Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 131428

Summary: InternalGEFPlugin failing to initialise
Product: [Tools] GEF Reporter: Justin Couch <justin>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Justin Couch CLA 2006-03-10 22:03:15 EST
The manifest is missing the Bundle-Activator definition. The result is that anywhere the code uses InternalGEFPlugin.getDefault() will return null as the plugin is never instantiated. For example, creating a GraphicalEditorWithFlyoutPalette will generate the following exception trace:

!ENTRY org.eclipse.ui 4 0 2006-03-10 18:49:04.437
!MESSAGE Unable to create editor ID org.iloc.ui.editor.OpenCanvasEditor: An unexpected exception was thrown.
!STACK 0
java.lang.NullPointerException
	at org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette.getPalettePreferences(GraphicalEditorWithFlyoutPalette.java:113)
	at org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette.createPartControl(GraphicalEditorWithFlyoutPalette.java:76)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:585)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:365)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
	at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:283)
	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:126)
	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:391)
	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1102)
	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1051)
	at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1256)
	at org.eclipse.ui.internal.PartStack.add(PartStack.java:442)
	at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:109)
	at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:60)
	at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:212)
	at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:202)
	at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:753)
	at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:665)
	at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:628)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2323)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2258)
	at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:2250)
	at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2236)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2231)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2212)
	at org.iloc.ui.editor.actions.NewDiagramAction.run(NewDiagramAction.java:86)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246)
	at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:223)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:896)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3236)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2856)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.iloc.core.ILocApplication.run(ILocApplication.java:60)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
	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:324)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)

By adding in the following line to the plugin's manifest, the above code will correctly function because the internal plugin class has been instantiated:

Bundle-Activator: org.eclipse.gef.internal.InternalGEFPlugin

Note that from Eclipse 3.1 onward, the class attribute of the plugin tag in plugin.xml is ignored if you are not running the compatibility plugin. To instantiate the plugin class, you must have the Bundle-Activator entry in the plugin's manifest.
Comment 1 Justin Couch CLA 2006-03-10 22:43:29 EST
Reorganised the title to make it more meaningful to the problem at hand. 

Within a RCP application, with no compatibility nor automatic update enabled, the InternalGEFPlugin fails to initialise. The result is that anywhere it is used, a NPE is generated. The above exception trace is one such instance, but I'm running into it all over the place as I play whack-a-mole with it. (Eg default constructor of DefaultPaletteViewerPreferences also crashes). 

This occurs with any version of GEF in the 3.2 build collection. Right now I'm using the current stream integration build from 9 March 2006 and it still has issues. 

I only ever see this fail to initialise problem when the Bundle-Activator entry is missing or incorrectly configured in the manifest, as appears to be the case here. 
Comment 2 Randy Hudson CLA 2006-03-12 22:56:48 EST
I don't understand what you are saying about the bundle activator not being set. It was changed in January to point to the new Internal plugin class.

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gef/META-INF/MANIFEST.MF?cvsroot=Tools_Project
Comment 3 Randy Hudson CLA 2006-03-29 13:27:11 EST
invalid