How to popup a YES/NO dialog on adding a child node [message #123177] |
Wed, 02 May 2007 02:49  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03673 seconds