Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-10-31 07:37:38 -0400
committerUwe Stieber2013-11-02 04:18:55 -0400
commit33689a6a2e2407c8f0a64cbfd6319f91ab7dfbd2 (patch)
treed93c02e834027c2e7b18ab578e71a44fc844e1bd /target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence
parentc7b6c980f097215f85f64373f2fd43b10ffdeb03 (diff)
downloadorg.eclipse.tcf-33689a6a2e2407c8f0a64cbfd6319f91ab7dfbd2.tar.gz
org.eclipse.tcf-33689a6a2e2407c8f0a64cbfd6319f91ab7dfbd2.tar.xz
org.eclipse.tcf-33689a6a2e2407c8f0a64cbfd6319f91ab7dfbd2.zip
Target Explorer: Path variable replacement must not change the original case of the passed in path
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java4
4 files changed, 17 insertions, 9 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java
index 840b23ae5..e255b6e45 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractPathVariableDelegate.java
@@ -11,7 +11,6 @@
package org.eclipse.tcf.te.runtime.persistence.delegates;
import org.eclipse.core.runtime.Path;
-import org.eclipse.tcf.te.runtime.utils.Host;
/**
* AbstractPathVariableDelegate
@@ -31,8 +30,8 @@ public abstract class AbstractPathVariableDelegate extends AbstractVariableDeleg
@Override
protected Object useVariable(String key, Object value, String variableName, String variableValue) {
if (isPathKey(key) && value instanceof String) {
- String valuePath = new Path(Host.isWindowsHost() ? ((String)value).toLowerCase() : (String)value).toString();
- String variablePath = new Path(Host.isWindowsHost() ? variableValue.toLowerCase() : (String)variableValue).toString();
+ String valuePath = new Path((String)value).toString();
+ String variablePath = new Path(variableValue).toString();
return super.useVariable(key, valuePath, variableName, variablePath);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java
index 329a40b29..a7a841638 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/AbstractVariableDelegate.java
@@ -13,6 +13,7 @@ package org.eclipse.tcf.te.runtime.persistence.delegates;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.regex.Pattern;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -20,6 +21,7 @@ import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.tcf.te.runtime.persistence.PersistenceManager;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IVariableDelegate;
import org.eclipse.tcf.te.runtime.persistence.interfaces.IVariableProvider;
+import org.eclipse.tcf.te.runtime.utils.Host;
/**
* AbstractVariableDelegate
@@ -34,15 +36,23 @@ public abstract class AbstractVariableDelegate implements IVariableDelegate, IEx
/**
* Try to use a variable inside the given value.
+ *
* @param key The key of the value.
* @param value The value to inspect.
* @param variableName The variable name to use.
* @param variableValue The variable value.
+ *
* @return The new value if the variable was used, <code>null</code> otherwise.
*/
protected Object useVariable(String key, Object value, String variableName, String variableValue) {
- if (value instanceof String && ((String)value).contains(variableValue)) {
- return ((String)value).replaceAll(variableValue, "<"+variableName+">"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (value instanceof String) {
+ boolean contains = Host.isWindowsHost() ? ((String)value).toLowerCase().contains(variableValue.toLowerCase()) : ((String)value).contains(variableValue);
+ if (contains) {
+ if (Host.isWindowsHost()) {
+ return Pattern.compile(variableValue, Pattern.CASE_INSENSITIVE).matcher((String)value).replaceAll("<"+variableName+">"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return ((String)value).replaceAll(variableValue, "<"+variableName+">"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
return null;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java
index ef2868499..a6c685fca 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java
@@ -179,8 +179,7 @@ public class GsonMapPersistenceDelegate extends ExecutableExtension implements I
if (data != null) {
Map<String, String> variables = null;
- IVariableDelegate[] delegates = PersistenceManager.getInstance()
- .getVariableDelegates(this);
+ IVariableDelegate[] delegates = PersistenceManager.getInstance().getVariableDelegates(this);
for (IVariableDelegate delegate : delegates) {
variables = delegate.getVariables(data);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java
index c7b9f520b..38c9af71d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/PathVariableDelegate.java
@@ -17,9 +17,9 @@ import org.eclipse.core.runtime.IConfigurationElement;
/**
* General path variable delegate that can be configured directly in the contributions.
- *
+ *
* To set the list of handled keys you have to use the <code>class</code> and <code>parameter</code> tags
- * with <b>keysToHandle</b> as parameter name and a coma seperated list of handled keys
+ * with <b>keysToHandle</b> as parameter name and a comma separated list of handled keys
* (i.e. "file,directory") as parameter value.
*/
public class PathVariableDelegate extends AbstractPathVariableDelegate {

Back to the top