Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » disable save
disable save [message #496805] Wed, 11 November 2009 12:27 Go to next message
Sven Krause is currently offline Sven KrauseFriend
Messages: 119
Registered: July 2009
Senior Member
Hi,

how mayI disable the save action (due to sematically check state)? I
trie to use an own
DiagramGlobalActionHandler#canSave(IGlobalActionContext), that is
registered by an own GlobalActionHandlerProvider replacing the default
registered one. But it does not effects the proper save action.

I need to prevent save before the model got a valid state.

Thanks in advance,
Sven

<extension
point=" org.eclipse.gmf.runtime.common.ui.services.action.globalActi onHandlerProviders "
id="global-actions">
<?gmfgen generated="true"?>
<GlobalActionHandlerProvider
class="xyz....DiagramGlobalActionHandlerProviderExt"
id="0815Presentation">
<Priority name="Lowest"/>
<ViewId id="xyz....model.pkg.diagram.part.XYZDiagramEditorID">
<ElementType
class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditP art ">
<GlobalActionId actionId="delete"/>
</ElementType>
<ElementType
class=" org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart ">
<GlobalActionId actionId="save"/>
</ElementType>
</ViewId>
</GlobalActionHandlerProvider>
....
</extension>

publix class DiagramGlobalActionHandlerProviderExt extends
AbstractGlobalActionHandlerProvider {
....
public IGlobalActionHandler getGlobalActionHandler(final
IGlobalActionHandlerContext context) {
...
getHandlerList().put(context.getActivePart(), new
DiagramGlobalActionHandlerExt());
.... }
}
.... }

public class DiagramGlobalActionHandlerExt extends
DiagramGlobalActionHandler {
protected boolean canSave(IGlobalActionContext cntxt) {
return super.canSave(cntxt) && checkState(cntx);
}
}
Re: disable save [message #498481 is a reply to message #496805] Tue, 17 November 2009 08:15 Go to previous messageGo to next message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello Sven,

Try overriding doSave() method in generated ???DiagramEditor.

-----------------
Alex Shatalin
Re: disable save [message #499572 is a reply to message #498481] Mon, 23 November 2009 11:42 Go to previous messageGo to next message
Sven Krause is currently offline Sven KrauseFriend
Messages: 119
Registered: July 2009
Senior Member
Hi Alex,

that's what I'm doing right now to prevent save execution, but the
action is still enabled. So it suggests the user he can save, but
nothing happens. That is a poor usability case. So would like to show
the user that he can not save right at the save action state.

Sven

Alex Shatalin schrieb:
> Hello Sven,
>
> Try overriding doSave() method in generated ???DiagramEditor.
>
> -----------------
> Alex Shatalin
>
>
Re: disable save [message #500899 is a reply to message #499572] Mon, 30 November 2009 08:36 Go to previous message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
Hi Sven,

If I was the user, I'd prefer to have the button enabled and to get a message when I try to save, telling me why it's not allowed at the moment, and what I need to do to resolve the problem.
Disabling the button without providing information about why I can't save my document sounds like poor usability too.

Regards, Peter
Previous Topic:Inner circle in GMFGraph
Next Topic:Generate GMF diagram editor dynamically with diagram
Goto Forum:
  


Current Time: Thu Mar 28 09:23:57 GMT 2024

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

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

Back to the top