Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Save button method in code
Save button method in code [message #1222028] Thu, 19 December 2013 14:36 Go to next message
Martin LangFriend
Messages: 3
Registered: December 2013
Junior Member
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 15:17 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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 17:26 Go to previous messageGo to next message
Martin LangFriend
Messages: 3
Registered: December 2013
Junior Member
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 09:09 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
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 10:42 Go to previous message
Martin LangFriend
Messages: 3
Registered: December 2013
Junior Member
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 08:10]

Report message to a moderator

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


Current Time: Wed Apr 24 22:46:11 GMT 2024

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

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

Back to the top