Ensure that OfficeInstallation path is initialised correctly

This commit is contained in:
Tomas O'Connor
2003-02-27 14:25:28 +00:00
parent 8290926bd9
commit 88ec711f37
3 changed files with 32 additions and 23 deletions

View File

@@ -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();

View File

@@ -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">

View File

@@ -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
}