Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to initialize the arrangement of elements in the opening of a diagram?
How to initialize the arrangement of elements in the opening of a diagram? [message #541939] Wed, 23 June 2010 09:47 Go to next message
Dewas is currently offline DewasFriend
Messages: 21
Registered: March 2010
Location: Toulouse (France)
Junior Member
Hello,

I try to arrange the various elements of one under diagram according to an organization more advanced than a horizontal display on a line.

Does it configure in the .gmfgraph file?
Or is it necessary to modify the code and to add a layout?

Thank you in advance


DEWAS Albert
Master Degree in the IUP Intelligent Systems
Trainee to Continental Corporation Toulouse
Re: How to initialize the arrangement of elements in the opening of a diagram? [message #542197 is a reply to message #541939] Thu, 24 June 2010 08:43 Go to previous message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi Dewas,

you have to define a custom Layout Provider as an extension point in your plugin.xml; then you can invoke an "Arrage All" action on your diagram with the following code:

//perform layout...
final AbstractEMFOperation operation = new AbstractEMFOperation(myEditingDomain, "Make layout", null) {

@Override
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
LayoutService.getInstance().layout(editPart.getDiagramView() , LayoutType.DEFAULT);
return Status.OK_STATUS;
}
};
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {

@Override
public void run() {
try {
operation.execute(new NullProgressMonitor(), null);
} catch (Exception e) {
e.printStackTrace();
}
}
});



Hope this helps, bye

Giovanni.
Previous Topic:Properties for connections between two figures
Next Topic:Custom tool icons in popup menu
Goto Forum:
  


Current Time: Sat May 25 23:50:55 GMT 2024

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

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

Back to the top