本文整理汇总了Java中org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator类的典型用法代码示例。如果您正苦于以下问题:Java IDependentElementsCalculator类的具体用法?Java IDependentElementsCalculator怎么用?Java IDependentElementsCalculator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDependentElementsCalculator类属于org.eclipse.xtext.ui.refactoring包,在下文中一共展示了IDependentElementsCalculator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindIDependentElementsCalculator
import org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator; //导入依赖的package包/类
public Class<? extends IDependentElementsCalculator> bindIDependentElementsCalculator() {
return DefaultDependentElementsCalculator.class;
}
示例2: bindIDependentElementsCalculator
import org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator; //导入依赖的package包/类
public Class<? extends IDependentElementsCalculator> bindIDependentElementsCalculator() {
return JvmModelDependentElementsCalculator.class;
}
示例3: getLinkedPositionGroup
import org.eclipse.xtext.ui.refactoring.IDependentElementsCalculator; //导入依赖的package包/类
public LinkedPositionGroup getLinkedPositionGroup(IRenameElementContext renameElementContext,
IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, 100);
XtextEditor editor = (XtextEditor) renameElementContext.getTriggeringEditor();
IProject project = projectUtil.getProject(renameElementContext.getContextResourceURI());
if (project == null)
throw new IllegalStateException("Could not determine project for context resource "
+ renameElementContext.getContextResourceURI());
ResourceSet resourceSet = resourceSetProvider.get(project);
EObject targetElement = resourceSet.getEObject(renameElementContext.getTargetElementURI(), true);
if (targetElement == null)
throw new IllegalStateException("Target element could not be loaded");
IRenameStrategy.Provider strategyProvider = globalServiceProvider.findService(targetElement,
IRenameStrategy.Provider.class);
IRenameStrategy renameStrategy = null;
try {
renameStrategy = strategyProvider.get(targetElement, renameElementContext);
} catch(NoSuchStrategyException exc) {
// handle in next line
}
if(renameStrategy == null)
throw new IllegalArgumentException("Cannot find a rename strategy for "
+ notNull(renameElementContext.getTargetElementURI()));
String newName = renameStrategy.getOriginalName();
IResourceServiceProvider resourceServiceProvider = resourceServiceProviderRegistry.getResourceServiceProvider(renameElementContext.getTargetElementURI());
IDependentElementsCalculator dependentElementsCalculator = resourceServiceProvider.get(IDependentElementsCalculator.class);
Iterable<URI> dependentElementURIs = dependentElementsCalculator.getDependentElementURIs(targetElement,
progress.newChild(10));
LocalResourceRefactoringUpdateAcceptor updateAcceptor = updateAcceptorProvider.get();
updateAcceptor.setLocalResourceURI(renameElementContext.getContextResourceURI());
renameStrategy.createDeclarationUpdates(newName, resourceSet, updateAcceptor);
Map<URI, URI> original2newEObjectURI = renamedElementTracker.renameAndTrack(
concat(Collections.singleton(renameElementContext.getTargetElementURI()), dependentElementURIs),
newName, resourceSet, renameStrategy, progress.newChild(10));
ElementRenameArguments elementRenameArguments = new ElementRenameArguments(
renameElementContext.getTargetElementURI(), newName, renameStrategy, original2newEObjectURI);
final List<IReferenceDescription> referenceDescriptions = newArrayList();
IAcceptor<IReferenceDescription> referenceAcceptor = new IAcceptor<IReferenceDescription>() {
public void accept(IReferenceDescription referenceDescription) {
referenceDescriptions.add(referenceDescription);
}
};
referenceFinder.findReferences(elementRenameArguments.getRenamedElementURIs(),
singleton(renameElementContext.getContextResourceURI()), new SimpleLocalResourceAccess(resourceSet),
referenceAcceptor, progress.newChild(60));
referenceUpdater.createReferenceUpdates(elementRenameArguments, referenceDescriptions, updateAcceptor,
progress.newChild(10));
List<ReplaceEdit> textEdits = updateAcceptor.getTextEdits();
LinkedPositionGroup linkedGroup = createLinkedGroupFromReplaceEdits(textEdits, editor,
renameStrategy.getOriginalName(), progress.newChild(10));
return linkedGroup;
}