IssueZilla 10661 - Change Office Directory property to store an OfficeInstallation instance.
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: OfficeSettings.java,v $
|
* $RCSfile: OfficeSettings.java,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.4 $
|
* $Revision: 1.5 $
|
||||||
*
|
*
|
||||||
* last change: $Author: toconnor $ $Date: 2003-01-16 11:42:47 $
|
* last change: $Author: toconnor $ $Date: 2003-02-20 11:56:16 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -71,6 +71,7 @@ import org.openide.util.HelpCtx;
|
|||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
|
||||||
import org.openoffice.idesupport.SVersionRCFile;
|
import org.openoffice.idesupport.SVersionRCFile;
|
||||||
|
import org.openoffice.idesupport.OfficeInstallation;
|
||||||
|
|
||||||
/** Options for something or other.
|
/** Options for something or other.
|
||||||
*
|
*
|
||||||
@@ -87,34 +88,27 @@ public class OfficeSettings extends SystemOption {
|
|||||||
|
|
||||||
protected void initialize() {
|
protected void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
setWarnBeforeDocDeploy(true);
|
setWarnBeforeDocDeploy(true);
|
||||||
setWarnAfterDirDeploy(true);
|
setWarnAfterDirDeploy(true);
|
||||||
setWarnBeforeMount(true);
|
setWarnBeforeMount(true);
|
||||||
|
|
||||||
SVersionRCFile sversion = SVersionRCFile.createInstance();
|
if (getOfficeDirectory() == null) {
|
||||||
|
SVersionRCFile sversion = SVersionRCFile.createInstance();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Hashtable versions = sversion.getVersions();
|
Enumeration enum = sversion.getVersions();
|
||||||
Enumeration enum = versions.elements();
|
OfficeInstallation oi;
|
||||||
String path;
|
|
||||||
|
|
||||||
while (enum.hasMoreElements()) {
|
while (enum.hasMoreElements()) {
|
||||||
path = (String)enum.nextElement();
|
oi = (OfficeInstallation)enum.nextElement();
|
||||||
File f = new File(path);
|
setOfficeDirectory(oi);
|
||||||
|
|
||||||
if (f.exists()) {
|
|
||||||
setOfficeDirectory(path);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (IOException ioe) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ioe) {
|
|
||||||
/* do nothing a default will be used */
|
|
||||||
}
|
|
||||||
|
|
||||||
// if no office version is found try a default value
|
|
||||||
setOfficeDirectory(System.getProperty("user.home") +
|
|
||||||
System.getProperty("file.separator") + "OpenOffice.org643");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String displayName() {
|
public String displayName() {
|
||||||
@@ -129,12 +123,12 @@ public class OfficeSettings extends SystemOption {
|
|||||||
return (OfficeSettings)findObject(OfficeSettings.class, true);
|
return (OfficeSettings)findObject(OfficeSettings.class, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOfficeDirectory() {
|
public OfficeInstallation getOfficeDirectory() {
|
||||||
return (String)getProperty(OFFICE_DIRECTORY);
|
return (OfficeInstallation)getProperty(OFFICE_DIRECTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOfficeDirectory(String path) {
|
public void setOfficeDirectory(OfficeInstallation oi) {
|
||||||
putProperty(OFFICE_DIRECTORY, path, true);
|
putProperty(OFFICE_DIRECTORY, oi, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getWarnBeforeDocDeploy() {
|
public boolean getWarnBeforeDocDeploy() {
|
||||||
|
Reference in New Issue
Block a user