List of usage examples for org.eclipse.jdt.core Flags AccPublic
int AccPublic
To view the source code for org.eclipse.jdt.core Flags AccPublic.
Click Source Link
From source file:ac.at.tuwien.dsg.uml.stereotype.export.transformation.rules.DataTypeTransformationRule.java
License:Open Source License
public Object createTarget(ITransformContext context) { DOMFactory domFactory = new DOMFactory(); //create output content IDOMType target = domFactory.createClass(); /**/*w w w.ja va2 s .c om*/ * Get the transformation UML Class */ DataType dataType = (DataType) context.getSource(); target.setName(dataType.getName()); //get all properties for (Property attribute : dataType.getAllAttributes()) { String name = attribute.getName(); Type type = attribute.getType(); String typeName = type.getName(); org.eclipse.uml2.uml.Package packageType = type.getPackage(); /** * Create Java field/class variable for each attribute */ Namespace namespace = attribute.getNamespace(); IDOMField field = domFactory.createField(); field.setName(name); field.setFlags(Flags.AccPrivate); /** * In case the model is incomplete, we add the field with Object as type */ if (typeName == null) { field.setType("Object"); //add in the generated code a comment explaining why field type is Object field.setComment( "/*Type for attribute \"" + name + "\" on stereotype \"" + dataType + "\" is null */"); System.err .println("Type for attribute \"" + name + "\" on stereotype \"" + dataType + "\" is null"); } else { field.setType(typeName); } target.addChild(field); /** * Add setter/getter for the added field */ IDOMMethod setter = domFactory.createMethod(); /** * Capitalize the first letter of the variable name so we have nice camel-case */ setter.setName("set" + name.substring(0, 1).toUpperCase() + name.substring(1)); setter.setFlags(Flags.AccPublic); setter.setReturnType("void"); setter.addParameter(typeName, name); setter.setBody("{ \n this." + name + "=" + name + ";\n }"); target.addChild(setter); IDOMMethod getter = domFactory.createMethod(); getter.setName("get" + name.substring(0, 1).toUpperCase() + name.substring(1)); getter.setFlags(Flags.AccPublic); getter.setReturnType(typeName); getter.setBody("{ \n return this." + name + ";\n }"); target.addChild(getter); } //create Java file from UML class JavaClassOutputter.outputFile(context, target); return target; }
From source file:ac.at.tuwien.dsg.uml.stereotype.export.transformation.rules.SignalTransformationRule.java
License:Open Source License
public Object createTarget(ITransformContext context) { DOMFactory domFactory = new DOMFactory(); //create output content IDOMType target = domFactory.createClass(); /**/*from w w w.j av a 2s . com*/ * Get the transformation UML Class */ Signal signal = (Signal) context.getSource(); target.setName(signal.getName()); //get all properties for (Property attribute : signal.getAllAttributes()) { String name = attribute.getName(); Type type = attribute.getType(); String typeName = type.getName(); org.eclipse.uml2.uml.Package packageType = type.getPackage(); /** * Create Java field/class variable for each attribute */ Namespace namespace = attribute.getNamespace(); IDOMField field = domFactory.createField(); field.setName(name); field.setFlags(Flags.AccPrivate); /** * In case the model is incomplete, we add the field with Object as type */ if (typeName == null) { field.setType("Object"); //add in the generated code a comment explaining why field type is Object field.setComment( "/*Type for attribute \"" + name + "\" on stereotype \"" + signal + "\" is null */"); System.err.println("Type for attribute \"" + name + "\" on stereotype \"" + signal + "\" is null"); } else { field.setType(typeName); } target.addChild(field); /** * Add setter/getter for the added field */ IDOMMethod setter = domFactory.createMethod(); /** * Capitalize the first letter of the variable name so we have nice camel-case */ setter.setName("set" + name.substring(0, 1).toUpperCase() + name.substring(1)); setter.setFlags(Flags.AccPublic); setter.setReturnType("void"); setter.addParameter(typeName, name); setter.setBody("{ \n this." + name + "=" + name + ";\n }"); target.addChild(setter); IDOMMethod getter = domFactory.createMethod(); getter.setName("get" + name.substring(0, 1).toUpperCase() + name.substring(1)); getter.setFlags(Flags.AccPublic); getter.setReturnType(typeName); getter.setBody("{ \n return this." + name + ";\n }"); target.addChild(getter); } //create Java file from UML class JavaClassOutputter.outputFile(context, target); return target; }
From source file:ac.at.tuwien.dsg.uml.stereotype.export.transformation.rules.StereotypeTransformationRule.java
License:Open Source License
public Object createTarget(ITransformContext context) { DOMFactory domFactory = new DOMFactory(); //create output content IDOMType target = domFactory.createClass(); /**/*from www. j a v a 2 s . c o m*/ * Get the transformation UML Class */ Class umlCls = (Class) context.getSource(); target.setName(umlCls.getName()); Stereotype stereotype = (Stereotype) context.getSource(); //get all properties for (Property attribute : stereotype.getAllAttributes()) { String name = attribute.getName(); Type type = attribute.getType(); String typeName = type.getName(); org.eclipse.uml2.uml.Package packageType = type.getPackage(); /** * Create Java field/class variable for each attribute */ Namespace namespace = attribute.getNamespace(); IDOMField field = domFactory.createField(); field.setName(name); field.setFlags(Flags.AccPrivate); /** * In case the model is incomplete, we add the field with Object as type */ if (typeName == null) { field.setType("Object"); //add in the generated code a comment explaining why field type is Object field.setComment( "/*Type for attribute \"" + name + "\" on stereotype \"" + stereotype + "\" is null */"); System.err.println( "Type for attribute \"" + name + "\" on stereotype \"" + stereotype + "\" is null"); } else { field.setType(typeName); } target.addChild(field); /** * Add setter/getter for the added field */ IDOMMethod setter = domFactory.createMethod(); /** * Capitalize the first letter of the variable name so we have nice camel-case */ setter.setName("set" + name.substring(0, 1).toUpperCase() + name.substring(1)); setter.setFlags(Flags.AccPublic); setter.setReturnType("void"); setter.addParameter(typeName, name); setter.setBody("{ \n this." + name + "=" + name + ";\n }"); target.addChild(setter); IDOMMethod getter = domFactory.createMethod(); getter.setName("get" + name.substring(0, 1).toUpperCase() + name.substring(1)); getter.setFlags(Flags.AccPublic); getter.setReturnType(typeName); getter.setBody("{ \n return this." + name + ";\n }"); target.addChild(getter); } //create Java file from UML class JavaClassOutputter.outputFile(context, target); return target; }
From source file:ac.at.tuwien.dsg.uml2java.stereotype.export.ClassWithStereotypeExportRule.java
License:Open Source License
protected Object createTarget(ITransformContext context) { /**/* w ww. j a v a 2s . c o m*/ * Retrieve the target DOM generated by the UML2Java standard transformation */ DOMNode target = (DOMNode) context.getTarget(); /** * Create a DOMFactory to be used in instantiating new DOM elements */ DOMFactory domFactory = new DOMFactory(); /** * Get the transformation UML Class */ Class umlCls = (Class) context.getSource(); /** * We want to add something as default imports. Mainly org.eclipse.uml2.uml.* but maybe something more in the future. * To do that, as in this rule the Class java file is already partially generated by super ClassRule, we get its parent (i.e., the CompilationUnit), * remove all parent children (actually just one, the generated class), add all import statements we need, and add the removed children back. * * Otherwise the imports are added after the end of the class, which triggers compilation errors. */ List<IDOMNode> children = new ArrayList<>(); IDOMNode parent = target.getParent(); Enumeration enumeration = parent.getChildren(); //remove all parent children while (enumeration.hasMoreElements()) { IDOMNode node = (IDOMNode) enumeration.nextElement(); children.add(node); node.remove(); } //add all import statements for (String importStatement : defaultImports) { IDOMImport importEclipseUML = domFactory.createImport(); importEclipseUML.setName(importStatement); parent.addChild(importEclipseUML); } //add children back for (IDOMNode child : children) { parent.addChild(child); } /** * We go through all applied stereotypes and for each we go through each attribute, and create a class field. */ for (Stereotype stereotype : umlCls.getAppliedStereotypes()) { //get all properties for (Property attribute : stereotype.getAllAttributes()) { String name = attribute.getName(); Type type = attribute.getType(); String typeName = type.getName(); org.eclipse.uml2.uml.Package packageType = type.getPackage(); /** * Create Java field/class variable for each attribute */ Namespace namespace = attribute.getNamespace(); //create import statement for each added field // IDOMImport importStatement = domFactory.createImport(); // importStatement.setName(packageType+"."+typeName); // // target.addChild(importStatement); IDOMField field = domFactory.createField(); field.setName(name); field.setFlags(Flags.AccPrivate); /** * In case the model is incomplete, we add the field with Object as type */ if (typeName == null) { field.setType("Object"); //add in the generated code a comment explaining why field type is Object field.setComment("/*Type for attribute \"" + name + "\" on stereotype \"" + stereotype + "\" is null */"); System.err.println( "Type for attribute \"" + name + "\" on stereotype \"" + stereotype + "\" is null"); } else { field.setType(typeName); } target.addChild(field); /** * Add setter/getter for the added field */ IDOMMethod setter = domFactory.createMethod(); /** * Capitalize the first letter of the variable name so we have nice camel-case */ setter.setName("set" + name.substring(0, 1).toUpperCase() + name.substring(1)); setter.setFlags(Flags.AccPublic); setter.setReturnType("void"); setter.addParameter(typeName, name); setter.setBody("{ \n this." + name + "=" + name + ";\n }"); target.addChild(setter); IDOMMethod getter = domFactory.createMethod(); getter.setName("get" + name.substring(0, 1).toUpperCase() + name.substring(1)); getter.setFlags(Flags.AccPublic); getter.setReturnType(typeName); getter.setBody("{ \n return this." + name + ";\n }"); target.addChild(getter); } } return target; }
From source file:ca.uvic.chisel.javasketch.ui.internal.presentation.TraceThreadLabelProvider.java
License:Open Source License
@Override public Color getBackground(Object element) { if (element instanceof IActivation) { try {/*from www .j a va2s .co m*/ IJavaElement je = JavaSearchUtils.findElement((IActivation) element, new NullProgressMonitor()); if (je instanceof IMethod) { IMethod method = (IMethod) je; int flags = method.getFlags(); if ((flags & Flags.AccPrivate) != 0) { return ISketchColorConstants.PRIVATE_BG; } else if ((flags & Flags.AccProtected) != 0) { return ISketchColorConstants.PROTECTED_BG; } else if ((flags & Flags.AccDefault) != 0) { return ISketchColorConstants.FRIEND_BG; } else if ((flags & Flags.AccPublic) != 0) { return ISketchColorConstants.PUBLIC_BG; } } } catch (JavaModelException e) { } catch (InterruptedException e) { } catch (CoreException e) { } catch (Exception e) { } } else if (element instanceof String) { return ISketchColorConstants.PACKAGE; } return null; }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.BasicSearchEngine.java
License:Open Source License
public void searchAllConstructorDeclarations(final char[] packageName, final char[] typeName, final int typeMatchRule, IJavaSearchScope scope, final IRestrictedAccessConstructorRequestor nameRequestor, int waitingPolicy, IProgressMonitor progressMonitor) throws JavaModelException { // Validate match rule first final int validatedTypeMatchRule = SearchPattern .validateMatchRule(typeName == null ? null : new String(typeName), typeMatchRule); final int pkgMatchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE; final char NoSuffix = IIndexConstants.TYPE_SUFFIX; // Used as TYPE_SUFFIX has no effect in method #match(char, char[] , int, char[], int , int, char[], char[]) // Debug// w w w . j a v a 2 s. c om if (VERBOSE) { Util.verbose( "BasicSearchEngine.searchAllConstructorDeclarations(char[], char[], int, IJavaSearchScope, IRestrictedAccessConstructorRequestor, int, IProgressMonitor)"); //$NON-NLS-1$ Util.verbose(" - package name: " + (packageName == null ? "null" : new String(packageName))); //$NON-NLS-1$ //$NON-NLS-2$ Util.verbose(" - type name: " + (typeName == null ? "null" : new String(typeName))); //$NON-NLS-1$ //$NON-NLS-2$ Util.verbose(" - type match rule: " + getMatchRuleString(typeMatchRule)); //$NON-NLS-1$ if (validatedTypeMatchRule != typeMatchRule) { Util.verbose(" - validated type match rule: " + getMatchRuleString(validatedTypeMatchRule)); //$NON-NLS-1$ } Util.verbose(" - scope: " + scope); //$NON-NLS-1$ } if (validatedTypeMatchRule == -1) return; // invalid match rule => return no results // Create pattern final ConstructorDeclarationPattern pattern = new ConstructorDeclarationPattern(packageName, typeName, validatedTypeMatchRule); // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor final HashSet workingCopyPaths = new HashSet(); String workingCopyPath = null; ICompilationUnit[] copies = getWorkingCopies(); final int copiesLength = copies == null ? 0 : copies.length; if (copies != null) { if (copiesLength == 1) { workingCopyPath = copies[0].getPath().toString(); } else { for (int i = 0; i < copiesLength; i++) { ICompilationUnit workingCopy = copies[i]; workingCopyPaths.add(workingCopy.getPath().toString()); } } } final String singleWkcpPath = workingCopyPath; // Index requestor IndexQueryRequestor searchRequestor = new IndexQueryRequestor() { public boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access) { // Filter unexpected types ConstructorDeclarationPattern record = (ConstructorDeclarationPattern) indexRecord; if ((record.extraFlags & ExtraFlags.IsMemberType) != 0) { return true; // filter out member classes } if ((record.extraFlags & ExtraFlags.IsLocalType) != 0) { return true; // filter out local and anonymous classes } switch (copiesLength) { case 0: break; case 1: if (singleWkcpPath.equals(documentPath)) { return true; // filter out *the* working copy } break; default: if (workingCopyPaths.contains(documentPath)) { return true; // filter out working copies } break; } // Accept document path AccessRestriction accessRestriction = null; if (access != null) { // Compute document relative path int pkgLength = (record.declaringPackageName == null || record.declaringPackageName.length == 0) ? 0 : record.declaringPackageName.length + 1; int nameLength = record.declaringSimpleName == null ? 0 : record.declaringSimpleName.length; char[] path = new char[pkgLength + nameLength]; int pos = 0; if (pkgLength > 0) { System.arraycopy(record.declaringPackageName, 0, path, pos, pkgLength - 1); CharOperation.replace(path, '.', '/'); path[pkgLength - 1] = '/'; pos += pkgLength; } if (nameLength > 0) { System.arraycopy(record.declaringSimpleName, 0, path, pos, nameLength); pos += nameLength; } // Update access restriction if path is not empty if (pos > 0) { accessRestriction = access.getViolatedRestriction(path); } } nameRequestor.acceptConstructor(record.modifiers, record.declaringSimpleName, record.parameterCount, record.signature, record.parameterTypes, record.parameterNames, record.declaringTypeModifiers, record.declaringPackageName, record.extraFlags, documentPath, accessRestriction); return true; } }; try { if (progressMonitor != null) { progressMonitor.beginTask(Messages.engine_searching, 1000); } // add type names from indexes indexManager.performConcurrentJob( new PatternSearchJob(pattern, getDefaultSearchParticipant(indexManager), // Java search only scope, searchRequestor, indexManager), waitingPolicy, progressMonitor == null ? null : new SubProgressMonitor(progressMonitor, 1000 - copiesLength)); // add type names from working copies if (copies != null) { for (int i = 0; i < copiesLength; i++) { final ICompilationUnit workingCopy = copies[i]; if (scope instanceof HierarchyScope) { if (!((HierarchyScope) scope).encloses(workingCopy, progressMonitor)) continue; } else { if (!scope.encloses(workingCopy)) continue; } final String path = workingCopy.getPath().toString(); if (workingCopy.isConsistent()) { IPackageDeclaration[] packageDeclarations = workingCopy.getPackageDeclarations(); char[] packageDeclaration = packageDeclarations.length == 0 ? CharOperation.NO_CHAR : packageDeclarations[0].getElementName().toCharArray(); IType[] allTypes = workingCopy.getAllTypes(); for (int j = 0, allTypesLength = allTypes.length; j < allTypesLength; j++) { IType type = allTypes[j]; char[] simpleName = type.getElementName().toCharArray(); if (match(NoSuffix, packageName, pkgMatchRule, typeName, validatedTypeMatchRule, 0/*no kind*/, packageDeclaration, simpleName) && !type.isMember()) { int extraFlags = ExtraFlags.getExtraFlags(type); boolean hasConstructor = false; IMethod[] methods = type.getMethods(); for (int k = 0; k < methods.length; k++) { IMethod method = methods[k]; if (method.isConstructor()) { hasConstructor = true; String[] stringParameterNames = method.getParameterNames(); String[] stringParameterTypes = method.getParameterTypes(); int length = stringParameterNames.length; char[][] parameterNames = new char[length][]; char[][] parameterTypes = new char[length][]; for (int l = 0; l < length; l++) { parameterNames[l] = stringParameterNames[l].toCharArray(); parameterTypes[l] = Signature.toCharArray(Signature .getTypeErasure(stringParameterTypes[l]).toCharArray()); } nameRequestor.acceptConstructor(method.getFlags(), simpleName, parameterNames.length, null, // signature is not used for source type parameterTypes, parameterNames, type.getFlags(), packageDeclaration, extraFlags, path, null); } } if (!hasConstructor) { nameRequestor.acceptConstructor(Flags.AccPublic, simpleName, -1, null, // signature is not used for source type CharOperation.NO_CHAR_CHAR, CharOperation.NO_CHAR_CHAR, type.getFlags(), packageDeclaration, extraFlags, path, null); } } } } else { Parser basicParser = getParser(); org.eclipse.jdt.internal.compiler.env.ICompilationUnit unit = (org.eclipse.jdt.internal.compiler.env.ICompilationUnit) workingCopy; CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, this.compilerOptions.maxProblemsPerUnit); CompilationUnitDeclaration parsedUnit = basicParser.dietParse(unit, compilationUnitResult); if (parsedUnit != null) { final char[] packageDeclaration = parsedUnit.currentPackage == null ? CharOperation.NO_CHAR : CharOperation.concatWith(parsedUnit.currentPackage.getImportName(), '.'); class AllConstructorDeclarationsVisitor extends ASTVisitor { private TypeDeclaration[] declaringTypes = new TypeDeclaration[0]; private int declaringTypesPtr = -1; private void endVisit(TypeDeclaration typeDeclaration) { if (!hasConstructor(typeDeclaration) && typeDeclaration.enclosingType == null) { if (match(NoSuffix, packageName, pkgMatchRule, typeName, validatedTypeMatchRule, 0/*no kind*/, packageDeclaration, typeDeclaration.name)) { nameRequestor.acceptConstructor(Flags.AccPublic, typeName, -1, null, // signature is not used for source type CharOperation.NO_CHAR_CHAR, CharOperation.NO_CHAR_CHAR, typeDeclaration.modifiers, packageDeclaration, ExtraFlags.getExtraFlags(typeDeclaration), path, null); } } this.declaringTypes[this.declaringTypesPtr] = null; this.declaringTypesPtr--; } public void endVisit(TypeDeclaration typeDeclaration, CompilationUnitScope s) { endVisit(typeDeclaration); } public void endVisit(TypeDeclaration memberTypeDeclaration, ClassScope s) { endVisit(memberTypeDeclaration); } private boolean hasConstructor(TypeDeclaration typeDeclaration) { AbstractMethodDeclaration[] methods = typeDeclaration.methods; int length = methods == null ? 0 : methods.length; for (int j = 0; j < length; j++) { if (methods[j].isConstructor()) { return true; } } return false; } public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope classScope) { TypeDeclaration typeDeclaration = this.declaringTypes[this.declaringTypesPtr]; if (match(NoSuffix, packageName, pkgMatchRule, typeName, validatedTypeMatchRule, 0/*no kind*/, packageDeclaration, typeDeclaration.name)) { Argument[] arguments = constructorDeclaration.arguments; int length = arguments == null ? 0 : arguments.length; char[][] parameterNames = new char[length][]; char[][] parameterTypes = new char[length][]; for (int l = 0; l < length; l++) { Argument argument = arguments[l]; parameterNames[l] = argument.name; if (argument.type instanceof SingleTypeReference) { parameterTypes[l] = ((SingleTypeReference) argument.type).token; } else { parameterTypes[l] = CharOperation.concatWith( ((QualifiedTypeReference) argument.type).tokens, '.'); } } TypeDeclaration enclosing = typeDeclaration.enclosingType; char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR; while (enclosing != null) { enclosingTypeNames = CharOperation.arrayConcat( new char[][] { enclosing.name }, enclosingTypeNames); if ((enclosing.bits & ASTNode.IsMemberType) != 0) { enclosing = enclosing.enclosingType; } else { enclosing = null; } } nameRequestor.acceptConstructor(constructorDeclaration.modifiers, typeName, parameterNames.length, null, // signature is not used for source type parameterTypes, parameterNames, typeDeclaration.modifiers, packageDeclaration, ExtraFlags.getExtraFlags(typeDeclaration), path, null); } return false; // no need to find constructors from local/anonymous type } public boolean visit(TypeDeclaration typeDeclaration, BlockScope blockScope) { return false; } private boolean visit(TypeDeclaration typeDeclaration) { if (this.declaringTypes.length <= ++this.declaringTypesPtr) { int length = this.declaringTypesPtr; System.arraycopy(this.declaringTypes, 0, this.declaringTypes = new TypeDeclaration[length * 2 + 1], 0, length); } this.declaringTypes[this.declaringTypesPtr] = typeDeclaration; return true; } public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope s) { return visit(typeDeclaration); } public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope s) { return visit(memberTypeDeclaration); } } parsedUnit.traverse(new AllConstructorDeclarationsVisitor(), parsedUnit.scope); } } if (progressMonitor != null) { if (progressMonitor.isCanceled()) throw new OperationCanceledException(); progressMonitor.worked(1); } } } } finally { if (progressMonitor != null) { progressMonitor.done(); } } }
From source file:com.google.gdt.eclipse.appengine.rpc.util.JavaUtils.java
License:Open Source License
public static Image getFieldImage(int flags) { // TODO: can we remove this discouraged reference? ImageDescriptor desc = JavaElementImageProvider.getFieldImageDescriptor(false, Flags.AccPublic); int adornmentFlags = Flags.isStatic(flags) ? JavaElementImageDescriptor.STATIC : 0; desc = new JavaElementImageDescriptor(desc, adornmentFlags, JavaElementImageProvider.BIG_SIZE); // TODO: can we remove this discouraged reference? return JavaPlugin.getImageDescriptorRegistry().get(desc); }
From source file:com.halware.nakedide.eclipse.core.util.MethodUtils.java
License:Open Source License
public static boolean isPublic(MethodDeclaration methodDeclaration) { if ((methodDeclaration.getModifiers() & Flags.AccPublic) == Flags.AccPublic) { return true; }/*ww w. j a va 2s .co m*/ return false; // Here's a clumsier way of achieving the same: // ChildListPropertyDescriptor modifiersProperty = methodDeclaration.getModifiersProperty(); // List<ASTNode> modifiers = // Generics.asT(methodDeclaration.getStructuralProperty(modifiersProperty)); // boolean publicFound = false; // for(ASTNode node: modifiers) { // if (!publicFound) { // if (node instanceof Modifier) { // Modifier modifier = (Modifier)node; // publicFound = (modifier.getKeyword() == ModifierKeyword.PUBLIC_KEYWORD); // } // } // } }
From source file:com.halware.nakedide.eclipse.ext.builders.checkers.MethodChecker.java
License:Open Source License
public void checkPrefixes() throws CoreException { if (prefix == null) { return;/*www . j av a 2s .c o m*/ } if (type.isInterface()) { return; } int flags = method.getFlags(); if ((flags & Flags.AccPublic) != Flags.AccPublic) { return; } memberName = MethodUtils.unprefixed(method, prefix); propertyOrCollectionAccessorMethodName = MethodUtils.accessorMethodNameFor(memberName); actionMethodName = MethodUtils.actionMethodNameFor(memberName); propertyOrCollectionAccessorMethod = TypeUtils.findMethodSearchingSuperclasses(type, propertyOrCollectionAccessorMethodName, new String[] {}); foundPropertyOrCollection = propertyOrCollectionAccessorMethod != null; if (foundPropertyOrCollection) { foundAction = false; } else { actionMethod = TypeUtils.findMethodSearchingSuperclasses(type, actionMethodName, method.getParameterTypes()); if (actionMethod == null) { actionMethod = TypeUtils.findMethodSearchingSuperclasses(type, actionMethodName); } foundAction = actionMethod != null; } // if no joy, we might be trying to match one of the supporting action methods // (disable, hide, default, choices) with a no-arg. If so, attempt a more liberal search for // an action based only on the action name. if (!foundPropertyOrCollection && !foundAction) { if (method.getParameterTypes().length == 0 && MethodUtils.in(prefix, Constants.ACTION_NO_ARG_SUPPORTING_PREFIXES)) { IMethod[] methods = type.getMethods(); for (IMethod method : methods) { if (method.getElementName().equals(actionMethodName)) { actionMethod = method; foundAction = true; } } } } isPropertyType = true; isCollectionType = false; returnTypeSig = null; paramTypeSigs = null; referencedTypeSig = null; referencedParamTypeSigs = null; if (foundPropertyOrCollection) { returnTypeSig = propertyOrCollectionAccessorMethod.getReturnType(); paramTypeSigs = new String[] { returnTypeSig }; isCollectionType = MethodUtils.isCollectionTypeQSig(returnTypeSig); isPropertyType = !isCollectionType; if (isCollectionType) { referencedTypeSig = MethodUtils.collectionTypeQSig(returnTypeSig); referencedParamTypeSigs = new String[] { referencedTypeSig }; } } if (foundAction) { paramTypeSigs = actionMethod.getParameterTypes(); } if (foundPropertyOrCollection && foundAction) { createProblemMarker(method, MarkerConstants.ID_AMBIGUOUS_METHOD, "Ambiguous method (could represent both a " + propertyOrCollection(isPropertyType) + " and an action)"); return; } if (prefix.equals(Constants.PREFIX_GET)) { // no additional checks } else if (prefix.equals(Constants.PREFIX_SET)) { checkSetPrefix(); } else if (prefix.equals(Constants.PREFIX_MODIFY)) { checkModifyPrefix(); } else if (prefix.equals(Constants.PREFIX_CLEAR)) { checkClearPrefix(); } else if (prefix.equals(Constants.PREFIX_ADD_TO)) { checkAddToPrefix(); } else if (prefix.equals(Constants.PREFIX_REMOVE_FROM)) { checkRemoveFromPrefix(); } else if (prefix.equals(Constants.PREFIX_VALIDATE)) { checkValidatePrefix(); } else if (prefix.equals(Constants.PREFIX_VALIDATE_ADD_TO)) { checkValidateAddToPrefix(); } else if (prefix.equals(Constants.PREFIX_VALIDATE_REMOVE_FROM)) { checkValidateRemoveFromPrefix(); } else if (prefix.equals(Constants.PREFIX_DISABLE)) { checkDisablePrefix(); } else if (prefix.equals(Constants.PREFIX_HIDE)) { checkHidePrefix(); } else if (prefix.equals(Constants.PREFIX_DEFAULT)) { checkDefaultPrefix(); } else if (prefix.equals(Constants.PREFIX_CHOICES)) { checkChoicesPrefix(); } }
From source file:com.salesforce.ide.ui.editors.apex.outline.icon.ModifierFlagsBitFlipper.java
License:Open Source License
@Override public void _case(PublicModifier x) { accessorFlag_JVM |= Flags.AccPublic; }