Skip to main content



      Home
Home » Modeling » Graphiti » Auto save Editor
Auto save Editor [message #957625] Thu, 25 October 2012 07:16 Go to next message
Eclipse UserFriend
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 07:17] by Moderator

Re: Auto save Editor [message #963131 is a reply to message #957625] Mon, 29 October 2012 11:45 Go to previous messageGo to next message
Eclipse UserFriend
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 13:02 Go to previous messageGo to next message
Eclipse UserFriend
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 13:57 Go to previous messageGo to next message
Eclipse UserFriend
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 04:59 Go to previous message
Eclipse UserFriend
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: Tue Jul 22 21:02:14 EDT 2025

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

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

Back to the top