Home » Language IDEs » Java Development Tools (JDT) » [SOLVED] How to open an IJavaElement programatically?
[SOLVED] How to open an IJavaElement programatically? [message #650853] |
Wed, 26 January 2011 20:33 |
Kivanc Muslu Messages: 153 Registered: November 2010 |
Senior Member |
|
|
Hi,
I am trying to open an IJavaElement (created from an actual .java file) programatically by using:
IProject project = ... // get a project from workspace.
IFile file = project.getFile("<ClassName>.java");
ICompilationUnit javaElement = (ICompilationUnit) JavaCore.create(file);
javaElement.open(null);
However, for the last line of the code, I get the following exception:
org.osgi.framework.BundleException: The activator com.kivancmuslu.deneme.Activator for bundle com.kivancmuslu.deneme is invalid
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:156)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:904)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.jdt.internal.ui.text.correction.ContributedProcessorDescriptor.getProcessor(ContributedProcessorDescriptor.java:133)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeHasCorrections.safeRun(JavaCorrectionProcessor.java:445)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:336)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:332)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:110)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.showQuickFix(JavaAnnotationImageProvider.java:89)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImageType(JavaAnnotationImageProvider.java:115)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:65)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImage(JavaAnnotationImageProvider.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:66)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.getImage(DefaultMarkerAnnotationAccess.java:377)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.paint(DefaultMarkerAnnotationAccess.java:264)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doPaint1(AnnotationRulerColumn.java:790)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doubleBufferPaint(AnnotationRulerColumn.java:541)
at org.eclipse.jface.text.source.AnnotationRulerColumn.access$3(AnnotationRulerColumn.java:517)
at org.eclipse.jface.text.source.AnnotationRulerColumn$1.paintControl(AnnotationRulerColumn.java:289)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:223)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1131)
at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:134)
at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:685)
at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:129)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4958)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSWindow.makeKeyAndOrderFront(NSWindow.java:190)
at org.eclipse.swt.widgets.Shell.makeKeyAndOrderFront(Shell.java:1130)
at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:1740)
at org.eclipse.swt.widgets.Shell.open(Shell.java:1173)
at org.eclipse.jface.window.Window.open(Window.java:797)
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:790)
at org.eclipse.ui.internal.Workbench$66.runWithException(Workbench.java:3660)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$31.runWithException(Workbench.java:1567)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: Java Model Exception: Java Model Status [<project root> [in Quickfixes] is not on its project's build path]
at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:502)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:246)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.CompilationUnit.openAncestors(CompilationUnit.java:1170)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:515)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:252)
at org.eclipse.jdt.internal.core.Openable.open(Openable.java:432)
at com.kivancmuslu.deneme.Activator.<init>(Activator.java:252)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:151)
... 90 more
Root exception:
Java Model Exception: Java Model Status [<project root> [in Quickfixes] is not on its project's build path]
at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:502)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:246)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.CompilationUnit.openAncestors(CompilationUnit.java:1170)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:515)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:252)
at org.eclipse.jdt.internal.core.Openable.open(Openable.java:432)
at com.kivancmuslu.deneme.Activator.<init>(Activator.java:252)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:151)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:904)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.jdt.internal.ui.text.correction.ContributedProcessorDescriptor.getProcessor(ContributedProcessorDescriptor.java:133)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeHasCorrections.safeRun(JavaCorrectionProcessor.java:445)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:336)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:332)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:110)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.showQuickFix(JavaAnnotationImageProvider.java:89)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImageType(JavaAnnotationImageProvider.java:115)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:65)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImage(JavaAnnotationImageProvider.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:66)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.getImage(DefaultMarkerAnnotationAccess.java:377)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.paint(DefaultMarkerAnnotationAccess.java:264)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doPaint1(AnnotationRulerColumn.java:790)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doubleBufferPaint(AnnotationRulerColumn.java:541)
at org.eclipse.jface.text.source.AnnotationRulerColumn.access$3(AnnotationRulerColumn.java:517)
at org.eclipse.jface.text.source.AnnotationRulerColumn$1.paintControl(AnnotationRulerColumn.java:289)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:223)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1131)
at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:134)
at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:685)
at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:129)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4958)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSWindow.makeKeyAndOrderFront(NSWindow.java:190)
at org.eclipse.swt.widgets.Shell.makeKeyAndOrderFront(Shell.java:1130)
at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:1740)
at org.eclipse.swt.widgets.Shell.open(Shell.java:1173)
at org.eclipse.jface.window.Window.open(Window.java:797)
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:790)
at org.eclipse.ui.internal.Workbench$66.runWithException(Workbench.java:3660)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$31.runWithException(Workbench.java:1567)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
!ENTRY org.eclipse.jdt.ui 4 10001 2011-01-26 12:28:05.413
!MESSAGE Internal Error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in com.kivancmuslu.deneme was unable to load class edu.uw.quickfix.speculation.proposal.QuickFixProcessor.
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:176)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:904)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.jdt.internal.ui.text.correction.ContributedProcessorDescriptor.getProcessor(ContributedProcessorDescriptor.java:133)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeHasCorrections.safeRun(JavaCorrectionProcessor.java:445)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:336)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:332)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:110)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.showQuickFix(JavaAnnotationImageProvider.java:89)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImageType(JavaAnnotationImageProvider.java:115)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:65)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImage(JavaAnnotationImageProvider.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:66)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.getImage(DefaultMarkerAnnotationAccess.java:377)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.paint(DefaultMarkerAnnotationAccess.java:264)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doPaint1(AnnotationRulerColumn.java:790)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doubleBufferPaint(AnnotationRulerColumn.java:541)
at org.eclipse.jface.text.source.AnnotationRulerColumn.access$3(AnnotationRulerColumn.java:517)
at org.eclipse.jface.text.source.AnnotationRulerColumn$1.paintControl(AnnotationRulerColumn.java:289)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:223)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1131)
at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:134)
at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:685)
at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:129)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4958)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSWindow.makeKeyAndOrderFront(NSWindow.java:190)
at org.eclipse.swt.widgets.Shell.makeKeyAndOrderFront(Shell.java:1130)
at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:1740)
at org.eclipse.swt.widgets.Shell.open(Shell.java:1173)
at org.eclipse.jface.window.Window.open(Window.java:797)
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:790)
at org.eclipse.ui.internal.Workbench$66.runWithException(Workbench.java:3660)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$31.runWithException(Workbench.java:1567)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle com.kivancmuslu.deneme (485).
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:121)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
... 72 more
Caused by: org.osgi.framework.BundleException: The activator com.kivancmuslu.deneme.Activator for bundle com.kivancmuslu.deneme is invalid
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:156)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
... 84 more
Caused by: Java Model Exception: Java Model Status [<project root> [in Quickfixes] is not on its project's build path]
at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:502)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:246)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.CompilationUnit.openAncestors(CompilationUnit.java:1170)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:515)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:252)
at org.eclipse.jdt.internal.core.Openable.open(Openable.java:432)
at com.kivancmuslu.deneme.Activator.<init>(Activator.java:252)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:151)
... 90 more
!SUBENTRY 1 org.eclipse.equinox.registry 4 1 2011-01-26 12:28:05.417
!MESSAGE Plug-in com.kivancmuslu.deneme was unable to load class edu.uw.quickfix.speculation.proposal.QuickFixProcessor.
!STACK 0
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle com.kivancmuslu.deneme (485).
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:121)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:904)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.jdt.internal.ui.text.correction.ContributedProcessorDescriptor.getProcessor(ContributedProcessorDescriptor.java:133)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeHasCorrections.safeRun(JavaCorrectionProcessor.java:445)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:336)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:332)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:110)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.hasCorrections(JavaCorrectionProcessor.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.showQuickFix(JavaAnnotationImageProvider.java:89)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImageType(JavaAnnotationImageProvider.java:115)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:65)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getImage(JavaAnnotationImageProvider.java:131)
at org.eclipse.jdt.internal.ui.javaeditor.JavaAnnotationImageProvider.getManagedImage(JavaAnnotationImageProvider.java:66)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.getImage(DefaultMarkerAnnotationAccess.java:377)
at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.paint(DefaultMarkerAnnotationAccess.java:264)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doPaint1(AnnotationRulerColumn.java:790)
at org.eclipse.jface.text.source.AnnotationRulerColumn.doubleBufferPaint(AnnotationRulerColumn.java:541)
at org.eclipse.jface.text.source.AnnotationRulerColumn.access$3(AnnotationRulerColumn.java:517)
at org.eclipse.jface.text.source.AnnotationRulerColumn$1.paintControl(AnnotationRulerColumn.java:289)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:223)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1131)
at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:134)
at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:685)
at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:129)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4958)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSWindow.makeKeyAndOrderFront(NSWindow.java:190)
at org.eclipse.swt.widgets.Shell.makeKeyAndOrderFront(Shell.java:1130)
at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:1740)
at org.eclipse.swt.widgets.Shell.open(Shell.java:1173)
at org.eclipse.jface.window.Window.open(Window.java:797)
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:790)
at org.eclipse.ui.internal.Workbench$66.runWithException(Workbench.java:3660)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$31.runWithException(Workbench.java:1567)
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:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: org.osgi.framework.BundleException: The activator com.kivancmuslu.deneme.Activator for bundle com.kivancmuslu.deneme is invalid
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:156)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
... 84 more
Caused by: Java Model Exception: Java Model Status [<project root> [in Quickfixes] is not on its project's build path]
at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:502)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:246)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:504)
at org.eclipse.jdt.internal.core.CompilationUnit.openAncestors(CompilationUnit.java:1170)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:240)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:515)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:252)
at org.eclipse.jdt.internal.core.Openable.open(Openable.java:432)
at com.kivancmuslu.deneme.Activator.<init>(Activator.java:252)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:151)
... 90 more
Any idea why this might happen or how I can fix it? Thanks in advance, best regards,
[Updated on: Sat, 29 January 2011 03:13] Report message to a moderator
|
|
| | |
Re: How to open an IJavaElement programatically? [message #650895 is a reply to message #650890] |
Thu, 27 January 2011 04:30 |
Kivanc Muslu Messages: 153 Registered: November 2010 |
Senior Member |
|
|
Okay, thanks for the help but I keep getting the following exception:
org.eclipse.ui.PartInitException: No active workbench page
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.throwPartInitException(EditorUtility.java:385)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.throwPartInitException(EditorUtility.java:389)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:376)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:178)
at org.eclipse.jdt.ui.JavaUI.openInEditor(JavaUI.java:692)
at org.eclipse.jdt.ui.JavaUI.openInEditor(JavaUI.java:670)
at edu.uw.quickfix.speculation.util.Aux.openEditor(Aux.java:81)
at edu.uw.quickfix.speculation.util.Aux.openAndSwitchBack(Aux.java:116)
at edu.uw.quickfix.speculation.util.QuickFixPreCalculator.doWork2(QuickFixPreCalculator.java:220)
at edu.uw.quickfix.speculation.util.BlockableMortalThread.doWork(BlockableMortalThread.java:98)
at edu.uw.quickfix.speculation.util.MortalThread.run(MortalThread.java:36)
I think this happens because the thread I am invoking the method is not a GUI thread, am I correct?
As a related and different question, do you know what changes internally for a IFile (or IJavaElement) when it is actively selected and opened in the page? If I were to find it and could do the same without actually openning the file, I think it would also work.
Thanks, regards,
Satyam Kandula wrote on Wed, 26 January 2011 23:02 | This would happen if the java element is not in the source folder of the project.
|
Actually it is in under the src/ directory. I think the problem is something else.
[Updated on: Thu, 27 January 2011 04:31] Report message to a moderator
|
|
| | | |
Re: How to open an IJavaElement programatically? [message #650945 is a reply to message #650939] |
Thu, 27 January 2011 09:20 |
Kivanc Muslu Messages: 153 Registered: November 2010 |
Senior Member |
|
|
Hi Dani,
Thank you for your question. Sorry that I wasn't clear.
What I really want to do is that to perform a Change object (created using QuickFixProcessor).
However, the problem is that, I figured out, the change is not applied if the particular file that it will modify (i.e., change.getModifiedElement()) is not open in the Eclipse's page view and selected at least one. I know that it sounds strange, however I have tried it many times with many debugging and if I don't open the file in Eclipse's workbench page, then when I invoke change.perform() nothing happens (I don't get an error, no notification). On the other hand if the file is open and selected, then when I say change.perform() the change is applied correctly.
I have to do the whole process (creating the change and applying it automatically, i.e., I cannot open the file that would change manually). Therefore, I need to one of the following before invoking change.perform()
1- Actually open the file on the workbench page (so that it is also selected) and run the change. I have tried this inside the constructor of the plugin, it works, however the actual thread that should do this is a background thread and since it is not a GUI thread, Eclipse API throws exception when I try to open an editor for the file to change (using page.openEditor()).
2- Figure out what does opening the file int eh workbench page changes internally for an IFile or CompilationUnit. I guess that if I can mimic the same thing without actually opening the file in the page, then the change will also be applied correctly.
I might be missing something or if anything does not make sense please point it, I will try to explain in detail. Again, thank you for your interest,
Regards,
|
|
|
Re: How to open an IJavaElement programatically? [message #651192 is a reply to message #650945] |
Fri, 28 January 2011 10:32 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 27.01.2011 10:20, Kivanc Muslu wrote:
> Hi Dani,
>
> Thank you for your question. Sorry that I wasn't clear.
>
> What I really want to do is that to perform a Change object (created
> using QuickFixProcessor).
This is an internal class which you should not use and for which there's
no support. You should create your own Change(Operation).
Dani
> However, the problem is that, I figured out, the change is not applied
> if the particular file that it will modify (i.e.,
> change.getModifiedElement()) is not open in the Eclipse's page view
> and selected at least one. I know that it sounds strange, however I
> have tried it many times with many debugging and if I don't open the
> file in Eclipse's workbench page, then when I invoke change.perform()
> nothing happens (I don't get an error, no notification). On the other
> hand if the file is open and selected, then when I say
> change.perform() the change is applied correctly.
> I have to do the whole process (creating the change and applying it
> automatically, i.e., I cannot open the file that would change
> manually). Therefore, I need to one of the following before invoking
> change.perform()
> 1- Actually open the file on the workbench page (so that it is also
> selected) and run the change. I have tried this inside the constructor
> of the plugin, it works, however the actual thread that should do this
> is a background thread and since it is not a GUI thread, Eclipse API
> throws exception when I try to open an editor for the file to change
> (using page.openEditor()).
> 2- Figure out what does opening the file int eh workbench page changes
> internally for an IFile or CompilationUnit. I guess that if I can
> mimic the same thing without actually opening the file in the page,
> then the change will also be applied correctly.
>
> I might be missing something or if anything does not make sense please
> point it, I will try to explain in detail. Again, thank you for your
> interest,
>
> Regards,
|
|
| | | |
Re: How to open an IJavaElement programatically? [message #651208 is a reply to message #651206] |
Fri, 28 January 2011 11:21 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 28.01.2011 12:08, Kivanc Muslu wrote:
> Excellent point.
>
> The problem is that, though I have searched many files in the
> unarchived plug-ins folder of Eclipse (i.e., I un-jared all plug-ins
> in the same folder), I couldn't find an exact location or anything
> that could bring me there.
Take a look at the apply(...) methods on the proposal.
Dani
>
> More specifically, I have searched for new QuickFixProcessor(...) and
> getCorrections(...) in the source code directory, however the results
> were not related.
>
> Most of the getCorrections(...) were for the classes that implemented
> IQuickFixProcessor (they were simply overriding it), so I couldn't
> find place to start to dig into the code.
>
> Do you by any chance know a good place so that maybe following that I
> could find the source code that does this? For example: do you know
> what is executed when the actual user clicks to a possible quick fix?
> Or what part of the GUI code is that dialog box (or gadget) is? I
> think these would be excellent starts for me, however I have no idea
> to which code they point to.
>
> Thank you,
|
|
|
Re: How to open an IJavaElement programatically? [message #651222 is a reply to message #651208] |
Fri, 28 January 2011 13:06 |
Kivanc Muslu Messages: 153 Registered: November 2010 |
Senior Member |
|
|
Hi Dani,
I had written a quite long reply normally, however for some reason the system didn't accept it and it is gone.
In summary (please ask me if something is not clear, I would explain it in more detail), I have looked at ChangeCorrectionProposal.apply(...). It seems that it is getting active page (which is got through the active window). I am not sure if this is my problem but, I am sure that when you try to get active window using a non-UI thread, then it returns null (it is even documented to return null in this case). So in my version, I definitely cannot get the active page (I get null), because I need to apply the changes using a background thread (daemon).
So, my question is: When I do change.perform(...) it doesn't change anything in the target file. Is this due to the fact that I am invoking it from a non-UI thread, and this is not permitted? If so, I might need to completely change my design, if not, I will look more into it.
I ask this, because other than that what is done in ChagneCorrectionProposal.apply(...) seems very alike to the pattern proposed in Change.java documentation to apply the changes.
* Here is a code snippet that can be used to execute a change:
* <pre>
* Change change= createChange();
* try {
* change.initializeValidationData(pm);
*
* ....
*
* if (!change.isEnabled())
* return;
* RefactoringStatus valid= change.isValid(new SubProgressMonitor(pm, 1));
* if (valid.hasFatalError())
* return;
* Change undo= change.perform(new SubProgressMonitor(pm, 1));
* if (undo != null) {
* undo.initializeValidationData(new SubProgressMonitor(pm, 1));
* // do something with the undo object
* }
* } finally {
* change.dispose();
* }
I also use a minor modified version of this above code to perform the changes. As I said however, when I invoke change.perform(...) (which returns normally), the target file does not change.
However, if I do the same using a UI thread (i.e., from plug-in's constructor for testing), then it again does not change the target file (performing the change does not change the target file).
However, if I do the same using a UI thread, and if I open the file that is supposed to change using page.openEditor(...) (since this is a UI thread, I can get the active page), now the change is applied correctly and the target file is updated accordingly.
Since I don't know the internal of these whole classes and the interaction between them, this seems pretty weird to me (i.e., it is like that I need to open the file inside an editor to apply a change object on it). Again, I might be missing something.
Thanks a lot for the help, any further guidance is greatly appreciated.
Regards,
|
|
|
Re: How to open an IJavaElement programatically? [message #651248 is a reply to message #651222] |
Fri, 28 January 2011 14:39 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 28.01.2011 14:06, Kivanc Muslu wrote:
> Hi Dani,
>
> I had written a quite long reply normally, however for some reason the
> system didn't accept it and it is gone.
>
> In summary (please ask me if something is not clear, I would explain
> it in more detail), I have looked at
> ChangeCorrectionProposal.apply(...). It seems that it is getting
> active page (which is got through the active window). I am not sure if
> this is my problem but, I am sure that when you try to get active
> window using a non-UI thread, then it returns null (it is even
> documented to return null in this case). So in my version, I
> definitely cannot get the active page (I get null), because I need to
> apply the changes using a background thread (daemon).
>
> So, my question is: When I do change.perform(...) it doesn't change
> anything in the target file. Is this due to the fact that I am
> invoking it from a non-UI thread,
Why not just post into the UI thread?
Dani
> and this is not permitted? If so, I might need to completely change my
> design, if not, I will look more into it.
>
> I ask this, because other than that what is done in
> ChagneCorrectionProposal.apply(...) seems very alike to the pattern
> proposed in Change.java documentation to apply the changes.
>
> * Here is a code snippet that can be used to execute a change:
> * <pre>
> * Change change= createChange();
> * try {
> * change.initializeValidationData(pm);
> * * ....
> *
> * if (!change.isEnabled())
> * return;
> * RefactoringStatus valid= change.isValid(new
> SubProgressMonitor(pm, 1));
> * if (valid.hasFatalError())
> * return;
> * Change undo= change.perform(new SubProgressMonitor(pm, 1));
> * if (undo != null) {
> * undo.initializeValidationData(new SubProgressMonitor(pm, 1));
> * // do something with the undo object
> * }
> * } finally {
> * change.dispose();
> * }
>
>
> I also use a minor modified version of this above code to perform the
> changes. As I said however, when I invoke change.perform(...) (which
> returns normally), the target file does not change.
>
> However, if I do the same using a UI thread (i.e., from plug-in's
> constructor for testing), then it again does not change the target
> file (performing the change does not change the target file).
>
> However, if I do the same using a UI thread, and if I open the file
> that is supposed to change using page.openEditor(...) (since this is a
> UI thread, I can get the active page), now the change is applied
> correctly and the target file is updated accordingly.
>
> Since I don't know the internal of these whole classes and the
> interaction between them, this seems pretty weird to me (i.e., it is
> like that I need to open the file inside an editor to apply a change
> object on it). Again, I might be missing something.
>
> Thanks a lot for the help, any further guidance is greatly appreciated.
>
> Regards,
|
|
| | | |
Goto Forum:
Current Time: Thu Sep 26 08:37:58 GMT 2024
Powered by FUDForum. Page generated in 0.05795 seconds
|