intial source from http://www.sf.net/projects/wdte
[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.swt.*;
14 import org.eclipse.swt.layout.*;
15 import org.eclipse.swt.widgets.*;
16 import org.eclipse.jface.dialogs.Dialog;
17 import org.eclipse.jface.preference.PreferencePage;
18 import org.eclipse.ui.IWorkbench;
19 import org.eclipse.ui.IWorkbenchPreferencePage;
20 import org.eclipse.ui.help.WorkbenchHelp;
21 /**
22  * The preference page that holds webbrowser preferences.
23  */
24 public class WebBrowserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
25         /**
26          * WebBrowserPreferencePage constructor comment.
27          */
28         public WebBrowserPreferencePage() {
29                 super();
30                 noDefaultAndApplyButton();
31         }
32
33         /**
34          * Create the preference options.
35          *
36          * @param parent org.eclipse.swt.widgets.Composite
37          * @return org.eclipse.swt.widgets.Control
38          */
39         protected Control createContents(Composite parent) {
40                 initializeDialogUnits(parent);
41                 
42                 Composite composite = new Composite(parent, SWT.NONE);
43                 GridLayout layout = new GridLayout();
44                 layout.numColumns = 1;
45                 layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
46                 layout.verticalSpacing = convertVerticalDLUsToPixels(4);
47                 layout.marginWidth = 0;
48                 layout.marginHeight = 0;
49                 composite.setLayout(layout);
50                 GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
51                 composite.setLayoutData(data);
52                 WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER);
53                 
54                 Label label = new Label(composite, SWT.WRAP);
55                 label.setText(WebBrowserUIPlugin.getResource("%preferenceWebBrowserDescription"));
56                 data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
57                 label.setLayoutData(data);
58                 
59                 BrowserTableComposite browserComposite = new BrowserTableComposite(composite, SWT.NONE);
60                 
61                 data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
62                 browserComposite.setLayoutData(data);
63                 
64                 Dialog.applyDialogFont(composite);
65                 
66                 return composite;
67         }
68         
69         /**
70          * Initializes this preference page using the passed desktop.
71          *
72          * @param desktop the current desktop
73          */
74         public void init(IWorkbench workbench) { }
75         
76         /**
77          * 
78          */
79         public void setVisible(boolean visible) {
80                 super.setVisible(visible);
81                 if (visible)
82                         setTitle(WebBrowserUIPlugin.getResource("%preferenceWebBrowserTitleLong"));
83         }
84 }