Bug 190114 [regression]Exception when new style in library theme.[01]
Description: Exception when new style in library theme. Build number:2.2.0.v20070531 Steps to reproduce: 1. New a library. 2. In outline, select theme, right click and select new style. Expected result: Style builder pops up without errors. Actual result: Error dialog pops up. Error log: java.lang.IllegalArgumentException: Argument cannot be null at org.eclipse.swt.SWT.error(SWT.java:3531) at org.eclipse.swt.SWT.error(SWT.java:3465) at org.eclipse.swt.SWT.error(SWT.java:3436) at org.eclipse.swt.widgets.Widget.error(Widget.java:432) at org.eclipse.swt.widgets.Text.setText(Text.java:1794) at org.eclipse.birt.report.designer.internal.ui.dialogs.GeneralPreferencePage.initialize(GeneralPreferencePage.java:227) at org.eclipse.jface.preference.FieldEditorPreferencePage.createContents(FieldEditorPreferencePage.java:233) at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233) at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1441) at org.eclipse.jface.preference.PreferenceDialog$13.run(PreferenceDialog.java:1198) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:850) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:46) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:193) at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1192) at org.eclipse.jface.preference.PreferenceDialog$9.selectionChanged(PreferenceDialog.java:697) at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:842) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:850) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:46) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:193) at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:840) at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1642) at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1083) at org.eclipse.jface.preference.PreferenceDialog.selectSavedItem(PreferenceDialog.java:994) at org.eclipse.jface.preference.PreferenceDialog$4.run(PreferenceDialog.java:368) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.preference.PreferenceDialog.createContents(PreferenceDialog.java:364) at org.eclipse.jface.window.Window.create(Window.java:426) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1081) at org.eclipse.jface.window.Window.open(Window.java:785) at org.eclipse.birt.report.designer.ui.dialogs.StyleBuilder.open(StyleBuilder.java:79) at org.eclipse.birt.report.designer.internal.ui.views.outline.providers.StyleNodeProvider.performEdit(StyleNodeProvider.java:83) at org.eclipse.birt.report.designer.internal.ui.views.DefaultNodeProvider.performRequest(DefaultNodeProvider.java:368) at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.birt.report.designer.ui.views.ElementAdapterInvocationHandler.invoke(ElementAdapterInvocationHandler.java:89) at $Proxy0.performRequest(Unknown Source) at org.eclipse.birt.report.designer.internal.ui.views.outline.providers.ThemeNodeProvider.createElement(ThemeNodeProvider.java:94) at org.eclipse.birt.report.designer.internal.ui.views.DefaultNodeProvider.createElement(DefaultNodeProvider.java:565) at org.eclipse.birt.report.designer.internal.ui.views.DefaultNodeProvider.performInsert(DefaultNodeProvider.java:609) at org.eclipse.birt.report.designer.internal.ui.views.DefaultNodeProvider.performRequest(DefaultNodeProvider.java:360) at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.birt.report.designer.ui.views.ElementAdapterInvocationHandler.invoke(ElementAdapterInvocationHandler.java:89) at $Proxy0.performRequest(Unknown Source) at org.eclipse.birt.report.designer.internal.ui.views.actions.InsertAction.doAction(InsertAction.java:173) at org.eclipse.birt.report.designer.internal.ui.views.actions.AbstractElementAction.run(AbstractElementAction.java:64) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:545) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) 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:153) 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:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/core/namespace/ModuleNameHelper.java
*/
	public Level findCachedLevel( String elementName )
	{
		if ( elementName == null )
			return null;
		String namespace = StringUtil.extractNamespace( elementName );
		String name = StringUtil.extractName( elementName );
		if ( namespace == null )
			return (Level) cachedLevelNames.get( name );
		Library lib = module.getLibraryWithNamespace( namespace );
		return lib == null ? null : (Level) ( (ModuleNameHelper) lib
				.getNameHelper( ) ).findCachedLevel( name );
	}
	/**
	 * 
	 */
	public void clearCachedLevels( )
	{
		cachedLevelNames = null;
		List libs = module.getAllLibraries( );
		if ( libs == null )
			return;
		for ( int i = 0; i < libs.size( ); i++ )
		{
			Library lib = (Library) libs.get( i );
			( (ModuleNameHelper) lib.getNameHelper( ) ).cachedLevelNames = null;
		}
	}
}