Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtext 2.0] supress confirmation "Undoing ... affects elements outside of ..." on undo ref
[xtext 2.0] supress confirmation "Undoing ... affects elements outside of ..." on undo ref [message #665321] Thu, 14 April 2011 09:47
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Hi,
I have a simple example which modifies the semantic model using the new
refactoring API. Briefly, I implemented a "Clear state transitions"
refactoring for the FowlerDsl example. I noticed that I always get the
confirmation dialog "Undoing 'Clear transitions' affects elements
outside of test.fowlerdsl'", although there is only one file. Is it
possible to avoid that?

This is how I implemented the refactoring:

public class ClearStateTransitionsRefactoring extends
org.eclipse.ltk.core.refactoring.Refactoring {
....
@Override
public Change createChange(IProgressMonitor pm) throws CoreException,
OperationCanceledException {
Resource targetResource = object.eResource();
try {
if (object instanceof State) {
((State)object).getTransitions().clear();
}
changeUtil.addSaveAsUpdate(targetResource, updateAcceptor);
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, "", "cannot save
resource", e));
}
return updateAcceptor.createCompositeChange(getName(), pm);
}
}


Maybe the problem is the way how I invoke the refactoring:

Refactoring refactoring = new ClearStateTransitionsRefactoring(eObject,
updateAcceptorProvider.get(), changeUtil);
NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
Change change = refactoring.createChange(nullProgressMonitor);
change.initializeValidationData(nullProgressMonitor);
PerformChangeOperation performChangeOperation =
new PerformChangeOperation(change);
performChangeOperation.setUndoManager(RefactoringCore.getUnd oManager(),
refactoring.getName());
performChangeOperation.setSchedulingRule(ResourcesPlugin.get Workspace().getRoot());
ResourcesPlugin.getWorkspace().run(performChangeOperation,
nullProgressMonitor);


My XText version is the nightly build 2.0.0.v201104111605

--
Best regards,
Sebastian Paul
Previous Topic:ClassNotFound while testing the xtext generated editor
Next Topic:[XText]Text generation
Goto Forum:
  


Current Time: Fri Apr 26 00:47:35 GMT 2024

Powered by FUDForum. Page generated in 0.02878 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top