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 [11/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/filetypes/registry_ui/XcuWizardIterator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/XcuWizardIterator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/XcuWizardIterator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/registry_ui/XcuWizardIterator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XcuWizardIterator.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sg $ $Date: 2008/10/07 08:55: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.filetypes.registry_ui;
+
+import java.awt.Component;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeListener;
+import org.netbeans.spi.project.ui.templates.support.Templates;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+public final class XcuWizardIterator implements WizardDescriptor.InstantiatingIterator {
+
+ private int index;
+ private WizardDescriptor wizard;
+ private WizardDescriptor.Panel[] panels;
+
+ /**
+ * Initialize panels representing individual wizard's steps and sets
+ * various properties for them influencing wizard appearance.
+ */
+ private WizardDescriptor.Panel[] getPanels() {
+ if (panels == null) {
+ panels = new WizardDescriptor.Panel[]{
+ new RegistryWizardPanel1(RegistryWizardPanel1.XCU_FILE_TYPE)
+ };
+ 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;
+ // Sets step number of a component
+ jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
+ // Sets steps names for a panel
+ jc.putClientProperty("WizardPanel_contentData", steps);
+ // Turn on subtitle creation on each step
+ jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
+ // Show steps on the left side with the image on the background
+ jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
+ // Turn on numbering of all steps
+ jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
+ }
+ }
+ }
+ return panels;
+ }
+
+ public Set instantiate() throws IOException {
+ Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
+ String fileName = (String)wizard.getProperty("FileName"); // NOI18N
+ String folder = (String)wizard.getProperty("Folder"); // NOI18N
+ if (folder.length() > 0) {
+ File parent = new File(folder);
+ if (!parent.exists()) {
+ parent.mkdirs();
+ }
+ FileObject parentObject = FileUtil.toFileObject(parent);
+ if (parentObject != null) {
+ FileObject file = parentObject.createData(fileName);
+ FileObject template = Templates.getTemplate(wizard);
+ if (RegistryWizardPanel1.unZipFile(file, template)) {
+ resultSet.add(file);
+ }
+ return resultSet; //Collections.EMPTY_SET;
+ }
+ }
+ return Collections.EMPTY_SET;
+ }
+
+ public void initialize(WizardDescriptor wizard) {
+ this.wizard = wizard;
+ }
+
+ public void uninitialize(WizardDescriptor wizard) {
+ panels = null;
+ }
+
+ public WizardDescriptor.Panel current() {
+ return getPanels()[index];
+ }
+
+ public String name() {
+ return index + 1 + ". from " + getPanels().length;
+ }
+
+ public boolean hasNext() {
+ return index < getPanels().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--;
+ }
+
+ // If nothing unusual changes in the middle of the wizard, simply:
+ public void addChangeListener(ChangeListener l) {
+ }
+
+ public void removeChangeListener(ChangeListener l) {
+ }
+
+ // If something changes dynamically (besides moving between panels), e.g.
+ // the number of panels changes in response to user input, then uncomment
+ // the following and call when needed: fireChangeEvent();
+ /*
+ private Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
+ 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<ChangeListener> it;
+ synchronized (listeners) {
+ it = new HashSet<ChangeListener>(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+ */ // You could safely ignore this method. Is is here to keep steps which were
+ // there before this wizard was instantiated. It should be better handled
+ // by NetBeans Wizard API itself rather than needed to be implemented by a
+ // client code.
+ private String[] createSteps() {
+ String[] beforeSteps = null;
+ Object prop = wizard.getProperty("WizardPanel_contentData");
+ if (prop != null && prop instanceof String[]) {
+ beforeSteps = (String[]) prop;
+ }
+
+ if (beforeSteps == null) {
+ beforeSteps = new String[0];
+ }
+
+ String[] res = new String[(beforeSteps.length - 1) + panels.length];
+ for (int i = 0; i < res.length; i++) {
+ if (i < (beforeSteps.length - 1)) {
+ res[i] = beforeSteps[i];
+ } else {
+ res[i] = panels[i - beforeSteps.length + 1].getComponent().getName();
+ }
+ }
+ return res;
+ }
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,20 @@
+CTL_CompileFileAction=Compile File
+
+LBL_UnoIdlType_loader_name=UNOIDL Type Files
+LBL_Name=&Name:
+LBL_DataType=Data &Type:
+LBL_Project=Project:
+LBL_Location=Location:
+LBL_Package=&Package:
+LBL_CreatedFile=Created File:
+LBL_ImplementationObject=Also &Create an Implementation Object
+
+ERROR_MessageCreation=The specified file cannot be created.
+ERROR_MessageImplObject=The specified implementation object cannot be created.
+
+OpenIDE-Module-Display-Category=Developing NetBeans
+Services/MIMEResolver/UnoIdlTypeResolver.xml=UNOIDL Type Files
+Templates/org-openoffice-extensions/idl=Empty UNOIDL file
+OutputWindowName=Debug Output
+IdlVisualPanelName=Name and Package
+IdlVisualPanelTypes=UNOIDL File Details
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_ja.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_ja.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_ja.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_ja.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,40 @@
+# CTL_CompileFileAction=Compile File
+CTL_CompileFileAction=\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30f3\u30d1\u30a4\u30eb
+
+# LBL_UnoIdlType_loader_name=UNOIDL Type Files
+LBL_UnoIdlType_loader_name=UNOIDL \u578b\u30d5\u30a1\u30a4\u30eb
+# LBL_Name=&Name:
+LBL_Name=\u540d\u524d(&N):
+# LBL_DataType=Data &Type:
+LBL_DataType=\u30c7\u30fc\u30bf\u578b(&T):
+# LBL_Project=Project:
+LBL_Project=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8:
+# LBL_Location=Location:
+LBL_Location=\u5834\u6240:
+# LBL_Package=&Package:
+LBL_Package=\u30d1\u30c3\u30b1\u30fc\u30b8(&P):
+# LBL_CreatedFile=Created File:
+LBL_CreatedFile=\u4f5c\u6210\u3055\u308c\u308b\u30d5\u30a1\u30a4\u30eb:
+# LBL_ImplementationObject=Also &Create an Implementation Object
+LBL_ImplementationObject=\u5b9f\u88c5\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3082\u4f5c\u6210(&C)
+
+# ERROR_MessageCreation=The specified file cannot be created.
+ERROR_MessageCreation=\u6307\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002
+# ERROR_MessageImplObject=The specified implementation object cannot be created.
+ERROR_MessageImplObject=\u6307\u5b9a\u3057\u305f\u5b9f\u88c5\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002
+
+# OpenIDE-Module-Display-Category=Developing NetBeans
+OpenIDE-Module-Display-Category=NetBeans \u306e\u958b\u767a
+# Services/MIMEResolver/UnoIdlTypeResolver.xml=UNOIDL Type Files
+Services/MIMEResolver/UnoIdlTypeResolver.xml=UNOIDL \u578b\u30d5\u30a1\u30a4\u30eb
+# Templates/org-openoffice-extensions/idl=Empty UNOIDL file
+Templates/org-openoffice-extensions/idl=\u7a7a\u306e UNOIDL \u30d5\u30a1\u30a4\u30eb
+# OutputWindowName=Debug Output
+OutputWindowName=\u51fa\u529b\u3092\u30c7\u30d0\u30c3\u30b0
+# IdlVisualPanelName=Name and Package
+IdlVisualPanelName=\u540d\u524d\u3068\u30d1\u30c3\u30b1\u30fc\u30b8
+# IdlVisualPanelTypes=UNOIDL File Details
+IdlVisualPanelTypes=UNOIDL \u30d5\u30a1\u30a4\u30eb\u306e\u8a73\u7d30
+
+
+
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_pt_BR.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_pt_BR.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_pt_BR.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_pt_BR.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,20 @@
+CTL_CompileFileAction=Compile File
+
+LBL_UnoIdlType_loader_name=UNOIDL Type Files
+LBL_Name=&Name:
+LBL_DataType=Data &Type:
+LBL_Project=Project:
+LBL_Location=Location:
+LBL_Package=&Package:
+LBL_CreatedFile=Created File:
+LBL_ImplementationObject=Also &Create an Implementation Object
+
+ERROR_MessageCreation=The specified file cannot be created.
+ERROR_MessageImplObject=The specified implementation object cannot be created.
+
+OpenIDE-Module-Display-Category=Developing NetBeans
+Services/MIMEResolver/UnoIdlTypeResolver.xml=UNOIDL Type Files
+Templates/org-openoffice-extensions/idl=Empty UNOIDL file
+OutputWindowName=Debug Output
+IdlVisualPanelName=Name and Package
+IdlVisualPanelTypes=UNOIDL File Details
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_zh_CN.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_zh_CN.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_zh_CN.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/Bundle_zh_CN.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,20 @@
+CTL_CompileFileAction=\u7f16\u8bd1\u6587\u4ef6
+
+LBL_UnoIdlType_loader_name=UNOIDL \u7c7b\u578b\u6587\u4ef6
+LBL_Name=\u540d\u79f0(&N)\uff1a
+LBL_DataType=\u6570\u636e\u7c7b\u578b(&T)\uff1a
+LBL_Project=\u9879\u76ee\uff1a
+LBL_Location=\u4f4d\u7f6e\uff1a
+LBL_Package=\u5305(&P)\uff1a
+LBL_CreatedFile=\u521b\u5efa\u7684\u6587\u4ef6\uff1a
+LBL_ImplementationObject=\u540c\u65f6\u521b\u5efa\u5b9e\u73b0\u5bf9\u8c61(&C)
+
+ERROR_MessageCreation=\u65e0\u6cd5\u521b\u5efa\u6307\u5b9a\u7684\u6587\u4ef6\u3002
+ERROR_MessageImplObject=\u65e0\u6cd5\u521b\u5efa\u6307\u5b9a\u7684\u5b9e\u73b0\u5bf9\u8c61\u3002
+
+OpenIDE-Module-Display-Category=\u5f00\u53d1 NetBeans
+Services/MIMEResolver/UnoIdlTypeResolver.xml=UNOIDL \u7c7b\u578b\u6587\u4ef6
+Templates/org-openoffice-extensions/idl=\u7a7a\u7684 UNOIDL \u6587\u4ef6
+OutputWindowName=\u8c03\u8bd5\u8f93\u51fa
+IdlVisualPanelName=\u540d\u79f0\u548c\u5305
+IdlVisualPanelTypes=UNOIDL \u6587\u4ef6\u8be6\u7ec6\u4fe1\u606f
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,233 @@
+<?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_generateFQN" type="java.lang.Boolean" value="true"/>
+ <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="jSeparator1" alignment="0" pref="375" max="32767" attributes="0"/>
+ <Group type="102" alignment="1" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel4" alignment="1" pref="70" max="32767" attributes="1"/>
+ <Component id="jLabel3" alignment="0" pref="70" max="32767" attributes="1"/>
+ <Component id="jLabel6" alignment="0" pref="70" max="32767" attributes="1"/>
+ <Component id="jLabel1" alignment="0" pref="70" max="32767" attributes="1"/>
+ <Component id="jLabel5" alignment="0" max="32767" attributes="1"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <Component id="jLabel2" pref="80" max="32767" attributes="1"/>
+ <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="implObjectTextField" alignment="1" pref="293" max="32767" attributes="0"/>
+ <Component id="implObjectCheckBox" alignment="1" pref="293" max="32767" attributes="0"/>
+ <Component id="projectTextField" alignment="1" pref="293" max="32767" attributes="1"/>
+ <Component id="locationTextField" pref="293" max="32767" attributes="1"/>
+ <Component id="packageComboBox" alignment="1" pref="293" max="32767" attributes="0"/>
+ <Component id="dataTypeComboBox" alignment="0" pref="293" max="32767" attributes="1"/>
+ <Component id="nameTextField1" alignment="1" pref="293" max="32767" attributes="1"/>
+ <Component id="createdFileTextField" alignment="1" pref="293" max="32767" attributes="1"/>
+ </Group>
+ </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">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
+ <Component id="nameTextField1" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="dataTypeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="projectTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="locationTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="packageComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="createdFileTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
+ <Component id="implObjectCheckBox" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="implObjectTextField" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jSeparator1" min="-2" pref="12" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="nameTextField1"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/unoidl/Bundle.properties" key="LBL_Name" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel2">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="projectTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/unoidl/Bundle.properties" key="LBL_Project" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel3">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="locationTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/unoidl/Bundle.properties" key="LBL_Location" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel4">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="packageComboBox"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/unoidl/Bundle.properties" key="LBL_Package" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel5">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="createdFileTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/unoidl/Bundle.properties" key="LBL_CreatedFile" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="nameTextField1">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="NewUnoIdlType"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="packageComboBox">
+ <Properties>
+ <Property name="editable" type="boolean" value="true"/>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="cbModel" type="code"/>
+ </Property>
+ <Property name="actionCommand" type="java.lang.String" value="packageComboBoxChanged"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="projectTextField">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="text" type="java.lang.String" value="jTextField2"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="locationTextField">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="text" type="java.lang.String" value="Source Packages"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="createdFileTextField">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="text" type="java.lang.String" value="jTextField4"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JSeparator" name="jSeparator1">
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel6">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="dataTypeComboBox"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/unoidl/Bundle.properties" key="LBL_DataType" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="dataTypeComboBox">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection code="getDataTypeList()" type="code"/>
+ </Property>
+ <Property name="actionCommand" type="java.lang.String" value="dataTypeComboBoxChanged"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="implObjectCheckBox">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/openoffice/extensions/filetypes/unoidl/Bundle.properties" key="LBL_ImplementationObject" replaceFormat="NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
+ </Property>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+ </Border>
+ </Property>
+ <Property name="enabled" type="boolean" value="false"/>
+ <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+ <Insets value="[0, 0, 0, 0]"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="implObjectCheckBoxActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JTextField" name="implObjectTextField">
+ <Properties>
+ <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="ee" green="ee" red="ee" type="rgb"/>
+ </Property>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="text" type="java.lang.String" value="jTextField1"/>
+ <Property name="enabled" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel1.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,511 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: IdlVisualPanel1.java,v $
+ *
+ * $Revision: 1.7 $
+ *
+ * last change: $Author: sg $ $Date: 2009/10/22 08:00:39 $
+ *
+ * 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.filetypes.unoidl;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.regex.Pattern;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.text.Document;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.spi.project.ui.templates.support.Templates;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.ImageUtilities;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.component.datamodel.DataType;
+import org.openoffice.extensions.util.IdlFileHelper;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+import org.openoffice.extensions.util.typebrowser.logic.TypeNode;
+
+public final class IdlVisualPanel1 extends JPanel implements KeyListener, DocumentListener, ActionListener {
+
+ public static final String PROP_NAME = "name"; // NOI18N
+
+ private SourceFolderComboBoxModel cbModel;
+ private String basePath;
+ private String m_sPackageName;
+
+ /** Creates new form IdlVisualPanel1 */
+ public IdlVisualPanel1() {
+ m_sPackageName = "";
+ cbModel = new SourceFolderComboBoxModel();
+ Image iconImage = ImageUtilities.loadImage("org/openoffice/extensions/projecttemplates/component/icons/module.png");
+ SourceFolderListCellRenderer renderer = new SourceFolderListCellRenderer(new ImageIcon(iconImage));
+ initComponents();
+ implObjectTextField.setText("");
+ packageComboBox.setRenderer(renderer);
+ packageComboBox.addActionListener(this);
+ packageComboBox.getEditor().getEditorComponent().addKeyListener(this);
+ dataTypeComboBox.addActionListener(this);
+ nameTextField1.getDocument().addDocumentListener(this);
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(IdlWizardIterator.class, "IdlVisualPanelName"); // NOI18N
+ }
+
+ /** 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() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ nameTextField1 = new javax.swing.JTextField();
+ packageComboBox = new javax.swing.JComboBox();
+ projectTextField = new javax.swing.JTextField();
+ locationTextField = new javax.swing.JTextField();
+ createdFileTextField = new javax.swing.JTextField();
+ jSeparator1 = new javax.swing.JSeparator();
+ jLabel6 = new javax.swing.JLabel();
+ dataTypeComboBox = new javax.swing.JComboBox();
+ implObjectCheckBox = new javax.swing.JCheckBox();
+ implObjectTextField = new javax.swing.JTextField();
+
+ jLabel1.setLabelFor(nameTextField1);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, NbBundle.getMessage(IdlVisualPanel1.class, "LBL_Name")); // NOI18N
+
+ jLabel2.setLabelFor(projectTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, NbBundle.getMessage(IdlVisualPanel1.class, "LBL_Project")); // NOI18N
+
+ jLabel3.setLabelFor(locationTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel3, NbBundle.getMessage(IdlVisualPanel1.class, "LBL_Location")); // NOI18N
+
+ jLabel4.setLabelFor(packageComboBox);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel4, NbBundle.getMessage(IdlVisualPanel1.class, "LBL_Package")); // NOI18N
+
+ jLabel5.setLabelFor(createdFileTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel5, NbBundle.getMessage(IdlVisualPanel1.class, "LBL_CreatedFile")); // NOI18N
+
+ nameTextField1.setText("NewUnoIdlType");
+
+ packageComboBox.setEditable(true);
+ packageComboBox.setModel(cbModel);
+ packageComboBox.setActionCommand("packageComboBoxChanged");
+
+ projectTextField.setEditable(false);
+ projectTextField.setText("jTextField2");
+
+ locationTextField.setEditable(false);
+ locationTextField.setText("Source Packages");
+
+ createdFileTextField.setEditable(false);
+ createdFileTextField.setText("jTextField4");
+
+ jLabel6.setLabelFor(dataTypeComboBox);
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel6, NbBundle.getMessage(IdlVisualPanel1.class, "LBL_DataType")); // NOI18N
+
+ dataTypeComboBox.setModel(getDataTypeList());
+ dataTypeComboBox.setActionCommand("dataTypeComboBoxChanged");
+
+ org.openide.awt.Mnemonics.setLocalizedText(implObjectCheckBox, NbBundle.getMessage(IdlVisualPanel1.class, "LBL_ImplementationObject")); // NOI18N
+ implObjectCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ implObjectCheckBox.setEnabled(false);
+ implObjectCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
+ implObjectCheckBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ implObjectCheckBoxActionPerformed(evt);
+ }
+ });
+
+ implObjectTextField.setBackground(new java.awt.Color(238, 238, 238));
+ implObjectTextField.setEditable(false);
+ implObjectTextField.setText("jTextField1");
+ implObjectTextField.setEnabled(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(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
+ .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
+ .add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
+ .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
+ .add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
+ .add(layout.createSequentialGroup()
+ .add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
+ .add(2, 2, 2)))
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, implObjectTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, implObjectCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, projectTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
+ .add(locationTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, packageComboBox, 0, 293, Short.MAX_VALUE)
+ .add(dataTypeComboBox, 0, 293, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, nameTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, createdFileTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jLabel1)
+ .add(nameTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(40, 40, 40)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel6)
+ .add(dataTypeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel2)
+ .add(projectTextField, 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(jLabel3)
+ .add(locationTextField, 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(packageComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(jLabel4))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel5)
+ .add(createdFileTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(15, 15, 15)
+ .add(implObjectCheckBox)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(implObjectTextField, 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(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(55, 55, 55))
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void implObjectCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_implObjectCheckBoxActionPerformed
+
+ if (implObjectCheckBox.isSelected()) {
+ implObjectTextField.setEnabled(true);
+// implObjectTextField.setEditable(true);
+ updateCreatedFileTextField();
+ }
+ else {
+ implObjectTextField.setEnabled(false);
+// implObjectTextField.setEditable(false);
+ }
+
+ }//GEN-LAST:event_implObjectCheckBoxActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTextField createdFileTextField;
+ private javax.swing.JComboBox dataTypeComboBox;
+ private javax.swing.JCheckBox implObjectCheckBox;
+ private javax.swing.JTextField implObjectTextField;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JSeparator jSeparator1;
+ private javax.swing.JTextField locationTextField;
+ private javax.swing.JTextField nameTextField1;
+ private javax.swing.JComboBox packageComboBox;
+ private javax.swing.JTextField projectTextField;
+ // End of variables declaration//GEN-END:variables
+
+ protected void read(WizardDescriptor desc) {
+ // project name
+ Project p = Templates.getProject(desc);
+ if (p != null) {
+ String displayName = ProjectUtils.getInformation(p).getDisplayName();
+ projectTextField.setText(displayName);
+ FileObject sourceObject = null;
+ try {
+ FileObject projDir = p.getProjectDirectory();
+ desc.putProperty("projdir", FileUtil.toFile(projDir)); // NOI18N
+ sourceObject = FileUtil.createFolder(projDir, "src"); // NOI18N
+ cbModel.setItems(getOrderedSubFolders(sourceObject));
+
+ } catch (IOException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+
+ // initialize local types if possible
+ IdlFileHelper ifh = new IdlFileHelper(sourceObject);
+ NbNodeObject[] existingIdlFiles = ifh.getAllIdlFiles();
+ TypeNode.setDesignedTypes(existingIdlFiles);
+
+ // update UI
+ this.dataTypeComboBox.setSelectedItem(DataType.INTERFACE_TYPE_NAME);
+ if (sourceObject != null) {
+ try {
+ File baseFile = FileUtil.toFile(sourceObject);
+ this.basePath = baseFile.getCanonicalPath();
+ desc.putProperty("srcdir", baseFile); // NOI18N
+ } catch (IOException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ }
+ updateCreatedFileTextField();
+ }
+ }
+
+ protected void store(WizardDescriptor desc) {
+ String name = this.nameTextField1.getText();
+ desc.putProperty("Name", name); // NOI18N
+ desc.putProperty("mainClassName", name.concat("Impl")); // NOI18N
+
+ // TODO: consolidate different keys for the same values
+ desc.putProperty("Package", m_sPackageName); // NOI18N
+ desc.putProperty("packageName", m_sPackageName); // NOI18N
+ desc.putProperty("UnoPackage", m_sPackageName); // NOI18N
+
+ desc.putProperty("DataType", this.dataTypeComboBox.getSelectedItem().toString()); // NOI18N
+ boolean createImplObject = this.implObjectCheckBox.isSelected() && this.implObjectCheckBox.isEnabled();
+ desc.putProperty("CreateImplObject", createImplObject); // NOI18N
+ }
+
+ private ComboBoxModel getDataTypeList() {
+ return new DefaultComboBoxModel(new String[]{
+ DataType.ENUM_TYPE_NAME,
+ DataType.EXCEPTION_TYPE_NAME,
+ DataType.INTERFACE_TYPE_NAME,
+ DataType.POLY_STRUCT_TYPE_NAME,
+ DataType.SERVICE_TYPE_NAME,
+ DataType.STRUCT_TYPE_NAME,
+ });
+ }
+
+ private void updateCreatedFileTextField() {
+ String selectedPackage = m_sPackageName.replace('.', File.separatorChar);
+ String fileName = nameTextField1.getText(); // NOI18N
+ String fullFileName = null;
+ if (basePath != null) {
+ fullFileName = basePath.concat(File.separator).concat(selectedPackage).concat(File.separator).concat(fileName);
+ createdFileTextField.setText(fullFileName.concat(".idl"));
+ }
+ else {
+ fullFileName = "...".concat(File.separator).concat(selectedPackage).concat(File.separator).concat(fileName); // NOI18N
+ createdFileTextField.setText(fullFileName.concat(".idl"));
+ }
+ if (implObjectCheckBox.isEnabled())
+ implObjectTextField.setText(fullFileName.concat("Impl.java"));
+ }
+
+ private void updateTexts(DocumentEvent docEvent) {
+ Document doc = docEvent.getDocument();
+
+ if (doc == this.nameTextField1.getDocument()) {
+ updateCreatedFileTextField();
+ firePropertyChange(PROP_NAME, null, this.nameTextField1.getText());
+ }
+ }
+
+ private String[] getOrderedSubFolders(FileObject sourceObject) {
+ Vector<String>subFolders = new Vector<String>();
+ int length = sourceObject.getPath().length();
+ if (sourceObject != null) {
+ Enumeration sourceChildren = sourceObject.getFolders(true);
+ while (sourceChildren.hasMoreElements()) {
+ FileObject nextCandidate = (FileObject)sourceChildren.nextElement();
+ String p = nextCandidate.getPath();
+ subFolders.add(p.substring(length + 1).replace('/', '.'));
+ }
+ }
+ return subFolders.toArray(new String[subFolders.size()]);
+ }
+
+ public void insertUpdate(DocumentEvent documentEvent) {
+ updateTexts(documentEvent);
+ }
+
+ public void removeUpdate(DocumentEvent documentEvent) {
+ updateTexts(documentEvent);
+ }
+
+ public void changedUpdate(DocumentEvent documentEvent) {
+ updateTexts(documentEvent);
+ }
+
+ public void actionPerformed(ActionEvent actionEvent) {
+ if (actionEvent.getActionCommand().equals(packageComboBox.getActionCommand())) {
+ m_sPackageName = packageComboBox.getSelectedItem().toString();
+ updateCreatedFileTextField();
+ }
+ else if (actionEvent.getActionCommand().equals(dataTypeComboBox.getActionCommand())) {
+ boolean bHelper =
+ DataType.SERVICE_TYPE_NAME.equals(dataTypeComboBox.getSelectedItem().toString()) ||
+ DataType.INTERFACE_TYPE_NAME.equals(dataTypeComboBox.getSelectedItem().toString());
+ implObjectCheckBox.setEnabled(bHelper);
+ // enable text field when check box is checked and check box is selected
+ if (implObjectCheckBox.isSelected() && bHelper) {
+ implObjectTextField.setEnabled(true);
+ updateCreatedFileTextField(); // also update text inside
+ }
+ else {
+ implObjectTextField.setEnabled(false);
+ }
+ }
+ }
+
+ public void keyTyped(KeyEvent e) {
+ char c = e.getKeyChar();
+ String charc = new String(new char[]{c});
+ m_sPackageName = packageComboBox.getEditor().getItem().toString();
+ if (Pattern.matches("[a-zA-Z_0-9\\.]", charc)) {
+ m_sPackageName = m_sPackageName.concat(charc);
+ }
+ updateCreatedFileTextField();
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+
+ private class SourceFolderComboBoxModel implements ComboBoxModel {
+ Vector<ListDataListener> listeners;
+ private String[] items;
+ private int index;
+ Image iconImage;
+ public SourceFolderComboBoxModel() {
+ listeners = new Vector<ListDataListener>();
+ items = new String[0];
+ }
+ public void setItems(String[] itemArray) {
+ if (itemArray != null && itemArray.length > 0) {
+ items = itemArray;
+ for (Iterator<ListDataListener>it = listeners.iterator(); it.hasNext();) {
+ ListDataListener l = it.next();
+ l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED,
+ 0, items.length - 1));
+ }
+ }
+ }
+ public void setSelectedItem(Object object) {
+ String compare = null;
+ if (object instanceof JLabel) {
+ compare = ((JLabel)object).getText();
+ }
+ else {
+ compare = object.toString();
+ }
+ for (int i = 0; i < items.length; i++) {
+ if (items[i].equals(object)) {
+ index = i;
+ }
+ }
+ }
+ public Object getSelectedItem() {
+ if (index >= 0 && index < items.length) {
+ return items[index];
+ }
+ return null;
+ }
+ public int getSize() {
+ return items.length;
+ }
+ public Object getElementAt(int i) {
+ if (i >= 0 && i < items.length) {
+ return items[i];
+ }
+ return null;
+ }
+ public void addListDataListener(ListDataListener listDataListener) {
+ listeners.add(listDataListener);
+ }
+ public void removeListDataListener(ListDataListener listDataListener) {
+ listeners.remove(listDataListener);
+ }
+ }
+
+ private class SourceFolderListCellRenderer extends JLabel implements ListCellRenderer {
+ public SourceFolderListCellRenderer(ImageIcon icon) {
+ super(icon, SwingConstants.LEFT);
+ setOpaque(true);
+ }
+ public Component getListCellRendererComponent(JList list, Object value, int index,
+ boolean isSelected, boolean cellHasFocus) {
+ Object e = cbModel.getElementAt(index);
+ if (e != null) {
+ String name = e.toString();
+ this.setText(name);
+ if (isSelected) {
+ setBackground(new Color(184, 207, 229));
+ }
+ else {
+ setBackground(new Color(255, 255, 255));
+ }
+ }
+ return this;
+ }
+ }
+}
+
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <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="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="dataTypeBasePanel" pref="428" max="32767" attributes="0"/>
+ <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">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="dataTypeBasePanel" pref="333" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="dataTypeBasePanel">
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="getContentPanel();"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
+ </Container>
+ </SubComponents>
+</Form>
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlVisualPanel2.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: IdlVisualPanel2.java,v $
+ *
+ * $Revision: 1.4 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/12 16:20:13 $
+ *
+ * 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.filetypes.unoidl;
+
+import javax.swing.JPanel;
+import org.openide.WizardDescriptor;
+import org.openide.explorer.ExplorerManager;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.component.datamodel.DataType;
+import org.openoffice.extensions.projecttemplates.component.datamodel.types.node.ComponentTypeNode;
+import org.openoffice.extensions.projecttemplates.component.dialogs.ChangeEventPanel;
+import org.openoffice.extensions.projecttemplates.component.dialogs.DialogProperties;
+import org.openoffice.extensions.projecttemplates.component.dialogs.EnumDataTypePanel;
+import org.openoffice.extensions.projecttemplates.component.dialogs.ExceptionDataTypePanel;
+import org.openoffice.extensions.projecttemplates.component.dialogs.InterfaceDataTypePanel;
+import org.openoffice.extensions.projecttemplates.component.dialogs.PolyStructDataTypePanel;
+import org.openoffice.extensions.projecttemplates.component.dialogs.ServiceDataTypePanel;
+import org.openoffice.extensions.projecttemplates.component.dialogs.StructDataTypePanel;
+import org.openoffice.extensions.projecttemplates.component.dialogs.ValidateDataType;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+
+public final class IdlVisualPanel2 extends JPanel implements ValidateDataType {
+
+ private static final String ICON_PATH =
+ "/org/openoffice/extensions/projecttemplates/component/icons/error.png"; // NOI18N
+
+ private DialogProperties props;
+ private IdlWizardPanel2 panel;
+
+ private boolean m_bError;
+ private String m_errorMessage;
+
+ /** Creates new form IdlVisualPanel2 */
+ public IdlVisualPanel2(IdlWizardPanel2 panel, WizardDescriptor wizard) {
+ this.panel = panel;
+ String name = (String)wizard.getProperty("Name"); // NOI18N
+ if (name == null) name = ""; // NOI18N
+ String pkg = (String)wizard.getProperty("Package"); // NOI18N
+ if (pkg == null) pkg = ""; // NOI18N
+ String dataType = (String)wizard.getProperty("DataType"); // NOI18N
+ if (dataType == null) dataType = DataType.ENUM_TYPE_NAME;
+ props = new DialogProperties(
+ new DialogProperties.OneDataType[] {
+ new DialogProperties.OneDataType<Integer>(DialogProperties.DATA_TYPE,
+ Integer.valueOf(DataType.getTypeIdForName(dataType))),
+ new DialogProperties.OneDataType<String>(DialogProperties.NAME, name),
+ new DialogProperties.OneDataType<String>(DialogProperties.IFC, name),
+ new DialogProperties.OneDataType<String>(DialogProperties.SRV, name),
+ new DialogProperties.OneDataType<String>(DialogProperties.PKG, pkg),
+ new DialogProperties.OneDataType<String[]>(DialogProperties.SELECTION, new String[]{
+ DataType.ENUM_TYPE_NAME,
+ DataType.EXCEPTION_TYPE_NAME,
+ DataType.INTERFACE_TYPE_NAME,
+ DataType.POLY_STRUCT_TYPE_NAME,
+ DataType.SERVICE_TYPE_NAME,
+ DataType.STRUCT_TYPE_NAME,
+ }),
+ new DialogProperties.OneDataType<Boolean>(DialogProperties.EDIT, Boolean.FALSE),
+ new DialogProperties.OneDataType<Boolean>(DialogProperties.ALLOW_SELECTION, Boolean.TRUE),
+ new DialogProperties.OneDataType<ChangeEventPanel>(DialogProperties.PANEL, (ChangeEventPanel)this.panel),
+ new DialogProperties.OneDataType<ComponentTypeNode>(DialogProperties.NODE, null)
+ }
+ );
+ initComponents();
+ }
+
+ public String getName() {
+ return NbBundle.getMessage(IdlWizardIterator.class, "IdlVisualPanelTypes");
+ }
+
+ protected void store(WizardDescriptor desc) {
+ ExplorerManager.Provider prov = (ExplorerManager.Provider)dataTypeBasePanel;
+ ComponentTypeNode node = (ComponentTypeNode)prov.getExplorerManager().getRootContext();
+ NbNodeObject object = (NbNodeObject)node.getLookup().lookup(NbNodeObject.class);
+ desc.putProperty("NbNodeObject", object); // NOI18N
+ }
+
+ /** 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() {
+ dataTypeBasePanel = getContentPanel();
+
+ 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(dataTypeBasePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(dataTypeBasePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel dataTypeBasePanel;
+ // End of variables declaration//GEN-END:variables
+
+
+ private JPanel getContentPanel() {
+ switch(props.getIntProperty(props.DATA_TYPE)) {
+ case DataType.EXCEPTION_TYPE:
+ return new ExceptionDataTypePanel(this, props);
+ case DataType.POLY_STRUCT_TYPE:
+ return new PolyStructDataTypePanel(this, props);
+ case DataType.ENUM_TYPE:
+ return new EnumDataTypePanel(this, props);
+ case DataType.INTERFACE_TYPE:
+ return new InterfaceDataTypePanel(this, props);
+ case DataType.SERVICE_TYPE:
+ return new ServiceDataTypePanel(this, props);
+ case DataType.STRUCT_TYPE:
+ return new StructDataTypePanel(this, props);
+ default:
+ LogWriter.getLogWriter().log(LogWriter.LEVEL_CRITICAL, "Unkown type for plugged panel creation."); // NOI18N
+ }
+ return new JPanel();
+ }
+
+ protected boolean valid(WizardDescriptor wizardDescriptor) {
+ if (m_bError) {
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", m_errorMessage); // NOI18N
+ return false;
+ }
+ wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); // NOI18N
+ return true;
+ }
+
+ public void setEnableError(boolean error, String message) {
+ this.m_bError = error;
+ if (error) {
+ m_errorMessage = message;
+// errorMessageLabel.setIcon(
+// new javax.swing.ImageIcon(getClass().getResource(ICON_PATH)));
+ }
+ else {
+ m_errorMessage = "";
+ }
+ panel.fireChangeEvent();
+ }
+}
+
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardIterator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardIterator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardIterator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardIterator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: IdlWizardIterator.java,v $
+ *
+ * $Revision: 1.6 $
+ *
+ * last change: $Author: sg $ $Date: 2008/07/02 11:24:50 $
+ *
+ * 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.filetypes.unoidl;
+
+import java.awt.Component;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.Set;
+import javax.swing.JComponent;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.filesystems.FileLock;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openoffice.extensions.config.ConfigurationSettings;
+import org.openoffice.extensions.projecttemplates.component.ComponentWizardIterator;
+import org.openoffice.extensions.projecttemplates.component.datamodel.DataType;
+import org.openoffice.extensions.util.IdlFileCreator;
+import org.openoffice.extensions.util.LogWriter;
+import org.openoffice.extensions.util.ProjectCreator;
+import org.openoffice.extensions.util.datamodel.NbNodeObject;
+
+public final class IdlWizardIterator implements WizardDescriptor.InstantiatingIterator {
+
+ private int index;
+
+ private WizardDescriptor wizard;
+ private WizardDescriptor.Panel[] panels;
+
+ /**
+ * Initialize panels representing individual wizard's steps and sets
+ * various properties for them influencing wizard appearance.
+ */
+ private WizardDescriptor.Panel[] getPanels() {
+ if (panels == null) {
+ panels = new WizardDescriptor.Panel[] {
+ new IdlWizardPanel1(),
+ new IdlWizardPanel2(wizard)
+ };
+ 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;
+ // Sets step number of a component
+ jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); // NOI18N
+ // Sets steps names for a panel
+ jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N
+ // Turn on subtitle creation on each step
+ jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N
+ // Show steps on the left side with the image on the background
+ jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N
+ // Turn on numbering of all steps
+ jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N
+ }
+ }
+ }
+ return panels;
+ }
+
+ public Set instantiate() throws IOException {
+ Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
+ File dirF = FileUtil.normalizeFile((File) wizard.getProperty("srcdir")); // NOI18N
+ dirF.mkdirs();
+
+ NbNodeObject object = (NbNodeObject)wizard.getProperty("NbNodeObject"); // NOI18N
+
+ // construct necessary properties in wizard
+ wizard.putProperty("TimeStamp", ConfigurationSettings.getTimeStamp()); // NOI18N
+
+
+ // get resources for the file from component project Bundle.properties
+ IdlFileCreator idlFileCreator = new IdlFileCreator(wizard,
+ ComponentWizardIterator.class, dirF.getCanonicalPath());
+
+ // this will for now only create one single file, but just to be prepared...
+ FileObject[] resultFiles = idlFileCreator.createAllIdlFiles(object);
+ for (int i = 0; i < resultFiles.length; i++) {
+ Enumeration resFolders = resultFiles[i].getFolders(false);
+ while (resFolders.hasMoreElements()) {
+ FileObject fo = (FileObject)resFolders.nextElement();
+ resultSet.add(fo);
+ }
+ }
+
+ boolean createImplObject = ((Boolean)wizard.getProperty("CreateImplObject")).booleanValue(); // NOI18N
+ if (createImplObject) { // fire skeletonmaker!
+ ProjectCreator creator = new ProjectCreator(dirF.getParentFile(), wizard);
+ creator.skeletonmaker(resultFiles);
+
+ FileObject projectRoot = FileUtil.toFileObject(dirF.getParentFile());
+ FileObject projectUnoProps = projectRoot.getFileObject("nbproject").getFileObject("project-uno", "properties"); // NOI18N
+ Properties props = new Properties();
+
+ // load the existing props and update when a service is created
+ String dataType = (String)wizard.getProperty("DataType");
+ if (DataType.SERVICE_TYPE_NAME.equals(dataType)) {
+ InputStream inStream = projectUnoProps.getInputStream();
+ props.load(inStream);
+ inStream.close();
+ String centralRegClass = props.getProperty("central.registration.class"); // NOI18N
+ // when entry not exists, do nothing
+ if (centralRegClass != null) {
+ String regClasses = props.getProperty("registration.classname"); // NOI18N
+ String fullName = ((String)wizard.getProperty("packageName")).concat(
+ ".").concat((String)wizard.getProperty("mainClassName"));
+ regClasses = regClasses.concat(" ").concat(fullName);
+ props.setProperty("registration.classname", regClasses); // NOI18N
+ }
+ FileLock lock = projectUnoProps.lock();
+ try {
+ OutputStream out = projectUnoProps.getOutputStream(lock);
+ props.store(out, null);
+ out.close();
+ } catch (IOException ex) {
+ LogWriter.getLogWriter().printStackTrace(ex);
+ }
+ finally {
+ lock.releaseLock();
+ }
+ }
+ }
+ return resultSet;
+ }
+
+ public void initialize(WizardDescriptor wizard) {
+ this.wizard = wizard;
+ }
+
+ public void uninitialize(WizardDescriptor wizard) {
+ panels = null;
+ }
+
+ public WizardDescriptor.Panel current() {
+ return getPanels()[index];
+ }
+
+ public String name() {
+ return index + 1 + ". from " + getPanels().length; // NOI18N ?? is this used anyway?
+ }
+
+ public boolean hasNext() {
+ return index < getPanels().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--;
+ }
+
+ // If nothing unusual changes in the middle of the wizard, simply:
+ public void addChangeListener(ChangeListener l) {}
+ public void removeChangeListener(ChangeListener l) {}
+
+ // If something changes dynamically (besides moving between panels), e.g.
+ // the number of panels changes in response to user input, then uncomment
+ // the following and call when needed: fireChangeEvent();
+ /*
+ private 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<ChangeListener> it;
+ synchronized (listeners) {
+ it = new HashSet<ChangeListener>(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+ */
+
+ // You could safely ignore this method. Is is here to keep steps which were
+ // there before this wizard was instantiated. It should be better handled
+ // by NetBeans Wizard API itself rather than needed to be implemented by a
+ // client code.
+ private String[] createSteps() {
+ String[] beforeSteps = null;
+ Object prop = wizard.getProperty("WizardPanel_contentData"); // NOI18N
+ if (prop != null && prop instanceof String[]) {
+ beforeSteps = (String[]) prop;
+ }
+
+ if (beforeSteps == null) {
+ beforeSteps = new String[0];
+ }
+
+ String[] res = new String[(beforeSteps.length - 1) + panels.length];
+ for (int i = 0; i < res.length; i++) {
+ if (i < (beforeSteps.length - 1)) {
+ res[i] = beforeSteps[i];
+ } else {
+ res[i] = panels[i - beforeSteps.length + 1].getComponent().getName();
+ }
+ }
+ return res;
+ }
+
+}
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel1.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel1.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel1.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel1.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: IdlWizardPanel1.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: sg $ $Date: 2007/08/15 13:45:19 $
+ *
+ * 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.filetypes.unoidl;
+
+import java.awt.Component;
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+
+public class IdlWizardPanel1 implements WizardDescriptor.Panel {
+
+ /**
+ * The visual component that displays this panel. If you need to access the
+ * component from this class, just use getComponent().
+ */
+ private IdlVisualPanel1 component;
+
+ // Get the visual component for the panel. In this template, the component
+ // is kept separate. This can be more efficient: if the wizard is created
+ // but never displayed, or not all panels are displayed, it is better to
+ // create only those which really need to be visible.
+ public Component getComponent() {
+ if (component == null) {
+ component = new IdlVisualPanel1();
+ }
+ return component;
+ }
+
+ public HelpCtx getHelp() {
+ // Show no Help button for this panel:
+ return HelpCtx.DEFAULT_HELP;
+ // If you have context help:
+ // return new HelpCtx(SampleWizardPanel1.class);
+ }
+
+ public boolean isValid() {
+ // If it is always OK to press Next or Finish, then:
+ return true;
+ // If it depends on some condition (form filled out...), then:
+ // return someCondition();
+ // and when this condition changes (last form field filled in...) then:
+ // fireChangeEvent();
+ // and uncomment the complicated stuff below.
+ }
+
+ public final void addChangeListener(ChangeListener l) {}
+ public final void removeChangeListener(ChangeListener l) {}
+
+ /*
+ 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<ChangeListener> it;
+ synchronized (listeners) {
+ it = new HashSet<ChangeListener>(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+ */
+
+ // You can use a settings object to keep track of state. Normally the
+ // settings object will be the WizardDescriptor, so you can use
+ // WizardDescriptor.getProperty & putProperty to store information entered
+ // by the user.
+ public void readSettings(Object settings) {
+ component.read((WizardDescriptor)settings);
+ }
+
+ public void storeSettings(Object settings) {
+ component.store((WizardDescriptor)settings);
+ }
+
+}
+
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel2.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel2.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel2.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/filetypes/unoidl/IdlWizardPanel2.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: IdlWizardPanel2.java,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: sg $ $Date: 2007/09/12 16:20:13 $
+ *
+ * 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.filetypes.unoidl;
+
+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.util.HelpCtx;
+import org.openoffice.extensions.projecttemplates.component.dialogs.ChangeEventPanel;
+
+public class IdlWizardPanel2 implements WizardDescriptor.Panel, ChangeEventPanel {
+
+ /**
+ * The visual component that displays this panel. If you need to access the
+ * component from this class, just use getComponent().
+ */
+ private IdlVisualPanel2 component;
+
+ private WizardDescriptor wizard;
+
+ public IdlWizardPanel2(WizardDescriptor wizard) {
+ this.wizard = wizard;
+ }
+
+ // Get the visual component for the panel. In this template, the component
+ // is kept separate. This can be more efficient: if the wizard is created
+ // but never displayed, or not all panels are displayed, it is better to
+ // create only those which really need to be visible.
+ public Component getComponent() {
+ if (component == null) {
+ component = new IdlVisualPanel2(this, wizard);
+ }
+ return component;
+ }
+
+
+ public HelpCtx getHelp() {
+ // Show no Help button for this panel:
+ return HelpCtx.DEFAULT_HELP;
+ // If you have context help:
+ // return new HelpCtx(SampleWizardPanel1.class);
+ }
+
+ public boolean isValid() {
+ return component.valid(wizard);
+ }
+
+ 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<ChangeListener> it;
+ synchronized (listeners) {
+ it = new HashSet<ChangeListener>(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+
+ public void readSettings(Object settings) {
+ component = new IdlVisualPanel2(this, (WizardDescriptor)settings);
+// component.read((WizardDescriptor)settings);
+ }
+
+ public void storeSettings(Object settings) {
+ component.store((WizardDescriptor)settings);
+ }
+
+}
+