Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » saveable view
saveable view [message #336854] Wed, 08 July 2009 06:02 Go to next message
Eclipse UserFriend
Hi All,

I have implemented a view with actions to modify a model. I am able to
detect changes on my model but I am unable to enable the save button.

In the createPartControl() method, I call this method:

private void hookGlobalActions()
{

getViewSite().getActionBars().setGlobalActionHandler(ActionF actory.SAVE.getId(),
new SaveAction());
}

I can detect changes and make my view in the dirty state but still, my
action button is disabled.

Any idea ?

thx.
Re: saveable view [message #336856 is a reply to message #336854] Wed, 08 July 2009 06:12 Go to previous messageGo to next message
Eclipse UserFriend
exquisitus wrote:
> I can detect changes and make my view in the dirty state but still, my
> action button is disabled.

Your view should implement ISaveablePart.

- Prakash
---
http://blog.eclipse-tips.com
Re: saveable view [message #336857 is a reply to message #336856] Wed, 08 July 2009 07:17 Go to previous messageGo to next message
Eclipse UserFriend
A view part already implements this interface. I have overriden
corresponding methods but still, no save action allowed !

Prakash G.R. a écrit :
> exquisitus wrote:
>> I can detect changes and make my view in the dirty state but still, my
>> action button is disabled.
>
> Your view should implement ISaveablePart.
>
> - Prakash
> ---
> http://blog.eclipse-tips.com
Re: saveable view [message #336862 is a reply to message #336857] Wed, 08 July 2009 08:33 Go to previous messageGo to next message
Eclipse UserFriend
exquisitus wrote:
> A view part already implements this interface. I have overriden
> corresponding methods but still, no save action allowed !

As Prakash says, you must implement the methods in ISaveablePart (and
make sure you fire PROP_DIRTY when your view dirty state changes, or no
one will care)

You don't use setGlobalActionHandler(*) since the save action is not
retargetable.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Re: saveable view [message #336864 is a reply to message #336862] Wed, 08 July 2009 09:12 Go to previous messageGo to next message
Eclipse UserFriend
As I said before, changes are detected because I fire PROP_DIRTY but the
save action is not enabled ! Is it possible to enable it into a view ? I
guess it is since I have seen such example like papyrus uml editor into
which models can be edited from the outline view.

Paul Webster a écrit :
> exquisitus wrote:
>> A view part already implements this interface. I have overriden
>> corresponding methods but still, no save action allowed !
>
> As Prakash says, you must implement the methods in ISaveablePart (and
> make sure you fire PROP_DIRTY when your view dirty state changes, or no
> one will care)
>
> You don't use setGlobalActionHandler(*) since the save action is not
> retargetable.
>
> PW
>
>
Re: saveable view [message #336865 is a reply to message #336864] Wed, 08 July 2009 10:06 Go to previous messageGo to next message
Eclipse UserFriend
exquisitus wrote:
> As I said before, changes are detected because I fire PROP_DIRTY but the
> save action is not enabled ! Is it possible to enable it into a view ? I
> guess it is since I have seen such example like papyrus uml editor into
> which models can be edited from the outline view.

What save action? Are you running in the IDE or your own RCP app? In
the IDE, save is managed by org.eclipse.ui.actions.ActionFactory.SAVE

The protocol is simple. If the view is active and returns true from
isDirty() then the save action (provided by the ActionFactory and
registered properly in WorkbenchActionBuilder) is enabled. If the view
is active and its dirty state changes it must fire the PROP_DIRTY, but
it is good form to always fire PROP_DIRTY when changing the dirty state.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Re: saveable view [message #336867 is a reply to message #336865] Wed, 08 July 2009 11:55 Go to previous message
Eclipse UserFriend
Is there any document explaining that ? It does not seem that clear for me !

Paul Webster a écrit :
> exquisitus wrote:
>> As I said before, changes are detected because I fire PROP_DIRTY but
>> the save action is not enabled ! Is it possible to enable it into a
>> view ? I guess it is since I have seen such example like papyrus uml
>> editor into which models can be edited from the outline view.
>
> What save action? Are you running in the IDE or your own RCP app? In
> the IDE, save is managed by org.eclipse.ui.actions.ActionFactory.SAVE
>
> The protocol is simple. If the view is active and returns true from
> isDirty() then the save action (provided by the ActionFactory and
> registered properly in WorkbenchActionBuilder) is enabled. If the view
> is active and its dirty state changes it must fire the PROP_DIRTY, but
> it is good form to always fire PROP_DIRTY when changing the dirty state.
>
> PW
>
>
Previous Topic:[intro] Can css contain platform URL locations of images?
Next Topic:action canceled in help
Goto Forum:
  


Current Time: Fri Apr 25 01:15:00 EDT 2025

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

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

Back to the top