Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Save disabled
Save disabled [message #1121329] Mon, 30 September 2013 14:00 Go to next message
Phil H is currently offline Phil HFriend
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 18:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save disabled [message #1123363 is a reply to message #1121550] Wed, 02 October 2013 13:41 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
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 14:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save disabled [message #1127512 is a reply to message #1123394] Sun, 06 October 2013 19:29 Go to previous messageGo to next message
Phil H is currently offline Phil HFriend
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 07:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
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...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save disabled [message #1829092 is a reply to message #1127512] Thu, 25 June 2020 06:51 Go to previous message
Buse Tekin Aydın is currently offline Buse Tekin AydınFriend
Messages: 1
Registered: June 2020
Junior Member
Hi

did you solve your problem ?
Previous Topic:Programatically edit XML Schema file
Next Topic:How to transform a xmi file to atl file?
Goto Forum:
  


Current Time: Tue Apr 16 16:30:19 GMT 2024

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

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

Back to the top