Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Save disabled
Save disabled [message #1121329] Mon, 30 September 2013 10:00 Go to next message
Phil H is currently offline Phil H
Messages: 267
Registered: November 2012
Senior Member
Hi,

for some reasons it seem that the save button in my EMF editor is disabled:

index.php/fa/16330/0/

Which method responsible for determing if a save is needed? IsDirty in my xxxEditor?:

public boolean isDirty() {
   return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
}


Cheers,
Phil
Re: Save disabled [message #1121550 is a reply to message #1121329] Mon, 30 September 2013 14:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25744
Registered: July 2009
Senior Member
Phil,

Yes, the isDirty method should compute that.

On 30/09/2013 4:00 PM, Phil H wrote:
> Hi,
>
> for some reasons it seem that the save button in my EMF editor is disabled:
>
>
>
> Which method responsible for determing if a save is needed? IsDirty in my xxxEditor?:
>
>
> public boolean isDirty() {
> return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
> }
>
>
> Cheers,
> Phil
Re: Save disabled [message #1123363 is a reply to message #1121550] Wed, 02 October 2013 09:41 Go to previous messageGo to next message
Phil H is currently offline Phil H
Messages: 267
Registered: November 2012
Senior Member
I had a closer look at the isDirty method and it turned out that every time I add something to the model it returns true and if I undo this it returns false. So it seems to work as expected, but save is still disabled. What can be another reaon for this?

Cheers,
phil
Re: Save disabled [message #1123394 is a reply to message #1123363] Wed, 02 October 2013 10:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25744
Registered: July 2009
Senior Member
Phil,

Unfortunately I'm not psychic... Note that generated editors have code
like this:

// Add a listener to set the most recent command's affected objects
to be the selection of the viewer with focus.
//
commandStack.addCommandStackListener
(new CommandStackListener()
{
public void commandStackChanged(final EventObject event)
{
getContainer().getDisplay().asyncExec
(new Runnable()
{
public void run()
{
firePropertyChange(IEditorPart.PROP_DIRTY);

I.e., it ensures that the the dirty state is checked by the editor...


On 02/10/2013 3:41 PM, Phil H wrote:
> I had a closer look at the isDirty method and it turned out that every
> time I add something to the model it returns true and if I undo this
> it returns false. So it seems to work as expected, but save is still
> disabled. What can be another reaon for this?
>
> Cheers,
> phil
Re: Save disabled [message #1127512 is a reply to message #1123394] Sun, 06 October 2013 15:29 Go to previous messageGo to next message
Phil H is currently offline Phil H
Messages: 267
Registered: November 2012
Senior Member
Hi Ed,

thx for your patience with me. I had a look at the code you mentioned and it turned out that it's called every time I change something in the model. So this mans the editor checks the dirt state (which is true) then and should enable saving?

What I also observed:

- "Save all" works as I expected - every time the model change, "Save all" is enabled and I can save my model.

- when I close the file, the question "..has been modified. Save changes?" occurs and I'm able to save my model.
Re: Save disabled [message #1127948 is a reply to message #1127512] Mon, 07 October 2013 03:06 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25744
Registered: July 2009
Senior Member
Phil,

Comments below.

On 06/10/2013 9:29 PM, Phil H wrote:
> Hi Ed,
>
> thx for your patience with me. I had a look at the code you mentioned
> and it turned out that it's called every time I change something in
> the model. So this mans the editor checks the dirt state (which is
> true) then and should enable saving?
Yes, the enabled state of the save should reflect what the isDirty
method returns.
>
> What I also observed:
>
> - "Save all" works as I expected - every time the model change, "Save
> all" is enabled and I can save my model.
That might well be the case because at least one editor has save enabled...
>
> - when I close the file, the question "..has been modified. Save
> changes?" occurs and I'm able to save my model.
Is something changing the underlying file system without using the
Resource APIs?

In the end, you really need to use the debugger to track down such
problems (and the "error while deleting" problem) yourself...
Previous Topic:Problem loading an XML model instance into GUI editor: Package with uri '..' not found
Next Topic:(non) modifiable attributes...
Goto Forum:
  


Current Time: Thu Apr 17 11:42:24 EDT 2014

Powered by FUDForum. Page generated in 0.02377 seconds