summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-24 23:02:42 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-24 23:02:42 +0100
commit5453835a913fddf0b2336c09563cf4821efc46bf (patch)
treec3e3e9df45f307327d1991a92fc4341e5e46ebf1
parentfb37332199e4ee3e15a210f6980468b2e41b5fdd (diff)
parentad40506a82ea5e77e27ccc3d9ef95fe6490873c4 (diff)
Merge branch 'ooo-launcher'
Conflicts: core/build/MANIFEST.MF.in core/source/org/openoffice/ide/eclipse/core/helpers/SystemHelper.java core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java cpp/META-INF/MANIFEST.MF java/META-INF/MANIFEST.MF
-rw-r--r--[-rwxr-xr-x]core/.project80
-rw-r--r--[-rwxr-xr-x]core/META-INF/MANIFEST.MF6
-rw-r--r--[-rwxr-xr-x]core/build/MANIFEST.MF.in6
-rw-r--r--[-rwxr-xr-x]core/plugin.xml18
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java4
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java270
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java403
-rw-r--r--[-rwxr-xr-x]core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java4
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java100
-rw-r--r--[-rwxr-xr-x]core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java382
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/messages.properties3
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java59
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java80
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java23
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java252
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java237
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/launch/office/messages.properties24
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java35
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/config/IExtraOptionsProvider.java20
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java138
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/config/NullExtraOptionsProvider.java18
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/language/AbstractLanguage.java87
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java9
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java15
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java10
-rw-r--r--cpp/META-INF/MANIFEST.MF3
-rw-r--r--cpp/build/MANIFEST.MF.in5
-rw-r--r--cpp/source/org/openoffice/ide/eclipse/cpp/Language.java24
-rw-r--r--java/META-INF/MANIFEST.MF4
-rw-r--r--java/build/MANIFEST.MF.in6
-rw-r--r--java/source/org/openoffice/ide/eclipse/java/JavaDebugExtraOptionsProvider.java34
-rw-r--r--java/source/org/openoffice/ide/eclipse/java/Language.java62
32 files changed, 1744 insertions, 677 deletions
diff --git a/core/.project b/core/.project
index d640f8f..1fd0fc3 100755..100644
--- a/core/.project
+++ b/core/.project
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.openoffice.ide.eclipse.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.openoffice.ide.eclipse.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
diff --git a/core/META-INF/MANIFEST.MF b/core/META-INF/MANIFEST.MF
index 852debb..1e5611b 100755..100644
--- a/core/META-INF/MANIFEST.MF
+++ b/core/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-SymbolicName: org.openoffice.ide.eclipse.core; singleton:=true
Bundle-Version: 1.2.0
Bundle-Activator: org.openoffice.ide.eclipse.core.OOEclipsePlugin
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.core.runtime;visibility:=reexport,
org.eclipse.jface.text,
org.eclipse.core.resources,
org.eclipse.ui.editors,
@@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.help,
org.eclipse.ui.forms,
org.junit,
- org.eclipse.debug.core,
+ org.eclipse.debug.core;visibility:=reexport,
org.eclipse.debug.ui,
org.eclipse.ui;bundle-version="3.4.1",
javax.xml;bundle-version="1.3.4",
@@ -34,11 +34,13 @@ Export-Package: org.openoffice.ide.eclipse.core,
org.openoffice.ide.eclipse.core.editors.utils,
org.openoffice.ide.eclipse.core.gui,
org.openoffice.ide.eclipse.core.gui.rows,
+ org.openoffice.ide.eclipse.core.helpers,
org.openoffice.ide.eclipse.core.i18n,
org.openoffice.ide.eclipse.core.internal.helpers;x-internal:=true,
org.openoffice.ide.eclipse.core.internal.model;x-internal:=true,
org.openoffice.ide.eclipse.core.internal.office;x-internal:=true,
org.openoffice.ide.eclipse.core.launch,
+ org.openoffice.ide.eclipse.core.launch.office,
org.openoffice.ide.eclipse.core.model,
org.openoffice.ide.eclipse.core.model.config,
org.openoffice.ide.eclipse.core.model.description,
diff --git a/core/build/MANIFEST.MF.in b/core/build/MANIFEST.MF.in
index 5916611..506a7a0 100755..100644
--- a/core/build/MANIFEST.MF.in
+++ b/core/build/MANIFEST.MF.in
@@ -5,7 +5,7 @@ Bundle-SymbolicName: org.openoffice.ide.eclipse.core; singleton:=true
Bundle-Version: @VERSION@
Bundle-Activator: org.openoffice.ide.eclipse.core.OOEclipsePlugin
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.core.runtime;visibility:=reexport,
org.eclipse.jface.text,
org.eclipse.core.resources,
org.eclipse.ui.editors,
@@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.help,
org.eclipse.ui.forms,
org.junit,
- org.eclipse.debug.core,
+ org.eclipse.debug.core;visibility:=reexport,
org.eclipse.debug.ui,
org.eclipse.ui;bundle-version="3.4.1",
javax.xml;bundle-version="1.3.4",
@@ -34,11 +34,13 @@ Export-Package: org.openoffice.ide.eclipse.core,
org.openoffice.ide.eclipse.core.editors.utils,
org.openoffice.ide.eclipse.core.gui,
org.openoffice.ide.eclipse.core.gui.rows,
+ org.openoffice.ide.eclipse.core.helpers,
org.openoffice.ide.eclipse.core.i18n,
org.openoffice.ide.eclipse.core.internal.helpers;x-internal:=true,
org.openoffice.ide.eclipse.core.internal.model;x-internal:=true,
org.openoffice.ide.eclipse.core.internal.office;x-internal:=true,
org.openoffice.ide.eclipse.core.launch,
+ org.openoffice.ide.eclipse.core.launch.office,
org.openoffice.ide.eclipse.core.model,
org.openoffice.ide.eclipse.core.model.config,
org.openoffice.ide.eclipse.core.model.description,
diff --git a/core/plugin.xml b/core/plugin.xml
index 4491ae0..af031cb 100755..100644
--- a/core/plugin.xml
+++ b/core/plugin.xml
@@ -263,6 +263,14 @@
id="org.openoffice.ide.eclipse.core.launchUreApplication"
modes="run"
name="URE Application"/>
+ <launchConfigurationType
+ delegate="org.openoffice.ide.eclipse.core.launch.office.OfficeLaunchDelegate"
+ delegateDescription="The Open Office launcher supports running and remote debugging Open Office extensions."
+ delegateName="Open Office Launcher"
+ id="org.openoffice.ide.eclipse.core.launchOpenOffice"
+ modes="run,debug"
+ name="Open Office Application">
+ </launchConfigurationType>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
@@ -270,6 +278,11 @@
class="org.openoffice.ide.eclipse.core.launch.LaunchConfigurationTabs"
id="org.openoffice.ide.eclipse.core.launchConfigurationTabGroup1"
type="org.openoffice.ide.eclipse.core.launchUreApplication"/>
+ <launchConfigurationTabGroup
+ class="org.openoffice.ide.eclipse.core.launch.office.LaunchConfigurationTabs"
+ id="org.openoffice.ide.eclipse.core.OfficeLlaunchConfigurationTabGroup1"
+ type="org.openoffice.ide.eclipse.core.launchOpenOffice">
+ </launchConfigurationTabGroup>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
@@ -277,6 +290,11 @@
configTypeID="org.openoffice.ide.eclipse.core.launchUreApplication"
icon="icons/ure_app.gif"
id="org.openoffice.ide.eclipse.core.UreLaunchIcon"/>
+ <launchConfigurationTypeImage
+ configTypeID="org.openoffice.ide.eclipse.core.launchOpenOffice"
+ icon="icons/ooo16.png"
+ id="org.openoffice.ide.eclipse.core.OfficeLaunchIcon">
+ </launchConfigurationTypeImage>
</extension>
<extension
point="org.eclipse.ui.exportWizards">
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
index ff5d52e..9f3d2b0 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
@@ -105,6 +105,10 @@ public class UnoidlProjectHelper {
* Project relative path to the idl root folder.
*/
public static final String IDL_BASIS = "/idl"; //$NON-NLS-1$
+
+ public static final String DIST_BASIS = "dist"; //$NON-NLS-1$
+
+ public static final String OO_PROFILE_BASIS = ".ooo-debug";
/**
* Create a default configuration file for UNO-IDL projects.
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
index cff6ee1..09f1254 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
@@ -47,67 +47,75 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.swt.graphics.Image;
+import org.openoffice.ide.eclipse.core.PluginLogger;
import org.openoffice.ide.eclipse.core.gui.ITableElement;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.OOoContainer;
+import org.openoffice.ide.eclipse.core.model.config.IExtraOptionsProvider;
import org.openoffice.ide.eclipse.core.model.config.IOOo;
import org.openoffice.ide.eclipse.core.model.config.InvalidConfigException;
import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
/**
- * Helper class to add the table element features to the OOo classes. All the
- * {@link IOOo} interface still has to be implemented by the subclasses
+ * Helper class to add the table element features to the OOo classes. All the {@link IOOo} interface still has to be
+ * implemented by the subclasses
*
* @author cbosdonnat
- *
+ *
*/
public abstract class AbstractOOo implements IOOo, ITableElement {
public static final String NAME = "__ooo_name"; //$NON-NLS-1$
-
+
public static final String PATH = "__ooo_path"; //$NON-NLS-1$
protected static final String FILE_SEP = System.getProperty("file.separator"); //$NON-NLS-1$
-
+
private static String sPlatform;
-
+
private String mHome;
private String mName;
-
+
/**
* Creating a new OOo or URE instance specifying its home directory.
*
- * @param pOooHome the OpenOffice.org or URE home directory
- * @throws InvalidConfigException is thrown if the home directory doesn't
- * contains the required files and directories
+ * @param pOooHome
+ * the OpenOffice.org or URE home directory
+ * @throws InvalidConfigException
+ * is thrown if the home directory doesn't contains the required files and directories
*/
public AbstractOOo(String pOooHome) throws InvalidConfigException {
setHome(pOooHome);
}
-
+
/**
* Creating a new OOo or URE instance specifying its home directory and name.
*
- * @param pOooHome the OpenOffice.org or URE installation directory
- * @param pName the OpenOffice.org or URE instance name
+ * @param pOooHome
+ * the OpenOffice.org or URE installation directory
+ * @param pName
+ * the OpenOffice.org or URE instance name
*
- * @throws InvalidConfigException if the home directory doesn't
- * contains the required files and directories
+ * @throws InvalidConfigException
+ * if the home directory doesn't contains the required files and directories
*/
public AbstractOOo(String pOooHome, String pName) throws InvalidConfigException {
setHome(pOooHome);
setName(pName);
}
-
+
/**
* {@inheritDoc}
*/
@@ -115,120 +123,110 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
Path homePath = new Path(pHome);
File homeFile = homePath.toFile();
-
+
/* Checks if the directory exists */
if (!homeFile.isDirectory() || !homeFile.canRead()) {
mHome = null;
- throw new InvalidConfigException(
- Messages.getString("AbstractOOo.NoDirectoryError") + //$NON-NLS-1$
- homeFile.getAbsolutePath(),
- InvalidConfigException.INVALID_OOO_HOME);
+ throw new InvalidConfigException(Messages.getString("AbstractOOo.NoDirectoryError") + //$NON-NLS-1$
+ homeFile.getAbsolutePath(), InvalidConfigException.INVALID_OOO_HOME);
}
-
+
mHome = pHome;
-
+
/* Checks if the classes paths are directories */
checkClassesDir();
-
+
/* Checks if types registries are readable files */
checkTypesRdb();
-
+
/* Checks if services.rdb is a readable file */
checkServicesRdb();
-
+
/* Checks if unorc is a readable file */
checkUnoIni();
}
-
+
/**
* {@inheritDoc}
*/
public String getHome() {
return mHome;
}
-
+
/**
* {@inheritDoc}
*/
public String getName() {
return mName;
}
-
+
/**
- * Set the new name only if it's neither null nor the empty string. The name
- * will be rendered unique and therefore may be changed.
+ * Set the new name only if it's neither null nor the empty string. The name will be rendered unique and therefore
+ * may be changed.
*
- * @param pName the name to set
+ * @param pName
+ * the name to set
*/
protected void setName(String pName) {
if (pName != null && !pName.equals("")) { //$NON-NLS-1$
mName = OOoContainer.getUniqueName(pName);
}
}
-
+
/**
- * Check if the UNO configuration file is present in the OOo
- * installation directory.
+ * Check if the UNO configuration file is present in the OOo installation directory.
*
- * @throws InvalidConfigException if the UNO configuration file
- * isn't present.
+ * @throws InvalidConfigException
+ * if the UNO configuration file isn't present.
*/
private void checkUnoIni() throws InvalidConfigException {
Path unorcPath = new Path(getUnorcPath());
File unorcFile = unorcPath.toFile();
-
+
if (!unorcFile.isFile() || !unorcFile.canRead()) {
mHome = null;
- throw new InvalidConfigException(
- Messages.getString("AbstractOOo.NoFileError") + //$NON-NLS-1$
- unorcFile.getAbsolutePath(),
- InvalidConfigException.INVALID_OOO_HOME);
+ throw new InvalidConfigException(Messages.getString("AbstractOOo.NoFileError") + //$NON-NLS-1$
+ unorcFile.getAbsolutePath(), InvalidConfigException.INVALID_OOO_HOME);
}
}
/**
- * Check if the <code>services.rdb</code> file is present in the OOo
- * installation directory.
+ * Check if the <code>services.rdb</code> file is present in the OOo installation directory.
*
- * @throws InvalidConfigException if the <code>services.rdb</code> file
- * isn't present
+ * @throws InvalidConfigException
+ * if the <code>services.rdb</code> file isn't present
*/
private void checkServicesRdb() throws InvalidConfigException {
String[] paths = getServicesPath();
-
+
for (String path : paths) {
Path servicesPath = new Path(path);
File servicesFile = servicesPath.toFile();
-
+
if (!servicesFile.isFile() || !servicesFile.canRead()) {
mHome = null;
- throw new InvalidConfigException(
- Messages.getString("AbstractOOo.NoFileError") + //$NON-NLS-1$
- servicesFile.getAbsolutePath(),
- InvalidConfigException.INVALID_OOO_HOME);
- }
+ throw new InvalidConfigException(Messages.getString("AbstractOOo.NoFileError") + //$NON-NLS-1$
+ servicesFile.getAbsolutePath(), InvalidConfigException.INVALID_OOO_HOME);
+ }
}
}
/**
- * Check if the <code>types.rdb</code> file is present in the OOo
- * installation directory.
+ * Check if the <code>types.rdb</code> file is present in the OOo installation directory.
*
- * @throws InvalidConfigException if the <code>types.rdb</code> file
- * isn't present
+ * @throws InvalidConfigException
+ * if the <code>types.rdb</code> file isn't present
*/
private void checkTypesRdb() throws InvalidConfigException {
String[] paths = getTypesPath();
for (String path : paths) {
Path typesPath = new Path(path);
File typesFile = typesPath.toFile();
-
+
if (!typesFile.isFile() || !typesFile.canRead()) {
mHome = null;
- throw new InvalidConfigException(
- Messages.getString("AbstractOOo.NoFileError") + //$NON-NLS-1$
- typesFile.getAbsolutePath(),
- InvalidConfigException.INVALID_OOO_HOME);
+ throw new InvalidConfigException(Messages.getString("AbstractOOo.NoFileError") + //$NON-NLS-1$
+ typesFile.getAbsolutePath(), InvalidConfigException.INVALID_OOO_HOME);
}
}
}
@@ -236,26 +234,25 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
/**
* Check if the classes directory exits in the OOo installation folder.
*
- * @throws InvalidConfigException if the classes directory can't be found
+ * @throws InvalidConfigException
+ * if the classes directory can't be found
*/
private void checkClassesDir() throws InvalidConfigException {
String[] paths = getClassesPath();
for (String path : paths) {
Path javaPath = new Path(path);
File javaDir = javaPath.toFile();
-
+
if (!javaDir.isDirectory() || !javaDir.canRead()) {
mHome = null;
- throw new InvalidConfigException(
- Messages.getString("AbstractOOo.NoDirectoryError") + //$NON-NLS-1$
- javaDir.getAbsolutePath(),
- InvalidConfigException.INVALID_OOO_HOME);
- }
+ throw new InvalidConfigException(Messages.getString("AbstractOOo.NoDirectoryError") + //$NON-NLS-1$
+ javaDir.getAbsolutePath(), InvalidConfigException.INVALID_OOO_HOME);
+ }
}
}
-
- //-------------------------------------------- ITableElement Implementation
-
+
+ // -------------------------------------------- ITableElement Implementation
+
/**
* {@inheritDoc}
*/
@@ -280,7 +277,7 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
* {@inheritDoc}
*/
public String[] getProperties() {
- return new String[] {NAME, PATH};
+ return new String[] { NAME, PATH };
}
/**
@@ -303,79 +300,134 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
public void setValue(String pProperty, Object pValue) {
// Nothing to do
}
-
+
/**
- * Run a UNO application using an implementation of the <code>XMain</code>
- * interface.
+ * Run a UNO application using an implementation of the <code>XMain</code> interface.
*
- * @param pPrj the UNO project to run
- * @param pMain the fully qualified name of the main service to run
- * @param pArgs the UNO program arguments
- * @param pLaunch the Eclipse launch instance
- * @param pMonitor the monitor reporting the run progress
+ * @param pPrj
+ * the UNO project to run
+ * @param pMain
+ * the fully qualified name of the main service to run
+ * @param pArgs
+ * the UNO program arguments
+ * @param pLaunch
+ * the Eclipse launch instance
+ * @param pMonitor
+ * the monitor reporting the run progress
*/
- public void runUno(IUnoidlProject pPrj, String pMain, String pArgs,
- ILaunch pLaunch, IProgressMonitor pMonitor) {
-
+ public void runUno(IUnoidlProject pPrj, String pMain, String pArgs, ILaunch pLaunch, IProgressMonitor pMonitor) {
+
String libpath = pPrj.getLanguage().getProjectHandler().getLibraryPath(pPrj);
libpath = libpath.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
libpath = libpath.replace(" ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$
libpath = "file:///" + libpath; //$NON-NLS-1$
-
+
String unoPath = getUnoPath();
if (getPlatform().equals(Platform.OS_WIN32)) {
/* uno is already in the PATH variable, so don't worry */
unoPath = "uno"; //$NON-NLS-1$
}
-
- String command = unoPath +
- " -c " + pMain + //$NON-NLS-1$
- " -l " + libpath + //$NON-NLS-1$
- " -- " + pArgs; //$NON-NLS-1$
-
+
+ String command = unoPath + " -c " + pMain + //$NON-NLS-1$
+ " -l " + libpath + //$NON-NLS-1$
+ " -- " + pArgs; //$NON-NLS-1$
+
String[] env = pPrj.getLanguage().getLanguageBuidler().getBuildEnv(pPrj);
-
- IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject( pPrj.getName() );
-
+
+ IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(pPrj.getName());
+
if (getJavaldxPath() != null) {
- Process p = pPrj.getSdk().runToolWithEnv(prj,
- pPrj.getOOo(), getJavaldxPath(), env, pMonitor);
+ Process p = pPrj.getSdk().runToolWithEnv(prj, pPrj.getOOo(), getJavaldxPath(), env, pMonitor);
InputStream out = p.getInputStream();
StringWriter writer = new StringWriter();
-
+
try {
int c = out.read();
while (c != -1) {
writer.write(c);
c = out.read();
}
- } catch (IOException e) {
+ } catch (IOException e) {
}
-
+
String libPath = writer.getBuffer().toString();
- env = SystemHelper.addEnv(env, "LD_LIBRARY_PATH", libPath.trim(), //$NON-NLS-1$
- System.getProperty("path.separator")); //$NON-NLS-1$
+ env = SystemHelper.addEnv(env, "LD_LIBRARY_PATH", libPath.trim(), //$NON-NLS-1$
+ System.getProperty("path.separator")); //$NON-NLS-1$
}
-
+
Process p = pPrj.getSdk().runToolWithEnv(prj, pPrj.getOOo(), command, env, pMonitor);
- DebugPlugin.newProcess(pLaunch, p, Messages.getString("AbstractOOo.UreProcessName") + pMain); //$NON-NLS-1$
+ DebugPlugin.newProcess(pLaunch, p, Messages.getString("AbstractOOo.UreProcessName") + pMain); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void runOpenOffice(IUnoidlProject pPrj, ILaunch pLaunch, IPath pUserInstallation,
+ IExtraOptionsProvider pExtraOptionsProvider, IProgressMonitor pMonitor) {
+ try {
+ IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(pPrj.getName());
+ String[] env = pPrj.getLanguage().getLanguageBuidler().getBuildEnv(pPrj);
+
+ String pathSeparator = System.getProperty("path.separator");
+ String[] sPaths = pPrj.getOOo().getBinPath();
+ StringBuilder sPathValue = new StringBuilder();
+ for (String sPath : sPaths) {
+ sPathValue.append(sPath);
+ sPathValue.append(pathSeparator);
+ }
+
+ String command = "soffice.bin";
+
+ env = SystemHelper.addEnv(env, "PATH", sPathValue.toString(), pathSeparator);
+ env = addUserProfile(pUserInstallation, env);
+ env = pExtraOptionsProvider.addEnv(env);
+
+ PluginLogger.debug("Launching OpenOffice from commandline: " + command);
+ Process p = pPrj.getSdk().runToolWithEnv(prj, pPrj.getOOo(), command, env, pMonitor);
+ DebugPlugin.newProcess(pLaunch, p, Messages.getString("AbstractOOo.OpenOfficeProcessName")); //$NON-NLS-1$
+ } catch (Exception e) {
+ e.printStackTrace();
+ PluginLogger.error("Error running OpenOffice", e);
+ }
+ }
+
+ /**
+ * Adds the proper env variables for the user profile.
+ *
+ * @param pUserInstallation
+ * the path to the user profile foldr.
+ * @param pEnv
+ * the original env.
+ * @return the new env.
+ * @throws URISyntaxException
+ * if something goes wrong.
+ */
+ protected String[] addUserProfile(IPath pUserInstallation, String[] pEnv) throws URISyntaxException {
+ if (null != pUserInstallation) {
+ // We have to turn the path to a URI something like file:///foo/bar/.ooo-debug
+ // TODO find a better way to get the proper URI.
+ URI userInstallationURI = new URI("file", "", pUserInstallation.toFile().toURI().getPath(), null);
+ pEnv = SystemHelper.addEnv(pEnv, "UserInstallation", userInstallationURI.toString(), null);
+ }
+ return pEnv;
}
-
+
/**
* Sets the target platform for tests.
*
- * @param pPlatform the target platform
+ * @param pPlatform
+ * the target platform
*/
- public static void setPlatform( String pPlatform ) {
+ public static void setPlatform(String pPlatform) {
sPlatform = pPlatform;
}
-
+
/**
* @return the system platform, or the test one if set.
*/
- protected String getPlatform( ) {
+ protected String getPlatform() {
String result = sPlatform;
- if ( sPlatform == null) {
+ if (sPlatform == null) {
result = Platform.getOS();
}
return result;
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
index 2700ff2..ffa39d7 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
@@ -49,6 +49,7 @@ import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.Properties;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -60,148 +61,150 @@ import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
/**
* Representing an OpenOffice.org instance for use in the UNO-IDL projects.
*
- * <p>An OpenOffice.org instance is recognized to the following files:
- * <ul>
- * <li><code>program/classes</code> directory</li>
- * <li><code>program/types.rdb</code> registry</li>
- * <li><code>program/bootstraprc</code> file</li>
- * </ul>
+ * <p>
+ * An OpenOffice.org instance is recognized to the following files:
+ * <ul>
+ * <li><code>program/classes</code> directory</li>
+ * <li><code>program/types.rdb</code> registry</li>
+ * <li><code>program/bootstraprc</code> file</li>
+ * </ul>
* </p>
*
- * <p>A MacOS installation of OpenOffice.org will have some different paths, and
- * of course the windows installation too. This class is used to abstract the
- * platform OOo is installed on.</p>
+ * <p>
+ * A MacOS installation of OpenOffice.org will have some different paths, and of course the windows installation too.
+ * This class is used to abstract the platform OOo is installed on.
+ * </p>
*
* @author cedricbosdo
- *
+ *
*/
public class OOo extends AbstractOOo {
-
+
/**
- * private constant that holds the ooo name key in the bootstrap
- * properties file.
+ * private constant that holds the ooo name key in the bootstrap properties file.
*/
- private static final String K_PRODUCTKEY = "ProductKey"; //$NON-NLS-1$
-
+ private static final String K_PRODUCTKEY = "ProductKey"; //$NON-NLS-1$
+
private boolean mDoRemovePackage = false;
-
+
private OOo3PathMapper mMapper;
-
+
/**
* Creating a new OOo instance specifying its home directory.
*
- * @param pOooHome the OpenOffice.org home directory
+ * @param pOooHome
+ * the OpenOffice.org home directory
*
- * @throws InvalidConfigException is thrown if the home directory doesn't
- * contains the required files and directories
+ * @throws InvalidConfigException
+ * is thrown if the home directory doesn't contains the required files and directories
*/
public OOo(String pOooHome) throws InvalidConfigException {
super(pOooHome);
}
-
+
/**
* Creating a new OOo instance specifying its home directory and name.
*
- * @param pOooHome the OpenOffice.org installation path
- * @param pOooName the OpenOffice.org instance name
+ * @param pOooHome
+ * the OpenOffice.org installation path
+ * @param pOooName
+ * the OpenOffice.org instance name
*
- * @throws InvalidConfigException is thrown if the home directory doesn't
- * contains the required files and directories
+ * @throws InvalidConfigException
+ * is thrown if the home directory doesn't contains the required files and directories
*/
public OOo(String pOooHome, String pOooName) throws InvalidConfigException {
super(pOooHome, pOooName);
}
-
- //----------------------------------------------------- IOOo Implementation
-
+
+ // ----------------------------------------------------- IOOo Implementation
+
/**
* Overridden to initialize the path mapper for 00o3 installations.
*
- * @param pHome the OOo installation path to set.
+ * @param pHome
+ * the OOo installation path to set.
*
- * @throws InvalidConfigException if the path doesn't point to a
- * valid OOo installation.
+ * @throws InvalidConfigException
+ * if the path doesn't point to a valid OOo installation.
*/
@Override
public void setHome(String pHome) throws InvalidConfigException {
-
+
if (getPlatform().equals(Platform.OS_MACOSX)) {
pHome = pHome + FILE_SEP + "Contents"; //$NON-NLS-1$
}
-
+
mMapper = new OOo3PathMapper(pHome);
super.setHome(pHome);
}
-
+
/**
* {@inheritDoc}
*/
public String[] getClassesPath() {
-
- String[] paths = new String[] {
- getLibsPath()[0] + FILE_SEP + "classes" //$NON-NLS-1$
+
+ String[] paths = new String[] { getLibsPath()[0] + FILE_SEP + "classes" //$NON-NLS-1$
};
-
+
if (mMapper.isVersion3()) {
paths = mMapper.getClasses();
}
-
+
return paths;
}
-
+
/**
* {@inheritDoc}
*/
public String[] getLibsPath() {
// Nothing if not OOo3
String[] otherPaths = mMapper.getAdditionnalLibs();
-
+
String libs = getHome() + FILE_SEP + "program"; //$NON-NLS-1$
if (getPlatform().equals(Platform.OS_MACOSX)) {
libs = getHome() + FILE_SEP + "MacOS"; //$NON-NLS-1$
}
-
- return mMapper.mergeArrays(new String[]{ libs }, otherPaths);
+
+ return mMapper.mergeArrays(new String[] { libs }, otherPaths);
}
-
+
/**
* {@inheritDoc}
*/
public String[] getBinPath() {
// Nothing if not OOo3
String[] otherPaths = mMapper.getAdditionnalBins();
-
+
String bins = getHome() + FILE_SEP + "program"; //$NON-NLS-1$
if (Platform.getOS().equals(Platform.OS_MACOSX)) {
bins = getHome() + FILE_SEP + "MacOS"; //$NON-NLS-1$
}
-
- return mMapper.mergeArrays(new String[]{ bins }, otherPaths);
+
+ return mMapper.mergeArrays(new String[] { bins }, otherPaths);
}
-
+
/**
* {@inheritDoc}
*/
public String[] getTypesPath() {
- String[] paths = {
- getLibsPath()[0] + FILE_SEP + "types.rdb" //$NON-NLS-1$
+ String[] paths = { getLibsPath()[0] + FILE_SEP + "types.rdb" //$NON-NLS-1$
};
-
+
if (mMapper.isVersion3()) {
paths = mMapper.getTypes();
}
-
- return paths;
+
+ return paths;
}
/**
* {@inheritDoc}
*/
public String[] getServicesPath() {
- String[] paths = new String[] {
- getLibsPath()[0] + FILE_SEP + "services.rdb" //$NON-NLS-1$
+ String[] paths = new String[] { getLibsPath()[0] + FILE_SEP + "services.rdb" //$NON-NLS-1$
};
-
+
// Change the paths for OOo3 installs
if (mMapper.isVersion3()) {
paths = mMapper.getServices();
@@ -221,7 +224,7 @@ public class OOo extends AbstractOOo {
}
return path;
}
-
+
/**
* {@inheritDoc}
*/
@@ -231,74 +234,73 @@ public class OOo extends AbstractOOo {
uno = "uno.exe"; //$NON-NLS-1$
}
String unoPath = getLibsPath()[0] + FILE_SEP + uno;
-
+
if (mMapper.isVersion3()) {
unoPath = mMapper.getUnoPath();
}
-
+
return unoPath;
}
-
+
/**
* {@inheritDoc}
*/
protected void setName(String pName) {
-
+
String name = pName;
if (name == null || name.equals("")) { //$NON-NLS-1$
name = getOOoName();
}
-
+
super.setName(name);
}
-
+
/**
* @return The OOo name as defined in Bootstraprc or <code>null</code>.
*/
private String getOOoName() {
-
+
String oooname = null;
-
+
Path unorcPath = new Path(getUnorcPath());
File unorcFile = unorcPath.toFile();
-
+
if (unorcFile.exists() && unorcFile.isFile()) {
-
+
Properties bootstraprcProperties = new Properties();
try {
- bootstraprcProperties.load(
- new FileInputStream(unorcFile));
-
+ bootstraprcProperties.load(new FileInputStream(unorcFile));
+
// Checks if the name and buildid properties are set
if (bootstraprcProperties.containsKey(K_PRODUCTKEY)) {
-
+
// Sets the both value
oooname = bootstraprcProperties.getProperty(K_PRODUCTKEY);
}
-
+
} catch (Exception e) {
// Nothing to report
}
}
-
+
return oooname;
}
-
+
/**
* {@inheritDoc}
*/
public String toString() {
return "OOo " + getName(); //$NON-NLS-1$
}
-
+
/**
* {@inheritDoc}
*/
- public String createUnoCommand(String pImplementationName, String pLibLocation,
- String[] pRegistriesPaths, String[] pArgs) {
-
+ public String createUnoCommand(String pImplementationName, String pLibLocation, String[] pRegistriesPaths,
+ String[] pArgs) {
+
String command = ""; //$NON-NLS-1$
-
+
if (pLibLocation != null && !pLibLocation.equals("")) { //$NON-NLS-1$
// Put the args into one string
String sArgs = ""; //$NON-NLS-1$
@@ -328,8 +330,7 @@ public class OOo extends AbstractOOo {
for (int i = 0, length = content.length; i < length; i++) {
String contenti = content[i];
if (contenti.endsWith(".jar")) { //$NON-NLS-1$
- classpath += oooClassesPath +
- fileSeparator + contenti + pathSeparator;
+ classpath += oooClassesPath + fileSeparator + contenti + pathSeparator;
}
}
}
@@ -340,86 +341,90 @@ public class OOo extends AbstractOOo {
}
command = "java " + classpath + " " + //$NON-NLS-1$ //$NON-NLS-2$
- pImplementationName + " " + sArgs; //$NON-NLS-1$
+ pImplementationName + " " + sArgs; //$NON-NLS-1$
}
-
+
return command;
}
-
+
/**
* {@inheritDoc}
*/
public String getJavaldxPath() {
String javaldx = getLibsPath() + FILE_SEP + "javaldx"; //$NON-NLS-1$
- return javaldx;
+ return javaldx;
}
-
+
/**
* {@inheritDoc}
*/
public boolean canManagePackages() {
return true;
}
-
+
/**
* {@inheritDoc}
*/
- public void updatePackage(File pPackageFile) {
-
+ public void updatePackage(File pPackageFile, IPath pUserInstallation) {
+
// Check if there is already a package with the same name
try {
- if (containsPackage(pPackageFile.getName())) {
+ if (containsPackage(pPackageFile.getName(), pUserInstallation)) {
mDoRemovePackage = false;
Display.getDefault().syncExec(new Runnable() {
public void run() {
- mDoRemovePackage = MessageDialog.openConfirm(Display.getDefault().getActiveShell(),
- Messages.getString("OOo.PackageExportTitle"), //$NON-NLS-1$
- Messages.getString("OOo.PackageAlreadyInstalled")); //$NON-NLS-1$
+ mDoRemovePackage = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), Messages
+ .getString("OOo.PackageExportTitle"), //$NON-NLS-1$
+ Messages.getString("OOo.PackageAlreadyInstalled")); //$NON-NLS-1$
}
});
if (mDoRemovePackage) {
// remove it
- removePackage(pPackageFile.getName());
+ removePackage(pPackageFile.getName(), pUserInstallation);
}
}
// Add the package
- addPackage(pPackageFile);
+ addPackage(pPackageFile, pUserInstallation);
} catch (Exception e) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- MessageDialog.openError(Display.getDefault().getActiveShell(),
- Messages.getString("OOo.PackageExportTitle"), //$NON-NLS-1$
- Messages.getString("OOo.DeploymentError")); //$NON-NLS-1$
+ MessageDialog.openError(Display.getDefault().getActiveShell(), Messages
+ .getString("OOo.PackageExportTitle"), //$NON-NLS-1$
+ Messages.getString("OOo.DeploymentError")); //$NON-NLS-1$
}
});
PluginLogger.error(Messages.getString("OOo.DeploymentError"), e); //$NON-NLS-1$
}
}
-
+
/**
* Add a Uno package to the OOo user packages.
*
- * FIXME This method has to handle license ap
- * proval
+ * FIXME This method has to handle license ap proval
*
- * @param pPackageFile the package file to add
- * @throws Exception if anything wrong happens
+ * @param pPackageFile
+ * the package file to add
+ * @param pUserInstallation
+ * path to the user profile folder.
+ * @throws Exception
+ * if anything wrong happens
*/
- private void addPackage(File pPackageFile) throws Exception {
+ private void addPackage(File pPackageFile, IPath pUserInstallation) throws Exception {
String path = pPackageFile.getAbsolutePath();
if (getPlatform().equals(Platform.OS_WIN32)) {
path = "\"" + path + "\""; //$NON-NLS-1$ //$NON-NLS-2$
}
String shellCommand = "unopkg gui -f " + path; //$NON-NLS-1$
-
+
String[] env = SystemHelper.getSystemEnvironement();
String pathsep = System.getProperty("path.separator"); //$NON-NLS-1$
env = SystemHelper.addEnv(env, "PATH", getHome() + FILE_SEP + "program", pathsep); //$NON-NLS-1$ //$NON-NLS-2$
-
+ env = addUserProfile(pUserInstallation, env);
+
Process process = SystemHelper.runTool(shellCommand, env, null);
-
+
InputStreamReader in = new InputStreamReader(process.getInputStream());
LineNumberReader reader = new LineNumberReader(in);
@@ -431,54 +436,63 @@ public class OOo extends AbstractOOo {
}
line = reader.readLine();
}
-
+
try {
reader.close();
in.close();
} catch (Exception e) {
}
-
+
if (failed) {
- throw new Exception(Messages.getString("OOo.PackageAddError") + //$NON-NLS-1$
- pPackageFile.getAbsolutePath());
+ throw new Exception(Messages.getString("OOo.PackageAddError") + //$NON-NLS-1$
+ pPackageFile.getAbsolutePath());
}
}
-
+
/**
* Remove the named package from the OOo packages.
*
- * @param pName the name of the package to remove
- * @throws Exception if anything wrong happens
+ * @param pName
+ * the name of the package to remove
+ * @param pUuserInstallation
+ * TODO
+ * @throws Exception
+ * if anything wrong happens
*/
- private void removePackage(String pName) throws Exception {
+ private void removePackage(String pName, IPath pUuserInstallation) throws Exception {
String shellCommand = "unopkg remove " + pName; //$NON-NLS-1$
-
+
String[] env = SystemHelper.getSystemEnvironement();
String filesep = System.getProperty("file.separator"); //$NON-NLS-1$
String pathsep = System.getProperty("path.separator"); //$NON-NLS-1$
env = SystemHelper.addEnv(env, "PATH", getHome() + filesep + "program", pathsep); //$NON-NLS-1$ //$NON-NLS-2$
-
+ env = addUserProfile(pUuserInstallation, env);
+
SystemHelper.runTool(shellCommand, env, null);
}
-
+
/**
* Check if the named package is already installed on OOo.
*
- * @param pName the package name to look for
- * @return <code>true</code> if the package is installed,
- * <code>false</code> otherwise
- * @throws Exception if anything wrong happens
+ * @param pName
+ * the package name to look for
+ * @param pUserInstallation
+ * path to the user profile.
+ * @return <code>true</code> if the package is installed, <code>false</code> otherwise
+ * @throws Exception
+ * if anything wrong happens
*/
- private boolean containsPackage(String pName) throws Exception {
+ private boolean containsPackage(String pName, IPath pUserInstallation) throws Exception {
boolean contained = false;
-
+
String shellCommand = "unopkg list"; //$NON-NLS-1$
-
+
String[] env = SystemHelper.getSystemEnvironement();
String filesep = System.getProperty("file.separator"); //$NON-NLS-1$
String pathsep = System.getProperty("path.separator"); //$NON-NLS-1$
env = SystemHelper.addEnv(env, "PATH", getHome() + filesep + "program", pathsep); //$NON-NLS-1$ //$NON-NLS-2$
-
+ env = addUserProfile(pUserInstallation, env);
+
Process process = SystemHelper.runTool(shellCommand, env, null);
InputStreamReader in = new InputStreamReader(process.getInputStream());
LineNumberReader reader = new LineNumberReader(in);
@@ -490,56 +504,57 @@ public class OOo extends AbstractOOo {
}
line = reader.readLine();
}
-
+
try {
reader.close();
in.close();
} catch (Exception e) {
}
-
+
return contained;
}
-
+
/**
* A class providing the paths for the OOo3 installation.
*
* @author cbosdonnat
- *
+ *
*/
private class OOo3PathMapper {
-
+
private String mHome;
private String mBasis;
-
+
private boolean mVersionChecked = false;
-
+
/**
* This field holds the URE instance to use for OOo3.
*/
private URE mUre;
-
+
/**
* Create a new mapper object to get the OOo3 layers paths.
*
- * @param pHome the OOo install home
+ * @param pHome
+ * the OOo install home
*/
public OOo3PathMapper(String pHome) {
mHome = pHome;
}
/**
- * @return <code>true</code> if the openoffice install corresponds to a 3.0
- * installation layout, <code>false</code> otherwise.
+ * @return <code>true</code> if the openoffice install corresponds to a 3.0 installation layout,
+ * <code>false</code> otherwise.
*/
public boolean isVersion3() {
boolean version3 = false;
-
- if (!mVersionChecked ) {
+
+ if (!mVersionChecked) {
try {
Path homePath = new Path(mHome);
File homeFile = homePath.toFile();
- File basis = getPortableLink("basis-link",homeFile); //$NON-NLS-1$
+ File basis = getPortableLink("basis-link", homeFile); //$NON-NLS-1$
File ure = getPortableLink("ure-link", basis); //$NON-NLS-1$
version3 = basis.isDirectory() && ure.isDirectory();
@@ -551,147 +566,147 @@ public class OOo extends AbstractOOo {
} catch (Exception e) {
version3 = false;
}
-
+
mVersionChecked = true;
} else {
version3 = mUre != null;
}
-
+
return version3;
}
-
+
/**
- * @return the libraries path to add for OOo3 or an empty array if not an
- * OOo3 install.
+ * @return the libraries path to add for OOo3 or an empty array if not an OOo3 install.
*/
public String[] getAdditionnalLibs() {
String[] additionnal = new String[0];
-
+
if (isVersion3()) {
String[] ureLibs = mUre.getLibsPath();
String basisLibs = mBasis + FILE_SEP + "program"; //$NON-NLS-1$
-
- additionnal = mergeArrays(ureLibs, new String[]{basisLibs});
+
+ additionnal = mergeArrays(ureLibs, new String[] { basisLibs });
}
-
+
return additionnal;
}
-
+
/**
- * @return the binaries path to add for OOo3 or an empty array if not an
- * OOo3 install.
+ * @return the binaries path to add for OOo3 or an empty array if not an OOo3 install.
*/
public String[] getAdditionnalBins() {
String[] additionnal = new String[0];
-
+
if (isVersion3()) {
String[] ureBins = mUre.getBinPath();
String basisBins = mBasis + FILE_SEP + "program"; //$NON-NLS-1$
-
- additionnal = mergeArrays(ureBins, new String[]{basisBins});
+
+ additionnal = mergeArrays(ureBins, new String[] { basisBins });
}
-
+
return additionnal;
}
-
+
/**
* @return the OOo 3.0 classes path or an empty array if not an OOo3 install.
*/
public String[] getClasses() {
String[] classes = new String[0];
-
+
if (isVersion3()) {
String[] ureClasses = mUre.getClassesPath();
String basisClasses = mBasis + FILE_SEP + "program" + //$NON-NLS-1$
- FILE_SEP + "classes"; //$NON-NLS-1$
-
- classes = mergeArrays(ureClasses, new String[]{basisClasses});
+ FILE_SEP + "classes"; //$NON-NLS-1$
+
+ classes = mergeArrays(ureClasses, new String[] { basisClasses });
}
-
+
return classes;
}
-
+
/**
* @return the OOo3 types path or an empty array if not an OOo3 install.
*/
public String[] getTypes() {
String[] types = new String[0];
-
+
if (isVersion3()) {
String[] ureTypes = mUre.getTypesPath();
String basisTypes = mBasis + FILE_SEP + "program" + //$NON-NLS-1$
- FILE_SEP + "offapi.rdb"; //$NON-NLS-1$
-
- types = mergeArrays(ureTypes, new String[]{basisTypes});
+ FILE_SEP + "offapi.rdb"; //$NON-NLS-1$
+
+ types = mergeArrays(ureTypes, new String[] { basisTypes });
}
-
+
return types;
}
-
+
/**
* @return the OOo3 services.rdb files or <code>null</code> if not an OOo3 install.
*/
public String[] getServices() {
String[] types = new String[0];
-
+
if (isVersion3()) {
String[] ureTypes = mUre.getServicesPath();
String basisTypes = mBasis + FILE_SEP + "program" + //$NON-NLS-1$
- FILE_SEP + "services.rdb"; //$NON-NLS-1$
-
- types = mergeArrays(ureTypes, new String[]{basisTypes});
+ FILE_SEP + "services.rdb"; //$NON-NLS-1$
+
+ types = mergeArrays(ureTypes, new String[] { basisTypes });
}
-
+
return types;
}
-
+
/**
- * @return the path to the uno executable for OOo3 of <code>null</code> if
- * not an OOo3 install.
+ * @return the path to the uno executable for OOo3 of <code>null</code> if not an OOo3 install.
*/
public String getUnoPath() {
String path = null;
if (isVersion3()) {
path = mUre.getUnoPath();
}
-
- return path;
+
+ return path;
}
-
+
/**
* Merge two string arrays into one.
*
* The duplicated elements are not removed.
*
- * @param pArray1 the first array to merge
- * @param pArray2 the second array to merge
+ * @param pArray1
+ * the first array to merge
+ * @param pArray2
+ * the second array to merge
*
* @return the array with the elements of both arrays
*/
public String[] mergeArrays(String[] pArray1, String[] pArray2) {
String[] result = new String[pArray1.length + pArray2.length];
-
+
System.arraycopy(pArray1, 0, result, 0, pArray1.length);
System.arraycopy(pArray2, 0, result, pArray1.length, pArray2.length);
-
+
return result;
}
-
+
/**
* Get the file object for the link defined as a child of a folder.
*
- * On Windows platform, the link relative location is specified as the content of
- * a file named after the link name. On Unix-based systems symbolic links are
- * supported.
+ * On Windows platform, the link relative location is specified as the content of a file named after the link
+ * name. On Unix-based systems symbolic links are supported.
*
- * @param pName the name of the symbolic link
- * @param pParent the parent directory file
+ * @param pName
+ * the name of the symbolic link
+ * @param pParent
+ * the parent directory file
*
* @return the file representing the link target or <code>null</code>
*/
private File getPortableLink(String pName, File pParent) {
File link = null;
-
+
File linkFile = new File(pParent, pName);
if (getPlatform().equals(Platform.OS_WIN32)) {
// Read the content of the file to get the true folder
@@ -699,7 +714,7 @@ public class OOo extends AbstractOOo {
FileInputStream is = new FileInputStream(linkFile);
byte[] buf = new byte[is.available()];
is.read(buf);
-
+
String relativePath = new String(buf);
linkFile = new File(pParent, relativePath);
link = linkFile;
@@ -709,8 +724,8 @@ public class OOo extends AbstractOOo {
} else {
link = linkFile;
}
-
+
return link;
}
}
-} \ No newline at end of file
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
index 64f51c2..ce8b219 100755..100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
@@ -386,7 +386,7 @@ public class SDK implements ISdk, ITableElement {
* @return the merged environment variables.
*/
private String[] mergeVariables(String[] pBaseEnv, String[] pToMergeEnv) {
-
+ //TODO cdan should add a test for this method (all entries in pToMergeEnv should be found in the result)
// PATH merging
String[] vars = pBaseEnv;
for (int i = 0; i < pToMergeEnv.length; i++) {
@@ -395,7 +395,7 @@ public class SDK implements ISdk, ITableElement {
if (m.matches()) {
String name = m.group(1);
String value = m.group(2);
- vars = SystemHelper.addEnv(pBaseEnv, name, value, SystemHelper.PATH_SEPARATOR);
+ vars = SystemHelper.addEnv(vars, name, value, SystemHelper.PATH_SEPARATOR);
}
}
return vars;
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
index fb8db68..db993b3 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
@@ -45,6 +45,7 @@ package org.openoffice.ide.eclipse.core.internal.model;
import java.io.File;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.openoffice.ide.eclipse.core.model.config.InvalidConfigException;
@@ -53,16 +54,17 @@ import org.openoffice.ide.eclipse.core.model.config.InvalidConfigException;
* Class representing a URE installation.
*
* @author cedricbosdo
- *
+ *
*/
public class URE extends AbstractOOo {
/**
* Creating a new URE instance specifying its home directory.
*
- * @param pHome the URE home directory
- * @throws InvalidConfigException is thrown if the home directory doesn't
- * contains the required files and directories
+ * @param pHome
+ * the URE home directory
+ * @throws InvalidConfigException
+ * is thrown if the home directory doesn't contains the required files and directories
*/
public URE(String pHome) throws InvalidConfigException {
super(pHome);
@@ -72,29 +74,31 @@ public class URE extends AbstractOOo {
/**
* Creating a new URE instance specifying its home directory and name.
*
- * @param pHome the URE home directory
- * @param pName the URE name
+ * @param pHome
+ * the URE home directory
+ * @param pName
+ * the URE name
*
- * @throws InvalidConfigException is thrown if the home directory doesn't
- * contains the required files and directories
+ * @throws InvalidConfigException
+ * is thrown if the home directory doesn't contains the required files and directories
*/
public URE(String pHome, String pName) throws InvalidConfigException {
super(pHome, pName);
}
-
+
/**
* {@inheritDoc}
*/
protected void setName(String pName) {
-
+
String name = pName;
if (name == null || name.equals("")) { //$NON-NLS-1$
name = "URE"; //$NON-NLS-1$
}
-
+
super.setName(name);
}
-
+
/**
* {@inheritDoc}
*/
@@ -103,7 +107,7 @@ public class URE extends AbstractOOo {
if (getPlatform().equals(Platform.OS_WIN32)) {
jars = getHome() + FILE_SEP + "java"; //$NON-NLS-1$
}
- return new String[]{ jars };
+ return new String[] { jars };
}
/**
@@ -114,15 +118,15 @@ public class URE extends AbstractOOo {
if (getPlatform().equals(Platform.OS_WIN32)) {
libs = getHome() + FILE_SEP + "bin"; //$NON-NLS-1$
}
- return new String[]{ libs };
+ return new String[] { libs };
}
-
+
/**
* {@inheritDoc}
*/
public String[] getBinPath() {
String libs = getHome() + FILE_SEP + "bin"; //$NON-NLS-1$
- return new String[]{ libs };
+ return new String[] { libs };
}
/**
@@ -130,11 +134,11 @@ public class URE extends AbstractOOo {
*/
public String[] getTypesPath() {
String types = getHome() + FILE_SEP + "share" + FILE_SEP + "misc" + //$NON-NLS-1$ //$NON-NLS-2$
- FILE_SEP + "types.rdb"; //$NON-NLS-1$
+ FILE_SEP + "types.rdb"; //$NON-NLS-1$
if (getPlatform().equals(Platform.OS_WIN32)) {
types = getHome() + FILE_SEP + "misc" + FILE_SEP + "types.rdb"; //$NON-NLS-1$ //$NON-NLS-2$
}
- return new String[]{ types };
+ return new String[] { types };
}
/**
@@ -142,11 +146,11 @@ public class URE extends AbstractOOo {
*/
public String[] getServicesPath() {
String services = getHome() + FILE_SEP + "share" + FILE_SEP + "misc" + //$NON-NLS-1$ //$NON-NLS-2$
- FILE_SEP + "services.rdb"; //$NON-NLS-1$
+ FILE_SEP + "services.rdb"; //$NON-NLS-1$
if (getPlatform().equals(Platform.OS_WIN32)) {
services = getHome() + FILE_SEP + "misc" + FILE_SEP + "services.rdb"; //$NON-NLS-1$ //$NON-NLS-2$
}
- return new String[]{ services };
+ return new String[] { services };
}
/**
@@ -159,60 +163,60 @@ public class URE extends AbstractOOo {
}
return path;
}
-
+
/**
* {@inheritDoc}
*/
public String getUnoPath() {
String uno = "uno.bin"; //$NON-NLS-1$
if (getPlatform().equals(Platform.OS_WIN32)) {
- uno = "uno.exe"; //$NON-NLS-1$
+ uno = "uno.exe"; //$NON-NLS-1$
}
-
+
return getHome() + FILE_SEP + "bin" + FILE_SEP + uno; //$NON-NLS-1$
}
-
+
/**
* {@inheritDoc}
*/
public String toString() {
return "URE " + getName(); //$NON-NLS-1$
}
-
+
/**
* {@inheritDoc}
*/
- public String createUnoCommand(String pImplementationName,
- String pLibLocation, String[] pRegistriesPath, String[] pArgs) {
-
+ public String createUnoCommand(String pImplementationName, String pLibLocation, String[] pRegistriesPath,
+ String[] pArgs) {
+
String command = ""; //$NON-NLS-1$
-
+
// Put the args into one string
String sArgs = ""; //$NON-NLS-1$
for (int i = 0; i < pArgs.length; i++) {
sArgs += pArgs[i];
-
+
if (i < pArgs.length - 1) {
sArgs += " "; //$NON-NLS-1$
}
}
-
+
// Transform the registries into a string to give to UNO
String additionnalRegistries = ""; //$NON-NLS-1$
for (int i = 0; i < pRegistriesPath.length; i++) {
additionnalRegistries += "-ro " + pRegistriesPath[i]; //$NON-NLS-1$
-
+
if (i < pRegistriesPath.length - 1) {
additionnalRegistries += " "; //$NON-NLS-1$
}
}
-
+
// Get the paths to OOo instance types and services registries
String typesArg = ""; //$NON-NLS-1$
String[] paths = getTypesPath();
for (String path : paths) {
Path typesPath = new Path(path);
- String sTypesPath = typesPath.toString().replace(" ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$
+ String sTypesPath = typesPath.toString().replace(" ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$
typesArg += " -ro file:///" + sTypesPath; //$NON-NLS-1$
}
@@ -223,40 +227,38 @@ public class URE extends AbstractOOo {
String sServicesPath = servicesPath.toString().replace(" ", "%20"); //$NON-NLS-1$ //$NON-NLS-2$
serviceArgs += " -ro file:///" + sServicesPath; //$NON-NLS-1$
}
-
+
String unoPath = getUnoPath();
if (Platform.OS_WIN32.equals(getPlatform())) {
- unoPath = "\"" + unoPath + "\""; // escape spaces in windows names //$NON-NLS-1$ //$NON-NLS-2$
+ unoPath = "\"" + unoPath + "\""; // escape spaces in windows names //$NON-NLS-1$ //$NON-NLS-2$
}
-
- command = unoPath +
- " -c " + pImplementationName + //$NON-NLS-1$
- " -l " + pLibLocation + //$NON-NLS-1$
- typesArg +
- " -ro file:///" + serviceArgs + //$NON-NLS-1$
- " " + additionnalRegistries + //$NON-NLS-1$
- " -- " + sArgs; //$NON-NLS-1$
-
+
+ command = unoPath + " -c " + pImplementationName + //$NON-NLS-1$
+ " -l " + pLibLocation + //$NON-NLS-1$
+ typesArg + " -ro file:///" + serviceArgs + //$NON-NLS-1$
+ " " + additionnalRegistries + //$NON-NLS-1$
+ " -- " + sArgs; //$NON-NLS-1$
+
return command;
}
-
+
/**
* {@inheritDoc}
*/
public String getJavaldxPath() {
return getHome() + FILE_SEP + "bin" + FILE_SEP + "javaldx"; //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
/**
* {@inheritDoc}
*/
public boolean canManagePackages() {
return false;
}
-
+
/**
* {@inheritDoc}
*/
- public void updatePackage(File pPackageFile) {
+ public void updatePackage(File pPackageFile, IPath userInstallation) {
}
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
index f7e073e..27de55b 100755..100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoidlProject.java
@@ -78,47 +78,45 @@ import org.openoffice.ide.eclipse.core.model.language.LanguagesHelper;
* This class implements the UNO-IDL and project nature interface.
*
* @author cedricbosdo
- *
+ *
*/
public class UnoidlProject implements IUnoidlProject, IProjectNature {
-
+
/**
* Project property that stores the company prefix.
*/
public static final String COMPANY_PREFIX = "project.prefix"; //$NON-NLS-1$
-
+
/**
* Project property that stores the output path extension.
*
- * <p>If the company prefix is <code>org.openoffice.sample</code> and this
- * property value is <code>impl</code>, the root package of the
- * implementations classes is <code>org.openoffice.sample.impl</code>.</p>
+ * <p>
+ * If the company prefix is <code>org.openoffice.sample</code> and this property value is <code>impl</code>, the
+ * root package of the implementations classes is <code>org.openoffice.sample.impl</code>.
+ * </p>
*/
public static final String OUTPUT_EXT = "project.implementation"; //$NON-NLS-1$
/**
- * Project property that stores the sdk name to use for
- * the project build.
+ * Project property that stores the sdk name to use for the project build.
*/
public static final String SDK_NAME = "project.sdk"; //$NON-NLS-1$
-
+
/**
- * Project property that stores the name of the OpenOffice.org instance
- * used to run / deploy the project.
+ * Project property that stores the name of the OpenOffice.org instance used to run / deploy the project.
*/
public static final String OOO_NAME = "project.ooo"; //$NON-NLS-1$
-
+
/**
- * Project property that stores the language name.
+ * Project property that stores the language name.
*/
public static final String LANGUAGE = "project.language"; //$NON-NLS-1$
-
+
/**
- * Project property that stores the path to the folder containing
- * the sources.
+ * Project property that stores the path to the folder containing the sources.
*/
public static final String SRC_DIRECTORY = "project.srcdir"; //$NON-NLS-1$
-
+
/**
* Property name for the idl folder.
*/
@@ -128,14 +126,14 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
* Property name for the build directory.
*/
public static final String BUILD_DIR = "project.build"; //$NON-NLS-1$
-
+
/**
* The name of the file containing the UNO project configuration.
*/
private static final String CONFIG_FILE = ".unoproject"; //$NON-NLS-1$
-
+
private IProject mProject;
-
+
private String mCompanyPrefix;
private String mOutputExtension;
@@ -143,23 +141,22 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
private ISdk mSdk;
private IOOo mOOo;
-
+
private AbstractLanguage mLanguage;
-
+
private String mIdlDir;
-
+
private String mSourcesDir;
-
+
private IConfigListener mConfigListener;
-
+
/**
- * Listener for the configuration to handle the changes on SDK and OOo
- * instances.
+ * Listener for the configuration to handle the changes on SDK and OOo instances.
*
* @author cedricbosdo
*/
private class configListener implements IConfigListener {
-
+
/**
* {@inheritDoc}
*/
@@ -179,10 +176,10 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
}
} else if (pElement instanceof IOOo) {
if (pElement == getOOo()) {
-
+
// Removes OOo dependencies
getLanguage().getProjectHandler().removeOOoDependencies(getOOo(), getProject());
-
+
// Sets the selected OOo to null, it will tag the project as invalid
setOOo(null);
}
@@ -197,30 +194,28 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
if (pElement == getOOo()) {
// the ooo is updated thanks to it's reference. Remove the old jar files
// from the classpath and the new ones
-
+
// Removes OOo dependencies
- getLanguage().getProjectHandler().removeOOoDependencies(
- getOOo(), getProject());
- getLanguage().getProjectHandler().addOOoDependencies(
- getOOo(), getProject());
+ getLanguage().getProjectHandler().removeOOoDependencies(getOOo(), getProject());
+ getLanguage().getProjectHandler().addOOoDependencies(getOOo(), getProject());
}
}
}
}
-
- //------------------------------------------------------------ Constructors
-
+
+ // ------------------------------------------------------------ Constructors
+
/**
* Default constructor initializing the configuration listener.
*/
public UnoidlProject() {
-
+
mConfigListener = new configListener();
-
+
SDKContainer.addListener(mConfigListener);
OOoContainer.addListener(mConfigListener);
}
-
+
/**
* Removes the listeners needed by the UNO project.
*/
@@ -228,30 +223,29 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
SDKContainer.removeListener(mConfigListener);
OOoContainer.removeListener(mConfigListener);
}
-
+
/**
- * Return the path of the file in the idl folder. If the given file doesn't
- * belong to the idl folder, <code>null</code> is returned.
+ * Return the path of the file in the idl folder. If the given file doesn't belong to the idl folder,
+ * <code>null</code> is returned.
*
- * @param pResource resource of which the idl path is asked
+ * @param pResource
+ * resource of which the idl path is asked
* @return idl relative path or <code>null</code>
*/
public IPath getIdlRelativePath(IResource pResource) {
IPath result = null;
-
+
IPath projectRelative = pResource.getProjectRelativePath();
-
+
if (projectRelative.toString().startsWith(getIdlPath().toString())) {
- result = projectRelative.removeFirstSegments(
- getIdlPath().segmentCount());
+ result = projectRelative.removeFirstSegments(getIdlPath().segmentCount());
}
return result;
}
-
-
- //*************************************************************************
+
+ // *************************************************************************
// IUnoidlModel Implementation
- //*************************************************************************
+ // *************************************************************************
/**
* {@inheritDoc}
@@ -259,50 +253,50 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
public AbstractLanguage getLanguage() {
return mLanguage;
}
-
+
/**
* {@inheritDoc}
*/
public String getName() {
return getProject().getName();
}
-
+
/**
* {@inheritDoc}
*/
public IOOo getOOo() {
return mOOo;
}
-
+
/**
* {@inheritDoc}
*/
public ISdk getSdk() {
return mSdk;
}
-
+
/**
* {@inheritDoc}
*/
public void setLanguage(AbstractLanguage pNewLanguage) {
-
+
if (mLanguage == null && pNewLanguage != null) {
- mLanguage = pNewLanguage;
+ mLanguage = pNewLanguage;
mLanguage.getProjectHandler().addProjectNature(getProject());
PluginLogger.debug("Language specific nature added"); //$NON-NLS-1$
}
}
-
+
/**
* {@inheritDoc}
*/
public void setOOo(IOOo pOoo) {
-
+
setErrorMarker(null == pOoo || null == getSdk());
-
+
try {
IProjectHandler langHandler = getLanguage().getProjectHandler();
-
+
// Remove the old OOo libraries
langHandler.removeOOoDependencies(mOOo, getProject());
@@ -311,27 +305,27 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
} catch (Exception e) {
// This might happen at some stage of the project creation
}
-
+
this.mOOo = pOoo;
}
-
+
/**
* {@inheritDoc}
*/
public void setSdk(ISdk pSdk) {
-
+
setErrorMarker(pSdk == null || null == getOOo());
-
+
this.mSdk = pSdk;
}
-
+
/**
* {@inheritDoc}
*/
public void setIdlDir(String pIdlDir) {
mIdlDir = pIdlDir;
}
-
+
/**
* {@inheritDoc}
*/
@@ -339,68 +333,67 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
if (pSourcesDir == null || pSourcesDir.equals("")) { //$NON-NLS-1$
pSourcesDir = UnoidlProjectHelper.SOURCE_BASIS;
}
-
+
// Add a / at the beginning of the path
if (!pSourcesDir.startsWith("/")) { //$NON-NLS-1$
pSourcesDir = "/" + pSourcesDir; //$NON-NLS-1$
}
-
+
mSourcesDir = pSourcesDir;
}
-
+
/**
* {@inheritDoc}
*/
public String getRootModule() {
String result = ""; //$NON-NLS-1$
-
+
if (null != mCompanyPrefix) {
result = mCompanyPrefix.replaceAll("\\.", "::"); //$NON-NLS-1$ //$NON-NLS-2$
}
return result;
}
-
+
/**
* {@inheritDoc}
*/
public IPath getRootModulePath() {
IPath result = null;
-
+
if (null != mCompanyPrefix) {
- result = getIdlPath().append(
- mCompanyPrefix.replaceAll("\\.", "/")); //$NON-NLS-1$ //$NON-NLS-2$
+ result = getIdlPath().append(mCompanyPrefix.replaceAll("\\.", "/")); //$NON-NLS-1$ //$NON-NLS-2$
}
return result;
}
-
+
/**
* {@inheritDoc}
*/
public void setCompanyPrefix(String pPrefix) {
mCompanyPrefix = pPrefix;
}
-
+
/**
* {@inheritDoc}
*/
public String getCompanyPrefix() {
return mCompanyPrefix;
}
-
+
/**
* {@inheritDoc}
*/
public void setOutputExtension(String pOutputExt) {
mOutputExtension = pOutputExt;
}
-
+
/**
* {@inheritDoc}
*/
public String getOutputExtension() {
return mOutputExtension;
}
-
+
/**
* {@inheritDoc}
*/
@@ -409,10 +402,10 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
if (!buildDir.startsWith("/")) { //$NON-NLS-1$
buildDir = "/" + buildDir; //$NON-NLS-1$
}
-
+
return getFolder(buildDir).getProjectRelativePath();
}
-
+
/**
* {@inheritDoc}
*/
@@ -421,10 +414,10 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
if (!idlDir.startsWith("/")) { //$NON-NLS-1$
idlDir = "/" + idlDir; //$NON-NLS-1$
}
-
+
return getFolder(idlDir).getProjectRelativePath();
}
-
+
/**
* {@inheritDoc}
*/
@@ -432,38 +425,38 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
String path = new String(mCompanyPrefix + "." + mOutputExtension).replace('.', '/'); //$NON-NLS-1$
return getSourcePath().append(path);
}
-
+
/**
* {@inheritDoc}
*/
public IPath getProjectPath() {
return getProject().getLocation();
}
-
+
/**
* {@inheritDoc}
*/
public IPath getTypesPath() {
return new Path("types.rdb"); //$NON-NLS-1$
}
-
+
/**
* {@inheritDoc}
*/
public IPath getServicesPath() {
return new Path("services.rdb"); //$NON-NLS-1$
}
-
+
/**
* {@inheritDoc}
*/
public IPath getSourcePath() {
- if ( mSourcesDir == null ) {
+ if (mSourcesDir == null) {
mSourcesDir = getProperty(SRC_DIRECTORY);
}
return getFolder(mSourcesDir).getProjectRelativePath();
}
-
+
/**
* {@inheritDoc}
*/
@@ -471,27 +464,53 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
return getFolder(getBuildPath().append(UnoidlProjectHelper.URD_BASIS)).getProjectRelativePath();
}
+ public IPath getDistPath() {
+ return getFolder(UnoidlProjectHelper.DIST_BASIS).getProjectRelativePath();
+ }
+
+ public IFolder getDistFolder() throws CoreException {
+ IFolder folder = getFolder(getDistPath());
+ // TODO find better way to make sure the folder exists.
+ if (!folder.exists()) {
+ folder.getLocation().toFile().mkdirs();
+ }
+ return folder;
+ }
+
+ public IPath getOpenOfficeUserProfilePath() {
+ return getFolder(getDistPath().append(UnoidlProjectHelper.OO_PROFILE_BASIS)).getProjectRelativePath();
+ }
+
+ public IFolder getOpenOfficeUserProfileFolder() throws CoreException {
+ IFolder folder = getFolder(getOpenOfficeUserProfilePath());
+ // TODO find better way to make sure the folder exists.
+ if (!folder.exists()) {
+ folder.getLocation().toFile().mkdirs();
+ }
+ return folder;
+ }
+
/**
* {@inheritDoc}
*/
public IFile getFile(IPath pPath) {
return getProject().getFile(pPath);
}
-
+
/**
* {@inheritDoc}
*/
public IFile getFile(String pPath) {
return getProject().getFile(pPath);
}
-
+
/**
* {@inheritDoc}
*/
public IFolder getFolder(IPath pPath) {
return getProject().getFolder(pPath);
}
-
+
/**
* {@inheritDoc}
*/
@@ -507,31 +526,34 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
public File getConfigFile() {
return new File(getProjectPath().append(CONFIG_FILE).toOSString());
}
-
+
/**
* Reads a property from the UNO project configuration file.
*
- * <p>Returns the property corresponding to the given name. If the
- * configuration file doesn't exists, a default one will be created.</p>
+ * <p>
+ * Returns the property corresponding to the given name. If the configuration file doesn't exists, a default one
+ * will be created.
+ * </p>
*
- * @param pPropertyName the name of the property to get
+ * @param pPropertyName
+ * the name of the property to get
* @return the property value or <code>null</code> if not found.
*
* @see #CONFIG_FILE for the configuration file name
*/
public String getProperty(String pPropertyName) {
-
+
Properties properties = new Properties();
File configFile = getConfigFile();
String property = null;
-
+
FileInputStream in = null;
- try {
+ try {
// Create a default configuration file if needed
if (!configFile.exists()) {
UnoidlProjectHelper.createDefaultConfig(configFile);
}
-
+
in = new FileInputStream(configFile);
properties.load(in);
property = properties.getProperty(pPropertyName);
@@ -540,70 +562,81 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
String msg = MessageFormat.format(pattern, CONFIG_FILE);
PluginLogger.warning(msg, e);
} finally {
- try { in.close(); } catch (IOException e) { }
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
}
-
+
return property;
}
-
+
/**
* Define a property in the UNO project configuration file.
*
- * @param pName the property name
- * @param pValue the property value
+ * @param pName
+ * the property name
+ * @param pValue
+ * the property value
*/
public void setProperty(String pName, String pValue) {
Properties properties = new Properties();
File configFile = getConfigFile();
-
+
FileInputStream in = null;
FileOutputStream out = null;
- try {
+ try {
// Create a default configuration file if needed
if (!configFile.exists()) {
UnoidlProjectHelper.createDefaultConfig(configFile);
}
-
+
in = new FileInputStream(configFile);
properties.load(in);
-
+
properties.setProperty(pName, pValue);
-
+
out = new FileOutputStream(configFile);
properties.store(out, Messages.getString("UnoidlProject.ConfigFileComment")); //$NON-NLS-1$
-
+
// Refresh the configuration file
getFile(CONFIG_FILE).refreshLocal(IResource.DEPTH_ZERO, null);
-
+
} catch (Exception e) {
String pattern = Messages.getString("UnoidlProject.PropertyChangeError"); //$NON-NLS-1$
String message = MessageFormat.format(pattern, pName, pValue);
PluginLogger.warning(message, e);
} finally {
- try { in.close(); } catch (IOException e) { }
- try { out.close(); } catch (IOException e) { }
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
+ try {
+ out.close();
+ } catch (IOException e) {
+ }
}
}
-
+
/**
* {@inheritDoc}
*/
public void saveAllProperties() {
-
+
Properties properties = new Properties();
File configFile = getConfigFile();
-
+
// Create a default configuration file if needed
if (!configFile.exists()) {
UnoidlProjectHelper.createDefaultConfig(configFile);
}
-
+
FileInputStream in = null;
FileOutputStream out = null;
- try {
+ try {
in = new FileInputStream(configFile);
properties.load(in);
-
+
properties.setProperty(LANGUAGE, mLanguage.getName());
properties.setProperty(OOO_NAME, mOOo.getName());
properties.setProperty(SDK_NAME, mSdk.getId());
@@ -611,59 +644,65 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
properties.setProperty(SRC_DIRECTORY, mSourcesDir);
properties.setProperty(COMPANY_PREFIX, mCompanyPrefix);
properties.setProperty(OUTPUT_EXT, mOutputExtension);
-
+
out = new FileOutputStream(configFile);
properties.store(out, Messages.getString("UnoidlProject.ConfigFileComment")); //$NON-NLS-1$
-
+
// Refresh the configuration file
getFile(CONFIG_FILE).refreshLocal(IResource.DEPTH_ZERO, null);
-
+
} catch (Exception e) {
PluginLogger.warning(Messages.getString("UnoidlProject.ConfigFileSaveError"), e); //$NON-NLS-1$
} finally {
- try { in.close(); } catch (Exception e) { }
- try { out.close(); } catch (Exception e) { }
+ try {
+ in.close();
+ } catch (Exception e) {
+ }
+ try {
+ out.close();
+ } catch (Exception e) {
+ }
}
}
-
+
/**
* {@inheritDoc}
*/
public IFolder[] getBinFolders() {
- return getLanguage().getProjectHandler().getBinFolders( this );
+ return getLanguage().getProjectHandler().getBinFolders(this);
}
-
- //*************************************************************************
+
+ // *************************************************************************
// IProjectNature Implementation
- //*************************************************************************
-
+ // *************************************************************************
+
/**
* {@inheritDoc}
*/
public void configure() throws CoreException {
-
+
// Load all the persistent properties into the members
-
+
String sdkKey = getProperty(SDK_NAME);
if (sdkKey != null) {
setSdk(SDKContainer.getSDK(sdkKey));
}
-
+
String prefix = getProperty(COMPANY_PREFIX);
if (prefix != null) {
mCompanyPrefix = prefix;
}
-
+
String outputExt = getProperty(OUTPUT_EXT);
if (outputExt != null) {
mOutputExtension = outputExt;
}
-
+
String languageName = getProperty(LANGUAGE);
if (languageName != null) {
setLanguage(LanguagesHelper.getLanguageFromName(languageName));
}
-
+
String idlDir = getProperty(IDL_DIR);
if (idlDir != null) {
setIdlDir(idlDir);
@@ -673,17 +712,17 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
if (srcDir != null) {
setSourcesDir(srcDir);
}
-
+
String oooKey = getProperty(OOO_NAME);
if (oooKey != null) {
IOOo someOOo = OOoContainer.getSomeOOo(oooKey);
setOOo(someOOo);
}
-
+
// Save any change from the read project file
saveAllProperties();
}
-
+
/**
* {@inheritDoc}
*/
@@ -704,78 +743,73 @@ public class UnoidlProject implements IUnoidlProject, IProjectNature {
public void setProject(IProject pProject) {
mProject = pProject;
}
-
-
- //*************************************************************************
+
+ // *************************************************************************
// Useful methods for the nature implementation
- //*************************************************************************
-
+ // *************************************************************************
/**
- * Set the builders for the project.
+ * Set the builders for the project.
*
- * <p>This method configures the builders using the implementation
- * language informations</p>
+ * <p>
+ * This method configures the builders using the implementation language informations
+ * </p>
*
- * @throws CoreException if the builders can't be set.
+ * @throws CoreException
+ * if the builders can't be set.
*/
public void setBuilders() throws CoreException {
- if (!(null == mSdk || null == mOOo ||
- null == mCompanyPrefix || null == mOutputExtension)) {
-
+ if (!(null == mSdk || null == mOOo || null == mCompanyPrefix || null == mOutputExtension)) {
+
// Set the types builder
IProjectDescription descr = getProject().getDescription();
ICommand[] builders = descr.getBuildSpec();
ICommand[] newCommands = new ICommand[builders.length + 1];
-
+
ICommand typesbuilderCommand = descr.newCommand();
typesbuilderCommand.setBuilderName(TypesBuilder.BUILDER_ID);
newCommands[0] = typesbuilderCommand;
-
+
System.arraycopy(builders, 0, newCommands, 1, builders.length);
-
+
descr.setBuildSpec(newCommands);
getProject().setDescription(descr, null);
}
}
-
+
/**
* {@inheritDoc}
*/
public String toString() {
return "UNO Project " + getName(); //$NON-NLS-1$
}
-
+
/**
- * Toggle an error marker on the project indicating that the there is either
- * no OpenOffice.org nor SDK set.
+ * Toggle an error marker on the project indicating that the there is either no OpenOffice.org nor SDK set.
*
- * @param pSet <code>true</code> if the error marker should be set, <code>false</code>
- * otherwise.
+ * @param pSet
+ * <code>true</code> if the error marker should be set, <code>false</code> otherwise.
*/
private void setErrorMarker(boolean pSet) {
-
+
IProject prjRes = getProject();
-
+
try {
if (pSet) {
IMarker marker = prjRes.createMarker(IMarker.PROBLEM);
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
- marker.setAttribute(IMarker.MESSAGE,
- Messages.getString("UnoidlProject.NoOOoSdkError")); //$NON-NLS-1$
+ marker.setAttribute(IMarker.MESSAGE, Messages.getString("UnoidlProject.NoOOoSdkError")); //$NON-NLS-1$
} else {
prjRes.deleteMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
}
} catch (CoreException e) {
if (pSet) {
- PluginLogger.error(
- Messages.getString("UnoidlProject.CreateMarkerError") + //$NON-NLS-1$
- getProjectPath().toString(), e);
+ PluginLogger.error(Messages.getString("UnoidlProject.CreateMarkerError") + //$NON-NLS-1$
+ getProjectPath().toString(), e);
} else {
- PluginLogger.error(
- Messages.getString("UnoidlProject.RemoveMarkerError"), e); //$NON-NLS-1$
+ PluginLogger.error(Messages.getString("UnoidlProject.RemoveMarkerError"), e); //$NON-NLS-1$
}
}
-
+
}
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/messages.properties b/core/source/org/openoffice/ide/eclipse/core/internal/model/messages.properties
index 429b92d..5d99548 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/messages.properties
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/messages.properties
@@ -1,5 +1,6 @@
AbstractOOo.NoDirectoryError=Not an existing directory:
-AbstractOOo.UreProcessName=URE process :
+AbstractOOo.UreProcessName=URE process :
+AbstractOOo.OpenOfficeProcessName=OpenOffice
AbstractOOo.NoFileError=Not an existing file:
UnoidlProject.RemoveMarkerError=Failed to remove marker
UnoidlProject.NoOOoSdkError=No SDK or OOo set: won't build
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java
new file mode 100644
index 0000000..5605121
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/IOfficeLaunchConstants.java
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * last change: $Author: $ $Date: $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2002 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Cedric Bosdonnat, Dan Corneanu
+ *
+ *
+ ************************************************************************/
+package org.openoffice.ide.eclipse.core.launch.office;
+
+import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
+
+/**
+ * Just a bunch of constants.
+ *
+ * @author cdan
+ *
+ */
+public interface IOfficeLaunchConstants {
+
+ String PROJECT_NAME = OOEclipsePlugin.OOECLIPSE_PLUGIN_ID + ".PROJECT_ATTR";
+ String CLEAN_USER_INSTALLATION = OOEclipsePlugin.OOECLIPSE_PLUGIN_ID + ".USE_CLEAN_USER_INSTALLATION_ATTR";
+
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java
new file mode 100644
index 0000000..93fb7a1
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/LaunchConfigurationTabs.java
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * last change: $Author: $ $Date: $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2002 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Cedric Bosdonnat, Dan Corneanu
+ *
+ *
+ ************************************************************************/
+package org.openoffice.ide.eclipse.core.launch.office;
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+
+/**
+ * Creates tabs in the OpenOffice launcher.
+ *
+ * @author cdan
+ *
+ */
+public class LaunchConfigurationTabs extends AbstractLaunchConfigurationTabGroup {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createTabs(ILaunchConfigurationDialog pDialog, String pMode) {
+ ILaunchConfigurationTab[] tabs = null;
+ if (ILaunchManager.DEBUG_MODE.equals(pMode)) {
+ tabs = new ILaunchConfigurationTab[] {
+ new OfficeTab(),
+ new SourceLookupTab(),
+ new CommonTab() };
+ } else {
+ tabs = new ILaunchConfigurationTab[] {
+ new OfficeTab(),
+ new CommonTab() };
+ }
+
+ setTabs(tabs);
+ }
+
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java
new file mode 100644
index 0000000..5f362ec
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/Messages.java
@@ -0,0 +1,23 @@
+package org.openoffice.ide.eclipse.core.launch.office;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.core.launch.office.messages"; //$NON-NLS-1$
+ public static String OfficeLaunchDelegate_LaunchError;
+ public static String OfficeLaunchDelegate_LaunchErrorTitle;
+ public static String OfficeTab_Options;
+ public static String OfficeTab_Configurationerror;
+ public static String OfficeTab_ProjectNameLabel;
+ public static String OfficeTab_Title;
+ public static String OfficeTab_UnoProject;
+ public static String OfficeTab_ChkUseCleanUserInstallation;
+ public static String OfficeTab_ChkUseCleanUserInstallation_ToolTip;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java
new file mode 100644
index 0000000..866c008
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeLaunchDelegate.java
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * last change: $Author: $ $Date: $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2002 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Cedric Bosdonnat, Dan Corneanu
+ *
+ *
+ ************************************************************************/
+package org.openoffice.ide.eclipse.core.launch.office;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.helpers.SystemHelper;
+import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
+import org.openoffice.ide.eclipse.core.internal.model.UnoidlProject;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
+import org.openoffice.ide.eclipse.core.model.ProjectsManager;
+import org.openoffice.ide.eclipse.core.model.config.IOOo;
+import org.openoffice.ide.eclipse.core.model.config.NullExtraOptionsProvider;
+import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
+import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
+import org.openoffice.ide.eclipse.core.utils.FilesFinder;
+
+/**
+ * OpenOffice launcher implementation.
+ *
+ * @author cdan
+ *
+ */
+public class OfficeLaunchDelegate extends LaunchConfigurationDelegate {
+
+ /**
+ * Export the .oxt file, deploy it in openoffice, run openoffice.
+ */
+ private static final int TASK_UNITS = 3;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void launch(ILaunchConfiguration pConfiguration, String pMode, ILaunch pLaunch, IProgressMonitor pMonitor)
+ throws CoreException {
+ if (pMonitor == null) {
+ pMonitor = new NullProgressMonitor();
+ }
+
+ try {
+ pMonitor.beginTask(MessageFormat.format("{0}...", //$NON-NLS-1$
+ new Object[] { pConfiguration.getName() }), TASK_UNITS);
+ // check for cancellation
+ if (pMonitor.isCanceled()) {
+ return;
+ }
+
+ String prjName = pConfiguration.getAttribute(IOfficeLaunchConstants.PROJECT_NAME, ""); //$NON-NLS-1$
+ boolean useCleanUserInstalation = pConfiguration.getAttribute(
+ IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, false);
+
+ IUnoidlProject prj = ProjectsManager.getProject(prjName);
+
+ if (null != prj) {
+ try {
+ IPath userInstallation = null;
+ if (useCleanUserInstalation) {
+ IFolder userInstallationFolder = prj.getOpenOfficeUserProfileFolder();
+ userInstallation = userInstallationFolder.getLocation();
+ }
+
+ File destFile = exportComponent(pMonitor, prj);
+ pMonitor.worked(1);
+
+ // Try to source ooenv if it exists
+ sourceOOEnv(prj);
+
+ // Deploy the component
+ deployComponent(prj, userInstallation, destFile);
+ pMonitor.worked(1);
+
+ // Run an OpenOffice instance
+ if (ILaunchManager.DEBUG_MODE.equals(pMode)) {
+ prj.getLanguage().connectDebuggerToOpenOffice(prj, pLaunch, userInstallation, pMonitor);
+ } else {
+ prj.getOOo().runOpenOffice(prj, pLaunch, userInstallation, new NullExtraOptionsProvider(),
+ pMonitor);
+ }
+ pMonitor.worked(1);
+ } catch (Exception e) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openError(Display.getDefault().getActiveShell(),
+ Messages.OfficeLaunchDelegate_LaunchErrorTitle,
+ Messages.OfficeLaunchDelegate_LaunchError);
+ }
+ });
+ }
+ }
+ } finally {
+ pMonitor.done();
+ }
+ }
+
+ /**
+ * Tries to source ooenv if it exists and if we are on alinux OS.
+ *
+ * @param pPrj the target project.
+ * @throws IOException if we were unable to start the command
+ */
+ private void sourceOOEnv(IUnoidlProject pPrj) throws IOException {
+ if (Platform.getOS().equals(Platform.OS_LINUX)) {
+ IOOo oo = pPrj.getOOo();
+ String home = oo.getHome();
+ File homeFolder = new File(home);
+ File programFolder = new File(homeFolder, "program");
+ File oooenvFile = new File(programFolder, "ooenv");
+
+ if (oooenvFile.isFile()) {
+ String pathsep = System.getProperty("path.separator"); //$NON-NLS-1$
+ String shellCommand = "source ooenv"; //$NON-NLS-1$
+ String[] env = SystemHelper.getSystemEnvironement();
+ env = SystemHelper.addEnv(env, "PATH",
+ programFolder.getAbsolutePath(), pathsep); //$NON-NLS-1$
+
+ PluginLogger.info("Sourcing: " + shellCommand);
+ PluginLogger.info("Sourcing.env: " + Arrays.toString(env));
+
+ Process process = SystemHelper.runTool(shellCommand, env, null);
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ PluginLogger.error("Interrupted while waiting for the source command to complete.", e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Deploys the .oxt component in an OpenOffice installation.
+ *
+ * @param pPrj
+ * target project
+ * @param pUserInstallation
+ * user profile to use
+ * @param pOxtFile
+ * the .oxt file
+ */
+ private void deployComponent(IUnoidlProject pPrj, IPath pUserInstallation, File pOxtFile) {
+ IOOo mOOo = pPrj.getOOo();
+ if (mOOo.canManagePackages()) {
+ mOOo.updatePackage(pOxtFile, pUserInstallation);
+ }
+ }
+
+ /**
+ * Will bild and export the .oxt file.
+ *
+ * @param pMonitor
+ * a monitor to report progress to.
+ * @param pPrj
+ * te target project.
+ * @return the file containing the .oxt file.
+ * @throws Exception
+ * if something goes wrong.
+ */
+ private File exportComponent(IProgressMonitor pMonitor, IUnoidlProject pPrj) throws Exception {
+
+ ILanguageBuilder langBuilder = pPrj.getLanguage().getLanguageBuidler();
+ IPath libraryPath = langBuilder.createLibrary(pPrj);
+
+ IFolder distFolder = pPrj.getFolder(pPrj.getDistPath());
+
+ File destFile = distFolder.getFile(pPrj.getName() + ".oxt").getLocation().toFile();
+ UnoPackage pack = UnoidlProjectHelper.createMinimalUnoPackage(pPrj, destFile);
+ pack.addToClean(libraryPath);
+
+ // FIXME this code is duplicated.
+ IFile descrFile = pPrj.getFile(IUnoidlProject.DESCRIPTION_FILENAME);
+ if (descrFile.exists()) {
+ pack.addContent(descrFile);
+ }
+
+ // Select the XCU / XCS files by default
+ FilesFinder finder = new FilesFinder(
+ new String[] { IUnoidlProject.XCU_EXTENSION, IUnoidlProject.XCS_EXTENSION });
+ finder.addExclude(pPrj.getDistFolder().getFullPath());
+ try {
+ ((UnoidlProject) pPrj).getProject().accept(finder);
+ } catch (CoreException e) {
+ // Nothing to log here
+ }
+ ArrayList<IFile> files = finder.getResults();
+ for (IFile aFile : files) {
+ pack.addContent(aFile);
+ }
+
+ pack.close(pMonitor);
+ return destFile;
+ }
+
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java
new file mode 100644
index 0000000..432dd08
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/OfficeTab.java
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * last change: $Author: $ $Date: $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2002 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Cedric Bosdonnat, Dan Corneanu
+ *
+ *
+ ************************************************************************/
+package org.openoffice.ide.eclipse.core.launch.office;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.gui.UnoProjectLabelProvider;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
+import org.openoffice.ide.eclipse.core.model.ProjectsManager;
+
+/**
+ * Tab for configuring the OpenOffice launch properties.
+ *
+ * @author cdan
+ *
+ */
+public class OfficeTab extends AbstractLaunchConfigurationTab {
+
+ private static final int LAYOUT_COLUMNS = 3;
+ private Text mProjectTxt;
+ private Button mProjectBtn;
+ private Button mUseCleanUserInstallation;
+ private SelectionListener mListener = new ChangeListener();
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createControl(Composite pParent) {
+ Composite comp = new Composite(pParent, SWT.NONE);
+ comp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ comp.setLayout(new GridLayout());
+
+ createProjectGroup(comp);
+
+ createOptionsGroup(comp);
+
+ setControl(comp);
+ }
+
+ /**
+ * Creates a group with UI controls for changing the launcher's options.
+ *
+ * @param pParent
+ * the parent composite to add our self to.
+ */
+ private void createOptionsGroup(Composite pParent) {
+ Group group = new Group(pParent, SWT.NONE);
+ group.setText(Messages.OfficeTab_Options);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ mUseCleanUserInstallation = createCheckButton(group, Messages.OfficeTab_ChkUseCleanUserInstallation);
+ mUseCleanUserInstallation.addSelectionListener(mListener);
+ mUseCleanUserInstallation.setToolTipText(Messages.OfficeTab_ChkUseCleanUserInstallation_ToolTip);
+ }
+
+ /**
+ * Creates a group with UI controls for selecting the target project.
+ *
+ * @param pParent
+ * the parent composite to add our self to.
+ */
+ private void createProjectGroup(Composite pParent) {
+ Group group = new Group(pParent, SWT.NONE);
+ group.setText(Messages.OfficeTab_UnoProject);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite field = new Composite(group, SWT.NONE);
+ field.setLayout(new GridLayout(LAYOUT_COLUMNS, false));
+ field.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label lbl = new Label(field, SWT.NONE);
+ lbl.setText(Messages.OfficeTab_ProjectNameLabel);
+ lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ mProjectTxt = new Text(field, SWT.SINGLE | SWT.BORDER);
+ mProjectTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ // mProjectTxt.addModifyListener(mListener);
+
+ mProjectBtn = new Button(field, SWT.PUSH);
+ mProjectBtn.setText("...");
+ mProjectBtn.addSelectionListener(mListener);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return Messages.OfficeTab_Title;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void initializeFrom(ILaunchConfiguration pConfiguration) {
+ try {
+ mProjectTxt.setText(pConfiguration.getAttribute(IOfficeLaunchConstants.PROJECT_NAME, ""));
+ mUseCleanUserInstallation.setSelection(pConfiguration.getAttribute(
+ IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, false));
+ } catch (CoreException e) {
+ PluginLogger.error(Messages.OfficeTab_Configurationerror, e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy pConfiguration) {
+ pConfiguration.setAttribute(IOfficeLaunchConstants.PROJECT_NAME, mProjectTxt.getText().trim());
+ pConfiguration.setAttribute(IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, mUseCleanUserInstallation
+ .getSelection());
+
+ try {
+ String projectName = pConfiguration.getAttribute(
+ IOfficeLaunchConstants.PROJECT_NAME, "");
+ IUnoidlProject project = ProjectsManager.getProject(projectName);
+ if (null != project) {
+ project.getLanguage().configureSourceLocator(pConfiguration);
+ }
+ } catch (CoreException e) {
+ PluginLogger.error("Could not set language specific source locator attributes.", e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy pConfiguration) {
+ pConfiguration.setAttribute(IOfficeLaunchConstants.PROJECT_NAME, "");
+ pConfiguration.setAttribute(IOfficeLaunchConstants.CLEAN_USER_INSTALLATION, true);
+ }
+
+ @Override
+ public boolean isValid(ILaunchConfiguration pLaunchConfig) {
+ boolean valid = false;
+
+ try {
+
+ boolean projectSet = !pLaunchConfig.getAttribute(IOfficeLaunchConstants.PROJECT_NAME, "")
+ .equals("");//$NON-NLS-1$ //$NON-NLS-2$
+ if (projectSet) {
+ String name = pLaunchConfig.getAttribute(IOfficeLaunchConstants.PROJECT_NAME, ""); //$NON-NLS-1$
+ valid = ProjectsManager.getProject(name) != null;
+ }
+ } catch (CoreException e) {
+ PluginLogger.error(Messages.OfficeTab_Configurationerror, e);
+ }
+
+ return valid;
+ }
+
+ /**
+ * Change listener to be notified when the user touches the UI controls :).
+ *
+ * @author cdan
+ *
+ */
+ private class ChangeListener extends SelectionAdapter {
+ @Override
+ public void widgetSelected(SelectionEvent pEvent) {
+ if (pEvent.getSource().equals(mProjectBtn)) {
+ ILabelProvider labelProvider = new UnoProjectLabelProvider();
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
+ dialog.setTitle("ProjectChooserTitle"); //$NON-NLS-1$
+ dialog.setMessage("ProjectChooserMessage"); //$NON-NLS-1$
+ dialog.setElements(ProjectsManager.getProjects());
+
+ if (dialog.open() == Window.OK) {
+ IUnoidlProject mProject = (IUnoidlProject) dialog.getFirstResult();
+ mProjectTxt.setText(mProject.getName());
+ }
+ }
+ setDirty(true);
+ getLaunchConfigurationDialog().updateButtons();
+ }
+ }
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/launch/office/messages.properties b/core/source/org/openoffice/ide/eclipse/core/launch/office/messages.properties
new file mode 100644
index 0000000..7d54f12
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/launch/office/messages.properties
@@ -0,0 +1,24 @@
+<<<<<<< HEAD
+OfficeLaunchDelegate_LaunchError=Error Message
+OfficeLaunchDelegate_LaunchErrorTitle=Error Title
+OfficeTab_Configurationerror=Configuration Error
+OfficeTab_ProjectNameLabel=Project
+OfficeTab_Title=OpenOffice
+OfficeTab_UnoProject=UNO Project
+OfficeTab_Options=Options
+OfficeTab_ChkUseCleanUserInstallation=Use Clean User Installation
+OfficeTab_ChkUseCleanUserInstallation_ToolTip=Start OpenOffice with a temporary user profile so that we do not pollute the system installed user profile.
+OfficeLaunchDelegate_LaunchErrorTitle=Error Launching OpenOffice
+=======
+OfficeLaunchDelegate_LaunchError=Error Message
+OfficeLaunchDelegate_LaunchErrorTitle=Error Title
+OfficeTab_Configurationerror=Configuration Error
+OfficeTab_ProjectNameLabel=Project
+OfficeTab_Title=OpenOffice
+OfficeTab_UnoProject=UNO Project
+OfficeTab_Options=Options
+OfficeTab_ChkUseCleanUserInstallation=Use Clean User Installation
+OfficeTab_ChkUseCleanUserInstallation_ToolTip=Start OpenOffice with a temporary user profile so that we do not pollute the system installed user profile.
+OfficeLaunchDelegate_LaunchErrorTitle=Error Launching OpenOffice
+>>>>>>> 2a46b52041f0f23b595e1cd433aaffec8fba6b2f
+OfficeLaunchDelegate_LaunchError=There was an exception launching OpenOffice.Please see the Error Log. \ No newline at end of file
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java b/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
index 7572070..67fd77c 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
@@ -45,6 +45,7 @@ package org.openoffice.ide.eclipse.core.model;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.openoffice.ide.eclipse.core.model.config.IOOo;
import org.openoffice.ide.eclipse.core.model.config.ISdk;
@@ -67,6 +68,10 @@ public interface IUnoidlProject {
*/
public static final String IDL_FOLDER = "idlfolder"; //$NON-NLS-1$
+ public static final String XCS_EXTENSION = "xcs"; //$NON-NLS-1$
+
+ public static final String XCU_EXTENSION = "xcu"; //$NON-NLS-1$
+
/**
* Cleans up the project before destroying it.
*/
@@ -244,6 +249,36 @@ public interface IUnoidlProject {
*/
public IPath getUrdPath();
+ /**
+ * @return the path to the project's folder containing the distribution .oxf
+ * file.
+ */
+ public IPath getDistPath();
+
+ /**
+ * @return the folder folder containing the distribution .oxf file. If the folder does not exist then it is created.
+ * @throws CoreException
+ * if we were unable to create the folder.
+ */
+ public IFolder getDistFolder() throws CoreException;
+
+ /**
+ * @return the path to the project's folder used to store the user profile
+ * when running/debugging OpenOffice in a clean environment. This
+ * way we do not mangle with the system wide installed, OpenOffice
+ * settings.
+ */
+ public IPath getOpenOfficeUserProfilePath();
+
+ /**
+ * @return the folder used to store the user profile
+ * when running/debugging OpenOffice in a clean environment. This
+ * way we do not mangle with the system wide installed, OpenOffice
+ * settings. If the folder does not exist then it is created.
+ * @throws CoreException if we were unable to create the folder.
+ */
+ public IFolder getOpenOfficeUserProfileFolder() throws CoreException;
+
//----------------------------------------------- Project resources getters
/**
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/config/IExtraOptionsProvider.java b/core/source/org/openoffice/ide/eclipse/core/model/config/IExtraOptionsProvider.java
new file mode 100644
index 0000000..6126069
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/model/config/IExtraOptionsProvider.java
@@ -0,0 +1,20 @@
+package org.openoffice.ide.eclipse.core.model.config;
+
+/**
+ * Gets a chance to add some more env variables just before starting an OpenOffice process.
+ *
+ * @author cdan
+ *
+ */
+public interface IExtraOptionsProvider {
+
+ /**
+ * Add your own env entries.
+ *
+ * @param pEnv
+ * the original env variables.
+ * @return
+ * the new env variables.
+ */
+ String[] addEnv(String[] pEnv);
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java b/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java
index 3c0385d..96c307c 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/config/IOOo.java
@@ -45,13 +45,13 @@ package org.openoffice.ide.eclipse.core.model.config;
import java.io.File;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
/**
- * Interface for an OpenOffice.org configuration instance. This can even
- * be implemented as an URE instance.
+ * Interface for an OpenOffice.org configuration instance. This can even be implemented as an URE instance.
*
* @author cedricbosdo
*/
@@ -60,118 +60,150 @@ public interface IOOo {
/**
* Set the home directory.
*
- * @param pHome the absolute path to the home directory
- * @throws InvalidConfigException is thrown if the path doesn't match the
- * implementation requirement for an OOo instance. The error code will
- * be {@link InvalidConfigException#INVALID_OOO_HOME}
+ * @param pHome
+ * the absolute path to the home directory
+ * @throws InvalidConfigException
+ * is thrown if the path doesn't match the implementation requirement for an OOo instance. The error
+ * code will be {@link InvalidConfigException#INVALID_OOO_HOME}
*/
public void setHome(String pHome) throws InvalidConfigException;
-
+
/**
- * Returns the path to the OpenOffice.org home directory. This string could
- * be passed to the Path constructor to get the folder object.
+ * Returns the path to the OpenOffice.org home directory. This string could be passed to the Path constructor to get
+ * the folder object.
*
* @return path to the OpenOffice.org home directory.
*/
public String getHome();
-
+
/**
* Returns the OOo name. It should be a unique identifier
*
* @return ooo name
*/
public String getName();
-
+
/**
- * <p>Returns the path to the OpenOffice.org classes directory.
- * These strings could be passed to the Path constructor to get the
- * folder object.</p>
+ * <p>
+ * Returns the path to the OpenOffice.org classes directory. These strings could be passed to the Path constructor
+ * to get the folder object.
+ * </p>
*
- * <p><em>This method should be used for future compatibility with
- * URE applications</em></p>
+ * <p>
+ * <em>This method should be used for future compatibility with
+ * URE applications</em>
+ * </p>
*
* @return path to the OpenOffice.org classes directory
*/
public String[] getClassesPath();
-
+
/**
- * <p>Returns the path to the OpenOffice.org shared libraries. This string
- * could be passed to the Path constructor to get the folder object.</p>
+ * <p>
+ * Returns the path to the OpenOffice.org shared libraries. This string could be passed to the Path constructor to
+ * get the folder object.
+ * </p>
*
* @return path to the OpenOffice.org libraries directory
*/
public String[] getLibsPath();
-
+
/**
- * <p>Returns the path to any folder containing binaries in the OOo installation.
- * This string could be passed to the Path constructor to get the folder object.</p>
+ * <p>
+ * Returns the path to any folder containing binaries in the OOo installation. This string could be passed to the
+ * Path constructor to get the folder object.
+ * </p>
*
* @return paths to the OpenOffice.org binary directories
*/
public String[] getBinPath();
-
+
/**
- * @return the path to the <code>types.rdb</code> file of the OOo or URE
- * instance.
+ * @return the path to the <code>types.rdb</code> file of the OOo or URE instance.
*/
public String[] getTypesPath();
-
+
/**
- * @return the path to the <code>services.rdb</code> file of the OOo or URE
- * instance.
+ * @return the path to the <code>services.rdb</code> file of the OOo or URE instance.
*/
public String[] getServicesPath();
-
+
/**
* @return the path to the UNO bootstrap properties file.
*/
public String getUnorcPath();
-
+
/**
* @return the path to the UNO executable file
*/
public String getUnoPath();
-
+
/**
- * @return the path to the <code>javaldx</code> executable
+ * @return the path to the <code>javaldx</code> executable
*/
public String getJavaldxPath();
-
+
/**
* Returns a command to execute a <code>uno</code> component.
*
- * @param pImplementationName the name of the component implementation to run
- * @param pLibLocation the name of the library containing the implementation
- * @param pRegistriesPaths the path to the additional registries
- * @param pArgs the argument for the component launch
+ * @param pImplementationName
+ * the name of the component implementation to run
+ * @param pLibLocation
+ * the name of the library containing the implementation
+ * @param pRegistriesPaths
+ * the path to the additional registries
+ * @param pArgs
+ * the argument for the component launch
*
* @return the command to execute the <code>uno</code> binary
*/
- public String createUnoCommand(String pImplementationName,
- String pLibLocation, String[] pRegistriesPaths, String[] pArgs);
-
+ public String createUnoCommand(String pImplementationName, String pLibLocation, String[] pRegistriesPaths,
+ String[] pArgs);
+
/**
- * Run the <code>uno</code> executable with the given Main implementation,
- * the arguments and the launcher.
+ * Run the <code>uno</code> executable with the given Main implementation, the arguments and the launcher.
*
- * @param pPrj the project to run
- * @param pMain the main implementation
- * @param pArgs the argument to pass to the main implementation
- * @param pLaunch the launcher
- * @param pMonitor a monitor to follow the progress
+ * @param pPrj
+ * the project to run
+ * @param pMain
+ * the main implementation
+ * @param pArgs
+ * the argument to pass to the main implementation
+ * @param pLaunch
+ * the launcher
+ * @param pMonitor
+ * a monitor to follow the progress
*/
- public void runUno(IUnoidlProject pPrj, String pMain, String pArgs,
- ILaunch pLaunch, IProgressMonitor pMonitor);
-
+ public void runUno(IUnoidlProject pPrj, String pMain, String pArgs, ILaunch pLaunch, IProgressMonitor pMonitor);
+
+ /**
+ *
+ * @param pPrj
+ * the project to run
+ * @param pLaunch
+ * the launcher to which we'll add our processes
+ * @param pUserInstallation
+ * the userInstallation folder to use. If null we'll go with the default system one.
+ * @param pExtraOptionsProvider
+ * provider for extra env variables to be set before launching.
+ * @param pMonitor
+ * a monitor to follow the progress
+ */
+ public void runOpenOffice(IUnoidlProject pPrj, ILaunch pLaunch, IPath pUserInstallation,
+ IExtraOptionsProvider pExtraOptionsProvider, IProgressMonitor pMonitor);
+
/**
* @return <code>true</code> if the OOo instance has a package manager.
*/
public boolean canManagePackages();
-
+
/**
* Update a package in the OOo instance if it can manages packages.
*
- * @param pPackageFile the package to add or update
+ * @param pPackageFile
+ * the package to add or update
+ * @param pUserInstallation
+ * path to the user profile folder.
*/
- public void updatePackage(File pPackageFile);
+ public void updatePackage(File pPackageFile, IPath pUserInstallation);
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/config/NullExtraOptionsProvider.java b/core/source/org/openoffice/ide/eclipse/core/model/config/NullExtraOptionsProvider.java
new file mode 100644
index 0000000..f88aa1d
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/model/config/NullExtraOptionsProvider.java
@@ -0,0 +1,18 @@
+package org.openoffice.ide.eclipse.core.model.config;
+
+/**
+ * Does nothing.
+ *
+ * @author cdan
+ *
+ */
+public class NullExtraOptionsProvider implements IExtraOptionsProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] addEnv(String[] pEnv) {
+ return pEnv;
+ }
+
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/language/AbstractLanguage.java b/core/source/org/openoffice/ide/eclipse/core/model/language/AbstractLanguage.java
index a6cc345..1cbc5fd 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/language/AbstractLanguage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/language/AbstractLanguage.java
@@ -30,79 +30,108 @@
************************************************************************/
package org.openoffice.ide.eclipse.core.model.language;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
/**
* Base class for the language extensions.
*
* @author cbosdo
- *
+ *
*/
public abstract class AbstractLanguage {
private IConfigurationElement mConfig;
-
+
/**
- * @param pConfig the configuration element for the language
+ * @param pConfig
+ * the configuration element for the language
*/
- protected void setConfigurationElement( IConfigurationElement pConfig ) {
+ protected void setConfigurationElement(IConfigurationElement pConfig) {
mConfig = pConfig;
}
-
+
/**
* @return the language display name
*/
- public String getName( ) {
- return mConfig.getAttribute( "name" ); //$NON-NLS-1$
+ public String getName() {
+ return mConfig.getAttribute("name"); //$NON-NLS-1$
}
-
+
/**
- * @return the wizard page for the New UNO project wizard or <code>null</code> if none
- * has been defined.
+ * @return the wizard page for the New UNO project wizard or <code>null</code> if none has been defined.
*/
- public LanguageWizardPage getNewWizardPage( ) {
+ public LanguageWizardPage getNewWizardPage() {
LanguageWizardPage result = null;
- IConfigurationElement[] children = mConfig.getChildren( "newWizardPage" ); //$NON-NLS-1$
- if ( children.length > 0 ) {
+ IConfigurationElement[] children = mConfig.getChildren("newWizardPage"); //$NON-NLS-1$
+ if (children.length > 0) {
// There can't be more than one
try {
- Object o = children[0].createExecutableExtension( "class" ); //$NON-NLS-1$
- if ( o instanceof LanguageWizardPage ) {
- result = ( LanguageWizardPage )o;
+ Object o = children[0].createExecutableExtension("class"); //$NON-NLS-1$
+ if (o instanceof LanguageWizardPage) {
+ result = (LanguageWizardPage) o;
}
- } catch ( Exception e ) {
+ } catch (Exception e) {
}
}
return result;
}
-
+
/**
- * @return the export build part for the UNO export wizard or <code>null</code> if none
- * has been defined.
+ * @return the export build part for the UNO export wizard or <code>null</code> if none has been defined.
*/
- public LanguageExportPart getExportBuildPart( ) {
+ public LanguageExportPart getExportBuildPart() {
LanguageExportPart result = null;
- IConfigurationElement[] children = mConfig.getChildren( "exportBuildPart" ); //$NON-NLS-1$
- if ( children.length > 0 ) {
+ IConfigurationElement[] children = mConfig.getChildren("exportBuildPart"); //$NON-NLS-1$
+ if (children.length > 0) {
// There can't be more than one
try {
- Object o = children[0].createExecutableExtension( "class" ); //$NON-NLS-1$
- if ( o instanceof LanguageExportPart ) {
- result = ( LanguageExportPart )o;
+ Object o = children[0].createExecutableExtension("class"); //$NON-NLS-1$
+ if (o instanceof LanguageExportPart) {
+ result = (LanguageExportPart) o;
}
- } catch ( Exception e ) {
+ } catch (Exception e) {
}
}
return result;
}
-
+
/**
* @return the utility class for projects handling.
*/
public abstract IProjectHandler getProjectHandler();
-
+
/**
* @return the utility class for building.
*/
public abstract ILanguageBuilder getLanguageBuidler();
+
+ /**
+ * Launch OpenOffice for debugging and connect the eclipse debugger to it.
+ * Currently only Java debugging is supported.
+ *
+ * @param pPrj the target project.
+ * @param pLaunch the launch configuration to add our debug target to.
+ * @param pUserInstallation user profile.
+ * @param pMonitor monitor to report progress to.
+ */
+ public abstract void connectDebuggerToOpenOffice(IUnoidlProject pPrj, ILaunch pLaunch, IPath pUserInstallation,
+ IProgressMonitor pMonitor);
+
+ /**
+ * When in debug mode, we have to configure the
+ * appropriate source locator for the respective language.
+ *
+ * The rest will be taken care by the {@link SourceLookupTab}.
+ *
+ * @param pConfiguration the configuration to add extra attributes to.
+ * @throws CoreException if something went wrong.
+ */
+ public abstract void configureSourceLocator(ILaunchConfigurationWorkingCopy pConfiguration) throws CoreException;
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java b/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
index 47ecc38..7445ad6 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
@@ -132,7 +132,7 @@ public class SystemHelper {
*/
public static String[] addEnv(String[] pEnv, String pName, String pValue,
String pSeparator) {
-
+ //TODO cdan should add a test for this method (test that the case is preserved even on windows, but compare with ignoring case on windows)
String[] result = new String[1];
if (pEnv != null) {
@@ -140,12 +140,13 @@ public class SystemHelper {
boolean found = false;
while (!found && i < pEnv.length) {
- String tmpEnv = pEnv[i];
+ String tmpEnv = pEnv[i];
+ String tmpName = pName;
if (Platform.getOS().equals(Platform.OS_WIN32)) {
tmpEnv = tmpEnv.toLowerCase();
- pName = pName.toLowerCase();
+ tmpName = pName.toLowerCase();
}
- if (tmpEnv.startsWith(pName + "=")) { //$NON-NLS-1$
+ if (tmpEnv.startsWith(tmpName + "=")) { //$NON-NLS-1$
found = true;
} else {
i++;
diff --git a/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java b/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java
index 36edeb1..e543478 100644
--- a/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java
+++ b/core/source/org/openoffice/ide/eclipse/core/utils/FilesFinder.java
@@ -1,11 +1,14 @@
package org.openoffice.ide.eclipse.core.utils;
import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
/**
* Visitor looking for all the files with given extensions.
@@ -17,6 +20,7 @@ public class FilesFinder implements IResourceVisitor {
private String[] mExtensions;
private ArrayList<IFile> mFiles;
+ private Set<IPath> excludedPaths = new HashSet<IPath>();
/**
* Constructor.
@@ -39,7 +43,12 @@ public class FilesFinder implements IResourceVisitor {
* {@inheritDoc}
*/
public boolean visit(IResource pResource) throws CoreException {
-
+
+ IPath resourcePath = pResource.getFullPath();
+ if(this.excludedPaths.contains(resourcePath)) {
+ return false;
+ }
+
if ( pResource.getType() == IResource.FILE ) {
boolean matches = false;
String name = pResource.getName();
@@ -57,4 +66,8 @@ public class FilesFinder implements IResourceVisitor {
return true;
}
+
+ public void addExclude(IPath pDistPath) {
+ this.excludedPaths.add(pDistPath);
+ }
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
index 8650fdc..b95364b 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
@@ -93,9 +93,6 @@ public class UnoPackageExportPage extends WizardPage {
private static final int MAX_DESTINATION_STORED = 5;
- private static final String XCS_EXTENSION = "xcs"; //$NON-NLS-1$
- private static final String XCU_EXTENSION = "xcu"; //$NON-NLS-1$
-
private Combo mProjectsList;
private ResourceTreeAndListGroup mResourceGroup;
private Combo mDestinationCombo;
@@ -164,11 +161,12 @@ public class UnoPackageExportPage extends WizardPage {
// Select the XCU / XCS files by default
IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject( mSelectedProject.getName() );
- FilesFinder finder = new FilesFinder( new String[] { XCU_EXTENSION, XCS_EXTENSION } );
+ FilesFinder finder = new FilesFinder( new String[] { IUnoidlProject.XCU_EXTENSION, IUnoidlProject.XCS_EXTENSION } );
try {
+ finder.addExclude(mSelectedProject.getDistFolder().getFullPath());
prj.accept( finder );
} catch (CoreException e) {
- // Nothing to log here
+ PluginLogger.error("Could not visit the project's content.", e);
}
ArrayList< IFile > files = finder.getResults();
@@ -541,7 +539,7 @@ public class UnoPackageExportPage extends WizardPage {
*/
public void run() {
if (mOOo.canManagePackages()) {
- mOOo.updatePackage(mDest);
+ mOOo.updatePackage(mDest, null);
}
}
}
diff --git a/cpp/META-INF/MANIFEST.MF b/cpp/META-INF/MANIFEST.MF
index d34e5c3..646386b 100644
--- a/cpp/META-INF/MANIFEST.MF
+++ b/cpp/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.ui;bundle-version="5.1.0",
org.eclipse.ui.ide;bundle-version="3.5.0",
org.eclipse.ui.cheatsheets,
- org.openoffice.ide.packager.core;bundle-version="0.1.0"
+ org.openoffice.ide.packager.core;bundle-version="0.1.0",
+ org.eclipse.debug.core
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/cpp/build/MANIFEST.MF.in b/cpp/build/MANIFEST.MF.in
index 03a0cd1..782c1cc 100644
--- a/cpp/build/MANIFEST.MF.in
+++ b/cpp/build/MANIFEST.MF.in
@@ -5,7 +5,6 @@ Bundle-SymbolicName: org.openoffice.ide.eclipse.cpp;singleton:=true
Bundle-Version: @VERSION@
Bundle-Activator: org.openoffice.ide.eclipse.cpp.Activator
Bundle-Vendor: Cédric Bosdonnat
-Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.openoffice.ide.eclipse.core;bundle-version="1.1.0",
@@ -14,6 +13,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.1",
org.eclipse.cdt.ui,
org.eclipse.ui.ide,
- org.eclipse.ui.cheatsheets
+ org.eclipse.ui.cheatsheets,
+ org.openoffice.ide.packager.core;bundle-version="0.1.0",
+ org.eclipse.debug.core
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/cpp/source/org/openoffice/ide/eclipse/cpp/Language.java b/cpp/source/org/openoffice/ide/eclipse/cpp/Language.java
index dc2da7d..624c281 100644
--- a/cpp/source/org/openoffice/ide/eclipse/cpp/Language.java
+++ b/cpp/source/org/openoffice/ide/eclipse/cpp/Language.java
@@ -30,6 +30,12 @@
************************************************************************/
package org.openoffice.ide.eclipse.cpp;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.language.AbstractLanguage;
import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
import org.openoffice.ide.eclipse.core.model.language.IProjectHandler;
@@ -38,7 +44,7 @@ import org.openoffice.ide.eclipse.core.model.language.IProjectHandler;
* Class for the extension point.
*
* @author cbosdonnat
- *
+ *
*/
public class Language extends AbstractLanguage {
@@ -46,14 +52,26 @@ public class Language extends AbstractLanguage {
* {@inheritDoc}
*/
public ILanguageBuilder getLanguageBuidler() {
- return new CppBuilder( );
+ return new CppBuilder();
}
/**
* {@inheritDoc}
*/
public IProjectHandler getProjectHandler() {
- return new CppProjectHandler( );
+ return new CppProjectHandler();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void connectDebuggerToOpenOffice(IUnoidlProject pPrj, ILaunch pLaunch, IPath pUserInstallation,
+ IProgressMonitor pMonitor) {
+ throw new RuntimeException("Not yet supported!");
}
+ @Override
+ public void configureSourceLocator(ILaunchConfigurationWorkingCopy pConfiguration) throws CoreException {
+ throw new RuntimeException("Not yet implemented!");
+ };
}
diff --git a/java/META-INF/MANIFEST.MF b/java/META-INF/MANIFEST.MF
index 6db7b2c..ebcc86d 100644
--- a/java/META-INF/MANIFEST.MF
+++ b/java/META-INF/MANIFEST.MF
@@ -6,7 +6,6 @@ Bundle-Version: 1.0.0
Bundle-Activator: org.openoffice.ide.eclipse.java.OOoJavaPlugin
Bundle-Vendor: OpenOffice.org
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
org.openoffice.ide.eclipse.core,
org.eclipse.core.resources,
org.eclipse.jdt.core,
@@ -17,6 +16,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jdt.junit;bundle-version="3.5.0",
org.eclipse.ui.ide,
org.eclipse.ui.cheatsheets,
- org.openoffice.ide.packager.core;bundle-version="0.1.0"
+ org.openoffice.ide.packager.core;bundle-version="0.1.0",
+ org.eclipse.jdt.debug.ui;bundle-version="3.4.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/java/build/MANIFEST.MF.in b/java/build/MANIFEST.MF.in
index d6bfd41..8623c68 100644
--- a/java/build/MANIFEST.MF.in
+++ b/java/build/MANIFEST.MF.in
@@ -6,7 +6,6 @@ Bundle-Version: @VERSION@
Bundle-Activator: org.openoffice.ide.eclipse.java.OOoJavaPlugin
Bundle-Vendor: Cédric Bosdonnat
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
org.openoffice.ide.eclipse.core,
org.eclipse.core.resources,
org.eclipse.jdt.core,
@@ -16,6 +15,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jface.text,
org.eclipse.jdt.junit;bundle-version="3.5.0",
org.eclipse.ui.ide,
- org.eclipse.ui.cheatsheets
+ org.eclipse.ui.cheatsheets,
+ org.openoffice.ide.packager.core;bundle-version="0.1.0",
+ org.eclipse.jdt.debug.ui;bundle-version="3.4.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaDebugExtraOptionsProvider.java b/java/source/org/openoffice/ide/eclipse/java/JavaDebugExtraOptionsProvider.java
new file mode 100644
index 0000000..fc1843c
--- /dev/null
+++ b/java/source/org/openoffice/ide/eclipse/java/JavaDebugExtraOptionsProvider.java
@@ -0,0 +1,34 @@
+package org.openoffice.ide.eclipse.java;
+
+import org.openoffice.ide.eclipse.core.helpers.SystemHelper;
+import org.openoffice.ide.eclipse.core.model.config.IExtraOptionsProvider;
+
+/**
+ * Adds extra env variables to start OpenOffice with Java setup to run in debug mode.
+ *
+ * @author cdan
+ *
+ */
+public class JavaDebugExtraOptionsProvider implements IExtraOptionsProvider {
+
+ private String mPort;
+
+ /**
+ *
+ * @param pPort
+ * the port to listen to.
+ */
+ public JavaDebugExtraOptionsProvider(String pPort) {
+ this.mPort = pPort;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] addEnv(String[] pEnv) {
+ pEnv = SystemHelper.addEnv(pEnv, "JAVA_TOOL_OPTIONS", "\"-Xdebug\" "
+ + "\"-Xrunjdwp:transport=dt_socket,address=localhost:" + mPort + "\"", null);
+ return pEnv;
+ }
+
+}
diff --git a/java/source/org/openoffice/ide/eclipse/java/Language.java b/java/source/org/openoffice/ide/eclipse/java/Language.java
index 6245535..c8b9352 100644
--- a/java/source/org/openoffice/ide/eclipse/java/Language.java
+++ b/java/source/org/openoffice/ide/eclipse/java/Language.java
@@ -43,6 +43,29 @@
************************************************************************/
package org.openoffice.ide.eclipse.java;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IPersistableSourceLocator;
+import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
+import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IVMConnector;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.sourcelookup.containers.JavaSourceLookupParticipant;
+import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.launch.office.IOfficeLaunchConstants;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.language.AbstractLanguage;
import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
import org.openoffice.ide.eclipse.core.model.language.IProjectHandler;
@@ -54,6 +77,8 @@ import org.openoffice.ide.eclipse.core.model.language.IProjectHandler;
*/
public class Language extends AbstractLanguage {
+ private static final String DEFAULT_JAVA_DEBUG_PORT = "7861";
+
/**
* {@inheritDoc}
*/
@@ -67,4 +92,39 @@ public class Language extends AbstractLanguage {
public IProjectHandler getProjectHandler() {
return new JavaProjectHandler();
}
-}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void connectDebuggerToOpenOffice(IUnoidlProject pPrj, ILaunch pLaunch, IPath pUserInstallation,
+ IProgressMonitor pMonitor) {
+
+ try {
+ // org.eclipse.jdt.launching.socketListenConnector
+ // SocketListenConnector
+ String connectorId = "org.eclipse.jdt.launching.socketListenConnector";
+ IVMConnector connector = JavaRuntime.getVMConnector(connectorId);
+ Map<String, String> argMap = new HashMap<String, String>();
+ argMap.put("timeout", "80000");
+ //FIXME implement some kind of port pickup/retry mechanism in case the default port is already used.
+ argMap.put("port", DEFAULT_JAVA_DEBUG_PORT);
+
+ connector.connect(argMap, pMonitor, pLaunch);
+
+ pPrj.getOOo().runOpenOffice(pPrj, pLaunch, pUserInstallation,
+ new JavaDebugExtraOptionsProvider(DEFAULT_JAVA_DEBUG_PORT), pMonitor);
+ } catch (Exception e) {
+ PluginLogger.error("Could not start remote debugger.", e);
+ }
+ }
+
+ @Override
+ public void configureSourceLocator(ILaunchConfigurationWorkingCopy pConfiguration) throws CoreException {
+ String projectName = pConfiguration.getAttribute(IOfficeLaunchConstants.PROJECT_NAME, "");
+ pConfiguration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID,
+ "org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector");
+ pConfiguration.setAttribute(ISourcePathComputer.ATTR_SOURCE_PATH_COMPUTER_ID,
+ "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer");
+ pConfiguration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
+ };
+} \ No newline at end of file