Fix source not showed (Ticket #654).
[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,
34                         IConfigurationWorkingCopy monitor) {
35                 super(parentShell);
36                 this.monitor = monitor;
37                 isEdit = true;
38         }
39
40         public ConfigurationPreferencesDialog(Shell composite) {
41                 super(composite);
42                 isEdit = false;
43         }
44
45         protected void configureShell(Shell shell) {
46                 super.configureShell(shell);
47                 shell.setText(PHPHelpPlugin.getResource("%preferenceTitle"));
48         }
49
50         protected Control createDialogArea(Composite parent) {
51                 Composite compositeParent = (Composite) super.createDialogArea(parent);
52
53                 Composite composite = new Composite(compositeParent, SWT.NONE);
54                 GridLayout layout = new GridLayout();
55                 layout.marginHeight = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
56                 layout.marginWidth = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
57                 layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
58                 composite.setLayout(layout);
59                 GridData data = new GridData(GridData.FILL_BOTH);
60                 composite.setLayoutData(data);
61                 // WorkbenchHelp.setHelp(composite, ContextIds.PREF);
62
63                 ConfigurationComposite monitorComp = new ConfigurationComposite(
64                                 composite, SWT.NONE);
65                 data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
66                 monitorComp.setLayoutData(data);
67
68                 Dialog.applyDialogFont(composite);
69
70                 return composite;
71         }
72
73         protected void okPressed() {
74                 PHPHelpPlugin.getDefault().savePluginPreferences();
75                 super.okPressed();
76         }
77 }