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


Java RenamePackageProcessor类代码示例

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


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

示例1: createPackageNameValidator

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
private static IInputValidator createPackageNameValidator(final IPackageFragment pack) {
	IInputValidator validator= new IInputValidator(){
		public String isValid(String newText) {
			if (newText == null || "".equals(newText)) //$NON-NLS-1$
				return INVALID_NAME_NO_MESSAGE;
			IStatus status= JavaConventionsUtil.validatePackageName(newText, pack);
			if (status.getSeverity() == IStatus.ERROR)
				return status.getMessage();

			IJavaElement parent= pack.getParent();
			try {
				if (parent instanceof IPackageFragmentRoot){
					if (! RenamePackageProcessor.isPackageNameOkInRoot(newText, (IPackageFragmentRoot)parent))
						return ReorgMessages.ReorgQueries_packagewithThatNameexistsMassage;
				}
			} catch (CoreException e) {
				return INVALID_NAME_NO_MESSAGE;
			}
			if (pack.getElementName().equalsIgnoreCase(newText))
				return ReorgMessages.ReorgQueries_resourceExistsWithDifferentCaseMassage;

			return null;
		}
	};
	return validator;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:NewNameQueries.java

示例2: test1

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
@Test
public void test1() throws Exception {
  fIsPreDeltaTest = true;
  RenamePackageProcessor proc = helper2(new String[] {"r"}, new String[][] {{"A"}}, "p1");
  IJavaElementMapper jm = (IJavaElementMapper) proc.getAdapter(IJavaElementMapper.class);
  IResourceMapper rm = (IResourceMapper) proc.getAdapter(IResourceMapper.class);

  IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
  IJavaProject project = getRoot().getJavaProject();
  IFile _project = project.getProject().getFile(".project");
  checkMappingUnchanged(
      jm,
      rm,
      new Object[] {
        project,
        _project,
        getRoot(),
        getPackageP(),
        getRoot().getPackageFragment("inexistent"),
        getRoot().getPackageFragment("r.inexistent"),
        getRoot().getPackageFragment("p1.inexistent")
      });

  IPackageFragment r = getRoot().getPackageFragment("p1");
  ICompilationUnit r_A = r.getCompilationUnit("A.java");
  IType r_A_A = r_A.getType("A");
  IField r_A_A_a = r_A_A.getField("a");
  IPackageFragment p1 = getRoot().getPackageFragment("p1");
  ICompilationUnit p1_A = p1.getCompilationUnit("A.java");
  IType p1_A_A = p1_A.getType("A");
  IField p1_A_A_a = p1_A_A.getField("a");
  checkMappingChanged(
      jm,
      rm,
      new Object[][] {
        {r, p1}, {r_A, p1_A}, {r_A_A, p1_A_A}, {r_A_A_a, p1_A_A_a},
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:RenamePackageTest.java

示例3: test2

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
@Test
public void test2() throws Exception {
  fIsPreDeltaTest = true;
  RenamePackageProcessor processor =
      helper2(new String[] {"r", "fred"}, new String[][] {{"A"}, {"A"}}, "p1");

  // test that participants are correctly informed after '< Back':
  // https://bugs.eclipse.org/bugs/show_bug.cgi?id=280068
  performUndo();

  ParticipantTesting.reset();
  String secondName = "pipapo";
  processor.setNewElementName(secondName);
  String[] renameHandles =
      ParticipantTesting.createHandles(
          new Object[] {processor.getPackage(), processor.getPackage().getResource()});

  RenameRefactoring refactoring = (RenameRefactoring) processor.getRefactoring();
  refactoring.checkFinalConditions(new NullProgressMonitor());
  refactoring.createChange(new NullProgressMonitor());

  ParticipantTesting.testRename(
      renameHandles,
      new RenameArguments[] {
        new RenameArguments(secondName, true), new RenameArguments(secondName, true)
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:RenamePackageTest.java

示例4: createRefactoring

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Refactoring createRefactoring(
    JavaRefactoringDescriptor descriptor, RefactoringStatus status) {
  JavaRefactoringArguments arguments =
      new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
  RenamePackageProcessor processor = new RenamePackageProcessor(arguments, status);
  return new RenameRefactoring(processor);
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:RenamePackageRefactoringContribution.java

示例5: createRefactoring

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) {
	JavaRefactoringArguments arguments= new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
	RenamePackageProcessor processor= new RenamePackageProcessor(arguments, status);
	return new RenameRefactoring(processor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:RenamePackageRefactoringContribution.java

示例6: RenameUserInterfaceManager

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的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

示例7: getRenamePackageProcessor

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
private RenamePackageProcessor getRenamePackageProcessor() {
	return (RenamePackageProcessor) ((RenameRefactoring) getRefactoring()).getProcessor();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:RenamePackageWizard.java

示例8: create

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
/**
 * Creates a new rename support for the given {@link IPackageFragment}.
 *
 * @param fragment the {@link IPackageFragment} to be renamed.
 * @param newName the package fragment'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(IPackageFragment fragment, String newName, int flags)
    throws CoreException {
  JavaRenameProcessor processor = new RenamePackageProcessor(fragment);
  return new RenameSupport(processor, newName, flags);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:RenameSupport.java

示例9: create

import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor; //导入依赖的package包/类
/**
 * Creates a new rename support for the given {@link IPackageFragment}.
 *
 * @param fragment the {@link IPackageFragment} to be renamed.
 * @param newName the package fragment'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(IPackageFragment fragment, String newName, int flags) throws CoreException {
	JavaRenameProcessor processor= new RenamePackageProcessor(fragment);
	return new RenameSupport(processor, newName, flags);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:RenameSupport.java


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