aboutsummaryrefslogtreecommitdiffstats
path: root/ddms/libs
diff options
context:
space:
mode:
Diffstat (limited to 'ddms/libs')
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatFilter.java7
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java22
2 files changed, 22 insertions, 7 deletions
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatFilter.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatFilter.java
index 509449d..7bdd98a 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatFilter.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatFilter.java
@@ -15,7 +15,6 @@
*/
package com.android.ddmuilib.logcat;
-import com.android.ddmlib.Log;
import com.android.ddmlib.Log.LogLevel;
import java.util.ArrayList;
@@ -96,8 +95,6 @@ public final class LogCatFilter {
mAppNamePattern = Pattern.compile(mAppName, getPatternCompileFlags(mAppName));
mCheckAppName = true;
} catch (PatternSyntaxException e) {
- Log.e("LogCatFilter", "Ignoring invalid app name regex.");
- Log.e("LogCatFilter", e.getMessage());
mCheckAppName = false;
}
}
@@ -107,8 +104,6 @@ public final class LogCatFilter {
mTagPattern = Pattern.compile(mTag, getPatternCompileFlags(mTag));
mCheckTag = true;
} catch (PatternSyntaxException e) {
- Log.e("LogCatFilter", "Ignoring invalid tag regex.");
- Log.e("LogCatFilter", e.getMessage());
mCheckTag = false;
}
}
@@ -118,8 +113,6 @@ public final class LogCatFilter {
mTextPattern = Pattern.compile(mText, getPatternCompileFlags(mText));
mCheckText = true;
} catch (PatternSyntaxException e) {
- Log.e("LogCatFilter", "Ignoring invalid text regex.");
- Log.e("LogCatFilter", e.getMessage());
mCheckText = false;
}
}
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
index 54381fb..d4da8e4 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
@@ -78,6 +78,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
/**
* LogCatPanel displays a table listing the logcat messages.
@@ -129,6 +131,12 @@ public final class LogCatPanel extends SelectionDependentPanel
/** Index of the default filter in the saved filters column. */
private static final int DEFAULT_FILTER_INDEX = 0;
+ /* Text colors for the filter box */
+ private static final Color VALID_FILTER_REGEX_COLOR =
+ Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
+ private static final Color INVALID_FILTER_REGEX_COLOR =
+ Display.getDefault().getSystemColor(SWT.COLOR_RED);
+
private LogCatReceiver mReceiver;
private IPreferenceStore mPrefStore;
@@ -542,6 +550,7 @@ public final class LogCatPanel extends SelectionDependentPanel
mLiveFilterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
+ updateFilterTextColor();
updateAppliedFilters();
}
});
@@ -617,6 +626,19 @@ public final class LogCatPanel extends SelectionDependentPanel
});
}
+ /** Sets the foreground color of filter text based on whether the regex is valid. */
+ private void updateFilterTextColor() {
+ String text = mLiveFilterText.getText();
+ Color c;
+ try {
+ Pattern.compile(text.trim());
+ c = VALID_FILTER_REGEX_COLOR;
+ } catch (PatternSyntaxException e) {
+ c = INVALID_FILTER_REGEX_COLOR;
+ }
+ mLiveFilterText.setForeground(c);
+ }
+
private void updateFiltersColumn(boolean showFilters) {
if (showFilters) {
mSash.setWeights(WEIGHTS_SHOW_FILTERS);