# HG changeset patch # User Jiri Rechtacek # Date 1316352673 -7200 # Node ID cd34d58c6d858de1175900ba72ec520973c88865 # Parent 718df9e6e6127e956a94d2fce129a09ca3d1fdc6 registrer Prototype multiview diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/nbproject/project.xml --- a/PLSQL/FileType/nbproject/project.xml Thu Sep 08 15:39:43 2011 +0200 +++ b/PLSQL/FileType/nbproject/project.xml Sun Sep 18 15:31:13 2011 +0200 @@ -7,6 +7,15 @@ + org.netbeans.core.multiview + + + + 1 + 1.25 + + + org.netbeans.modules.db diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties Thu Sep 08 15:39:43 2011 +0200 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties Sun Sep 18 15:31:13 2011 +0200 @@ -1,7 +1,10 @@ +LBL_Prototype_EDITOR=Source OpenIDE-Module-Name=PL/SQL File Type OpenIDE-Module-Display-Category=PL/SQL Support LBL_Plsql_loader_name=PL/SQL Files Services/MIMEResolver/PlsqlResolver.xml=PL/SQL Files +Services/MIMEResolver/PrototypeResolver.xml=Prototype Files +Templates/Other/PrototypeTemplate.sql=Empty Prototype file Templates/PLSQL=PL/SQL Templates/PLSQL/LogicalUnit.apy=Logical Unit Implementation Templates/PLSQL/LogicalUnit.api=Logical Unit Specification diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlResolver.xml --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlResolver.xml Thu Sep 08 15:39:43 2011 +0200 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PlsqlResolver.xml Sun Sep 18 15:31:13 2011 +0200 @@ -16,7 +16,7 @@ - + diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeDataObject.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeDataObject.java Sun Sep 18 15:31:13 2011 +0200 @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates and open the template in + * the editor. + */ +package org.netbeans.modules.plsql.filetype; + +import java.io.IOException; +import org.netbeans.core.spi.multiview.MultiViewElement; +import org.netbeans.core.spi.multiview.text.MultiViewEditorElement; +import org.openide.filesystems.FileObject; +import org.openide.loaders.DataObjectExistsException; +import org.openide.loaders.MultiDataObject; +import org.openide.loaders.MultiFileLoader; +import org.openide.util.Lookup; +import org.openide.windows.TopComponent; + +public class PrototypeDataObject extends MultiDataObject { + + public PrototypeDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { + super(pf, loader); + registerEditor("text/x-plsql-prototype", true); + } + + @Override + protected int associateLookup() { + return 1; + } + + @MultiViewElement.Registration(displayName = "#LBL_Prototype_EDITOR", + iconBase = "SET/PATH/TO/ICON/HERE", + mimeType = "text/x-plsql-prototype", + persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED, + preferredID = "Prototype", + position = 1000) + public static MultiViewEditorElement createEditor(Lookup lkp) { + return new MultiViewEditorElement(lkp); + } +} diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeResolver.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeResolver.xml Sun Sep 18 15:31:13 2011 +0200 @@ -0,0 +1,12 @@ + + + + + + + + + diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeTemplate.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeTemplate.sql Sun Sep 18 15:31:13 2011 +0200 @@ -0,0 +1,1 @@ +sample content \ No newline at end of file diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.form --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.form Sun Sep 18 15:31:13 2011 +0200 @@ -0,0 +1,28 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.java Sun Sep 18 15:31:13 2011 +0200 @@ -0,0 +1,125 @@ +/* + * To change this template, choose Tools | Templates and open the template in + * the editor. + */ +package org.netbeans.modules.plsql.filetype; + +import javax.swing.Action; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JToolBar; +import org.netbeans.core.spi.multiview.CloseOperationState; +import org.netbeans.core.spi.multiview.MultiViewElement; +import org.netbeans.core.spi.multiview.MultiViewElementCallback; +import org.openide.awt.UndoRedo; +import org.openide.util.Lookup; +import org.openide.util.NbBundle.Messages; +import org.openide.windows.TopComponent; + +@MultiViewElement.Registration(displayName = "#LBL_Prototype_VISUAL", +iconBase = "SET/PATH/TO/ICON/HERE", +mimeType = "text/x-plsql-prototype", +persistenceType = TopComponent.PERSISTENCE_NEVER, +preferredID = "PrototypeVisual", +position = 2000) +@Messages({ + "LBL_Prototype_VISUAL=Visual" +}) +public final class PrototypeVisualElement extends JPanel implements MultiViewElement { + + private PrototypeDataObject obj; + private JToolBar toolbar = new JToolBar(); + private transient MultiViewElementCallback callback; + + public PrototypeVisualElement(Lookup lkp) { + obj = lkp.lookup(PrototypeDataObject.class); + assert obj != null; + initComponents(); + } + + @Override + public String getName() { + return "PrototypeVisualElement"; + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables + @Override + public JComponent getVisualRepresentation() { + return this; + } + + @Override + public JComponent getToolbarRepresentation() { + return toolbar; + } + + @Override + public Action[] getActions() { + return new Action[0]; + } + + @Override + public Lookup getLookup() { + return obj.getLookup(); + } + + @Override + public void componentOpened() { + } + + @Override + public void componentClosed() { + } + + @Override + public void componentShowing() { + } + + @Override + public void componentHidden() { + } + + @Override + public void componentActivated() { + } + + @Override + public void componentDeactivated() { + } + + @Override + public UndoRedo getUndoRedo() { + return UndoRedo.NONE; + } + + @Override + public void setMultiViewCallback(MultiViewElementCallback callback) { + this.callback = callback; + } + + @Override + public CloseOperationState canCloseElement() { + return CloseOperationState.STATE_OK; + } +} diff -r 718df9e6e612 -r cd34d58c6d85 PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/layer.xml --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/layer.xml Thu Sep 08 15:39:43 2011 +0200 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/layer.xml Sun Sep 18 15:31:13 2011 +0200 @@ -53,7 +53,74 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -66,9 +133,18 @@ + + + + + + + + +