PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.java
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/PrototypeVisualElement.java Sun Sep 18 15:31:13 2011 +0200
1.3 @@ -0,0 +1,125 @@
1.4 +/*
1.5 + * To change this template, choose Tools | Templates and open the template in
1.6 + * the editor.
1.7 + */
1.8 +package org.netbeans.modules.plsql.filetype;
1.9 +
1.10 +import javax.swing.Action;
1.11 +import javax.swing.JComponent;
1.12 +import javax.swing.JPanel;
1.13 +import javax.swing.JToolBar;
1.14 +import org.netbeans.core.spi.multiview.CloseOperationState;
1.15 +import org.netbeans.core.spi.multiview.MultiViewElement;
1.16 +import org.netbeans.core.spi.multiview.MultiViewElementCallback;
1.17 +import org.openide.awt.UndoRedo;
1.18 +import org.openide.util.Lookup;
1.19 +import org.openide.util.NbBundle.Messages;
1.20 +import org.openide.windows.TopComponent;
1.21 +
1.22 +@MultiViewElement.Registration(displayName = "#LBL_Prototype_VISUAL",
1.23 +iconBase = "SET/PATH/TO/ICON/HERE",
1.24 +mimeType = "text/x-plsql-prototype",
1.25 +persistenceType = TopComponent.PERSISTENCE_NEVER,
1.26 +preferredID = "PrototypeVisual",
1.27 +position = 2000)
1.28 +@Messages({
1.29 + "LBL_Prototype_VISUAL=Visual"
1.30 +})
1.31 +public final class PrototypeVisualElement extends JPanel implements MultiViewElement {
1.32 +
1.33 + private PrototypeDataObject obj;
1.34 + private JToolBar toolbar = new JToolBar();
1.35 + private transient MultiViewElementCallback callback;
1.36 +
1.37 + public PrototypeVisualElement(Lookup lkp) {
1.38 + obj = lkp.lookup(PrototypeDataObject.class);
1.39 + assert obj != null;
1.40 + initComponents();
1.41 + }
1.42 +
1.43 + @Override
1.44 + public String getName() {
1.45 + return "PrototypeVisualElement";
1.46 + }
1.47 +
1.48 + /** This method is called from within the constructor to
1.49 + * initialize the form.
1.50 + * WARNING: Do NOT modify this code. The content of this method is
1.51 + * always regenerated by the Form Editor.
1.52 + */
1.53 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
1.54 + private void initComponents() {
1.55 +
1.56 + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
1.57 + this.setLayout(layout);
1.58 + layout.setHorizontalGroup(
1.59 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1.60 + .addGap(0, 400, Short.MAX_VALUE)
1.61 + );
1.62 + layout.setVerticalGroup(
1.63 + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1.64 + .addGap(0, 300, Short.MAX_VALUE)
1.65 + );
1.66 + }// </editor-fold>//GEN-END:initComponents
1.67 +
1.68 + // Variables declaration - do not modify//GEN-BEGIN:variables
1.69 + // End of variables declaration//GEN-END:variables
1.70 + @Override
1.71 + public JComponent getVisualRepresentation() {
1.72 + return this;
1.73 + }
1.74 +
1.75 + @Override
1.76 + public JComponent getToolbarRepresentation() {
1.77 + return toolbar;
1.78 + }
1.79 +
1.80 + @Override
1.81 + public Action[] getActions() {
1.82 + return new Action[0];
1.83 + }
1.84 +
1.85 + @Override
1.86 + public Lookup getLookup() {
1.87 + return obj.getLookup();
1.88 + }
1.89 +
1.90 + @Override
1.91 + public void componentOpened() {
1.92 + }
1.93 +
1.94 + @Override
1.95 + public void componentClosed() {
1.96 + }
1.97 +
1.98 + @Override
1.99 + public void componentShowing() {
1.100 + }
1.101 +
1.102 + @Override
1.103 + public void componentHidden() {
1.104 + }
1.105 +
1.106 + @Override
1.107 + public void componentActivated() {
1.108 + }
1.109 +
1.110 + @Override
1.111 + public void componentDeactivated() {
1.112 + }
1.113 +
1.114 + @Override
1.115 + public UndoRedo getUndoRedo() {
1.116 + return UndoRedo.NONE;
1.117 + }
1.118 +
1.119 + @Override
1.120 + public void setMultiViewCallback(MultiViewElementCallback callback) {
1.121 + this.callback = callback;
1.122 + }
1.123 +
1.124 + @Override
1.125 + public CloseOperationState canCloseElement() {
1.126 + return CloseOperationState.STATE_OK;
1.127 + }
1.128 +}