001: /*
002: * Sun Public License Notice
003: *
004: * The contents of this file are subject to the Sun Public License
005: * Version 1.0 (the "License"). You may not use this file except in
006: * compliance with the License. A copy of the License is available at
007: * http://www.sun.com/
008: *
009: * The Original Code is NetBeans. The Initial Developer of the Original
010: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
011: * Microsystems, Inc. All Rights Reserved.
012: If you wish your version of this file to be governed by only the CDDL
013: or only the GPL Version 2, indicate your decision by adding
014: "[Contributor] elects to include this software in this distribution
015: under the [CDDL or GPL Version 2] license." If you do not indicate a
016: single choice of license, a recipient has the option to distribute
017: your version of this file under either the CDDL, the GPL Version 2 or
018: to extend the choice of license to its licensees as provided above.
019: However, if you add GPL Version 2 code and therefore, elected the GPL
020: Version 2 license, then the option applies only if the new code is
021: made subject to such option by the copyright holder.
022: If you wish your version of this file to be governed by only the CDDL
023: or only the GPL Version 2, indicate your decision by adding
024: "[Contributor] elects to include this software in this distribution
025: under the [CDDL or GPL Version 2] license." If you do not indicate a
026: single choice of license, a recipient has the option to distribute
027: your version of this file under either the CDDL, the GPL Version 2 or
028: to extend the choice of license to its licensees as provided above.
029: However, if you add GPL Version 2 code and therefore, elected the GPL
030: Version 2 license, then the option applies only if the new code is
031: made subject to such option by the copyright holder.
032: */
033:
034: /*
035: * ETLSourceMultiviewDesc.java
036: *
037: * Created on October 13, 2005, 2:05 PM
038: *
039: * To change this template, choose Tools | Template Manager
040: * and open the template in the editor.
041: */
042: package org.netbeans.modules.etl.ui;
043:
044: import java.io.IOException;
045: import java.io.ObjectInput;
046: import java.io.ObjectOutput;
047: import java.io.Serializable;
048:
049: import net.java.hulp.i18n.Logger;
050: import org.netbeans.core.spi.multiview.MultiViewDescription;
051: import org.netbeans.core.spi.multiview.MultiViewFactory;
052: import org.netbeans.modules.etl.logger.Localizer;
053: import org.netbeans.modules.etl.logger.LogUtil;
054: import org.openide.windows.TopComponent;
055:
056: /**
057: *
058: * @author Jeri Lockhart
059: */
060: public class ETLSourceMultiviewDesc implements MultiViewDescription,
061: Serializable {
062:
063: private static final long serialVersionUID = -4505309173196320880L;
064: public static final String PREFERRED_ID = "etl-sourceview";
065: private ETLDataObject etlDataObject;
066: private static transient final Logger mLogger = LogUtil
067: .getLogger(ETLSourceMultiviewDesc.class.getName());
068: private static transient final Localizer mLoc = Localizer.get();
069:
070: // Constructor for reserialization
071: public ETLSourceMultiviewDesc() {
072:
073: }
074:
075: /**
076: * Creates a new instance of etlSourceMultiviewDesc
077: */
078: public ETLSourceMultiviewDesc(ETLDataObject etlDataObject) {
079: this .etlDataObject = etlDataObject;
080: }
081:
082: public String preferredID() {
083: return PREFERRED_ID;
084: }
085:
086: public int getPersistenceType() {
087: return TopComponent.PERSISTENCE_ONLY_OPENED;
088: }
089:
090: public java.awt.Image getIcon() {
091: ETLNode node = (ETLNode) etlDataObject.getNodeDelegate();
092: return node.getIcon(0);
093: }
094:
095: public org.openide.util.HelpCtx getHelpCtx() {
096: return org.openide.util.HelpCtx.DEFAULT_HELP;
097: }
098:
099: public String getDisplayName() {
100: String nbBundle1 = mLoc.t("PRSR001: Source");
101: return Localizer.parse(nbBundle1);
102: }
103:
104: public org.netbeans.core.spi.multiview.MultiViewElement createElement() {
105: ETLEditorSupport editorSupport = etlDataObject
106: .getETLEditorSupport();
107: if (editorSupport != null) {
108: ETLSourceMultiViewElement editorComponent = new ETLSourceMultiViewElement(
109: etlDataObject);
110: return editorComponent;
111: }
112: return MultiViewFactory.BLANK_ELEMENT;
113:
114: }
115:
116: public void writeExternal(ObjectOutput out) throws IOException {
117: out.writeObject(etlDataObject);
118: }
119:
120: public void readExternal(ObjectInput in) throws IOException,
121: ClassNotFoundException {
122: Object firstObject = in.readObject();
123: if (firstObject instanceof ETLDataObject) {
124: etlDataObject = (ETLDataObject) firstObject;
125: }
126: }
127: }
|