Ensure that OfficeInstallation path is initialised correctly
This commit is contained in:
@@ -17,7 +17,9 @@ import org.openide.WizardDescriptor;
|
|||||||
import org.openide.util.HelpCtx;
|
import org.openide.util.HelpCtx;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
|
||||||
|
import org.openoffice.netbeans.modules.office.options.OfficeSettings;
|
||||||
import org.openoffice.idesupport.OfficeInstallation;
|
import org.openoffice.idesupport.OfficeInstallation;
|
||||||
|
import org.openoffice.idesupport.SVersionRCFile;
|
||||||
|
|
||||||
/** A single panel descriptor for a wizard.
|
/** A single panel descriptor for a wizard.
|
||||||
* You probably want to make a wizard iterator to hold it.
|
* 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().
|
* just use getComponent().
|
||||||
*/
|
*/
|
||||||
private SelectPathVisualPanel component;
|
private SelectPathVisualPanel component;
|
||||||
|
private OfficeInstallation office;
|
||||||
|
|
||||||
/** Create the wizard panel descriptor. */
|
/** Create the wizard panel descriptor. */
|
||||||
public SelectPathPanel() {
|
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
|
// 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) {
|
public void setSelectedPath(OfficeInstallation oi) {
|
||||||
this.office = oi;
|
this.office = oi;
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
|
@@ -43,15 +43,12 @@
|
|||||||
</Constraints>
|
</Constraints>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JComboBox" name="installationsComboBox">
|
<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>
|
<AuxValues>
|
||||||
<AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value=""/>
|
<AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" value=""/>
|
||||||
<AuxValue name="JavaCodeGenerator_CreateCodePre" 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_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_CreateCodePost" type="java.lang.String" value=""/>
|
||||||
|
<AuxValue name="JavaCodeGenerator_CodeGeneration" type="java.lang.Integer" value="0"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
<Constraints>
|
<Constraints>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||||
|
@@ -33,7 +33,7 @@ public class SelectPathVisualPanel extends javax.swing.JPanel {
|
|||||||
public SelectPathVisualPanel(SelectPathPanel panel) {
|
public SelectPathVisualPanel(SelectPathPanel panel) {
|
||||||
this.panel = panel;
|
this.panel = panel;
|
||||||
initComponents();
|
initComponents();
|
||||||
OfficeInstallation orig = OfficeSettings.getDefault().getOfficeDirectory();
|
OfficeInstallation orig = panel.getSelectedPath();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Enumeration enum = SVersionRCFile.createInstance().getVersions();
|
Enumeration enum = SVersionRCFile.createInstance().getVersions();
|
||||||
@@ -49,8 +49,17 @@ public class SelectPathVisualPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
if (orig != null) {
|
if (orig != null) {
|
||||||
installationsComboBox.setSelectedItem(orig);
|
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.
|
// Provide a name in the title bar.
|
||||||
setName(NbBundle.getMessage(SelectPathVisualPanel.class, "TITLE_SelectPathVisualPanel"));
|
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
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* 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);
|
gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 12);
|
||||||
add(jLabel2, gridBagConstraints);
|
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 = new java.awt.GridBagConstraints();
|
||||||
gridBagConstraints.gridx = 1;
|
gridBagConstraints.gridx = 1;
|
||||||
gridBagConstraints.gridy = 0;
|
gridBagConstraints.gridy = 0;
|
||||||
@@ -172,15 +185,6 @@ public class SelectPathVisualPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
}//GEN-LAST:event_browseButtonActionPerformed
|
}//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
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JTextField installPath;
|
private javax.swing.JTextField installPath;
|
||||||
private javax.swing.JButton browseButton;
|
private javax.swing.JButton browseButton;
|
||||||
@@ -189,5 +193,4 @@ public class SelectPathVisualPanel extends javax.swing.JPanel {
|
|||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
private javax.swing.JPanel jPanel1;
|
private javax.swing.JPanel jPanel1;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user