List of usage examples for org.eclipse.jdt.core Flags isStatic
public static boolean isStatic(int flags)
static
modifier. From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.contentassist.FXGraphProposalProvider.java
License:Open Source License
private void collectStaticFields(List<IField> fields, IType type) throws JavaModelException { //FIXME Don't we have to check if the field is assignable??? for (IField f : type.getFields()) { if (Flags.isStatic(f.getFlags())) { fields.add(f);/*w w w. ja v a 2s . c o m*/ } } String s = type.getSuperclassName(); if (s != null) { String fqn = at.bestsolution.efxclipse.tooling.model.internal.utils.Util.getFQNType(type, Signature.getTypeErasure(s)); collectStaticFields(fields, type.getJavaProject().findType(fqn)); } }
From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.util.JDTHelper.java
License:Open Source License
private List<Proposal> getProposals(IType type, IJavaProject jp) { if (PROVIDERS.containsKey(type.getFullyQualifiedName())) { return PROVIDERS.get(type.getFullyQualifiedName()).getProposals(jp); } else {//from www . ja v a2 s . co m try { for (IMethod m : type.getMethods()) { if (Flags.isStatic(m.getFlags()) && "valueOf".equals(m.getElementName())) { Proposal p = new Proposal("\"<string>\""); p.hover = new HoverImpl(m); return Collections.singletonList(p); } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return Collections.emptyList(); }
From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.util.prop.KeyCombinationProvider.java
License:Open Source License
protected IMethod findMethod(IJavaProject jp) { try {//from w w w . ja va 2 s . c om IType t = jp.findType("javafx.scene.input.KeyCombination"); for (IMethod m : t.getMethods()) { if (Flags.isStatic(m.getFlags()) && "valueOf".equals(m.getElementName())) { return m; } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
From source file:at.bestsolution.efxclipse.tooling.fxgraph.ui.util.prop.PaintProposalProvider.java
License:Open Source License
protected IMethod findMethod(IJavaProject jp) { try {/*from ww w. j av a2 s.c o m*/ IType t = jp.findType("javafx.scene.paint.Color"); for (IMethod m : t.getMethods()) { if (Flags.isStatic(m.getFlags()) && "web".equals(m.getElementName()) && m.getParameters().length == 1) { return m; } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
From source file:at.bestsolution.efxclipse.tooling.model.internal.FXClass.java
License:Open Source License
@Override public IMethod getValueOf() { // if( ! valueOfResolved ) { try {// w w w .j a va 2 s . c om for (IMethod m : type.getMethods()) { if (Flags.isStatic(m.getFlags()) && Flags.isPublic(m.getFlags()) && "valueOf".equals(m.getElementName())) { if (m.getParameterTypes().length == 1) { // String fqnType = Util.toFQN((IType) m.getParent(),m.getParameterTypes()[0]); // if("java.lang.String".equals( fqnType) ) { valueOfMethod = m; break; // } } } } valueOfResolved = true; } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } // } return valueOfMethod; }
From source file:at.bestsolution.efxclipse.tooling.model.internal.FXObjectPoperty.java
License:Open Source License
public IMethod getValueOfMethod() { if (!valueOfMethodResolved) { try {/*from w w w. j av a 2 s.c o m*/ for (IMethod m : getElementType().getMethods()) { if (Flags.isStatic(m.getFlags()) && Flags.isPublic(m.getFlags()) && "valueOf".equals(m.getElementName())) { valueOfMethod = m; } } } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } valueOfMethodResolved = true; } return valueOfMethod; }
From source file:at.bestsolution.efxclipse.tooling.model.internal.utils.PropertiesUtil.java
License:Open Source License
public static Map<String, IFXProperty> resolveProperties(FXClass fxClass) throws JavaModelException { Map<String, IFXProperty> rv = new HashMap<String, IFXProperty>(); if ("java.lang.Object".equals(fxClass.getFQN())) { return rv; }/* www. ja v a 2 s . co m*/ Map<String, IMethod> beanProperties = new HashMap<String, IMethod>(); Map<String, IMethod> builderProperties = new HashMap<String, IMethod>(); String builder = fxClass.getType().getFullyQualifiedName() + "Builder"; IType builderType = fxClass.getJavaProject().findType(builder); if (builderType != null) { for (IMethod m : builderType.getMethods()) { // Only public and none static methods if (!Flags.isPublic(m.getFlags()) || Flags.isStatic(m.getFlags())) { continue; } String name = m.getElementName(); // omit the build method if ("build".equals(name) || "applyTo".equals(name)) { continue; } if (m.getParameterNames().length == 1) { String param = m.getParameterTypes()[0]; if (Signature.getArrayCount(param) == 0) { builderProperties.put(name, m); } } } } for (IMethod m : fxClass.getType().getMethods()) { // Only public and none static methods if (!Flags.isPublic(m.getFlags()) || Flags.isStatic(m.getFlags())) { continue; } String name = m.getElementName(); // do not use impl methods they are private if (name.startsWith("getImpl") || name.startsWith("isImpl") || name.startsWith("setImpl") || name.contains("Unmodifiable")) { continue; } if (name.startsWith("get") || name.startsWith("is")) { name = name.startsWith("get") ? name.substring(3) : name.substring(2); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); // Only set if there's not already one stored if (!beanProperties.containsKey(name)) { beanProperties.put(name, m); } } else if (m.getElementName().startsWith("set") && m.getParameters().length == 1) { name = name.substring(3); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); beanProperties.put(name, m); } } for (Entry<String, IMethod> e : beanProperties.entrySet()) { FXProperty p = getProperty(fxClass, e.getKey(), e.getValue()); if (p != null) { rv.put(e.getKey(), p); } } for (Entry<String, IMethod> e : builderProperties.entrySet()) { IFXProperty p = rv.get(e.getKey()); if (p == null) { continue; } if (!(p instanceof IFXCollectionProperty)) { if (!p.isSetable()) { p = getProperty(fxClass, e.getKey(), e.getValue()); if (p != null) { rv.put(e.getKey(), p); } } } } return rv; }
From source file:at.bestsolution.efxclipse.tooling.model.internal.utils.PropertiesUtil.java
License:Open Source License
public static Map<String, IFXProperty> resolveStaticProperties(FXClass fxClass) throws JavaModelException { Map<String, IFXProperty> rv = new HashMap<String, IFXProperty>(); if ("java.lang.Object".equals(fxClass.getFQN())) { return rv; }//from w w w . ja v a 2 s. com for (IMethod m : fxClass.getType().getMethods()) { if (!Flags.isPublic(m.getFlags()) || !Flags.isStatic(m.getFlags())) { continue; } String name = m.getElementName(); if (name.startsWith("setImpl")) { continue; } if (name.startsWith("set") && m.getParameterTypes().length == 2) { name = name.substring(3); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); FXProperty p = null; String signature = m.getParameterTypes()[1]; String genericType = Signature.toString(signature); if (FXPrimitiveProperty.isPrimitive(genericType)) { p = new FXPrimitiveProperty(fxClass, name, m, Type.parseType(genericType), true); } else { String erasedFQNType = Util.getFQNType((IType) m.getParent(), Signature.getTypeErasure(genericType)); if (erasedFQNType != null) { if (FXEnumProperty.isEnum(fxClass.getJavaProject(), erasedFQNType)) { p = new FXEnumProperty(fxClass, name, m, erasedFQNType, true); } else { p = new FXObjectPoperty(fxClass, name, m, erasedFQNType, true); } } } if (p != null) { rv.put(p.getName(), p); } } } return rv; }
From source file:at.bestsolution.fxide.jdt.corext.util.JdtFlags.java
License:Open Source License
public static boolean isAbstract(IMember member) throws JavaModelException { int flags = member.getFlags(); if (!member.isBinary() && isInterfaceOrAnnotationMethod(member)) { return !Flags.isStatic(flags) && !Flags.isDefaultMethod(flags); }/*from w ww. j a v a2 s.c om*/ return Flags.isAbstract(flags); }
From source file:at.bestsolution.fxide.jdt.corext.util.JdtFlags.java
License:Open Source License
public static boolean isStatic(IMember member) throws JavaModelException { if (isNestedInterfaceOrAnnotation(member)) return true; if (member.getElementType() != IJavaElement.METHOD && isInterfaceOrAnnotationMember(member)) return true; if (isEnum(member) && (member.getElementType() == IJavaElement.FIELD || member.getDeclaringType() != null)) return true; return Flags.isStatic(member.getFlags()); }