diff options
author | Scott Tepavich | 2012-11-14 15:33:43 +0000 |
---|---|---|
committer | Pawel Piech | 2012-11-14 17:55:58 +0000 |
commit | ac53cd58c8f267fc91b106d0b808fea9d4e01c18 (patch) | |
tree | ba76c2ee9ebc1b395d5ba23999c8abe90ca5c897 /plugins | |
parent | efda241f09e4ad5e2450409f2b3103c3db67f13b (diff) | |
download | org.eclipse.tcf-ac53cd58c8f267fc91b106d0b808fea9d4e01c18.tar.gz org.eclipse.tcf-ac53cd58c8f267fc91b106d0b808fea9d4e01c18.tar.xz org.eclipse.tcf-ac53cd58c8f267fc91b106d0b808fea9d4e01c18.zip |
Bug[390878] Context-queries for breakpoints are not wrapped with double quotes.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java | 52 |
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 582866687..d89cbe23f 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); |