adding direct path to Update Site URL for 1.2.x directory.
[phpeclipse.git] / net.sourceforge.phpeclipse.webbrowser / src / net / sourceforge / phpeclipse / webbrowser / internal / InternalBrowserDialog.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 net.sourceforge.phpeclipse.webbrowser.IInternalWebBrowserWorkingCopy;
14
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;
24
25 /**
26  * 
27  */
28 public class InternalBrowserDialog extends Dialog {
29         protected IInternalWebBrowserWorkingCopy browser;
30
31         protected boolean isEdit;
32
33         protected Button newPageCheckbox;
34
35         protected Button clearURLHistoryCheckbox;
36
37         /**
38          * @param parentShell
39          */
40         public InternalBrowserDialog(Shell parentShell,
41                         IInternalWebBrowserWorkingCopy browser) {
42                 super(parentShell);
43                 this.browser = browser;
44                 isEdit = true;
45         }
46
47         protected void configureShell(Shell shell) {
48                 super.configureShell(shell);
49
50                 if (isEdit)
51                         shell.setText(WebBrowserUIPlugin
52                                         .getResource("%editInternalBrowser"));
53         }
54
55         /*
56          * (non-Javadoc)
57          * 
58          * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
59          */
60         protected Control createDialogArea(Composite parent) {
61                 Composite composite = (Composite) super.createDialogArea(parent);
62                 ((GridLayout) composite.getLayout()).numColumns = 1;
63
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);
72
73                 newPageCheckbox = SWTUtil.createCheckbox(comp, WebBrowserUIPlugin
74                                 .getResource("%prefBrowserNewPage"), false);
75                 clearURLHistoryCheckbox = SWTUtil.createCheckbox(comp,
76                                 WebBrowserUIPlugin.getResource("%clearURLHistory"), true);
77
78                 newPageCheckbox.setSelection(browser.getUseNewPage());
79                 clearURLHistoryCheckbox.setSelection(browser.getClearHistoryOnExit());
80
81                 return composite;
82         }
83
84         /*
85          * (non-Javadoc)
86          * 
87          * @see org.eclipse.jface.dialogs.Dialog#okPressed()
88          */
89         protected void okPressed() {
90                 browser.setUseNewPage(newPageCheckbox.getSelection());
91                 browser.setClearHistoryOnExit(clearURLHistoryCheckbox.getSelection());
92                 browser.save();
93
94                 super.okPressed();
95         }
96 }