KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > progress > JobsViewPreferenceDialog


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 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  * Sebastian Davids <sdavids@gmx.de> - Fix for Bug 132156 [Dialogs] Progress Preferences dialog problems
11  *******************************************************************************/

12 package org.eclipse.ui.internal.progress;
13
14 import org.eclipse.jface.dialogs.Dialog;
15 import org.eclipse.jface.preference.BooleanFieldEditor;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.layout.GridData;
18 import org.eclipse.swt.layout.GridLayout;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.swt.widgets.Control;
21 import org.eclipse.swt.widgets.Shell;
22 import org.eclipse.ui.IWorkbenchPreferenceConstants;
23 import org.eclipse.ui.internal.util.PrefUtil;
24 import org.eclipse.ui.preferences.ViewSettingsDialog;
25
26 /**
27  * The JobsViewPreferenceDialog is the dialog that
28  * allows the user to set the preferences.
29  */

30 public class JobsViewPreferenceDialog extends ViewSettingsDialog {
31
32     private BooleanFieldEditor verboseEditor;
33
34     /**
35      * Create a new instance of the receiver.
36      * @param parentShell
37      */

38     public JobsViewPreferenceDialog(Shell parentShell) {
39         super(parentShell);
40     }
41
42     /* (non-Javadoc)
43      * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
44      */

45     protected void configureShell(Shell newShell) {
46         super.configureShell(newShell);
47         newShell.setText(ProgressMessages.JobsViewPreferenceDialog_Title);
48     }
49
50     /* (non-Javadoc)
51      * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
52      */

53     protected Control createDialogArea(Composite parent) {
54         Composite top = (Composite) super.createDialogArea(parent);
55         
56         Composite editArea = new Composite(top, SWT.NONE);
57         editArea.setLayout(new GridLayout());
58         editArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
59         
60         verboseEditor = new BooleanFieldEditor("verbose", ProgressMessages.JobsViewPreferenceDialog_Note, editArea);//$NON-NLS-1$
61
verboseEditor.setPreferenceName(IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS);
62         verboseEditor.setPreferenceStore(PrefUtil.getAPIPreferenceStore());
63         verboseEditor.load();
64         
65         Dialog.applyDialogFont(top);
66         
67         return top;
68     }
69     
70     /* (non-Javadoc)
71      * @see org.eclipse.jface.dialogs.Dialog#okPressed()
72      */

73     protected void okPressed() {
74         verboseEditor.store();
75         super.okPressed();
76     }
77     
78     /* (non-Javadoc)
79      * @see org.eclipse.ui.internal.preferences.ViewSettingsDialog#performDefaults()
80      */

81     protected void performDefaults() {
82         verboseEditor.loadDefault();
83     }
84 }
85
Popular Tags