Open PHP Help Online Manual in the browser / add other http querie for google and...
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / preferences / ConfigurationPreferencesDialog.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.httpquery.config.IConfigurationWorkingCopy;
14 import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
15
16 import org.eclipse.jface.dialogs.Dialog;
17 import org.eclipse.jface.dialogs.IDialogConstants;
18 import org.eclipse.swt.SWT;
19 import org.eclipse.swt.layout.GridData;
20 import org.eclipse.swt.layout.GridLayout;
21 import org.eclipse.swt.widgets.Composite;
22 import org.eclipse.swt.widgets.Control;
23 import org.eclipse.swt.widgets.Shell;
24
25 public class ConfigurationPreferencesDialog extends Dialog {
26   protected IConfigurationWorkingCopy monitor;
27
28   protected boolean isEdit;
29
30   /**
31    * @param parentShell
32    */
33   public ConfigurationPreferencesDialog(Shell parentShell, IConfigurationWorkingCopy monitor) {
34     super(parentShell);
35     this.monitor = monitor;
36     isEdit = true;
37   }
38
39   public ConfigurationPreferencesDialog(Shell composite) {
40     super(composite);
41     isEdit = false;
42   }
43
44   protected void configureShell(Shell shell) {
45     super.configureShell(shell);
46     shell.setText(PHPHelpPlugin.getResource("%preferenceTitle"));
47   }
48
49   protected Control createDialogArea(Composite parent) {
50     Composite compositeParent = (Composite) super.createDialogArea(parent);
51
52     Composite composite = new Composite(compositeParent, SWT.NONE);
53     GridLayout layout = new GridLayout();
54     layout.marginHeight = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
55     layout.marginWidth = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
56     layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
57     composite.setLayout(layout);
58     GridData data = new GridData(GridData.FILL_BOTH);
59     composite.setLayoutData(data);
60     //          WorkbenchHelp.setHelp(composite, ContextIds.PREF);
61
62     ConfigurationComposite monitorComp = new ConfigurationComposite(composite, SWT.NONE);
63     data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
64     monitorComp.setLayoutData(data);
65
66     Dialog.applyDialogFont(composite);
67
68     return composite;
69   }
70
71   protected void okPressed() {
72         PHPHelpPlugin.getDefault().savePluginPreferences();
73     super.okPressed();
74   }
75 }