當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。