aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Tepavich2012-05-21 20:18:14 (EDT)
committerEugene Tarassov2012-05-23 18:10:32 (EDT)
commit86f9644da25cddbf1680d2e1848f6f02fe1e8ec8 (patch)
treed4b856af3bb77f748ab4100065850be2053b0a7c
parent165591bf7ba5a9701c5c615449a15b23c3aa727f (diff)
downloadorg.eclipse.tcf-86f9644da25cddbf1680d2e1848f6f02fe1e8ec8.zip
org.eclipse.tcf-86f9644da25cddbf1680d2e1848f6f02fe1e8ec8.tar.gz
org.eclipse.tcf-86f9644da25cddbf1680d2e1848f6f02fe1e8ec8.tar.bz2
Bug [379413] cleanup context tree control view filter logic
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java32
1 files changed, 21 insertions, 11 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 ddc7c6f..1fed90f 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
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.tcf.internal.cdt.ui.breakpoints;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -68,6 +69,7 @@ import org.eclipse.tcf.internal.debug.ui.model.TCFNode;
import org.eclipse.tcf.internal.debug.ui.model.TCFNodeExecContext;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.protocol.IErrorReport;
import org.eclipse.tcf.services.IContextQuery;
import org.eclipse.tcf.services.IRunControl;
import org.eclipse.tcf.util.TCFDataCache;
@@ -199,6 +201,9 @@ public class TCFThreadFilterEditor {
public Object[] filterList(Object[] resultArray) {
ArrayList<Object> filteredList = new ArrayList<Object>();
+ String filterExpr = null;
+ if (scopeExprCombo != null)
+ filterExpr = scopeExprCombo.getText();
if (fContextList.size() != 0) {
for (Object obj : resultArray) {
for (String id : fContextList) {
@@ -210,7 +215,7 @@ public class TCFThreadFilterEditor {
}
}
}
- if (filteredList.size() != 0) {
+ if (filterExpr != null && filterExpr.length() != 0) {
return filteredList.toArray(new Object[filteredList.size()]);
}
else {
@@ -393,17 +398,20 @@ public class TCFThreadFilterEditor {
IContextQuery service = channel.getRemoteService(IContextQuery.class);
service.query(query, new IContextQuery.DoneQuery() {
public void doneQuery (IToken token, Exception error, String[] contexts) {
- String errorMessage = null;
if (error != null) {
- String[] errorMessages= error.getMessage().split("\n");
-
- for (int i=0; i < errorMessages.length; i++) {
- String startError = Messages.TCFThreadFileterEditorInvalidQuery;
- if (errorMessages[i].startsWith(startError)) {
- errorMessage = errorMessages[i].substring(startError.length(), errorMessages[i].length());
+ //TODO: What if the error is not an instance of IErrorReport?
+ if (error instanceof IErrorReport) {
+ Map<String,Object> error_data = ((IErrorReport)error).getAttributes();
+ if (error_data== null) done (null);
+ String fmt = (String)error_data.get(IErrorReport.ERROR_FORMAT);
+ if (fmt != null) {
+ Object params = error_data.get(IErrorReport.ERROR_PARAMS);
+ if (params != null && params instanceof ArrayList) {
+ done(new MessageFormat(fmt).format(((ArrayList<?>)params).toArray()));
+ }
+ done(fmt);
}
}
- done(errorMessage);
}else {
for (String context : contexts) {
contextList.add(context);
@@ -458,7 +466,9 @@ public class TCFThreadFilterEditor {
}
else {
fContextList.clear();
- String error = getQueryFilteredContexts (expression, fContextList);
+ String error = null;
+ if (expression != null && expression.length() != 0)
+ error = getQueryFilteredContexts (expression, fContextList);
if (error == null ) {
scopeExpressionDecoration.hide();
fPage.setErrorMessage(null);
@@ -466,7 +476,7 @@ public class TCFThreadFilterEditor {
}
else {
scopeExpressionDecoration.show();
- fPage.setErrorMessage(Messages.TCFThreadFilterEditorFormatError);
+ fPage.setErrorMessage(error);
fPage.setValid(false);
}
scopeExprCombo.getParent().layout();