diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2009-12-01 12:12:26 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2009-12-01 12:12:26 +0100 |
commit | 14120737802e73e974e243c3d66d64dc03316178 (patch) | |
tree | cf73d332560f53886ab31f7d7c936eba58b7353a | |
parent | af8c861e38b05780973fb9401b900770053406e8 (diff) |
Regview tool wasn't run: fixed the paths
3 files changed, 44 insertions, 26 deletions
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java b/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java index 3064b23..6da6359 100755 --- a/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java +++ b/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java @@ -94,7 +94,7 @@ public class RegDocumentProvider extends FileDocumentProvider { // Try to run regview on the file - String command = "regview " + file.getProjectRelativePath().toOSString(); //$NON-NLS-1$ + String command = "regview " + file.getLocation().toOSString(); //$NON-NLS-1$ Process process = unoproject.getSdk().runTool(unoproject, command, null); diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java index 910ae12..511867c 100644 --- a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java +++ b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java @@ -50,6 +50,7 @@ import java.util.Iterator; import java.util.Set; import java.util.Map.Entry; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.openoffice.ide.eclipse.core.PluginLogger; @@ -61,6 +62,8 @@ import org.openoffice.ide.eclipse.core.PluginLogger; */ public class SystemHelper { + public static final String PATH_SEPARATOR = System.getProperty("path.separator"); //$NON-NLS-1$ + private static final int COMMAND_ARGS_LENGTH = 3; /** @@ -70,6 +73,31 @@ public class SystemHelper { * new variable * @param pName the name of the variable to add * @param pValue the value of the variable to add + * + * @return the completed array + */ + public static String[] addPathEnv( String[] pEnv, String pName, String[] pValue ) { + + String values = new String(); + for (int i = 0; i < pValue.length; i++) { + String path = pValue[i]; + String tmpValue = new Path(path).toOSString(); + if (i < pValue.length - 1) { + tmpValue += PATH_SEPARATOR; + } + values += tmpValue; + } + + return addEnv( pEnv, pName, values, PATH_SEPARATOR ); + } + + /** + * Add an environment variable to an array of existing variables. + * + * @param pEnv the array of existing environment variables where to add the + * new variable + * @param pName the name of the variable to add + * @param pValue the value of the variable to add * @param pSeparator the separator to use if there is already a variable with * the same name. If <code>null</code>, the old variable will be replaced * 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 26a338e..46b79a3 100755 --- a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java +++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java @@ -91,8 +91,6 @@ public class SDK implements ISdk, ITableElement { */ private static final String F_DK_CONFIG = "dk.mk"; //$NON-NLS-1$ - private static final String PATH_SEPARATOR = System.getProperty("path.separator"); //$NON-NLS-1$ - private static final String INCLUDE = "include"; //$NON-NLS-1$ private static final String LIB = "lib"; //$NON-NLS-1$ @@ -397,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, PATH_SEPARATOR); + vars = SystemHelper.addEnv(pBaseEnv, name, value, SystemHelper.PATH_SEPARATOR); } } return vars; @@ -420,42 +418,34 @@ public class SDK implements ISdk, ITableElement { * OpenOffice.org SDK is available. */ private String[] updateEnvironment(String[] pVars, IOOo pOoo) throws Exception { - String binPath = getBinPath().toOSString(); + String[] oooBinPaths = pOoo.getBinPath(); + String[] binPaths = new String[ oooBinPaths.length + 1 ]; + binPaths[ 0 ] = getBinPath().toOSString(); + System.arraycopy( oooBinPaths, 0, binPaths, 1, oooBinPaths.length ); - // Extract the libraries paths - String[] paths = pOoo.getLibsPath(); - String oooLibs = ""; //$NON-NLS-1$ - for (int i = 0; i < paths.length; i++) { - String path = paths[i]; - String oooLibsPath = new Path(path).toOSString(); - if (i < paths.length - 1) { - oooLibsPath += PATH_SEPARATOR; - } - oooLibs += oooLibsPath; - } + String[] oooLibs = pOoo.getLibsPath(); // Create the exec parameters depending on the OS if (Platform.getOS().equals(Platform.OS_WIN32)) { // Definining path variables - pVars = SystemHelper.addEnv(pVars, "PATH", binPath + PATH_SEPARATOR + //$NON-NLS-1$ - oooLibs, PATH_SEPARATOR); + pVars = SystemHelper.addPathEnv(pVars, "PATH", binPaths); //$NON-NLS-1$ } else if (Platform.getOS().equals(Platform.OS_LINUX) || Platform.getOS().equals(Platform.OS_SOLARIS)) { // An UN*X platform - String[] tmpVars = SystemHelper.addEnv(pVars, "PATH", //$NON-NLS-1$ - binPath, PATH_SEPARATOR); - pVars = SystemHelper.addEnv(tmpVars, "LD_LIBRARY_PATH", //$NON-NLS-1$ - oooLibs, PATH_SEPARATOR); + String[] tmpVars = SystemHelper.addPathEnv(pVars, "PATH", //$NON-NLS-1$ + binPaths ); + pVars = SystemHelper.addPathEnv(tmpVars, "LD_LIBRARY_PATH", //$NON-NLS-1$ + oooLibs ); } else if (Platform.getOS().equals(Platform.OS_MACOSX)) { - String[] tmpVars = SystemHelper.addEnv(pVars, "PATH", //$NON-NLS-1$ - binPath, PATH_SEPARATOR); - pVars = SystemHelper.addEnv(tmpVars, "DYLD_LIBRARY_PATH", //$NON-NLS-1$ - oooLibs, PATH_SEPARATOR); + String[] tmpVars = SystemHelper.addPathEnv(pVars, "PATH", //$NON-NLS-1$ + binPaths ); + pVars = SystemHelper.addPathEnv(tmpVars, "DYLD_LIBRARY_PATH", //$NON-NLS-1$ + oooLibs); } else { // Unmanaged OS |