KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > DebugUIPreferenceInitializer


1 /*******************************************************************************
2  * Copyright (c) 2004, 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  *******************************************************************************/

11 package org.eclipse.debug.internal.ui;
12
13 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
14 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
15 import org.eclipse.debug.internal.ui.views.memory.MemoryViewUtil;
16 import org.eclipse.debug.ui.IDebugUIConstants;
17 import org.eclipse.jface.dialogs.MessageDialogWithToggle;
18 import org.eclipse.jface.preference.IPreferenceStore;
19 import org.eclipse.jface.preference.PreferenceConverter;
20 import org.eclipse.swt.SWT;
21 import org.eclipse.swt.graphics.RGB;
22 import org.eclipse.swt.widgets.Display;
23
24 public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer {
25
26     public DebugUIPreferenceInitializer() {
27         super();
28     }
29
30     /* (non-Javadoc)
31      * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
32      */

33     public void initializeDefaultPreferences() {
34         IPreferenceStore prefs = DebugUIPlugin.getDefault().getPreferenceStore();
35 // Debug PreferencePage
36
prefs.setDefault(IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH, true);
37         prefs.setDefault(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, MessageDialogWithToggle.PROMPT);
38         prefs.setDefault(IDebugUIConstants.PREF_SHOW_DEBUG_PERSPECTIVE_DEFAULT, IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
39         prefs.setDefault(IDebugUIConstants.PREF_SHOW_RUN_PERSPECTIVE_DEFAULT, IDebugUIConstants.PERSPECTIVE_NONE);
40         prefs.setDefault(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES, true);
41         prefs.setDefault(IDebugUIConstants.PREF_ACTIVATE_WORKBENCH, true);
42         prefs.setDefault(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, true);
43         prefs.setDefault(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, MessageDialogWithToggle.NEVER);
44         prefs.setDefault(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND, MessageDialogWithToggle.PROMPT);
45         prefs.setDefault(IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD, MessageDialogWithToggle.ALWAYS);
46         prefs.setDefault(IDebugUIConstants.PREF_REUSE_EDITOR, true);
47         prefs.setDefault(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE, false);
48         prefs.setDefault(IInternalDebugUIConstants.PREF_RELAUNCH_IN_DEBUG_MODE, MessageDialogWithToggle.NEVER);
49         prefs.setDefault(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, MessageDialogWithToggle.PROMPT);
50         prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_BREAKPOINTS, true);
51         prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, true);
52         
53         /**
54          * Context launching preferences. Appear on the the Launching preference page
55          *
56          * @since 3.3.0
57          */

58         prefs.setDefault(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, true);
59         prefs.setDefault(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, true);
60         prefs.setDefault(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE, false);
61         
62         //View Management preference page
63
prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
64         prefs.setDefault(IInternalDebugUIConstants.PREF_TRACK_VIEWS, true);
65         
66         //ConsolePreferencePage
67
prefs.setDefault(IDebugPreferenceConstants.CONSOLE_WRAP, false);
68         prefs.setDefault(IDebugPreferenceConstants.CONSOLE_WIDTH, 80);
69         prefs.setDefault(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, true);
70         prefs.setDefault(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, true);
71         prefs.setDefault(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT, true);
72         prefs.setDefault(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK, 80000);
73         prefs.setDefault(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK, 100000);
74         prefs.setDefault(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH, 8);
75         
76         // colors
77
PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR, new RGB(0, 0, 0));
78         PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR, new RGB(0, 200, 125));
79         PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR, new RGB(255, 0, 0));
80         // can be called in non-UI thread, so we must play safe
81
Display display = DebugUIPlugin.getStandardDisplay();
82         if (Thread.currentThread().equals(display.getThread())) {
83             PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
84         } else {
85             display.asyncExec(new Runnable JavaDoc() {
86                 public void run() {
87                     PreferenceConverter.setDefault(
88                         DebugUIPlugin.getDefault().getPreferenceStore(),
89                         IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR,
90                         DebugUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
91                 }
92             });
93         }
94         
95         PreferenceConverter.setDefault(prefs, IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND, new RGB(255, 255, 0));
96         PreferenceConverter.setDefault(prefs, IDebugUIConstants.PREF_MEMORY_HISTORY_UNKNOWN_COLOR, new RGB(114, 119, 129));
97         PreferenceConverter.setDefault(prefs, IDebugUIConstants.PREF_MEMORY_HISTORY_KNOWN_COLOR, new RGB(0, 0, 0));
98
99         //LaunchHistoryPreferencePage
100
prefs.setDefault(IDebugUIConstants.PREF_MAX_HISTORY_SIZE, 10);
101         
102         //VariableViewsPreferencePage
103
prefs.setDefault(IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_ORIENTATION, IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
104         PreferenceConverter.setDefault(prefs, IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, new RGB(255, 0, 0));
105         prefs.setDefault(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP, false);
106         prefs.setDefault(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, 10000);
107         
108         //Registers View
109
prefs.setDefault(IDebugPreferenceConstants.REGISTERS_DETAIL_PANE_ORIENTATION, IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
110         
111         // Variable/Expression view default settings
112
prefs.setDefault(IDebugUIConstants.ID_VARIABLE_VIEW + '+' + "org.eclipse.debug.ui.ShowDetailPaneAction", true); //$NON-NLS-1$
113
prefs.setDefault(IDebugUIConstants.ID_EXPRESSION_VIEW + '+' + "org.eclipse.debug.ui.ShowDetailPaneAction", true); //$NON-NLS-1$
114
prefs.setDefault(IDebugUIConstants.ID_VARIABLE_VIEW + '+' + "org.eclipse.debug.ui.ShowTypeNamesAction", false); //$NON-NLS-1$
115
prefs.setDefault(IDebugUIConstants.ID_EXPRESSION_VIEW + '+' + "org.eclipse.debug.ui.ShowTypeNamesAction", false); //$NON-NLS-1$
116

117         // set default for column size preference
118
prefs.setDefault(IDebugPreferenceConstants.PREF_COLUMN_SIZE,
119                 IDebugPreferenceConstants.PREF_COLUMN_SIZE_DEFAULT);
120         
121         // set default for row size preference
122
prefs.setDefault(IDebugPreferenceConstants.PREF_ROW_SIZE,
123                 IDebugPreferenceConstants.PREF_ROW_SIZE_DEFAULT);
124         
125         // set default padded string
126
prefs.setDefault(IDebugUIConstants.PREF_PADDED_STR,
127                 IDebugPreferenceConstants.PREF_PADDED_STR_DEFAULT);
128         
129         // set default code page for ascii and ebcdic
130
prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE,
131                 IDebugPreferenceConstants.DEFAULT_ASCII_CP);
132         prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE,
133                 IDebugPreferenceConstants.DEFAULT_EBCDIC_CP);
134         
135         if (MemoryViewUtil.isLinuxGTK()) {
136             prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, false);
137         }
138         else {
139             prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, true);
140         }
141         
142         prefs.setDefault(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE, IDebugPreferenceConstants.DEFAULT_PAGE_SIZE);
143         prefs.setDefault(IDebugPreferenceConstants.PREF_RESET_MEMORY_BLOCK, IDebugPreferenceConstants.RESET_VISIBLE);
144         prefs.setDefault(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PRE_BUFFER_SIZE,IDebugPreferenceConstants.DEFAULT_PAGE_SIZE);
145         prefs.setDefault(IDebugPreferenceConstants.PREF_TABLE_RENDERING_POST_BUFFER_SIZE,IDebugPreferenceConstants.DEFAULT_PAGE_SIZE);
146         
147         /**
148          * new launch configuration filtering options
149          * @since 3.2
150          */

151         prefs.setDefault(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_CLOSED, true);
152         prefs.setDefault(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_DELETED, true);
153         prefs.setDefault(IInternalDebugUIConstants.PREF_FILTER_WORKING_SETS, true);
154         prefs.setDefault(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES, false);
155     }
156 }
157
Popular Tags