Bug 140972 [Smoke]Multiple master page doesn't work.
Description: Multiple master page doesn't work. Steps to reproduce: 1. Insert another master page 2. Double click to edit it Result: java.lang.ClassCastException at org.eclipse.birt.report.designer.core.model.schematic.HandleAdapterFactory.getLibraryHandleAdapter(HandleAdapterFactory.java:289) at org.eclipse.birt.report.designer.core.model.schematic.HandleAdapterFactory.getLibraryHandleAdapter(HandleAdapterFactory.java:304) at org.eclipse.birt.report.designer.core.model.schematic.HandleAdapterFactory.getDesignElementHandleAdapter(HandleAdapterFactory.java:76) at org.eclipse.birt.report.designer.internal.lib.editparts.EmptyEditPart.creatDesignElementHandleAdapter(EmptyEditPart.java:100) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.editparts.ReportElementEditPart.<init>(ReportElementEditPart.java:99) at org.eclipse.birt.report.designer.internal.lib.editparts.EmptyEditPart.<init>(EmptyEditPart.java:39) at org.eclipse.birt.report.designer.internal.lib.editparts.LibraryMasterPageGraphicalPartFactory$1.<init>(LibraryMasterPageGraphicalPartFactory.java:44) at org.eclipse.birt.report.designer.internal.lib.editparts.LibraryMasterPageGraphicalPartFactory.createEditPart(LibraryMasterPageGraphicalPartFactory.java:38) at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents(AbstractEditPartViewer.java:594) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.layout.AbstractReportGraphicalEditorWithFlyoutPalette.initializeGraphicalViewer(AbstractReportGraphicalEditorWithFlyoutPalette.java:434) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.layout.ReportMasterPageEditor.initializeGraphicalViewer(ReportMasterPageEditor.java:45) at org.eclipse.birt.report.designer.internal.ui.editors.parts.GraphicalEditorWithFlyoutPalette.createGraphicalViewer(GraphicalEditorWithFlyoutPalette.java:559) at org.eclipse.birt.report.designer.internal.ui.editors.schematic.layout.AbstractReportGraphicalEditorWithRuler.createGraphicalViewer(AbstractReportGraphicalEditorWithRuler.java:60) at org.eclipse.gef.ui.parts.GraphicalEditor.createPartControl(GraphicalEditor.java:163) at org.eclipse.birt.report.designer.internal.ui.editors.parts.GraphicalEditorWithFlyoutPalette.createPartControl(GraphicalEditorWithFlyoutPalette.java:402) at org.eclipse.birt.report.designer.ui.editors.pages.ReportMasterPageEditorFormPage.createPartControl(ReportMasterPageEditorFormPage.java:261) at org.eclipse.ui.forms.editor.FormEditor.pageChange(FormEditor.java:462) at org.eclipse.birt.report.designer.ui.editors.MultiPageReportEditor.pageChange(MultiPageReportEditor.java:481) at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:596) at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:502) at org.eclipse.birt.report.designer.ui.editors.MultiPageReportEditor.handleOpenMasterPage(MultiPageReportEditor.java:882) at org.eclipse.birt.report.designer.ui.editors.MultiPageReportEditor.performRequest(MultiPageReportEditor.java:870) at org.eclipse.birt.report.designer.core.util.mediator.ReportMediator.notifyRequest(ReportMediator.java:128) at org.eclipse.birt.report.designer.internal.ui.views.outline.DesignerOutlinePage$2.widgetDefaultSelected(DesignerOutlinePage.java:218) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:97) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) 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:336) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
UI/org.eclipse.birt.report.designer.ui.editors/src/org/eclipse/birt/report/designer/ui/editors/MultiPageReportEditor.java
{
		if ( ReportRequest.OPEN_EDITOR.equals( request.getType( ) )
				&& ( request.getSelectionModelList( ).size( ) == 1 )
				&& request.getSelectionModelList( ).get( 0 ) instanceof MasterPageHandle )
		{
			handleOpenMasterPage( request );
			return;
		}
		
	}
	/**
	 * @param request
	 */
	protected void handleOpenMasterPage( final ReportRequest request )
	{
		setActivePage( LayoutMasterPage_ID );
		Display.getCurrent( ).asyncExec( new Runnable( ) {
			public void run( )
			{
				ReportRequest r = new ReportRequest( );
				r.setType( ReportRequest.LOAD_MASTERPAGE );
				r.setSelectionObject( request.getSelectionModelList( ) );
				SessionHandleAdapter.getInstance( )
						.getMediator( )
						.notifyRequest( r );
			}
		} );
	}
}