Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 16-27
Link Here
|
16 |
import java.util.*; |
16 |
import java.util.*; |
17 |
import java.util.List; |
17 |
import java.util.List; |
18 |
import org.eclipse.core.runtime.IAdaptable; |
18 |
import org.eclipse.core.runtime.IAdaptable; |
|
|
19 |
import org.eclipse.core.runtime.Preferences; |
19 |
import org.eclipse.jface.dialogs.*; |
20 |
import org.eclipse.jface.dialogs.*; |
20 |
import org.eclipse.jface.dialogs.Dialog; |
21 |
import org.eclipse.jface.dialogs.Dialog; |
21 |
import org.eclipse.jface.viewers.*; |
22 |
import org.eclipse.jface.viewers.*; |
|
|
23 |
import org.eclipse.jface.window.Window; |
22 |
import org.eclipse.swt.SWT; |
24 |
import org.eclipse.swt.SWT; |
23 |
import org.eclipse.swt.custom.SashForm; |
25 |
import org.eclipse.swt.custom.SashForm; |
24 |
import org.eclipse.swt.dnd.*; |
26 |
import org.eclipse.swt.dnd.*; |
|
|
27 |
import org.eclipse.swt.events.SelectionAdapter; |
28 |
import org.eclipse.swt.events.SelectionEvent; |
25 |
import org.eclipse.swt.graphics.Point; |
29 |
import org.eclipse.swt.graphics.Point; |
26 |
import org.eclipse.swt.layout.GridData; |
30 |
import org.eclipse.swt.layout.GridData; |
27 |
import org.eclipse.swt.layout.GridLayout; |
31 |
import org.eclipse.swt.layout.GridLayout; |
Lines 60-65
Link Here
|
60 |
private Comparator comparator = null; |
64 |
private Comparator comparator = null; |
61 |
Collator collator; |
65 |
Collator collator; |
62 |
|
66 |
|
|
|
67 |
// patterns for filtering stack traces |
68 |
private String[] stackFilterPatterns = getFilters(); |
69 |
|
63 |
// location configuration |
70 |
// location configuration |
64 |
private Point dialogLocation; |
71 |
private Point dialogLocation; |
65 |
private Point dialogSize; |
72 |
private Point dialogSize; |
Lines 101-110
Link Here
|
101 |
} |
108 |
} |
102 |
|
109 |
|
103 |
private void resetChildIndex() { |
110 |
private void resetChildIndex() { |
104 |
if (!(entry instanceof AbstractEntry)) { |
|
|
105 |
return; |
106 |
} |
107 |
|
108 |
if (entryChildren == null) |
111 |
if (entryChildren == null) |
109 |
return; |
112 |
return; |
110 |
|
113 |
|
Lines 318-324
Link Here
|
318 |
severityLabel.setText(logEntry.getSeverityText()); |
321 |
severityLabel.setText(logEntry.getSeverityText()); |
319 |
msgText.setText(logEntry.getMessage() != null ? logEntry.getMessage() : ""); //$NON-NLS-1$ |
322 |
msgText.setText(logEntry.getMessage() != null ? logEntry.getMessage() : ""); //$NON-NLS-1$ |
320 |
String stack = logEntry.getStack(); |
323 |
String stack = logEntry.getStack(); |
|
|
324 |
|
321 |
if (stack != null) { |
325 |
if (stack != null) { |
|
|
326 |
stack = filterStack(stack); |
322 |
stackTraceText.setText(stack); |
327 |
stackTraceText.setText(stack); |
323 |
} else { |
328 |
} else { |
324 |
stackTraceText.setText(Messages.EventDetailsDialog_noStack); |
329 |
stackTraceText.setText(Messages.EventDetailsDialog_noStack); |
Lines 581-587
Link Here
|
581 |
|
586 |
|
582 |
private void createStackSection(Composite parent) { |
587 |
private void createStackSection(Composite parent) { |
583 |
Composite container = new Composite(parent, SWT.NONE); |
588 |
Composite container = new Composite(parent, SWT.NONE); |
584 |
GridLayout layout = new GridLayout(); |
589 |
GridLayout layout = new GridLayout(2, false); |
585 |
layout.marginHeight = 0; |
590 |
layout.marginHeight = 0; |
586 |
layout.marginWidth = 6; |
591 |
layout.marginWidth = 6; |
587 |
container.setLayout(layout); |
592 |
container.setLayout(layout); |
Lines 589-603
Link Here
|
589 |
gd.heightHint = 100; |
594 |
gd.heightHint = 100; |
590 |
container.setLayoutData(gd); |
595 |
container.setLayoutData(gd); |
591 |
|
596 |
|
592 |
Label label = new Label(container, SWT.NULL); |
597 |
Label label = new Label(container, SWT.NONE); |
593 |
label.setText(Messages.EventDetailsDialog_exception); |
598 |
label.setText(Messages.EventDetailsDialog_exception); |
594 |
gd = new GridData(GridData.FILL_HORIZONTAL); |
599 |
|
595 |
gd.horizontalSpan = 3; |
600 |
Link link = new Link(container, SWT.NONE); |
596 |
label.setLayoutData(gd); |
601 |
link.setText(Messages.EventDetailsDialog_ConfigureFiltersLink); |
|
|
602 |
link.addSelectionListener(new SelectionAdapter() { |
603 |
public void widgetSelected(SelectionEvent e) { |
604 |
EventDetailsStackFilterDialog dialog = new EventDetailsStackFilterDialog(getShell()); |
605 |
dialog.create(); |
606 |
dialog.getShell().setText(Messages.EventDetailsDialog_FilterDialog); |
607 |
if (dialog.open() == Window.OK) |
608 |
// update filters and currently displayed stack trace |
609 |
stackFilterPatterns = getFilters(); |
610 |
updateProperties(); |
611 |
} |
612 |
|
613 |
}); |
597 |
|
614 |
|
598 |
stackTraceText = new Text(container, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); |
615 |
stackTraceText = new Text(container, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); |
599 |
gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL); |
616 |
gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL); |
600 |
gd.grabExcessHorizontalSpace = true; |
617 |
gd.grabExcessHorizontalSpace = true; |
|
|
618 |
gd.horizontalSpan = 2; |
601 |
stackTraceText.setLayoutData(gd); |
619 |
stackTraceText.setLayoutData(gd); |
602 |
stackTraceText.setEditable(false); |
620 |
stackTraceText.setEditable(false); |
603 |
} |
621 |
} |
Lines 628-633
Link Here
|
628 |
sessionDataText.setEditable(false); |
646 |
sessionDataText.setEditable(false); |
629 |
} |
647 |
} |
630 |
|
648 |
|
|
|
649 |
/** |
650 |
* Loads filters from preferences. |
651 |
* @return filters from preferences or empty array |
652 |
* |
653 |
* @since 3.4 |
654 |
*/ |
655 |
private String[] getFilters() { |
656 |
Preferences prefs = Activator.getDefault().getPluginPreferences(); |
657 |
|
658 |
if (!prefs.getBoolean(EventDetailsStackFilterDialog.FILTER_ENABLED)) { |
659 |
return new String[0]; |
660 |
} |
661 |
|
662 |
String filtersString = prefs.getString(EventDetailsStackFilterDialog.FILTER_LIST); |
663 |
StringTokenizer st = new StringTokenizer(filtersString, ";"); //$NON-NLS-1$ |
664 |
List filters = new ArrayList(); |
665 |
while (st.hasMoreElements()) { |
666 |
String filter = st.nextToken(); |
667 |
filters.add(filter); |
668 |
} |
669 |
|
670 |
return (String[]) filters.toArray(new String[filters.size()]); |
671 |
} |
672 |
|
673 |
/** |
674 |
* Filters stack trace. |
675 |
* Every stack trace line is compared against all patterns. |
676 |
* If line contains any of pattern strings, it's excluded from output. |
677 |
* |
678 |
* @returns filtered stack trace |
679 |
* @since 3.4 |
680 |
*/ |
681 |
private String filterStack(String stack) { |
682 |
if (stackFilterPatterns.length == 0) { |
683 |
return stack; |
684 |
} |
685 |
|
686 |
StringTokenizer st = new StringTokenizer(stack, "\n"); //$NON-NLS-1$ |
687 |
StringBuffer result = new StringBuffer(); |
688 |
while (st.hasMoreTokens()) { |
689 |
String stackElement = st.nextToken(); |
690 |
|
691 |
boolean filtered = false; |
692 |
int i = 0; |
693 |
while ((!filtered) && (i < stackFilterPatterns.length)) { |
694 |
filtered = stackElement.indexOf(stackFilterPatterns[i]) >= 0; |
695 |
i++; |
696 |
} |
697 |
|
698 |
if (!filtered) { |
699 |
result.append(stackElement).append("\n"); //$NON-NLS-1$ |
700 |
} |
701 |
} |
702 |
|
703 |
return result.toString(); |
704 |
} |
705 |
|
631 |
//--------------- configuration handling -------------- |
706 |
//--------------- configuration handling -------------- |
632 |
|
707 |
|
633 |
/** |
708 |
/** |