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

Bug 358719

Summary: PartNotFoundException thrown from WidgetDescriptorFactory
Product: z_Archived Reporter: Brian Svihovec <svihovec>
Component: EDTAssignee: Huo Zhen Zhong <huozz>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: chenzhh, pharmon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
fix lasher: iplog+

Description Brian Svihovec CLA 2011-09-23 09:22:13 EDT
Using a development environment, or running the installable build with the -console option, open a RUIHandler that contains a Box widget in the VE.

In the console window, you will see the following exception being thrown:

org.eclipse.edt.mof.egl.PartNotFoundException: 
	at org.eclipse.edt.ide.core.internal.lookup.ProjectEnvironment.findPart(ProjectEnvironment.java:218)
	at org.eclipse.edt.ide.rui.visualeditor.internal.widget.WidgetDescriptorFactory.processWidgetContainer(WidgetDescriptorFactory.java:531)
	at org.eclipse.edt.ide.rui.visualeditor.internal.widget.WidgetDescriptorFactory.processWidget(WidgetDescriptorFactory.java:213)
	at org.eclipse.edt.ide.rui.visualeditor.internal.widget.WidgetDescriptorFactory.createWidgetDescriptor(WidgetDescriptorFactory.java:132)
	at org.eclipse.edt.ide.rui.visualeditor.internal.widget.WidgetDescriptorRegistry.createWidgetDescriptor(WidgetDescriptorRegistry.java:256)
	at org.eclipse.edt.ide.rui.visualeditor.internal.widget.WidgetDescriptorRegistry$Updater.initializeRegistry(WidgetDescriptorRegistry.java:110)
	at org.eclipse.edt.ide.rui.visualeditor.internal.widget.WidgetDescriptorRegistry$Updater.run(WidgetDescriptorRegistry.java:83)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

I believe this is related to the way that default annotation values have changed in EDT as compared to RBD.  

In WidgetDescriptorFactory, line 509, there is the following code:

Annotation containerAnnotation = (Annotation) widgetAnnotation.getValue( WIDGET_CONTAINER );
		if(containerAnnotation != null){
			isContainer = true;
			String layoutDataTypeTemplate = (String) containerAnnotation.getValue( WIDGET_LAYOUTDATATYPE );
			if (layoutDataTypeTemplate != null ) {

The Box widget specifies the VEContainer annotation as:

container = @VEContainer{}

which means that we get into the first 'if' block.  The default value for the WIDGET_LAYOUTDATATYPE (e.g. "layoutDataType") field is a String, so layoutDataTypeTemplate becomes the empty string, since no value was specified in the annotation.  It looks like our code will have to change so that it checks for the empty string instead of Null, since the field of the VEContainer annotation is not nullable.

NOTE: I think we need to scrub our code for all annotation accesses and see if there are other changes like this to be made.
Comment 1 Huo Zhen Zhong CLA 2011-10-10 03:01:17 EDT
Created attachment 204855 [details]
fix
Comment 2 Huo Zhen Zhong CLA 2011-10-10 03:01:40 EDT
fixed
Comment 3 Lisa Lasher CLA 2012-04-04 22:30:42 EDT
fixed in 0.7 GA