Skip to main content



      Home
Home » Modeling » Graphiti » Save button method in code
Save button method in code [message #1222028] Thu, 19 December 2013 09:36 Go to next message
Eclipse UserFriend
Hello everyone,
I want to use(and can't find last 2 days) the same method that is called when you press the save(not save all) button, but in my drillDownFeature.
The reason is I have to save the unsaved elements in my current diagram, when I open a new digram by double-clicking a element in the current diagram .

public class DrillDownFeature extends AbstractDrillDownFeature {
[...]
@Override
public void execute(ICustomContext context) {
"pressSaveButton()";
[...]
}
[...]
}


Can anyone tell me where that method "pressSaveButton()" is and how to use it ?
Re: Save button method in code [message #1222054 is a reply to message #1222028] Thu, 19 December 2013 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Martin,

save can be triggered like this:
getDiagramBehavior().getDiagramContainer().doSave(monitor);

But from within a feature you will need to execute this asynchronously in
the UI thread otherwise you will run into a deadlock...

Michael
Re: Save button method in code [message #1222109 is a reply to message #1222054] Thu, 19 December 2013 12:26 Go to previous messageGo to next message
Eclipse UserFriend
Michael,

thank you very much for your answer. Do you know an other (easier) way to solve my problem?
My project has synchronization problems caused by unsaved elements after opening a new diagram, so i could just save in the DrillDownFeature. The other possibility is to save every element after it is created.

Martin
Re: Save button method in code [message #1222374 is a reply to message #1222109] Fri, 20 December 2013 04:09 Go to previous messageGo to next message
Eclipse UserFriend
Martin,

not sure, it depends on your scenario. Another option could be to use the
same editing domain in both editors, but that would mean you also get a
unified undo/redo stack for both editors. Not sure if that fits...

Michael
Re: Save button method in code [message #1228492 is a reply to message #1222028] Tue, 07 January 2014 05:42 Go to previous message
Eclipse UserFriend
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart editor = page.getActiveEditor();
page.saveEditor(editor, false); //true = ask user: want to save?
}});


Ok, this works for me. Thanks for the async advice!

[Updated on: Wed, 08 January 2014 03:10] by Moderator

Previous Topic:Button icon disabled
Next Topic:Routing tutorial
Goto Forum:
  


Current Time: Wed Jul 23 19:16:15 EDT 2025

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

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

Back to the top