|
|
|
|
Re: from emf model to GMF Edit part [message #157563 is a reply to message #157507] |
Mon, 29 October 2007 14:04  |
Eclipse User |
|
|
|
Originally posted by: r.q.com
What I am trying to say is I cannot delete in EditPart I have to delete in
DeleteXXXActivity as mentioned below and I am not able to create Delete
Command which will take care of deleting the edit parts. Any help please..
--------------------
public class DeleteXXXActivity extends ActionDelegate implements
IEditorActionDelegate {
private ISelection s = null;
@Override
public void run(IAction action) {
if (s != null) {
doDelete(s);
s = null;
}
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
this.s = selection;
super.selectionChanged(action, selection);
}
private void doDelete(ISelection s1) {
IStructuredSelection sS = (IStructuredSelection) s1;
EditPart sObj = (EditPart) sS.getFirstElement();
EObject modelPart = EditPartUtility.getAssociatedSemanticObject
(sObj);
//after getting the above model part we delete it in a subclass
//of org.eclipse.emf.transaction.RecordingCommand
/*TransactionalEditingDomain domain = EditingDomainUtility
getTransactionalEditingDomain(target);
Command cmd = //my custom commnad class to delete emf model
((TransactionalCommandStack) domain.getCommandStack()).execute(cmd,
null);
Now here I have to delete some other emf nodes as well as there editparts
and figures(if exists) programatically but I am not able to figure out how
i can do that here?
Any help or if you need more information.
}
-----------------------
You can delete editparts from your classes editparts.
If you delete from a editpart class, also you delete the element model.
To do this, you have to override the method handleEventNotification.
I write the template:
/**
* @generated NOT
* @param notification : the notification event
*/
protected final void handleNotificationEvent(final Notification
notification) {
//your code to delete elements
super.handleNotificationEvent(notification);
}
If you is deleting a element, the editpart that capture this event is the
container of removed element.
I think that you want this.
Regards.
"r q" <r@q.com> escribi�� el mensaje de
noticias:71a1d2569816cf0244d47338babf39dd$1@xxxxxxxx...
The problem is like this
In my emf/gmf model, some emf nodes are not represented in gmf model. They
are there only in project explorer. When we delete these nodes some other
nodes should also get deleted from emf model (as well as there
corresponding gmf part if its there). When I am deleting such nodes from
emf model, I am deleting other related emf nodes programatically but their
gmf part is not getting deleted from the notational view if it exists.
Please let me know how I can get the corresponding GMF parts (edit parts)
of such nodes so that I can delete them programatically.
If i have a emf node how can I get its corresponding GMF editpart.
|
|
|
Powered by
FUDForum. Page generated in 0.26575 seconds