Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Auto save Editor
Auto save Editor [message #957625] Thu, 25 October 2012 11:16 Go to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 193
Registered: October 2010
Senior Member
Usually in my gmf editors I was able to save the editors when some change happened in the editor.
Usually I used
OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(new IOperationHistoryListener() {
public void historyNotification(OperationHistoryEvent event) {
    //save current editor Or editor itself
    doSave(new NullProgressMonitor());
}
}


In this case, The dirty state was never shown, the usability aspect was smooth, with no popups, no refreshing issues (trembling.. etc)


I was trying to do the same in graphiti, and it works, however the usability aspect is impared, once it shows two progress dialog for a fraction of second, even using Nullprogressmonitor.

Am I missing something? I would like that the user doesn't notice anything whenever editor is being saved, or at least that the character (*-dirty) doesn't appear in the tab.

Thanks in advance

Rui Domingues

[Updated on: Thu, 25 October 2012 11:17]

Report message to a moderator

Re: Auto save Editor [message #963131 is a reply to message #957625] Mon, 29 October 2012 15:45 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Rui,

right, having a look into that coding I see that the passed monitor is
ignored and instead a monitor popup is opened in any case. Would you please
file that as a bugzilla?

Thanks,
Michael
Re: Auto save Editor [message #963226 is a reply to message #963131] Mon, 29 October 2012 17:02 Go to previous messageGo to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 193
Registered: October 2010
Senior Member
Yes. It's done.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=393074

Thanks for replying.

Re: Auto save Editor [message #1052855 is a reply to message #963226] Tue, 30 April 2013 17:57 Go to previous messageGo to next message
Marek Jagielski is currently offline Marek JagielskiFriend
Messages: 65
Registered: April 2012
Member
Hi,
I tried to use Rui's idea. I put his code in the 'init' function of MyDiagramEditor, but the listener was not called. I looked in the Internet and found this code:


	
private IOperationHistory getOperationHistory() {
    IOperationHistory history = null;
    final TransactionalEditingDomain domain = getEditingDomain();
    if (domain != null) {
        final IWorkspaceCommandStack commandStack = (IWorkspaceCommandStack) getEditingDomain().getCommandStack();
        if (commandStack != null) {
            history = commandStack.getOperationHistory();
        }
    }
    return history;
}


I added also:
switch(event.getEventType()) {
    case OperationHistoryEvent.DONE:
    case OperationHistoryEvent.REDONE:
    case OperationHistoryEvent.UNDONE:
        doSave(new NullProgressMonitor());
	break;
}

in the listener.

In 0.9.2 mentioned problem is present. But my remark is that even after automatically save, the character (*-dirty) is appearing. Is it because of the way I retrived the IOperationHistory?
Re: Auto save Editor [message #1053490 is a reply to message #1052855] Mon, 06 May 2013 08:59 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Marek,

I would suspect a timing issue as there is no guarantee in which sequence
listeners are called. It might happen that the diagram editor dirty state is
updated before your your save is done. Have you tried to add firing prop
dirty event after the save?

Michael
Previous Topic:Change the Color of the Grid
Next Topic:Load domain model from diagram file
Goto Forum:
  


Current Time: Fri Nov 28 03:25:56 GMT 2014

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

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