summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorScott Tepavich2012-11-14 10:33:43 (EST)
committer Pawel Piech2012-11-14 12:55:58 (EST)
commitac53cd58c8f267fc91b106d0b808fea9d4e01c18 (patch)
treeba76c2ee9ebc1b395d5ba23999c8abe90ca5c897
parentefda241f09e4ad5e2450409f2b3103c3db67f13b (diff)
downloadorg.eclipse.tcf-ac53cd58c8f267fc91b106d0b808fea9d4e01c18.zip
org.eclipse.tcf-ac53cd58c8f267fc91b106d0b808fea9d4e01c18.tar.gz
org.eclipse.tcf-ac53cd58c8f267fc91b106d0b808fea9d4e01c18.tar.bz2
Bug[390878] Context-queries for breakpoints are not wrapped with double quotes.
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java52
1 files changed, 16 insertions, 36 deletions
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java
index 5828666..d89cbe2 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java
@@ -413,49 +413,29 @@ public class TCFThreadFilterEditor {
return result;
}
- String missingParameterValue(String expression, int fromIndex) {
+ String validateBasicSyntax(String expression) {
+
String result = null;
- if (fromIndex == 0) {
- // Ignore content in double-quotes.
- Pattern p = Pattern.compile("\"([^\"]*)\"");
- Matcher m = p.matcher(expression);
- expression = m.replaceAll("temp");
-
- // No whitespace
- if (expression.matches("^(.*?)(\\s)(.*)$"))
- return Messages.TCFThreadFilterEditorFormatError;
-
- // Check characters around equals.
- if (expression.matches("^(.*?)[^a-zA-Z0-9_]=[^a-zA-Z0-9_](.*)$"))
- return Messages.TCFThreadFilterEditorUnbalancedParameters;
- }
-
- int lastIndex = expression.length();
- if (lastIndex != 0 && fromIndex <= lastIndex) {
- int equalsIndex = expression.indexOf('=', fromIndex);
- int commaIndex = expression.indexOf(',', fromIndex);
- int nextEqualsIndex = expression.indexOf('=',equalsIndex+1);
- if (commaIndex == lastIndex-1 || equalsIndex == lastIndex-1 ||
- equalsIndex == 0 || commaIndex == 0) {
- return Messages.TCFThreadFilterEditorUnbalancedParameters;
- }
- if (equalsIndex > 0) {
- if ((commaIndex != -1 && commaIndex < equalsIndex) ||
- (nextEqualsIndex != -1 && (commaIndex == -1 || nextEqualsIndex < commaIndex))) {
- return Messages.TCFThreadFilterEditorUnbalancedParameters;
- }
- if (commaIndex!=-1) {
- result = missingParameterValue(expression, commaIndex+1);
- }
- }
- }
+ // Ignore content in double-quotes.
+ Pattern p = Pattern.compile("\"((?:\\\\\\\\|\\\\\"|[^\"])*)\"");
+ Matcher m = p.matcher(expression);
+ expression = m.replaceAll("temp");
+
+ // No whitespace
+ if (expression.matches("^(.*?)(\\s)(.*)$"))
+ return Messages.TCFThreadFilterEditorFormatError;
+
+ // Check characters around equals.
+ if (expression.matches("^(.*?)[^a-zA-Z0-9_]=[^a-zA-Z0-9_](.*)$"))
+ return Messages.TCFThreadFilterEditorUnbalancedParameters;
+
return result;
}
private class ExpressionModifier implements ModifyListener {
public void modifyText(ModifyEvent e) {
String expression = scopeExprCombo.getText();
- String error = missingParameterValue(expression, 0);
+ String error = validateBasicSyntax(expression);
if (error != null) {
scopeExpressionDecoration.show();
fPage.setErrorMessage(error);