KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > internal > ui > UIPreferences


1 /*******************************************************************************
2  * Copyright (c) 2006 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: UIPreferences.java 371 2007-07-18 11:19:33Z mtnminds $
7  ******************************************************************************/

8 package com.mountainminds.eclemma.internal.ui;
9
10 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
11 import org.eclipse.jface.dialogs.MessageDialogWithToggle;
12 import org.eclipse.jface.preference.IPreferenceStore;
13
14 import com.mountainminds.eclemma.core.ICorePreferences;
15
16 /**
17  * Constants and initializer for the preference store.
18  *
19  * @author Marc R. Hoffmann
20  * @version $Revision: 371 $
21  */

22 public class UIPreferences extends AbstractPreferenceInitializer {
23
24   public static final String JavaDoc PREF_SHOW_COVERAGE_VIEW = EclEmmaUIPlugin.ID
25      + ".show_coverage_view"; //$NON-NLS-1$
26

27   public static final String JavaDoc PREF_ACTICATE_NEW_SESSIONS = EclEmmaUIPlugin.ID
28     + ".activate_new_sessions"; //$NON-NLS-1$
29

30   public static final String JavaDoc PREF_AUTO_REMOVE_SESSIONS = EclEmmaUIPlugin.ID
31     + ".auto_remove_sessions"; //$NON-NLS-1$
32

33   public static final String JavaDoc PREF_ALLOW_INPLACE_INSTRUMENTATION = EclEmmaUIPlugin.ID
34     + ".allow_inplace_instrumentation"; //$NON-NLS-1$
35

36   public static final ICorePreferences CORE_PREFERENCES = new ICorePreferences() {
37     public boolean getActivateNewSessions() {
38       return getPreferenceStore().getBoolean(PREF_ACTICATE_NEW_SESSIONS);
39     }
40     public boolean getAutoRemoveSessions() {
41       return getPreferenceStore().getBoolean(PREF_AUTO_REMOVE_SESSIONS);
42     }
43   };
44
45   public void initializeDefaultPreferences() {
46     IPreferenceStore pref = getPreferenceStore();
47     pref.setDefault(PREF_SHOW_COVERAGE_VIEW, true);
48     pref.setDefault(PREF_ACTICATE_NEW_SESSIONS, ICorePreferences.DEFAULT.getActivateNewSessions());
49     pref.setDefault(PREF_AUTO_REMOVE_SESSIONS, ICorePreferences.DEFAULT.getAutoRemoveSessions());
50     pref.setDefault(PREF_ALLOW_INPLACE_INSTRUMENTATION, MessageDialogWithToggle.PROMPT);
51   }
52
53   private static IPreferenceStore getPreferenceStore() {
54     return EclEmmaUIPlugin.getInstance().getPreferenceStore();
55   }
56   
57 }
58
Popular Tags