|
Lines 21-26
Link Here
|
| 21 |
import org.eclipse.jdt.core.IType; |
21 |
import org.eclipse.jdt.core.IType; |
| 22 |
import org.eclipse.jdt.core.JavaModelException; |
22 |
import org.eclipse.jdt.core.JavaModelException; |
| 23 |
import org.eclipse.jdt.core.search.SearchEngine; |
23 |
import org.eclipse.jdt.core.search.SearchEngine; |
|
|
24 |
|
| 25 |
import org.eclipse.jdt.internal.junit.util.ColorEditor; |
| 24 |
import org.eclipse.jdt.internal.junit.util.ExceptionHandler; |
26 |
import org.eclipse.jdt.internal.junit.util.ExceptionHandler; |
| 25 |
import org.eclipse.jdt.internal.junit.util.SWTUtil; |
27 |
import org.eclipse.jdt.internal.junit.util.SWTUtil; |
| 26 |
import org.eclipse.jdt.ui.IJavaElementSearchConstants; |
28 |
import org.eclipse.jdt.ui.IJavaElementSearchConstants; |
|
Lines 31-36
Link Here
|
| 31 |
import org.eclipse.jface.dialogs.IDialogConstants; |
33 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 32 |
import org.eclipse.jface.dialogs.ProgressMonitorDialog; |
34 |
import org.eclipse.jface.dialogs.ProgressMonitorDialog; |
| 33 |
import org.eclipse.jface.preference.IPreferenceStore; |
35 |
import org.eclipse.jface.preference.IPreferenceStore; |
|
|
36 |
import org.eclipse.jface.preference.PreferenceConverter; |
| 34 |
import org.eclipse.jface.preference.PreferencePage; |
37 |
import org.eclipse.jface.preference.PreferencePage; |
| 35 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
38 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
| 36 |
import org.eclipse.jface.viewers.CheckboxTableViewer; |
39 |
import org.eclipse.jface.viewers.CheckboxTableViewer; |
|
Lines 55-66
Link Here
|
| 55 |
import org.eclipse.swt.events.KeyAdapter; |
58 |
import org.eclipse.swt.events.KeyAdapter; |
| 56 |
import org.eclipse.swt.events.KeyEvent; |
59 |
import org.eclipse.swt.events.KeyEvent; |
| 57 |
import org.eclipse.swt.graphics.Image; |
60 |
import org.eclipse.swt.graphics.Image; |
|
|
61 |
import org.eclipse.swt.graphics.RGB; |
| 58 |
import org.eclipse.swt.layout.GridData; |
62 |
import org.eclipse.swt.layout.GridData; |
| 59 |
import org.eclipse.swt.layout.GridLayout; |
63 |
import org.eclipse.swt.layout.GridLayout; |
| 60 |
import org.eclipse.swt.widgets.Button; |
64 |
import org.eclipse.swt.widgets.Button; |
| 61 |
import org.eclipse.swt.widgets.Composite; |
65 |
import org.eclipse.swt.widgets.Composite; |
| 62 |
import org.eclipse.swt.widgets.Control; |
66 |
import org.eclipse.swt.widgets.Control; |
| 63 |
import org.eclipse.swt.widgets.Event; |
67 |
import org.eclipse.swt.widgets.Event; |
|
|
68 |
import org.eclipse.swt.widgets.Group; |
| 64 |
import org.eclipse.swt.widgets.Label; |
69 |
import org.eclipse.swt.widgets.Label; |
| 65 |
import org.eclipse.swt.widgets.Listener; |
70 |
import org.eclipse.swt.widgets.Listener; |
| 66 |
import org.eclipse.swt.widgets.Shell; |
71 |
import org.eclipse.swt.widgets.Shell; |
|
Lines 93-98
Link Here
|
| 93 |
"junit.framework.Assert", //$NON-NLS-1$ |
98 |
"junit.framework.Assert", //$NON-NLS-1$ |
| 94 |
"java.lang.reflect.Method.invoke" //$NON-NLS-1$ |
99 |
"java.lang.reflect.Method.invoke" //$NON-NLS-1$ |
| 95 |
}; |
100 |
}; |
|
|
101 |
|
| 102 |
private static final RGB DEFAULT_OK_COLOR= new RGB(63, 127, 63); |
| 103 |
private static final RGB DEFAULT_FAILURE_COLOR= new RGB(223, 63, 63); |
| 96 |
|
104 |
|
| 97 |
// Step filter widgets |
105 |
// Step filter widgets |
| 98 |
private CheckboxTableViewer fFilterViewer; |
106 |
private CheckboxTableViewer fFilterViewer; |
|
Lines 115-120
Link Here
|
| 115 |
private Label fTableLabel; |
123 |
private Label fTableLabel; |
| 116 |
|
124 |
|
| 117 |
private StackFilterContentProvider fStackFilterContentProvider; |
125 |
private StackFilterContentProvider fStackFilterContentProvider; |
|
|
126 |
private ColorEditor fOkColorButton; |
| 127 |
private ColorEditor fFailureColorButton; |
| 118 |
|
128 |
|
| 119 |
/** |
129 |
/** |
| 120 |
* Model object that represents a single entry in the filter table. |
130 |
* Model object that represents a single entry in the filter table. |
|
Lines 329-340
Link Here
|
| 329 |
data.verticalAlignment= GridData.FILL; |
339 |
data.verticalAlignment= GridData.FILL; |
| 330 |
data.horizontalAlignment= GridData.FILL; |
340 |
data.horizontalAlignment= GridData.FILL; |
| 331 |
composite.setLayoutData(data); |
341 |
composite.setLayoutData(data); |
| 332 |
|
342 |
|
|
|
343 |
createColorPickers(composite); |
| 333 |
createStackFilterPreferences(composite); |
344 |
createStackFilterPreferences(composite); |
| 334 |
Dialog.applyDialogFont(composite); |
345 |
Dialog.applyDialogFont(composite); |
| 335 |
return composite; |
346 |
return composite; |
| 336 |
} |
347 |
} |
| 337 |
|
348 |
|
|
|
349 |
private void createColorPickers(Composite composite) { |
| 350 |
Composite colorPickerComposite= new Composite(composite, SWT.NONE); |
| 351 |
colorPickerComposite.setLayoutData(new GridData()); |
| 352 |
GridLayout gl= new GridLayout(); |
| 353 |
gl.numColumns= 2; |
| 354 |
gl.marginHeight= 0; |
| 355 |
gl.marginWidth= 0; |
| 356 |
colorPickerComposite.setLayout(gl); |
| 357 |
|
| 358 |
Label okLabel= new Label(colorPickerComposite, SWT.NONE); |
| 359 |
okLabel.setText(JUnitMessages.getString("JUnitPreferencePage.ok.color")); //$NON-NLS-1$ |
| 360 |
okLabel.setLayoutData(new GridData()); |
| 361 |
|
| 362 |
fOkColorButton= new ColorEditor(colorPickerComposite); |
| 363 |
fOkColorButton.setColorValue(getOKColor()); |
| 364 |
fOkColorButton.getButton().setLayoutData(new GridData()); |
| 365 |
|
| 366 |
Label failureLabel= new Label(colorPickerComposite, SWT.NONE); |
| 367 |
failureLabel.setText(JUnitMessages.getString("JUnitPreferencePage.failure.color")); //$NON-NLS-1$ |
| 368 |
failureLabel.setLayoutData(new GridData()); |
| 369 |
|
| 370 |
fFailureColorButton= new ColorEditor(colorPickerComposite); |
| 371 |
fFailureColorButton.setColorValue(getFailureColor()); |
| 372 |
fFailureColorButton.getButton().setLayoutData(new GridData()); |
| 373 |
} |
| 374 |
|
| 338 |
/** |
375 |
/** |
| 339 |
* Create a group to contain the step filter related widgetry |
376 |
* Create a group to contain the step filter related widgetry |
| 340 |
*/ |
377 |
*/ |
|
Lines 732-737
Link Here
|
| 732 |
IPreferenceStore store= getPreferenceStore(); |
769 |
IPreferenceStore store= getPreferenceStore(); |
| 733 |
store.setValue(IJUnitPreferencesConstants.SHOW_ON_ERROR_ONLY, fShowOnErrorCheck.getSelection()); |
770 |
store.setValue(IJUnitPreferencesConstants.SHOW_ON_ERROR_ONLY, fShowOnErrorCheck.getSelection()); |
| 734 |
fStackFilterContentProvider.saveFilters(); |
771 |
fStackFilterContentProvider.saveFilters(); |
|
|
772 |
PreferenceConverter.setValue(store, IJUnitPreferencesConstants.PREF_COLOR_OK, fOkColorButton.getColorValue()); |
| 773 |
PreferenceConverter.setValue(store, IJUnitPreferencesConstants.PREF_COLOR_FAILURE, fFailureColorButton.getColorValue()); |
| 735 |
return true; |
774 |
return true; |
| 736 |
} |
775 |
} |
| 737 |
|
776 |
|
|
Lines 742-747
Link Here
|
| 742 |
|
781 |
|
| 743 |
private void setDefaultValues() { |
782 |
private void setDefaultValues() { |
| 744 |
fStackFilterContentProvider.setDefaults(); |
783 |
fStackFilterContentProvider.setDefaults(); |
|
|
784 |
fOkColorButton.setColorValue(DEFAULT_OK_COLOR); |
| 785 |
fFailureColorButton.setColorValue(DEFAULT_FAILURE_COLOR); |
| 745 |
} |
786 |
} |
| 746 |
|
787 |
|
| 747 |
/** |
788 |
/** |
|
Lines 814-819
Link Here
|
| 814 |
public static boolean getShowOnErrorOnly() { |
855 |
public static boolean getShowOnErrorOnly() { |
| 815 |
IPreferenceStore store= JUnitPlugin.getDefault().getPreferenceStore(); |
856 |
IPreferenceStore store= JUnitPlugin.getDefault().getPreferenceStore(); |
| 816 |
return store.getBoolean(IJUnitPreferencesConstants.SHOW_ON_ERROR_ONLY); |
857 |
return store.getBoolean(IJUnitPreferencesConstants.SHOW_ON_ERROR_ONLY); |
|
|
858 |
} |
| 859 |
|
| 860 |
public static RGB getOKColor() { |
| 861 |
IPreferenceStore store= JUnitPlugin.getDefault().getPreferenceStore(); |
| 862 |
RGB color= PreferenceConverter.getColor(store, IJUnitPreferencesConstants.PREF_COLOR_OK); |
| 863 |
if (color.equals(PreferenceConverter.COLOR_DEFAULT_DEFAULT)) |
| 864 |
return DEFAULT_OK_COLOR; |
| 865 |
return color; |
| 866 |
} |
| 867 |
|
| 868 |
public static RGB getFailureColor() { |
| 869 |
IPreferenceStore store= JUnitPlugin.getDefault().getPreferenceStore(); |
| 870 |
RGB color= PreferenceConverter.getColor(store, IJUnitPreferencesConstants.PREF_COLOR_FAILURE); |
| 871 |
if (color.equals(PreferenceConverter.COLOR_DEFAULT_DEFAULT)) |
| 872 |
return DEFAULT_FAILURE_COLOR; |
| 873 |
return color; |
| 817 |
} |
874 |
} |
| 818 |
|
875 |
|
| 819 |
/** |
876 |
/** |