当前位置: 首页>>代码示例>>Java>>正文


Java EnumConstantDeclaration类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.EnumConstantDeclaration的典型用法代码示例。如果您正苦于以下问题:Java EnumConstantDeclaration类的具体用法?Java EnumConstantDeclaration怎么用?Java EnumConstantDeclaration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EnumConstantDeclaration类属于org.eclipse.jdt.core.dom包,在下文中一共展示了EnumConstantDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getArgumentsProperty

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
public static ChildListPropertyDescriptor getArgumentsProperty(ASTNode invocation) {
  switch (invocation.getNodeType()) {
    case ASTNode.METHOD_INVOCATION:
      return MethodInvocation.ARGUMENTS_PROPERTY;
    case ASTNode.SUPER_METHOD_INVOCATION:
      return SuperMethodInvocation.ARGUMENTS_PROPERTY;

    case ASTNode.CONSTRUCTOR_INVOCATION:
      return ConstructorInvocation.ARGUMENTS_PROPERTY;
    case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
      return SuperConstructorInvocation.ARGUMENTS_PROPERTY;

    case ASTNode.CLASS_INSTANCE_CREATION:
      return ClassInstanceCreation.ARGUMENTS_PROPERTY;
    case ASTNode.ENUM_CONSTANT_DECLARATION:
      return EnumConstantDeclaration.ARGUMENTS_PROPERTY;

    default:
      throw new IllegalArgumentException(invocation.toString());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:Invocations.java

示例2: isTypeBindingNull

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
private static boolean isTypeBindingNull(ASTNode typeNode) {
	if (typeNode instanceof AbstractTypeDeclaration) {
		AbstractTypeDeclaration abstractTypeDeclaration= (AbstractTypeDeclaration) typeNode;
		if (abstractTypeDeclaration.resolveBinding() == null) {
			return true;
		}

		return false;
	} else if (typeNode instanceof AnonymousClassDeclaration) {
		AnonymousClassDeclaration anonymousClassDeclaration= (AnonymousClassDeclaration) typeNode;
		if (anonymousClassDeclaration.resolveBinding() == null) {
			return true;
		}

		return false;
	} else if (typeNode instanceof EnumConstantDeclaration) {
		return false;
	} else {
		return true;
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:22,代码来源:UnimplementedCodeFix.java

示例3: doAddEnumConst

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
private ASTRewrite doAddEnumConst(CompilationUnit astRoot) {
	SimpleName node= fOriginalNode;

	ASTNode newTypeDecl= astRoot.findDeclaringNode(fSenderBinding);
	if (newTypeDecl == null) {
		astRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null);
		newTypeDecl= astRoot.findDeclaringNode(fSenderBinding.getKey());
	}

	if (newTypeDecl != null) {
		AST ast= newTypeDecl.getAST();

		ASTRewrite rewrite= ASTRewrite.create(ast);

		EnumConstantDeclaration constDecl= ast.newEnumConstantDeclaration();
		constDecl.setName(ast.newSimpleName(node.getIdentifier()));

		ListRewrite listRewriter= rewrite.getListRewrite(newTypeDecl, EnumDeclaration.ENUM_CONSTANTS_PROPERTY);
		listRewriter.insertLast(constDecl, null);

		return rewrite;
	}
	return null;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:25,代码来源:NewVariableCorrectionProposal.java

示例4: getSelectedTypeNode

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
public static ASTNode getSelectedTypeNode(CompilationUnit root, IProblemLocation problem) {
  ASTNode selectedNode = problem.getCoveringNode(root);
  if (selectedNode == null) return null;

  if (selectedNode.getNodeType() == ASTNode.ANONYMOUS_CLASS_DECLARATION) { // bug 200016
    selectedNode = selectedNode.getParent();
  }

  if (selectedNode.getLocationInParent() == EnumConstantDeclaration.NAME_PROPERTY) {
    selectedNode = selectedNode.getParent();
  }
  if (selectedNode.getNodeType() == ASTNode.SIMPLE_NAME
      && selectedNode.getParent() instanceof AbstractTypeDeclaration) {
    return selectedNode.getParent();
  } else if (selectedNode.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION) {
    return ((ClassInstanceCreation) selectedNode).getAnonymousClassDeclaration();
  } else if (selectedNode.getNodeType() == ASTNode.ENUM_CONSTANT_DECLARATION) {
    EnumConstantDeclaration enumConst = (EnumConstantDeclaration) selectedNode;
    if (enumConst.getAnonymousClassDeclaration() != null)
      return enumConst.getAnonymousClassDeclaration();
    return enumConst;
  } else {
    return null;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:UnimplementedCodeFix.java

示例5: isTypeBindingNull

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
private static boolean isTypeBindingNull(ASTNode typeNode) {
  if (typeNode instanceof AbstractTypeDeclaration) {
    AbstractTypeDeclaration abstractTypeDeclaration = (AbstractTypeDeclaration) typeNode;
    if (abstractTypeDeclaration.resolveBinding() == null) return true;

    return false;
  } else if (typeNode instanceof AnonymousClassDeclaration) {
    AnonymousClassDeclaration anonymousClassDeclaration = (AnonymousClassDeclaration) typeNode;
    if (anonymousClassDeclaration.resolveBinding() == null) return true;

    return false;
  } else if (typeNode instanceof EnumConstantDeclaration) {
    return false;
  } else {
    return true;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:UnimplementedCodeFix.java

示例6: createOccurrenceUpdate

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
private OccurrenceUpdate<? extends ASTNode> createOccurrenceUpdate(
    ASTNode node, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
  if (BUG_89686
      && node instanceof SimpleName
      && node.getParent() instanceof EnumConstantDeclaration) node = node.getParent();

  if (Invocations.isInvocationWithArguments(node))
    return new ReferenceUpdate(node, cuRewrite, result);
  else if (node instanceof SimpleName && node.getParent() instanceof MethodDeclaration)
    return new DeclarationUpdate((MethodDeclaration) node.getParent(), cuRewrite, result);
  else if (node instanceof MemberRef || node instanceof MethodRef)
    return new DocReferenceUpdate(node, cuRewrite, result);
  else if (ASTNodes.getParent(node, ImportDeclaration.class) != null)
    return new StaticImportUpdate(
        (ImportDeclaration) ASTNodes.getParent(node, ImportDeclaration.class), cuRewrite, result);
  else if (node instanceof LambdaExpression)
    return new LambdaExpressionUpdate((LambdaExpression) node, cuRewrite, result);
  else if (node.getLocationInParent() == ExpressionMethodReference.NAME_PROPERTY)
    return new ExpressionMethodRefUpdate(
        (ExpressionMethodReference) node.getParent(), cuRewrite, result);
  else return new NullOccurrenceUpdate(node, cuRewrite, result);
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:ChangeSignatureProcessor.java

示例7: getFullTypeName

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
protected String getFullTypeName() {
  ASTNode node = getNode();
  while (true) {
    node = node.getParent();
    if (node instanceof AbstractTypeDeclaration) {
      String typeName = ((AbstractTypeDeclaration) node).getName().getIdentifier();
      if (getNode() instanceof LambdaExpression) {
        return Messages.format(
            RefactoringCoreMessages.ChangeSignatureRefactoring_lambda_expression, typeName);
      }
      return typeName;
    } else if (node instanceof ClassInstanceCreation) {
      ClassInstanceCreation cic = (ClassInstanceCreation) node;
      return Messages.format(
          RefactoringCoreMessages.ChangeSignatureRefactoring_anonymous_subclass,
          BasicElementLabels.getJavaElementName(ASTNodes.asString(cic.getType())));
    } else if (node instanceof EnumConstantDeclaration) {
      EnumDeclaration ed = (EnumDeclaration) node.getParent();
      return Messages.format(
          RefactoringCoreMessages.ChangeSignatureRefactoring_anonymous_subclass,
          BasicElementLabels.getJavaElementName(ASTNodes.asString(ed.getName())));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:ChangeSignatureProcessor.java

示例8: getArguments

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
public static List<Expression> getArguments(ASTNode invocation) {
  switch (invocation.getNodeType()) {
    case ASTNode.METHOD_INVOCATION:
      return ((MethodInvocation) invocation).arguments();
    case ASTNode.SUPER_METHOD_INVOCATION:
      return ((SuperMethodInvocation) invocation).arguments();

    case ASTNode.CONSTRUCTOR_INVOCATION:
      return ((ConstructorInvocation) invocation).arguments();
    case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
      return ((SuperConstructorInvocation) invocation).arguments();

    case ASTNode.CLASS_INSTANCE_CREATION:
      return ((ClassInstanceCreation) invocation).arguments();
    case ASTNode.ENUM_CONSTANT_DECLARATION:
      return ((EnumConstantDeclaration) invocation).arguments();

    default:
      throw new IllegalArgumentException(invocation.toString());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:Invocations.java

示例9: resolveBinding

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
public static IMethodBinding resolveBinding(ASTNode invocation) {
  switch (invocation.getNodeType()) {
    case ASTNode.METHOD_INVOCATION:
      return ((MethodInvocation) invocation).resolveMethodBinding();
    case ASTNode.SUPER_METHOD_INVOCATION:
      return ((SuperMethodInvocation) invocation).resolveMethodBinding();

    case ASTNode.CONSTRUCTOR_INVOCATION:
      return ((ConstructorInvocation) invocation).resolveConstructorBinding();
    case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
      return ((SuperConstructorInvocation) invocation).resolveConstructorBinding();

    case ASTNode.CLASS_INSTANCE_CREATION:
      return ((ClassInstanceCreation) invocation).resolveConstructorBinding();
    case ASTNode.ENUM_CONSTANT_DECLARATION:
      return ((EnumConstantDeclaration) invocation).resolveConstructorBinding();

    default:
      throw new IllegalArgumentException(invocation.toString());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:Invocations.java

示例10: getNodeStartPosition

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
private static int getNodeStartPosition(final ASTNode node) {
    if (node instanceof MethodDeclaration) {
        MethodDeclaration decl = (MethodDeclaration) node;
        return decl.isConstructor() ? decl.getName().getStartPosition() : decl.getReturnType2().getStartPosition();
    } else if (node instanceof FieldDeclaration) {
        return ((FieldDeclaration) node).getType().getStartPosition();
    } else if (node instanceof AbstractTypeDeclaration) {
        return ((AbstractTypeDeclaration) node).getName().getStartPosition();
    } else if (node instanceof AnnotationTypeMemberDeclaration) {
        return ((AnnotationTypeMemberDeclaration) node).getName().getStartPosition();
    } else if (node instanceof EnumConstantDeclaration) {
        return ((EnumConstantDeclaration) node).getName().getStartPosition();
    } else if (node instanceof PackageDeclaration) {
        return ((PackageDeclaration) node).getName().getStartPosition();
    }
    /* TODO: Initializer */

    return node.getStartPosition();
}
 
开发者ID:boalang,项目名称:compiler,代码行数:20,代码来源:UglyMathCommentsExtractor.java

示例11: createOccurrenceUpdate

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
private OccurrenceUpdate<? extends ASTNode> createOccurrenceUpdate(ASTNode node, CompilationUnitRewrite cuRewrite, RefactoringStatus result) {
	if (BUG_89686 && node instanceof SimpleName && node.getParent() instanceof EnumConstantDeclaration)
		node= node.getParent();

	if (Invocations.isInvocationWithArguments(node))
		return new ReferenceUpdate(node, cuRewrite, result);

	else if (node instanceof SimpleName && node.getParent() instanceof MethodDeclaration)
		return new DeclarationUpdate((MethodDeclaration) node.getParent(), cuRewrite, result);

	else if (node instanceof MemberRef || node instanceof MethodRef)
		return new DocReferenceUpdate(node, cuRewrite, result);

	else if (ASTNodes.getParent(node, ImportDeclaration.class) != null)
		return new StaticImportUpdate((ImportDeclaration) ASTNodes.getParent(node, ImportDeclaration.class), cuRewrite, result);

	else if (node instanceof LambdaExpression)
		return new LambdaExpressionUpdate((LambdaExpression) node, cuRewrite, result);

	else if (node.getLocationInParent() == ExpressionMethodReference.NAME_PROPERTY)
		return new ExpressionMethodRefUpdate((ExpressionMethodReference) node.getParent(), cuRewrite, result);

	else
		return new NullOccurrenceUpdate(node, cuRewrite, result);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:ChangeSignatureProcessor.java

示例12: getFullTypeName

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
protected String getFullTypeName() {
	ASTNode node= getNode();
	while (true) {
		node= node.getParent();
		if (node instanceof AbstractTypeDeclaration) {
			String typeName= ((AbstractTypeDeclaration) node).getName().getIdentifier();
			if (getNode() instanceof LambdaExpression) {
				return Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_lambda_expression, typeName);
			}
			return typeName;
		} else if (node instanceof ClassInstanceCreation) {
			ClassInstanceCreation cic= (ClassInstanceCreation) node;
			return Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_anonymous_subclass, BasicElementLabels.getJavaElementName(ASTNodes.asString(cic.getType())));
		} else if (node instanceof EnumConstantDeclaration) {
			EnumDeclaration ed= (EnumDeclaration) node.getParent();
			return Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_anonymous_subclass, BasicElementLabels.getJavaElementName(ASTNodes.asString(ed.getName())));
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ChangeSignatureProcessor.java

示例13: getArguments

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
public static List<Expression> getArguments(ASTNode invocation) {
	switch (invocation.getNodeType()) {
		case ASTNode.METHOD_INVOCATION:
			return ((MethodInvocation)invocation).arguments();
		case ASTNode.SUPER_METHOD_INVOCATION:
			return ((SuperMethodInvocation)invocation).arguments();
			
		case ASTNode.CONSTRUCTOR_INVOCATION:
			return ((ConstructorInvocation)invocation).arguments();
		case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
			return ((SuperConstructorInvocation)invocation).arguments();
			
		case ASTNode.CLASS_INSTANCE_CREATION:
			return ((ClassInstanceCreation)invocation).arguments();
		case ASTNode.ENUM_CONSTANT_DECLARATION:
			return ((EnumConstantDeclaration)invocation).arguments();
			
		default:
			throw new IllegalArgumentException(invocation.toString());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:Invocations.java

示例14: getArgumentsProperty

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
public static ChildListPropertyDescriptor getArgumentsProperty(ASTNode invocation) {
	switch (invocation.getNodeType()) {
		case ASTNode.METHOD_INVOCATION:
			return MethodInvocation.ARGUMENTS_PROPERTY;
		case ASTNode.SUPER_METHOD_INVOCATION:
			return SuperMethodInvocation.ARGUMENTS_PROPERTY;
			
		case ASTNode.CONSTRUCTOR_INVOCATION:
			return ConstructorInvocation.ARGUMENTS_PROPERTY;
		case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
			return SuperConstructorInvocation.ARGUMENTS_PROPERTY;
			
		case ASTNode.CLASS_INSTANCE_CREATION:
			return ClassInstanceCreation.ARGUMENTS_PROPERTY;
		case ASTNode.ENUM_CONSTANT_DECLARATION:
			return EnumConstantDeclaration.ARGUMENTS_PROPERTY;
			
		default:
			throw new IllegalArgumentException(invocation.toString());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:Invocations.java

示例15: resolveBinding

import org.eclipse.jdt.core.dom.EnumConstantDeclaration; //导入依赖的package包/类
public static IMethodBinding resolveBinding(ASTNode invocation) {
	switch (invocation.getNodeType()) {
		case ASTNode.METHOD_INVOCATION:
			return ((MethodInvocation)invocation).resolveMethodBinding();
		case ASTNode.SUPER_METHOD_INVOCATION:
			return ((SuperMethodInvocation)invocation).resolveMethodBinding();
			
		case ASTNode.CONSTRUCTOR_INVOCATION:
			return ((ConstructorInvocation)invocation).resolveConstructorBinding();
		case ASTNode.SUPER_CONSTRUCTOR_INVOCATION:
			return ((SuperConstructorInvocation)invocation).resolveConstructorBinding();
			
		case ASTNode.CLASS_INSTANCE_CREATION:
			return ((ClassInstanceCreation)invocation).resolveConstructorBinding();
		case ASTNode.ENUM_CONSTANT_DECLARATION:
			return ((EnumConstantDeclaration)invocation).resolveConstructorBinding();
			
		default:
			throw new IllegalArgumentException(invocation.toString());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:Invocations.java


注:本文中的org.eclipse.jdt.core.dom.EnumConstantDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。