Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » shouldProceed Changing the Text of Message Dialog
shouldProceed Changing the Text of Message Dialog [message #231547] Wed, 27 May 2009 11:42 Go to next message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
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 #231649 is a reply to message #231547] Thu, 28 May 2009 06:47 Go to previous messageGo to next message
Juan is currently offline JuanFriend
Messages: 29
Registered: July 2009
Junior Member
Hi govind,

Why dont you try to create manually the Message Dialog using :
MessageDialog.openXXX(PlatformUI.getWorkbench().getActiveWor kbenchWindow().getShell(),
"Message's title", "Message's text");

You should add it when it is needed, for example in method canExecute()
of your delete command. I'm using it and works fine.

Best Regards.




govind escribió:
> 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 Go to previous messageGo to next message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
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 Go to previous messageGo to next message
Peter Lang is currently offline Peter LangFriend
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
Re: shouldProceed Changing the Text of Message Dialog [message #232141 is a reply to message #231693] Wed, 03 June 2009 10:57 Go to previous messageGo to next message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
Hi Peter

Thanks a lot..


Regards
Govind R.
Re: shouldProceed Changing the Text of Message Dialog [message #232565 is a reply to message #231693] Fri, 05 June 2009 10:22 Go to previous messageGo to next message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
Hi Peter..

There is a small problem with that solution.

Actually i have figure A which can figure B..

Like i can drag a B in A.

So when i deleting the A the message dialog appears twice one while
deleting A and one while Deleting B..

Any Solution to this..

Regards
Govind R
Re: shouldProceed Changing the Text of Message Dialog [message #232896 is a reply to message #232565] Mon, 08 June 2009 10:45 Go to previous messageGo to next message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
Hi Peter

I still didn't get.

Regards
Govind R
Re: shouldProceed Changing the Text of Message Dialog [message #232934 is a reply to message #232565] Mon, 08 June 2009 12:36 Go to previous messageGo to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
Sorry, not sure about that.

Assuming that you are not using GMF 2.2 at the moment, you might try to
switch, if this is an option. Object deletion seems to work slightly
different now and changing generated
XxxBaseItemSemanticEditPolicy.addDeleteViewCommand seems to do the trick
for me.

You might also try to throw an ExecutionException which is declared for
doExecuteWithResult. Not sure if this works as expected though.

Regards, Peter
Re: shouldProceed Changing the Text of Message Dialog [message #233745 is a reply to message #232934] Mon, 15 June 2009 15:27 Go to previous message
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
Hi Peter

Thanks for the reply..

But right now i cant upgrade.

And the second part i didn't get..

Regards
Govind R
Previous Topic:Custom layout at diagram creation
Next Topic:Implementing some actions for my own Navigator
Goto Forum:
  


Current Time: Thu Apr 25 13:13:13 GMT 2024

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

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

Back to the top