### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.views.log Index: src/org/eclipse/ui/internal/views/log/messages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/messages.properties,v retrieving revision 1.2 diff -u -r1.2 messages.properties --- src/org/eclipse/ui/internal/views/log/messages.properties 22 Oct 2007 15:18:42 -0000 1.2 +++ src/org/eclipse/ui/internal/views/log/messages.properties 7 Nov 2007 21:43:31 -0000 @@ -10,6 +10,7 @@ # Jacek Pospychala - bug 202583 ############################################################################### +LogView_show_filter_text=&Show Text Filter LogView_column_message = Message LogView_column_plugin = Plug-in LogView_column_date = Date Index: src/org/eclipse/ui/internal/views/log/Messages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/Messages.java,v retrieving revision 1.3 diff -u -r1.3 Messages.java --- src/org/eclipse/ui/internal/views/log/Messages.java 22 Oct 2007 15:18:42 -0000 1.3 +++ src/org/eclipse/ui/internal/views/log/Messages.java 7 Nov 2007 21:43:31 -0000 @@ -15,6 +15,7 @@ public class Messages extends NLS { + public static String LogView_show_filter_text; public static String LogView_column_message; public static String LogView_column_plugin; public static String LogView_column_date; Index: src/org/eclipse/ui/internal/views/log/LogView.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/LogView.java,v retrieving revision 1.8 diff -u -r1.8 LogView.java --- src/org/eclipse/ui/internal/views/log/LogView.java 7 Nov 2007 02:50:03 -0000 1.8 +++ src/org/eclipse/ui/internal/views/log/LogView.java 7 Nov 2007 21:43:31 -0000 @@ -102,6 +102,10 @@ import com.ibm.icu.text.DateFormat; import com.ibm.icu.text.SimpleDateFormat; +/** + * The implementation of the log view + * @since 1.0.0 + */ public class LogView extends ViewPart implements ILogListener { public static final String P_LOG_WARNING = "warning"; //$NON-NLS-1$ public static final String P_LOG_ERROR = "error"; //$NON-NLS-1$ @@ -113,6 +117,7 @@ private static final String P_COLUMN_2 = "column3"; //$NON-NLS-1$ private static final String P_COLUMN_3 = "column4"; //$NON-NLS-1$ public static final String P_ACTIVATE = "activate"; //$NON-NLS-1$ + public static final String P_SHOW_FILTER_TEXT = "show_filter_text"; //$NON-NLS-1$ public static final String P_ORDER_TYPE = "orderType"; //$NON-NLS-1$ public static final String P_ORDER_VALUE = "orderValue"; //$NON-NLS-1$ @@ -159,11 +164,17 @@ private Action fOpenLogAction; private Action fExportAction; + /** + * Constructor + */ public LogView() { fLogs = new ArrayList(); fInputFile = Platform.getLogFileLocation().toFile(); } + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) + */ public void createPartControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); FillLayout layout = new FillLayout(SWT.VERTICAL); @@ -184,6 +195,9 @@ PlatformUI.getWorkbench().getHelpSystem().setHelp(fTree, IHelpContextIds.LOG_VIEW); } + /** + * Creates the actions for the viewsite action bars + */ private void createActions() { IActionBars bars = getViewSite().getActionBars(); @@ -220,6 +234,8 @@ fActivateViewAction = createActivateViewAction(); mgr.add(fActivateViewAction); + + mgr.add(createShowTextFilter()); createPropertiesAction(); @@ -252,7 +268,7 @@ Menu menu = popupMenuManager.createContextMenu(fTree); fTree.setMenu(menu); } - + private Action createActivateViewAction() { Action action = new Action(Messages.LogView_activate) { // public void run() { @@ -387,7 +403,39 @@ return action; } + /** + * Creates the Show Text Filter view menu action + * @return the new action for the Show Text Filter + */ + private Action createShowTextFilter() { + Action action = new Action(Messages.LogView_show_filter_text) { + public void run() { + showFilterText(isChecked()); + } + }; + boolean visible = fMemento.getBoolean(P_SHOW_FILTER_TEXT).booleanValue(); + action.setChecked(visible); + showFilterText(visible); + return action; + } + + /** + * Shows/hides the filter text control from the filtered tree. This method also sets the + * P_SHOW_FILTER_TEXT preference to the visible state + * + * @param visible if the filter text control should be shown or not + */ + private void showFilterText(boolean visible) { + fMemento.putBoolean(P_SHOW_FILTER_TEXT, visible); + Composite ctrl = fFilteredTree.getFilterControl().getParent(); + GridData gd = (GridData) ctrl.getLayoutData(); + gd.exclude = !visible; + ctrl.setVisible(visible); + fFilteredTree.layout(false); + } + private void createViewer(Composite parent) { + fFilteredTree = new FilteredTree(parent, SWT.FULL_SELECTION, new PatternFilter() { protected boolean isLeafMatch(Viewer viewer, Object element) { @@ -401,7 +449,6 @@ return false; } }); - fTree = fFilteredTree.getViewer().getTree(); fTree.setLinesVisible(true); createColumns(fTree); @@ -509,6 +556,7 @@ fTextShell.dispose(); LogReader.reset(); fLabelProvider.disconnect(this); + fFilteredTree.dispose(); super.dispose(); } @@ -786,30 +834,42 @@ } private void initializeMemento() { - if (fMemento.getString(P_USE_LIMIT) == null) + if (fMemento.getString(P_USE_LIMIT) == null) { fMemento.putString(P_USE_LIMIT, "true"); //$NON-NLS-1$ - if (fMemento.getInteger(P_LOG_LIMIT) == null) + } + if (fMemento.getInteger(P_LOG_LIMIT) == null) { fMemento.putInteger(P_LOG_LIMIT, 50); - if (fMemento.getString(P_LOG_INFO) == null) + } + if (fMemento.getString(P_LOG_INFO) == null) { fMemento.putString(P_LOG_INFO, "true"); //$NON-NLS-1$ - if (fMemento.getString(P_LOG_WARNING) == null) + } + if (fMemento.getString(P_LOG_WARNING) == null) { fMemento.putString(P_LOG_WARNING, "true"); //$NON-NLS-1$ - if (fMemento.getString(P_LOG_ERROR) == null) + } + if (fMemento.getString(P_LOG_ERROR) == null) { fMemento.putString(P_LOG_ERROR, "true"); //$NON-NLS-1$ - if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null) + } + if (fMemento.getString(P_SHOW_ALL_SESSIONS) == null) { fMemento.putString(P_SHOW_ALL_SESSIONS, "true"); //$NON-NLS-1$ + } Integer width = fMemento.getInteger(P_COLUMN_1); - if (width == null || width.intValue() == 0) + if (width == null || width.intValue() == 0) { fMemento.putInteger(P_COLUMN_1, 300); + } width = fMemento.getInteger(P_COLUMN_2); - if (width == null || width.intValue() == 0) + if (width == null || width.intValue() == 0) { fMemento.putInteger(P_COLUMN_2, 150); + } width = fMemento.getInteger(P_COLUMN_3); - if (width == null || width.intValue() == 0) + if (width == null || width.intValue() == 0) { fMemento.putInteger(P_COLUMN_3, 150); - if (fMemento.getString(P_ACTIVATE) == null) + } + if (fMemento.getString(P_ACTIVATE) == null) { fMemento.putString(P_ACTIVATE, "true"); //$NON-NLS-1$ - + } + if(fMemento.getBoolean(P_SHOW_FILTER_TEXT) == null) { + fMemento.putBoolean(P_SHOW_FILTER_TEXT, true); + } fMemento.putInteger(P_ORDER_VALUE, DESCENDING); fMemento.putInteger(P_ORDER_TYPE, DATE); }