• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RenameArguments类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: process

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
private boolean process(Object element, RenameArguments arguments) {
	if (element instanceof IFile) {
		originalFile = (IFile) element;
		newName =   arguments.getNewName();
		if (!acceptFile(originalFile))
			return false;
		RenameChange operation = new RenameGraphFileChange(originalFile.getProject(),originalFile.getFullPath(), newName);
		renameOperations.add(operation);
		return true;
	}
	if (element instanceof IFolder) {
		IFolder folder = (IFolder) element;
		MoveGraphParticipant mgp = new MoveGraphParticipant();
		moveOperations.addAll(mgp.create(folder,(folder.getParent().getFolder(new Path(arguments.getNewName())))));
		return moveOperations.size()>0;
	}
	return false;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:19,代码来源:RenameGraphParticipant.java


示例2: testHierarchicalDisabledImport

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Test
public void testHierarchicalDisabledImport() throws Exception {
  fRenameSubpackages = true;
  fUpdateTextualMatches = true;

  PackageRename rename =
      new PackageRename(new String[] {"my", "my.pack"}, new String[][] {{}, {"C"}}, "your");
  IPackageFragment thisPackage = rename.fPackages[0];

  ParticipantTesting.reset();

  List toRename =
      new ArrayList(Arrays.asList(JavaElementUtil.getPackageAndSubpackages(thisPackage)));
  toRename.add(thisPackage.getResource());
  String[] renameHandles = ParticipantTesting.createHandles(toRename.toArray());

  rename.execute();

  ParticipantTesting.testRename(
      renameHandles,
      new RenameArguments[] {
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[0]), true),
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[1]), true),
        new RenameArguments("your", true)
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:RenamePackageTest.java


示例3: testToEmptySubPack

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Test
public void testToEmptySubPack() throws Exception {
  fRenameSubpackages = true;

  PackageRename rename =
      new PackageRename(new String[] {"p", "p.q"}, new String[][] {{}, {}}, "p.q");
  IPackageFragment p = rename.fPackages[0];
  IPackageFragment pq = rename.fPackages[1];

  ParticipantTesting.reset();
  String[] renameHandles = ParticipantTesting.createHandles(p, pq);

  rename.createAndPerform(RefactoringStatus.OK);
  assertTrue(p.exists());
  assertTrue(pq.exists());
  IPackageFragment ppq = getRoot().getPackageFragment("p.q.q");
  assertTrue(ppq.exists());

  ParticipantTesting.testRename(
      renameHandles,
      new RenameArguments[] {
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[0]), true),
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[1]), true),
      });
  ParticipantTesting.testCreate(ParticipantTesting.createHandles(ppq.getResource()));
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:RenamePackageTest.java


示例4: loadParticipants

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Override
public RefactoringParticipant[] loadParticipants(
    RefactoringStatus status,
    RefactoringProcessor owner,
    String[] natures,
    SharableParticipants shared) {
  List<RefactoringParticipant> result = new ArrayList<RefactoringParticipant>();
  for (int i = 0; i < fRename.size(); i++) {
    result.addAll(
        Arrays.asList(
            ParticipantManager.loadRenameParticipants(
                status,
                owner,
                fRename.get(i),
                (RenameArguments) fRenameArguments.get(i),
                fParticipantDescriptorFilter.get(i),
                natures,
                shared)));
  }
  result.addAll(
      Arrays.asList(getResourceModifications().getParticipants(status, owner, natures, shared)));
  return result.toArray(new RefactoringParticipant[result.size()]);
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:RenameModifications.java


示例5: addAllResourceModifications

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
private void addAllResourceModifications(
    IPackageFragment rootPackage,
    RenameArguments args,
    boolean renameSubPackages,
    IPackageFragment[] allSubPackages)
    throws CoreException {
  IFolder target = addResourceModifications(rootPackage, args, rootPackage, renameSubPackages);
  if (renameSubPackages) {
    IContainer container = (IContainer) rootPackage.getResource();
    if (container == null) return;
    boolean removeContainer = !container.contains(target);
    for (int i = 0; i < allSubPackages.length; i++) {
      IPackageFragment pack = allSubPackages[i];
      IFolder subTarget = addResourceModifications(rootPackage, args, pack, renameSubPackages);
      if (container.contains(subTarget)) removeContainer = false;
    }
    if (removeContainer) {
      getResourceModifications().addDelete(container);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:RenameModifications.java


示例6: computeRenameModifications

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Override
protected RenameModifications computeRenameModifications() throws CoreException {
  RenameModifications result = new RenameModifications();
  result.rename(fField, new RenameArguments(getNewElementName(), getUpdateReferences()));
  if (fRenameGetter) {
    IMethod getter = getGetter();
    if (getter != null) {
      result.rename(getter, new RenameArguments(getNewGetterName(), getUpdateReferences()));
    }
  }
  if (fRenameSetter) {
    IMethod setter = getSetter();
    if (setter != null) {
      result.rename(setter, new RenameArguments(getNewSetterName(), getUpdateReferences()));
    }
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:RenameFieldProcessor.java


示例7: computeRenameModifications

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Override
protected RenameModifications computeRenameModifications() {
  RenameModifications result = new RenameModifications();
  result.rename(fCu, new RenameArguments(getNewElementName(), getUpdateReferences()));
  if (fRenameTypeProcessor != null) {
    String newTypeName = removeFileNameExtension(getNewElementName());
    RenameTypeArguments arguments =
        new RenameTypeArguments(
            newTypeName,
            getUpdateReferences(),
            getUpdateSimilarDeclarations(),
            getSimilarElements());
    result.rename(
        fRenameTypeProcessor.getType(),
        arguments,
        getUpdateSimilarDeclarations()
            ? new RenameTypeProcessor.ParticipantDescriptorFilter()
            : null);
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:RenameCompilationUnitProcessor.java


示例8: computeRenameModifications

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Override
protected RenameModifications computeRenameModifications() {
  RenameModifications result = new RenameModifications();
  result.rename(
      fType,
      new RenameTypeArguments(
          getNewElementName(),
          getUpdateReferences(),
          getUpdateSimilarDeclarations(),
          getSimilarElements()),
      createParticipantDescriptorFilter());
  if (isPrimaryType()) {
    ICompilationUnit cu = fType.getCompilationUnit();
    String newCUName = getNewCompilationUnit().getElementName();
    result.rename(cu, new RenameArguments(newCUName, getUpdateReferences()));
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:RenameTypeProcessor.java


示例9: checkFinalConditions

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context)
    throws CoreException {
  pm.beginTask("", 1); // $NON-NLS-1$
  try {
    fRenameArguments = new RenameArguments(getNewResourceName(), isUpdateReferences());

    ResourceChangeChecker checker =
        (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
    IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();

    ResourceModifications.buildMoveDelta(deltaFactory, fResource, fRenameArguments);

    return new RefactoringStatus();
  } finally {
    pm.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:RenameResourceProcessor.java


示例10: addAllResourceModifications

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
private void addAllResourceModifications(IPackageFragment rootPackage, RenameArguments args, boolean renameSubPackages, IPackageFragment[] allSubPackages) throws CoreException {
	IFolder target= addResourceModifications(rootPackage, args, rootPackage, renameSubPackages);
	if (renameSubPackages) {
		IContainer container= (IContainer) rootPackage.getResource();
		if (container == null)
			return;
		boolean removeContainer= ! container.contains(target);
		for (int i= 0; i < allSubPackages.length; i++) {
			IPackageFragment pack= allSubPackages[i];
			IFolder subTarget= addResourceModifications(rootPackage, args, pack, renameSubPackages);
			if (container.contains(subTarget))
				removeContainer= false;
		}
		if (removeContainer) {
			getResourceModifications().addDelete(container);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:RenameModifications.java


示例11: addResourceModifications

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
private IFolder addResourceModifications(IPackageFragment rootPackage, RenameArguments args, IPackageFragment pack, boolean renameSubPackages) throws CoreException {
	IContainer container= (IContainer)pack.getResource();
	if (container == null)
		return null;
	IFolder target= computeTargetFolder(rootPackage, args, pack);
	createIncludingParents(target);
	MoveArguments arguments= new MoveArguments(target, args.getUpdateReferences());
	IResource[] resourcesToMove= collectResourcesOfInterest(pack);
	Set<IResource> allMembers= new HashSet<IResource>(Arrays.asList(container.members()));
	for (int i= 0; i < resourcesToMove.length; i++) {
		IResource toMove= resourcesToMove[i];
		getResourceModifications().addMove(toMove, arguments);
		allMembers.remove(toMove);
	}
	for (Iterator<IResource> iter= allMembers.iterator(); iter.hasNext();) {
		IResource element= iter.next();
		if (element instanceof IFile) {
			getResourceModifications().addDelete(element);
			iter.remove();
		}
	}
	if (! renameSubPackages && allMembers.isEmpty()) {
		getResourceModifications().addDelete(container);
	}
	return target;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:RenameModifications.java


示例12: computeRenameModifications

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Override
protected RenameModifications computeRenameModifications() throws CoreException {
	RenameModifications result= new RenameModifications();
	result.rename(fField, new RenameArguments(getNewElementName(), getUpdateReferences()));
	if (fRenameGetter) {
		IMethod getter= getGetter();
		if (getter != null) {
			result.rename(getter, new RenameArguments(getNewGetterName(), getUpdateReferences()));
		}
	}
	if (fRenameSetter) {
		IMethod setter= getSetter();
		if (setter != null) {
			result.rename(setter, new RenameArguments(getNewSetterName(), getUpdateReferences()));
		}
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:RenameFieldProcessor.java


示例13: loadParticipants

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Override
public RefactoringParticipant[] loadParticipants(RefactoringStatus status, SharableParticipants sharedParticipants)
		throws CoreException {
	RenameParticipant[] renameParticipants = ParticipantManager.loadRenameParticipants(status, this,
			renameElementContext, new RenameArguments(newName, true),
			new String[] { XtextProjectHelper.NATURE_ID }, sharedParticipants);
	return renameParticipants;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:9,代码来源:RenameElementProcessor.java


示例14: test0

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Test
public void test0() throws Exception {
  ParticipantTesting.reset();
  String newName = "B";
  String[] renameHandles = helper2("A", newName);
  ParticipantTesting.testRename(
      renameHandles,
      new RenameArguments[] {
        new RenameArguments(newName, true),
        new RenameArguments(newName + ".java", true),
        new RenameArguments(newName + ".java", true)
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:RenameTypeTest.java


示例15: test61

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Test
public void test61() throws Exception {
  ParticipantTesting.reset();
  String[] renameHandles = helperWithTextual("A", "Inner", "InnerB", "A", true, false);
  ParticipantTesting.testRename(
      renameHandles,
      new RenameArguments[] {
        new RenameArguments("InnerB", true),
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:RenameTypeTest.java


示例16: testArguments

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
public static void testArguments(RenameArguments[] args) {
  testNumberOfElements(args.length);
  for (int i = 0; i < args.length; i++) {
    RenameArguments expected = args[i];
    RenameArguments actual = (RenameArguments) fgInstance.fArguments.get(i);
    Assert.assertEquals(expected.getNewName(), actual.getNewName());
    Assert.assertEquals(expected.getUpdateReferences(), actual.getUpdateReferences());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:TestRenameParticipantShared.java


示例17: testArguments

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
public static void testArguments(RenameArguments[] args) {
  testNumberOfInstances(args.length);
  for (int i = 0; i < args.length; i++) {
    RenameArguments expected = args[i];
    RenameArguments actual = getInstance(i).getArguments();
    Assert.assertEquals(expected.getNewName(), actual.getNewName());
    Assert.assertEquals(expected.getUpdateReferences(), actual.getUpdateReferences());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:TestRenameParticipantSingle.java


示例18: testHierarchical01

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Test
public void testHierarchical01() throws Exception {
  fRenameSubpackages = true;

  PackageRename rename =
      new PackageRename(
          new String[] {"my", "my.a", "my.b"},
          new String[][] {{"MyA"}, {"ATest"}, {"B"}},
          "your");
  IPackageFragment thisPackage = rename.fPackages[0];

  ParticipantTesting.reset();
  List toRename =
      new ArrayList(Arrays.asList(JavaElementUtil.getPackageAndSubpackages(thisPackage)));
  toRename.add(thisPackage.getResource());
  String[] renameHandles = ParticipantTesting.createHandles(toRename.toArray());

  rename.execute();

  ParticipantTesting.testRename(
      renameHandles,
      new RenameArguments[] {
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[0]), true),
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[1]), true),
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[2]), true),
        new RenameArguments("your", true)
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:RenamePackageTest.java


示例19: testHierarchical03

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的package包/类
@Test
@Ignore
public void testHierarchical03() throws Exception {
  fRenameSubpackages = true;
  fUpdateTextualMatches = true;

  PackageRename rename =
      new PackageRename(new String[] {"my", "my.pack"}, new String[][] {{}, {"C"}}, "your");
  IPackageFragment thisPackage = rename.fPackages[0];

  ParticipantTesting.reset();

  List toRename =
      new ArrayList(Arrays.asList(JavaElementUtil.getPackageAndSubpackages(thisPackage)));
  toRename.add(thisPackage.getResource());
  String[] createHandles = {};
  String[] deleteHandles = {};
  String[] moveHandles = {};
  String[] renameHandles = ParticipantTesting.createHandles(toRename.toArray());

  rename.execute();

  ParticipantTesting.testCreate(createHandles);
  ParticipantTesting.testDelete(deleteHandles);
  ParticipantTesting.testMove(moveHandles, new MoveArguments[] {});

  ParticipantTesting.testRename(
      renameHandles,
      new RenameArguments[] {
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[0]), true),
        new RenameArguments(rename.getNewPackageName(rename.fPackageNames[1]), true),
        new RenameArguments("your", true)
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:RenamePackageTest.java


示例20: test2

import org.eclipse.ltk.core.refactoring.participants.RenameArguments; //导入依赖的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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CircleGesture类代码示例发布时间:2022-05-23
下一篇:
Java Handler类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap