Hello,
Thanks for your reply. 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.integrated.project.soul" is the project name
IProject project = root.getProject( "org.integrated.project.soul");
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.integrated.project.soul.gui" package
lwType = javaProject.findType( "org.integrated.project.soul.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:2357) 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.createExecutableExtension(ExtensionRegistry.java:788) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243) at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51) at
org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:252) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:248) at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:69) at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:327) at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:227) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:592) at org.eclipse.ui.internal.WorkbenchPage$ActivationList.setActive(WorkbenchPage.java:4080) at org.eclipse.ui.internal.WorkbenchPage$17.runWithException(WorkbenchPage.java:3145) at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31) at
org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3659) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3296) at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:801) at org.eclipse.ui.internal.Workbench$25.runWithException(Workbench.java:1342) at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java: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:2219) 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(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.
--- On Mon, 4/20/09, Stephan Herrmann <stephan@xxxxxxxxxxxxxxx> wrote:
From: Stephan Herrmann <stephan@xxxxxxxxxxxxxxx> Subject: Re: [jdt-core-dev] JDT - PARSER - HELP To: jdt-core-dev@xxxxxxxxxxx Cc: "Eddy Freeman" <win1for@xxxxxxxxx> Date: Monday, April 20, 2009, 2:52 PM
-----Inline Attachment Follows-----
Eddy,
> I am very very sorry for posting this message here, but i have posted > it in the eclipse jdt newsgroup and no answer and i need your help urgently > please. In the newsgroup I see two questions from you, both of which were answered on the same day. That's a pretty good result, I'd say.
If these answers didn't provide the help you were seeking, maybe you should try to state more precisely, what it is you are stuck with.
best, Stephan
|