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 [22/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/calcaddin/AddinPanelVisual1Project.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual1Project.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual1Project.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual1Project.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <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">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="projectNameLabel" alignment="0" min="-2" max="-2" attributes="1"/>
+ <Component id="packageLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="addinNameLabel" alignment="0" min="-2" max="-2" attributes="1"/>
+ <Component id="projectLocationLabel" alignment="0" min="-2" max="-2" attributes="1"/>
+ <Group type="103" alignment="0" groupAlignment="1" attributes="0">
+ <Component id="createdFilesLabel" alignment="1" min="-2" max="-2" attributes="0"/>
+ <Component id="createdFolderLabel" alignment="1" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="projectNameTextField" alignment="0" pref="383" max="32767" attributes="2"/>
+ <Component id="calcAddinNameTextField" alignment="0" pref="383" max="32767" attributes="2"/>
+ <Component id="createdFolderTextField" alignment="0" pref="383" max="32767" attributes="2"/>
+ <Component id="packageTextField" alignment="1" pref="383" max="32767" attributes="2"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="projectLocationTextField" pref="383" max="32767" attributes="2"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
+ <Component id="browseButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="createdFilesPane" pref="476" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="projectNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="projectNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="addinNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="calcAddinNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="packageLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="packageTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="projectLocationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="projectLocationTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="browseButton" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="createdFolderLabel" min="-2" max="-2" attributes="0"/>
+ <Component id="createdFolderTextField" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="createdFilesLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="165" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <Component id="createdFilesPane" pref="184" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="projectNameLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="projectNameTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_ProjectName" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="projectNameTextField">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="TF_ProjectName_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual1Project.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="addinNameLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="calcAddinNameTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LB_CalcAddinName" replaceFormat="NbBundle.getMessage(AddinWizardIterator.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="calcAddinNameTextField">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="TF_CalcAddinName_Tooltip" replaceFormat="NbBundle.getMessage(AddinWizardIterator.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="packageLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="packageTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LB_PackageName" replaceFormat="NbBundle.getMessage(AddinWizardIterator.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="packageTextField">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="TF_PackageName_Tooltip" replaceFormat="NbBundle.getMessage(AddinWizardIterator.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="projectLocationLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="projectLocationTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_ProjectLocation" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JTextField" name="projectLocationTextField">
+ <Properties>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="TF_ProjectLocation_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual1Project.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="browseButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_BUTTON_Browse" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="BUTTON_Browse_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual1Project.class, "{key}")"/>
+ </Property>
+ <Property name="actionCommand" type="java.lang.String" value="BROWSE"/>
+ <Property name="name" type="java.lang.String" value="browse" noResource="true"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="createdFolderLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="createdFolderTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_ProjectFolder" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="createdFolderTextField">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="TF_ProjectFolder_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual1Project.class, "{key}")"/>
+ </Property>
+ <Property name="focusable" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="createdFilesLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="createdFilesPane"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LB_CreatedFiles" replaceFormat="NbBundle.getMessage(AddinWizardIterator.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextPane" name="createdFilesPane">
+ <Properties>
+ <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="d8" green="e9" red="ec" type="rgb"/>
+ </Property>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="null"/>
+ </Property>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="opaque" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual1Project.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual1Project.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual1Project.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual1Project.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,461 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AddinPanelVisual1Project.java,v $
+ *
+ * $Revision: 1.20 $
+ *
+ * last change: $Author: sg $ $Date: 2008/10/07 10:18:51 $
+ *
+ * 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.calcaddin;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.filechooser.FileSystemView;
+import javax.swing.text.Document;
+import org.netbeans.spi.project.ui.support.ProjectChooser;
+import org.openide.WizardDescriptor;
+import org.openide.WizardValidationException;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.config.ConfigurationSettings;
+
+public class AddinPanelVisual1Project extends JPanel implements DocumentListener {
+
+ public static final String PROP_PROJECT_NAME = "AddIn"; // NOI18N
+
+ private boolean addinNameModified = false;
+ private AddinWizardPanel1Project panel;
+
+ private String[] generatedFiles = new String[]{ "", "", "",
+ "src/uno-extension-manifest.xml\n",
+ "registry/data/org/openoffice/Office/CalcAddins.xcu\n" }; // NOI18N
+
+ /** Creates new form PanelProjectLocationVisual */
+ public AddinPanelVisual1Project(AddinWizardPanel1Project panel) {
+ initComponents();
+ this.panel = panel;
+ // Register listener on the textFields to make the automatic updates
+ projectNameTextField.getDocument().addDocumentListener(this);
+ projectLocationTextField.getDocument().addDocumentListener(this);
+ // Register listener on the textFields to make the automatic updates
+ calcAddinNameTextField.getDocument().addDocumentListener(this);
+ packageTextField.getDocument().addDocumentListener(this);
+ }
+
+ /** 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() {
+
+ projectNameLabel = new javax.swing.JLabel();
+ projectNameTextField = new javax.swing.JTextField();
+ addinNameLabel = new javax.swing.JLabel();
+ calcAddinNameTextField = new javax.swing.JTextField();
+ packageLabel = new javax.swing.JLabel();
+ packageTextField = new javax.swing.JTextField();
+ projectLocationLabel = new javax.swing.JLabel();
+ projectLocationTextField = new javax.swing.JTextField();
+ browseButton = new javax.swing.JButton();
+ createdFolderLabel = new javax.swing.JLabel();
+ createdFolderTextField = new javax.swing.JTextField();
+ createdFilesLabel = new javax.swing.JLabel();
+ createdFilesPane = new javax.swing.JTextPane();
+
+ projectNameLabel.setLabelFor(projectNameTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, NbBundle.getMessage(AddinPanelVisual1Project.class, "LBL_ProjectName")); // NOI18N
+
+ projectNameTextField.setToolTipText(NbBundle.getMessage(AddinPanelVisual1Project.class, "TF_ProjectName_Tooltip")); // NOI18N
+
+ addinNameLabel.setLabelFor(calcAddinNameTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(addinNameLabel, NbBundle.getMessage(AddinWizardIterator.class, "LB_CalcAddinName")); // NOI18N
+
+ calcAddinNameTextField.setToolTipText(NbBundle.getMessage(AddinWizardIterator.class, "TF_CalcAddinName_Tooltip")); // NOI18N
+
+ packageLabel.setLabelFor(packageTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(packageLabel, NbBundle.getMessage(AddinWizardIterator.class, "LB_PackageName")); // NOI18N
+
+ packageTextField.setToolTipText(NbBundle.getMessage(AddinWizardIterator.class, "TF_PackageName_Tooltip")); // NOI18N
+
+ projectLocationLabel.setLabelFor(projectLocationTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, NbBundle.getMessage(AddinPanelVisual1Project.class, "LBL_ProjectLocation")); // NOI18N
+
+ projectLocationTextField.setToolTipText(NbBundle.getMessage(AddinPanelVisual1Project.class, "TF_ProjectLocation_Tooltip")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(browseButton, NbBundle.getMessage(AddinPanelVisual1Project.class, "LBL_BUTTON_Browse")); // NOI18N
+ browseButton.setToolTipText(NbBundle.getMessage(AddinPanelVisual1Project.class, "BUTTON_Browse_Tooltip")); // NOI18N
+ browseButton.setActionCommand("BROWSE");
+ browseButton.setName("browse"); // NOI18N
+ browseButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ browseButtonActionPerformed(evt);
+ }
+ });
+
+ createdFolderLabel.setLabelFor(createdFolderTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(createdFolderLabel, NbBundle.getMessage(AddinPanelVisual1Project.class, "LBL_ProjectFolder")); // NOI18N
+
+ createdFolderTextField.setEditable(false);
+ createdFolderTextField.setToolTipText(NbBundle.getMessage(AddinPanelVisual1Project.class, "TF_ProjectFolder_Tooltip")); // NOI18N
+ createdFolderTextField.setFocusable(false);
+
+ createdFilesLabel.setLabelFor(createdFilesPane);
+ org.openide.awt.Mnemonics.setLocalizedText(createdFilesLabel, NbBundle.getMessage(AddinWizardIterator.class, "LB_CreatedFiles")); // NOI18N
+
+ createdFilesPane.setBackground(new java.awt.Color(236, 233, 216));
+ createdFilesPane.setBorder(null);
+ createdFilesPane.setEditable(false);
+ createdFilesPane.setOpaque(false);
+
+ 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()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(projectNameLabel)
+ .add(packageLabel)
+ .add(addinNameLabel)
+ .add(projectLocationLabel)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(createdFilesLabel)
+ .add(createdFolderLabel)))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(projectNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE)
+ .add(calcAddinNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE)
+ .add(createdFolderTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, packageTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE)
+ .add(layout.createSequentialGroup()
+ .add(projectLocationTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
+ .add(6, 6, 6)
+ .add(browseButton))
+ .add(createdFilesPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(projectNameLabel)
+ .add(projectNameTextField, 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.BASELINE)
+ .add(addinNameLabel)
+ .add(calcAddinNameTextField, 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.BASELINE)
+ .add(packageLabel)
+ .add(packageTextField, 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.BASELINE)
+ .add(projectLocationLabel)
+ .add(projectLocationTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(browseButton))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(createdFolderLabel)
+ .add(createdFolderTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(18, 18, 18)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(createdFilesLabel)
+ .add(165, 165, 165))
+ .add(layout.createSequentialGroup()
+ .add(createdFilesPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)
+ .addContainerGap())))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
+ JFileChooser chooser = new JFileChooser(FileSystemView.getFileSystemView());
+ FileUtil.preventFileChooserSymlinkTraversal(chooser, ConfigurationSettings.getDefaultFileChooserStartingDir());
+ chooser.setDialogTitle(NbBundle.getMessage(AddinWizardIterator.class, "LB_FileChooserTitle"));
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ String path = this.projectLocationTextField.getText();
+ if (path.length() > 0) {
+ File f = new File(path);
+ if (f.exists()) {
+ chooser.setSelectedFile(f);
+ }
+ }
+ if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
+ File projectDir = chooser.getSelectedFile();
+ ConfigurationSettings.storeDefaultFileChooserStartingDir(projectDir);
+ projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
+ }
+ panel.fireChangeEvent();
+
+ }//GEN-LAST:event_browseButtonActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel addinNameLabel;
+ private javax.swing.JButton browseButton;
+ private javax.swing.JTextField calcAddinNameTextField;
+ private javax.swing.JLabel createdFilesLabel;
+ private javax.swing.JTextPane createdFilesPane;
+ private javax.swing.JLabel createdFolderLabel;
+ private javax.swing.JTextField createdFolderTextField;
+ private javax.swing.JLabel packageLabel;
+ private javax.swing.JTextField packageTextField;
+ private javax.swing.JLabel projectLocationLabel;
+ private javax.swing.JTextField projectLocationTextField;
+ private javax.swing.JLabel projectNameLabel;
+ private javax.swing.JTextField projectNameTextField;
+ // End of variables declaration//GEN-END:variables
+
+ public void addNotify() {
+ super.addNotify();
+ //same problem as in 31086, initial focus on Cancel button
+ projectNameTextField.requestFocus();
+ }
+
+ boolean valid(WizardDescriptor wizardDescriptor) {
+
+ if (projectNameTextField.getText().length() == 0) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_ProjectName");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false; // Display name not specified
+ }
+ File f = FileUtil.normalizeFile(new File(projectLocationTextField.getText()).getAbsoluteFile());
+ if (!f.isDirectory()) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_ProjectFolderPath");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+ final File destFolder = FileUtil.normalizeFile(new File(createdFolderTextField.getText()).getAbsoluteFile());
+
+ File projLoc = destFolder;
+ while (projLoc != null && !projLoc.exists()) {
+ projLoc = projLoc.getParentFile();
+ }
+ if (projLoc == null || !projLoc.canWrite()) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_CreateProjectFolder");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+
+ if (FileUtil.toFileObject(projLoc) == null) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_ProjectFolderPath");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+
+ File[] kids = destFolder.listFiles();
+ if (destFolder.exists() && kids != null && kids.length > 0) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_ProjectFolderNotEmpty");
+ // Folder exists and is not empty
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+
+ String mainClass = calcAddinNameTextField.getText().trim();
+ if (mainClass.length() == 0 || !mainClass.matches("[a-zA-Z_][a-zA-Z._$0-9]*")) { // NOI18N
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_AddInClassName");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false; // Display name not specified
+ }
+ String packageName = packageTextField.getText().trim();
+ if (packageName.length() == 0 || !packageName.matches("[a-zA-Z_]((\\.[a-zA-Z_0-9]++)|[a-zA-Z_0-9])*")) { // NOI18N
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_PackageName");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false; // Display name not specified
+ }
+
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); // NOI18N
+ return true;
+ }
+
+ void store(WizardDescriptor d) {
+ String name = projectNameTextField.getText().trim();
+ String folder = createdFolderTextField.getText().trim();
+ try {
+ d.putProperty("projdir", new File(folder)); // NOI18N
+ d.putProperty("name", name); // NOI18N
+ d.putProperty("ProjectDir", new File(folder).getCanonicalPath()); // NOI18N
+ d.putProperty("ProjectName", name); // NOI18N
+ d.putProperty("ProjectDisplayName", name); // NOI18N
+ } catch (IOException e) {
+ // TODO
+ }
+
+ String mainClass = calcAddinNameTextField.getText().trim();
+ String packageName = packageTextField.getText().trim();
+ d.putProperty("mainClassName", mainClass); // NOI18N
+ d.putProperty("displayName", mainClass); // NOI18N
+ d.putProperty("packageName", packageName); // NOI18N
+ d.putProperty("RegistrationClass", packageName + "." + mainClass + "Impl"); // NOI18N
+ d.putProperty("UnoPackage", packageName); // NOI18N
+ }
+
+ private void updateCreatedFiles() {
+ createdFilesPane.setText(generatedFiles[0] + generatedFiles[1] +
+ generatedFiles[2] + generatedFiles[3] +
+ generatedFiles[4]); // NOI18N
+ }
+
+ void read(WizardDescriptor settings) {
+ File projectLocation = (File) settings.getProperty("projdir"); // NOI18N
+ if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
+ projectLocation = ProjectChooser.getProjectsFolder();
+ } else {
+ projectLocation = projectLocation.getParentFile();
+ }
+ this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
+
+
+ String projectName = (String) settings.getProperty("name"); // NOI18N
+ if(projectName == null) {
+ projectName = "AddIn"; // NOI18N
+ String[] fileList = projectLocation.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ if (name.startsWith("AddIn")) return true; // NOI18N
+ return false;
+ }
+ });
+ boolean searchProjectName = true;
+ int length = projectName.length();
+ for (int i=0; searchProjectName && i<fileList.length + 1; i++) {
+ switch (i) {
+ case 0: // keep project name
+ break;
+ case 1: // append 1
+ projectName = new StringBuffer(projectName).append(1).toString();
+ break;
+ default: // remove number and append the next one
+ projectName = new StringBuffer(projectName.substring(0, length)).append(i).toString();
+ }
+ // test if the name is already used
+ searchProjectName = false;
+ for (int j=0; !searchProjectName && j<fileList.length; j++) {
+ // if the project name isn't found, searchProjectName stays false and the name is kept
+ searchProjectName |= fileList[j].equals(projectName);
+ }
+ }
+ }
+ this.projectNameTextField.setText(projectName);
+ this.projectNameTextField.selectAll();
+
+ String mainclass = (String)settings.getProperty("mainClassName"); // NOI18N
+ if (mainclass == null)
+ mainclass = projectName;
+ calcAddinNameTextField.setText(projectName);
+
+ String packagename = (String)settings.getProperty("packageName"); // NOI18N
+ if (packagename == null)
+ packagename = NbBundle.getMessage(ConfigurationSettings.class, "default.package"); // NOI18N
+ packageTextField.setText(packagename);
+
+ updateCreatedFiles();
+ }
+
+ void validate(WizardDescriptor d) throws WizardValidationException {
+ // nothing to validate
+ }
+
+ // Implementation of DocumentListener --------------------------------------
+
+ public void changedUpdate(DocumentEvent e) {
+ updateTexts(e);
+ if (this.projectNameTextField.getDocument() == e.getDocument()) {
+ firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
+ }
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ updateTexts(e);
+ if (this.projectNameTextField.getDocument() == e.getDocument()) {
+ firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
+ }
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ updateTexts(e);
+ if (this.projectNameTextField.getDocument() == e.getDocument()) {
+ firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
+ }
+ }
+
+ /** Handles changes in the Project name and project directory, */
+ private void updateTexts(DocumentEvent e) {
+
+ Document doc = e.getDocument();
+
+ if (doc == calcAddinNameTextField.getDocument() && calcAddinNameTextField.getText().length()>0) {
+ if (!projectNameTextField.getText().equals(calcAddinNameTextField.getText()))
+ addinNameModified = true;
+ }
+
+ if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument() ||
+ doc == packageTextField.getDocument()) {
+// doc == calcAddinNameTextField.getDocument() || doc == packageTextField.getDocument()) {
+ // Change in the project name
+
+ String projectName = projectNameTextField.getText();
+ String projectFolder = projectLocationTextField.getText();
+
+ if (!addinNameModified)
+ calcAddinNameTextField.setText(projectName);
+
+ //if (projectFolder.trim().length() == 0 || projectFolder.equals(oldName)) {
+ createdFolderTextField.setText(projectFolder.concat(File.separator).concat(projectName));
+ //}
+
+ String packagePath = "src/" + packageTextField.getText().replace('.', '/') + '/'; // NOI18N
+ generatedFiles[0] = packagePath + calcAddinNameTextField.getText() + "Impl.java\n"; // NOI18N
+ generatedFiles[1] = packagePath + calcAddinNameTextField.getText() + ".idl\n"; // NOI18N
+ generatedFiles[2] = packagePath + "X" + calcAddinNameTextField.getText() + ".idl\n"; // NOI18N
+
+ updateCreatedFiles();
+ }
+ if (doc == calcAddinNameTextField.getDocument()) {
+ String packagePath = "src/" + packageTextField.getText().replace('.', '/') + '/'; // NOI18N
+ generatedFiles[0] = packagePath + calcAddinNameTextField.getText() + "Impl.java\n"; // NOI18N
+ generatedFiles[1] = packagePath + calcAddinNameTextField.getText() + ".idl\n"; // NOI18N
+ generatedFiles[2] = packagePath + "X" + calcAddinNameTextField.getText() + ".idl\n"; // NOI18N
+ updateCreatedFiles();
+ }
+ panel.fireChangeEvent(); // Notify that the panel changed
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="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_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <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" alignment="1" attributes="0">
+ <Component id="jSplitPane1" pref="403" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="addLanguageButton" max="32767" attributes="1"/>
+ <Component id="deleteButton" max="32767" attributes="1"/>
+ <Component id="addParameterButton" max="32767" attributes="1"/>
+ <Component id="deleteLanguageButton" max="32767" attributes="1"/>
+ <Component id="addFunctionButton" alignment="0" pref="113" max="32767" attributes="1"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="addFunctionButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="addParameterButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="deleteButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace pref="315" max="32767" attributes="0"/>
+ <Component id="addLanguageButton" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="deleteLanguageButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="jSplitPane1" alignment="1" pref="463" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JSplitPane" name="jSplitPane1">
+ <Properties>
+ <Property name="dividerLocation" type="int" value="200"/>
+ <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="ff" green="ff" id="white" palette="1" red="ff" type="palette"/>
+ </Property>
+ </Properties>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[5, 10]"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="properties"/>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[5, 10]"/>
+ </Property>
+ </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="right"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
+ <EtchetBorder/>
+ </Border>
+ </Property>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[5, 10]"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="functionList"/>
+ <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[5, 10]"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
+ </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>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="addFunctionButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_BUTTON_AddFunction" replaceFormat="org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_AddFunction")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="BUTTON_AddFunction_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual2Description.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="addFunction"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addFunctionButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="deleteLanguageButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_BUTTON_DeleteLanguage" replaceFormat="org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_DeleteLanguage")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="BUTTON_DeleteLang_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual2Description.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteLanguageButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="addParameterButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_BUTTON_AddParameter" replaceFormat="org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_AddParameter")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="BUTTON_AddParam_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual2Description.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="addParamater"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addParameterButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <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/calcaddin/Bundle.properties" key="LBL_BUTTON_Delete" replaceFormat="org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_Delete")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="BUTTON_Delete_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual2Description.class, "{key}")"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="delete"/>
+ </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="addLanguageButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="LBL_BUTTON_AddLanguage" replaceFormat="org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_AddLanguage")"/>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/projecttemplates/calcaddin/Bundle.properties" key="BUTTON_AddLang_Tooltip" replaceFormat="NbBundle.getMessage(AddinPanelVisual2Description.class, "{key}")"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addLanguageButtonActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinPanelVisual2Description.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,452 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AddinPanelVisual2Description.java,v $
+ *
+ * $Revision: 1.14 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/03 13:27:31 $
+ *
+ * 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.calcaddin;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import java.util.Vector;
+import javax.swing.ActionMap;
+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.BeanTreeView;
+import org.openide.nodes.Node;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.util.datamodel.Function;
+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.datamodel.properties.OpenOfficeOrgProperty;
+import org.openoffice.extensions.util.datamodel.Parameter;
+import org.openoffice.extensions.util.datamodel.properties.UnknownOpenOfficeOrgLanguageIDException;
+import org.openoffice.extensions.projecttemplates.calcaddin.datamodel.node.AddInNode;
+import org.openoffice.extensions.projecttemplates.calcaddin.datamodel.node.AddInTreeCreator;
+import org.openoffice.extensions.util.LogWriter;
+
+public class AddinPanelVisual2Description 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 AddinActions actions;
+ private AddinWizardPanel2Description panel;
+
+ /** Creates new form PanelProjectLocationVisual */
+ public AddinPanelVisual2Description(AddinWizardPanel2Description panel) {
+ initComponents();
+
+ this.panel = panel;
+
+ manager.setRootContext(AddInTreeCreator.createInitialFunctionTree());
+
+ BeanTreeView view = (BeanTreeView)jScrollPane1;
+ 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;
+ // this does not seem to work; commented -> later version of NB?
+// propSheet.addPropertyChangeListener(this);
+
+ actions = new AddinActions(manager, panel);
+ // deliver the actual actions to the node-actions
+ AddInNode rootNode = (AddInNode)manager.getRootContext();
+ rootNode.setActions(actions);
+
+ 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 BeanTreeView();
+ addFunctionButton = new javax.swing.JButton();
+ deleteLanguageButton = new javax.swing.JButton();
+ addParameterButton = new javax.swing.JButton();
+ deleteButton = new javax.swing.JButton();
+ addLanguageButton = new javax.swing.JButton();
+
+ 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.setMinimumSize(new java.awt.Dimension(5, 10));
+ jScrollPane1.setName("functionList");
+ jScrollPane1.setPreferredSize(new java.awt.Dimension(5, 10));
+ jSplitPane1.setLeftComponent(jScrollPane1);
+
+ org.openide.awt.Mnemonics.setLocalizedText(addFunctionButton, org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_AddFunction"));
+ addFunctionButton.setToolTipText(NbBundle.getMessage(AddinPanelVisual2Description.class, "BUTTON_AddFunction_Tooltip"));
+ addFunctionButton.setName("addFunction");
+ addFunctionButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ addFunctionButtonActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(deleteLanguageButton, org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_DeleteLanguage"));
+ deleteLanguageButton.setToolTipText(NbBundle.getMessage(AddinPanelVisual2Description.class, "BUTTON_DeleteLang_Tooltip"));
+ deleteLanguageButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ deleteLanguageButtonActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(addParameterButton, org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_AddParameter"));
+ addParameterButton.setToolTipText(NbBundle.getMessage(AddinPanelVisual2Description.class, "BUTTON_AddParam_Tooltip"));
+ addParameterButton.setName("addParamater");
+ addParameterButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ addParameterButtonActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(deleteButton, org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_Delete"));
+ deleteButton.setToolTipText(NbBundle.getMessage(AddinPanelVisual2Description.class, "BUTTON_Delete_Tooltip"));
+ 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(addLanguageButton, org.openide.util.NbBundle.getMessage(AddinWizardIterator.class, "LBL_BUTTON_AddLanguage"));
+ addLanguageButton.setToolTipText(NbBundle.getMessage(AddinPanelVisual2Description.class, "BUTTON_AddLang_Tooltip"));
+ addLanguageButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ addLanguageButtonActionPerformed(evt);
+ }
+ });
+
+ 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(jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
+ .add(addLanguageButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(deleteButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(addParameterButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(deleteLanguageButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(addFunctionButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 113, Short.MAX_VALUE)))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(addFunctionButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(addParameterButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(deleteButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 305, Short.MAX_VALUE)
+ .add(addLanguageButton)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(deleteLanguageButton))
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jSplitPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void deleteLanguageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteLanguageButtonActionPerformed
+
+ actions.deleteLanguageAction();
+
+ }//GEN-LAST:event_deleteLanguageButtonActionPerformed
+
+ private void addLanguageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addLanguageButtonActionPerformed
+
+ actions.addLanguageAction();
+
+ }//GEN-LAST:event_addLanguageButtonActionPerformed
+
+ private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
+
+ actions.deleteAction();
+
+ }//GEN-LAST:event_deleteButtonActionPerformed
+
+ private void addParameterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addParameterButtonActionPerformed
+
+ actions.addParameterAction();
+
+ }//GEN-LAST:event_addParameterButtonActionPerformed
+
+ private void addFunctionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addFunctionButtonActionPerformed
+
+ actions.addFunctionAction();
+
+ }//GEN-LAST:event_addFunctionButtonActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton addFunctionButton;
+ private javax.swing.JButton addLanguageButton;
+ private javax.swing.JButton addParameterButton;
+ private javax.swing.JButton deleteButton;
+ private javax.swing.JButton deleteLanguageButton;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JSplitPane jSplitPane1;
+ // 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();
+ // first subnodes are functions
+ NbNodeObject addIn = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ NbNodeObject[] subNodes = addIn.getAllSubObjects();
+ if (subNodes.length == 0) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_FunctionMissing");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+ Vector<String> functions = new Vector<String>();
+ for (int i=0; i<subNodes.length; i++) {
+ Function function = (Function)subNodes[i];
+ try {
+ String funcName = function.getProperty(function.PROPERTY_Name).getValueForLanguage(-1);
+ if (functions.contains(funcName)) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_FunctionUniqueName");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+ else {
+ functions.add(funcName);
+ }
+ } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+
+ // check for multilingual entries
+ LocalizedOpenOfficeOrgProperty prop = (LocalizedOpenOfficeOrgProperty)function.getProperty(function.PROPERTY_DisplayName);
+ Integer[] indexes = prop.getUsedLanguageIndexes();
+ if (indexes == null || indexes.length == 0) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_LanguageMissing");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+
+ String[] paramNames = function.getAllSetObjectNames();
+ Vector<String> parameters = new Vector<String>();
+ for (int j=0; j<paramNames.length; j++) {
+ Parameter param = (Parameter)function.getSetObject(paramNames[j]);
+ try {
+ String paramName = param.getProperty(param.PROPERTY_Name).getValueForLanguage(-1);
+ if (parameters.contains(paramName)) {
+ String message = NbBundle.getMessage(AddinWizardIterator.class, "LB_Error_ParameterUniqueName");
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", message); // NOI18N
+ return false;
+ }
+ else {
+ parameters.add(paramName);
+ }
+ } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ }
+ }
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); // NOI18N
+ return true;
+ }
+
+ void store(WizardDescriptor d) {
+ Node node = manager.getRootContext();
+ // first subnodes are functions
+ NbNodeObject addIn = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ d.putProperty("ServiceObject", addIn); // NOI18N
+ NbNodeObject[] subNodes = addIn.getAllSubObjects();
+ d.putProperty("functionCount", new Integer(subNodes.length)); // NOI18N
+ for (int i=0; i<subNodes.length; i++) {
+ Vector<String> functionSignatureContainer = new Vector<String>();
+ Function function = (Function)subNodes[i];
+ try {
+ String retValue = function.getProperty(function.PROPERTY_Type).getValueForLanguage(-1);
+ functionSignatureContainer.add(retValue);
+ String funcName = function.getProperty(function.PROPERTY_Name).getValueForLanguage(-1);
+ functionSignatureContainer.add(funcName);
+
+ // function specific stuff
+ String category = function.getProperty(function.PROPERTY_Category).getValueForLanguage(-1);
+ d.putProperty(funcName.concat("Category"), category); // NOI18N
+
+ // multilingual stuff
+ LocalizedOpenOfficeOrgProperty prop = (LocalizedOpenOfficeOrgProperty)function.getProperty(function.PROPERTY_DisplayName);
+ String[][]localProps = getLocalizedProperties(prop, funcName);
+ d.putProperty(funcName.concat("DisplayName"), localProps); // NOI18N
+
+ prop = (LocalizedOpenOfficeOrgProperty)function.getProperty(function.PROPERTY_Description);
+ localProps = getLocalizedProperties(prop, null);
+ d.putProperty(funcName.concat("Description"), localProps); // NOI18N
+
+// prop = (LocalizedOpenOfficeOrgProperty)function.getProperty(function.PROPERTY_CategoryDisplayName);
+// localProps = getLocalizedProperties(prop);
+// d.putProperty(funcName.concat("CategoryDisplayName"), localProps); // NOI18N
+
+ prop = (LocalizedOpenOfficeOrgProperty)function.getProperty(function.PROPERTY_CompatibilityName);
+ localProps = getLocalizedProperties(prop, null);
+ d.putProperty(funcName.concat("CompatibilityName"), localProps); // NOI18N
+
+ // function parameters
+ String[] paramNames = function.getAllSetObjectNames();
+ for (int j=0;j<paramNames.length; j++) {
+ Parameter parameter = (Parameter)function.getSetObject(paramNames[j]);
+ String type = parameter.getProperty(parameter.PROPERTY_Type).getValueForLanguage(-1);
+ functionSignatureContainer.add(type);
+ String name = parameter.getProperty(parameter.PROPERTY_Name).getValueForLanguage(-1);
+ functionSignatureContainer.add(name);
+
+ // multilingual stuff
+ prop = (LocalizedOpenOfficeOrgProperty)parameter.getProperty(parameter.PROPERTY_DisplayName);
+ localProps = getLocalizedProperties(prop, name);
+ d.putProperty(funcName.concat(name.concat("DisplayName")), localProps); // NOI18N
+
+ prop = (LocalizedOpenOfficeOrgProperty)parameter.getProperty(parameter.PROPERTY_Description);
+ localProps = getLocalizedProperties(prop, null);
+ d.putProperty(funcName.concat(name.concat("Description")), localProps); // NOI18N
+
+ }
+ } catch (UnknownOpenOfficeOrgLanguageIDException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ String[] functionArray = (String[])functionSignatureContainer.toArray(new String[functionSignatureContainer.size()]);
+ d.putProperty(new StringBuffer("function").append(i).toString(), functionArray); // 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) {
+/* File projectLocation = (File) settings.getProperty("projdir"); // NOI18N
+ if (projectLocation == null || projectLocation.getParentFile() == null || !projectLocation.getParentFile().isDirectory()) {
+ projectLocation = ProjectChooser.getProjectsFolder();
+ } else {
+ projectLocation = projectLocation.getParentFile();
+ }
+ this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
+
+ String projectName = (String) settings.getProperty("name"); // NOI18N
+ if(projectName == null) {
+ projectName = "AddIn"; // NOI18N
+ }
+ this.projectNameTextField.setText(projectName);
+ this.projectNameTextField.selectAll(); */
+ }
+
+ 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();
+ if (selectedNodes.length > 0) {
+ NbNodeObject nodeObject = (NbNodeObject)selectedNodes[0].getLookup().lookup(NbNodeObject.class);
+ if (nodeObject instanceof OpenOfficeOrgProperty) {
+ addParameterButton.setEnabled(false);
+ deleteButton.setEnabled(false);
+ }
+ else {
+ addParameterButton.setEnabled(true);
+ deleteButton.setEnabled(true);
+ }
+ }
+ propSheet.setNodes(selectedNodes);
+ panel.fireChangeEvent(); // Notify that the panel changed
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinProject.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinProject.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinProject.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinProject.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__=-calc
+
+__BuildUnoVersion__=%BuildUnoVersion%
+
+__PlatformBinDir__=%PlatformBinDir%
+__RegistrationClass__=%RegistrationClass%
+__CentralRegistrationClass__=%CentralRegistrationClass%
+
+__OfficeLibrary__=%OfficeLibrary%
+__OfficePath__=%OfficePath%
+__SdkPath__=%SdkPath%
+
+
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinWizardIterator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinWizardIterator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinWizardIterator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/projecttemplates/calcaddin/AddinWizardIterator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AddinWizardIterator.java,v $
+ *
+ * $Revision: 1.9 $
+ *
+ * last change: $Author: sg $ $Date: 2008/04/28 11:13: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.calcaddin;
+
+import java.awt.Component;
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.NoSuchElementException;
+import java.util.Set;
+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.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 AddinWizardIterator implements WizardDescriptor.InstantiatingIterator {
+
+ private static final long serialVersionUID = 1L;
+
+ private transient int index;
+ private transient WizardDescriptor.Panel[] panels;
+ private transient WizardDescriptor wiz;
+
+ public AddinWizardIterator() {}
+
+ public static AddinWizardIterator createIterator() {
+ return new AddinWizardIterator();
+ }
+
+ private WizardDescriptor.Panel[] createPanels() {
+ return new WizardDescriptor.Panel[] {
+ new AddinWizardPanel1Project(),
+// new AddinWizardPanel2Class(),
+ new AddinWizardPanel2Description()
+ //new AddinWizardPanel4Description(),
+ };
+ }
+
+ private String[] createSteps() {
+ return new String[] {
+ NbBundle.getMessage(AddinWizardIterator.class, "LBL_CreateProjectStep"),
+// NbBundle.getMessage(AddinWizardIterator.class, "LBL_CreateClassStep"),
+ NbBundle.getMessage(AddinWizardIterator.class, "LBL_CalcAddinEditor")
+ };
+ }
+
+ 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.createCalcAddIn();
+ // 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;
+ panels = createPanels();
+ // Make sure list of steps is accurate.
+ String[] steps = createSteps();
+ for (int i = 0; i < panels.length; i++) {
+ Component c = panels[i].getComponent();
+ if (steps[i] == null) {
+ // Default step name to component name of panel.
+ // Mainly useful for getting the name of the target
+ // chooser to appear in the list of steps.
+ steps[i] = c.getName();
+ }
+ if (c instanceof JComponent) { // assume Swing components
+ JComponent jc = (JComponent) c;
+ // Step #.
+ jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); // NOI18N
+ // Step name (actually the whole list for reference).
+ jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N
+ }
+ }
+ }
+
+ 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];
+ }
+
+ // If nothing unusual changes in the middle of the wizard, simply:
+ public final void addChangeListener(ChangeListener l) {}
+ public final void removeChangeListener(ChangeListener l) {}
+
+}