Hi, I am new in this forum and in eclipse. Not new in programming.
I wish someone there could help me with this problem:
When I run this code:
package training;
/*******************************************************************************
* Copyright 2005-2007, CHISEL Group, University of Victoria, Victoria, BC, Canada.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http //www eclipse org/legal/epl-v10.html
*
* Contributors:
* The Chisel Group, University of Victoria
*******************************************************************************/
import org.eclipse.zest.core.widgets.Graph;
import org.eclipse.zest.core.widgets.GraphConnection;
import org.eclipse.zest.core.widgets.GraphNode;
import org.eclipse.zest.core.widgets.ZestStyles;
import org.eclipse.zest.layouts.LayoutStyles;
import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm;
import org.eclipse.zest.dot.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
* Adds a selection listener to the nodes to tell when a selection event has
* happened.
*
* @author Ian Bull
*
*/
public class GWSelect {
public static void main(String[] args) {
Display d = new Display();
Shell shell = new Shell(d);
Image image1 = Display.getDefault().getSystemImage(SWT.ICON_INFORMATION);
Image image2 = Display.getDefault().getSystemImage(SWT.ICON_WARNING);
Image image3 = Display.getDefault().getSystemImage(SWT.ICON_ERROR);
shell.setLayout(new FillLayout());
shell.setSize(400, 400);
DotGraph g = new DotGraph(shell, LayoutStyles.NONE );
g.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
g.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.out.println(((Graph) e.widget).getSelection());
}
});
g.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
GraphNode n1 = new GraphNode(g, SWT.NONE, "Information", image1);
GraphNode n2 = new GraphNode(g, SWT.NONE, "Warning", image2);
GraphNode n3 = new GraphNode(g, SWT.NONE, "Error", image3);
new GraphConnection(g, SWT.NONE, n1, n2);
new GraphConnection(g, SWT.NONE, n2, n3);
new GraphConnection(g, SWT.NONE, n3, n1);
shell.open();
while (!shell.isDisposed()) {
while (!d.readAndDispatch()) {
System.out.println( g.toDot() );
d.sleep();
}
}
image1.dispose();
image2.dispose();
image3.dispose();
}
}
...I get
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/zest/layouts/InvalidLayoutConfiguration
at training.GWSelect.main(GWSelect.java:47)
Caused by: java.lang.ClassNotFoundException: org.eclipse.zest.layouts.InvalidLayoutConfiguration
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
line 47 is this:
DotGraph g = new DotGraph(shell, LayoutStyles.NONE );
The only hint I have for this is that the import:
import org.eclipse.zest.layouts.LayoutStyles;
is marked as deprecated.
Thanks in advance for any hint.
Jorge