01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.xslt.tmap.multiview.source;
21:
22: import java.awt.Image;
23: import java.beans.BeanInfo;
24: import java.io.Serializable;
25:
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.netbeans.modules.xslt.tmap.TMapDataObject;
30: import org.openide.util.HelpCtx;
31: import org.openide.util.NbBundle;
32: import org.openide.windows.TopComponent;
33:
34: /**
35: *
36: * @author Vitaly Bychkov
37: * @version 1.0
38: */
39: public class TMapSourceMultiViewElementDesc implements
40: MultiViewDescription, Serializable {
41:
42: private static final long serialVersionUID = 1L;
43: public static final String PREFERED_ID = "tmapsource"; //NOI18N
44: private static final String DISPLAY_NAME = "LBL_SourceMultiview_DisplayName"; //NOI18N
45: private TMapDataObject myDataObject;
46:
47: // need for serialization
48: private TMapSourceMultiViewElementDesc() {
49: super ();
50: }
51:
52: public TMapSourceMultiViewElementDesc(TMapDataObject dataObject) {
53: super ();
54: myDataObject = dataObject;
55: }
56:
57: public MultiViewElement createElement() {
58: if (myDataObject.getEditorSupport() != null) {
59: return new TMapSourceMultiViewElement(myDataObject);
60: }
61: return MultiViewFactory.BLANK_ELEMENT;
62: }
63:
64: public String getDisplayName() {
65: return NbBundle.getMessage(getClass(), DISPLAY_NAME);
66: }
67:
68: public HelpCtx getHelpCtx() {
69: return new HelpCtx("tmap_editor_source"); //NOI18N
70: }
71:
72: public Image getIcon() {
73: return getDataObject().getNodeDelegate().getIcon(
74: BeanInfo.ICON_COLOR_16x16);
75: }
76:
77: public int getPersistenceType() {
78: return TopComponent.PERSISTENCE_ONLY_OPENED;
79: }
80:
81: public String preferredID() {
82: return PREFERED_ID;
83: }
84:
85: private TMapDataObject getDataObject() {
86: return myDataObject;
87: }
88: }
|