Avoid NullPointerException
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / InternetPreferencePage.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  * A preference page that holds internet preferences.
23  */
24 public class InternetPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
25         /**
26          * InternetPreferencePage constructor comment.
27          */
28         public InternetPreferencePage() {
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("%preferenceInternetDescription"));
56                 data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
57                 label.setLayoutData(data);
58                 
59                 Dialog.applyDialogFont(composite);
60                 
61                 return composite;
62         }
63
64         /**
65          * Initializes this preference page using the passed desktop.
66          *
67          * @param desktop the current desktop
68          */
69         public void init(IWorkbench workbench) { }
70 }