You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/01/27 02:29:58 UTC

svn commit: r1236486 [19/43] - in /incubator/ooo/devtools/netbeansintegration: ./ build/ build/public-package-jars/ javahelp/ javahelp/org/ javahelp/org/openoffice/ javahelp/org/openoffice/extensions/ javahelp/org/openoffice/extensions/docs/ javahelp/o...

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual3Menubar.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual3Menubar.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual3Menubar.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual3Menubar.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: AddOnPanelVisual3Menubar.java,v $
+ *
+ *  $Revision: 1.8 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/08/18 15:59:23 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.addon;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import javax.swing.ActionMap;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JPanel;
+import javax.swing.tree.TreeSelectionModel;
+import org.openide.WizardDescriptor;
+import org.openide.WizardValidationException;
+import org.openide.explorer.ExplorerManager;
+import org.openide.explorer.ExplorerUtils;
+import org.openide.explorer.propertysheet.PropertySheet;
+import org.openide.explorer.view.TreeTableView;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.AddOn;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.node.AddOnChildren;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.node.AddOnNode;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.node.AddOnTreeCreator;
+import org.openoffice.extensions.projecttemplates.addon.dialogs.AddDeletedCommandPanel;
+import org.openoffice.extensions.util.datamodel.PropertyContainer;
+import org.openoffice.extensions.util.datamodel.localization.LanguageDefinition;
+import org.openoffice.extensions.util.datamodel.properties.LocalizedOpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.actions.BaseAction;
+
+public class AddOnPanelVisual3Menubar extends JPanel implements 
+        ExplorerManager.Provider, PropertyChangeListener {
+    
+    public static final String PROP_PROJECT_NAME = "descFirst"; // NOI18N
+    
+    private ExplorerManager manager = new ExplorerManager();
+    private PropertySheet propSheet;
+    private Lookup lookup;
+    
+    private AddOnActions actions;
+    private AddOnWizardPanel3Menubar panel;
+    
+    private String[] tags;
+    private NbNodeObject rootAddOn;
+    
+    /** Creates new form PanelProjectLocationVisual */
+    public AddOnPanelVisual3Menubar(AddOnWizardPanel3Menubar panel) {
+        initComponents();
+        
+        this.panel = panel;
+
+        TreeTableView view = (TreeTableView)jScrollPane1;
+//        view.setName("AddOn"); // NOI18N
+        view.setRootVisible(false);
+        view.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+        
+        // for keyboard actions enable this: handle actions must be done, too
+        ActionMap map = getActionMap();
+//        map.put("delete", ExplorerUtils.actionDelete(manager, true)); // NOI18N
+
+        propSheet = (PropertySheet)jPanel1;
+        
+        actions = new AddOnActions(manager, panel);
+        
+        manager.addPropertyChangeListener(this);
+        lookup = ExplorerUtils.createLookup(manager, map);
+    }
+    
+    public ExplorerManager getExplorerManager() {
+        return manager;
+    }
+   
+    public Lookup getLookup() {
+        return lookup;
+    }
+    
+    /** 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.
+     */
+    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+    private void initComponents() {
+        jSplitPane1 = new javax.swing.JSplitPane();
+        jPanel1 = new PropertySheet();
+        jScrollPane1 = new TreeTableView();
+        addMenuButton = new javax.swing.JButton();
+        addSeparatorButton = new javax.swing.JButton();
+        upButton = new javax.swing.JButton();
+        downButton = new javax.swing.JButton();
+        removeCommandButton = new javax.swing.JButton();
+        addCommandsButton = new javax.swing.JButton();
+        previewComboBox = new javax.swing.JComboBox();
+        jLabel1 = new javax.swing.JLabel();
+
+        setAutoscrolls(true);
+        setRequestFocusEnabled(false);
+        jSplitPane1.setDividerLocation(200);
+        jSplitPane1.setForeground(java.awt.Color.white);
+        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+        jPanel1.setMinimumSize(new java.awt.Dimension(5, 10));
+        jPanel1.setName("properties");
+        jPanel1.setPreferredSize(new java.awt.Dimension(5, 10));
+        jSplitPane1.setRightComponent(jPanel1);
+
+        jScrollPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+        jScrollPane1.setFocusTraversalPolicy(getFocusTraversalPolicy());
+        jScrollPane1.setMinimumSize(new java.awt.Dimension(5, 10));
+        jScrollPane1.setName("menuStructure");
+        jScrollPane1.setPreferredSize(new java.awt.Dimension(5, 10));
+        jSplitPane1.setLeftComponent(jScrollPane1);
+
+        org.openide.awt.Mnemonics.setLocalizedText(addMenuButton, NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "LBL_BUTTON_AddSubMenu"));
+        addMenuButton.setToolTipText(NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "BUTTON_AddSubMenu_Tooltip"));
+        addMenuButton.setName("addMenu");
+        addMenuButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                addMenuButtonActionPerformed(evt);
+            }
+        });
+
+        org.openide.awt.Mnemonics.setLocalizedText(addSeparatorButton, NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "LBL_BUTTON_AddSeparator"));
+        addSeparatorButton.setName("addSeparator");
+        addSeparatorButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                addSeparatorButtonActionPerformed(evt);
+            }
+        });
+
+        upButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/openoffice/extensions/projecttemplates/addon/icons/up.gif")));
+        upButton.setToolTipText(org.openide.util.NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "LBL_BUTTON_Delete"));
+        upButton.setName("up");
+        upButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                upButtonActionPerformed(evt);
+            }
+        });
+
+        downButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/openoffice/extensions/projecttemplates/addon/icons/down.gif")));
+        downButton.setToolTipText(org.openide.util.NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "LBL_BUTTON_Delete"));
+        downButton.setName("down");
+        downButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                downButtonActionPerformed(evt);
+            }
+        });
+
+        org.openide.awt.Mnemonics.setLocalizedText(removeCommandButton, NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "LBL_BUTTON_Delete"));
+        removeCommandButton.setName("delete");
+        removeCommandButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                removeCommandButtonActionPerformed(evt);
+            }
+        });
+
+        org.openide.awt.Mnemonics.setLocalizedText(addCommandsButton, NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "LBL_BUTTON_AddCommand"));
+        addCommandsButton.setName("addCommand");
+        addCommandsButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                addCommandsButtonActionPerformed(evt);
+            }
+        });
+
+        previewComboBox.setModel(getPreviewModel());
+        previewComboBox.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                previewComboBoxActionPerformed(evt);
+            }
+        });
+
+        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
+        jLabel1.setLabelFor(previewComboBox);
+        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, NbBundle.getMessage(AddOnPanelVisual3Menubar.class, "LBL_Preview"));
+        jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+
+        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+        this.setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+                        .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(previewComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 350, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+                    .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE))
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                    .add(layout.createSequentialGroup()
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                            .add(addMenuButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
+                            .add(addSeparatorButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
+                            .add(addCommandsButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
+                            .add(removeCommandButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)))
+                    .add(layout.createSequentialGroup()
+                        .add(46, 46, 46)
+                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+                            .add(org.jdesktop.layout.GroupLayout.LEADING, downButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE)
+                            .add(org.jdesktop.layout.GroupLayout.LEADING, upButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                        .add(76, 76, 76)))
+                .addContainerGap())
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(layout.createSequentialGroup()
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(previewComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                    .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
+                        .add(addMenuButton)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(addSeparatorButton)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(addCommandsButton)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(removeCommandButton)
+                        .add(50, 50, 50)
+                        .add(upButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(downButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                        .addContainerGap())
+                    .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 449, Short.MAX_VALUE)))
+        );
+    }// </editor-fold>//GEN-END:initComponents
+
+    private void previewComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previewComboBoxActionPerformed
+
+        int index = previewComboBox.getSelectedIndex();
+        if (tags != null) {
+            String context = tags[index];
+            AddOnNode rootNode = new AddOnNode(rootAddOn, new AddOnChildren(context, false, false), false, false);
+            manager.setRootContext(rootNode);
+            selectFirstLeaf(rootNode);
+        }
+
+
+    }//GEN-LAST:event_previewComboBoxActionPerformed
+
+    private void addCommandsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addCommandsButtonActionPerformed
+
+        AddDeletedCommandPanel.start(actions);
+        
+    }//GEN-LAST:event_addCommandsButtonActionPerformed
+
+    private void removeCommandButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeCommandButtonActionPerformed
+
+        actions.toggleVisibility();
+
+    }//GEN-LAST:event_removeCommandButtonActionPerformed
+
+    private void upButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upButtonActionPerformed
+
+        actions.moveUp();
+
+    }//GEN-LAST:event_upButtonActionPerformed
+
+    private void downButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downButtonActionPerformed
+
+        actions.moveDown();
+        
+    }//GEN-LAST:event_downButtonActionPerformed
+
+    private void addSeparatorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSeparatorButtonActionPerformed
+
+        actions.addSeparatorAction();
+
+    }//GEN-LAST:event_addSeparatorButtonActionPerformed
+
+    private void addMenuButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addMenuButtonActionPerformed
+
+        actions.addMenuAction();
+        
+    }//GEN-LAST:event_addMenuButtonActionPerformed
+        
+    
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JButton addCommandsButton;
+    private javax.swing.JButton addMenuButton;
+    private javax.swing.JButton addSeparatorButton;
+    private javax.swing.JButton downButton;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JPanel jPanel1;
+    private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JSplitPane jSplitPane1;
+    private javax.swing.JComboBox previewComboBox;
+    private javax.swing.JButton removeCommandButton;
+    private javax.swing.JButton upButton;
+    // End of variables declaration//GEN-END:variables
+    
+    public void addNotify() {
+        super.addNotify();
+        try {
+            //same problem as in 31086, initial focus on Cancel button
+            manager.setSelectedNodes(manager.getRootContext().getChildren().getNodes());
+        } catch (PropertyVetoException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+    }
+    
+    boolean valid(WizardDescriptor wizardDescriptor) {
+        Node node = manager.getRootContext();
+        AddOn addon = (AddOn)node.getLookup().lookup(NbNodeObject.class);
+        NbNodeObject[]commands = addon.getAllCommands();
+        if (commands.length == 0) {
+            String message = NbBundle.getMessage(AddOnWizardIterator.class, "LBL_ErrorMessageOneCommand");
+            wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+            return false;
+        }
+        wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); // NOI18N
+        return true;
+    }
+    
+    void store(WizardDescriptor d) { // method may be called several times!
+        Node node = manager.getRootContext();
+        // first subnodes are functions
+        NbNodeObject addOn = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+        // only one menu as sub object
+        d.putProperty("AddOnMenu", addOn.getAllSubObjects()[0]); // NOI18N
+    }
+    
+    private String[][] getLocalizedProperties(LocalizedOpenOfficeOrgProperty prop, String defaultValue) {
+        if (defaultValue == null) defaultValue = ""; // NOI18N
+        Integer[] indexes = prop.getUsedLanguageIndexes();
+        String[][] retValue = new String[2][indexes.length];
+        for (int i=0; i<indexes.length; i++) {
+            int languageID = indexes[i].intValue();
+            String text = prop.getValueForLanguage(languageID);
+            String language = LanguageDefinition.getLanguageShortNameForId(languageID);
+            retValue[0][i] = language;
+            if (text != null && text.length() > 0 && text.charAt(0) != '<' 
+                            && text.charAt(text.length() - 1) != '>') {
+                retValue[1][i] = text;
+            }
+            else {
+                retValue[1][i] = defaultValue;
+            }
+        }
+        return retValue;
+    }
+    
+    void read(WizardDescriptor settings) {
+        AddOn restepAddOn = (AddOn)settings.getProperty("AddOnMenu"); // NOI18N
+        AddOn addOn = (AddOn)settings.getProperty("AddOn"); // NOI18N
+        AddOnNode rootNode = null;
+        if (restepAddOn == null) { // first creation
+            rootNode = AddOnTreeCreator.createMenuStructure(addOn);
+        }
+        else { // restep through this panel: merge eventual changes from panel before
+            rootNode = AddOnTreeCreator.restoreMenuStructure(restepAddOn, addOn);
+        }
+        rootAddOn = (NbNodeObject)rootNode.getLookup().lookup(NbNodeObject.class);
+        manager.setRootContext(rootNode);
+        // deliver the actual actions to the node-actions
+        rootNode.setActions((BaseAction)actions);
+        selectFirstLeaf(rootNode);
+    }
+    
+    void validate(WizardDescriptor d) throws WizardValidationException {
+        // nothing to validate
+    }
+
+    public void propertyChange(PropertyChangeEvent evt) {
+        // because of TreeSelectionModel.SINGLE_TREE_SELECTION max. one node is selected
+        Node[] selectedNodes = manager.getSelectedNodes();
+        boolean disableComamnds = true;
+        if (selectedNodes != null && selectedNodes.length > 0) {
+            propSheet.setNodes(selectedNodes);
+            Node node = selectedNodes[0].getParentNode();
+            if (node != null) {  // is null after a delete
+                node = node.getParentNode(); // make sure to get parent from top node
+            }
+            if (node != null) {
+                this.removeCommandButton.setEnabled(true);
+                this.upButton.setEnabled(true);
+                this.downButton.setEnabled(true);
+                disableComamnds = false;
+            }
+        }
+        if (disableComamnds) {
+            this.removeCommandButton.setEnabled(false);
+            this.upButton.setEnabled(false);
+            this.downButton.setEnabled(false);
+        }
+        panel.fireChangeEvent(); // Notify that the panel changed
+    }
+
+    private ComboBoxModel getPreviewModel() {
+        tags = new String[PropertyContainer.PROPERTY_CONTAINER_CONTEXTS.length + 2];
+        for (int i = 0; i < PropertyContainer.PROPERTY_CONTAINER_CONTEXTS.length; i++) {
+            tags[i + 1] = PropertyContainer.PROPERTY_CONTAINER_CONTEXTS[i];
+        }
+        tags[0] = AddOnChildren.ALL;
+        tags[tags.length - 1] = AddOnChildren.BACK_END;
+        return new DefaultComboBoxModel(tags);
+    }
+
+    /**
+     * Select the first node that is not a menu node,
+     * thus opening the tree structure untill there
+     * @param node the starting node
+     */
+    private void selectFirstLeaf(Node node) {
+        Node[] nodes = node.getChildren().getNodes();
+        if (nodes != null && nodes.length > 0) {
+            selectFirstLeaf(nodes[0]);
+        }
+        else {
+            try {
+                manager.setSelectedNodes(new Node[]{node});
+            } catch (PropertyVetoException ex) {
+                LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "Cannot set selected node."); // NOI18N
+            }
+        }
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+  <Properties>
+    <Property name="autoscrolls" type="boolean" value="true"/>
+    <Property name="requestFocusEnabled" type="boolean" value="false"/>
+  </Properties>
+  <AuxValues>
+    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+  </AuxValues>
+
+  <Layout>
+    <DimensionLayout dim="0">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" attributes="0">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" attributes="0">
+                      <Component id="jLabel1" min="-2" pref="88" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="previewComboBox" pref="380" max="32767" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                  </Group>
+                  <Component id="jSplitPane1" pref="486" max="32767" attributes="0"/>
+              </Group>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" attributes="0">
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="addSeparatorButton" alignment="0" pref="159" max="32767" attributes="1"/>
+                          <Component id="deleteButton" pref="159" max="32767" attributes="1"/>
+                          <Component id="addCommandButton" pref="159" max="32767" attributes="0"/>
+                      </Group>
+                  </Group>
+                  <Group type="102" alignment="0" attributes="0">
+                      <EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
+                      <Component id="leftButton" min="-2" pref="40" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="rightButton" min="-2" pref="40" max="-2" attributes="0"/>
+                  </Group>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="previewComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="1" attributes="0">
+                  <Group type="102" alignment="0" attributes="0">
+                      <Component id="addSeparatorButton" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="addCommandButton" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
+                      <Component id="deleteButton" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace min="-2" pref="35" max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="leftButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="rightButton" alignment="3" min="-2" pref="39" max="-2" attributes="0"/>
+                      </Group>
+                  </Group>
+                  <Component id="jSplitPane1" pref="437" max="32767" attributes="1"/>
+              </Group>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Component class="javax.swing.JButton" name="deleteButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="org/openoffice/extensions/projecttemplates/addon/Bundle.properties" key="LBL_BUTTON_Delete" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+        <Property name="actionCommand" type="java.lang.String" value="Delete"/>
+        <Property name="name" type="java.lang.String" value="delete" noResource="true"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="addSeparatorButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="org/openoffice/extensions/projecttemplates/addon/Bundle.properties" key="LBL_BUTTON_AddSeparator" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+        <Property name="name" type="java.lang.String" value="addSeparator" noResource="true"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addSeparatorButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="leftButton">
+      <Properties>
+        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
+          <Image iconType="3" name="/org/openoffice/extensions/projecttemplates/addon/icons/back.gif"/>
+        </Property>
+        <Property name="name" type="java.lang.String" value="left" noResource="true"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="leftButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JButton" name="rightButton">
+      <Properties>
+        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
+          <Image iconType="3" name="/org/openoffice/extensions/projecttemplates/addon/icons/forward.gif"/>
+        </Property>
+        <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[65, 28]"/>
+        </Property>
+        <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[65, 28]"/>
+        </Property>
+        <Property name="name" type="java.lang.String" value="right" noResource="true"/>
+        <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+          <Dimension value="[65, 28]"/>
+        </Property>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rightButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Container class="javax.swing.JSplitPane" name="jSplitPane1">
+      <Properties>
+        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+          <Color blue="ff" green="ff" red="ff" type="rgb"/>
+        </Property>
+        <Property name="dividerLocation" type="int" value="60"/>
+        <Property name="orientation" type="int" value="0"/>
+        <Property name="opaque" type="boolean" value="false"/>
+      </Properties>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
+      <SubComponents>
+        <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+          <Properties>
+            <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+              <Color blue="ff" green="ff" red="ff" type="rgb"/>
+            </Property>
+            <Property name="name" type="java.lang.String" value="toolbar" noResource="true"/>
+          </Properties>
+          <AuxValues>
+            <AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="jScrollPane1.setViewportView(buttonPanel);"/>
+          </AuxValues>
+          <Constraints>
+            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+              <JSplitPaneConstraints position="left"/>
+            </Constraint>
+          </Constraints>
+
+          <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+        </Container>
+        <Container class="javax.swing.JPanel" name="jPanel1">
+          <Properties>
+            <Property name="name" type="java.lang.String" value="properties" noResource="true"/>
+          </Properties>
+          <AuxValues>
+            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new PropertySheet();"/>
+          </AuxValues>
+          <Constraints>
+            <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
+              <JSplitPaneConstraints position="bottom"/>
+            </Constraint>
+          </Constraints>
+
+          <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+        </Container>
+      </SubComponents>
+    </Container>
+    <Component class="javax.swing.JButton" name="addCommandButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="org/openoffice/extensions/projecttemplates/addon/Bundle.properties" key="LBL_BUTTON_AddCommand" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+        <Property name="name" type="java.lang.String" value="addCommand" noResource="true"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addCommandButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JComboBox" name="previewComboBox">
+      <Properties>
+        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+          <Connection code="getPreviewModel()" type="code"/>
+        </Property>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="previewComboBoxActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JLabel" name="jLabel1">
+      <Properties>
+        <Property name="horizontalAlignment" type="int" value="2"/>
+        <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+          <ComponentRef name="previewComboBox"/>
+        </Property>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="org/openoffice/extensions/projecttemplates/addon/Bundle.properties" key="LBL_Preview" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+      </Properties>
+    </Component>
+  </SubComponents>
+</Form>

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnPanelVisual4Toolbar.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,506 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: AddOnPanelVisual4Toolbar.java,v $
+ *
+ *  $Revision: 1.8 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/08/18 15:59:24 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.addon;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.PropertyVetoException;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JPanel;
+import org.openide.WizardDescriptor;
+import org.openide.WizardValidationException;
+import org.openide.explorer.ExplorerManager;
+import org.openide.explorer.propertysheet.PropertySheet;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.AddOn;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.SeparatorElement;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.node.AddOnChildren;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.node.AddOnNode;
+import org.openoffice.extensions.projecttemplates.addon.datamodel.node.AddOnTreeCreator;
+import org.openoffice.extensions.projecttemplates.addon.dialogs.AddDeletedCommandPanel;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.datamodel.PropertyContainer;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgPropertyException;
+
+public class AddOnPanelVisual4Toolbar extends JPanel implements
+        ExplorerManager.Provider, ActionListener {
+    
+    public static final String PROP_PROJECT_NAME = "descFirst"; // NOI18N
+    
+    private ExplorerManager manager = new ExplorerManager();
+    private PropertySheet propSheet;
+    private Lookup lookup;
+    
+    private AddOnActions actions;
+    private AddOnWizardPanel4Toolbar panel;
+    private ButtonPanel buttonPanel;
+
+//    private NbNodeObject rootAddOn;
+    private AddOnNode m_rootAddOnNode;
+    private Node m_SelectedNode;
+    
+    private String[] tags;
+    
+    /** Creates new form PanelProjectLocationVisual */
+    public AddOnPanelVisual4Toolbar(AddOnWizardPanel4Toolbar panel) {
+        buttonPanel = new ButtonPanel(this);
+        initComponents();
+        
+        this.panel = panel;
+
+        actions = new AddOnActions(manager, panel);
+        propSheet = (PropertySheet)jPanel1;
+        
+        // for keyboard actions enable this: handle actions must be done, too
+//        ActionMap map = getActionMap();
+//        map.put("delete", ExplorerUtils.actionDelete(manager, true)); // NOI18N
+//        manager.addPropertyChangeListener(this);
+//        lookup = ExplorerUtils.createLookup(manager, map);
+    }
+    
+    public Lookup getLookup() {
+        return lookup;
+    }
+    
+    /** 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.
+     */
+    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+    private void initComponents() {
+        deleteButton = new javax.swing.JButton();
+        addSeparatorButton = new javax.swing.JButton();
+        leftButton = new javax.swing.JButton();
+        rightButton = new javax.swing.JButton();
+        jSplitPane1 = new javax.swing.JSplitPane();
+        jScrollPane1 = new javax.swing.JScrollPane();
+        jScrollPane1.setViewportView(buttonPanel);
+        jPanel1 = new PropertySheet();
+        addCommandButton = new javax.swing.JButton();
+        previewComboBox = new javax.swing.JComboBox();
+        jLabel1 = new javax.swing.JLabel();
+
+        setAutoscrolls(true);
+        setRequestFocusEnabled(false);
+        org.openide.awt.Mnemonics.setLocalizedText(deleteButton, NbBundle.getMessage(AddOnPanelVisual4Toolbar.class, "LBL_BUTTON_Delete"));
+        deleteButton.setActionCommand("Delete");
+        deleteButton.setName("delete");
+        deleteButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                deleteButtonActionPerformed(evt);
+            }
+        });
+
+        org.openide.awt.Mnemonics.setLocalizedText(addSeparatorButton, NbBundle.getMessage(AddOnPanelVisual4Toolbar.class, "LBL_BUTTON_AddSeparator"));
+        addSeparatorButton.setName("addSeparator");
+        addSeparatorButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                addSeparatorButtonActionPerformed(evt);
+            }
+        });
+
+        leftButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/openoffice/extensions/projecttemplates/addon/icons/back.gif")));
+        leftButton.setName("left");
+        leftButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                leftButtonActionPerformed(evt);
+            }
+        });
+
+        rightButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/openoffice/extensions/projecttemplates/addon/icons/forward.gif")));
+        rightButton.setMaximumSize(new java.awt.Dimension(65, 28));
+        rightButton.setMinimumSize(new java.awt.Dimension(65, 28));
+        rightButton.setName("right");
+        rightButton.setPreferredSize(new java.awt.Dimension(65, 28));
+        rightButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                rightButtonActionPerformed(evt);
+            }
+        });
+
+        jSplitPane1.setBackground(new java.awt.Color(255, 255, 255));
+        jSplitPane1.setDividerLocation(60);
+        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
+        jSplitPane1.setOpaque(false);
+        jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));
+        jScrollPane1.setName("toolbar");
+        jSplitPane1.setLeftComponent(jScrollPane1);
+
+        jPanel1.setName("properties");
+        jSplitPane1.setBottomComponent(jPanel1);
+
+        org.openide.awt.Mnemonics.setLocalizedText(addCommandButton, NbBundle.getMessage(AddOnPanelVisual4Toolbar.class, "LBL_BUTTON_AddCommand"));
+        addCommandButton.setName("addCommand");
+        addCommandButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                addCommandButtonActionPerformed(evt);
+            }
+        });
+
+        previewComboBox.setModel(getPreviewModel());
+        previewComboBox.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                previewComboBoxActionPerformed(evt);
+            }
+        });
+
+        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
+        jLabel1.setLabelFor(previewComboBox);
+        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, NbBundle.getMessage(AddOnPanelVisual4Toolbar.class, "LBL_Preview"));
+
+        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+        this.setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(layout.createSequentialGroup()
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                    .add(layout.createSequentialGroup()
+                        .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 88, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(previewComboBox, 0, 380, Short.MAX_VALUE)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
+                    .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE))
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                    .add(layout.createSequentialGroup()
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                            .add(addSeparatorButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
+                            .add(deleteButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
+                            .add(addCommandButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)))
+                    .add(layout.createSequentialGroup()
+                        .add(28, 28, 28)
+                        .add(leftButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(rightButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
+                .addContainerGap())
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(layout.createSequentialGroup()
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel1)
+                    .add(previewComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+                    .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
+                        .add(addSeparatorButton)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(addCommandButton)
+                        .add(4, 4, 4)
+                        .add(deleteButton)
+                        .add(35, 35, 35)
+                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                            .add(leftButton)
+                            .add(rightButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 39, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
+                    .add(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE))
+                .addContainerGap())
+        );
+    }// </editor-fold>//GEN-END:initComponents
+
+    private void previewComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previewComboBoxActionPerformed
+
+        int index = previewComboBox.getSelectedIndex();
+        if (tags != null) {
+            String context = tags[index];
+            NbNodeObject aNode = (NbNodeObject)m_rootAddOnNode.getLookup().lookup(NbNodeObject.class);
+            AddOnNode rootNode = new AddOnNode(aNode, new AddOnChildren(context, false, true), false, true);
+            manager.setRootContext(rootNode);
+            try {
+                buttonPanel.buildNewList();
+            } catch (UnknownOpenOfficeOrgPropertyException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+            m_SelectedNode = null;
+            updateButtonAndSheet();
+        }
+
+    }//GEN-LAST:event_previewComboBoxActionPerformed
+
+    private void addCommandButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addCommandButtonActionPerformed
+
+        try {
+            if (m_SelectedNode == null) {
+                manager.setSelectedNodes(new Node[0]);
+            }
+            else {
+                manager.setSelectedNodes(new Node[]{m_SelectedNode});
+            }
+        } catch (PropertyVetoException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        AddDeletedCommandPanel.start(actions);
+        try {
+            buttonPanel.buildNewList();
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        
+    }//GEN-LAST:event_addCommandButtonActionPerformed
+
+    private void addSeparatorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSeparatorButtonActionPerformed
+
+        try {
+            if (m_SelectedNode != null) {
+                manager.setSelectedNodes(new Node[]{m_SelectedNode});
+                SeparatorElement sep = actions.addSeparatorAction();
+                if (sep != null)
+                    sep.setDisplayName(""); // NOI18N
+                buttonPanel.buildNewList();
+            }
+        } catch (PropertyVetoException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        
+    }//GEN-LAST:event_addSeparatorButtonActionPerformed
+
+    private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
+
+        try {
+            if (m_SelectedNode != null) {
+                manager.setSelectedNodes(new Node[]{m_SelectedNode});
+                actions.toggleVisibility();
+                buttonPanel.buildNewList();
+                // remove selection after delete
+                m_SelectedNode = null;
+                this.updateButtonAndSheet();
+            }
+        } catch (PropertyVetoException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        
+    }//GEN-LAST:event_deleteButtonActionPerformed
+
+    private void leftButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_leftButtonActionPerformed
+        
+        try {
+            if (m_SelectedNode != null) {
+                manager.setSelectedNodes(new Node[]{m_SelectedNode});
+                NbNodeObject object = (NbNodeObject)
+                        m_SelectedNode.getLookup().lookup(NbNodeObject.class);
+                String elementName = getElementName(object);
+                actions.moveUp();
+                buttonPanel.buildNewList();
+                enableElement(elementName);
+            }
+        } catch (PropertyVetoException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        
+    }//GEN-LAST:event_leftButtonActionPerformed
+
+    private void rightButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rightButtonActionPerformed
+
+        try {
+            if (m_SelectedNode != null) {
+                NbNodeObject object = (NbNodeObject)
+                        m_SelectedNode.getLookup().lookup(NbNodeObject.class);
+                String elementName = getElementName(object);
+                manager.setSelectedNodes(new Node[]{m_SelectedNode});
+                actions.moveDown();
+                buttonPanel.buildNewList();
+                enableElement(elementName);
+            }
+        } catch (PropertyVetoException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        
+    }//GEN-LAST:event_rightButtonActionPerformed
+        
+    
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JButton addCommandButton;
+    private javax.swing.JButton addSeparatorButton;
+    private javax.swing.JButton deleteButton;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JPanel jPanel1;
+    private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JSplitPane jSplitPane1;
+    private javax.swing.JButton leftButton;
+    private javax.swing.JComboBox previewComboBox;
+    private javax.swing.JButton rightButton;
+    // End of variables declaration//GEN-END:variables
+    
+    public void addNotify() {
+        super.addNotify();
+        try {
+            //same problem as in 31086, initial focus on Cancel button
+            manager.setSelectedNodes(manager.getRootContext().getChildren().getNodes());
+        } catch (PropertyVetoException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        } 
+    }
+    
+    boolean valid(WizardDescriptor wizardDescriptor) {
+        Node node = manager.getRootContext();
+        
+        AddOn addon = (AddOn)node.getLookup().lookup(NbNodeObject.class);
+        NbNodeObject[]commands = addon.getAllCommands();
+        if (commands.length == 0) {
+            String message = NbBundle.getMessage(AddOnWizardIterator.class, "LBL_ErrorMessageOneCommand");
+            wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+            return false;
+        }
+        wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); // NOI18N
+        return true;
+    }
+    
+    void store(WizardDescriptor d) {// method may be called several times!
+        NbNodeObject addOn = (NbNodeObject)this.m_rootAddOnNode.getLookup().lookup(NbNodeObject.class);
+        AddOn rootAddon = new AddOn();
+        rootAddon.addSetObject("Toolbar", addOn); // NOI18N
+        // only one menu as sub object
+        d.putProperty("AddOnToolbar", rootAddon); // NOI18N
+    }
+    
+    void read(WizardDescriptor settings) {
+        AddOn addOn = (AddOn)settings.getProperty("AddOn");  // NOI18N
+        AddOn restepAddOn = (AddOn)settings.getProperty("AddOnToolbar"); // NOI18N
+        if (restepAddOn == null) { // first creation
+            m_rootAddOnNode = AddOnTreeCreator.createToolbarStructure(addOn);
+        }
+        else { // restep through this panel: merge eventual changes from panel before
+            m_rootAddOnNode = AddOnTreeCreator.restoreToolbarStructure(restepAddOn, addOn);
+        }
+
+//        this.m_rootAddOnNode = AddOnTreeCreator.createToolbarStructure(addOn);
+//        rootAddOn = (NbNodeObject)rootAddOnNode.getLookup().lookup(NbNodeObject.class);
+        
+        manager.setRootContext(m_rootAddOnNode);
+        try {
+            buttonPanel.setManager(manager);
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+
+        // enable first button in list
+        Node[] nodes = manager.getRootContext().getChildren().getNodes();
+        if (nodes != null && nodes.length > 0) {
+            m_SelectedNode = nodes[0];
+            // should update the selection in the UI, but does not work
+            buttonPanel.setSelectedButton(0);
+        }
+        // UI 
+        updateButtonAndSheet();
+    }
+    
+    void validate(WizardDescriptor d) throws WizardValidationException {
+        // nothing to validate
+    }
+
+    private ComboBoxModel getPreviewModel() {
+        tags = new String[PropertyContainer.PROPERTY_CONTAINER_CONTEXTS.length + 2];
+        for (int i = 0; i < PropertyContainer.PROPERTY_CONTAINER_CONTEXTS.length; i++) {
+            tags[i + 1] = PropertyContainer.PROPERTY_CONTAINER_CONTEXTS[i];
+        }
+        tags[0] = AddOnChildren.ALL;
+        tags[tags.length - 1] = AddOnChildren.BACK_END;
+        return new DefaultComboBoxModel(tags);
+    }
+
+    public ExplorerManager getExplorerManager() {
+        return manager;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        String elementName = e.getActionCommand();
+        enableElement(elementName);
+    }
+    
+    private void enableElement(String elementName) {
+        Node[] nodes = manager.getRootContext().getChildren().getNodes();
+        m_SelectedNode = null;
+        for (int i = 0; i < nodes.length; i++) {
+            NbNodeObject object = (NbNodeObject)
+                    nodes[i].getLookup().lookup(NbNodeObject.class);
+            String name = getElementName(object);
+            if (name != null && name.equals(elementName)) {
+                m_SelectedNode = nodes[i];
+            }
+        }
+        // UI 
+        updateButtonAndSheet();
+    }
+
+    private String getElementName(NbNodeObject element) {
+        try {
+            String name = null;
+            if (element.getType() == NbNodeObject.UI_SEPARATOR_TYPE) {
+                SeparatorElement sep = (SeparatorElement)element;
+                name = sep.getName();
+            }
+            else {
+                PropertyContainer cont = (PropertyContainer)element;
+                name = cont.getSimpleProperty(cont.PROPERTY_CONTAINER_NAME);
+            }
+            return name;
+        } catch (UnknownOpenOfficeOrgPropertyException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        return null;
+    }
+    
+    /**
+     * update the sheet and enable/diasable buttons
+     */
+    private void updateButtonAndSheet() {
+        if (m_SelectedNode == null) {
+            deleteButton.setEnabled(false);
+            leftButton.setEnabled(false);
+            rightButton.setEnabled(false);
+            propSheet.setNodes(new Node[0]);
+        }
+        else {
+            deleteButton.setEnabled(true);
+            leftButton.setEnabled(true);
+            rightButton.setEnabled(true);
+            propSheet.setNodes(new Node[]{m_SelectedNode});
+        }
+        panel.fireChangeEvent(); // Notify that the panel changed
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnProject.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnProject.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnProject.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnProject.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,41 @@
+#                 Sun Public License Notice
+# 
+# The contents of this file are subject to the Sun Public License
+# Version 1.0 (the "License"). You may not use this file except in
+# compliance with the License. A copy of the License is available at
+# http://www.sun.com/
+# 
+# The Original Code is NetBeans. The Initial Developer of the Original
+# Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+# Microsystems, Inc. All Rights Reserved.
+
+# Properties file containing substitutions for file paths and content for the
+# basic UNO client application
+
+# The following special tokens are supported in values:
+#   %UserName% - substitute the user name as determined by system property
+#   %ApplicationName% - the user entered display name of the application (
+#           human readable, may contain spaces, etc.)
+#   %UnoPackagee% - the package name the user entered in the wizard
+#   %UnoPackagePath% - the package name, but with /'s instead of .'s
+
+__UnoPackage__=%UnoPackage%
+#__UnoClientMain__=%UnoClientMain%
+__ProjectName__=%ProjectName%
+__ProjectDir__=%ProjectName%
+__TimeStamp__=%TimeStamp%
+__UserName__=%UserName%
+
+__StartupOptions__=
+
+__BuildUnoVersion__=%BuildUnoVersion%
+
+__PlatformBinDir__=%PlatformBinDir%
+__RegistrationClass__=%RegistrationClass%
+__CentralRegistrationClass__=%CentralRegistrationClass%
+
+__OfficeLibrary__=%OfficeLibrary%
+__OfficePath__=%OfficePath%
+__SdkPath__=%SdkPath%
+
+

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardIterator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardIterator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardIterator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardIterator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: AddOnWizardIterator.java,v $
+ *
+ *  $Revision: 1.7 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/08/15 13:45:14 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+package org.openoffice.extensions.projecttemplates.addon;
+
+import java.awt.Component;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.MessageFormat;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.spi.project.ui.support.ProjectChooser;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.config.ConfigurationValidator;
+import org.openoffice.extensions.projecttemplates.actions.panel.DescriptionXmlHandler;
+import org.openoffice.extensions.util.ProjectCreator;
+
+public class AddOnWizardIterator implements WizardDescriptor.InstantiatingIterator {
+    
+    public static final int ALL_PANELS = 0;
+    public static final int MENU_PANEL = 2;
+    public static final int TOOLBAR_PANEL = 3;
+    
+    private int index;
+    private WizardDescriptor.Panel[] panels;
+    private WizardDescriptor.Panel[] panelCache;
+    private WizardDescriptor wiz;
+    private HashSet<ChangeListener>listeners;
+    
+    public AddOnWizardIterator() {
+        listeners = new HashSet<ChangeListener>();
+    }
+    
+    public static AddOnWizardIterator createIterator() {
+        return new AddOnWizardIterator();
+    }
+    
+    private void createPanelCache() {
+        panelCache =  new WizardDescriptor.Panel[] {
+            new AddOnWizardPanel1Project(this),
+            new AddOnWizardPanel2Description(),
+            new AddOnWizardPanel3Menubar(),
+            new AddOnWizardPanel4Toolbar(),
+        };
+        String[] steps = createSteps();
+        int stepIndex = 0;
+        for (int i = 0; i < panelCache.length; i++) {
+            Component c = panelCache[i].getComponent();
+            JComponent jc = (JComponent) c;
+            // Step #.
+            jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(stepIndex)); // NOI18N
+            if (stepIndex < panelCache.length - 2) {
+                stepIndex++;
+            }
+            // Step name (actually the whole list for reference).
+            jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N
+        }
+    }
+    
+    private void createPanels(int panelID) {
+        switch(panelID) {
+            case MENU_PANEL:
+                panels =  new WizardDescriptor.Panel[] {
+                    panelCache[0], panelCache[1], panelCache[2]
+                };
+                break;
+            case TOOLBAR_PANEL:
+                panels =  new WizardDescriptor.Panel[] {
+                    panelCache[0], panelCache[1], panelCache[3],
+                };
+                break;
+            default:
+                panels =  new WizardDescriptor.Panel[] {
+                    panelCache[0], panelCache[1], panelCache[2], panelCache[3]
+                };
+        }
+    }
+    
+    private String[] createSteps() {
+        return new String[] {
+                    NbBundle.getMessage(AddOnWizardIterator.class, "LBL_CreateProjectStep"),
+                    NbBundle.getMessage(AddOnWizardIterator.class, "LBL_UIProjectStep"),
+                    NbBundle.getMessage(AddOnWizardIterator.class, "LBL_UIProject"),
+                };
+    }
+    
+    void updatePanelSteps(int panelID) {
+        // allow editing of the panel steps only in first panel!
+        if (index == 0) {
+            createPanels(panelID);
+        }
+    }
+    
+    public Set<FileObject> instantiate() throws IOException {
+        Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
+        File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir")); // NOI18N
+        dirF.mkdirs();
+        
+        FileObject dir = FileUtil.toFileObject(dirF);
+        ProjectCreator creator = new ProjectCreator(dirF, wiz);
+        creator.createAddon();
+        // create initial description.xml
+        DescriptionXmlHandler dXml = new DescriptionXmlHandler(dir);
+        dXml.writeDescriptionXml();
+        
+        // Always open top dir as a project:
+        resultSet.add(dir);
+        // Look for nested projects to open as well:
+        Enumeration e = dir.getFolders(true);
+        while (e.hasMoreElements()) {
+            FileObject subfolder = (FileObject) e.nextElement();
+            if (ProjectManager.getDefault().isProject(subfolder)) {
+                resultSet.add(subfolder);
+            }
+        }
+        
+        File parent = dirF.getParentFile();
+        if (parent != null && parent.exists()) {
+            ProjectChooser.setProjectsFolder(parent);
+        }
+        
+        return resultSet;
+    }
+    
+    public void initialize(WizardDescriptor wiz) {
+        ConfigurationValidator.validateSettings();
+        this.wiz = wiz;
+        index = 0;
+        createPanelCache();
+        createPanels(ALL_PANELS);
+    }
+    
+    public void uninitialize(WizardDescriptor wiz) {
+        this.wiz.putProperty("projdir",null); // NOI18N
+        this.wiz.putProperty("name",null); // NOI18N
+        this.wiz = null;
+        panels = null;
+    }
+    
+    public String name() {
+        return MessageFormat.format("{0} of {1}",
+                new Object[] {new Integer(index + 1), new Integer(panels.length)}); // NOI18N
+    }
+    
+    public boolean hasNext() {
+        return index < panels.length - 1;
+    }
+    
+    public boolean hasPrevious() {
+        return index > 0;
+    }
+    
+    public void nextPanel() {
+        if (!hasNext()) {
+            throw new NoSuchElementException();
+        }
+        index++;
+    }
+    
+    public void previousPanel() {
+        if (!hasPrevious()) {
+            throw new NoSuchElementException();
+        }
+        index--;
+    }
+    
+    public WizardDescriptor.Panel current() {
+        return panels[index];
+    }
+    
+    public final void addChangeListener(ChangeListener l) {
+        listeners.add(l);
+    }
+    public final void removeChangeListener(ChangeListener l) {
+        listeners.remove(l);
+    }
+    
+    private static void unZipFile(InputStream source, FileObject projectRoot) throws IOException {
+        try {
+            ZipInputStream str = new ZipInputStream(source);
+            ZipEntry entry;
+            while ((entry = str.getNextEntry()) != null) {
+                if (entry.isDirectory()) {
+                    FileUtil.createFolder(projectRoot, entry.getName());
+                } else {
+                    FileObject fo = FileUtil.createData(projectRoot, entry.getName());
+                    FileLock lock = fo.lock();
+                    try {
+                        OutputStream out = fo.getOutputStream(lock);
+                        try {
+                            FileUtil.copy(str, out);
+                        } finally {
+                            out.close();
+                        }
+                    } finally {
+                        lock.releaseLock();
+                    }
+                }
+            }
+        } finally {
+            source.close();
+        }
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel1Project.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel1Project.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel1Project.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel1Project.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: AddOnWizardPanel1Project.java,v $
+ *
+ *  $Revision: 1.7 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/07 10:18:26 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/        
+package org.openoffice.extensions.projecttemplates.addon;
+
+import java.awt.Component;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.WizardValidationException;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+
+/**
+ * Panel just asking for basic info.
+ */
+public class AddOnWizardPanel1Project implements WizardDescriptor.Panel,
+        WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel {
+    
+    private WizardDescriptor wizardDescriptor;
+    private AddOnPanelVisual1Project component;
+    private AddOnWizardIterator addonIt;
+    
+    /** Creates a new instance of templateWizardPanel */
+    public AddOnWizardPanel1Project(AddOnWizardIterator it) {
+        addonIt = it;
+    }
+    
+    public Component getComponent() {
+        if (component == null) {
+            component = new AddOnPanelVisual1Project(this);
+            component.setName(NbBundle.getMessage(AddOnWizardPanel1Project.class, "LBL_CreateProjectStep"));
+        }
+        return component;
+    }
+  
+    public HelpCtx getHelp() {
+        return new HelpCtx("org.openoffice.extensions.working.with.addons"); // NOI18N
+    }
+
+    protected void updatePanelSteps(int panelID) {
+        addonIt.updatePanelSteps(panelID);
+    }
+    
+    public boolean isValid() {
+        getComponent();
+        return component.valid(wizardDescriptor);
+    }
+    
+    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
+    public final void addChangeListener(ChangeListener l) {
+        synchronized (listeners) {
+            listeners.add(l);
+        }
+    }
+    public final void removeChangeListener(ChangeListener l) {
+        synchronized (listeners) {
+            listeners.remove(l);
+        }
+    }
+    protected final void fireChangeEvent() {
+        Iterator it;
+        synchronized (listeners) {
+            it = new HashSet<ChangeListener>(listeners).iterator();
+        }
+        ChangeEvent ev = new ChangeEvent(this);
+        while (it.hasNext()) {
+            ((ChangeListener) it.next()).stateChanged(ev);
+        }
+    }
+    
+    public void readSettings(Object settings) {
+        wizardDescriptor = (WizardDescriptor) settings;
+        component.read(wizardDescriptor);
+    }
+    
+    public void storeSettings(Object settings) {
+        WizardDescriptor d = (WizardDescriptor) settings;
+        component.store(d);
+    }
+    
+    public boolean isFinishPanel() {
+        return false;
+    }
+    
+    public void validate() throws WizardValidationException {
+        getComponent();
+        component.validate(wizardDescriptor);
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel2Description.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel2Description.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel2Description.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel2Description.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: AddOnWizardPanel2Description.java,v $
+ *
+ *  $Revision: 1.4 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/05/03 09:53:36 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.addon;
+
+import java.awt.Component;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.WizardValidationException;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+
+/**
+ * Panel just asking for basic info.
+ */
+public class AddOnWizardPanel2Description implements WizardDescriptor.Panel,
+        WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel, AddOnActions.ActionPanel {
+    
+    private WizardDescriptor wizardDescriptor;
+    private AddOnPanelVisual2Description component;
+    
+    /** Creates a new instance of templateWizardPanel */
+    public AddOnWizardPanel2Description() {
+    }
+    
+    public Component getComponent() {
+        if (component == null) {
+            component = new AddOnPanelVisual2Description(this);
+            component.setName(NbBundle.getMessage(AddOnWizardIterator.class, "LBL_AddOnEditor"));
+        }
+        return component;
+    }
+    
+    public HelpCtx getHelp() {
+        return new HelpCtx("org.openoffice.extensions.working.with.addons"); // NOI18N
+    }
+    
+    public boolean isValid() {
+        getComponent();
+        return component.valid(wizardDescriptor);
+    }
+    
+    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
+    public final void addChangeListener(ChangeListener l) {
+        synchronized (listeners) {
+            listeners.add(l);
+        }
+    }
+    public final void removeChangeListener(ChangeListener l) {
+        synchronized (listeners) {
+            listeners.remove(l);
+        }
+    }
+    public final void fireChangeEvent() {
+        Iterator it;
+        synchronized (listeners) {
+            it = new HashSet<ChangeListener>(listeners).iterator();
+        }
+        ChangeEvent ev = new ChangeEvent(this);
+        while (it.hasNext()) {
+            ((ChangeListener) it.next()).stateChanged(ev);
+        }
+    }
+    
+    public void readSettings(Object settings) {
+        wizardDescriptor = (WizardDescriptor) settings;
+        component.read(wizardDescriptor);
+    }
+    
+    public void storeSettings(Object settings) {
+        WizardDescriptor d = (WizardDescriptor) settings;
+        component.store(d);
+    }
+    
+    public boolean isFinishPanel() {
+        return false;
+    }
+    
+    public void validate() throws WizardValidationException {
+        getComponent();
+        component.validate(wizardDescriptor);
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel3Menubar.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel3Menubar.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel3Menubar.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/addon/AddOnWizardPanel3Menubar.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: AddOnWizardPanel3Menubar.java,v $
+ *
+ *  $Revision: 1.3 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/05/03 09:53:36 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.projecttemplates.addon;
+
+import java.awt.Component;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.WizardValidationException;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+
+/**
+ * Panel just asking for basic info.
+ */
+public class AddOnWizardPanel3Menubar implements WizardDescriptor.Panel,
+        WizardDescriptor.ValidatingPanel, WizardDescriptor.FinishablePanel, AddOnActions.ActionPanel {
+    
+    private WizardDescriptor wizardDescriptor;
+    private AddOnPanelVisual3Menubar component;
+    private boolean isFinshablePanel;
+    
+    /** Creates a new instance of templateWizardPanel */
+    public AddOnWizardPanel3Menubar() {
+    }
+    
+    public Component getComponent() {
+        if (component == null) {
+            component = new AddOnPanelVisual3Menubar(this);
+            component.setName(NbBundle.getMessage(AddOnWizardIterator.class, "LBL_AddOnEditor"));
+        }
+        return component;
+    }
+    
+    public HelpCtx getHelp() {
+        return new HelpCtx("org.openoffice.extensions.working.with.addons"); // NOI18N
+    }
+    
+    public boolean isValid() {
+        getComponent();
+        return component.valid(wizardDescriptor);
+    }
+    
+    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
+    public final void addChangeListener(ChangeListener l) {
+        synchronized (listeners) {
+            listeners.add(l);
+        }
+    }
+    public final void removeChangeListener(ChangeListener l) {
+        synchronized (listeners) {
+            listeners.remove(l);
+        }
+    }
+    public final void fireChangeEvent() {
+        Iterator it;
+        synchronized (listeners) {
+            it = new HashSet<ChangeListener>(listeners).iterator();
+        }
+        ChangeEvent ev = new ChangeEvent(this);
+        while (it.hasNext()) {
+            ((ChangeListener) it.next()).stateChanged(ev);
+        }
+    }
+    
+    public void readSettings(Object settings) {
+        wizardDescriptor = (WizardDescriptor) settings;
+        Object val = wizardDescriptor.getProperty("GotToolbar"); // NOI18N
+        if (val != null)
+            isFinshablePanel = !((Boolean)val).booleanValue();
+        component.read(wizardDescriptor);
+    }
+    
+    public void storeSettings(Object settings) {
+        WizardDescriptor d = (WizardDescriptor) settings;
+        component.store(d);
+    }
+    
+    public boolean isFinishPanel() {
+        return isFinshablePanel;
+    }
+    
+    public void validate() throws WizardValidationException {
+        getComponent();
+        component.validate(wizardDescriptor);
+    }
+    
+}