Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to popup a YES/NO dialog on adding a child node
How to popup a YES/NO dialog on adding a child node [message #123177] Wed, 02 May 2007 02:49 Go to next message
Eclipse UserFriend
Originally posted by: biju_gopinathan.rediffmail.com

Hi friends,

In one of our parent node, we are supposed to add only one
child, and if the user try to add another child, we need to show a
YES/NO dialog to replace the previous child or not.

How can we pop up a YES/NO dialog on adding a child node.

Thanks and Regards biju
Re: How to popup a YES/NO dialog on adding a child node [message #123380 is a reply to message #123177] Wed, 02 May 2007 08:30 Go to previous message
Eclipse UserFriend
Originally posted by: biju_gopinathan.rediffmail.com

Hi Friends,

Its fixed by overriding doExecute method in XXXCreateCommand, if dialog
is to be shown before the model is updated which is given below.

If the dialog is to be shown after the model is updated we need to
overriding XXXCanonicalEditPolicy#handleNotificationEvent to show the
MessageBox.


Thanks and Regards biju

@Override
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
int result=0;

if(XXXDiagramEditorPlugin.getInstance().getWorkbench().getDi splay().getActiveShell()!=null){
MessageBox messageBox=new
MessageBox(XXXDiagramEditorPlugin.getInstance().getWorkbench ().getDisplay().getActiveShell(),SWT.OK
| SWT.CANCEL |SWT.ICON_WARNING);
messageBox.setText("Warning !!!");
messageBox.setMessage("The Slot can contain only one port. If you
add another one ,the existing one will be replaced");
result=messageBox.open();
}
if(result==SWT.CANCEL){
Status status=new
Status(Status.CANCEL,XXXDiagramEditorPlugin.ID,"Cancel");
return status;
}
return super.doExecute(monitor, info);
}
biju wrote:
> Hi friends,
>
> In one of our parent node, we are supposed to add only one
> child, and if the user try to add another child, we need to show a
> YES/NO dialog to replace the previous child or not.
>
> How can we pop up a YES/NO dialog on adding a child node.
>
> Thanks and Regards biju
Previous Topic:Re: [Teneo] GMF Editors
Next Topic:GMF Transaction RollbackException
Goto Forum:
  


Current Time: Wed May 14 18:12:30 EDT 2025

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

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

Back to the top