org.netbeans.core.spi.multiview.MultiViewElement Java Examples

The following examples show how to use org.netbeans.core.spi.multiview.MultiViewElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiViewModel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
     * constructor used at deserialization...
     */
    MultiViewModel(MultiViewDescription[] descs, MultiViewDescription defaultDescr, 
                   MultiViewModel.ActionRequestObserverFactory factory, Map<MultiViewDescription, MultiViewElement> existingElements) {
        observerFactory = factory;
        nestedElements = new HashMap<MultiViewDescription, MultiViewElement>();
//        nestedPerspectiveComponents = new HashMap();
        nestedPerspectives = new HashMap<MultiViewDescription,MultiViewPerspective>();
        nestedCallbacks = new HashMap<MultiViewElement, MultiViewElementCallback>();
        shownElements = new HashSet<MultiViewElement>(descs.length + 3);
        descriptions = descs;
        for (int i = 0; i < descriptions.length; i++) {
            MultiViewElement element = existingElements.get(descriptions[i]);
            nestedElements.put(descriptions[i], element);
            nestedPerspectives.put(descriptions[i], Accessor.DEFAULT.createPerspective(descriptions[i]));
            if (element != null) {
                // set the observer..
                MultiViewElementCallback call = factory.createElementCallback(descriptions[i]);
                nestedCallbacks.put(element, call);
                element.setMultiViewCallback(call);
//                nestedPerspectiveComponents.put(descriptions[i], Accessor.DEFAULT.createPersComponent(element));
            }
        }
        currentEditor = (defaultDescr == null || !nestedElements.containsKey(defaultDescr) ? descriptions[0] : defaultDescr);
        group = new BtnGroup();
	groupSplit = new BtnGroup();
    }
 
Example #2
Source File: MultiViewPeer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addPropertyChangeListeners() {
    if( null != model ) {
        for (MultiViewDescription mvd : model.getDescriptions()) {
            if( mvd instanceof ContextAwareDescription && ((ContextAwareDescription)mvd).isSplitDescription() )
                continue; //#240371 - don't update name from spit elements
            
            MultiViewElement el = model.getElementForDescription( mvd, false );
            if (el == null) {
                continue;
            }
            if (el.getVisualRepresentation() instanceof Pane) {
                Pane pane = (Pane)el.getVisualRepresentation();
                final CloneableTopComponent tc = pane.getComponent();
                if (!Arrays.asList(tc.getPropertyChangeListeners()).contains(propListener)) {
                    tc.addPropertyChangeListener(propListener);
                }
            }
        }
    }
}
 
Example #3
Source File: SunDescriptorDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@MultiViewElement.Registration(
    mimeType={ DDType.IPLANET_MIME_TYPE_PREFIX + DDType.WEB_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.WEB_MIME_TYPE_SUFFIX,
        DDType.IPLANET_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX,
        DDType.GLASSFISH_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX
    },
    iconBase="org/netbeans/modules/j2ee/sun/ddloaders/resources/DDDataIcon.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="multiview_xml_gf_shared_environment",
    displayName="#CTL_EnvTabCaption",
    position=15
)
public static MultiViewElement createEnvMultiViewEnvironmentElement(Lookup lookup) {
    return new EnvironmentMultiViewElement(lookup.lookup(SunDescriptorDataObject.class));
}
 
Example #4
Source File: MultiViewPeer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void updateName() {
    // is called before setMultiViewDescriptions() need to check for null.
    if (model != null) {
        for (MultiViewDescription mvd : model.getDescriptions()) {
            if( mvd instanceof ContextAwareDescription && ((ContextAwareDescription)mvd).isSplitDescription() )
                continue; //#240371 - don't update name from spit elements
            
            MultiViewElement el = model.getElementForDescription(
                mvd, MultiViewCloneableTopComponent.isSourceView(mvd)
            );
            if (el == null) {
                continue;
            }
            if (el.getVisualRepresentation() instanceof Pane) {
                Pane pane = (Pane)el.getVisualRepresentation();
                pane.updateName();
                final CloneableTopComponent tc = pane.getComponent();
                peer.setDisplayName(tc.getDisplayName());
                peer.setIcon(tc.getIcon());
                if (!Arrays.asList(tc.getPropertyChangeListeners()).contains(propListener)) {
                    tc.addPropertyChangeListener(propListener);
                }
            }
        }
    }
}
 
Example #5
Source File: SunDescriptorDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@MultiViewElement.Registration(
    mimeType={ DDType.SUN_MIME_TYPE_PREFIX + DDType.WEB_MIME_TYPE_SUFFIX, 
        DDType.IPLANET_MIME_TYPE_PREFIX + DDType.WEB_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.EJB_MIME_TYPE_SUFFIX,
        DDType.IPLANET_MIME_TYPE_PREFIX + DDType.EJB_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.APP_MIME_TYPE_SUFFIX,
        DDType.IPLANET_MIME_TYPE_PREFIX + DDType.APP_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX, 
        DDType.IPLANET_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX,
        DDType.GLASSFISH_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.CMP_MIME_TYPE_SUFFIX, 
        DDType.IPLANET_MIME_TYPE_PREFIX + DDType.CMP_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.RSRC_MIME_TYPE_SUFFIX, 
        DDType.IPLANET_MIME_TYPE_PREFIX + DDType.RSRC_MIME_TYPE_SUFFIX
    },
    iconBase="org/netbeans/modules/j2ee/sun/ddloaders/resources/DDDataIcon.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="multiview_xml_xml",
    displayName="#CTL_SourceTabCaption",
    position=20
)
public static XmlMultiViewElement createXmlMultiViewElement(Lookup lookup) {
    return new XmlMultiViewElement(lookup.lookup(SunDescriptorDataObject.class));
}
 
Example #6
Source File: JadeLanguage.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@MIMEResolver.ExtensionRegistration(
    extension={ "jade"},
    displayName="#JadeResolver",
    mimeType=JadeTokenId.JADE_MIME_TYPE,
    position=191
)
@NbBundle.Messages("JadeResolver=Jade Files")
@MultiViewElement.Registration(displayName = "#LBL_JadeEditorTab",
    iconBase = "org/netbeans/modules/javascript2/jade/resources/jade16.png",
    persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID = "jade.source",
    mimeType = JadeTokenId.JADE_MIME_TYPE,
    position = 2)
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #7
Source File: JsonLanguage.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@MIMEResolver.Registration(displayName = "jshintrc", resource = "jshintrc-resolver.xml", position = 124)
@MIMEResolver.ExtensionRegistration(
    extension={ "json" },
    displayName="#JsonResolver",
    mimeType=JsTokenId.JSON_MIME_TYPE,
    position=195
)
@NbBundle.Messages("JsonResolver=JSON Files")
@MultiViewElement.Registration(displayName = "#LBL_JsonEditorTab",
    iconBase = "org/netbeans/modules/javascript2/editor/resources/javascript.png",
    persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID = "json.source",
    mimeType = JsTokenId.JSON_MIME_TYPE,
    position = 1)
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #8
Source File: JsLanguage.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@MIMEResolver.ExtensionRegistration(
    extension={ "js", "sdoc", "jsx" },
    displayName="#JsResolver",
    mimeType=JsTokenId.JAVASCRIPT_MIME_TYPE,
    position=190
)
@NbBundle.Messages("JsResolver=JavaScript Files")
@MultiViewElement.Registration(displayName = "#LBL_JsEditorTab",
    iconBase = "org/netbeans/modules/javascript2/editor/resources/javascript.png",
    persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID = "javascript.source",
    mimeType = JsTokenId.JAVASCRIPT_MIME_TYPE,
    position = 1)
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #9
Source File: EjbJarMultiViewDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    mimeType="text/x-dd-ejbjar-ee5",
    iconBase="org/netbeans/modules/j2ee/ddloaders/client/DDDataIcon.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="multiview_xml",
    displayName="#CTL_SourceTabCaption",
    position=1
)
public static XmlMultiViewElement createXmlMultiViewElementEE5(Lookup lookup) {
    return new XmlMultiViewElement(lookup.lookup(XmlMultiViewDataObject.class));
}
 
Example #10
Source File: LayerDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages("Source=&Source")
@MultiViewElement.Registration(
    displayName = "#Source",
    iconBase = LayerUtil.LAYER_ICON,
    mimeType = "text/x-netbeans-layer+xml",
    persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID = "source",
    position = 1
)
public static MultiViewEditorElement createEditor(Lookup lkp) {
    return new MultiViewEditorElement(lkp);
}
 
Example #11
Source File: MfDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Messages("Source=&Source")
@MultiViewElement.Registration(
        displayName="#Source",
        iconBase="org/netbeans/modules/languages/manifest/manifest_file_16.png",
        persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
        mimeType=MfLanguageProvider.MIME_TYPE,
        preferredID="manifest.source",
        position=1
)
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #12
Source File: DDDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    mimeType={DDDataLoader.REQUIRED_MIME_1, DDWeb25DataLoader.REQUIRED_MIME, DDWeb30DataLoader.REQUIRED_MIME,
        DDWebFragment30DataLoader.REQUIRED_MIME, DDWeb30DataLoader.REQUIRED_MIME_31, DDWebFragment30DataLoader.REQUIRED_MIME_31},
    iconBase="org/netbeans/modules/j2ee/ddloaders/web/resources/DDDataIcon.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="multiview_xml",
    displayName="#CTL_SourceTabCaption",
    position=1
)
@Messages("CTL_SourceTabCaption=Source")
public static XmlMultiViewElement createXmlMultiViewElement(Lookup lookup) {
    return new XmlMultiViewElement(lookup.lookup(XmlMultiViewDataObject.class));
}
 
Example #13
Source File: EjbJarMultiViewDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    displayName="#LBL_" + CMP_RELATIONSHIPS,
    iconBase=Utils.ICON_BASE_DD_VALID + ".gif",
    persistenceType=TopComponent.PERSISTENCE_NEVER,
    preferredID="dd_multiview_" + CMP_RELATIONSHIPS,
    mimeType="text/x-dd-ejbjar",
    position=1000
)
public static MultiViewElement getCmpRelationShips(Lookup context) {
    DataObject dObj = context.lookup(DataObject.class);
    assert dObj != null;
    return new CmpRelationshipsMultiViewElement((EjbJarMultiViewDataObject) dObj);
}
 
Example #14
Source File: YamlDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("Source=&Source")
@MultiViewElement.Registration(
        displayName="#Source",
        iconBase="org/netbeans/modules/languages/yaml/yaml_files_16.png",
        persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
        mimeType=YamlTokenId.YAML_MIME_TYPE,
        preferredID="neon.source",
        position=1
)
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #15
Source File: TLDDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
        displayName="#LBL_TLDEditorTab",
        iconBase="org/netbeans/modules/web/taglib/resources/tag.gif",
        persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
        preferredID="tld.source",
        mimeType=TLDLoader.TLD_MIMETYPE,
        position=1
    )
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #16
Source File: EjbJarMultiViewDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    mimeType="text/x-dd-ejbjar",
    iconBase="org/netbeans/modules/j2ee/ddloaders/client/DDDataIcon.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="multiview_xml",
    displayName="#CTL_SourceTabCaption",
    position=1
)
public static XmlMultiViewElement createXmlMultiViewElement(Lookup lookup) {
    return new XmlMultiViewElement(lookup.lookup(XmlMultiViewDataObject.class));
}
 
Example #17
Source File: GspLanguage.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("CTL_SourceTabCaption=&Source")
@MultiViewElement.Registration(
    iconBase = GSP_ICON,
    mimeType = GSP_MIME_TYPE,
    position = 1,
    preferredID = "groovy.gsp",
    displayName = "#CTL_SourceTabCaption",
    persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED
)
public static MultiViewEditorElement createEditor(Lookup lkp) {
    return new MultiViewEditorElement(lkp);
}
 
Example #18
Source File: MultiViewPeer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
JEditorPane getEditorPane() {
    if (model != null) {
        MultiViewElement el = model.getActiveElement();
        if (el != null && el.getVisualRepresentation() instanceof Pane) {
            Pane pane = (Pane)el.getVisualRepresentation();
            return pane.getEditorPane();
        }
    }
    return null;
}
 
Example #19
Source File: MultiViewProcessorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    displayName="Contextual",
    mimeType="text/context",
    persistenceType=TopComponent.PERSISTENCE_ALWAYS,
    preferredID="context"
)
public static CntxMVE create(Lookup lkp) {
    return new CntxMVE(lkp);
}
 
Example #20
Source File: EntityDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    displayName="org.netbeans.modules.xml.Bundle#CTL_SourceTabCaption",
    iconBase="org/netbeans/modules/xml/resources/entObject.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="entity.text",
    mimeType=MIME_TYPE,
    position=1
)
public static MultiViewEditorElement createMultiViewDTDElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #21
Source File: ProguardDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
        displayName = "&Source",
        iconBase = "org/netbeans/modules/android/project/proguard/proguard.png",
        mimeType = "text/x-proguard",
        persistenceType = TopComponent.PERSISTENCE_NEVER,
        preferredID = "source",
        position = 1
)
public static MultiViewEditorElement createEditor(Lookup lkp) {
    return new MultiViewEditorElement(lkp);
}
 
Example #22
Source File: TabsComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void switchToCard(MultiViewElement elem, String id, boolean isSplitElement) {
if (isSplitElement) {
    switchToCardSplit(elem, id);
    return;
}
       if (! alreadyAddedElements.contains(elem)) {
           componentPanel.add(elem.getVisualRepresentation(), id);
           alreadyAddedElements.add(elem);
       }
       cardLayout.show(componentPanel, id);
   }
 
Example #23
Source File: SunDescriptorDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    mimeType={ DDType.SUN_MIME_TYPE_PREFIX + DDType.WEB_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.EJB_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX,
        DDType.GLASSFISH_MIME_TYPE_PREFIX + DDType.APP_CLI_MIME_TYPE_SUFFIX
    },
    iconBase="org/netbeans/modules/j2ee/sun/ddloaders/resources/DDDataIcon.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="multiview_xml_gf_shared_WS",
    displayName="#CTL_WebServiceTabCaption",
    position=5
)
public static MultiViewElement createServicesMultiViewElement(Lookup lookup) {
    return new WebServiceMultiViewElement(lookup.lookup(SunDescriptorDataObject.class));
}
 
Example #24
Source File: MultiViewCloneableTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public javax.swing.JEditorPane getEditorPane() {
    if (peer == null || peer.model == null) {
        return null;
    }
    MultiViewElement paneEl = findPaneElement();
    if (paneEl != null) {
        CloneableEditorSupport.Pane pane = (CloneableEditorSupport.Pane)paneEl.getVisualRepresentation();
        return pane.getEditorPane();
    }
    // hopeless case, don't try to create new elements. it's users responsibility to
    // switch to the editor element before getEditorPane() 
    return null;
}
 
Example #25
Source File: JPAFileDataObject.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("Source=&Source")
@MultiViewElement.Registration(
        displayName = "#Source",
        iconBase = "io/github/jeddict/jpa/modeler/specification/model/file/JPA_FILE_ICON.png",
        persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
        mimeType = JPA_FILE_TYPE,
        preferredID = "jpa.source",
        position = 1
)
public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
    return new MultiViewEditorElement(context);
}
 
Example #26
Source File: SunDescriptorDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
    mimeType={ DDType.IPLANET_MIME_TYPE_PREFIX + DDType.EJB_MIME_TYPE_SUFFIX,
        DDType.SUN_MIME_TYPE_PREFIX + DDType.EJB_MIME_TYPE_SUFFIX
    },
    iconBase="org/netbeans/modules/j2ee/sun/ddloaders/resources/DDDataIcon.gif",
    persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
    preferredID="multiview_xml_gf_ejb_overview",
    displayName="#CTL_OverviewTabCaption",
    position=1
)
public static MultiViewElement createEjbOveriewMultiViewElement(Lookup lookup) {
    return new SunEjbOverviewMultiViewElement(lookup.lookup(SunDescriptorDataObject.class));
}
 
Example #27
Source File: ColorsDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
        displayName = "#Source",
        iconBase = "org/nbandroid/netbeans/gradle/v2/layout/icons-colors-16.png",
        mimeType = "text/text/x-android-colors+xml",
        persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
        preferredID = "source",
        position = 1
)
public static MultiViewEditorElement createEditor(Lookup lkp) {
    return new MultiViewEditorElement(lkp);
}
 
Example #28
Source File: UnknownValuesDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
        displayName = "#Source",
        iconBase = "org/nbandroid/netbeans/gradle/v2/layout/icons-values-16.png",
        mimeType = "text/x-android-values+xml",
        persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
        preferredID = "source",
        position = 1
)
public static MultiViewEditorElement createEditor(Lookup lkp) {
    return new MultiViewEditorElement(lkp);
}
 
Example #29
Source File: PayaraDescriptorDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
        mimeType = PAYARA_WEB_MIME_TYPE,
        iconBase = DD_ICON,
        persistenceType = PERSISTENCE_ONLY_OPENED,
        preferredID = "multiview_xml_payara_shared_security",
        displayName = "#CTL_SecurityTabCaption",
        position = 3
)
public static MultiViewElement createSecurityMultiViewSecurityElement(Lookup lookup) {
    return new SecurityRoleMappingMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
}
 
Example #30
Source File: PayaraDescriptorDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@MultiViewElement.Registration(
        mimeType = PAYARA_WEB_MIME_TYPE,
        iconBase = DD_ICON,
        persistenceType = PERSISTENCE_ONLY_OPENED,
        preferredID = "multiview_xml_payara_xml",
        displayName = "#CTL_SourceTabCaption",
        position = 20
)
public static XmlMultiViewElement createXmlMultiViewElement(Lookup lookup) {
    return new XmlMultiViewElement(lookup.lookup(PayaraDescriptorDataObject.class));
}