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.help.WorkbenchHelp;
 
  27 public class InternalBrowserDialog extends Dialog {
 
  28         protected IInternalWebBrowserWorkingCopy browser;
 
  29         protected boolean isEdit;
 
  30         protected Button newPageCheckbox;
 
  31         protected Button clearURLHistoryCheckbox;
 
  36         public InternalBrowserDialog(Shell parentShell, IInternalWebBrowserWorkingCopy browser) {
 
  38                 this.browser = browser;
 
  42         protected void configureShell(Shell shell) {
 
  43                 super.configureShell(shell);
 
  46                         shell.setText(WebBrowserUIPlugin.getResource("%editInternalBrowser"));
 
  50          * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 
  52         protected Control createDialogArea(Composite parent) {
 
  53                 Composite composite = (Composite) super.createDialogArea(parent);
 
  54                 ((GridLayout)composite.getLayout()).numColumns = 1;
 
  56                 Composite comp = new Composite(composite, SWT.NONE);
 
  57                 GridLayout layout = new GridLayout(1, true);
 
  58                 layout.marginHeight = 10;
 
  59                 layout.marginWidth = 10;
 
  60                 comp.setLayout(layout);
 
  61                 comp.setLayoutData(new GridData(GridData.FILL_BOTH));
 
  62                 WorkbenchHelp.setHelp(composite, ContextIds.PREF_BROWSER_INTERNAL);
 
  64                 newPageCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%prefBrowserNewPage"), false);
 
  65                 clearURLHistoryCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin.getResource("%clearURLHistory"), true);
 
  67                 newPageCheckbox.setSelection(browser.getUseNewPage());
 
  68                 clearURLHistoryCheckbox.setSelection(browser.getClearHistoryOnExit());
 
  74          * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 
  76         protected void okPressed() {
 
  77                 browser.setUseNewPage(newPageCheckbox.getSelection());
 
  78                 browser.setClearHistoryOnExit(clearURLHistoryCheckbox.getSelection());