1 19 20 package org.netbeans.modules.xml.schema.core.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.MultiViewFactory; 28 import org.netbeans.modules.xml.schema.core.SchemaDataObject; 29 import org.netbeans.modules.xml.schema.core.SchemaEditorSupport; 30 import org.openide.util.NbBundle; 31 import org.openide.util.Utilities; 32 import org.openide.windows.TopComponent; 33 37 public class SchemaSourceMultiViewDesc 38 implements MultiViewDescription, Serializable { 39 40 41 private static final long serialVersionUID = -4505309173196320880L; 42 public static final String PREFERRED_ID = "xml-schema-sourceview"; 43 private SchemaDataObject schemaDataObject; 44 45 public SchemaSourceMultiViewDesc( ) { 47 } 48 49 50 public SchemaSourceMultiViewDesc(SchemaDataObject schemaDataObject) { 51 this.schemaDataObject = schemaDataObject; 52 } 53 54 public String preferredID() { 55 return PREFERRED_ID; 56 } 57 58 public int getPersistenceType() { 59 return TopComponent.PERSISTENCE_ONLY_OPENED; 60 } 61 62 public java.awt.Image getIcon() { 63 return Utilities.loadImage(SchemaDataObject.SCHEMA_ICON_BASE_WITH_EXT); 64 } 65 66 public org.openide.util.HelpCtx getHelpCtx() { 67 return org.openide.util.HelpCtx.DEFAULT_HELP; 68 } 69 70 public String getDisplayName() { 71 return NbBundle.getMessage(SchemaColumnViewMultiViewDesc.class, "LBL_sourceView_name"); 72 } 73 74 public org.netbeans.core.spi.multiview.MultiViewElement createElement() { 75 SchemaEditorSupport editorSupport = 76 schemaDataObject.getSchemaEditorSupport(); 77 if (editorSupport != null) { 78 SchemaSourceMultiViewElement editorComponent = new SchemaSourceMultiViewElement(schemaDataObject); 79 return editorComponent; 80 } 81 return MultiViewFactory.BLANK_ELEMENT; 82 83 } 84 85 public void writeExternal(ObjectOutput out) throws IOException { 86 out.writeObject(schemaDataObject); 87 } 88 89 public void readExternal(ObjectInput in) 90 throws IOException , ClassNotFoundException 91 { 92 Object firstObject = in.readObject(); 93 if (firstObject instanceof SchemaDataObject) 94 schemaDataObject = (SchemaDataObject) firstObject; 95 } 96 97 } 98 | Popular Tags |