1 19 20 package org.netbeans.modules.xml.wsdl.ui.netbeans.module; 21 import org.netbeans.core.api.multiview.MultiViewHandler; 22 import org.netbeans.core.api.multiview.MultiViewPerspective; 23 import org.netbeans.core.api.multiview.MultiViews; 24 import org.netbeans.core.spi.multiview.MultiViewDescription; 25 import org.netbeans.core.spi.multiview.MultiViewFactory; 26 import org.openide.windows.CloneableTopComponent; 27 import org.openide.windows.TopComponent; 28 29 33 public class WSDLMultiViewFactory { 34 37 public WSDLMultiViewFactory() { 38 } 39 40 public static CloneableTopComponent createMultiView(WSDLDataObject wsdlDataObject) { 41 MultiViewDescription views[] = new MultiViewDescription[3]; 42 43 views[0] = getWSDLSourceMultiviewDesc(wsdlDataObject); 44 views[1] = getWSDLTreeViewMultiViewDesc(wsdlDataObject); 45 views[2] = getWSDLDesignMultiviewDesc(wsdlDataObject); 46 47 CloneableTopComponent multiview = 48 MultiViewFactory.createCloneableMultiView( 49 views, 50 views[0], 51 new WSDLEditorSupport.CloseHandler(wsdlDataObject)); 52 53 String name = wsdlDataObject.getNodeDelegate().getDisplayName(); 55 multiview.setDisplayName(name); 56 multiview.setName(name); 57 58 59 return multiview; 60 } 61 62 63 private static MultiViewDescription getWSDLTreeViewMultiViewDesc(WSDLDataObject wsdlDataObject) { 64 return new WSDLTreeViewMultiViewDesc(wsdlDataObject); 65 } 66 67 private static MultiViewDescription getWSDLSourceMultiviewDesc(WSDLDataObject wsdlDataObject) { 68 return new WSDLSourceMultiviewDesc(wsdlDataObject); 69 } 70 71 private static MultiViewDescription getWSDLDesignMultiviewDesc(WSDLDataObject wsdlDataObject) { 72 return new WSDLDesignMultiViewDesc(wsdlDataObject); 73 } 74 75 82 public static void requestMultiviewActive(String id) { 83 TopComponent activeTC = TopComponent.getRegistry().getActivated(); 84 MultiViewHandler handler = MultiViews.findMultiViewHandler(activeTC); 85 if (handler != null) { 86 MultiViewPerspective[] perspectives = handler.getPerspectives(); 87 for (MultiViewPerspective perspective : perspectives) { 88 if (perspective.preferredID().equals(id)) { 89 handler.requestActive(perspective); 90 } 91 } 92 } 93 } 94 } 95 | Popular Tags |