Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86371 Details for
Bug 110836
[logview] filter InvocationTargetException
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
clipboard.txt (text/plain), 27.48 KB, created by
Jacek Pospychala
on 2008-01-07 19:52:37 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Jacek Pospychala
Created:
2008-01-07 19:52:37 EST
Size:
27.48 KB
patch
obsolete
>### 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.7 >diff -u -r1.7 messages.properties >--- src/org/eclipse/ui/internal/views/log/messages.properties 4 Dec 2007 13:51:47 -0000 1.7 >+++ src/org/eclipse/ui/internal/views/log/messages.properties 8 Jan 2008 00:52:10 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2007 IBM Corporation and others. >+# Copyright (c) 2007, 2008 IBM Corporation and others. > # All rights reserved. This program and the accompanying materials > # are made available under the terms of the Eclipse Public License v1.0 > # which accompanies this distribution, and is available at >@@ -71,6 +71,14 @@ > EventDetailsDialog_previous=View Details Of Previous Event > EventDetailsDialog_next=View Details Of Next Event > EventDetailsDialog_copy=Copy Event Details To Clipboard >+EventDetailsDialog_FilterDialog=Filters >+EventDetailsDialog_ShowFilterDialog=Show filter dialog >+FilterDialog_Add=Add... >+FilterDialog_AddFilterTitle=Add filter >+FilterDialog_AddFliterLabel=Add filter: >+FilterDialog_EnableFiltersCheckbox=Enable filters to hide stack trace elements in Event Details dialog. >+FilterDialog_FilterShouldntContainSemicolon=Filter shouldn't contain semicolon >+FilterDialog_Remove=Remove... > > OpenLogDialog_title=Error Log > OpenLogDialog_message=Opening log... >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.8 >diff -u -r1.8 Messages.java >--- src/org/eclipse/ui/internal/views/log/Messages.java 31 Dec 2007 00:37:51 -0000 1.8 >+++ src/org/eclipse/ui/internal/views/log/Messages.java 8 Jan 2008 00:52:09 -0000 >@@ -78,7 +78,15 @@ > public static String EventDetailsDialog_previous; > public static String EventDetailsDialog_next; > public static String EventDetailsDialog_copy; >+ public static String EventDetailsDialog_FilterDialog; >+ public static String EventDetailsDialog_ShowFilterDialog; > >+ public static String FilterDialog_Add; >+ public static String FilterDialog_AddFilterTitle; >+ public static String FilterDialog_AddFliterLabel; >+ public static String FilterDialog_EnableFiltersCheckbox; >+ public static String FilterDialog_FilterShouldntContainSemicolon; >+ public static String FilterDialog_Remove; > public static String OpenLogDialog_title; > public static String OpenLogDialog_message; > public static String OpenLogDialog_cannotDisplay; >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.15 >diff -u -r1.15 LogView.java >--- src/org/eclipse/ui/internal/views/log/LogView.java 31 Dec 2007 00:37:51 -0000 1.15 >+++ src/org/eclipse/ui/internal/views/log/LogView.java 8 Jan 2008 00:52:09 -0000 >@@ -15,107 +15,37 @@ > > package org.eclipse.ui.internal.views.log; > >-import java.io.BufferedReader; >-import java.io.BufferedWriter; >-import java.io.File; >-import java.io.FileInputStream; >-import java.io.FileOutputStream; >-import java.io.IOException; >-import java.io.InputStreamReader; >-import java.io.OutputStreamWriter; >-import java.io.PrintWriter; >-import java.io.StringWriter; >+import com.ibm.icu.text.DateFormat; >+import com.ibm.icu.text.SimpleDateFormat; >+import java.io.*; > import java.lang.reflect.InvocationTargetException; >-import java.util.ArrayList; >-import java.util.Arrays; >-import java.util.Collections; >-import java.util.Comparator; >-import java.util.Date; >-import java.util.HashMap; >-import java.util.Iterator; >+import java.util.*; > import java.util.List; >-import java.util.Map; >- >-import org.eclipse.core.runtime.ILogListener; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.Path; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.core.runtime.Preferences; >-import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; >-import org.eclipse.jface.action.Action; >-import org.eclipse.jface.action.IContributionItem; >-import org.eclipse.jface.action.IMenuListener; >-import org.eclipse.jface.action.IMenuManager; >-import org.eclipse.jface.action.IStatusLineManager; >-import org.eclipse.jface.action.IToolBarManager; >-import org.eclipse.jface.action.MenuManager; >-import org.eclipse.jface.action.Separator; >-import org.eclipse.jface.dialogs.IDialogSettings; >-import org.eclipse.jface.dialogs.MessageDialog; >-import org.eclipse.jface.dialogs.ProgressMonitorDialog; >+import org.eclipse.jface.action.*; >+import org.eclipse.jface.dialogs.*; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.util.Policy; >-import org.eclipse.jface.viewers.DoubleClickEvent; >-import org.eclipse.jface.viewers.IDoubleClickListener; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.jface.viewers.ISelectionChangedListener; >-import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.jface.viewers.SelectionChangedEvent; >-import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.jface.viewers.ViewerComparator; >+import org.eclipse.jface.viewers.*; > import org.eclipse.jface.window.Window; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; >-import org.eclipse.swt.dnd.Clipboard; >-import org.eclipse.swt.dnd.TextTransfer; >-import org.eclipse.swt.dnd.Transfer; >-import org.eclipse.swt.events.DisposeEvent; >-import org.eclipse.swt.events.DisposeListener; >-import org.eclipse.swt.events.SelectionAdapter; >-import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.graphics.Color; >-import org.eclipse.swt.graphics.Image; >-import org.eclipse.swt.graphics.Point; >-import org.eclipse.swt.graphics.Rectangle; >+import org.eclipse.swt.dnd.*; >+import org.eclipse.swt.events.*; >+import org.eclipse.swt.graphics.*; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.program.Program; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Display; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.swt.widgets.FileDialog; >-import org.eclipse.swt.widgets.Listener; >-import org.eclipse.swt.widgets.Menu; >-import org.eclipse.swt.widgets.Shell; >-import org.eclipse.swt.widgets.Text; >-import org.eclipse.swt.widgets.Tree; >-import org.eclipse.swt.widgets.TreeColumn; >-import org.eclipse.swt.widgets.TreeItem; >-import org.eclipse.ui.IActionBars; >-import org.eclipse.ui.IMemento; >-import org.eclipse.ui.IPerspectiveDescriptor; >-import org.eclipse.ui.IPerspectiveListener2; >-import org.eclipse.ui.ISharedImages; >-import org.eclipse.ui.IViewReference; >-import org.eclipse.ui.IViewSite; >-import org.eclipse.ui.IWorkbenchActionConstants; >-import org.eclipse.ui.IWorkbenchPage; >-import org.eclipse.ui.IWorkbenchPart; >-import org.eclipse.ui.IWorkbenchPartReference; >-import org.eclipse.ui.PartInitException; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.XMLMemento; >+import org.eclipse.swt.widgets.*; >+import org.eclipse.ui.*; > import org.eclipse.ui.actions.ActionFactory; > import org.eclipse.ui.dialogs.FilteredTree; > import org.eclipse.ui.dialogs.PatternFilter; > import org.eclipse.ui.part.ViewPart; > >-import com.ibm.icu.text.DateFormat; >-import com.ibm.icu.text.SimpleDateFormat; >- > 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$ >@@ -470,7 +400,7 @@ > } > > private void createPropertiesAction() { >- fPropertiesAction = new EventDetailsDialogAction(fTree.getShell(), fFilteredTree.getViewer()); >+ fPropertiesAction = new EventDetailsDialogAction(fTree.getShell(), fFilteredTree.getViewer(), fMemento); > fPropertiesAction.setImageDescriptor(SharedImages.getImageDescriptor(SharedImages.DESC_PROPERTIES)); > fPropertiesAction.setDisabledImageDescriptor(SharedImages.getImageDescriptor(SharedImages.DESC_PROPERTIES_DISABLED)); > fPropertiesAction.setToolTipText(Messages.LogView_properties_tooltip); >Index: src/org/eclipse/ui/internal/views/log/EventDetailsDialogAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/EventDetailsDialogAction.java,v >retrieving revision 1.4 >diff -u -r1.4 EventDetailsDialogAction.java >--- src/org/eclipse/ui/internal/views/log/EventDetailsDialogAction.java 31 Dec 2007 00:37:51 -0000 1.4 >+++ src/org/eclipse/ui/internal/views/log/EventDetailsDialogAction.java 8 Jan 2008 00:52:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -12,13 +12,16 @@ > package org.eclipse.ui.internal.views.log; > > import java.util.Comparator; >- > import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.jface.viewers.ISelectionProvider; > import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.IMemento; > import org.eclipse.ui.actions.SelectionProviderAction; > >+/** >+ * Opens EventDetailsDialog >+ */ > public class EventDetailsDialogAction extends SelectionProviderAction { > > /** >@@ -28,19 +31,22 @@ > private ISelectionProvider provider; > private EventDetailsDialog propertyDialog; > private Comparator comparator; >+ private IMemento memento; > > /** > * Creates a new action for opening a property dialog > * on the elements from the given selection provider > * @param shell - the shell in which the dialog will open > * @param provider - the selection provider whose elements >+ * @param memento - memento with EventDetails dialog options > * the property dialog will describe > */ >- public EventDetailsDialogAction(Shell shell, ISelectionProvider provider) { >+ public EventDetailsDialogAction(Shell shell, ISelectionProvider provider, IMemento memento) { > super(provider, Messages.EventDetailsDialog_title); > Assert.isNotNull(shell); > this.shell = shell; > this.provider = provider; >+ this.memento = memento; > // setToolTipText > //WorkbenchHelp.setHelp > } >@@ -86,7 +92,7 @@ > if ((element == null) || (!(element instanceof LogEntry))) > return; > >- propertyDialog = new EventDetailsDialog(shell, element, provider, comparator); >+ propertyDialog = new EventDetailsDialog(shell, element, provider, comparator, memento); > propertyDialog.create(); > propertyDialog.getShell().setText(Messages.EventDetailsDialog_title); > propertyDialog.open(); >Index: src/org/eclipse/ui/internal/views/log/EventDetailsDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/EventDetailsDialog.java,v >retrieving revision 1.8 >diff -u -r1.8 EventDetailsDialog.java >--- src/org/eclipse/ui/internal/views/log/EventDetailsDialog.java 31 Dec 2007 00:37:51 -0000 1.8 >+++ src/org/eclipse/ui/internal/views/log/EventDetailsDialog.java 8 Jan 2008 00:52:05 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -19,17 +19,31 @@ > import org.eclipse.jface.dialogs.*; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.viewers.*; >+import org.eclipse.jface.window.Window; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.SashForm; > import org.eclipse.swt.dnd.*; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.*; >-import org.eclipse.ui.ISharedImages; >-import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.*; > >+/** >+ * Displays details about Log Entry. >+ * Event information is split in three sections: details, stack trace and session. Details >+ * contain event date, message and severity. Stack trace is displayed if an exception is bound >+ * to event. Stack trace entries can be filtered. >+ */ > public class EventDetailsDialog extends TrayDialog { >+ >+ public static final String FILTER_ENABLED = "detailsStackFilterEnabled"; //$NON-NLS-1$ >+ public static final String FILTER_LIST = "detailsStackFilterList"; //$NON-NLS-1$ >+ >+ private IMemento memento; >+ > private AbstractEntry entry; > private AbstractEntry parentEntry; // parent of the entry > private AbstractEntry[] entryChildren; // children of the entry >@@ -60,6 +74,9 @@ > private Comparator comparator = null; > Collator collator; > >+ // patterns for filtering stack traces >+ private String[] stackFilterPatterns = null; >+ > // location configuration > private Point dialogLocation; > private Point dialogSize; >@@ -72,13 +89,14 @@ > * @param provider viewer > * @param comparator comparator used to order all entries > */ >- protected EventDetailsDialog(Shell parentShell, IAdaptable selection, ISelectionProvider provider, Comparator comparator) { >+ protected EventDetailsDialog(Shell parentShell, IAdaptable selection, ISelectionProvider provider, Comparator comparator, IMemento memento) { > super(parentShell); > this.provider = (TreeViewer) provider; > labelProvider = (LogViewLabelProvider) this.provider.getLabelProvider(); > labelProvider.connect(this); > this.entry = (AbstractEntry) selection; > this.comparator = comparator; >+ this.memento = memento; > setShellStyle(SWT.MODELESS | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.CLOSE | SWT.BORDER | SWT.TITLE); > clipboard = new Clipboard(parentShell.getDisplay()); > initialize(); >@@ -86,6 +104,7 @@ > readConfiguration(); > isLastChild = false; > isAtEndOfLog = false; >+ stackFilterPatterns = getFilters(); > } > > private void initialize() { >@@ -101,10 +120,6 @@ > } > > private void resetChildIndex() { >- if (!(entry instanceof AbstractEntry)) { >- return; >- } >- > if (entryChildren == null) > return; > >@@ -318,7 +333,9 @@ > severityLabel.setText(logEntry.getSeverityText()); > msgText.setText(logEntry.getMessage() != null ? logEntry.getMessage() : ""); //$NON-NLS-1$ > String stack = logEntry.getStack(); >+ > if (stack != null) { >+ stack = filterStack(stack); > stackTraceText.setText(stack); > } else { > stackTraceText.setText(Messages.EventDetailsDialog_noStack); >@@ -491,41 +508,56 @@ > Composite comp = new Composite(parent, SWT.NONE); > GridLayout layout = new GridLayout(); > layout.marginWidth = layout.marginHeight = 0; >- layout.numColumns = 1; >+ //layout.numColumns = 1; > comp.setLayout(layout); > comp.setLayoutData(new GridData(GridData.FILL_VERTICAL)); >+ ((GridData) comp.getLayoutData()).verticalAlignment = SWT.BOTTOM; > > Composite container = new Composite(comp, SWT.NONE); > layout = new GridLayout(); > layout.marginWidth = 0; >- layout.marginHeight = 10; >- layout.numColumns = 1; >+ layout.marginHeight = 0; > container.setLayout(layout); > container.setLayoutData(new GridData(GridData.FILL_BOTH)); > > backButton = createButton(container, IDialogConstants.BACK_ID, "", false); //$NON-NLS-1$ > GridData gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.horizontalSpan = 3; >- gd.verticalSpan = 1; > backButton.setLayoutData(gd); > backButton.setToolTipText(Messages.EventDetailsDialog_previous); > backButton.setImage(SharedImages.getImage(SharedImages.DESC_PREV_EVENT)); > >+ copyButton = createButton(container, COPY_ID, "", false); //$NON-NLS-1$ >+ gd = new GridData(); >+ copyButton.setLayoutData(gd); >+ copyButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_COPY)); >+ copyButton.setToolTipText(Messages.EventDetailsDialog_copy); >+ > nextButton = createButton(container, IDialogConstants.NEXT_ID, "", false); //$NON-NLS-1$ > gd = new GridData(); >- gd.horizontalSpan = 3; >- gd.verticalSpan = 1; > nextButton.setLayoutData(gd); > nextButton.setToolTipText(Messages.EventDetailsDialog_next); > nextButton.setImage(SharedImages.getImage(SharedImages.DESC_NEXT_EVENT)); > >- copyButton = createButton(container, COPY_ID, "", false); //$NON-NLS-1$ >+ Button button = new Button(container, SWT.NONE); >+ button.setToolTipText(Messages.EventDetailsDialog_ShowFilterDialog); >+ button.setImage(SharedImages.getImage(SharedImages.DESC_FILTER)); > gd = new GridData(); >- gd.horizontalSpan = 3; >- gd.verticalSpan = 1; >- copyButton.setLayoutData(gd); >- copyButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_COPY)); >- copyButton.setToolTipText(Messages.EventDetailsDialog_copy); >+ gd.horizontalAlignment = SWT.RIGHT; >+ button.setLayoutData(gd); >+ button.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ FilterDialog dialog = new FilterDialog(getShell(), memento); >+ dialog.create(); >+ dialog.getShell().setText(Messages.EventDetailsDialog_FilterDialog); >+ if (dialog.open() == Window.OK) >+ // update filters and currently displayed stack trace >+ stackFilterPatterns = getFilters(); >+ updateProperties(); >+ } >+ }); >+ >+ // set numColumns at the end, after all createButton() calls, which change this value >+ layout.numColumns = 2; > } > > protected void createButtonsForButtonBar(Composite parent) { >@@ -536,6 +568,7 @@ > private void createDetailsSection(Composite parent) { > Composite container = new Composite(parent, SWT.NONE); > GridLayout layout = new GridLayout(); >+ layout.marginWidth = layout.marginHeight = 0; > layout.numColumns = 2; > container.setLayout(layout); > container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >@@ -581,7 +614,7 @@ > > private void createStackSection(Composite parent) { > Composite container = new Composite(parent, SWT.NONE); >- GridLayout layout = new GridLayout(); >+ GridLayout layout = new GridLayout(2, false); > layout.marginHeight = 0; > layout.marginWidth = 6; > container.setLayout(layout); >@@ -589,15 +622,16 @@ > gd.heightHint = 100; > container.setLayoutData(gd); > >- Label label = new Label(container, SWT.NULL); >+ Label label = new Label(container, SWT.NONE); > label.setText(Messages.EventDetailsDialog_exception); >- gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.horizontalSpan = 3; >+ gd = new GridData(); >+ gd.verticalAlignment = SWT.BOTTOM; > label.setLayoutData(gd); > > stackTraceText = new Text(container, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); > gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL); > gd.grabExcessHorizontalSpace = true; >+ gd.horizontalSpan = 2; > stackTraceText.setLayoutData(gd); > stackTraceText.setEditable(false); > } >@@ -628,6 +662,65 @@ > sessionDataText.setEditable(false); > } > >+ /** >+ * Loads filters from preferences. >+ * @return filters from preferences or empty array >+ * >+ * @since 3.4 >+ */ >+ private String[] getFilters() { >+ >+ Boolean filterEnabled = memento.getBoolean(FILTER_ENABLED); >+ >+ String filtersString = memento.getString(FILTER_LIST); >+ >+ if ((filterEnabled == null) || (filterEnabled.booleanValue() == false) || filtersString == null) { >+ return new String[0]; >+ } >+ >+ StringTokenizer st = new StringTokenizer(filtersString, ";"); //$NON-NLS-1$ >+ List filters = new ArrayList(); >+ while (st.hasMoreElements()) { >+ String filter = st.nextToken(); >+ filters.add(filter); >+ } >+ >+ return (String[]) filters.toArray(new String[filters.size()]); >+ } >+ >+ /** >+ * Filters stack trace. >+ * Every stack trace line is compared against all patterns. >+ * If line contains any of pattern strings, it's excluded from output. >+ * >+ * @returns filtered stack trace >+ * @since 3.4 >+ */ >+ private String filterStack(String stack) { >+ if (stackFilterPatterns.length == 0) { >+ return stack; >+ } >+ >+ StringTokenizer st = new StringTokenizer(stack, "\n"); //$NON-NLS-1$ >+ StringBuffer result = new StringBuffer(); >+ while (st.hasMoreTokens()) { >+ String stackElement = st.nextToken(); >+ >+ boolean filtered = false; >+ int i = 0; >+ while ((!filtered) && (i < stackFilterPatterns.length)) { >+ filtered = stackElement.indexOf(stackFilterPatterns[i]) >= 0; >+ i++; >+ } >+ >+ if (!filtered) { >+ result.append(stackElement).append("\n"); //$NON-NLS-1$ >+ } >+ } >+ >+ return result.toString(); >+ } >+ > //--------------- configuration handling -------------- > > /** >Index: src/org/eclipse/ui/internal/views/log/FilterDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.views.log/src/org/eclipse/ui/internal/views/log/FilterDialog.java,v >retrieving revision 1.2 >diff -u -r1.2 FilterDialog.java >--- src/org/eclipse/ui/internal/views/log/FilterDialog.java 31 Dec 2007 00:37:51 -0000 1.2 >+++ src/org/eclipse/ui/internal/views/log/FilterDialog.java 8 Jan 2008 00:52:07 -0000 >@@ -10,8 +10,10 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.views.log; > >+import java.util.StringTokenizer; > import org.eclipse.jface.dialogs.*; > import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.window.Window; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.*; > import org.eclipse.swt.layout.GridData; >@@ -21,14 +23,27 @@ > import org.eclipse.ui.IMemento; > > public class FilterDialog extends TrayDialog { >+ >+ Button okButton; >+ >+ // entries count limit > private Button limit; > Text limitText; > >- Button okButton; >+ // entry types filter > private Button errorButton; > private Button warningButton; > private Button infoButton; >+ >+ // show all sessions > private Button showAllButton; >+ >+ // filter stack trace elements in EventDetailsDialog >+ private Button filterEnabled; >+ private Button addFilter; >+ private Button removeFilter; >+ private List filterList; >+ > private IMemento memento; > > public FilterDialog(Shell parentShell, IMemento memento) { >@@ -41,6 +56,7 @@ > createEventTypesGroup(container); > createLimitSection(container); > createSessionSection(container); >+ createFilterSection(container); > > Dialog.applyDialogFont(container); > return container; >@@ -129,6 +145,106 @@ > } > } > >+ private void createFilterSection(Composite parent) { >+ Composite comp = new Composite(parent, SWT.NONE); >+ GridLayout layout = new GridLayout(2, false); >+ comp.setLayout(layout); >+ comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ >+ filterEnabled = new Button(comp, SWT.CHECK); >+ filterEnabled.setText(Messages.FilterDialog_EnableFiltersCheckbox); >+ GridData gd = new GridData(); >+ gd.horizontalSpan = 2; >+ filterEnabled.setLayoutData(gd); >+ filterEnabled.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ setStackTraceFilterEnabled(filterEnabled.getSelection()); >+ } >+ >+ }); >+ >+ filterList = new List(comp, SWT.BORDER); >+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); >+ gd.verticalSpan = 3; >+ gd.widthHint = 280; >+ gd.horizontalIndent = 20; >+ filterList.setLayoutData(gd); >+ filterList.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ removeFilter.setEnabled(true); >+ } >+ }); >+ >+ addFilter = new Button(comp, SWT.NONE); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ addFilter.setLayoutData(gd); >+ addFilter.setText(Messages.FilterDialog_Add); >+ addFilter.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ addFilter(); >+ } >+ }); >+ >+ removeFilter = new Button(comp, SWT.NONE); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ removeFilter.setLayoutData(gd); >+ removeFilter.setText(Messages.FilterDialog_Remove); >+ removeFilter.setEnabled(false); >+ removeFilter.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ removeFilter(); >+ } >+ }); >+ >+ // load preferences >+ Boolean enable = memento.getBoolean(EventDetailsDialog.FILTER_ENABLED); >+ enable = enable == null ? Boolean.FALSE : enable; >+ >+ filterEnabled.setSelection(enable.booleanValue()); >+ setStackTraceFilterEnabled(enable.booleanValue()); >+ >+ String filters = memento.getString(EventDetailsDialog.FILTER_LIST); >+ if (filters != null) { >+ StringTokenizer st = new StringTokenizer(filters, ";"); //$NON-NLS-1$ >+ while (st.hasMoreElements()) { >+ filterList.add(st.nextToken()); >+ } >+ } >+ } >+ >+ private void addFilter() { >+ IInputValidator validator = new IInputValidator() { >+ >+ public String isValid(String newText) { >+ return newText.indexOf(';') >= 0 ? Messages.FilterDialog_FilterShouldntContainSemicolon : null; >+ } >+ >+ }; >+ InputDialog dialog = new InputDialog(getShell(), Messages.FilterDialog_AddFilterTitle, Messages.FilterDialog_AddFliterLabel, null, validator); >+ if (dialog.open() == Window.OK) { >+ String value = dialog.getValue().trim(); >+ >+ if (value.length() > 0) { >+ filterList.add(value); >+ } >+ } >+ } >+ >+ private void removeFilter() { >+ int index = filterList.getSelectionIndex(); >+ if (index != -1) { >+ filterList.remove(index); >+ } >+ >+ removeFilter.setEnabled(false); >+ } >+ >+ private void setStackTraceFilterEnabled(boolean enabled) { >+ filterList.setEnabled(enabled); >+ addFilter.setEnabled(enabled); >+ removeFilter.setEnabled(enabled && filterList.getSelectionIndex() != -1); >+ } >+ > protected void createButtonsForButtonBar(Composite parent) { > okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); > createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); >@@ -141,6 +257,20 @@ > memento.putString(LogView.P_LOG_LIMIT, limitText.getText()); > memento.putString(LogView.P_USE_LIMIT, limit.getSelection() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ > memento.putString(LogView.P_SHOW_ALL_SESSIONS, showAllButton.getSelection() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ // store Event Dialog stack trace filter preferences >+ memento.putBoolean(EventDetailsDialog.FILTER_ENABLED, filterEnabled.getSelection()); >+ >+ StringBuffer sb = new StringBuffer(); >+ String[] items = filterList.getItems(); >+ for (int i = 0; i < items.length; i++) { >+ sb.append(items[i]); >+ if (i < items.length - 1) { >+ sb.append(";"); //$NON-NLS-1$ >+ } >+ } >+ memento.putString(EventDetailsDialog.FILTER_LIST, sb.toString()); >+ > super.okPressed(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 110836
:
82000
|
86269
|
86270
|
86271
|
86320
|
86321
|
86365
|
86366
|
86368
|
86369
| 86371