KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > internal > ui > dialogs > CoveragePreferencePage


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: CoveragePreferencePage.java 391 2007-08-19 13:45:35Z mtnminds $
7  ******************************************************************************/

8 package com.mountainminds.eclemma.internal.ui.dialogs;
9
10 import org.eclipse.jface.dialogs.MessageDialogWithToggle;
11 import org.eclipse.jface.preference.BooleanFieldEditor;
12 import org.eclipse.jface.preference.FieldEditorPreferencePage;
13 import org.eclipse.swt.SWT;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.swt.widgets.Control;
16 import org.eclipse.swt.widgets.Label;
17 import org.eclipse.ui.IWorkbench;
18 import org.eclipse.ui.IWorkbenchPreferencePage;
19 import org.eclipse.ui.dialogs.PreferenceLinkArea;
20 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
21
22 import com.mountainminds.eclemma.internal.ui.ContextHelp;
23 import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin;
24 import com.mountainminds.eclemma.internal.ui.UIMessages;
25 import com.mountainminds.eclemma.internal.ui.UIPreferences;
26
27 /**
28  * Implementation of the "Code Coverage" preferences page.
29  *
30  * @author Marc R. Hoffmann
31  * @version $Revision: 391 $
32  */

33 public class CoveragePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
34   
35   private static final String JavaDoc DECORATORS_PAGE = "org.eclipse.ui.preferencePages.Decorators"; //$NON-NLS-1$
36
private static final String JavaDoc ANNOTATIONS_PAGE = "org.eclipse.ui.editors.preferencePages.Annotations"; //$NON-NLS-1$
37

38   public CoveragePreferencePage() {
39      super(GRID);
40      setDescription(UIMessages.CoveragePreferences_description);
41      setPreferenceStore(EclEmmaUIPlugin.getInstance().getPreferenceStore());
42   }
43   
44   public void createControl(Composite parent) {
45     super.createControl(parent);
46     ContextHelp.setHelp(getControl(), ContextHelp.COVERAGE_PREFERENCES);
47   }
48
49   protected Control createContents(Composite parent) {
50     parent = (Composite) super.createContents(parent);
51     new Label(parent, SWT.NONE);
52     new PreferenceLinkArea(parent, SWT.NONE, DECORATORS_PAGE,
53         UIMessages.CoveragePreferencesDecoratorsLink_label,
54         (IWorkbenchPreferenceContainer) getContainer(), null);
55     new PreferenceLinkArea(parent, SWT.NONE, ANNOTATIONS_PAGE,
56         UIMessages.CoveragePreferencesAnnotationsLink_label,
57         (IWorkbenchPreferenceContainer) getContainer(), null);
58     return parent;
59   }
60
61   protected void createFieldEditors() {
62     addField(new BooleanFieldEditor(UIPreferences.PREF_SHOW_COVERAGE_VIEW,
63                                     UIMessages.CoveragePreferencesShowCoverageView_label,
64                                     getFieldEditorParent()));
65     addField(new BooleanFieldEditor(UIPreferences.PREF_ACTICATE_NEW_SESSIONS,
66                                     UIMessages.CoveragePreferencesActivateNewSessions_label,
67                                     getFieldEditorParent()));
68     addField(new BooleanFieldEditor(UIPreferences.PREF_AUTO_REMOVE_SESSIONS,
69                                     UIMessages.CoveragePreferencesAutoRemoveSessions_label,
70                                     getFieldEditorParent()));
71     addField(new ToggleValueFieldEditor(UIPreferences.PREF_ALLOW_INPLACE_INSTRUMENTATION,
72                                     UIMessages.CoveragePreferencesShowInplaceWarning_label,
73                                     getFieldEditorParent(),
74                                     MessageDialogWithToggle.PROMPT, MessageDialogWithToggle.ALWAYS));
75   }
76
77   public void init(IWorkbench workbench) {
78     // nothing to do here
79
}
80
81 }
82
Popular Tags