Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GraphicalEditor in Composite
GraphicalEditor in Composite [message #921748] Mon, 24 September 2012 11:46 Go to next message
mark tal is currently offline mark talFriend
Messages: 11
Registered: July 2012
Junior Member
Hi,
Is it Possible to show GraphicalEditor inside composite and not Editor?

Right now I display gef like this:
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();	
				
 page.openEditor(editorInput,EditorGEF.ID, true);



I need to display the graph in "dialog window".


Re: GraphicalEditor in Composite [message #922612 is a reply to message #921748] Tue, 25 September 2012 07:02 Go to previous messageGo to next message
Igor Zapletnev is currently offline Igor ZapletnevFriend
Messages: 33
Registered: September 2012
Member
Hi,

The best way in your case don't use GraphicalEditor and use directly graphical viewer. It will looks like that:

        final Composite viewerComposite = toolkit.createComposite(composite);
        viewerComposite.setLayout(new FillLayout());
        final GraphicalViewer viewer = new ScrollingGraphicalViewer();
        viewer.createControl(viewerComposite);


Thanks,
Igor
Re: GraphicalEditor in Composite [message #925572 is a reply to message #922612] Thu, 27 September 2012 21:16 Go to previous messageGo to next message
mark tal is currently offline mark talFriend
Messages: 11
Registered: July 2012
Junior Member
But how do I define and set EditPartFactory?
Re: GraphicalEditor in Composite [message #926179 is a reply to message #921748] Fri, 28 September 2012 11:34 Go to previous messageGo to next message
mark tal is currently offline mark talFriend
Messages: 11
Registered: July 2012
Junior Member
I've managed to display graph in dialog but now I have problem with
ScrollingGraphicalViewer, I don't get the scrolling bars.

private void initialize() {

 this.initData();
  this.setLayout(new FillLayout());

final GraphicalViewer viewer = new ScrollingGraphicalViewer();
        
viewer.createControl(this); //this class extends Composite
viewer.setEditDomain(new DefaultEditDomain(null));           
viewer.setRootEditPart(new ScalableFreeformRootEditPart());

//CustomEditPartFactory extends EditPartFactory
CustomEditPartFactory customEditPartFactory = new CustomEditPartFactory(this);      

viewer.setEditPartFactory(customEditPartFactory);
        
viewer.setContents(model); 
        
CompoundDirectedGraph graph = new CompoundDirectedGraph();
graph.nodes = nodes;
graph.edges = edges;
new CompoundDirectedGraphLayout().visit(graph);

}


After investigating i've found out that I get the scroll bars when i try to move figures outside the initial frame.

But at initialization, the diagram size is > size of the shell size.

So the question how to specify the size of the ScrollingGraphicalViewer?

[Updated on: Fri, 28 September 2012 13:33]

Report message to a moderator

Re: GraphicalEditor in Composite [message #930060 is a reply to message #926179] Tue, 02 October 2012 01:44 Go to previous message
Igor Zapletnev is currently offline Igor ZapletnevFriend
Messages: 33
Registered: September 2012
Member
Hi,

First of all extend Composite is not good experience. Probably it is enough to use standard composite with FillLayout
viewer.createControl(composite);


Probably try to use ScalableRootEditPart instead of ScalableFreeformRootEditPart:
viewer.setRootEditPart(new ScalableRootEditPart ());


So the main issue that scrolls are not shown initially? But when you try to move figure outside the editor it properly layouted and scrolls are shown?

Thanks,
Igor
Previous Topic:GEF 3.8.1?
Next Topic:ScrollingGraphicalViewer Select and Unselect listener
Goto Forum:
  


Current Time: Thu Apr 25 02:13:59 GMT 2024

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

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

Back to the top