org.eclipse.xtext.ui.refactoring.IRefactoringUpdateAcceptor Java Examples
The following examples show how to use
org.eclipse.xtext.ui.refactoring.IRefactoringUpdateAcceptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: N4JSRenameStrategy.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Custom logics for creating text edits for definitions of composed members */ @Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { EObject targetElement = resourceSet.getEObject(getTargetElementOriginalURI(), true); if (TypeModelUtils.isComposedTElement(targetElement)) { // If target element is a composed element, create updates for its constituent members List<TMember> constituentMembers = ((TMember) targetElement).getConstituentMembers(); for (TMember constituentMember : constituentMembers) { String text = newName; EAttribute att = getNameAttribute(constituentMember); ITextRegion nameRegion = getOriginalNameRegion(constituentMember, att); ReplaceEdit replaceEdit = new ReplaceEdit(nameRegion.getOffset(), nameRegion.getLength(), text); updateAcceptor.accept(EcoreUtil.getURI(constituentMember).trimFragment(), replaceEdit); } } else { updateAcceptor.accept(getTargetElementOriginalURI().trimFragment(), getDeclarationTextEdit(newName)); } }
Example #2
Source File: ReferenceUpdaterDispatcher.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public void createReferenceUpdates( ElementRenameArguments elementRenameArguments, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, "Updating references", 100); ResourceAccess resourceAccess = resourceAccessProvider.get(); resourceAccess.registerResourceSet(resourceSet); ReferenceDescriptionAcceptor referenceDescriptionAcceptor = createFindReferenceAcceptor(updateAcceptor); referenceFinder.findAllReferences( targetURIConverter.fromIterable(elementRenameArguments.getRenamedElementURIs()), resourceAccess, indexData, referenceDescriptionAcceptor, progress.newChild(2)); Multimap<IReferenceUpdater, IReferenceDescription> updater2descriptions = referenceDescriptionAcceptor .getReferenceUpdater2ReferenceDescriptions(); SubMonitor updaterProgress = progress.newChild(98).setWorkRemaining(updater2descriptions.keySet().size()); for (IReferenceUpdater referenceUpdater : updater2descriptions.keySet()) { if (updaterProgress.isCanceled()) return; referenceUpdater.createReferenceUpdates(elementRenameArguments, updater2descriptions.get(referenceUpdater), updateAcceptor, updaterProgress.newChild(1)); } }
Example #3
Source File: DefaultReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void createReferenceUpdate(EObject referringElement, URI referringResourceURI, EReference reference, int indexInList, EObject newTargetElement, IRefactoringUpdateAcceptor updateAcceptor) { if (!transientValueService.isValueInListTransient(referringElement, indexInList, reference)) { ITextRegion referenceTextRegion = locationInFileProvider.getFullTextRegion(referringElement, reference, indexInList); if (referenceTextRegion != null) { CrossReference crossReference = getCrossReference(referringElement, referenceTextRegion.getOffset()); if (crossReference != null) { RefTextEvaluator refTextComparator = getRefTextEvaluator(referringElement, referringResourceURI, reference, indexInList, newTargetElement); String newReferenceText = crossReferenceSerializer.getCrossRefText(referringElement, crossReference, newTargetElement, refTextComparator, referenceTextRegion, updateAcceptor.getRefactoringStatus()); if (newReferenceText == null) { newReferenceText = resolveNameConflict(referringElement, reference, newTargetElement, updateAcceptor); } if (newReferenceText == null) { updateAcceptor.getRefactoringStatus().add(RefactoringStatus.ERROR, "Refactoring introduces a name conflict.", referringElement, referenceTextRegion); } createTextChange(referenceTextRegion, newReferenceText, referringElement, newTargetElement, reference, referringResourceURI, updateAcceptor); } } } }
Example #4
Source File: DefaultReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void createReferenceUpdate(IReferenceDescription referenceDescription, URI referringResourceURI, ElementRenameArguments elementRenameArguments, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { URI referringElementNewURI = elementRenameArguments .getNewElementURI(referenceDescription.getSourceEObjectUri()); EObject referringElement = resourceSet.getEObject(referringElementNewURI, false); if (referringElement == null) { updateAcceptor.getRefactoringStatus().add(RefactoringStatus.ERROR, "Cannot find new referring element.", referringElementNewURI); log.error("Cannot find new referring element. ReferringElementURI:" + referringElementNewURI); return; } URI targetElementNewURI = elementRenameArguments.getNewElementURI(referenceDescription.getTargetEObjectUri()); EObject newTargetElement = resourceSet.getEObject(targetElementNewURI, false); if (newTargetElement == null) { updateAcceptor.getRefactoringStatus().add(RefactoringStatus.ERROR, "Cannot find new target element.", targetElementNewURI); log.error("Cannot find new target element. ReferringElement:" + referringElement + " targetElementNewURI:" + targetElementNewURI); return; } createReferenceUpdate(referringElement, referringResourceURI, referenceDescription.getEReference(), referenceDescription.getIndexInList(), newTargetElement, updateAcceptor); }
Example #5
Source File: DefaultReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override protected void createReferenceUpdates(ElementRenameArguments elementRenameArguments, Multimap<URI, IReferenceDescription> resource2references, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, "Creating reference updates", resource2references.keySet() .size()); for (URI referringResourceURI : resource2references.keySet()) { if (progress.isCanceled()) return; Resource referringResource = resourceSet.getResource(referringResourceURI, false); if (!(referringResource instanceof XtextResource)) { updateAcceptor.getRefactoringStatus().add(ERROR, "Resource {0} is not an XtextResource.", referringResource.getURI(), resourceSet); } else { Iterable<IReferenceDescription> referenceDescriptions = resource2references.get(referringResourceURI); processReferringResource(referringResource, referenceDescriptions, elementRenameArguments, updateAcceptor, progress); } progress.worked(1); } }
Example #6
Source File: XbaseReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override protected void processReferringResource(Resource referringResource, Iterable<IReferenceDescription> referenceDescriptions, ElementRenameArguments elementRenameArguments, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) { ImportAwareUpdateAcceptor importAwareUpdateAcceptor = createUpdateAcceptor(referringResource, updateAcceptor); Iterable<IReferenceDescription> importTypeReferences = getImportTypeReferences(referenceDescriptions); super.processReferringResource(referringResource, importTypeReferences, elementRenameArguments, importAwareUpdateAcceptor, monitor); importAwareUpdateAcceptor.getImportSection().update(); Iterable<IReferenceDescription> notImportTypeReferences = getNotImportTypeReferences(referenceDescriptions); super.processReferringResource(referringResource, notImportTypeReferences, elementRenameArguments, importAwareUpdateAcceptor, monitor); List<ReplaceRegion> importChanges = importAwareUpdateAcceptor.getImportSection().rewrite(); TextEdit importChangeEdit = replaceConverter.convertToTextEdit(importChanges); if(importChangeEdit != null) updateAcceptor.accept(referringResource.getURI(), importChangeEdit); }
Example #7
Source File: DotRenameStrategy.java From gef with Eclipse Public License 2.0 | 6 votes |
@Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { super.createDeclarationUpdates(newName, resourceSet, updateAcceptor); // perform renaming of the dependent element if (targetElement instanceof NodeId) { URI resourceURI = getTargetElementOriginalURI().trimFragment(); NodeId targetNodeId = (NodeId) targetElement; List<NodeId> dependentNodeIds = DotAstHelper .getAllNodeIds(targetNodeId); for (NodeId dependentNodeId : dependentNodeIds) { ITextRegion dependentNodeIdTextRegion = locationInFileProvider .getFullTextRegion(dependentNodeId); TextEdit referenceEdit = new ReplaceEdit( dependentNodeIdTextRegion.getOffset(), dependentNodeIdTextRegion.getLength(), newName); updateAcceptor.accept(resourceURI, referenceEdit); } } }
Example #8
Source File: AbstractReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void createReferenceUpdates( ElementRenameArguments elementRenameArguments, Iterable<IReferenceDescription> referenceDescriptions, IRefactoringUpdateAcceptor updateAcceptor, RefactoringResourceSetProvider resourceSetProvider, IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, 100); progress.beginTask("Sort references by project", 1); Multimap<IProject, IReferenceDescription> project2references = sorter.sortByProject(referenceDescriptions); SubMonitor allProjectsProgress = progress.newChild(98).setWorkRemaining(project2references.keySet().size()); for (IProject project : project2references.keySet()) { if (allProjectsProgress.isCanceled()) { throw new OperationCanceledException(); } Multimap<URI, IReferenceDescription> resource2references = sorter.sortByResource(project2references .get(project)); ResourceSet resourceSet = resourceSetProvider.get(project); StatusWrapper status = updateAcceptor.getRefactoringStatus(); createClusteredReferenceUpdates(elementRenameArguments, resource2references, resourceSet, updateAcceptor, status, allProjectsProgress.newChild(1)); } }
Example #9
Source File: XbaseReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected void createTextChange(ITextRegion referenceTextRegion, String newReferenceText, EObject referringElement, EObject newTargetElement, EReference reference, URI referringResourceURI, IRefactoringUpdateAcceptor updateAcceptor) { if (newReferenceText != null && updateAcceptor instanceof ImportAwareUpdateAcceptor && isReferenceToJvmType(newTargetElement, reference)) { JvmType newTargetType = (JvmType) newTargetElement; ImportAwareUpdateAcceptor importAwareUpdateAcceptor = (ImportAwareUpdateAcceptor) updateAcceptor; Pair<JvmDeclaredType, QualifiedName> importedTypeAndRelativeName = getImportedTypeAndRelativeName(newTargetType, importAwareUpdateAcceptor.getImportSection()); if(importedTypeAndRelativeName != null) { JvmDeclaredType importedType = importedTypeAndRelativeName.getFirst(); QualifiedName importRelativeName = importedTypeAndRelativeName.getSecond(); importAwareUpdateAcceptor.removeImport(importedType, false, false, null); if (isReferencedByQualifiedName(referringElement, newTargetType, importRelativeName)) { QualifiedName newTypeQualifiedName = qualifiedNameProvider.getFullyQualifiedName(newTargetElement); newReferenceText = getLinkText(newTypeQualifiedName, newReferenceText); } else { if(!isEmpty(importedType.getPackageName())) { importAwareUpdateAcceptor.acceptImport(importedType, false, false, null); } newReferenceText = getLinkText(importRelativeName, newReferenceText); } } } super.createTextChange(referenceTextRegion, newReferenceText, referringElement, newTargetElement, reference, referringResourceURI, updateAcceptor); }
Example #10
Source File: DotHtmlLabelRenameStrategy.java From gef with Eclipse Public License 2.0 | 5 votes |
@Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { super.createDeclarationUpdates(newName, resourceSet, updateAcceptor); // perform renaming of the dependent element URI resourceURI = getTargetElementOriginalURI().trimFragment(); if (targetElement instanceof HtmlTag) { HtmlTag htmlTag = (HtmlTag) targetElement; if (!htmlTag.isSelfClosing()) { List<INode> nodes = NodeModelUtils.findNodesForFeature(htmlTag, HtmllabelPackage.Literals.HTML_TAG__CLOSE_NAME); if (nodes.size() == 1) { INode node = nodes.get(0); TextEdit referenceEdit = new ReplaceEdit(node.getOffset(), node.getLength(), newName); updateAcceptor.accept(resourceURI, referenceEdit); } else { System.err.println( "Exact 1 node is expected for the name of the html closing tag, but got " //$NON-NLS-1$ + nodes.size()); } } } }
Example #11
Source File: XtendRenameStrategy.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { super.createDeclarationUpdates(newName, resourceSet, updateAcceptor); IPath path = getPathToRename(getTargetElementOriginalURI(), resourceSet); if (path != null && path.lastSegment().equals(this.getOriginalName()+".xtend")) updateAcceptor.accept(getTargetElementOriginalURI().trimFragment(), new RenameResourceChange(path, newName + "." + path.getFileExtension())); }
Example #12
Source File: XbaseReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected boolean hasImportedType(IRefactoringUpdateAcceptor updateAcceptor, JvmDeclaredType declaringType) { if (updateAcceptor instanceof ImportAwareUpdateAcceptor) { ImportAwareUpdateAcceptor importAwareUpdateAcceptor = (ImportAwareUpdateAcceptor) updateAcceptor; return importAwareUpdateAcceptor.getImportSection().hasImportedType(declaringType); } return false; }
Example #13
Source File: XtendReferenceUpdater.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override protected void createReferenceUpdate(final EObject referringElement, final URI referringResourceURI, final EReference reference, final int indexInList, final EObject newTargetElement, final IRefactoringUpdateAcceptor updateAcceptor) { if ((((referringElement instanceof XConstructorCall) && (referringElement.eContainer() instanceof AnonymousClass)) && (newTargetElement instanceof JvmType))) { return; } super.createReferenceUpdate(referringElement, referringResourceURI, reference, indexInList, newTargetElement, updateAcceptor); }
Example #14
Source File: XbaseReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected String resolveNameConflict(EObject referringElement, EReference reference, EObject newTargetElement, IRefactoringUpdateAcceptor updateAcceptor) { if (EcoreUtil2.isAssignableFrom(TypesPackage.Literals.JVM_IDENTIFIABLE_ELEMENT, reference.getEReferenceType())) { if (newTargetElement instanceof JvmType) { JvmType type = (JvmType) newTargetElement; if (canLinkJvmType(referringElement, type)) { return toString(qualifiedNameProvider.getFullyQualifiedName(type)); } } if (newTargetElement instanceof JvmFeature) { JvmFeature feature = (JvmFeature) newTargetElement; if (feature.isStatic() && !isStaticExtensionFeatureCall(referringElement, reference, newTargetElement)) { JvmDeclaredType declaringType = feature.getDeclaringType(); if (canLinkJvmType(referringElement, declaringType)) { JvmDeclaredType parentType = declaringType; List<String> segments = new LinkedList<String>(); segments.add(feature.getSimpleName()); segments.add(0, parentType.getSimpleName()); while (!hasImportedType(updateAcceptor, parentType)) { parentType = parentType.getDeclaringType(); if (parentType == null) { return toString(qualifiedNameProvider.getFullyQualifiedName(feature)); } segments.add(0, parentType.getSimpleName()); } return toString(QualifiedName.create(segments)); } } } } return super.resolveNameConflict(referringElement, reference, newTargetElement, updateAcceptor); }
Example #15
Source File: JvmModelReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected void createReferenceUpdate(EObject referringElement, URI referringResourceURI, EReference reference, int indexInList, EObject newTargetElement, IRefactoringUpdateAcceptor updateAcceptor) { if (!isInferredJvmModelElement(referringElement)) super.createReferenceUpdate(referringElement, referringResourceURI, reference, indexInList, newTargetElement, updateAcceptor); }
Example #16
Source File: AbstractReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void createReferenceUpdates(ElementRenameArguments elementRenameArguments, Iterable<IReferenceDescription> referenceDescriptions, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) { RefactoringResourceSetProvider provider = elementRenameArguments.getResourceSetProvider(); createReferenceUpdates(elementRenameArguments, referenceDescriptions, updateAcceptor, provider != null ? provider : resourceSetProvider, monitor); }
Example #17
Source File: EmfResourceReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected void createReferenceUpdates(ElementRenameArguments elementRenameArguments, Multimap<URI, IReferenceDescription> resource2references, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) { for (URI referringResourceURI : resource2references.keySet()) { try { if (monitor.isCanceled()) throw new OperationCanceledException(); Resource referringResource = resourceSet.getResource(referringResourceURI, false); EObject refactoredElement = resourceSet.getEObject(elementRenameArguments.getNewElementURI(elementRenameArguments.getTargetElementURI()), true); if (referringResource != refactoredElement.eResource()) { if (refactoredElement instanceof EClassifier) { for (IReferenceDescription reference : resource2references.get(referringResourceURI)) { EObject source = referringResource.getEObject(reference.getSourceEObjectUri().fragment()); if (source == null) { LOG.error("Couldn't find source element "+ reference.getSourceEObjectUri() + " in " + referringResource.getURI()); } else { EObject referringEReference = source.eContainer(); if (referringEReference != null && referringEReference instanceof EReference) ((EReference) referringEReference).setEType((EClassifier) refactoredElement); } } } changeUtil.addSaveAsUpdate(referringResource, updateAcceptor); } } catch (OperationCanceledException e) { throw e; } catch (Exception exc) { throw new WrappedException(exc); } } }
Example #18
Source File: DefaultReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void createTextChange(ITextRegion referenceTextRegion, String newReferenceText, EObject referringElement, EObject newTargetElement, EReference reference, URI referringResourceURI, IRefactoringUpdateAcceptor updateAcceptor) { if (newReferenceText != null) { TextEdit referenceEdit = new ReplaceEdit(referenceTextRegion.getOffset(), referenceTextRegion.getLength(), newReferenceText); updateAcceptor.accept(referringResourceURI, referenceEdit); } }
Example #19
Source File: AbstractReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void createClusteredReferenceUpdates(ElementRenameArguments elementRenameArguments, Multimap<URI, IReferenceDescription> resource2references, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor, StatusWrapper status, IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, resource2references.keySet().size() + 1); if (loadTargetResources(resourceSet, elementRenameArguments, status, progress.newChild(1))) { if (getClusterSize() > 0) { Set<Resource> targetResources = newHashSet(resourceSet.getResources()); Multimap<URI, IReferenceDescription> cluster = HashMultimap.create(); SubMonitor clusterMonitor = progress.newChild(1); for (URI referringResourceURI : resource2references.keySet()) { cluster.putAll(referringResourceURI, resource2references.get(referringResourceURI)); if (cluster.keySet().size() == getClusterSize()) { unloadNonTargetResources(resourceSet, targetResources); createReferenceUpdatesForCluster(elementRenameArguments, cluster, resourceSet, updateAcceptor, status, clusterMonitor); cluster.clear(); } } if (!cluster.isEmpty()) { unloadNonTargetResources(resourceSet, targetResources); createReferenceUpdatesForCluster(elementRenameArguments, cluster, resourceSet, updateAcceptor, status, clusterMonitor); } } else { createReferenceUpdatesForCluster(elementRenameArguments, resource2references, resourceSet, updateAcceptor, status, progress.newChild(resource2references.keySet().size())); } } }
Example #20
Source File: DefaultReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Override this method for pre- or post-processing hooks. */ protected void processReferringResource(Resource referringResource, Iterable<IReferenceDescription> referenceDescriptions, ElementRenameArguments elementRenameArguments, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) { ((XtextResource) referringResource).getCache().clear(referringResource); for (IReferenceDescription referenceDescription : referenceDescriptions) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } createReferenceUpdate(referenceDescription, referringResource.getURI(), elementRenameArguments, referringResource.getResourceSet(), updateAcceptor); } }
Example #21
Source File: EmfResourceChangeUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public void addSaveAsUpdate(Resource resource, IRefactoringUpdateAcceptor updateAcceptor) throws IOException { IRefactoringDocument document = updateAcceptor.getDocument(resource.getURI()); if (document == null) return; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); resource.save(outputStream, null); String newContent = new String(outputStream.toByteArray(), encodingProvider.getEncoding(resource.getURI())); updateAcceptor.accept(resource.getURI(), new ReplaceEdit(0, document.getOriginalContents().length(), newContent)); }
Example #22
Source File: AbstractReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void createReferenceUpdatesForCluster(ElementRenameArguments elementRenameArguments, Multimap<URI, IReferenceDescription> resource2references, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor, StatusWrapper status, IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, 100); List<URI> unloadableResources = loadReferringResources(resourceSet, resource2references.keySet(), status, progress.newChild(10)); if (progress.isCanceled()) { throw new OperationCanceledException(); } for (URI unloadableResouce : unloadableResources) resource2references.removeAll(unloadableResouce); List<IReferenceDescription> unresolvableReferences = resolveReferenceProxies(resourceSet, resource2references.values(), status, progress.newChild(70)); if (progress.isCanceled()) { throw new OperationCanceledException(); } for (IReferenceDescription unresolvableReference : unresolvableReferences) { URI unresolvableReferringResource = unresolvableReference.getSourceEObjectUri().trimFragment(); resource2references.remove(unresolvableReferringResource, unresolvableReference); } elementRenameArguments.getRenameStrategy().applyDeclarationChange(elementRenameArguments.getNewName(), resourceSet); if (progress.isCanceled()) { throw new OperationCanceledException(); } createReferenceUpdates(elementRenameArguments, resource2references, resourceSet, updateAcceptor, progress.newChild(20)); if (progress.isCanceled()) { throw new OperationCanceledException(); } elementRenameArguments.getRenameStrategy().revertDeclarationChange(resourceSet); }
Example #23
Source File: EmfResourceRenameStrategy.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { Resource targetResource = resourceSet.getResource(getTargetElementOriginalURI().trimFragment(), false); EcoreUtil.resolveAll(targetResource); applyDeclarationChange(newName, resourceSet); try { changeUtil.addSaveAsUpdate(targetResource, updateAcceptor); } catch (IOException exc) { updateAcceptor.getRefactoringStatus().add(ERROR, exc.getMessage()); } finally { revertDeclarationChange(resourceSet); } }
Example #24
Source File: XbaseReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public ImportAwareUpdateAcceptor(XtextResource resource, IRefactoringUpdateAcceptor delegate) { this.resource = resource; this.delegate = delegate; this.importSection = importSectionFactory.parse(resource); }
Example #25
Source File: EcorePackageRenameStrategy.java From sarl with Apache License 2.0 | 4 votes |
@Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { updateAcceptor.accept(this.uriProvider.apply(resourceSet), getDeclarationTextEdit(newName, resourceSet)); }
Example #26
Source File: DispatchMethodRenameStrategy.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { for(IRenameStrategy child: children) child.createDeclarationUpdates(newName, resourceSet, updateAcceptor); }
Example #27
Source File: AbstractReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected abstract void createReferenceUpdates(ElementRenameArguments elementRenameArguments, Multimap<URI, IReferenceDescription> resource2references, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor);
Example #28
Source File: RenameElementProcessor.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected void transferChangeRedirector(IRefactoringUpdateAcceptor currentUpdateAcceptor2) { if(currentUpdateAcceptor instanceof IChangeRedirector.Aware && renameElementContext instanceof IChangeRedirector.Aware) ((IChangeRedirector.Aware) currentUpdateAcceptor).setChangeRedirector( ((IChangeRedirector.Aware)getRenameElementContext()).getChangeRedirector()); }
Example #29
Source File: JvmMemberRenameStrategy.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void createDeclarationUpdates(String newName, ResourceSet resourceSet, IRefactoringUpdateAcceptor updateAcceptor) { }
Example #30
Source File: NullReferenceUpdater.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void createReferenceUpdates( ElementRenameArguments elementRenameArguments, Iterable<IReferenceDescription> referenceDescriptions, IRefactoringUpdateAcceptor updateAcceptor, IProgressMonitor monitor) { // nothing to do }