Skip to main content


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 10:02 Go to next message
Ali Koudri is currently offline Ali KoudriFriend
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 10:12 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
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 11:17 Go to previous messageGo to next message
Ali Koudri is currently offline Ali KoudriFriend
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 12:33 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
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 13:12 Go to previous messageGo to next message
Ali Koudri is currently offline Ali KoudriFriend
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 14:06 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
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 15:55 Go to previous message
Ali Koudri is currently offline Ali KoudriFriend
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: Tue Apr 23 15:27:53 GMT 2024

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

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

Back to the top