diff options
author | Tomas O'Connor <toconnor@openoffice.org> | 2003-02-27 14:25:28 +0000 |
---|---|---|
committer | Tomas O'Connor <toconnor@openoffice.org> | 2003-02-27 14:25:28 +0000 |
commit | 88ec711f37779ee2b0effc6b751ead77de44dabf (patch) | |
tree | 1e5b13b6266d4cd53990b5140f05af4dbdc1b2b5 /scripting/java/org/openoffice/netbeans/modules/office/wizard | |
parent | Merge SRC641: 27.02.03 - 14:30:47 (diff) | |
download | core-88ec711f37779ee2b0effc6b751ead77de44dabf.tar.gz core-88ec711f37779ee2b0effc6b751ead77de44dabf.zip |
Ensure that OfficeInstallation path is initialised correctly
Diffstat (limited to 'scripting/java/org/openoffice/netbeans/modules/office/wizard')
3 files changed, 32 insertions, 23 deletions
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java index da8390f891db..77f1c0f8b2e5 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java +++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java @@ -17,7 +17,9 @@ import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openoffice.netbeans.modules.office.options.OfficeSettings; import org.openoffice.idesupport.OfficeInstallation; +import org.openoffice.idesupport.SVersionRCFile; /** A single panel descriptor for a wizard. * You probably want to make a wizard iterator to hold it. @@ -31,9 +33,18 @@ public class SelectPathPanel implements WizardDescriptor.Panel /* .FinishPanel * * just use getComponent(). */ private SelectPathVisualPanel component; + private OfficeInstallation office; /** Create the wizard panel descriptor. */ public SelectPathPanel() { + office = OfficeSettings.getDefault().getOfficeDirectory(); + + if (office == null) { + try { + office = SVersionRCFile.createInstance().getDefaultVersion(); + } + catch (java.io.IOException ioe) {} + } } // Get the visual component for the panel. In this template, the component @@ -89,8 +100,6 @@ public class SelectPathPanel implements WizardDescriptor.Panel /* .FinishPanel * } } - private OfficeInstallation office; - public void setSelectedPath(OfficeInstallation oi) { this.office = oi; fireChangeEvent(); diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form index 088e5db8b08c..b054e349f390 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form +++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form @@ -43,15 +43,12 @@ </Constraints> </Component> <Component class="javax.swing.JComboBox" name="installationsComboBox"> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="installationsComboBoxActionPerformed"/> - </Events> <AuxValues> <AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value=""/> <AuxValue name="JavaCodeGenerator_CreateCodePre" type="java.lang.String" value=""/> <AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value=""/> - <AuxValue name="JavaCodeGenerator_CodeGeneration" type="java.lang.Integer" value="0"/> <AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value=""/> + <AuxValue name="JavaCodeGenerator_CodeGeneration" type="java.lang.Integer" value="0"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java index 3b79878b0093..1fa09d5e3169 100644 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java +++ b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java @@ -33,7 +33,7 @@ public class SelectPathVisualPanel extends javax.swing.JPanel { public SelectPathVisualPanel(SelectPathPanel panel) { this.panel = panel; initComponents(); - OfficeInstallation orig = OfficeSettings.getDefault().getOfficeDirectory(); + OfficeInstallation orig = panel.getSelectedPath(); try { Enumeration enum = SVersionRCFile.createInstance().getVersions(); @@ -49,8 +49,17 @@ public class SelectPathVisualPanel extends javax.swing.JPanel { if (orig != null) { installationsComboBox.setSelectedItem(orig); + installPath.setText(orig.getPath()); } + installationsComboBox.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + installationsComboBoxActionPerformed(evt); + } + } + ); + // Provide a name in the title bar. setName(NbBundle.getMessage(SelectPathVisualPanel.class, "TITLE_SelectPathVisualPanel")); /* @@ -66,6 +75,16 @@ public class SelectPathVisualPanel extends javax.swing.JPanel { */ } + private void installationsComboBoxActionPerformed( + java.awt.event.ActionEvent evt) { + + OfficeInstallation oi = + (OfficeInstallation)installationsComboBox.getSelectedItem(); + + installPath.setText(oi.getPath()); + panel.setSelectedPath(oi); + } + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -108,12 +127,6 @@ public class SelectPathVisualPanel extends javax.swing.JPanel { gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 12); add(jLabel2, gridBagConstraints); - installationsComboBox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - installationsComboBoxActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; @@ -172,15 +185,6 @@ public class SelectPathVisualPanel extends javax.swing.JPanel { }//GEN-LAST:event_browseButtonActionPerformed - private void installationsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_installationsComboBoxActionPerformed - // Add your handling code here: - OfficeInstallation oi = - (OfficeInstallation)installationsComboBox.getSelectedItem(); - - installPath.setText(oi.getPath()); - panel.setSelectedPath(oi); - }//GEN-LAST:event_installationsComboBoxActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField installPath; private javax.swing.JButton browseButton; @@ -189,5 +193,4 @@ public class SelectPathVisualPanel extends javax.swing.JPanel { private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables - } |