|
Lines 11-18
Link Here
|
| 11 |
|
11 |
|
| 12 |
package org.eclipse.debug.internal.ui.stringsubstitution; |
12 |
package org.eclipse.debug.internal.ui.stringsubstitution; |
| 13 |
|
13 |
|
|
|
14 |
import org.eclipse.core.runtime.Platform; |
| 14 |
import org.eclipse.core.variables.IDynamicVariable; |
15 |
import org.eclipse.core.variables.IDynamicVariable; |
| 15 |
import org.eclipse.core.variables.IDynamicVariableResolver; |
16 |
import org.eclipse.core.variables.IDynamicVariableResolver; |
|
|
17 |
import org.eclipse.osgi.service.environment.Constants; |
| 16 |
|
18 |
|
| 17 |
public class SelectedTextResolver implements IDynamicVariableResolver { |
19 |
public class SelectedTextResolver implements IDynamicVariableResolver { |
| 18 |
private SelectedResourceManager selectedResourceManager; |
20 |
private SelectedResourceManager selectedResourceManager; |
|
Lines 27-35
Link Here
|
| 27 |
public String resolveValue(IDynamicVariable variable, String argument) { |
29 |
public String resolveValue(IDynamicVariable variable, String argument) { |
| 28 |
String selection = selectedResourceManager.getSelectedText(); |
30 |
String selection = selectedResourceManager.getSelectedText(); |
| 29 |
String selectedText = argument; |
31 |
String selectedText = argument; |
|
|
32 |
|
| 30 |
if (selection != null && selection.length() > 0) { |
33 |
if (selection != null && selection.length() > 0) { |
| 31 |
selectedText = selection; |
34 |
selectedText = selection; |
|
|
35 |
if (Platform.getOS().equals(Constants.OS_MACOSX)) { |
| 36 |
// @see Bug 255619. Mac OS X needs escaping before ArgumentParser.parseString(). |
| 37 |
if (selectedText.indexOf('\\') > -1) { |
| 38 |
selectedText = selectedText.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 39 |
} |
| 40 |
if (selectedText.indexOf('"') > -1) { |
| 41 |
selectedText = selectedText.replace("\"", "\\\""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 42 |
} |
| 43 |
} |
| 32 |
} |
44 |
} |
|
|
45 |
|
| 33 |
return selectedText; |
46 |
return selectedText; |
| 34 |
} |
47 |
} |
| 35 |
} |
48 |
} |