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
9 * IBM - Initial API and implementation
10 **********************************************************************/
11 package net.sourceforge.phpeclipse.webbrowser.internal;
13 import net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowserWorkingCopy;
15 import org.eclipse.jface.dialogs.Dialog;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.layout.GridData;
18 import org.eclipse.swt.layout.GridLayout;
19 import org.eclipse.swt.widgets.Button;
20 import org.eclipse.swt.widgets.Composite;
21 import org.eclipse.swt.widgets.Control;
22 import org.eclipse.swt.widgets.Shell;
23 import org.eclipse.ui.PlatformUI;
28 public class InternalBrowserDialog extends Dialog {
29 protected IInternalWebBrowserWorkingCopy browser;
31 protected boolean isEdit;
33 protected Button newPageCheckbox;
35 protected Button clearURLHistoryCheckbox;
40 public InternalBrowserDialog(Shell parentShell,
41 IInternalWebBrowserWorkingCopy browser) {
43 this.browser = browser;
47 protected void configureShell(Shell shell) {
48 super.configureShell(shell);
51 shell.setText(WebBrowserUIPlugin
52 .getResource("%editInternalBrowser"));
58 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
60 protected Control createDialogArea(Composite parent) {
61 Composite composite = (Composite) super.createDialogArea(parent);
62 ((GridLayout) composite.getLayout()).numColumns = 1;
64 Composite comp = new Composite(composite, SWT.NONE);
65 GridLayout layout = new GridLayout(1, true);
66 layout.marginHeight = 10;
67 layout.marginWidth = 10;
68 comp.setLayout(layout);
69 comp.setLayoutData(new GridData(GridData.FILL_BOTH));
70 PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
71 ContextIds.PREF_BROWSER_INTERNAL);
73 newPageCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin
74 .getResource("%prefBrowserNewPage"), false);
75 clearURLHistoryCheckbox = SWTUtil.createCheckbox(comp,
76 WebBrowserUIPlugin.getResource("%clearURLHistory"), true);
78 newPageCheckbox.setSelection(browser.getUseNewPage());
79 clearURLHistoryCheckbox.setSelection(browser.getClearHistoryOnExit());
87 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
89 protected void okPressed() {
90 browser.setUseNewPage(newPageCheckbox.getSelection());
91 browser.setClearHistoryOnExit(clearURLHistoryCheckbox.getSelection());