Java Code Examples for org.eclipse.jdt.core.dom.Modifier#PRIVATE

The following examples show how to use org.eclipse.jdt.core.dom.Modifier#PRIVATE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdtFlags.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Compares two visibilities.
 *
 * @param newVisibility the 'new' visibility
 * @param oldVisibility the 'old' visibility
 * @return <code>true</code> iff the 'new' visibility is strictly higher than the old visibility
 *
 * @see Modifier#PUBLIC
 * @see Modifier#PROTECTED
 * @see Modifier#NONE
 * @see Modifier#PRIVATE
 */
public static boolean isHigherVisibility(int newVisibility, int oldVisibility){
	assertVisibility(oldVisibility);
	assertVisibility(newVisibility);
	switch (oldVisibility) {
		case Modifier.PRIVATE :
			return 	newVisibility == Modifier.NONE
					||	newVisibility == Modifier.PUBLIC
					||  newVisibility == Modifier.PROTECTED;
		case Modifier.NONE :
			return 	newVisibility == Modifier.PUBLIC
					||  newVisibility == Modifier.PROTECTED;

		case Modifier.PROTECTED :
			return newVisibility == Modifier.PUBLIC;

		case Modifier.PUBLIC :
			return false;
		default:
			Assert.isTrue(false);
			return false;
	}
}
 
Example 2
Source File: JdtFlags.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Compares two visibilities.
 *
 * @param newVisibility the 'new' visibility
 * @param oldVisibility the 'old' visibility
 * @return <code>true</code> iff the 'new' visibility is strictly higher than the old visibility
 *
 * @see Modifier#PUBLIC
 * @see Modifier#PROTECTED
 * @see Modifier#NONE
 * @see Modifier#PRIVATE
 */
public static boolean isHigherVisibility(int newVisibility, int oldVisibility){
	assertVisibility(oldVisibility);
	assertVisibility(newVisibility);
	switch (oldVisibility) {
		case Modifier.PRIVATE :
			return 	newVisibility == Modifier.NONE
					||	newVisibility == Modifier.PUBLIC
					||  newVisibility == Modifier.PROTECTED;
		case Modifier.NONE :
			return 	newVisibility == Modifier.PUBLIC
					||  newVisibility == Modifier.PROTECTED;

		case Modifier.PROTECTED :
			return newVisibility == Modifier.PUBLIC;

		case Modifier.PUBLIC :
			return false;
		default:
			Assert.isTrue(false);
			return false;
	}
}
 
Example 3
Source File: ExtractFieldRefactoring.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
public ExtractFieldRefactoring(CompilationUnit astRoot, int selectionStart, int selectionLength) {
	Assert.isTrue(selectionStart >= 0);
	Assert.isTrue(selectionLength >= 0);
	Assert.isTrue(astRoot.getTypeRoot() instanceof ICompilationUnit);

	fSelectionStart = selectionStart;
	fSelectionLength = selectionLength;
	fCu = (ICompilationUnit) astRoot.getTypeRoot();
	fCompilationUnitNode = astRoot;

	fDeclareFinal = false;
	fDeclareStatic = false;
	fFieldName = ""; //$NON-NLS-1$

	fLinkedProposalModel = null;
	fVisibility = Modifier.PRIVATE;
	fInitializeIn = INITIALIZE_IN_METHOD;
}
 
Example 4
Source File: ChangeSignatureProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private RefactoringStatus checkVisibilityChanges() throws JavaModelException {
	if (isVisibilitySameAsInitial())
		return null;
    if (fRippleMethods.length == 1)
    	return null;
    Assert.isTrue(JdtFlags.getVisibilityCode(fMethod) != Modifier.PRIVATE);
    if (fVisibility == Modifier.PRIVATE)
    	return RefactoringStatus.createWarningStatus(RefactoringCoreMessages.ChangeSignatureRefactoring_non_virtual);
	return null;
}
 
Example 5
Source File: PromoteTempToFieldRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void initializeDefaults() {
    fVisibility= Modifier.PRIVATE;
    fDeclareStatic= Modifier.isStatic(getMethodDeclaration().getModifiers());
    fDeclareFinal= false;
    if (canEnableSettingDeclareInMethod())
     fInitializeIn= INITIALIZE_IN_METHOD;
 else if (canEnableSettingDeclareInFieldDeclaration())
     fInitializeIn= INITIALIZE_IN_FIELD;
 else if (canEnableSettingDeclareInConstructors())
     fInitializeIn= INITIALIZE_IN_CONSTRUCTOR;
}
 
Example 6
Source File: NewVariableCorrectionProposal.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private int evaluateFieldModifiers(ASTNode newTypeDecl) {
	if (fSenderBinding.isAnnotation()) {
		return 0;
	}
	if (fSenderBinding.isInterface()) {
		// for interface members copy the modifiers from an existing field
		FieldDeclaration[] fieldDecls= ((TypeDeclaration) newTypeDecl).getFields();
		if (fieldDecls.length > 0) {
			return fieldDecls[0].getModifiers();
		}
		return 0;
	}
	int modifiers= 0;

	if (fVariableKind == CONST_FIELD) {
		modifiers |= Modifier.FINAL | Modifier.STATIC;
	} else {
		ASTNode parent= fOriginalNode.getParent();
		if (parent instanceof QualifiedName) {
			IBinding qualifierBinding= ((QualifiedName)parent).getQualifier().resolveBinding();
			if (qualifierBinding instanceof ITypeBinding) {
				modifiers |= Modifier.STATIC;
			}
		} else if (ASTResolving.isInStaticContext(fOriginalNode)) {
			modifiers |= Modifier.STATIC;
		}
	}
	ASTNode node= ASTResolving.findParentType(fOriginalNode, true);
	if (newTypeDecl.equals(node)) {
		modifiers |= Modifier.PRIVATE;
	} else if (node instanceof AnonymousClassDeclaration) {
		modifiers |= Modifier.PROTECTED;
	} else {
		modifiers |= Modifier.PUBLIC;
	}

	return modifiers;
}
 
Example 7
Source File: NewVariableCorrectionProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int evaluateFieldModifiers(ASTNode newTypeDecl) {
	if (fSenderBinding.isAnnotation()) {
		return 0;
	}
	if (fSenderBinding.isInterface()) {
		// for interface members copy the modifiers from an existing field
		FieldDeclaration[] fieldDecls= ((TypeDeclaration) newTypeDecl).getFields();
		if (fieldDecls.length > 0) {
			return fieldDecls[0].getModifiers();
		}
		return 0;
	}
	int modifiers= 0;

	if (fVariableKind == CONST_FIELD) {
		modifiers |= Modifier.FINAL | Modifier.STATIC;
	} else {
		ASTNode parent= fOriginalNode.getParent();
		if (parent instanceof QualifiedName) {
			IBinding qualifierBinding= ((QualifiedName)parent).getQualifier().resolveBinding();
			if (qualifierBinding instanceof ITypeBinding) {
				modifiers |= Modifier.STATIC;
			}
		} else if (ASTResolving.isInStaticContext(fOriginalNode)) {
			modifiers |= Modifier.STATIC;
		}
	}
	ASTNode node= ASTResolving.findParentType(fOriginalNode, true);
	if (newTypeDecl.equals(node)) {
		modifiers |= Modifier.PRIVATE;
	} else if (node instanceof AnonymousClassDeclaration) {
		modifiers |= Modifier.PROTECTED;
	} else {
		modifiers |= Modifier.PUBLIC;
	}

	return modifiers;
}
 
Example 8
Source File: JdtFlags.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static int getVisibilityCode(IBinding binding) {
	if (isPublic(binding))
		return Modifier.PUBLIC;
	else if (isProtected(binding))
		return Modifier.PROTECTED;
	else if (isPackageVisible(binding))
		return Modifier.NONE;
	else if (isPrivate(binding))
		return Modifier.PRIVATE;
	Assert.isTrue(false);
	return VISIBILITY_CODE_INVALID;
}
 
Example 9
Source File: ExtractConstantRefactoring.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private ExtractConstantDescriptor createRefactoringDescriptor() {
	final Map<String, String> arguments = new HashMap<>();
	String project = null;
	IJavaProject javaProject = fCu.getJavaProject();
	if (javaProject != null) {
		project = javaProject.getElementName();
	}
	int flags = JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
	if (JdtFlags.getVisibilityCode(fVisibility) != Modifier.PRIVATE) {
		flags |= RefactoringDescriptor.STRUCTURAL_CHANGE;
	}

	final String expression = ASTNodes.asString(fSelectedExpression.getAssociatedExpression());
	final String description = Messages.format(RefactoringCoreMessages.ExtractConstantRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fConstantName));
	final String header = Messages.format(RefactoringCoreMessages.ExtractConstantRefactoring_descriptor_description,
			new String[] { BasicElementLabels.getJavaElementName(fConstantName), BasicElementLabels.getJavaCodeString(expression) });
	final JDTRefactoringDescriptorComment comment = new JDTRefactoringDescriptorComment(project, this, header);
	comment.addSetting(Messages.format(RefactoringCoreMessages.ExtractConstantRefactoring_constant_name_pattern, BasicElementLabels.getJavaElementName(fConstantName)));
	comment.addSetting(Messages.format(RefactoringCoreMessages.ExtractConstantRefactoring_constant_expression_pattern, BasicElementLabels.getJavaCodeString(expression)));
	String visibility = fVisibility;
	if ("".equals(visibility)) {
		visibility = RefactoringCoreMessages.ExtractConstantRefactoring_default_visibility;
	}
	comment.addSetting(Messages.format(RefactoringCoreMessages.ExtractConstantRefactoring_visibility_pattern, visibility));
	if (fReplaceAllOccurrences) {
		comment.addSetting(RefactoringCoreMessages.ExtractConstantRefactoring_replace_occurrences);
	}
	if (fQualifyReferencesWithDeclaringClassName) {
		comment.addSetting(RefactoringCoreMessages.ExtractConstantRefactoring_qualify_references);
	}
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fCu));
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fConstantName);
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
	arguments.put(ATTRIBUTE_REPLACE, Boolean.valueOf(fReplaceAllOccurrences).toString());
	arguments.put(ATTRIBUTE_QUALIFY, Boolean.valueOf(fQualifyReferencesWithDeclaringClassName).toString());
	arguments.put(ATTRIBUTE_VISIBILITY, new Integer(JdtFlags.getVisibilityCode(fVisibility)).toString());

	ExtractConstantDescriptor descriptor = RefactoringSignatureDescriptorFactory.createExtractConstantDescriptor(project, description, comment.asString(), arguments, flags);
	return descriptor;
}
 
Example 10
Source File: ExtractFieldRefactoring.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private void initializeDefaults() throws JavaModelException {
	fVisibility = Modifier.PRIVATE;
	fDeclareStatic = isDeclaredInStaticMethod();
	fDeclareFinal = false;
	if (canEnableSettingDeclareInMethod()) {
		fInitializeIn = INITIALIZE_IN_METHOD;
	} else if (canEnableSettingDeclareInFieldDeclaration()) {
		fInitializeIn = INITIALIZE_IN_FIELD;
	} else if (canEnableSettingDeclareInConstructors()) {
		fInitializeIn = INITIALIZE_IN_CONSTRUCTOR;
	}
}
 
Example 11
Source File: ChangeSignatureWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private String getAccessModifierString(int modifier) {
	switch (modifier) {
		case Modifier.PUBLIC :
			return JdtFlags.VISIBILITY_STRING_PUBLIC;
		case Modifier.PROTECTED :
			return JdtFlags.VISIBILITY_STRING_PROTECTED;
		case Modifier.NONE :
			return RefactoringMessages.ChangeSignatureInputPage_default;
		case Modifier.PRIVATE :
			return JdtFlags.VISIBILITY_STRING_PRIVATE;
		default :
			throw new IllegalArgumentException("\"" + modifier + "\" is not a Modifier constant"); //$NON-NLS-1$ //$NON-NLS-2$
	}
}
 
Example 12
Source File: SelfEncapsulateFieldRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int createModifiers() throws JavaModelException {
	int result= 0;
	if (Flags.isPublic(fVisibility))
		result |= Modifier.PUBLIC;
	else if (Flags.isProtected(fVisibility))
		result |= Modifier.PROTECTED;
	else if (Flags.isPrivate(fVisibility))
		result |= Modifier.PRIVATE;
	if (JdtFlags.isStatic(fField))
		result |= Modifier.STATIC;
	return result;
}
 
Example 13
Source File: ConvertAnonymousToNestedRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public int[] getAvailableVisibilities() {
    if (isLocalInnerType()) {
        return new int[] { Modifier.NONE };
    } else {
        return new int[] { Modifier.PUBLIC, Modifier.PROTECTED, Modifier.NONE, Modifier.PRIVATE };
    }
}
 
Example 14
Source File: JdtFlags.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public static int getVisibilityCode(IMember member) throws JavaModelException {
	if (isPublic(member)) {
		return Modifier.PUBLIC;
	} else if (isProtected(member)) {
		return Modifier.PROTECTED;
	} else if (isPackageVisible(member)) {
		return Modifier.NONE;
	} else if (isPrivate(member)) {
		return Modifier.PRIVATE;
	}
	Assert.isTrue(false);
	return VISIBILITY_CODE_INVALID;
}
 
Example 15
Source File: TokenModifiers.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean applies(IBinding binding) {
    int flags = binding.getModifiers();
    if ((flags & Modifier.PRIVATE) != 0) {
        return true;
    }
    return false;
}
 
Example 16
Source File: SourceActionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected Composite createVisibilityControl(Composite parent, final IVisibilityChangeListener visibilityChangeListener, int[] availableVisibilities, int correctVisibility) {
	fAllowedVisibilities= convertToIntegerList(availableVisibilities);
	if (fAllowedVisibilities.size() == 1)
		return null;

	Group group= new Group(parent, SWT.NONE);
	group.setText(ActionMessages.SourceActionDialog_modifier_group);
	GridData gd= new GridData(GridData.FILL_BOTH);
	group.setLayoutData(gd);
	GridLayout layout= new GridLayout();
	layout.makeColumnsEqualWidth= true;
	layout.numColumns= 4;
	group.setLayout(layout);

	String[] labels= new String[] {
		ActionMessages.SourceActionDialog_modifier_public,
		ActionMessages.SourceActionDialog_modifier_protected,
		ActionMessages.SourceActionDialog_modifier_default,
		ActionMessages.SourceActionDialog_modifier_private,
	};
	Integer[] data= new Integer[] {
				new Integer(Modifier.PUBLIC),
				new Integer(Modifier.PROTECTED),
				new Integer(Modifier.NONE),
				new Integer(Modifier.PRIVATE)};
	Integer initialVisibility= new Integer(correctVisibility);
	for (int i= 0; i < labels.length; i++) {
		Button radio= new Button(group, SWT.RADIO);
		Integer visibilityCode= data[i];
		radio.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
		radio.setText(labels[i]);
		radio.setData(visibilityCode);
		radio.setSelection(visibilityCode.equals(initialVisibility));
		radio.setEnabled(fAllowedVisibilities.contains(visibilityCode));
		radio.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent event) {
				visibilityChangeListener.visibilityChanged(((Integer)event.widget.getData()).intValue());
			}
		});
	}
	return group;
}
 
Example 17
Source File: AssignToVariableAssistProposal.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
private ASTRewrite doAddField(ASTRewrite rewrite, ASTNode nodeToAssign, ITypeBinding typeBinding, int index) {
	boolean isParamToField= nodeToAssign.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION;

	ASTNode newTypeDecl= ASTResolving.findParentType(nodeToAssign);
	if (newTypeDecl == null) {
		return null;
	}

	Expression expression= isParamToField ? ((SingleVariableDeclaration) nodeToAssign).getName() : ((ExpressionStatement) nodeToAssign).getExpression();

	AST ast= newTypeDecl.getAST();

	createImportRewrite((CompilationUnit) nodeToAssign.getRoot());

	BodyDeclaration bodyDecl= ASTResolving.findParentBodyDeclaration(nodeToAssign);
	Block body;
	if (bodyDecl instanceof MethodDeclaration) {
		body= ((MethodDeclaration) bodyDecl).getBody();
	} else if (bodyDecl instanceof Initializer) {
		body= ((Initializer) bodyDecl).getBody();
	} else {
		return null;
	}

	IJavaProject project= getCompilationUnit().getJavaProject();
	boolean isAnonymous= newTypeDecl.getNodeType() == ASTNode.ANONYMOUS_CLASS_DECLARATION;
	boolean isStatic= Modifier.isStatic(bodyDecl.getModifiers()) && !isAnonymous;
	int modifiers= Modifier.PRIVATE;
	if (isStatic) {
		modifiers |= Modifier.STATIC;
	}

	VariableDeclarationFragment newDeclFrag= addFieldDeclaration(rewrite, newTypeDecl, modifiers, expression, nodeToAssign, typeBinding, index);
	String varName= newDeclFrag.getName().getIdentifier();

	Assignment assignment= ast.newAssignment();
	assignment.setRightHandSide((Expression) rewrite.createCopyTarget(expression));

	boolean needsThis= StubUtility.useThisForFieldAccess(project);
	if (isParamToField) {
		needsThis |= varName.equals(((SimpleName) expression).getIdentifier());
	}

	SimpleName accessName= ast.newSimpleName(varName);
	if (needsThis) {
		FieldAccess fieldAccess= ast.newFieldAccess();
		fieldAccess.setName(accessName);
		if (isStatic) {
			String typeName= ((AbstractTypeDeclaration) newTypeDecl).getName().getIdentifier();
			fieldAccess.setExpression(ast.newSimpleName(typeName));
		} else {
			fieldAccess.setExpression(ast.newThisExpression());
		}
		assignment.setLeftHandSide(fieldAccess);
	} else {
		assignment.setLeftHandSide(accessName);
	}

	ASTNode selectionNode;
	if (isParamToField) {
		// assign parameter to field
		ExpressionStatement statement= ast.newExpressionStatement(assignment);
		int insertIdx= findAssignmentInsertIndex(body.statements(), nodeToAssign) + index;
		rewrite.getListRewrite(body, Block.STATEMENTS_PROPERTY).insertAt(statement, insertIdx, null);
		selectionNode= statement;
	} else {
		if (needsSemicolon(expression)) {
			rewrite.replace(expression, ast.newExpressionStatement(assignment), null);
		} else {
			rewrite.replace(expression, assignment, null);
		}
		selectionNode= nodeToAssign;
	}

	addLinkedPosition(rewrite.track(newDeclFrag.getName()), false, KEY_NAME + index);
	if (!isParamToField) {
		FieldDeclaration fieldDeclaration= (FieldDeclaration) newDeclFrag.getParent();
		addLinkedPosition(rewrite.track(fieldDeclaration.getType()), false, KEY_TYPE);
	}
	addLinkedPosition(rewrite.track(accessName), true, KEY_NAME + index);
	IVariableBinding variableBinding= newDeclFrag.resolveBinding();
	if (variableBinding != null) {
		SimpleName[] linkedNodes= LinkedNodeFinder.findByBinding(nodeToAssign.getRoot(), variableBinding);
		for (int i= 0; i < linkedNodes.length; i++) {
			addLinkedPosition(rewrite.track(linkedNodes[i]), false, KEY_NAME + index);
		}
	}
	setEndPosition(rewrite.track(selectionNode));

	return rewrite;
}
 
Example 18
Source File: ConvertAnonymousToNestedRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void initializeDefaults() {
    fVisibility= isLocalInnerType() ? Modifier.NONE : Modifier.PRIVATE;
    fDeclareStatic = mustInnerClassBeStatic();
}
 
Example 19
Source File: ASTReader.java    From JDeodorant with MIT License 4 votes vote down vote up
private ClassObject processEnumDeclaration(IFile iFile, IDocument document, EnumDeclaration enumDeclaration, List<Comment> comments) {
	final ClassObject classObject = new ClassObject();
	classObject.setEnum(true);
	classObject.setIFile(iFile);
	classObject.addComments(processComments(iFile, document, enumDeclaration, comments));
	classObject.setName(enumDeclaration.resolveBinding().getQualifiedName());
	classObject.setAbstractTypeDeclaration(enumDeclaration);
	
	int modifiers = enumDeclaration.getModifiers();
	if((modifiers & Modifier.ABSTRACT) != 0)
		classObject.setAbstract(true);
	
	if((modifiers & Modifier.PUBLIC) != 0)
		classObject.setAccess(Access.PUBLIC);
	else if((modifiers & Modifier.PROTECTED) != 0)
		classObject.setAccess(Access.PROTECTED);
	else if((modifiers & Modifier.PRIVATE) != 0)
		classObject.setAccess(Access.PRIVATE);
	else
		classObject.setAccess(Access.NONE);
	
	if((modifiers & Modifier.STATIC) != 0)
		classObject.setStatic(true);
	
	List<Type> superInterfaceTypes = enumDeclaration.superInterfaceTypes();
	for(Type interfaceType : superInterfaceTypes) {
		ITypeBinding binding = interfaceType.resolveBinding();
		String qualifiedName = binding.getQualifiedName();
		TypeObject typeObject = TypeObject.extractTypeObject(qualifiedName);
		classObject.addInterface(typeObject);
	}
	
	List<EnumConstantDeclaration> enumConstantDeclarations = enumDeclaration.enumConstants();
	for(EnumConstantDeclaration enumConstantDeclaration : enumConstantDeclarations) {
		EnumConstantDeclarationObject enumConstantDeclarationObject = new EnumConstantDeclarationObject(enumConstantDeclaration.getName().getIdentifier());
		enumConstantDeclarationObject.setEnumName(classObject.getName());
		enumConstantDeclarationObject.setEnumConstantDeclaration(enumConstantDeclaration);
		List<Expression> arguments = enumConstantDeclaration.arguments();
		for(Expression argument : arguments) {
			AbstractExpression abstractExpression = new AbstractExpression(argument);
			enumConstantDeclarationObject.addArgument(abstractExpression);
		}
		classObject.addEnumConstantDeclaration(enumConstantDeclarationObject);
	}
	
	List<BodyDeclaration> bodyDeclarations = enumDeclaration.bodyDeclarations();
	for(BodyDeclaration bodyDeclaration : bodyDeclarations) {
		if(bodyDeclaration instanceof MethodDeclaration) {
			processMethodDeclaration(classObject, (MethodDeclaration)bodyDeclaration);
		}
		else if(bodyDeclaration instanceof FieldDeclaration) {
			processFieldDeclaration(classObject, (FieldDeclaration)bodyDeclaration);
		}
	}
	return classObject;
}
 
Example 20
Source File: MoveInnerToTopRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private int getEnclosingInstanceAccessModifiers() {
	if (fMarkInstanceFieldAsFinal)
		return Modifier.PRIVATE | Modifier.FINAL;
	else
		return Modifier.PRIVATE;
}