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;
14 import net.sourceforge.phpeclipse.webbrowser.internal.SWTUtil;
16 import org.eclipse.jface.dialogs.Dialog;
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.layout.GridData;
19 import org.eclipse.swt.layout.GridLayout;
20 import org.eclipse.swt.widgets.Button;
21 import org.eclipse.swt.widgets.Composite;
22 import org.eclipse.swt.widgets.Control;
23 import org.eclipse.swt.widgets.Shell;
24 import org.eclipse.ui.help.WorkbenchHelp;
28 public class InternalBrowserDialog extends Dialog {
29 protected IInternalWebBrowserWorkingCopy browser;
30 protected boolean isEdit;
31 protected Button newPageCheckbox;
32 protected Button clearURLHistoryCheckbox;
37 public InternalBrowserDialog(Shell parentShell, IInternalWebBrowserWorkingCopy browser) {
39 this.browser = browser;
43 protected void configureShell(Shell shell) {
44 super.configureShell(shell);
47 shell.setText(WebBrowserUIPlugin.getResource("%editInternalBrowser"));
51 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
53 protected Control createDialogArea(Composite parent) {
54 Composite composite = (Composite) super.createDialogArea(parent);
55 ((GridLayout)composite.getLayout()).numColumns = 1;
57 Composite comp = new Composite(composite, SWT.NONE);
58 GridLayout layout = new GridLayout(1, true);
59 layout.marginHeight = 10;
60 layout.marginWidth = 10;
61 comp.setLayout(layout);
62 comp.setLayoutData(new GridData(GridData.FILL_BOTH));
63 WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER_INTERNAL);
65 newPageCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%prefBrowserNewPage"), false);
66 clearURLHistoryCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%clearURLHistory"), true);
68 newPageCheckbox.setSelection(browser.getUseNewPage());
69 clearURLHistoryCheckbox.setSelection(browser.getClearHistoryOnExit());
75 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
77 protected void okPressed() {
78 browser.setUseNewPage(newPageCheckbox.getSelection());
79 browser.setClearHistoryOnExit(clearURLHistoryCheckbox.getSelection());