KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit > ui > JUnitPreferencesConstants


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * David Saff (saff@mit.edu) - bug 102632: [JUnit] Support for JUnit 4.
11  *******************************************************************************/

12 package org.eclipse.jdt.internal.junit.ui;
13
14 import java.util.Arrays JavaDoc;
15 import java.util.List JavaDoc;
16
17 /**
18  * Defines constants which are used to refer to values in the plugin's preference store.
19  */

20 public class JUnitPreferencesConstants {
21     /**
22      * Boolean preference controlling whether the failure stack should be
23      * filtered.
24      */

25     public static final String JavaDoc DO_FILTER_STACK= JUnitPlugin.PLUGIN_ID + ".do_filter_stack"; //$NON-NLS-1$
26

27     /**
28      * Boolean preference controlling whether the JUnit view should be shown on
29      * errors only.
30      */

31     public static final String JavaDoc SHOW_ON_ERROR_ONLY= JUnitPlugin.PLUGIN_ID + ".show_on_error"; //$NON-NLS-1$
32

33     /**
34      * Boolean preference controlling whether the JUnit view should be shown on
35      * errors only.
36      */

37     public static final String JavaDoc ENABLE_ASSERTIONS= JUnitPlugin.PLUGIN_ID + ".enable_assertions"; //$NON-NLS-1$
38

39     /**
40      * List of active stack filters. A String containing a comma separated list
41      * of fully qualified type names/patterns.
42      */

43     public static final String JavaDoc PREF_ACTIVE_FILTERS_LIST = JUnitPlugin.PLUGIN_ID + ".active_filters"; //$NON-NLS-1$
44

45     /**
46      * List of inactive stack filters. A String containing a comma separated
47      * list of fully qualified type names/patterns.
48      */

49     public static final String JavaDoc PREF_INACTIVE_FILTERS_LIST = JUnitPlugin.PLUGIN_ID + ".inactive_filters"; //$NON-NLS-1$
50

51     /**
52      * Maximum number of remembered test runs.
53      */

54     public static final String JavaDoc MAX_TEST_RUNS= JUnitPlugin.PLUGIN_ID + ".max_test_runs"; //$NON-NLS-1$
55

56     /**
57      * Javadoc location for JUnit 3
58      */

59     public static final String JavaDoc JUNIT3_JAVADOC= JUnitPlugin.PLUGIN_ID + ".junit3.javadoclocation"; //$NON-NLS-1$
60

61     
62     /**
63      * Javadoc location for JUnit 4
64      */

65     public static final String JavaDoc JUNIT4_JAVADOC= JUnitPlugin.PLUGIN_ID + ".junit4.javadoclocation"; //$NON-NLS-1$
66

67
68     private static final String JavaDoc[] fgDefaultFilterPatterns= new String JavaDoc[] {
69         "org.eclipse.jdt.internal.junit.runner.*", //$NON-NLS-1$
70
"org.eclipse.jdt.internal.junit4.runner.*", //$NON-NLS-1$
71
"org.eclipse.jdt.internal.junit.ui.*", //$NON-NLS-1$
72
"junit.framework.TestCase", //$NON-NLS-1$
73
"junit.framework.TestResult", //$NON-NLS-1$
74
"junit.framework.TestResult$1", //$NON-NLS-1$
75
"junit.framework.TestSuite", //$NON-NLS-1$
76
"junit.framework.Assert", //$NON-NLS-1$
77
"org.junit.*", //$NON-NLS-1$ //TODO: filter all these?
78
"java.lang.reflect.Method.invoke", //$NON-NLS-1$
79
"sun.reflect.*", //$NON-NLS-1$
80
};
81     
82     private JUnitPreferencesConstants() {
83         // no instance
84
}
85     
86     /**
87      * Returns the default list of active stack filters.
88      *
89      * @return list
90      */

91     public static List JavaDoc createDefaultStackFiltersList() {
92         return Arrays.asList(fgDefaultFilterPatterns);
93     }
94
95     /**
96      * Serializes the array of strings into one comma
97      * separated string.
98      *
99      * @param list array of strings
100      * @return a single string composed of the given list
101      */

102     public static String JavaDoc serializeList(String JavaDoc[] list) {
103         if (list == null)
104             return ""; //$NON-NLS-1$
105

106         StringBuffer JavaDoc buffer= new StringBuffer JavaDoc();
107         for (int i= 0; i < list.length; i++) {
108             if (i > 0)
109                 buffer.append(',');
110
111             buffer.append(list[i]);
112         }
113         return buffer.toString();
114     }
115 }
116
Popular Tags