HELP - JavaModelException [message #259681] |
Wed, 22 April 2009 11:42  |
Eclipse User |
|
|
|
Hello Everybody,
Thanks for all your help. I have a little problem when i try to open the
view of my plugin. I have the following view class. The intention is to
create a view with a label and i set the text of the view to just the name
of a SimpleName element. This is the class:
public class TableView extends ViewPart{
public TableView(){
}
public void createPartControl(Composite parent){
GridLayout gridLayout = new GridLayout();
parent.setLayout(gridLayout);
Label label = new Label(parent, SWT.CENTER);
ICompilationUnit icomp = this.findProject();
CompilationUnit comp = this.parse(icomp);
SimpleName sn =
((TypeDeclaration)comp.types().get(0)).getName();
label.setText(sn.getFullyQualifiedName());
}
public void setFocus(){
}
protected CompilationUnit parse(ICompilationUnit unit) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setSource(unit); // set source
parser.setResolveBindings(true); // we need bindings later on
return (CompilationUnit)parser.createAST(null /* IProgressMonitor
*/); // parse
}
public ICompilationUnit findProject(){
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
// "org.integ.proj.sl" is the project name
IProject project = root.getProject("org.integ.proj.sl");
if (project.exists() && !project.isOpen())
try {
project.open(null /* IProgressMonitor */);
} catch (CoreException e1) {
e1.printStackTrace();
}
IJavaProject javaProject = JavaCore.create(project);
IType lwType = null;
try {
// "Menu" is a class in the "org.integ.proj.sl.gui" package
lwType = javaProject.findType("org.integ.proj.sl.gui.Menu");
} catch (JavaModelException e) {
e.printStackTrace();
}
ICompilationUnit lwCompilationUnit =
lwType.getCompilationUnit();
return lwCompilationUnit;
}
}
After i execute the project as "Eclipse Application", i get a new
workspace and when i try to open the view, i get the following errors and
exception:
Error creating the view
java.lang.NoClassDefFoundError: org/eclipse/jdt/core/JavaModelException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:23 57)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at
org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI .createExecutableExtension(RegistryStrategyOSGI.java:170)
at
org.eclipse.core.internal.registry.ExtensionRegistry.createE xecutableExtension(ExtensionRegistry.java:788)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:243)
at
org.eclipse.core.internal.registry.ConfigurationElementHandl e.createExecutableExtension(ConfigurationElementHandle.java: 51)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugi n.java:252)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at
org.eclipse.ui.internal.WorkbenchPlugin.createExtension(Work benchPlugin.java:248)
at
org.eclipse.ui.internal.registry.ViewDescriptor.createView(V iewDescriptor.java:69)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:327)
at
org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:227)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
at
org.eclipse.ui.internal.WorkbenchPage$ActivationList.setActi ve(WorkbenchPage.java:4080)
at
org.eclipse.ui.internal.WorkbenchPage$17.runWithException(Wo rkbenchPage.java:3145)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:801)
at
org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1342)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3659)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3296)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
I am asking if you can help me to track why and where this exception is
coming from so that i can solve it.. Thank you very much. Regards,Eddy.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03258 seconds