• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RenameTypeProcessor类的典型用法和代码示例

java 2次浏览

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

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

示例1: checkMappedSimilarElementsExist

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
private void checkMappedSimilarElementsExist(Refactoring ref) {
  RenameTypeProcessor rtp = (RenameTypeProcessor) ((RenameRefactoring) ref).getProcessor();
  IJavaElementMapper mapper = (IJavaElementMapper) rtp.getAdapter(IJavaElementMapper.class);
  IJavaElement[] similarElements = rtp.getSimilarElements();
  if (similarElements == null) return;
  for (int i = 0; i < similarElements.length; i++) {
    IJavaElement element = similarElements[i];
    if (!(element instanceof ILocalVariable)) {
      IJavaElement newElement = mapper.getRefactoredJavaElement(element);
      TestCase.assertTrue(newElement.exists());
      Assert.assertFalse(element.exists());
    }
  }
}
 

开发者ID:eclipse,
项目名称:che,
代码行数:15,
代码来源:RenameTypeTest.java

示例2: checkMappers

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
private void checkMappers(
    Refactoring refactoring, IType type, String newCUName, IJavaElement[] someClassMembers) {
  RenameTypeProcessor rtp =
      (RenameTypeProcessor) ((RenameRefactoring) refactoring).getProcessor();

  ICompilationUnit newUnit =
      (ICompilationUnit) rtp.getRefactoredJavaElement(type.getCompilationUnit());
  TestCase.assertTrue(newUnit.exists());
  TestCase.assertTrue(newUnit.getElementName().equals(newCUName));

  IFile newFile = (IFile) rtp.getRefactoredResource(type.getResource());
  TestCase.assertTrue(newFile.exists());
  TestCase.assertTrue(newFile.getName().equals(newCUName));

  if ((type.getParent().getElementType() == IJavaElement.COMPILATION_UNIT)
      && type.getCompilationUnit().getElementName().equals(type.getElementName() + ".java")) {
    Assert.assertFalse(type.getCompilationUnit().exists());
    Assert.assertFalse(type.getResource().exists());
  }

  IPackageFragment oldPackage = (IPackageFragment) type.getCompilationUnit().getParent();
  IPackageFragment newPackage = (IPackageFragment) rtp.getRefactoredJavaElement(oldPackage);
  Assert.assertEquals(oldPackage, newPackage);

  for (int i = 0; i < someClassMembers.length; i++) {
    IMember member = (IMember) someClassMembers[i];
    IJavaElement refactoredMember = rtp.getRefactoredJavaElement(member);
    if (member instanceof IMethod && member.getElementName().equals(type.getElementName()))
      continue; // constructor
    TestCase.assertTrue(refactoredMember.exists());
    Assert.assertEquals(member.getElementName(), refactoredMember.getElementName());
    Assert.assertFalse(refactoredMember.equals(member));
  }
}
 

开发者ID:eclipse,
项目名称:che,
代码行数:35,
代码来源:RenameTypeTest.java

示例3: createRefactoring

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Refactoring createRefactoring(
    JavaRefactoringDescriptor descriptor, RefactoringStatus status) {
  JavaRefactoringArguments arguments =
      new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
  RenameTypeProcessor processor = new RenameTypeProcessor(arguments, status);
  return new RenameRefactoring(processor);
}
 

开发者ID:eclipse,
项目名称:che,
代码行数:10,
代码来源:RenameTypeRefactoringContribution.java

示例4: InterfaceRenameChangeBuilder

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
public InterfaceRenameChangeBuilder(IType pairedType, String pairedNewName,
    RenameTypeProcessor processor, IWorkspace workspace) {
  super(RenameJavaElementDescriptor.class, IJavaRefactorings.RENAME_TYPE,
      workspace);

  this.processor = processor;
  this.pairedType = pairedType;
  this.pairedNewName = pairedNewName;
}
 

开发者ID:gwt-plugins,
项目名称:gwt-eclipse-plugin,
代码行数:10,
代码来源:PairedInterfaceRenameParticipant.java

示例5: createRefactoring

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	RenameTypeProcessor processor= new RenameTypeProcessor(arguments, status);
	return new RenameRefactoring(processor);
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:10,
代码来源:RenameTypeRefactoringContribution.java

示例6: getRenameTypeProcessor

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
public RenameTypeProcessor getRenameTypeProcessor() {
	RefactoringProcessor proc= ((RenameRefactoring) getRefactoring()).getProcessor();
	if (proc instanceof RenameTypeProcessor)
		return (RenameTypeProcessor) proc;
	else if (proc instanceof RenameCompilationUnitProcessor) {
		RenameCompilationUnitProcessor rcu= (RenameCompilationUnitProcessor) proc;
		return rcu.getRenameTypeProcessor();
	}
	Assert.isTrue(false); // Should never get here
	return null;
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:12,
代码来源:RenameTypeWizard.java

示例7: RenameUserInterfaceManager

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
private RenameUserInterfaceManager() {
	put(RenameJavaProjectProcessor.class, RenameUserInterfaceStarter.class, RenameJavaProjectWizard.class);
	put(RenameSourceFolderProcessor.class, RenameUserInterfaceStarter.class, RenameSourceFolderWizard.class);
	put(RenamePackageProcessor.class, RenameUserInterfaceStarter.class, RenamePackageWizard.class);
	put(RenameCompilationUnitProcessor.class, RenameUserInterfaceStarter.class, RenameCuWizard.class);
	put(RenameTypeProcessor.class, RenameUserInterfaceStarter.class, RenameTypeWizard.class);
	put(RenameFieldProcessor.class, RenameUserInterfaceStarter.class, RenameFieldWizard.class);
	put(RenameEnumConstProcessor.class, RenameUserInterfaceStarter.class, RenameEnumConstWizard.class);
	put(RenameTypeParameterProcessor.class, RenameUserInterfaceStarter.class, RenameTypeParameterWizard.class);
	put(RenameNonVirtualMethodProcessor.class, RenameMethodUserInterfaceStarter.class, RenameMethodWizard.class);
	put(RenameVirtualMethodProcessor.class, RenameMethodUserInterfaceStarter.class, RenameMethodWizard.class);
	put(RenameLocalVariableProcessor.class, RenameUserInterfaceStarter.class, RenameLocalVariableWizard.class);
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:14,
代码来源:RenameUserInterfaceManager.java

示例8: initialize

点赞 2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
@Override
protected boolean initialize(Object element) {
  if (!super.initialize(element)) {
    return false;
  }

  try {
    typeContainer = TypeContainer.createTypeContainer(getTypeRefactoringSupport().getOldType());
    if (typeContainer == null) {
      // This isn't a GWT RPC interface
      return false;
    }

    if (!updateNewNameMetadata()) {
      return false;
    }

  } catch (JavaModelException e) {
    GWTPluginLog.logError(
        e,
        "Error when checking whether a rename type refactoring is renaming a GWT RPC interface");
    return false;
  }

  RefactoringProcessor refactoringProcessor = getRenameProcessor();
  if (!(refactoringProcessor instanceof RenameTypeProcessor)) {
    GWTPluginLog.logWarning("Not participating in GWT RPC type rename due to invalid processor type: "
        + refactoringProcessor.getClass().getSimpleName());
    return false;
  }
  processor = (RenameTypeProcessor) refactoringProcessor;

  refactoringContext = (InterfaceRenameRefactoringContext) NestedRefactoringContext.forProcessor(refactoringProcessor);
  if (refactoringContext == null) {
    // This is a root (i.e. user-initiated) refactoring, not a
    // refactoring-initiated nested refactoring
    refactoringContext = InterfaceRenameRefactoringContext.newRootRefactoringContext();
    NestedRefactoringContext.storeForProcessor(refactoringProcessor,
        refactoringContext);
  }

  return true;
}
 

开发者ID:gwt-plugins,
项目名称:gwt-eclipse-plugin,
代码行数:44,
代码来源:PairedInterfaceRenameParticipant.java

示例9: create

点赞 1

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
/**
 * Creates a new rename support for the given {@link IType}.
 *
 * @param type the {@link IType} to be renamed.
 * @param newName the type's new name. <code>null</code> is a valid value indicating that no new
 *     name is provided.
 * @param flags flags controlling additional parameters. Valid flags are <code>UPDATE_REFERENCES
 *     </code>, and <code>UPDATE_TEXTUAL_MATCHES</code>, or their bitwise OR, or <code>NONE</code>
 *     .
 * @return the {@link RenameSupport}.
 * @throws CoreException if an unexpected error occurred while creating the {@link RenameSupport}.
 */
public static RenameSupport create(IType type, String newName, int flags) throws CoreException {
  JavaRenameProcessor processor = new RenameTypeProcessor(type);
  return new RenameSupport(processor, newName, flags);
}
 

开发者ID:eclipse,
项目名称:che,
代码行数:17,
代码来源:RenameSupport.java

示例10: create

点赞 1

import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor; //导入依赖的package包/类
/**
 * Creates a new rename support for the given {@link IType}.
 *
 * @param type the {@link IType} to be renamed.
 * @param newName the type's new name. <code>null</code> is a valid value
 * indicating that no new name is provided.
 * @param flags flags controlling additional parameters. Valid flags are
 * <code>UPDATE_REFERENCES</code>, and <code>UPDATE_TEXTUAL_MATCHES</code>,
 * or their bitwise OR, or <code>NONE</code>.
 * @return the {@link RenameSupport}.
 * @throws CoreException if an unexpected error occurred while creating
 * the {@link RenameSupport}.
 */
public static RenameSupport create(IType type, String newName, int flags) throws CoreException {
	JavaRenameProcessor processor= new RenameTypeProcessor(type);
	return new RenameSupport(processor, newName, flags);
}
 

开发者ID:trylimits,
项目名称:Eclipse-Postfix-Code-Completion,
代码行数:18,
代码来源:RenameSupport.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)