aboutsummaryrefslogtreecommitdiffstats
path: root/ddms/libs
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2011-09-29 14:34:39 -0700
committerSiva Velusamy <vsiva@google.com>2011-09-29 15:05:15 -0700
commitc9192e375844e45ccb74ee69150717a31385564f (patch)
tree8c7d997e2b89d3d8b3ff71c16ac808ab0af67f14 /ddms/libs
parentb1409e744e5a06e7f3fcadbb98b0f86835440f8c (diff)
downloadsdk-c9192e375844e45ccb74ee69150717a31385564f.zip
sdk-c9192e375844e45ccb74ee69150717a31385564f.tar.gz
sdk-c9192e375844e45ccb74ee69150717a31385564f.tar.bz2
Provide a way to show/hide the filters column.
Change-Id: I7c94daa006987a0983cdb3cee02a35f6e678d86e
Diffstat (limited to 'ddms/libs')
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java48
-rw-r--r--ddms/libs/ddmuilib/src/images/displayfilters.pngbin0 -> 242 bytes
2 files changed, 40 insertions, 8 deletions
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 607b5b2..b34b756 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java
@@ -99,6 +99,7 @@ public final class LogCatPanel extends SelectionDependentPanel
}
private static final String LOGCAT_VIEW_COLSIZE_PREFKEY_PREFIX = "logcat.view.colsize.";
+ private static final String DISPLAY_FILTERS_COLUMN_PREFKEY = "logcat.view.display.filters";
/** Default message to show in the message search field. */
private static final String DEFAULT_SEARCH_MESSAGE =
@@ -116,6 +117,10 @@ public final class LogCatPanel extends SelectionDependentPanel
private static final String IMAGE_EDIT_FILTER = "edit.png"; //$NON-NLS-1$
private static final String IMAGE_SAVE_LOG_TO_FILE = "save.png"; //$NON-NLS-1$
private static final String IMAGE_CLEAR_LOG = "clear.png"; //$NON-NLS-1$
+ private static final String IMAGE_DISPLAY_FILTERS = "displayfilters.png"; //$NON-NLS-1$
+
+ private static final int[] WEIGHTS_SHOW_FILTERS = new int[] {15, 85};
+ private static final int[] WEIGHTS_LOGCAT_ONLY = new int[] {0, 100};
private LogCatReceiver mReceiver;
private IPreferenceStore mPrefStore;
@@ -136,6 +141,8 @@ public final class LogCatPanel extends SelectionDependentPanel
private String mLogFileExportFolder;
private LogCatMessageLabelProvider mLogCatMessageLabelProvider;
+ private SashForm mSash;
+
/**
* Construct a logcat panel.
* @param prefStore preference store where UI preferences will be saved
@@ -170,6 +177,7 @@ public final class LogCatPanel extends SelectionDependentPanel
DEFAULT_LOGCAT_FONTDATA);
mPrefStore.setDefault(LogCatMessageList.MAX_MESSAGES_PREFKEY,
LogCatMessageList.MAX_MESSAGES_DEFAULT);
+ mPrefStore.setDefault(DISPLAY_FILTERS_COLUMN_PREFKEY, true);
}
private void initializePreferenceUpdateListeners() {
@@ -251,14 +259,13 @@ public final class LogCatPanel extends SelectionDependentPanel
}
private void createViews(Composite parent) {
- SashForm sash = createSash(parent);
+ mSash = createSash(parent);
- createListOfFilters(sash);
- createLogTableView(sash);
+ createListOfFilters(mSash);
+ createLogTableView(mSash);
- /* allocate widths of the two columns 20%:80% */
- /* FIXME: save/restore sash widths */
- sash.setWeights(new int[] {20, 80});
+ boolean showFilters = mPrefStore.getBoolean(DISPLAY_FILTERS_COLUMN_PREFKEY);
+ updateFiltersColumn(showFilters);
}
private SashForm createSash(Composite parent) {
@@ -520,12 +527,37 @@ public final class LogCatPanel extends SelectionDependentPanel
clearLog.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
- mReceiver.clearMessages();
- refreshLogCatTable();
+ if (mReceiver != null) {
+ mReceiver.clearMessages();
+ refreshLogCatTable();
+ }
+ }
+ });
+
+ final ToolItem showFiltersColumn = new ToolItem(toolBar, SWT.CHECK);
+ showFiltersColumn.setImage(
+ ImageLoader.getDdmUiLibLoader().loadImage(IMAGE_DISPLAY_FILTERS,
+ toolBar.getDisplay()));
+ showFiltersColumn.setSelection(mPrefStore.getBoolean(DISPLAY_FILTERS_COLUMN_PREFKEY));
+ showFiltersColumn.setToolTipText("Display Saved Filters View");
+ showFiltersColumn.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ boolean showFilters = showFiltersColumn.getSelection();
+ mPrefStore.setValue(DISPLAY_FILTERS_COLUMN_PREFKEY, showFilters);
+ updateFiltersColumn(showFilters);
}
});
}
+ private void updateFiltersColumn(boolean showFilters) {
+ if (showFilters) {
+ mSash.setWeights(WEIGHTS_SHOW_FILTERS);
+ } else {
+ mSash.setWeights(WEIGHTS_LOGCAT_ONLY);
+ }
+ }
+
/**
* Save logcat messages selected in the table to a file.
*/
diff --git a/ddms/libs/ddmuilib/src/images/displayfilters.png b/ddms/libs/ddmuilib/src/images/displayfilters.png
new file mode 100644
index 0000000..d110c2c
--- /dev/null
+++ b/ddms/libs/ddmuilib/src/images/displayfilters.png
Binary files differ