1 19 20 package org.netbeans.modules.websvc.design.multiview; 21 22 import java.io.IOException ; 23 import java.io.ObjectInput ; 24 import java.io.ObjectOutput ; 25 import java.io.Serializable ; 26 import org.netbeans.core.spi.multiview.MultiViewDescription; 27 import org.netbeans.core.spi.multiview.MultiViewElement; 28 import org.netbeans.core.spi.multiview.MultiViewFactory; 29 import org.openide.loaders.DataObject; 30 import org.openide.text.DataEditorSupport; 31 import org.openide.util.NbBundle; 32 import org.openide.windows.TopComponent; 33 37 public class SourceMultiViewDesc 38 implements MultiViewDescription, Serializable { 39 40 41 private static final long serialVersionUID = -4505309173196320880L; 42 45 public static final String PREFERRED_ID = "webservice-sourceview"; 46 private MultiViewSupport mvSupport; 47 48 51 public SourceMultiViewDesc() { 52 } 53 54 58 public SourceMultiViewDesc(MultiViewSupport mvSupport) { 59 this.mvSupport = mvSupport; 60 } 61 62 public String preferredID() { 63 return PREFERRED_ID; 64 } 65 66 public int getPersistenceType() { 67 return TopComponent.PERSISTENCE_ONLY_OPENED; 68 } 69 70 public java.awt.Image getIcon() { 71 return MultiViewSupport.SERVICE_BADGE; 72 } 73 74 public org.openide.util.HelpCtx getHelpCtx() { 75 return org.openide.util.HelpCtx.DEFAULT_HELP; 76 } 77 78 public String getDisplayName() { 79 return NbBundle.getMessage(SourceMultiViewDesc.class, "LBL_sourceView_name"); 80 } 81 82 public MultiViewElement createElement() { 83 DataObject dataObject = mvSupport.getDataObject(); 84 DataEditorSupport editorSupport = (DataEditorSupport) 85 dataObject.getLookup().lookup(DataEditorSupport.class); 86 if (editorSupport != null) { 87 SourceMultiViewElement editorComponent = 88 new SourceMultiViewElement(mvSupport,editorSupport); 89 return editorComponent; 90 } 91 return MultiViewFactory.BLANK_ELEMENT; 92 } 93 94 99 public void writeExternal(ObjectOutput out) throws IOException { 100 out.writeObject(mvSupport); 101 } 102 103 109 public void readExternal(ObjectInput in) 110 throws IOException , ClassNotFoundException 111 { 112 Object firstObject = in.readObject(); 113 if (firstObject instanceof MultiViewSupport) 114 mvSupport = (MultiViewSupport) firstObject; 115 } 116 117 } 118 | Popular Tags |