annotate snippets/browser/Snippet128.d @ 176:219f3c1087d1

Second browser test -- loads eclipse.org url
author John Reimer <terminal.node@gmail.com>
date Sun, 02 Nov 2008 08:12:48 -0800
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
176
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
1 /*******************************************************************************
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
7 *
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
8 * Contributors:
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
10 * Ported to the D Programming Language:
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
11 * by John Reimer
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
12 *******************************************************************************/
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
13 module Snippet128;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
14
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
15 /*
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
16 * Browser example snippet: bring up a browser
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
17 *
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
18 * For a list of all DWT example snippets see
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
19 * http://www.eclipse.org/swt/snippets/
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
20 *
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
21 * @since 3.0
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
22 */
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
23
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
24 version(linux)
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
25 {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
26 version(build)
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
27 {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
28 pragma(link,"stdc++");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
29 pragma(link,"xpcomglue");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
30 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
31 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
32
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
33 import tango.io.Console;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
34 import dwt.dwthelper.utils;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
35
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
36 import dwt.DWT;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
37 import dwt.DWTError;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
38 import dwt.DWTException;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
39
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
40 import dwt.browser.Browser;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
41 import dwt.browser.ProgressEvent;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
42 import dwt.browser.ProgressListener;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
43 import dwt.browser.StatusTextEvent;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
44 import dwt.browser.StatusTextListener;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
45 import dwt.browser.LocationEvent;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
46 import dwt.browser.LocationListener;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
47
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
48 import dwt.layout.GridLayout;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
49 import dwt.layout.GridData;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
50
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
51 import dwt.widgets.Shell;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
52 import dwt.widgets.Display;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
53 import dwt.widgets.ToolBar;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
54 import dwt.widgets.ToolItem;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
55 import dwt.widgets.Label;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
56 import dwt.widgets.Text;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
57 import dwt.widgets.ProgressBar;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
58 import dwt.widgets.Listener;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
59 import dwt.widgets.Event;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
60
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
61 public static void main(String [] args) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
62 Display display = new Display();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
63 final Shell shell = new Shell(display);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
64 GridLayout gridLayout = new GridLayout();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
65 gridLayout.numColumns = 3;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
66 shell.setLayout(gridLayout);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
67 ToolBar toolbar = new ToolBar(shell, DWT.NONE);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
68 ToolItem itemBack = new ToolItem(toolbar, DWT.PUSH);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
69 itemBack.setText("Back");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
70 ToolItem itemForward = new ToolItem(toolbar, DWT.PUSH);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
71 itemForward.setText("Forward");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
72 ToolItem itemStop = new ToolItem(toolbar, DWT.PUSH);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
73 itemStop.setText("Stop");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
74 ToolItem itemRefresh = new ToolItem(toolbar, DWT.PUSH);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
75 itemRefresh.setText("Refresh");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
76 ToolItem itemGo = new ToolItem(toolbar, DWT.PUSH);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
77 itemGo.setText("Go");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
78
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
79 GridData data = new GridData();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
80 data.horizontalSpan = 3;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
81 toolbar.setLayoutData(data);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
82
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
83 Label labelAddress = new Label(shell, DWT.NONE);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
84 labelAddress.setText("Address");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
85
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
86 final Text location = new Text(shell, DWT.BORDER);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
87 data = new GridData();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
88 data.horizontalAlignment = GridData.FILL;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
89 data.horizontalSpan = 2;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
90 data.grabExcessHorizontalSpace = true;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
91 location.setLayoutData(data);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
92
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
93 Browser browser;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
94 try {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
95 browser = new Browser(shell, DWT.NONE);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
96 } catch (DWTError e) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
97 Cout ("Could not instantiate Browser: " ~ e.getMessage());
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
98 return;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
99 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
100 data = new GridData();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
101 data.horizontalAlignment = GridData.FILL;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
102 data.verticalAlignment = GridData.FILL;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
103 data.horizontalSpan = 3;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
104 data.grabExcessHorizontalSpace = true;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
105 data.grabExcessVerticalSpace = true;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
106 browser.setLayoutData(data);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
107
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
108 Label status = new Label(shell, DWT.NONE);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
109 data = new GridData(GridData.FILL_HORIZONTAL);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
110 data.horizontalSpan = 2;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
111 status.setLayoutData(data);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
112
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
113 ProgressBar progressBar = new ProgressBar(shell, DWT.NONE);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
114 data = new GridData();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
115 data.horizontalAlignment = GridData.END;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
116 progressBar.setLayoutData(data);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
117
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
118 /* event handling */
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
119 Listener listener = new class() Listener {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
120 public void handleEvent(Event event) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
121 ToolItem item = cast(ToolItem)event.widget;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
122 String string = item.getText();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
123 if (string.equals("Back")) browser.back();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
124 else if (string.equals("Forward")) browser.forward();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
125 else if (string.equals("Stop")) browser.stop();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
126 else if (string.equals("Refresh")) browser.refresh();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
127 else if (string.equals("Go")) browser.setUrl(location.getText());
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
128 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
129 };
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
130 browser.addProgressListener(new class() ProgressListener {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
131 public void changed(ProgressEvent event) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
132 if (event.total == 0) return;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
133 int ratio = event.current * 100 / event.total;
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
134 progressBar.setSelection(ratio);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
135 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
136 public void completed(ProgressEvent event) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
137 progressBar.setSelection(0);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
138 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
139 });
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
140 browser.addStatusTextListener(new class() StatusTextListener {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
141 public void changed(StatusTextEvent event) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
142 status.setText(event.text);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
143 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
144 });
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
145 browser.addLocationListener(new class() LocationListener {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
146 public void changed(LocationEvent event) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
147 if (event.top) location.setText(event.location);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
148 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
149 public void changing(LocationEvent event) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
150 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
151 });
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
152 itemBack.addListener(DWT.Selection, listener);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
153 itemForward.addListener(DWT.Selection, listener);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
154 itemStop.addListener(DWT.Selection, listener);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
155 itemRefresh.addListener(DWT.Selection, listener);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
156 itemGo.addListener(DWT.Selection, listener);
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
157 location.addListener(DWT.DefaultSelection, new class() Listener {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
158 public void handleEvent(Event e) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
159 browser.setUrl(location.getText());
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
160 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
161 });
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
162
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
163 shell.open();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
164 browser.setUrl("http://eclipse.org");
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
165
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
166 while (!shell.isDisposed()) {
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
167 if (!display.readAndDispatch())
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
168 display.sleep();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
169 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
170 display.dispose();
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
171 }
219f3c1087d1 Second browser test -- loads eclipse.org url
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
172