Fix missed files from cvs to svn migration. again!
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / WebBrowserPreferencePage.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.webbrowser.internal;
12
13 import org.eclipse.jface.dialogs.Dialog;
14 import org.eclipse.jface.preference.PreferencePage;
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.Label;
21 import org.eclipse.ui.IWorkbench;
22 import org.eclipse.ui.IWorkbenchPreferencePage;
23 import org.eclipse.ui.PlatformUI;
24
25 /**
26  * The preference page that holds webbrowser preferences.
27  */
28 public class WebBrowserPreferencePage extends PreferencePage implements
29                 IWorkbenchPreferencePage {
30         /**
31          * WebBrowserPreferencePage constructor comment.
32          */
33         public WebBrowserPreferencePage() {
34                 super();
35                 noDefaultAndApplyButton();
36         }
37
38         /**
39          * Create the preference options.
40          * 
41          * @param parent
42          *            org.eclipse.swt.widgets.Composite
43          * @return org.eclipse.swt.widgets.Control
44          */
45         protected Control createContents(Composite parent) {
46                 initializeDialogUnits(parent);
47
48                 Composite composite = new Composite(parent, SWT.NONE);
49                 GridLayout layout = new GridLayout();
50                 layout.numColumns = 1;
51                 layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
52                 layout.verticalSpacing = convertVerticalDLUsToPixels(4);
53                 layout.marginWidth = 0;
54                 layout.marginHeight = 0;
55                 composite.setLayout(layout);
56                 GridData data = new GridData(GridData.FILL_HORIZONTAL
57                                 | GridData.VERTICAL_ALIGN_FILL);
58                 composite.setLayoutData(data);
59                 PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
60                                 ContextIds.PREF_BROWSER);
61
62                 Label label = new Label(composite, SWT.WRAP);
63                 label.setText(WebBrowserUIPlugin
64                                 .getResource("%preferenceWebBrowserDescription"));
65                 data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
66                 label.setLayoutData(data);
67
68                 BrowserTableComposite browserComposite = new BrowserTableComposite(
69                                 composite, SWT.NONE);
70
71                 data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
72                 browserComposite.setLayoutData(data);
73
74                 Dialog.applyDialogFont(composite);
75
76                 return composite;
77         }
78
79         /**
80          * Initializes this preference page using the passed desktop.
81          * 
82          * @param desktop
83          *            the current desktop
84          */
85         public void init(IWorkbench workbench) {
86         }
87
88         /**
89          * 
90          */
91         public void setVisible(boolean visible) {
92                 super.setVisible(visible);
93                 if (visible)
94                         setTitle(WebBrowserUIPlugin
95                                         .getResource("%preferenceWebBrowserTitleLong"));
96         }
97 }