Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » saveable view
saveable view [message #336854] Wed, 08 July 2009 06:02 Go to next message
Ali Koudri is currently offline Ali Koudri
Messages: 118
Registered: July 2009
Senior Member
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
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
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
Ali Koudri is currently offline Ali Koudri
Messages: 118
Registered: July 2009
Senior Member
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
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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
Ali Koudri is currently offline Ali Koudri
Messages: 118
Registered: July 2009
Senior Member
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
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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
Ali Koudri is currently offline Ali Koudri
Messages: 118
Registered: July 2009
Senior Member
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: Sat Jul 26 11:13:42 EDT 2014

Powered by FUDForum. Page generated in 0.01577 seconds