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


Java ConstructorInvocation类代码示例

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


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

示例1: getArgumentsProperty

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的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: visit

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
public boolean visit(ConstructorInvocation node) {
	IMethodBinding mmtb = node.resolveConstructorBinding();

	if (mtbStack.isEmpty()) // not part of a method
		return true;

	// make field access fact
	try {
		facts.add(Fact.makeCallsFact(getQualifiedName(mtbStack.peek()),
				getQualifiedName(mmtb)));
	} catch (Exception e) {
		System.err.println("Cannot resolve constructor invocation in \""
				+ "\"");
	}
	return true;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:17,代码来源:ASTVisitorAtomicChange.java

示例3: visit

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
public boolean visit(ConstructorInvocation node)
{
  IMethodBinding mmtb = node.resolveConstructorBinding();
  if (this.mtbStack.isEmpty()) {
    return true;
  }
  try
  {
    this.facts.add(Fact.makeCallsFact(getQualifiedName((IMethodBinding)this.mtbStack.peek()), 
      getQualifiedName(mmtb)));
  }
  catch (Exception e)
  {
    System.err.println("Cannot resolve constructor invocation in \"\"");
  }
  return true;
}
 
开发者ID:SEAL-UCLA,项目名称:Ref-Finder,代码行数:18,代码来源:ASTVisitorAtomicChange.java

示例4: visit

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
public boolean visit(ConstructorInvocation node)
{
  IMethodBinding mmtb = node.resolveConstructorBinding();
  if (this.mtbStack.isEmpty()) {
    return true;
  }
  try
  {
    this.facts.add(Fact.makeCallsFact(getQualifiedName((IMethodBinding)this.mtbStack.peek()), 
      getQualifiedName(mmtb)));
  }
  catch (Exception localException)
  {
    System.err.println("Cannot resolve constructor invocation in \"\"");
  }
  return true;
}
 
开发者ID:SEAL-UCLA,项目名称:Ref-Finder,代码行数:18,代码来源:ASTVisitorAtomicChange.java

示例5: getArguments

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的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

示例6: resolveBinding

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的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

示例7: create

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
/**
 * Creates a new inline method refactoring
 *
 * @param unit the compilation unit or class file
 * @param node the compilation unit node
 * @param selectionStart start
 * @param selectionLength length
 * @return returns the refactoring
 */
public static InlineMethodRefactoring create(
    ITypeRoot unit, CompilationUnit node, int selectionStart, int selectionLength) {
  ASTNode target =
      RefactoringAvailabilityTester.getInlineableMethodNode(
          unit, node, selectionStart, selectionLength);
  if (target == null) return null;
  if (target.getNodeType() == ASTNode.METHOD_DECLARATION) {

    return new InlineMethodRefactoring(
        unit, (MethodDeclaration) target, selectionStart, selectionLength);
  } else {
    ICompilationUnit cu = (ICompilationUnit) unit;
    if (target.getNodeType() == ASTNode.METHOD_INVOCATION) {
      return new InlineMethodRefactoring(
          cu, (MethodInvocation) target, selectionStart, selectionLength);
    } else if (target.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION) {
      return new InlineMethodRefactoring(
          cu, (SuperMethodInvocation) target, selectionStart, selectionLength);
    } else if (target.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION) {
      return new InlineMethodRefactoring(
          cu, (ConstructorInvocation) target, selectionStart, selectionLength);
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:InlineMethodRefactoring.java

示例8: setCurrentMode

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
public RefactoringStatus setCurrentMode(Mode mode) throws JavaModelException {
  if (fCurrentMode == mode) return new RefactoringStatus();
  Assert.isTrue(getInitialMode() == Mode.INLINE_SINGLE);
  fCurrentMode = mode;
  if (mode == Mode.INLINE_SINGLE) {
    if (fInitialNode instanceof MethodInvocation)
      fTargetProvider =
          TargetProvider.create(
              (ICompilationUnit) fInitialTypeRoot, (MethodInvocation) fInitialNode);
    else if (fInitialNode instanceof SuperMethodInvocation)
      fTargetProvider =
          TargetProvider.create(
              (ICompilationUnit) fInitialTypeRoot, (SuperMethodInvocation) fInitialNode);
    else if (fInitialNode instanceof ConstructorInvocation)
      fTargetProvider =
          TargetProvider.create(
              (ICompilationUnit) fInitialTypeRoot, (ConstructorInvocation) fInitialNode);
    else throw new IllegalStateException(String.valueOf(fInitialNode));
  } else {
    fTargetProvider = TargetProvider.create(fSourceProvider.getDeclaration());
  }
  return fTargetProvider.checkActivation();
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:InlineMethodRefactoring.java

示例9: resolveBinding

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
private static IBinding resolveBinding(ASTNode node) {
  if (node instanceof SimpleName) {
    SimpleName simpleName = (SimpleName) node;
    // workaround for https://bugs.eclipse.org/62605 (constructor name resolves to type, not
    // method)
    ASTNode normalized = ASTNodes.getNormalizedNode(simpleName);
    if (normalized.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) {
      ClassInstanceCreation cic = (ClassInstanceCreation) normalized.getParent();
      IMethodBinding constructorBinding = cic.resolveConstructorBinding();
      if (constructorBinding == null) return null;
      ITypeBinding declaringClass = constructorBinding.getDeclaringClass();
      if (!declaringClass.isAnonymous()) return constructorBinding;
      ITypeBinding superTypeDeclaration = declaringClass.getSuperclass().getTypeDeclaration();
      return resolveSuperclassConstructor(superTypeDeclaration, constructorBinding);
    }
    return simpleName.resolveBinding();

  } else if (node instanceof SuperConstructorInvocation) {
    return ((SuperConstructorInvocation) node).resolveConstructorBinding();
  } else if (node instanceof ConstructorInvocation) {
    return ((ConstructorInvocation) node).resolveConstructorBinding();
  } else {
    return null;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:JavadocFinder.java

示例10: getArguments

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的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

示例11: getArgumentsProperty

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的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

示例12: resolveBinding

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的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

示例13: create

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
/**
 * Creates a new inline method refactoring
 * @param unit the compilation unit or class file
 * @param node the compilation unit node
 * @param selectionStart start
 * @param selectionLength length
 * @return returns the refactoring
 */
public static InlineMethodRefactoring create(ITypeRoot unit, CompilationUnit node, int selectionStart, int selectionLength) {
	ASTNode target= RefactoringAvailabilityTester.getInlineableMethodNode(unit, node, selectionStart, selectionLength);
	if (target == null)
		return null;
	if (target.getNodeType() == ASTNode.METHOD_DECLARATION) {

		return new InlineMethodRefactoring(unit, (MethodDeclaration)target, selectionStart, selectionLength);
	} else {
		ICompilationUnit cu= (ICompilationUnit) unit;
		if (target.getNodeType() == ASTNode.METHOD_INVOCATION) {
			return new InlineMethodRefactoring(cu, (MethodInvocation)target, selectionStart, selectionLength);
		} else if (target.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION) {
			return new InlineMethodRefactoring(cu, (SuperMethodInvocation)target, selectionStart, selectionLength);
		} else if (target.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION) {
			return new InlineMethodRefactoring(cu, (ConstructorInvocation)target, selectionStart, selectionLength);
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:InlineMethodRefactoring.java

示例14: setCurrentMode

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
public RefactoringStatus setCurrentMode(Mode mode) throws JavaModelException {
	if (fCurrentMode == mode)
		return new RefactoringStatus();
	Assert.isTrue(getInitialMode() == Mode.INLINE_SINGLE);
	fCurrentMode= mode;
	if (mode == Mode.INLINE_SINGLE) {
		if (fInitialNode instanceof MethodInvocation)
			fTargetProvider= TargetProvider.create((ICompilationUnit) fInitialTypeRoot, (MethodInvocation)fInitialNode);
		else if (fInitialNode instanceof SuperMethodInvocation)
			fTargetProvider= TargetProvider.create((ICompilationUnit) fInitialTypeRoot, (SuperMethodInvocation)fInitialNode);
		else if (fInitialNode instanceof ConstructorInvocation)
			fTargetProvider= TargetProvider.create((ICompilationUnit) fInitialTypeRoot, (ConstructorInvocation)fInitialNode);
		else
			throw new IllegalStateException(String.valueOf(fInitialNode));
	} else {
		fTargetProvider= TargetProvider.create(fSourceProvider.getDeclaration());
	}
	return fTargetProvider.checkActivation();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:InlineMethodRefactoring.java

示例15: resolveBinding

import org.eclipse.jdt.core.dom.ConstructorInvocation; //导入依赖的package包/类
private static IBinding resolveBinding(ASTNode node) {
	if (node instanceof SimpleName) {
		SimpleName simpleName= (SimpleName) node;
		// workaround for https://bugs.eclipse.org/62605 (constructor name resolves to type, not method)
		ASTNode normalized= ASTNodes.getNormalizedNode(simpleName);
		if (normalized.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) {
			ClassInstanceCreation cic= (ClassInstanceCreation) normalized.getParent();
			IMethodBinding constructorBinding= cic.resolveConstructorBinding();
			if (constructorBinding == null)
				return null;
			ITypeBinding declaringClass= constructorBinding.getDeclaringClass();
			if (!declaringClass.isAnonymous())
				return constructorBinding;
			ITypeBinding superTypeDeclaration= declaringClass.getSuperclass().getTypeDeclaration();
			return resolveSuperclassConstructor(superTypeDeclaration, constructorBinding);
		}
		return simpleName.resolveBinding();
		
	} else if (node instanceof SuperConstructorInvocation) {
		return ((SuperConstructorInvocation) node).resolveConstructorBinding();
	} else if (node instanceof ConstructorInvocation) {
		return ((ConstructorInvocation) node).resolveConstructorBinding();
	} else {
		return null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:JavadocHover.java


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