Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » from emf model to GMF Edit part
from emf model to GMF Edit part [message #157382] Fri, 26 October 2007 16:06 Go to next message
Eclipse UserFriend
Originally posted by: r.q.com

If i have a emf node how can I get its corresponding GMF editpart.
Re: from emf model to GMF Edit part [message #157408 is a reply to message #157382] Fri, 26 October 2007 16:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: r.q.com

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.
Re: from emf model to GMF Edit part [message #157444 is a reply to message #157408] Sat, 27 October 2007 21:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ijerez2001.msn.com

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ó en el mensaje de
noticias:71a1d2569816cf0244d47338babf39dd$1@www.eclipse.org...
> 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.
>
Re: from emf model to GMF Edit part [message #157507 is a reply to message #157444] Mon, 29 October 2007 10:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: r.q.com

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&#56130;&#56686; el mensaje de
noticias:71a1d2569816cf0244d47338babf39dd$1@xxxxxxxxe.org...

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.
Re: from emf model to GMF Edit part [message #157563 is a reply to message #157507] Mon, 29 October 2007 14:04 Go to previous message
Eclipse UserFriend
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&#56130;&#56686; 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.
Previous Topic:Request/Command infrastructure
Next Topic:using emf functions in gef application
Goto Forum:
  


Current Time: Fri May 09 04:00:04 EDT 2025

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

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

Back to the top