01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: * Sebastian Davids <sdavids@gmx.de> - Fix for Bug 132156 [Dialogs] Progress Preferences dialog problems
11: *******************************************************************************/package org.eclipse.ui.internal.progress;
12:
13: import org.eclipse.jface.dialogs.Dialog;
14: import org.eclipse.jface.preference.BooleanFieldEditor;
15: import org.eclipse.swt.SWT;
16: import org.eclipse.swt.layout.GridData;
17: import org.eclipse.swt.layout.GridLayout;
18: import org.eclipse.swt.widgets.Composite;
19: import org.eclipse.swt.widgets.Control;
20: import org.eclipse.swt.widgets.Shell;
21: import org.eclipse.ui.IWorkbenchPreferenceConstants;
22: import org.eclipse.ui.internal.util.PrefUtil;
23: import org.eclipse.ui.preferences.ViewSettingsDialog;
24:
25: /**
26: * The JobsViewPreferenceDialog is the dialog that
27: * allows the user to set the preferences.
28: */
29: public class JobsViewPreferenceDialog extends ViewSettingsDialog {
30:
31: private BooleanFieldEditor verboseEditor;
32:
33: /**
34: * Create a new instance of the receiver.
35: * @param parentShell
36: */
37: public JobsViewPreferenceDialog(Shell parentShell) {
38: super (parentShell);
39: }
40:
41: /* (non-Javadoc)
42: * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
43: */
44: protected void configureShell(Shell newShell) {
45: super .configureShell(newShell);
46: newShell
47: .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
59: | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
60:
61: verboseEditor = new BooleanFieldEditor(
62: "verbose", ProgressMessages.JobsViewPreferenceDialog_Note, editArea);//$NON-NLS-1$
63: verboseEditor
64: .setPreferenceName(IWorkbenchPreferenceConstants.SHOW_SYSTEM_JOBS);
65: verboseEditor.setPreferenceStore(PrefUtil
66: .getAPIPreferenceStore());
67: verboseEditor.load();
68:
69: Dialog.applyDialogFont(top);
70:
71: return top;
72: }
73:
74: /* (non-Javadoc)
75: * @see org.eclipse.jface.dialogs.Dialog#okPressed()
76: */
77: protected void okPressed() {
78: verboseEditor.store();
79: super .okPressed();
80: }
81:
82: /* (non-Javadoc)
83: * @see org.eclipse.ui.internal.preferences.ViewSettingsDialog#performDefaults()
84: */
85: protected void performDefaults() {
86: verboseEditor.loadDefault();
87: }
88: }
|