incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ar...@apache.org
Subject svn commit: r1236486 [7/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/or...
Date Fri, 27 Jan 2012 01:29:58 GMT
Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,269 @@
+<?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="false"/>
+    <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="jPanel1" alignment="1" max="32767" attributes="0"/>
+                  <Component id="enableLoggingCheckBox" alignment="1" pref="491" max="32767" attributes="0"/>
+                  <Component id="jScrollPane1" alignment="0" pref="491" 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" alignment="0" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="enableLoggingCheckBox" min="-2" pref="16" max="-2" attributes="0"/>
+              <EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
+              <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
+              <EmptySpace max="32767" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Component class="javax.swing.JCheckBox" name="enableLoggingCheckBox">
+      <Properties>
+        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+          <Color blue="ff" green="ff" red="ff" type="rgb"/>
+        </Property>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="org/openoffice/extensions/config/Bundle.properties" key="LBL_Log_Checkbox" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </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="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+          <Insets value="[0, 0, 0, 0]"/>
+        </Property>
+        <Property name="opaque" type="boolean" value="false"/>
+      </Properties>
+    </Component>
+    <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.TitledBorderInfo">
+            <TitledBorder title="Log Settings">
+              <Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
+                <LineBorder>
+                  <Color PropertyName="color" blue="e5" green="cf" red="b8" type="rgb"/>
+                </LineBorder>
+              </Border>
+              <ResourceString PropertyName="titleX" bundle="org/openoffice/extensions/config/Bundle.properties" key="LBL_LogProperties" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+              <Color PropertyName="color" blue="0" green="0" red="0" type="rgb"/>
+            </TitledBorder>
+          </Border>
+        </Property>
+      </Properties>
+
+      <Layout>
+        <DimensionLayout dim="0">
+          <Group type="103" groupAlignment="0" attributes="0">
+              <Group type="102" alignment="1" attributes="0">
+                  <EmptySpace max="-2" attributes="0"/>
+                  <Group type="103" groupAlignment="1" attributes="0">
+                      <Component id="jLabel2" alignment="0" pref="124" max="32767" attributes="0"/>
+                      <Component id="jLabel1" alignment="1" pref="124" max="32767" attributes="0"/>
+                      <Component id="jLabel3" alignment="0" pref="124" max="32767" attributes="0"/>
+                      <Component id="jLabel4" alignment="0" pref="124" max="32767" attributes="0"/>
+                  </Group>
+                  <EmptySpace max="-2" attributes="0"/>
+                  <Group type="103" groupAlignment="0" attributes="0">
+                      <Group type="102" alignment="1" attributes="0">
+                          <Group type="103" groupAlignment="0" attributes="0">
+                              <Component id="fileNameTextField" pref="227" max="32767" attributes="0"/>
+                              <Component id="directoryTextField" alignment="1" pref="227" max="32767" attributes="0"/>
+                          </Group>
+                          <EmptySpace max="-2" attributes="0"/>
+                          <Group type="103" groupAlignment="1" max="-2" attributes="0">
+                              <Component id="browseButton" max="32767" attributes="1"/>
+                              <Component id="clearButton" alignment="1" max="32767" attributes="1"/>
+                          </Group>
+                      </Group>
+                      <Component id="logLevelFileName" pref="321" max="32767" attributes="0"/>
+                      <Component id="logLevelComboBox" alignment="0" pref="321" max="32767" attributes="1"/>
+                  </Group>
+                  <EmptySpace max="-2" attributes="0"/>
+              </Group>
+          </Group>
+        </DimensionLayout>
+        <DimensionLayout dim="1">
+          <Group type="103" groupAlignment="0" attributes="0">
+              <Group type="102" alignment="0" attributes="0">
+                  <Group type="103" groupAlignment="3" attributes="0">
+                      <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+                      <Component id="logLevelComboBox" 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="browseButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                      <Component id="directoryTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+                  </Group>
+                  <EmptySpace max="-2" attributes="0"/>
+                  <Group type="103" groupAlignment="3" attributes="0">
+                      <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
+                      <Component id="clearButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                      <Component id="fileNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+                  </Group>
+                  <EmptySpace max="-2" attributes="0"/>
+                  <Group type="103" groupAlignment="3" attributes="0">
+                      <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+                      <Component id="logLevelFileName" alignment="3" min="-2" pref="29" max="-2" attributes="0"/>
+                  </Group>
+                  <EmptySpace pref="13" max="32767" attributes="0"/>
+              </Group>
+          </Group>
+        </DimensionLayout>
+      </Layout>
+      <SubComponents>
+        <Component class="javax.swing.JLabel" name="jLabel4">
+          <Properties>
+            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+              <ComponentRef name="fileNameTextField"/>
+            </Property>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/openoffice/extensions/config/Bundle.properties" key="LBL_FileName" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+            </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="directoryTextField"/>
+            </Property>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/openoffice/extensions/config/Bundle.properties" key="LBL_Store_Directory" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+            </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/config/Bundle.properties" key="LBL_BUTTON_BrowseSDK" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+            </Property>
+            <Property name="actionCommand" type="java.lang.String" value="BROWSE"/>
+          </Properties>
+          <Events>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/>
+          </Events>
+          <AuxValues>
+            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+          </AuxValues>
+        </Component>
+        <Component class="javax.swing.JComboBox" name="logLevelComboBox">
+          <Properties>
+            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+              <Connection code="new javax.swing.DefaultComboBoxModel(LogWriter.getLoglevels())" type="code"/>
+            </Property>
+          </Properties>
+        </Component>
+        <Component class="javax.swing.JLabel" name="jLabel1">
+          <Properties>
+            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+              <ComponentRef name="logLevelComboBox"/>
+            </Property>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/openoffice/extensions/config/Bundle.properties" key="LBL_LogLevel_ComboBox" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+            </Property>
+          </Properties>
+        </Component>
+        <Component class="javax.swing.JButton" name="clearButton">
+          <Properties>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/openoffice/extensions/config/Bundle.properties" key="LBL_ButtonClear" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+            </Property>
+          </Properties>
+          <Events>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="clearButtonActionPerformed"/>
+          </Events>
+          <AuxValues>
+            <AuxValue name="generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+          </AuxValues>
+        </Component>
+        <Component class="javax.swing.JLabel" name="jLabel2">
+          <Properties>
+            <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+              <ComponentRef name="logLevelFileName"/>
+            </Property>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/openoffice/extensions/config/Bundle.properties" key="LBL_GeneratedFileName" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+            </Property>
+          </Properties>
+        </Component>
+        <Component class="javax.swing.JLabel" name="logLevelFileName">
+          <Properties>
+            <Property name="text" type="java.lang.String" value="jLabel6"/>
+            <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="opaque" type="boolean" value="true"/>
+          </Properties>
+        </Component>
+        <Component class="javax.swing.JTextField" name="directoryTextField">
+          <Properties>
+            <Property name="text" type="java.lang.String" value="jTextField1"/>
+          </Properties>
+        </Component>
+        <Component class="javax.swing.JTextField" name="fileNameTextField">
+          <Properties>
+            <Property name="text" type="java.lang.String" value="jTextField2"/>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </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="null"/>
+        </Property>
+      </Properties>
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JTextPane" name="errorTextPane">
+          <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="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+              <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+                <EmptyBorder/>
+              </Border>
+            </Property>
+            <Property name="editable" type="boolean" value="false"/>
+            <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+              <Color blue="0" green="0" red="ff" type="rgb"/>
+            </Property>
+          </Properties>
+        </Component>
+      </SubComponents>
+    </Container>
+  </SubComponents>
+</Form>

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/LogOutputSettingsDialog.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,368 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: LogOutputSettingsDialog.java,v $
+ *
+ *  $Revision: 1.4 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/07 08:52:40 $
+ *
+ *  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.config;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.filechooser.FileSystemView;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
+import org.openoffice.extensions.projecttemplates.addon.AddOnWizardIterator;
+import org.openoffice.extensions.util.LogWriter;
+
+/**
+ *
+ * @author  sg128468
+ */
+public class LogOutputSettingsDialog extends javax.swing.JPanel 
+        implements DocumentListener, ActionListener {
+    
+    /**
+     * Creates new form LogOutputSettingsDialog
+     */
+    public LogOutputSettingsDialog() {
+        initComponents();
+        initializeFields();
+        directoryTextField.getDocument().addDocumentListener(this);
+        fileNameTextField.getDocument().addDocumentListener(this);
+        enableLoggingCheckBox.addActionListener(this);
+        valid();
+    }
+    
+    /** 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() {
+
+        enableLoggingCheckBox = new javax.swing.JCheckBox();
+        jPanel1 = new javax.swing.JPanel();
+        jLabel4 = new javax.swing.JLabel();
+        jLabel3 = new javax.swing.JLabel();
+        browseButton = new javax.swing.JButton();
+        logLevelComboBox = new javax.swing.JComboBox();
+        jLabel1 = new javax.swing.JLabel();
+        clearButton = new javax.swing.JButton();
+        jLabel2 = new javax.swing.JLabel();
+        logLevelFileName = new javax.swing.JLabel();
+        directoryTextField = new javax.swing.JTextField();
+        fileNameTextField = new javax.swing.JTextField();
+        jScrollPane1 = new javax.swing.JScrollPane();
+        errorTextPane = new javax.swing.JTextPane();
+
+        enableLoggingCheckBox.setBackground(new java.awt.Color(255, 255, 255));
+        enableLoggingCheckBox.setText(NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_Log_Checkbox")); // NOI18N
+        enableLoggingCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+        enableLoggingCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
+        enableLoggingCheckBox.setOpaque(false);
+
+        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(184, 207, 229)), NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_LogProperties"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 11), new java.awt.Color(0, 0, 0))); // NOI18N
+
+        jLabel4.setLabelFor(fileNameTextField);
+        jLabel4.setText(NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_FileName")); // NOI18N
+
+        jLabel3.setLabelFor(directoryTextField);
+        jLabel3.setText(NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_Store_Directory")); // NOI18N
+
+        org.openide.awt.Mnemonics.setLocalizedText(browseButton, NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_BUTTON_BrowseSDK")); // NOI18N
+        browseButton.setActionCommand("BROWSE");
+        browseButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                browseButtonActionPerformed(evt);
+            }
+        });
+
+        logLevelComboBox.setModel(new javax.swing.DefaultComboBoxModel(LogWriter.getLoglevels()));
+
+        jLabel1.setLabelFor(logLevelComboBox);
+        jLabel1.setText(NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_LogLevel_ComboBox")); // NOI18N
+
+        org.openide.awt.Mnemonics.setLocalizedText(clearButton, NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_ButtonClear")); // NOI18N
+        clearButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                clearButtonActionPerformed(evt);
+            }
+        });
+
+        jLabel2.setLabelFor(logLevelFileName);
+        jLabel2.setText(NbBundle.getMessage(LogOutputSettingsDialog.class, "LBL_GeneratedFileName")); // NOI18N
+
+        logLevelFileName.setText("jLabel6");
+        logLevelFileName.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+        logLevelFileName.setOpaque(true);
+
+        directoryTextField.setText("jTextField1");
+
+        fileNameTextField.setText("jTextField2");
+
+        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
+        jPanel1.setLayout(jPanel1Layout);
+        jPanel1Layout.setHorizontalGroup(
+            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
+                .addContainerGap()
+                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+                    .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
+                    .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
+                    .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
+                    .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE))
+                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
+                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                            .add(fileNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
+                            .add(org.jdesktop.layout.GroupLayout.TRAILING, directoryTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE))
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
+                            .add(browseButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                            .add(clearButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+                    .add(logLevelFileName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE)
+                    .add(logLevelComboBox, 0, 321, Short.MAX_VALUE))
+                .addContainerGap())
+        );
+        jPanel1Layout.setVerticalGroup(
+            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(jPanel1Layout.createSequentialGroup()
+                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel1)
+                    .add(logLevelComboBox, 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(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel3)
+                    .add(browseButton)
+                    .add(directoryTextField, 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(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel4)
+                    .add(clearButton)
+                    .add(fileNameTextField, 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(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel2)
+                    .add(logLevelFileName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+                .addContainerGap(13, Short.MAX_VALUE))
+        );
+
+        jScrollPane1.setBorder(null);
+
+        errorTextPane.setBackground(new java.awt.Color(238, 238, 238));
+        errorTextPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
+        errorTextPane.setEditable(false);
+        errorTextPane.setForeground(new java.awt.Color(255, 0, 0));
+        jScrollPane1.setViewportView(errorTextPane);
+
+        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(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                    .add(org.jdesktop.layout.GroupLayout.TRAILING, enableLoggingCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE)
+                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE))
+                .addContainerGap())
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(layout.createSequentialGroup()
+                .addContainerGap()
+                .add(enableLoggingCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                .add(19, 19, 19)
+                .add(jPanel1, 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(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+        );
+    }// </editor-fold>//GEN-END:initComponents
+
+    private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed
+
+        LogWriter.getLogWriter().clearLogFile();
+        
+    }//GEN-LAST:event_clearButtonActionPerformed
+
+    private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
+
+        String command = evt.getActionCommand();
+        if ("BROWSE".equals(command)) { // NOI18N
+            JFileChooser chooser = new JFileChooser(FileSystemView.getFileSystemView());
+            FileUtil.preventFileChooserSymlinkTraversal(chooser, ConfigurationSettings.getDefaultFileChooserStartingDir());
+            chooser.setDialogTitle(NbBundle.getMessage(AddOnWizardIterator.class, "LBL_FileChooserTitle"));
+            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+            String path = this.directoryTextField.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);
+                directoryTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
+            }
+        }
+
+    }//GEN-LAST:event_browseButtonActionPerformed
+    
+    public boolean valid() {
+        if (enableLoggingCheckBox.isSelected()) {
+            String dir = directoryTextField.getText();
+            File logDir = new File(dir);
+            boolean valid = logDir.exists();
+            if (!valid) {  // directory wrong
+                errorTextPane.setText(
+                    NbBundle.getMessage(LogOutputSettingsDialog.class, 
+                    "ERROR_WrongDirectory"));
+                return false;
+            }
+
+            String log = logLevelFileName.getText();
+            File logFile = new File(log);
+            valid = (logFile.canWrite() || !logFile.exists()) && logDir.canWrite();
+            if (!valid) {  // log file cannot be created
+                errorTextPane.setText(
+                    NbBundle.getMessage(LogOutputSettingsDialog.class, 
+                    "ERROR_NoLogCreated"));
+                return false;
+            }
+        }
+        errorTextPane.setText("");
+        return true;
+    }
+
+    public String getLogLevel() {
+        // this will work, because static final LogWriter.getLoglevels() is used for the combo box model, too
+        return LogWriter.getLoglevels()[logLevelComboBox.getSelectedIndex()];
+    }
+
+    public String getLogFile() {
+        return logLevelFileName.getText();
+    }
+    
+    protected void initializeFields() {
+        LogWriter logWriter = LogWriter.getLogWriter();
+        int levelIndex = -1;//logWriter.getIndexFromLocalizedLogLevel(logWriter.getLogLevelLocalized());
+        String logFile = logWriter.getLogFile();
+        String logPath = null;
+        String logFileName = null;
+        int index = logFile.lastIndexOf(File.separatorChar);
+        if (index != -1) {
+            logPath = logFile.substring(0, index);
+            logFileName = logFile.substring(index + 1);
+        }
+        else {
+            logPath = ".";
+            logFileName = logFile;
+        }
+        directoryTextField.setText(logPath);
+        fileNameTextField.setText(logFileName);
+        logLevelFileName.setText(logFile);
+        if (levelIndex != -1) {
+            logLevelComboBox.setSelectedIndex(levelIndex);
+        }
+        if (logWriter.isActive()) {
+            enableLoggingCheckBox.setSelected(false);
+            directoryTextField.setEnabled(false);
+            logLevelComboBox.setEnabled(false);
+            logLevelFileName.setEnabled(false);
+            fileNameTextField.setEnabled(false);
+        }
+        else {
+            enableLoggingCheckBox.setSelected(true);
+        }
+    }
+
+    public void insertUpdate(DocumentEvent e) {
+        updateTexts();
+    }
+
+    public void removeUpdate(DocumentEvent e) {
+        updateTexts();
+    }
+
+    public void changedUpdate(DocumentEvent e) {
+        updateTexts();
+    }
+
+    public void updateTexts() {
+        String logFile = directoryTextField.getText().concat(
+            File.separator).concat(fileNameTextField.getText());
+        logLevelFileName.setText(logFile);
+        valid();
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        if (enableLoggingCheckBox.isSelected()) {
+            directoryTextField.setEnabled(true);
+            logLevelComboBox.setEnabled(true);
+            logLevelFileName.setEnabled(true);
+            fileNameTextField.setEnabled(true);
+        }
+        else {
+            directoryTextField.setEnabled(false);
+            logLevelComboBox.setEnabled(false);
+            logLevelFileName.setEnabled(false);
+            fileNameTextField.setEnabled(false);
+        }
+        valid();
+    }
+    
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JButton browseButton;
+    private javax.swing.JButton clearButton;
+    private javax.swing.JTextField directoryTextField;
+    private javax.swing.JCheckBox enableLoggingCheckBox;
+    private javax.swing.JTextPane errorTextPane;
+    private javax.swing.JTextField fileNameTextField;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JLabel jLabel2;
+    private javax.swing.JLabel jLabel3;
+    private javax.swing.JLabel jLabel4;
+    private javax.swing.JPanel jPanel1;
+    private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JComboBox logLevelComboBox;
+    private javax.swing.JLabel logLevelFileName;
+    // End of variables declaration//GEN-END:variables
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/OOoModuleInstall.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/OOoModuleInstall.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/OOoModuleInstall.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/OOoModuleInstall.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,34 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.extensions.config;
+
+import org.openide.modules.ModuleInstall;
+
+/**
+ * Class for handling the installation of the module. This is the first stuff
+ * that is called when the plugin is installed in NetBeans.
+ */
+public class OOoModuleInstall extends ModuleInstall {
+
+    /**
+     * Registers properties editor, installs options and copies settings.
+     * Overrides superclass method.
+     */
+    @Override
+    public void restored() {
+        // do nothing with the settings, see only that they are initialized
+        // since requestInstallations is not called, initializing must be done explicitly
+        ConfigurationSettings.getSettings();
+        // do insert the template code abbreviations
+        CodeTemplates.createTemplates();
+        // not used at the moment, uncomment if needed.
+//        requestInstallations();
+    }
+
+    private void requestInstallations() {
+        ConfigurationValidator.validateSettings();
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/IxLocator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/IxLocator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/IxLocator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/IxLocator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: IxLocator.java,v $
+ *
+ *  $Revision: 1.8 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/13 08:43:18 $
+ *
+ *  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.config.office;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import org.openoffice.extensions.util.LogWriter;
+
+/**
+ *
+ * @author steffen
+ */
+public class IxLocator extends PlatformLocator {
+
+    private final static String[] STARTING_PATHS = 
+            new String[] {"/opt", "/usr/lib", "/usr"};
+    private final static String OPENOFFICEORG3_NAME = "openoffice.org3";
+    private final static String STAROFFICE9_NAME = "staroffice9";
+    private final static String OPENOFFICEORG_NAME = "openoffice.org";
+    private final static String STAROFFICE_NAME = "staroffice";
+    private final static String STARSUITE_NAME = "starsuite";
+    // all names in an array for providing some sort of hierarchy
+    private final static String[] OFFICE_NAMES = new String[] {
+         STAROFFICE9_NAME,
+         OPENOFFICEORG3_NAME,
+         STAROFFICE_NAME,
+         OPENOFFICEORG_NAME,
+         STARSUITE_NAME,
+    };
+    
+    public IxLocator(String officePath, String sdkPath, boolean guessOfficePaths) {
+        super(officePath, sdkPath, guessOfficePaths);
+    }
+
+    /**
+     * determeine all paths variables: classpath and program/lib path
+     */
+    protected void locateOfficePaths() {
+        assert mOfficePath != null;
+        assert mSdkPath != null;
+        mOfficePathsSet = false;
+        File[] baseLink = mOfficePath.listFiles(new FileFilter() {
+            public boolean accept(File pathname) {
+                String path = pathname.getPath();
+                if (path != null && path.endsWith("basis-link")) {
+                    return true;
+                }
+                return false;
+            }
+        });
+        if (baseLink == null || baseLink.length == 0) {
+            try {
+                String path = mOfficePath.getCanonicalPath();
+                mJuhJurtRidlPath = path.concat("/program/classes"); // NOI18N
+                mUreBinPath = mSdkPath.getCanonicalPath().concat("/").concat(
+                        PlatformInfo.getPlatformBinDir()).concat("/bin");
+                // add "/usr/lib" to path
+                mPathVariable = path.concat("/program").concat(":").concat(
+                        mUreBinPath).concat(
+                        ":/usr/bin"); // // NOI18N
+                mJutUnoilPath = mJuhJurtRidlPath;
+                mTypesPath = new String[]{path.concat("/program/types.rdb")}; // NOI18N
+                mThreeLayerOffice = false;
+                mUnorcPath = path.concat("/program");
+                mOfficePathsSet = true;
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+        }
+        else {
+            try {
+                String path = baseLink[0].getCanonicalPath();
+                mJutUnoilPath = path.concat("/program/classes");
+                mJuhJurtRidlPath = path.concat("/ure-link/share/java");
+                mUnorcPath = path.concat("/ure-link/lib");
+                mPathVariable = 
+                        mOfficePath.getCanonicalPath().concat("/program").concat(
+                        ":").concat(
+                            mSdkPath.getCanonicalPath()).concat("/bin").concat(
+                        ":/usr/lib").concat(
+                        ":").concat(path).concat("/program").concat(
+                        ":").concat(path).concat("/ure-link/lib").concat(
+                        ":").concat(path).concat("/ure-link/bin"); // // NOI18N
+                mUreBinPath = path.concat("/ure-link/bin");
+                mTypesPath = new String[]{
+                    path.concat("/ure-link/share/misc/types.rdb"),
+                    path.concat("/program/offapi.rdb"),
+                };
+                mThreeLayerOffice = true;
+                mOfficePathsSet = true;
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+        }
+    }
+
+    /**
+     * Find OOo candidate installations, select one of those
+     * @return one selected OpenOffice.org installation directory 
+     */
+    protected void locateOffice() {
+        int foundIndex = OFFICE_NAMES.length; // prefer StarOffice 9 before OOo 3 before StarOffice and so on
+        for (int i = 0; i < STARTING_PATHS.length; i++) {
+            File f = new File(STARTING_PATHS[i]);
+            // iterate over names in order: first ones are preferred
+            for (int k = 0; k < OFFICE_NAMES.length; k++) {
+                final String officeName = OFFICE_NAMES[k];
+                File[] cands = f.listFiles(new FilenameFilter() {
+                    public boolean accept(File dir, String name) {
+                        if (name.startsWith(officeName))
+                            return true;
+                        return false;
+                    }
+                });
+                if (cands != null && cands.length > 0) {
+                    for (int j = 0; j < cands.length; j++) {
+                        String name = cands[j].getName();
+                        // prefer SO before OOo 3/9 before all else
+                        if (foundIndex > k && !name.endsWith("sdk")) {
+                            mOfficePath = cands[j];
+                            foundIndex = k;
+                        }
+                        // sdk must match office (this is for OOo 2 etc) - this may be dangerous
+                        if (mSdkPath == null && name.endsWith("_sdk")) { // NOI18N
+                            mSdkPath = cands[j];
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    protected void locateSDK() {
+        if (mSdkPath == null && mOfficePath != null) {  // office, but no sdk yet found...
+            try {
+                String path = mOfficePath.getCanonicalPath();
+                String sdkPath = path.concat("/basis-link/sdk"); // NOI18N
+                File f = new File(sdkPath);
+                if (f.exists()) {
+                    mSdkPath = f.getCanonicalFile();
+                }
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+        }
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/MacLocator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/MacLocator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/MacLocator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/MacLocator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: MacLocator.java,v $
+ *
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/13 08:43:18 $
+ *
+ *  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.config.office;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import org.openoffice.extensions.util.LogWriter;
+
+/**
+ *
+ * @author steffen
+ */
+public class MacLocator extends PlatformLocator {
+
+    private final static String[] STARTING_PATHS = 
+            new String[] {"/Applications"};
+    private final static String OPENOFFICEORG3_NAME = "OpenOffice.org";
+    private final static String STAROFFICE9_NAME = "StarOffice";
+    // all names in an array for providing some sort of hierarchy
+    private final static String[] OFFICE_NAMES = new String[] {
+         OPENOFFICEORG3_NAME,
+         STAROFFICE9_NAME,
+    };
+    
+    public MacLocator(String office, String sdk, boolean guessOfficePaths) {
+        super(office, sdk, guessOfficePaths);
+    }
+
+    /**
+     * determeine all paths variables: classpath and program/lib path
+     */
+    protected void locateOfficePaths() {
+        assert mOfficePath != null;
+        assert mSdkPath != null;
+        mOfficePathsSet = false;
+        try {
+            File startPath = new File(mOfficePath.getCanonicalPath().concat("/Contents"));
+            File[] baseLink = startPath.listFiles(new FileFilter() {
+
+                public boolean accept(File pathname) {
+                    String path = pathname.getPath();
+                    if (path != null && path.endsWith("basis-link")) {
+                        return true;
+                    }
+                    return false;
+                }
+            });
+            if (baseLink != null && baseLink.length > 0) {
+                try {
+                    String path = baseLink[0].getCanonicalPath();
+                    mJutUnoilPath = path.concat("/program/classes");
+                    mJuhJurtRidlPath = path.concat("/ure-link/share/java");
+                    mUnorcPath = path.concat("/ure-link/lib");
+                    mUreBinPath = path.concat("/ure-link/bin");
+                    mPathVariable = mOfficePath.getCanonicalPath().concat(
+                            "/Contents/MacOS:").concat(
+                            mSdkPath.getCanonicalPath()).concat("/bin:/usr/lib:").concat(
+                            path).concat("/program:").concat(path).concat(
+                            "/ure-link/lib:").concat(mUreBinPath); // // NOI18N
+                    mTypesPath = new String[]{path.concat("/ure-link/share/misc/types.rdb"), path.concat("/program/offapi.rdb")};
+                    mThreeLayerOffice = true;
+                    mOfficePathsSet = true;
+                } catch (IOException ex) {
+                    LogWriter.getLogWriter().printStackTrace(ex);
+                }
+            }
+        } catch (IOException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+    }
+
+    /**
+     * Find OOo candidate installations, select one of those
+     * @return one selected OpenOffice.org installation directory 
+     */
+    protected void locateOffice() {
+        int foundIndex = OFFICE_NAMES.length; // prefer StarOffice 9 before OOo 3 before StarOffice and so on
+        for (int i = 0; i < STARTING_PATHS.length; i++) {
+            File f = new File(STARTING_PATHS[i]);
+            // iterate over names in order: first ones are preferred
+            for (int k = 0; k < OFFICE_NAMES.length; k++) {
+                final String officeName = OFFICE_NAMES[k];
+                File[] officeAndSdkCands = f.listFiles(new FilenameFilter() {
+                    public boolean accept(File dir, String name) {
+                        if (name.startsWith(officeName))
+                            return true;
+                        return false;
+                    }
+                });
+                if (officeAndSdkCands != null && officeAndSdkCands.length > 0) {
+                    for (int j = 0; j < officeAndSdkCands.length; j++) {
+                        String name = officeAndSdkCands[j].getName();
+                        if (foundIndex > k && name.equals(officeName.concat(".app"))) {
+                            mOfficePath = officeAndSdkCands[j];
+                            foundIndex = k;
+                        }
+                        // search for SDK in same way
+                        if (mSdkPath == null && (name.endsWith("sdk.app") || name.endsWith("SDK.app"))) {
+                            mSdkPath = officeAndSdkCands[j];
+                        }
+                    }
+                }
+            }
+            
+        }
+    }
+    
+    protected void locateSDK() {
+        if (mSdkPath == null && mOfficePath != null) {  // office, but no sdk yet found...
+            try {
+                String path = mOfficePath.getCanonicalPath();
+                String sdkPath = path.concat("/basis-link/sdk"); // NOI18N
+                File f = new File(sdkPath);
+                if (f.exists()) {
+                    mSdkPath = f.getCanonicalFile();
+                }
+                else {
+                    File parent = mOfficePath.getParentFile();
+                    if (parent != null) {
+                        for (int k = 0; k < OFFICE_NAMES.length; k++) {
+                            final String officeName = OFFICE_NAMES[k];
+                            File[] sdkCands = parent.listFiles(new FilenameFilter() {
+                                public boolean accept(File dir, String name) {
+                                    if (name.startsWith(officeName) && (name.endsWith("sdk") || name.endsWith("SDK")))
+                                        return true;
+                                    return false;
+                                }
+                            });
+                        }
+                    }
+                }
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+        }
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/OpenOfficeLocation.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/OpenOfficeLocation.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/OpenOfficeLocation.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/OpenOfficeLocation.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,240 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: OpenOfficeLocation.java,v $
+ *
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/13 08:43:18 $
+ *
+ *  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.config.office;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import org.openoffice.extensions.config.ConfigurationSettings;
+import org.openoffice.extensions.util.LogWriter;
+
+/**
+ *
+ * @author steffen
+ */
+public class OpenOfficeLocation {
+
+    // static declarations and static functions
+    private static OpenOfficeLocation sLocateOpenOffice;
+    
+    public static OpenOfficeLocation getOpenOfficeLocation() {
+        if (sLocateOpenOffice == null) {
+            sLocateOpenOffice = new OpenOfficeLocation();
+            if (!sLocateOpenOffice.validate()) {
+                sLocateOpenOffice = null;
+            }
+        }
+        return sLocateOpenOffice;
+    }
+    
+    public static OpenOfficeLocation getOpenOfficeLocation(String office, String sdk, boolean guessOfficePaths) {
+        if (sLocateOpenOffice == null) {
+            sLocateOpenOffice = new OpenOfficeLocation(office, sdk, guessOfficePaths);
+            if (!sLocateOpenOffice.validate()) {
+                sLocateOpenOffice = null;
+            }
+        }
+        return sLocateOpenOffice;
+    }
+
+    public static void clearOpenOfficeLocation() {
+        sLocateOpenOffice = null;
+    }
+    
+    private static PlatformLocator createPlatformLocator(String office, String sdk, boolean guessOfficePaths) {
+        if (PlatformInfo.isWindows()) {
+            return new WinLocator(office, sdk, guessOfficePaths);
+        }
+        else if (PlatformInfo.isMacOS()) {
+            return new MacLocator(office, sdk, guessOfficePaths);
+        }
+        return new IxLocator(office, sdk, guessOfficePaths);
+    }
+    
+    private PlatformLocator mPlatformLocator;
+    private String mOfficeVersion;
+
+    // local declarations and local functions
+    private OpenOfficeLocation() {
+        this(null, null, true);
+    }
+
+    private OpenOfficeLocation(String office, String sdk, boolean guessOfficePaths) {
+        mPlatformLocator = createPlatformLocator(office, sdk, guessOfficePaths);
+        findOfficeVersion();
+    }
+    
+    /**
+     * Get the path of bootstraprc (or bootstrap.ini); bootstraprc is the last 
+     * entry of the path. Returns empty string if bootstraprc is not found.
+     * @param officepath
+     * @return the path of bootstraprc (bootstrap.ini)
+     */
+    public String getBootstrapPath() {
+        String bootstrapiniPath = "";
+        try
+        {
+            String bootstrapini = PlatformInfo.getBootstrapIni();
+            File f = new File(mPlatformLocator.getOfficePath() + File.separator 
+                    + PlatformInfo.getOfficeProgramDir() + File.separator + bootstrapini ); // NOI18N
+            if (f.exists()) {
+                bootstrapiniPath = f.getCanonicalPath();
+            }
+        }
+        catch (IOException ex)
+        {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        return bootstrapiniPath;
+    }
+
+//    public PlatformLocator getPlatformLocator() {
+//        return mPlatformLocator;
+//    }
+    
+    public String getOfficePath() {
+        return mPlatformLocator.getOfficePath();
+    }
+    
+    public String getSdkPath() {
+        return mPlatformLocator.getSdkPath();
+    }
+    
+    public String getUnorcPath() {
+        return mPlatformLocator.getUnorcPath();
+    }
+    
+    public String getUreBinPath() {
+        return mPlatformLocator.getUreBinPath();
+    }
+    
+    /**
+     * Get the version of the Office currently used.
+     * @return the Office version
+     */
+    public String getOfficeVersion() {
+        return mOfficeVersion;
+    }
+
+    public String getFullPathForJar(String jarName) {
+        return mPlatformLocator.getFullPathForJar(jarName);
+    }
+    
+    public String[] getUnoTypesPath() {
+        return mPlatformLocator.getTypesPath();
+    }
+    
+    public String getPathVariable() {
+        return mPlatformLocator.getPathVariable();
+    }
+    
+    private void findOfficeVersion() {
+        FileInputStream inStream = null; // NOI18N
+        try {
+            File bootstrap = new File(getBootstrapPath());
+            inStream = new FileInputStream(bootstrap);
+            java.util.PropertyResourceBundle props = new java.util.PropertyResourceBundle(inStream);
+            mOfficeVersion = (String) props.handleGetObject("ProductKey"); // NOI18N
+        } catch (FileNotFoundException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        } catch (IOException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        } finally {
+            try {
+                if (inStream != null)
+                    inStream.close();
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+        }
+    }
+    
+    public static boolean validateOffice(String officePath) {
+        String postfix = PlatformInfo.getPostfix();  // NOI18N
+        
+        String checkdir = PlatformInfo.getOfficeProgramDir();
+
+        File f = new File(officePath + File.separator + checkdir + File.separator + "soffice" + postfix);
+        try {
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "Looking for file: " + f.getCanonicalPath());
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        }
+        return f.exists();
+    }
+    
+    public static boolean validateSDK(String sdkPath) {
+        String sdkPostfix = PlatformInfo.getSDKPostfix(); // NOI18N
+        
+        File f = new File(sdkPath + File.separator + "setsdkenv_" + sdkPostfix); // NOI18N
+        try {
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "Looking for file: " + f.getCanonicalPath());
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        }
+        return f.exists();
+    }
+    
+    public boolean validate() {
+        if (mPlatformLocator.mOfficePathsSet) {
+            return validateOffice(getOfficePath()) & validateSDK(getSdkPath());
+        }
+        return false;
+    }
+ 
+    public static String getSdk(String officePath) {
+        PlatformLocator locator = createPlatformLocator(officePath, null, true);
+        String path = locator.getSdkPath();
+        return path; // may be null
+    }
+    
+    public boolean isThreeLayerOffice() {
+        return mPlatformLocator.isThreeLayerOffice();
+    }
+    
+    /**
+     * Be optimistic about the office: if path is null or "", we assume it is
+     * a three layer office.
+     * @param officePath
+     * @return true, if officePath denotes a three layer office, also true if 
+     * officePath is empty
+     */
+    public static boolean isThreeLayerOffice(String officePath) {
+        if (officePath == null || officePath.length() == 0) return true;
+        PlatformLocator locator = createPlatformLocator(officePath, null, true);
+        return locator.isThreeLayerOffice();
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformInfo.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformInfo.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformInfo.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformInfo.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: PlatformInfo.java,v $
+ *
+ *  $Revision: 1.4 $
+ *
+ *  last change: $Author: sg $ $Date: 2009/07/06 14:51:29 $
+ *
+ *  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.config.office;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openoffice.extensions.util.LogWriter;
+
+/**
+ *
+ * @author js93811
+ */
+public class PlatformInfo {
+    static public final String UNKNOWN_PLATFORM = "unknown_platform";  // NOI18N
+    
+    static String m_PlatformBinDir = null;
+    static String m_PlatformPackageDir = null;
+    // unix on all, on Windows: windows.bat
+    static String m_ProgramSDKPostfix = null;
+    // ".exe" on windows
+    static String m_ProgramPostfix = null;
+    // program on all, but Contents/MacOS on Mac
+    static String m_OfficeProgramDir = null;
+    static String m_UnorcName = null;
+    static String m_BootstrapIni;
+    
+    public static String getPlatformBinDir() {
+        if (m_PlatformBinDir == null) {
+            preparePlatformInfo();
+        }
+        
+        return m_PlatformBinDir;
+    }
+    
+    public static String getPlatformPackageDir() {
+        if (m_PlatformBinDir == null) {
+            preparePlatformInfo();
+        }
+        return m_PlatformPackageDir;
+    }    
+    
+    public static boolean isWindows() {
+        if (m_PlatformBinDir == null) {
+            preparePlatformInfo();
+        }
+
+        return m_PlatformBinDir.equals("windows"); // NOI18N
+    }
+
+    public static boolean isMacOS() {
+        if (m_PlatformBinDir == null) {
+            preparePlatformInfo();
+        }
+
+        return m_PlatformBinDir.equals("macosx"); // NOI18N
+    }
+    
+    public static String getOfficeProgramDir() {
+        if (m_OfficeProgramDir == null) {
+            preparePlatformInfo();
+        }
+
+        return m_OfficeProgramDir;
+    }
+
+    public static String getBootstrapIni() {
+        if (m_BootstrapIni == null) {
+            preparePlatformInfo();
+        }
+        
+        return m_BootstrapIni;
+    }
+    
+    public static String getUnorcName() {
+        if (m_UnorcName == null) {
+            preparePlatformInfo();
+        }
+        
+        return m_UnorcName;
+    }
+    
+    public static String getSDKPostfix() {
+        return m_ProgramSDKPostfix == null?"unix":m_ProgramSDKPostfix;
+    }
+    
+    public static String getPostfix() {
+        return m_ProgramPostfix == null?"":m_ProgramPostfix;
+    }
+    
+    private static void preparePlatformInfo() {
+        boolean knownPlatform = false;
+        if (m_PlatformBinDir == null || System.getProperty("os.dir") == null) { // NOI18N
+            String osName = System.getProperty("os.name"); // NOI18N
+            String osArch = System.getProperty("os.arch"); // NOI18N
+            
+            m_OfficeProgramDir = "program"; //NOI18N
+            m_BootstrapIni = "bootstraprc";
+            m_UnorcName = "unorc";
+            
+            if (osName.indexOf("Windows") >= 0) { // NOI18N
+                m_PlatformBinDir = "windows"; // NOI18N
+                m_PlatformPackageDir = "Windows"; // NOI18N
+                m_BootstrapIni = "bootstrap.ini";
+                m_UnorcName = "uno.ini";
+                m_ProgramPostfix = ".exe";
+                m_ProgramSDKPostfix = "windows.bat";
+                knownPlatform = true;
+            } 
+            else if (osName.indexOf("Linux") >= 0) { // NOI18N
+                m_PlatformBinDir = "linux"; // NOI18N
+                knownPlatform = true;
+                if (osArch.indexOf("i386") >= 0) { // NOI18N
+                    m_PlatformPackageDir = "Linux_x86"; // NOI18N
+                }
+                else {
+                    // TODO: handle unkown architecture
+                }
+            }
+            else if (osName.indexOf("SunOS") >= 0) { // NOI18N
+                if (osArch.indexOf("sparc") >= 0) { // NOI18N
+                    m_PlatformBinDir = "solsparc"; // NOI18N
+                    m_PlatformPackageDir = "Solaris_SPARC"; // NOI18N
+                    knownPlatform = true;
+                }
+                else if (osArch.indexOf("x86") >= 0) { // NOI18N
+                    m_PlatformBinDir = "solintel";                 // NOI18N    
+                    m_PlatformPackageDir = "Solaris_x86"; // NOI18N
+                    knownPlatform = true;
+                }
+                else {
+                    // TODO: handle unkown architecture
+                }
+            }
+            else if (osName.indexOf("Mac OS X") >= 0) { // NOI18N
+                m_OfficeProgramDir = "Contents/MacOS";
+                if (osArch.indexOf("x86_64") >= 0) { // NOI18N
+                    m_PlatformBinDir = "macosx"; // NOI18N
+                    m_PlatformPackageDir = "MacOSX_Intel"; // NOI18N
+                    knownPlatform = true;
+                }
+                else if (osArch.indexOf("i386") >= 0) { // NOI18N
+                    m_PlatformBinDir = "macosx"; // NOI18N
+                    m_PlatformPackageDir = "MacOSX_Intel"; // NOI18N
+                    knownPlatform = true;
+                }
+                else if (osArch.indexOf("PPC") >= 0) { // NOI18N
+                    m_PlatformBinDir = "macosx";                 // NOI18N    
+                    m_PlatformPackageDir = "MacOSX_PowerPC"; // NOI18N
+                    knownPlatform = true;
+                }
+                else {
+                    // TODO: handle unkown architecture
+                }
+            }
+            else {
+                // TODO: handle unkown platform i.e. mac
+            }
+        }
+        if (!knownPlatform) {
+            Properties platformProps = new Properties();
+            File f = new File(System.getProperty("user.home").concat(
+                File.separator).concat(".OOo_plugin.properties"));
+            if (f.exists() && f.isFile() && f.canRead()) {
+                FileObject props = FileUtil.toFileObject(f);
+                try {
+                    platformProps.load(props.getInputStream());
+                    m_PlatformBinDir = platformProps.getProperty("platform.bin.dir");
+                    m_PlatformPackageDir = platformProps.getProperty("platform.package.dir");
+                    m_ProgramSDKPostfix = platformProps.getProperty("platform.sdk.postfix");
+                    m_ProgramPostfix = platformProps.getProperty("platform.postfix");
+                    LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, 
+                        "Read Platform Info:  1. platform bin " + m_PlatformBinDir + 
+                        "  2. platform package " + m_PlatformPackageDir + 
+                        "  3. postfix " + m_ProgramPostfix + 
+                        "  4. sdk postfix " + m_ProgramSDKPostfix);
+                    knownPlatform = true;
+                } catch (FileNotFoundException ex) {
+                    LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, ex.getMessage());
+                } catch (IOException ex) {
+                    LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, ex.getMessage());
+                }
+            }
+            if (m_PlatformBinDir == null || m_PlatformPackageDir == null || !knownPlatform) {
+                m_PlatformBinDir = UNKNOWN_PLATFORM;
+            }
+        }
+        System.setProperty("sdk.os.dir", m_PlatformBinDir); // NOI18N
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformLocator.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformLocator.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformLocator.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/office/PlatformLocator.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: PlatformLocator.java,v $
+ *
+ *  $Revision: 1.8 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/13 08:43:18 $
+ *
+ *  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.config.office;
+
+import java.io.File;
+import java.io.IOException;
+import org.openide.util.Exceptions;
+import org.openoffice.extensions.util.LogWriter;
+
+/**
+ *
+ * @author steffen
+ */
+public abstract class PlatformLocator {
+
+    /** derived classes have to fill this variable in locateOffice method **/
+    protected File mOfficePath;
+    /** derived classes have to fill this variable in locateSdk method **/
+    protected File mSdkPath;
+    /** derived classes have to fill this variable in locateOfficePaths method **/
+    protected String mJutUnoilPath;
+    /** derived classes have to fill this variable in locateOfficePaths method **/
+    protected String mJuhJurtRidlPath;
+    /** derived classes have to fill this variable in locateOfficePaths method **/
+    protected String mPathVariable;
+    /** derived classes have to fill this variable in locateOfficePaths method **/
+    protected String mUnorcPath;
+    /** derived classes have to fill this variable in locateOfficePaths method **/
+    protected String mUreBinPath;
+    /** derived classes have to fill this variable in locateOfficePaths method **/
+    protected String[] mTypesPath;
+    /** derived classes have to fill this variable in locateOfficePaths method **/
+    protected boolean mThreeLayerOffice;
+    /** derived clases can set this to show that something went wrong with office paths **/
+    protected boolean mOfficePathsSet;
+    
+    /**
+     * C'tor for this class: only called from derived classes
+     * @param office path to the office, can be null
+     * @param sdk path to the sdk, can be null
+     */
+    protected PlatformLocator(String officePath, String sdkPath, boolean guessOfficePaths) {
+        if (guessOfficePaths && (officePath == null || officePath.length() == 0)) {
+            // sdk path may be found, too
+            locateOffice();
+        }
+        else {
+            if (officePath != null && officePath.length() > 0)
+                mOfficePath = new File(officePath);
+        }
+        if (guessOfficePaths && (sdkPath == null || sdkPath.length() == 0)) {
+            locateSDK();
+        }
+        else {
+            if (sdkPath != null && sdkPath.length() > 0)
+                mSdkPath = new File(sdkPath);
+        }
+        if (mOfficePath != null && mSdkPath != null && mOfficePath.exists() && mSdkPath.exists()) {
+            locateOfficePaths(); // produce path variables
+        }
+        else {
+            mOfficePathsSet = false; // gets also set in locateOfficePaths
+            mOfficePath = null;
+            mSdkPath = null;
+        }
+        logAllVariables();
+    }
+
+    private void logAllVariables() {
+        try {
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "mOfficePath: " + (mOfficePath == null ? "" : mOfficePath.getCanonicalPath()));
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "mSdkPath: " + (mSdkPath == null ? "" : mSdkPath.getCanonicalPath()));
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "mJutUnoilPath: " + mJutUnoilPath);
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "mJuhJurtRidlPath: " + mJuhJurtRidlPath);
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "mPathVariable: " + mPathVariable);
+            String typesPath = "";
+            if (mTypesPath != null) {
+                for (int i = 0; i < mTypesPath.length; i++) {
+                    typesPath = typesPath.concat(mTypesPath[i]).concat(":");
+                }
+            }
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "mTypesPath: " + typesPath);
+            LogWriter.getLogWriter().log(LogWriter.LEVEL_INFO, "mThreeLayerOffice: " + mThreeLayerOffice);
+        } catch (IOException ex) {
+            Exceptions.printStackTrace(ex);
+        }
+
+    }
+
+    // derived classes must implement the following functions:
+    /**
+     * Locate the office directory for this platform: after executing this 
+     * function, mOfficePath should denote the path to the office, null 
+     * otherwise
+     */
+    protected abstract void locateOffice();
+
+    /**
+     * Locate the sdk directory for this platform: after executing this 
+     * function, mSdkPath should denote the path to the sdk, null 
+     * otherwise
+     */
+    protected abstract void locateSDK();
+
+    /**
+     * Fill all other variables with meaningful values, when officePath and 
+     * sdkPath are known.
+     */
+    protected abstract void locateOfficePaths();
+    
+    /**
+     * Get the full path for a special jar. Note: WinLocator overrides this,
+     * because of stupid Java problems when writing \\
+     * @param jarName the name of the jar
+     * @return the full path including the jar
+     */
+    public String getFullPathForJar(String jarName) {
+        if (jarName.equals("juh.jar") || jarName.equals("jurt.jar") || 
+                jarName.equals("ridl.jar") || jarName.equals("java_uno.jar") || jarName.equals("unoloader.jar")) {
+            return mJuhJurtRidlPath.concat(File.separator).concat(jarName);
+        }
+        return mJutUnoilPath.concat(File.separator).concat(jarName);
+    }
+
+    /**
+     *  Get the path to the Office
+     * @return the path to the Office
+     */
+    public String getOfficePath() {
+        try {
+            if (mOfficePath != null) {
+                return mOfficePath.getCanonicalPath();
+            }
+        } catch (IOException ex) {
+            Exceptions.printStackTrace(ex);
+        }
+        return "";
+    }
+    
+    /**
+     * Get the path to the SDK
+     * @return the path to the sdk
+     */
+    public String getSdkPath() {
+        try {
+            if (mSdkPath != null) {
+                return mSdkPath.getCanonicalPath();
+            }
+        } catch (IOException ex) {
+            Exceptions.printStackTrace(ex);
+        }
+        return "";
+    }
+    
+    /**
+     *  Get the path variable
+     * @return the path variable
+     */
+    public String getPathVariable() {
+        if (mPathVariable == null) {
+            return "";
+        }
+        return mPathVariable;
+    }
+
+    /**
+     *  Get the ure bin path for tools
+     * @return the path variable
+     */
+    public String getUreBinPath() {
+        if (mUreBinPath == null) {
+            return "";
+        }
+        return mUreBinPath;
+    }
+
+    /**
+     * get the types path
+     * @return the types path
+     */
+    public String[] getTypesPath() {
+        if (mTypesPath == null) {
+            return new String[]{""};
+        }
+        return mTypesPath;
+    }
+    
+    /**
+     * Is this a three layer office?
+     * @return true, when it's athree layer office, false else.
+     */
+    public boolean isThreeLayerOffice() {
+        return mThreeLayerOffice;
+    }
+    
+    /**
+     * Get the path to uno(.exe) 
+     *
+     */
+    public String getUnorcPath() {
+        if (mUnorcPath == null) {
+            return "";
+        }
+        return mUnorcPath;
+    }
+}



Mime
View raw message