Open PHP Help Online Manual in the browser / add other http querie for google and...
[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  * The preference page that holds webbrowser preferences.
26  */
27 public class WebBrowserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
28         /**
29          * WebBrowserPreferencePage constructor comment.
30          */
31         public WebBrowserPreferencePage() {
32                 super();
33                 noDefaultAndApplyButton();
34         }
35
36         /**
37          * Create the preference options.
38          *
39          * @param parent org.eclipse.swt.widgets.Composite
40          * @return org.eclipse.swt.widgets.Control
41          */
42         protected Control createContents(Composite parent) {
43                 initializeDialogUnits(parent);
44
45                 Composite composite = new Composite(parent, SWT.NONE);
46                 GridLayout layout = new GridLayout();
47                 layout.numColumns = 1;
48                 layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
49                 layout.verticalSpacing = convertVerticalDLUsToPixels(4);
50                 layout.marginWidth = 0;
51                 layout.marginHeight = 0;
52                 composite.setLayout(layout);
53                 GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
54                 composite.setLayoutData(data);
55                 PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER);
56
57                 Label label = new Label(composite, SWT.WRAP);
58                 label.setText(WebBrowserUIPlugin.getResource("%preferenceWebBrowserDescription"));
59                 data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
60                 label.setLayoutData(data);
61
62                 BrowserTableComposite browserComposite = new BrowserTableComposite(composite, SWT.NONE);
63
64                 data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
65                 browserComposite.setLayoutData(data);
66
67                 Dialog.applyDialogFont(composite);
68
69                 return composite;
70         }
71
72         /**
73          * Initializes this preference page using the passed desktop.
74          *
75          * @param desktop the current desktop
76          */
77         public void init(IWorkbench workbench) { }
78
79         /**
80          *
81          */
82         public void setVisible(boolean visible) {
83                 super.setVisible(visible);
84                 if (visible)
85                         setTitle(WebBrowserUIPlugin.getResource("%preferenceWebBrowserTitleLong"));
86         }
87 }