Reputation: 6822
I am building a Eclipse plug-in project with The Eclipse Graphical Editing Framework (GEF). It's ok that I write a single class for testing with example code I find on the internet, the code is following:
public class Test {
public static void main(String args[]){
Shell shell = new Shell();
shell.open();
Display display = shell.getDisplay();
LightweightSystem lws = new LightweightSystem(shell);
IFigure panel = new Figure();
lws.setContents(panel);
RectangleFigure node1 = new RectangleFigure();
RectangleFigure node2 = new RectangleFigure();
node1.setBackgroundColor(ColorConstants.red);
node1.setBounds(new Rectangle(30, 30, 64, 36));
node2.setBackgroundColor(ColorConstants.blue);
node2.setBounds(new Rectangle(300, 300, 64, 36));
PolylineConnection conn = new PolylineConnection();
conn.setSourceAnchor(new ChopboxAnchor(node1));
conn.setTargetAnchor(new ChopboxAnchor(node2));
conn.setTargetDecoration(new PolygonDecoration());
Label label = new Label("Midpoint");
label.setOpaque(true);
label.setBackgroundColor(ColorConstants.buttonLightest);
label.setBorder(new LineBorder());
conn.add(label, new MidpointLocator(conn, 0));
panel.add(node1);
panel.add(node2);
panel.add(conn);
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ())
display.sleep ();
}
}//main
}
It works.
But - when I try to build figures in a EditorPart (org.eclipse.ui.IEditorPart
) instance class, it turns bad and giving me the following error code:
**org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError:** org/eclipse/draw2d/LightweightSystem
It's quite strange because I just write 3 lines at the editor's createPartControl
method:
Shell shell = parent.getShell();
Display display = shell.getDisplay();
LightweightSystem lws = new LightweightSystem(shell);
So any body help?
Upvotes: 1
Views: 946
Reputation: 46
Are your dependencies set properly? You need to add org.eclipse.draw2d for the LightweightSystem
.
Upvotes: 0