Skip to main content



      Home
Home » Eclipse Projects » GEF » Using GEF in a Shell opened by Eclipse RCP
Using GEF in a Shell opened by Eclipse RCP [message #248341] Wed, 15 April 2009 07:37
Eclipse UserFriend
Hi,

Suppose I have a Model along with EditParts and an EditPartFactory, and I
want to display it in a graphical form in a Shell that is generated from
within an Eclipse plugin. How do I do that? I tried something like this:

----------------------------

public class GEFShellSample {

private Shell parent;

private ScrollingGraphicalViewer viewer = new ScrollingGraphicalViewer();

private RootEditPart rootEditPart = new ScalableFreeformRootEditPart();

private EditPartFactory editPartFactory = new MyGEFEditPartFactory();

private MyModel model;

public void makeShell() {

parent = new Shell(Display.getDefault());
model = new MyModel();
viewer.createControl(parent);
viewer.setRootEditPart(rootEditPart);
viewer.setEditPartFactory(editPartFactory);
viewer.setContents(model);
viewer.getControl().setBackground(new Color(null, 255,255,255));
parent.pack();
parent.open();
}

}

----------------------------

This doesn't work. When calling makeShell() I can't see any graphical
viewer, just an empty Shell. However, if I copy the makeShell() body
(minus the lines about the Shell) and past them into the
createPartControl(Composite parent) of a ViewPart, there it seems to work.

What am I missing? Shouldn't the viewer.createControl() method create the
canvas automatically?

Thanks,

Alessandro
Previous Topic:[Announce] GEF 3.5.0 I200904131850 is available
Next Topic:How to create PolyLine (as standalone figure)
Goto Forum:
  


Current Time: Tue Mar 25 03:07:17 EDT 2025

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

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

Back to the top