Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to delete ae element programmly?
How to delete ae element programmly? [message #1016015] Mon, 04 March 2013 15:36 Go to next message
Joshua Yang is currently offline Joshua YangFriend
Messages: 11
Registered: October 2012
Junior Member
I loaded model from file to delete an element and all links/edges with it.

Since I figured out that pop menu "Delete from Model" can do the job perfectly.
I wandered to use the command .
My code goes as belows:
ResourceSet resourceSet  = new ResourceSetImpl();
TransactionalEditingDomain domainx = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
Resource res = domainx.loadResource(fileUri.path());
xxxImpl toDelete = (xxxImpl)((xxxModelImpl)res.getContents().get(0)).getXXX().get(0);

IOperationHistory history = OperationHistoryFactory.getOperationHistory();
DestroyElementRequest desRequest = new DestroyElementRequest(toDelete, true);
history.execute(new DestroyElementCommand(desRequest), new NullProgressMonitor(), null);


however , it goes not as i wanted . The code delete the element indeed,while the edgs goes still. it causes the problem that i can not open the file any more.

What should I do ,Could you please give a helping hand?
Re: How to delete ae element programmly? [message #1016134 is a reply to message #1016015] Tue, 05 March 2013 08:10 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

did you try to simply delete the semantic model element by using an EMF command? The command would be DeleteCommand. You can create a new command by using DeleteCommand.create(...). This should do the job.

Ralph
Previous Topic:delete an element from model
Next Topic:How to create a new EditingDomain?
Goto Forum:
  


Current Time: Thu Apr 25 23:05:57 GMT 2024

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

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

Back to the top