registrer Prototype multiview multiview_prototype
authorJiri Rechtacek <jrechtacek@netbeans.org>
Sun, 18 Sep 2011 15:31:13 +0200
branchmultiview_prototype
changeset 19cd34d58c6d85
parent 18 718df9e6e612
registrer Prototype multiview
PLSQL/FileType/nbproject/project.xml
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlResolver.xml
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeDataObject.java
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeResolver.xml
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeTemplate.sql
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.form
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.java
PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/layer.xml
     1.1 --- a/PLSQL/FileType/nbproject/project.xml	Thu Sep 08 15:39:43 2011 +0200
     1.2 +++ b/PLSQL/FileType/nbproject/project.xml	Sun Sep 18 15:31:13 2011 +0200
     1.3 @@ -7,6 +7,15 @@
     1.4              <suite-component/>
     1.5              <module-dependencies>
     1.6                  <dependency>
     1.7 +                    <code-name-base>org.netbeans.core.multiview</code-name-base>
     1.8 +                    <build-prerequisite/>
     1.9 +                    <compile-dependency/>
    1.10 +                    <run-dependency>
    1.11 +                        <release-version>1</release-version>
    1.12 +                        <specification-version>1.25</specification-version>
    1.13 +                    </run-dependency>
    1.14 +                </dependency>
    1.15 +                <dependency>
    1.16                      <code-name-base>org.netbeans.modules.db</code-name-base>
    1.17                      <build-prerequisite/>
    1.18                      <compile-dependency/>
     2.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties	Thu Sep 08 15:39:43 2011 +0200
     2.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties	Sun Sep 18 15:31:13 2011 +0200
     2.3 @@ -1,7 +1,10 @@
     2.4 +LBL_Prototype_EDITOR=Source
     2.5  OpenIDE-Module-Name=PL/SQL File Type
     2.6  OpenIDE-Module-Display-Category=PL/SQL Support
     2.7  LBL_Plsql_loader_name=PL/SQL Files
     2.8  Services/MIMEResolver/PlsqlResolver.xml=PL/SQL Files
     2.9 +Services/MIMEResolver/PrototypeResolver.xml=Prototype Files
    2.10 +Templates/Other/PrototypeTemplate.sql=Empty Prototype file
    2.11  Templates/PLSQL=PL/SQL
    2.12  Templates/PLSQL/LogicalUnit.apy=Logical Unit Implementation
    2.13  Templates/PLSQL/LogicalUnit.api=Logical Unit Specification
     3.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlResolver.xml	Thu Sep 08 15:39:43 2011 +0200
     3.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlResolver.xml	Sun Sep 18 15:31:13 2011 +0200
     3.3 @@ -16,7 +16,7 @@
     3.4          <ext name="SPEC"/>
     3.5          <ext name="db"/>
     3.6          <ext name="DB"/>
     3.7 -        <ext name="sql"/>
     3.8 +        <!--<ext name="sql"/>-->
     3.9          <ext name="SQL"/>
    3.10          <ext name="cre"/>
    3.11          <ext name="CRE"/>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeDataObject.java	Sun Sep 18 15:31:13 2011 +0200
     4.3 @@ -0,0 +1,38 @@
     4.4 +/*
     4.5 + * To change this template, choose Tools | Templates and open the template in
     4.6 + * the editor.
     4.7 + */
     4.8 +package org.netbeans.modules.plsql.filetype;
     4.9 +
    4.10 +import java.io.IOException;
    4.11 +import org.netbeans.core.spi.multiview.MultiViewElement;
    4.12 +import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
    4.13 +import org.openide.filesystems.FileObject;
    4.14 +import org.openide.loaders.DataObjectExistsException;
    4.15 +import org.openide.loaders.MultiDataObject;
    4.16 +import org.openide.loaders.MultiFileLoader;
    4.17 +import org.openide.util.Lookup;
    4.18 +import org.openide.windows.TopComponent;
    4.19 +
    4.20 +public class PrototypeDataObject extends MultiDataObject {
    4.21 +
    4.22 +    public PrototypeDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    4.23 +        super(pf, loader);
    4.24 +        registerEditor("text/x-plsql-prototype", true);
    4.25 +    }
    4.26 +
    4.27 +    @Override
    4.28 +    protected int associateLookup() {
    4.29 +        return 1;
    4.30 +    }
    4.31 +
    4.32 +    @MultiViewElement.Registration(displayName = "#LBL_Prototype_EDITOR",
    4.33 +    iconBase = "SET/PATH/TO/ICON/HERE",
    4.34 +    mimeType = "text/x-plsql-prototype",
    4.35 +    persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
    4.36 +    preferredID = "Prototype",
    4.37 +    position = 1000)
    4.38 +    public static MultiViewEditorElement createEditor(Lookup lkp) {
    4.39 +        return new MultiViewEditorElement(lkp);
    4.40 +    }
    4.41 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeResolver.xml	Sun Sep 18 15:31:13 2011 +0200
     5.3 @@ -0,0 +1,12 @@
     5.4 +<?xml version="1.0" encoding="UTF-8"?>
     5.5 +<!--
     5.6 +To change this template, choose Tools | Templates
     5.7 +and open the template in the editor.
     5.8 +-->
     5.9 +<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
    5.10 +<MIME-resolver>
    5.11 +    <file>
    5.12 +        <ext name="sql"/>
    5.13 +        <resolver mime="text/x-plsql-prototype"/>
    5.14 +    </file>
    5.15 +</MIME-resolver>
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeTemplate.sql	Sun Sep 18 15:31:13 2011 +0200
     6.3 @@ -0,0 +1,1 @@
     6.4 +sample content
     6.5 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.form	Sun Sep 18 15:31:13 2011 +0200
     7.3 @@ -0,0 +1,28 @@
     7.4 +<?xml version="1.0" encoding="UTF-8" ?>
     7.5 +
     7.6 +<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     7.7 +  <AuxValues>
     7.8 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
     7.9 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
    7.10 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
    7.11 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
    7.12 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
    7.13 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
    7.14 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
    7.15 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
    7.16 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
    7.17 +  </AuxValues>
    7.18 +
    7.19 +  <Layout>
    7.20 +    <DimensionLayout dim="0">
    7.21 +      <Group type="103" groupAlignment="0" attributes="0">
    7.22 +          <EmptySpace min="0" pref="400" max="32767" attributes="0"/>
    7.23 +      </Group>
    7.24 +    </DimensionLayout>
    7.25 +    <DimensionLayout dim="1">
    7.26 +      <Group type="103" groupAlignment="0" attributes="0">
    7.27 +          <EmptySpace min="0" pref="300" max="32767" attributes="0"/>
    7.28 +      </Group>
    7.29 +    </DimensionLayout>
    7.30 +  </Layout>
    7.31 +</Form>
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.java	Sun Sep 18 15:31:13 2011 +0200
     8.3 @@ -0,0 +1,125 @@
     8.4 +/*
     8.5 + * To change this template, choose Tools | Templates and open the template in
     8.6 + * the editor.
     8.7 + */
     8.8 +package org.netbeans.modules.plsql.filetype;
     8.9 +
    8.10 +import javax.swing.Action;
    8.11 +import javax.swing.JComponent;
    8.12 +import javax.swing.JPanel;
    8.13 +import javax.swing.JToolBar;
    8.14 +import org.netbeans.core.spi.multiview.CloseOperationState;
    8.15 +import org.netbeans.core.spi.multiview.MultiViewElement;
    8.16 +import org.netbeans.core.spi.multiview.MultiViewElementCallback;
    8.17 +import org.openide.awt.UndoRedo;
    8.18 +import org.openide.util.Lookup;
    8.19 +import org.openide.util.NbBundle.Messages;
    8.20 +import org.openide.windows.TopComponent;
    8.21 +
    8.22 +@MultiViewElement.Registration(displayName = "#LBL_Prototype_VISUAL",
    8.23 +iconBase = "SET/PATH/TO/ICON/HERE",
    8.24 +mimeType = "text/x-plsql-prototype",
    8.25 +persistenceType = TopComponent.PERSISTENCE_NEVER,
    8.26 +preferredID = "PrototypeVisual",
    8.27 +position = 2000)
    8.28 +@Messages({
    8.29 +    "LBL_Prototype_VISUAL=Visual"
    8.30 +})
    8.31 +public final class PrototypeVisualElement extends JPanel implements MultiViewElement {
    8.32 +
    8.33 +    private PrototypeDataObject obj;
    8.34 +    private JToolBar toolbar = new JToolBar();
    8.35 +    private transient MultiViewElementCallback callback;
    8.36 +
    8.37 +    public PrototypeVisualElement(Lookup lkp) {
    8.38 +        obj = lkp.lookup(PrototypeDataObject.class);
    8.39 +        assert obj != null;
    8.40 +        initComponents();
    8.41 +    }
    8.42 +
    8.43 +    @Override
    8.44 +    public String getName() {
    8.45 +        return "PrototypeVisualElement";
    8.46 +    }
    8.47 +
    8.48 +    /** This method is called from within the constructor to
    8.49 +     * initialize the form.
    8.50 +     * WARNING: Do NOT modify this code. The content of this method is
    8.51 +     * always regenerated by the Form Editor.
    8.52 +     */
    8.53 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    8.54 +    private void initComponents() {
    8.55 +
    8.56 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    8.57 +        this.setLayout(layout);
    8.58 +        layout.setHorizontalGroup(
    8.59 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    8.60 +            .addGap(0, 400, Short.MAX_VALUE)
    8.61 +        );
    8.62 +        layout.setVerticalGroup(
    8.63 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    8.64 +            .addGap(0, 300, Short.MAX_VALUE)
    8.65 +        );
    8.66 +    }// </editor-fold>//GEN-END:initComponents
    8.67 +
    8.68 +    // Variables declaration - do not modify//GEN-BEGIN:variables
    8.69 +    // End of variables declaration//GEN-END:variables
    8.70 +    @Override
    8.71 +    public JComponent getVisualRepresentation() {
    8.72 +        return this;
    8.73 +    }
    8.74 +
    8.75 +    @Override
    8.76 +    public JComponent getToolbarRepresentation() {
    8.77 +        return toolbar;
    8.78 +    }
    8.79 +
    8.80 +    @Override
    8.81 +    public Action[] getActions() {
    8.82 +        return new Action[0];
    8.83 +    }
    8.84 +
    8.85 +    @Override
    8.86 +    public Lookup getLookup() {
    8.87 +        return obj.getLookup();
    8.88 +    }
    8.89 +
    8.90 +    @Override
    8.91 +    public void componentOpened() {
    8.92 +    }
    8.93 +
    8.94 +    @Override
    8.95 +    public void componentClosed() {
    8.96 +    }
    8.97 +
    8.98 +    @Override
    8.99 +    public void componentShowing() {
   8.100 +    }
   8.101 +
   8.102 +    @Override
   8.103 +    public void componentHidden() {
   8.104 +    }
   8.105 +
   8.106 +    @Override
   8.107 +    public void componentActivated() {
   8.108 +    }
   8.109 +
   8.110 +    @Override
   8.111 +    public void componentDeactivated() {
   8.112 +    }
   8.113 +
   8.114 +    @Override
   8.115 +    public UndoRedo getUndoRedo() {
   8.116 +        return UndoRedo.NONE;
   8.117 +    }
   8.118 +
   8.119 +    @Override
   8.120 +    public void setMultiViewCallback(MultiViewElementCallback callback) {
   8.121 +        this.callback = callback;
   8.122 +    }
   8.123 +
   8.124 +    @Override
   8.125 +    public CloseOperationState canCloseElement() {
   8.126 +        return CloseOperationState.STATE_OK;
   8.127 +    }
   8.128 +}
     9.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/layer.xml	Thu Sep 08 15:39:43 2011 +0200
     9.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/layer.xml	Sun Sep 18 15:31:13 2011 +0200
     9.3 @@ -53,7 +53,74 @@
     9.4                 </file>
     9.5              </folder>
     9.6           </folder>
     9.7 -      </folder>
     9.8 +          <folder name="x-plsql-prototype">
     9.9 +                <folder name="Actions">
    9.10 +                    <file name="org-openide-actions-CopyAction.shadow">
    9.11 +                        <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-CopyAction.instance"/>
    9.12 +                        <attr name="position" intvalue="400"/>
    9.13 +                    </file>
    9.14 +                    <file name="org-openide-actions-CutAction.shadow">
    9.15 +                        <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-CutAction.instance"/>
    9.16 +                        <attr name="position" intvalue="300"/>
    9.17 +                    </file>
    9.18 +                    <file name="org-openide-actions-DeleteAction.shadow">
    9.19 +                        <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-DeleteAction.instance"/>
    9.20 +                        <attr name="position" intvalue="600"/>
    9.21 +                    </file>
    9.22 +                    <file name="org-openide-actions-FileSystemAction.shadow">
    9.23 +                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-FileSystemAction.instance"/>
    9.24 +                        <attr name="position" intvalue="1100"/>
    9.25 +                    </file>
    9.26 +                    <file name="org-openide-actions-OpenAction.shadow">
    9.27 +                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-OpenAction.instance"/>
    9.28 +                        <attr name="position" intvalue="100"/>
    9.29 +                    </file>
    9.30 +                    <file name="org-openide-actions-PropertiesAction.shadow">
    9.31 +                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-PropertiesAction.instance"/>
    9.32 +                        <attr name="position" intvalue="1400"/>
    9.33 +                    </file>
    9.34 +                    <file name="org-openide-actions-RenameAction.shadow">
    9.35 +                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-RenameAction.instance"/>
    9.36 +                        <attr name="position" intvalue="700"/>
    9.37 +                    </file>
    9.38 +                    <file name="org-openide-actions-SaveAsTemplateAction.shadow">
    9.39 +                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-SaveAsTemplateAction.instance"/>
    9.40 +                        <attr name="position" intvalue="900"/>
    9.41 +                    </file>
    9.42 +                    <file name="org-openide-actions-ToolsAction.shadow">
    9.43 +                        <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-ToolsAction.instance"/>
    9.44 +                        <attr name="position" intvalue="1300"/>
    9.45 +                    </file>
    9.46 +                    <file name="sep-1.instance">
    9.47 +                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
    9.48 +                        <attr name="position" intvalue="200"/>
    9.49 +                    </file>
    9.50 +                    <file name="sep-2.instance">
    9.51 +                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
    9.52 +                        <attr name="position" intvalue="500"/>
    9.53 +                    </file>
    9.54 +                    <file name="sep-3.instance">
    9.55 +                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
    9.56 +                        <attr name="position" intvalue="800"/>
    9.57 +                    </file>
    9.58 +                    <file name="sep-4.instance">
    9.59 +                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
    9.60 +                        <attr name="position" intvalue="1000"/>
    9.61 +                    </file>
    9.62 +                    <file name="sep-5.instance">
    9.63 +                        <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
    9.64 +                        <attr name="position" intvalue="1200"/>
    9.65 +                    </file>
    9.66 +                </folder>
    9.67 +                <folder name="Factories">
    9.68 +                    <file name="PrototypeDataLoader.instance">
    9.69 +                        <attr name="dataObjectClass" stringvalue="org.netbeans.modules.plsql.filetype.PrototypeDataObject"/>
    9.70 +                        <attr name="instanceCreate" methodvalue="org.openide.loaders.DataLoaderPool.factory"/>
    9.71 +                        <attr name="mimeType" stringvalue="text/x-plsql-prototype"/>
    9.72 +                    </file>
    9.73 +                </folder>
    9.74 +            </folder>
    9.75 +        </folder>
    9.76     </folder>
    9.77     <folder name="Services">
    9.78        <folder name="JavaHelp">
    9.79 @@ -66,9 +133,18 @@
    9.80              <attr name="position" intvalue="2"/>
    9.81              <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.plsql.filetype.Bundle"/>
    9.82           </file>
    9.83 +            <file name="PrototypeResolver.xml" url="PrototypeResolver.xml">
    9.84 +                <attr name="displayName" bundlevalue="org.netbeans.modules.plsql.filetype.Bundle#Services/MIMEResolver/PrototypeResolver.xml"/>
    9.85 +            </file>
    9.86          </folder>
    9.87     </folder>
    9.88     <folder name="Templates">
    9.89 +        <folder name="Other">
    9.90 +            <file name="PrototypeTemplate.sql" url="PrototypeTemplate.sql">
    9.91 +                <attr name="displayName" bundlevalue="org.netbeans.modules.plsql.filetype.Bundle#Templates/Other/PrototypeTemplate.sql"/>
    9.92 +                <attr name="template" boolvalue="true"/>
    9.93 +            </file>
    9.94 +        </folder>
    9.95          <folder name="PLSQL">
    9.96           <attr name="position" intvalue="2"/>
    9.97           <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.plsql.filetype.Bundle"/>