1 19 20 package org.netbeans.modules.xml.wsdl.ui.netbeans.module; 21 22 import java.io.IOException ; 23 import java.io.ObjectInput ; 24 import java.io.ObjectOutput ; 25 import java.io.Serializable ; 26 27 import org.netbeans.core.spi.multiview.MultiViewDescription; 28 import org.netbeans.core.spi.multiview.MultiViewFactory; 29 import org.openide.util.NbBundle; 30 import org.openide.util.Utilities; 31 import org.openide.windows.TopComponent; 32 36 public class WSDLSourceMultiviewDesc 37 implements MultiViewDescription, Serializable { 38 39 40 private static final long serialVersionUID = -4505309173196320880L; 41 public static final String PREFERRED_ID = "wsdl-sourceview"; 42 private WSDLDataObject wsdlDataObject; 43 44 public WSDLSourceMultiviewDesc( ) { 46 } 47 48 51 public WSDLSourceMultiviewDesc(WSDLDataObject wsdlDataObject) { 52 this.wsdlDataObject = wsdlDataObject; 53 } 54 55 public String preferredID() { 56 return PREFERRED_ID; 57 } 58 59 public int getPersistenceType() { 60 return TopComponent.PERSISTENCE_ONLY_OPENED; 61 } 62 63 public java.awt.Image getIcon() { 64 return Utilities.loadImage(WSDLDataObject.WSDL_ICON_BASE_WITH_EXT); 65 } 66 67 public org.openide.util.HelpCtx getHelpCtx() { 68 return org.openide.util.HelpCtx.DEFAULT_HELP; 69 } 70 71 public String getDisplayName() { 72 return NbBundle.getMessage(WSDLTreeViewMultiViewDesc.class, "LBL_sourceView_name"); 73 } 74 75 public org.netbeans.core.spi.multiview.MultiViewElement createElement() { 76 WSDLEditorSupport editorSupport = wsdlDataObject.getWSDLEditorSupport(); 77 if (editorSupport != null) { 78 WSDLSourceMultiViewElement editorComponent = new WSDLSourceMultiViewElement(wsdlDataObject); 79 return editorComponent; 80 } 81 return MultiViewFactory.BLANK_ELEMENT; 82 83 } 84 85 public void writeExternal(ObjectOutput out) throws IOException { 86 out.writeObject(wsdlDataObject); 87 } 88 89 public void readExternal(ObjectInput in) 90 throws IOException , ClassNotFoundException 91 { 92 Object firstObject = in.readObject(); 93 if (firstObject instanceof WSDLDataObject) 94 wsdlDataObject = (WSDLDataObject) firstObject; 95 } 96 97 } 98 | Popular Tags |