shouldProceed Changing the Text of Message Dialog [message #231547] |
Wed, 27 May 2009 11:42 |
|
Hi All,,
I want to show the Custom Message when the user tries to delete any figure.
I checked the ItemSemanticEditPolicy class of editpart where we can call
shouldProceed(req) which show a message dailog..
I want to show the custom message as the name of the figure is used
somewhere else .
But the messages are final.
Please help ..Its urgent
Regards
Govind R.
|
|
|
|
Re: shouldProceed Changing the Text of Message Dialog [message #231685 is a reply to message #231649] |
Thu, 28 May 2009 10:46 |
|
Hi Juan..
Thanks.. but i dont have any XXXDeleteCommand Class generated as
XXXCreateCommands.
its Using DeleteCommand of gmf runtime ..
I tried to call my custom message dialog in XXXBaseItemSemanticEditPolicy
Class getSemanticCommand method when
if (shouldProceed) {
myCustomDialog();// this returns boolean.
if (completedRequest instanceof DestroyRequest) {
TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
.getEditingDomain();
Command deleteViewCommand = new ICommandProxy(
new DeleteCommand(editingDomain, (View) getHost() .getModel()));
semanticCommand = semanticCommand == null ? deleteViewCommand
: semanticCommand.chain(deleteViewCommand);
}
return semanticCommand;
}
But when click on the editpart it show the dialog.. i want the dialog to
come when i click on the menu item DeleteFromModel when i right click on
editpart.
Regards
Govind R
|
|
|
Re: shouldProceed Changing the Text of Message Dialog [message #231693 is a reply to message #231685] |
Thu, 28 May 2009 12:20 |
Peter Lang Messages: 153 Registered: July 2009 |
Senior Member |
|
|
You could try to return your own DeleteCommand in
XxxBaseItemSemanticEditPolicy, overriding doExecuteWithResult.
Here's an example that I tried - just to give an idea, not what the final
result should look like ;-)
Command deleteViewCommand = new ICommandProxy(
new DeleteCommand(editingDomain, (View) getHost().getModel()) {
// --------------
@Override
protected CommandResult doExecuteWithResult(
IProgressMonitor progressMonitor,
IAdaptable info)
throws ExecutionException {
if(MessageDialog.openQuestion(Display.getDefault().getActive Shell(),
"Sure?", "Do you really want to delete?")) {
return super.doExecuteWithResult(progressMonitor, info);
}
return CommandResult.newCancelledCommandResult();
}
// --------------
});
semanticCommand = semanticCommand == null ? deleteViewCommand
: semanticCommand.chain(deleteViewCommand);
Regards, Peter
govind wrote:
> Hi Juan..
> Thanks.. but i dont have any XXXDeleteCommand Class generated as
> XXXCreateCommands.
> its Using DeleteCommand of gmf runtime ..
> I tried to call my custom message dialog in XXXBaseItemSemanticEditPolicy
> Class getSemanticCommand method when
> if (shouldProceed) {
> myCustomDialog();// this returns boolean.
> if (completedRequest instanceof DestroyRequest) {
> TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
> .getEditingDomain();
> Command deleteViewCommand = new ICommandProxy(
> new DeleteCommand(editingDomain, (View) getHost() .getModel()));
> semanticCommand = semanticCommand == null ? deleteViewCommand
> : semanticCommand.chain(deleteViewCommand);
> }
> return semanticCommand;
> }
> But when click on the editpart it show the dialog.. i want the dialog to
> come when i click on the menu item DeleteFromModel when i right click on
> editpart.
> Regards
> Govind R
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04156 seconds