Eliminate CLASSNAME duplicate from object properties, see http://bugs.xdebug.org...
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / preferences / ConfigurationPreferencePage.java
1 /**********************************************************************
2  * Copyright (c) 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  �*
8  * Contributors:
9  *    IBM - Initial API and implementation
10  **********************************************************************/
11 package net.sourceforge.phpdt.httpquery.preferences;
12
13 import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
14
15 import org.eclipse.jface.dialogs.Dialog;
16 import org.eclipse.jface.preference.PreferencePage;
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.layout.GridData;
19 import org.eclipse.swt.layout.GridLayout;
20 import org.eclipse.swt.widgets.Composite;
21 import org.eclipse.swt.widgets.Control;
22 import org.eclipse.swt.widgets.Label;
23 import org.eclipse.ui.IWorkbench;
24 import org.eclipse.ui.IWorkbenchPreferencePage;
25
26 /**
27  * The preference page that holds monitor properties.
28  */
29 public class ConfigurationPreferencePage extends PreferencePage implements
30                 IWorkbenchPreferencePage {
31
32         /**
33          * ConfigurationPreferencePage constructor comment.
34          */
35         public ConfigurationPreferencePage() {
36                 super();
37                 noDefaultAndApplyButton();
38         }
39
40         /**
41          * Create the preference options.
42          * 
43          * @param parent
44          *            org.eclipse.swt.widgets.Composite
45          * @return org.eclipse.swt.widgets.Control
46          */
47         protected Control createContents(Composite parent) {
48                 initializeDialogUnits(parent);
49
50                 Composite composite = new Composite(parent, SWT.NONE);
51                 GridLayout layout = new GridLayout();
52                 layout.numColumns = 1;
53                 layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
54                 layout.verticalSpacing = convertVerticalDLUsToPixels(4);
55                 layout.marginWidth = 0;
56                 layout.marginHeight = 0;
57                 composite.setLayout(layout);
58                 GridData data = new GridData(GridData.FILL_HORIZONTAL
59                                 | GridData.VERTICAL_ALIGN_FILL);
60                 composite.setLayoutData(data);
61                 // WorkbenchHelp.setHelp(composite, ContextIds.PREF);
62
63                 Label label = new Label(composite, SWT.WRAP);
64                 label.setText(PHPHelpPlugin.getResource("%preferenceDescription"));
65                 data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
66                 label.setLayoutData(data);
67
68                 label = new Label(composite, SWT.NONE);
69                 label.setText("");
70
71                 ConfigurationComposite monitorComp = new ConfigurationComposite(
72                                 composite, SWT.NONE);
73                 data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
74                 monitorComp.setLayoutData(data);
75
76                 Dialog.applyDialogFont(composite);
77
78                 return composite;
79         }
80
81         /**
82          * Initializes this preference page using the passed desktop.
83          * 
84          * @param desktop
85          *            the current desktop
86          */
87         public void init(IWorkbench workbench) {
88         }
89
90         /**
91          * Performs special processing when this page's Defaults button has been
92          * pressed.
93          * <p>
94          * This is a framework hook method for sublcasses to do special things when
95          * the Defaults button has been pressed. Subclasses may override, but should
96          * call <code>super.performDefaults</code>.
97          * </p>
98          */
99         protected void performDefaults() {
100                 // displayButton.setSelection(WikiEditorPlugin.getDefaultShowOnActivityPreference());
101                 super.performDefaults();
102         }
103
104         /**
105          * Method declared on IPreferencePage. Subclasses should override
106          */
107         public boolean performOk() {
108                 // WikiEditorPlugin.setShowOnActivityPreference(displayButton.getSelection());
109                 PHPHelpPlugin.getDefault().savePluginPreferences();
110                 return true;
111         }
112 }