java.lang.NoClassDefFoundError:org / eclipse / draw2d / LightweightSystem

时间:2013-01-21 08:34:15

标签: java eclipse eclipse-plugin eclipse-rcp draw2d

我正在使用Eclipse图形编辑框架(GEF)构建一个Eclipse插件项目。 我可以用互联网上找到的示例代码编写单个类进行测试,代码如下:

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
}

有效。

但是 - 当我尝试在EditorPart(org.eclipse.ui.IEditorPart)实例类中构建数字时,它变坏并且给我以下错误代码:

**org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError:** org/eclipse/draw2d/LightweightSystem

这很奇怪,因为我只是在编辑器的createPartControl方法中写了3行:

Shell shell = parent.getShell();
Display display = shell.getDisplay();
LightweightSystem lws = new LightweightSystem(shell);

所以身体有帮助吗?

0 个答案:

没有答案
相关问题