initial contribution
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / ui / internal / ConfigurationPrefrencesDialog.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.phpeclipse.wiki.ui.internal;
12
13 import net.sourceforge.phpeclipse.webbrowser.internal.ContextIds;
14 import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
15 import net.sourceforge.phpeclipse.wiki.internal.IConfigurationWorkingCopy;
16
17 import org.eclipse.jface.dialogs.Dialog;
18 import org.eclipse.jface.dialogs.IDialogConstants;
19 import org.eclipse.swt.SWT;
20 import org.eclipse.swt.layout.GridData;
21 import org.eclipse.swt.layout.GridLayout;
22 import org.eclipse.swt.widgets.Composite;
23 import org.eclipse.swt.widgets.Control;
24 import org.eclipse.swt.widgets.Shell;
25 import org.eclipse.ui.help.WorkbenchHelp;
26
27 /**
28  *  
29  */
30 public class ConfigurationPrefrencesDialog extends Dialog {
31   protected IConfigurationWorkingCopy monitor;
32
33   protected boolean isEdit;
34
35   /**
36    * @param parentShell
37    */
38   public ConfigurationPrefrencesDialog(Shell parentShell, IConfigurationWorkingCopy monitor) {
39     super(parentShell);
40     this.monitor = monitor;
41     isEdit = true;
42   }
43
44   public ConfigurationPrefrencesDialog(Shell composite) {
45     super(composite);
46     isEdit = false;
47   }
48
49   protected void configureShell(Shell shell) {
50     super.configureShell(shell);
51     shell.setText(WikiEditorPlugin.getResource("%preferenceTitle"));
52   }
53
54   /*
55    * (non-Javadoc)
56    * 
57    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
58    */
59   protected Control createDialogArea(Composite parent) {
60     Composite compositeParent = (Composite) super.createDialogArea(parent);
61
62     Composite composite = new Composite(compositeParent, SWT.NONE);
63     GridLayout layout = new GridLayout();
64     layout.marginHeight = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
65     layout.marginWidth = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
66     layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
67     composite.setLayout(layout);
68     GridData data = new GridData(GridData.FILL_BOTH);
69     composite.setLayoutData(data);
70     //          WorkbenchHelp.setHelp(composite, ContextIds.PREF);
71
72     ConfigurationComposite monitorComp = new ConfigurationComposite(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    * (non-Javadoc)
83    * 
84    * @see org.eclipse.jface.dialogs.Dialog#okPressed()
85    */
86   protected void okPressed() {
87     WikiEditorPlugin.getDefault().savePluginPreferences();
88     super.okPressed();
89   }
90 }