summaryrefslogtreecommitdiffstats
path: root/examples/org.eclipse.swt.examples.browser.demos
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.swt.examples.browser.demos')
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/.classpath7
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/.project28
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/about.html28
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/build.properties22
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/back1.jpgbin28021 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/back2.jpgbin28352 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/black.gifbin1066 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/board1.jpgbin17747 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/empty.gifbin848 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/line1.gifbin233 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/style.css30
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/wall.gifbin1066 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/welcome.html53
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css1/white.gifbin910 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/Back640x440.gifbin126237 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/black_chip.gifbin2359 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/line1.gifbin233 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/style.css30
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/texture_cells.gifbin66826 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/wall_chip.gifbin2256 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/welcome.html53
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css2/white_chip.gifbin2275 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/Back640x440.gifbin126237 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/black_pawn.gifbin1883 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/line1.gifbin233 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/style.css30
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/texture_cells.gifbin66826 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/wall_pawn.gifbin2157 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/welcome.html53
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css3/white_pawn.gifbin1836 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/Back640x440.gifbin126237 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/blue_people.gifbin1669 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/gold_people.gifbin1656 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/line1.gifbin233 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/style.css30
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/texture_cells.gifbin66826 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/wall_people.gifbin2211 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/css4/welcome.html53
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/doc-html/swt_browser_demos_ex.html41
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/icons/pawn.gifbin551 -> 0 bytes
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/plugin.properties31
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/plugin.xml55
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/BrowserDemoPlugin.java59
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/Pawns.java232
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/BrowserDemoView.java51
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/EditorTab.java148
-rw-r--r--examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/PawnTab.java261
48 files changed, 0 insertions, 1307 deletions
diff --git a/examples/org.eclipse.swt.examples.browser.demos/.classpath b/examples/org.eclipse.swt.examples.browser.demos/.classpath
deleted file mode 100644
index 065ac06e19..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.swt.examples.browser.demos/.project b/examples/org.eclipse.swt.examples.browser.demos/.project
deleted file mode 100644
index db0b47df6f..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swt.examples.BrowserDemo</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.swt.examples.browser.demos/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.swt.examples.browser.demos/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 714b88aaf5..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Mon Dec 11 15:14:31 EST 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/examples/org.eclipse.swt.examples.browser.demos/about.html b/examples/org.eclipse.swt.examples.browser.demos/about.html
deleted file mode 100644
index 460233046e..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.browser.demos/build.properties b/examples/org.eclipse.swt.examples.browser.demos/build.properties
deleted file mode 100644
index 9764da6cf4..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/build.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###############################################################################
-# Copyright (c) 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.BrowserDemo.jar = src/
-output.BrowserDemo.jar = bin/
-bin.includes = doc-html/,\
- plugin.properties,\
- plugin.xml,\
- about.html,\
- BrowserDemo.jar,\
- css1/,\
- css2/,\
- css3/,\
- css4/,\
- icons/
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/back1.jpg b/examples/org.eclipse.swt.examples.browser.demos/css1/back1.jpg
deleted file mode 100644
index bab9f33410..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/back1.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/back2.jpg b/examples/org.eclipse.swt.examples.browser.demos/css1/back2.jpg
deleted file mode 100644
index 83f68de754..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/back2.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/black.gif b/examples/org.eclipse.swt.examples.browser.demos/css1/black.gif
deleted file mode 100644
index 976c1e9377..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/black.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/board1.jpg b/examples/org.eclipse.swt.examples.browser.demos/css1/board1.jpg
deleted file mode 100644
index 0cc4d5e0e8..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/board1.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/empty.gif b/examples/org.eclipse.swt.examples.browser.demos/css1/empty.gif
deleted file mode 100644
index a6bce4dac9..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/empty.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/line1.gif b/examples/org.eclipse.swt.examples.browser.demos/css1/line1.gif
deleted file mode 100644
index f9a0f34ecf..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/line1.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/style.css b/examples/org.eclipse.swt.examples.browser.demos/css1/style.css
deleted file mode 100644
index 7b36fa934a..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/style.css
+++ /dev/null
@@ -1,30 +0,0 @@
-body {background: url(./back2.jpg) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./white.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./black.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: center;}
-table { border-collapse: collapse; margin: 0;}
-tr {}
-td {height: 32px; width:32px; table-layout: fixed;}
-
-.whitelink a {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;}
-.blacklink a {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;}
-.empty {display: block; background: url(./empty.gif) no-repeat; width:32px; height:32px;}
-
-.whitelink a:hover {display: block; background: url(./white.gif) no-repeat; width:32px; height:32px;}
-.blacklink a:hover {display: block; background: url(./black.gif) no-repeat; width:32px; height:32px;}
-.white {background: url(./white.gif) no-repeat;}
-.black {background: url(./black.gif) no-repeat;}
-.wall {background: url(./wall.gif) no-repeat;}
-
-.playerwhite {float: left; margin: 1em 1em; border: 1px solid gray; background: url(./white.gif) no-repeat; text-align: right; width:100px; height:32px;}
-.playerblack {float: right; margin: 1em 1em; border: 1px solid gray; background: url(./black.gif) no-repeat; text-align: right; width:100px; height:32px;}
-
-.winner {border: 4px solid blue; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/wall.gif b/examples/org.eclipse.swt.examples.browser.demos/css1/wall.gif
deleted file mode 100644
index fb97fc10e8..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/wall.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/welcome.html b/examples/org.eclipse.swt.examples.browser.demos/css1/welcome.html
deleted file mode 100644
index 58e92a35b0..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/welcome.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-<head>
- <title>Start a game</title>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
- <link rel="stylesheet" type="text/css" href="./style.css">
-</head>
-<body>
-<h1>Pawns Game</h1>
-<div class="start">
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart1player">1 player</a>
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart2players">2 players</a>
-</div>
-<h2>How to play</h2>
-This board game is a variant of Reversi and Tic Tac Toe. Each one of the two players sets a pawn on an empty cell of the board.
-<h3>Pawns</h3>
-<ul>
-<li class="white">Player 1</li>
-<li class="black">Player 2</li>
-<li class="wall">Wall. Cannot be reversed.</li>
-</ul>
-<div class="theme">
-Different themes are supported. Theme is configured through a Cascading Style Sheet (CSS) that determines how the HTML content is rendered by the SWT Browser widget.
-<ul class="theme">
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css1">Theme 1</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css2">Theme 2</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css3">Theme 3</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css4">Theme 4</a></li>
-</ul>
-
-</div>
-<h2>How to win</h2>
-The game ends when all cells are filled. The winner is the one with most pawns of their colour.
-
-<h2>Java and HTML integrated through the SWT Browser widget</h2>
-<p>
-Rendering is based on HTML and CSS techniques. Computer moves are programmed in regular
-Java code in the Eclipse plug-in. The SWT Browser widget is used for rendering and reacting
-to user input.
-</p>
-<h3>Implementation</h3>
-<p>
-The board is a table filled with hyperlinks. Cascading Style Sheets
-provide various themes and control the table aesthetic appearance.
-<br>The API <code>org.eclipse.swt.browser.Browser.setText(java.lang.String)</code> draws
-the board game from HTML generated in memory.
-<br>Player moves are captured by implementing the interface <code>org.eclipse.swt.browser.LocationListener</code>.
-e.g the player clicks on a cell that may generate a hyperlink with a URL similar to
-<code>http://www.org.eclipse.swt.examples.browser.demos/xx1yy2</code>. That hyperlink identifies
-the position of the cell selected by the player (column 1, row 2). The move is completed by generating
-new HTML content and invoking <code>Browser.setText</code> to update the board game.
-</p>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css1/white.gif b/examples/org.eclipse.swt.examples.browser.demos/css1/white.gif
deleted file mode 100644
index c43fd96602..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css1/white.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/Back640x440.gif b/examples/org.eclipse.swt.examples.browser.demos/css2/Back640x440.gif
deleted file mode 100644
index 6533821828..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/Back640x440.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/black_chip.gif b/examples/org.eclipse.swt.examples.browser.demos/css2/black_chip.gif
deleted file mode 100644
index c7c6ebd55c..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/black_chip.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/line1.gif b/examples/org.eclipse.swt.examples.browser.demos/css2/line1.gif
deleted file mode 100644
index f9a0f34ecf..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/line1.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/style.css b/examples/org.eclipse.swt.examples.browser.demos/css2/style.css
deleted file mode 100644
index 590749c6b1..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/style.css
+++ /dev/null
@@ -1,30 +0,0 @@
-body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./white_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./black_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall_chip.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: left;}
-table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)}
-tr {}
-td {height:48px; width:48px; table-layout: fixed;}
-
-.whitelink a {display: block; width:48px; height:48px;}
-.blacklink a {display: block; width:48px; height:48px;}
-.empty {display: block; width:48px; height:48px;}
-
-.whitelink a:hover {display: block; background: url(./white_chip.gif) no-repeat; width:48px; height:48px;}
-.blacklink a:hover {display: block; background: url(./black_chip.gif) no-repeat; width:48px; height:48px;}
-.white {background: url(./white_chip.gif) no-repeat;}
-.black {background: url(./black_chip.gif) no-repeat;}
-.wall {background: url(./wall_chip.gif) no-repeat;}
-
-.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./white_chip.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./black_chip.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-
-.winner {border: 4px solid white; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/texture_cells.gif b/examples/org.eclipse.swt.examples.browser.demos/css2/texture_cells.gif
deleted file mode 100644
index f7fee9d24d..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/texture_cells.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/wall_chip.gif b/examples/org.eclipse.swt.examples.browser.demos/css2/wall_chip.gif
deleted file mode 100644
index bdf0b30ebd..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/wall_chip.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/welcome.html b/examples/org.eclipse.swt.examples.browser.demos/css2/welcome.html
deleted file mode 100644
index 58e92a35b0..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/welcome.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-<head>
- <title>Start a game</title>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
- <link rel="stylesheet" type="text/css" href="./style.css">
-</head>
-<body>
-<h1>Pawns Game</h1>
-<div class="start">
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart1player">1 player</a>
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart2players">2 players</a>
-</div>
-<h2>How to play</h2>
-This board game is a variant of Reversi and Tic Tac Toe. Each one of the two players sets a pawn on an empty cell of the board.
-<h3>Pawns</h3>
-<ul>
-<li class="white">Player 1</li>
-<li class="black">Player 2</li>
-<li class="wall">Wall. Cannot be reversed.</li>
-</ul>
-<div class="theme">
-Different themes are supported. Theme is configured through a Cascading Style Sheet (CSS) that determines how the HTML content is rendered by the SWT Browser widget.
-<ul class="theme">
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css1">Theme 1</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css2">Theme 2</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css3">Theme 3</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css4">Theme 4</a></li>
-</ul>
-
-</div>
-<h2>How to win</h2>
-The game ends when all cells are filled. The winner is the one with most pawns of their colour.
-
-<h2>Java and HTML integrated through the SWT Browser widget</h2>
-<p>
-Rendering is based on HTML and CSS techniques. Computer moves are programmed in regular
-Java code in the Eclipse plug-in. The SWT Browser widget is used for rendering and reacting
-to user input.
-</p>
-<h3>Implementation</h3>
-<p>
-The board is a table filled with hyperlinks. Cascading Style Sheets
-provide various themes and control the table aesthetic appearance.
-<br>The API <code>org.eclipse.swt.browser.Browser.setText(java.lang.String)</code> draws
-the board game from HTML generated in memory.
-<br>Player moves are captured by implementing the interface <code>org.eclipse.swt.browser.LocationListener</code>.
-e.g the player clicks on a cell that may generate a hyperlink with a URL similar to
-<code>http://www.org.eclipse.swt.examples.browser.demos/xx1yy2</code>. That hyperlink identifies
-the position of the cell selected by the player (column 1, row 2). The move is completed by generating
-new HTML content and invoking <code>Browser.setText</code> to update the board game.
-</p>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css2/white_chip.gif b/examples/org.eclipse.swt.examples.browser.demos/css2/white_chip.gif
deleted file mode 100644
index 3c6d6582b6..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css2/white_chip.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/Back640x440.gif b/examples/org.eclipse.swt.examples.browser.demos/css3/Back640x440.gif
deleted file mode 100644
index 6533821828..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/Back640x440.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/black_pawn.gif b/examples/org.eclipse.swt.examples.browser.demos/css3/black_pawn.gif
deleted file mode 100644
index 6e1a41dc31..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/black_pawn.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/line1.gif b/examples/org.eclipse.swt.examples.browser.demos/css3/line1.gif
deleted file mode 100644
index f9a0f34ecf..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/line1.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/style.css b/examples/org.eclipse.swt.examples.browser.demos/css3/style.css
deleted file mode 100644
index bddf04e514..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/style.css
+++ /dev/null
@@ -1,30 +0,0 @@
-body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./white_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./black_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall_pawn.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: left;}
-table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)}
-tr {}
-td {height:48px; width:48px; table-layout: fixed;}
-
-.whitelink a {display: block; width:48px; height:48px;}
-.blacklink a {display: block; width:48px; height:48px;}
-.empty {display: block; width:48px; height:48px;}
-
-.whitelink a:hover {display: block; background: url(./white_pawn.gif) no-repeat; width:48px; height:48px;}
-.blacklink a:hover {display: block; background: url(./black_pawn.gif) no-repeat; width:48px; height:48px;}
-.white {background: url(./white_pawn.gif) no-repeat;}
-.black {background: url(./black_pawn.gif) no-repeat;}
-.wall {background: url(./wall_pawn.gif) no-repeat;}
-
-.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./white_pawn.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./black_pawn.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-
-.winner {border: 4px solid white; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/texture_cells.gif b/examples/org.eclipse.swt.examples.browser.demos/css3/texture_cells.gif
deleted file mode 100644
index f7fee9d24d..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/texture_cells.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/wall_pawn.gif b/examples/org.eclipse.swt.examples.browser.demos/css3/wall_pawn.gif
deleted file mode 100644
index d05cd507ab..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/wall_pawn.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/welcome.html b/examples/org.eclipse.swt.examples.browser.demos/css3/welcome.html
deleted file mode 100644
index 58e92a35b0..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/welcome.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-<head>
- <title>Start a game</title>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
- <link rel="stylesheet" type="text/css" href="./style.css">
-</head>
-<body>
-<h1>Pawns Game</h1>
-<div class="start">
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart1player">1 player</a>
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart2players">2 players</a>
-</div>
-<h2>How to play</h2>
-This board game is a variant of Reversi and Tic Tac Toe. Each one of the two players sets a pawn on an empty cell of the board.
-<h3>Pawns</h3>
-<ul>
-<li class="white">Player 1</li>
-<li class="black">Player 2</li>
-<li class="wall">Wall. Cannot be reversed.</li>
-</ul>
-<div class="theme">
-Different themes are supported. Theme is configured through a Cascading Style Sheet (CSS) that determines how the HTML content is rendered by the SWT Browser widget.
-<ul class="theme">
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css1">Theme 1</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css2">Theme 2</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css3">Theme 3</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css4">Theme 4</a></li>
-</ul>
-
-</div>
-<h2>How to win</h2>
-The game ends when all cells are filled. The winner is the one with most pawns of their colour.
-
-<h2>Java and HTML integrated through the SWT Browser widget</h2>
-<p>
-Rendering is based on HTML and CSS techniques. Computer moves are programmed in regular
-Java code in the Eclipse plug-in. The SWT Browser widget is used for rendering and reacting
-to user input.
-</p>
-<h3>Implementation</h3>
-<p>
-The board is a table filled with hyperlinks. Cascading Style Sheets
-provide various themes and control the table aesthetic appearance.
-<br>The API <code>org.eclipse.swt.browser.Browser.setText(java.lang.String)</code> draws
-the board game from HTML generated in memory.
-<br>Player moves are captured by implementing the interface <code>org.eclipse.swt.browser.LocationListener</code>.
-e.g the player clicks on a cell that may generate a hyperlink with a URL similar to
-<code>http://www.org.eclipse.swt.examples.browser.demos/xx1yy2</code>. That hyperlink identifies
-the position of the cell selected by the player (column 1, row 2). The move is completed by generating
-new HTML content and invoking <code>Browser.setText</code> to update the board game.
-</p>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css3/white_pawn.gif b/examples/org.eclipse.swt.examples.browser.demos/css3/white_pawn.gif
deleted file mode 100644
index 98f5e538b6..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css3/white_pawn.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/Back640x440.gif b/examples/org.eclipse.swt.examples.browser.demos/css4/Back640x440.gif
deleted file mode 100644
index 6533821828..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/Back640x440.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/blue_people.gif b/examples/org.eclipse.swt.examples.browser.demos/css4/blue_people.gif
deleted file mode 100644
index a710c55e5b..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/blue_people.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/gold_people.gif b/examples/org.eclipse.swt.examples.browser.demos/css4/gold_people.gif
deleted file mode 100644
index 605090a1ae..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/gold_people.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/line1.gif b/examples/org.eclipse.swt.examples.browser.demos/css4/line1.gif
deleted file mode 100644
index f9a0f34ecf..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/line1.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/style.css b/examples/org.eclipse.swt.examples.browser.demos/css4/style.css
deleted file mode 100644
index e15b096be0..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/style.css
+++ /dev/null
@@ -1,30 +0,0 @@
-body {background: url(./Back640x440.gif) fixed; font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h1 {text-align: center; font-size: 14pt; font-family: Verdana, Arial, Helv, Helvetica, sans-serif;}
-h2 {background: url(./line1.gif) no-repeat right bottom; font-size: 12pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-h3 {font-size: 10pt; font-family:Verdana, Arial, Helv, Helvetica, sans-serif;}
-
-ul {list-style: none; padding: 0; margin:0; font: 12pt Times;}
-li.white {background: url(./blue_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.black {background: url(./gold_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-li.wall {background: url(./wall_people.gif) no-repeat; padding: 3px 0 32px 64px; margin: 0;}
-
-.board {text-align: left;}
-table { border-collapse: collapse; margin: 0; padding:0; background: url(./texture_cells.gif)}
-tr {}
-td {height:48px; width:48px; table-layout: fixed;}
-
-.whitelink a {display: block; width:48px; height:48px;}
-.blacklink a {display: block; width:48px; height:48px;}
-.empty {display: block; width:48px; height:48px;}
-
-.whitelink a:hover {display: block; background: url(./blue_people.gif) no-repeat; width:48px; height:48px;}
-.blacklink a:hover {display: block; background: url(./gold_people.gif) no-repeat; width:48px; height:48px;}
-.white {background: url(./blue_people.gif) no-repeat;}
-.black {background: url(./gold_people.gif) no-repeat;}
-.wall {background: url(./wall_people.gif) no-repeat;}
-
-.playerwhite {position: absolute; top: 50px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./blue_people.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-.playerblack {position: absolute; top: 300px; right:10px; margin: 1em 10px; border: 3px solid blue; background: url(./gold_people.gif) no-repeat right; text-align: left; width:100px; height:48px; font: 36pt Times, serif;}
-
-.winner {border: 4px solid white; font: bold 16pt Times, serif;}
-.loser {border: 1px solid black; font: 12pt Times, serif;}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/texture_cells.gif b/examples/org.eclipse.swt.examples.browser.demos/css4/texture_cells.gif
deleted file mode 100644
index f7fee9d24d..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/texture_cells.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/wall_people.gif b/examples/org.eclipse.swt.examples.browser.demos/css4/wall_people.gif
deleted file mode 100644
index 5616c815d9..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/wall_people.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/css4/welcome.html b/examples/org.eclipse.swt.examples.browser.demos/css4/welcome.html
deleted file mode 100644
index 58e92a35b0..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/css4/welcome.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<html>
-<head>
- <title>Start a game</title>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
- <link rel="stylesheet" type="text/css" href="./style.css">
-</head>
-<body>
-<h1>Pawns Game</h1>
-<div class="start">
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart1player">1 player</a>
-<a class="start" href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actionstart2players">2 players</a>
-</div>
-<h2>How to play</h2>
-This board game is a variant of Reversi and Tic Tac Toe. Each one of the two players sets a pawn on an empty cell of the board.
-<h3>Pawns</h3>
-<ul>
-<li class="white">Player 1</li>
-<li class="black">Player 2</li>
-<li class="wall">Wall. Cannot be reversed.</li>
-</ul>
-<div class="theme">
-Different themes are supported. Theme is configured through a Cascading Style Sheet (CSS) that determines how the HTML content is rendered by the SWT Browser widget.
-<ul class="theme">
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css1">Theme 1</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css2">Theme 2</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css3">Theme 3</a></li>
-<li><a href="http://www.org.eclipse.swt.examples.browser.demos.pawns/actiontheme/css4">Theme 4</a></li>
-</ul>
-
-</div>
-<h2>How to win</h2>
-The game ends when all cells are filled. The winner is the one with most pawns of their colour.
-
-<h2>Java and HTML integrated through the SWT Browser widget</h2>
-<p>
-Rendering is based on HTML and CSS techniques. Computer moves are programmed in regular
-Java code in the Eclipse plug-in. The SWT Browser widget is used for rendering and reacting
-to user input.
-</p>
-<h3>Implementation</h3>
-<p>
-The board is a table filled with hyperlinks. Cascading Style Sheets
-provide various themes and control the table aesthetic appearance.
-<br>The API <code>org.eclipse.swt.browser.Browser.setText(java.lang.String)</code> draws
-the board game from HTML generated in memory.
-<br>Player moves are captured by implementing the interface <code>org.eclipse.swt.browser.LocationListener</code>.
-e.g the player clicks on a cell that may generate a hyperlink with a URL similar to
-<code>http://www.org.eclipse.swt.examples.browser.demos/xx1yy2</code>. That hyperlink identifies
-the position of the cell selected by the player (column 1, row 2). The move is completed by generating
-new HTML content and invoking <code>Browser.setText</code> to update the board game.
-</p>
-</body>
-</html> \ No newline at end of file
diff --git a/examples/org.eclipse.swt.examples.browser.demos/doc-html/swt_browser_demos_ex.html b/examples/org.eclipse.swt.examples.browser.demos/doc-html/swt_browser_demos_ex.html
deleted file mode 100644
index 12975b0f6b..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/doc-html/swt_browser_demos_ex.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
-<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>SWT - Controls Overview</title>
-</head>
-<body>
-
-<h2>SWT example - Browser Demos</h2>
-
-<p>
-The Browser Demos demonstrate various features of the SWT Browser widget.
-</p><p>The Pawns Game is a board game that can be played against the computer
-or against another player. Rendering is based on HTML and CSS techniques. The
-board is a table filled with hyperlinks. Cascading Style Sheets
-provide various themes and control the table aesthetic appearance.
-The API <code>org.eclipse.swt.browser.Browser.setText(java.lang.String)</code> draws
-the board game from HTML generated in memory.
-Player moves are captured by implementing the interface <code>org.eclipse.swt.browser.LocationListener</code>.
-e.g the player clicks on a cell that may generate an hyperlink with a URL similar to
-http://www.org.eclipse.swt.examples.browser.demos/xx1yy2. That hyperlink identifies
-the position of the cell selected by the player. The move is completed by generating
-new HTML content and invoking <code>Browser.setText</code> to update the board game.
-</p>
-
-<h3>Running the example</h3>
-<p>
-Follow the <a href="../../org.eclipse.swt.examples/doc-html/swt_manual_setup.html">SWT standalone examples setup</a>
-instructions to install and run the example from your workspace.
-</p>
-<p>
-The "Main" class is <code>org.eclipse.swt.examples.browser.demos.BrowserDemoView</code>.
-</p>
-<p>
-This example can also be run using the <a href="../../org.eclipse.swt.examples.launcher/doc-html/swt_launcher_ex.html">Example Launcher</a>.
-Select the <strong>Browser Demo</strong> item from the <strong>Workbench Views</strong> category and click <strong>Run</strong>.
-</p>
-
-</body>
-</html>
diff --git a/examples/org.eclipse.swt.examples.browser.demos/icons/pawn.gif b/examples/org.eclipse.swt.examples.browser.demos/icons/pawn.gif
deleted file mode 100644
index c811f8ba71..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/icons/pawn.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.swt.examples.browser.demos/plugin.properties b/examples/org.eclipse.swt.examples.browser.demos/plugin.properties
deleted file mode 100644
index e2a0fea73a..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/plugin.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-providerName = Eclipse.org
-plugin.SWTBrowserDemos.name = SWT Browser Demos Plugin
-category.SWTExamples.name = SWT Examples
-view.BrowserDemos.name = Browser Demo
-
-launchcategory.SWTViewExamples.name = Workbench Views
-launchcategory.SWTViewExamples.description = \
- A collection of Standard Widget Toolkit examples that run as Views inside the Workbench. \
- These examples will create a new View in the current Perspective.
-
-launchitem.BrowserDemos.name = Browser Demo
-launchitem.BrowserDemos.description = \
- The example illustrates how to use the SWT Browser widget for HTML rendering.\n\n\
- The Pawns Game is a board game that can be played against the computer or against another player.\n\n\
- Rendering is based on HTML and CSS techniques. The board is a table filled with hyperlinks. Cascading Style Sheets \
- provide various themes and control the table aesthetic appearance. \n\
- The API org.eclipse.swt.browser.Browser.setText(java.lang.String) draws the board game from HTML generated in memory.\n\
- Player moves are captured by implementing the interface org.eclipse.swt.browser.LocationListener. e.g the player clicks \
- on a cell that defines an hyperlink with a URL http://www.org.eclipse.swt.examples.browser.demos/xx1yy2.\
- That hyperlink identifies the position of the cell selected by the player. The move is completed by generating \
- new HTML content and invoking Browser.setText to update the board game.
diff --git a/examples/org.eclipse.swt.examples.browser.demos/plugin.xml b/examples/org.eclipse.swt.examples.browser.demos/plugin.xml
deleted file mode 100644
index 54458dc678..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/plugin.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="org.eclipse.swt.examples.browser.demos"
- name="%plugin.SWTBrowserDemos.name"
- version="3.1.100.qualifier"
- provider-name="%providerName"
- class="org.eclipse.swt.examples.browser.demos.BrowserDemoPlugin">
-
- <runtime>
- <library name="BrowserDemo.jar">
- <export name="*"/>
- </library>
- </runtime>
-
- <requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.runtime"/>
- </requires>
-
- <extension
- point="org.eclipse.ui.views">
- <category
- name="%view.BrowserDemos.name"
- id="org.eclipse.swt.examples.browser.demos.BrowserDemo">
- </category>
- <view
- allowMultiple="false"
- class="org.eclipse.swt.examples.browser.demos.views.BrowserDemoView"
- icon="icons/pawn.gif"
- category="org.eclipse.swt.examples.category"
- name="Browser Demo"
- id="org.eclipse.swt.examples.browser.demos.views.BrowserDemoView">
- </view>
- </extension>
-
- <extension
- point="org.eclipse.swt.examples.launcher.launchItems">
- <category
- name="%launchcategory.SWTViewExamples.name"
- description="%launchcategory.SWTViewExamples.description"
- id="org.eclipse.swt.examples.launchViewCategory">
- </category>
- <item
- name="%launchitem.BrowserDemos.name"
- icon="icons/sample.gif"
- category="org.eclipse.swt.examples.launchViewCategory"
- description="%launchitem.BrowserDemos.description"
- id="org.eclipse.swt.examples.browserdemos.viewlauncher">
- <view
- viewId="org.eclipse.swt.examples.browser.demos.views.BrowserDemoView">
- </view>
- </item>
- </extension>
-</plugin>
diff --git a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/BrowserDemoPlugin.java b/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/BrowserDemoPlugin.java
deleted file mode 100644
index 823dbde378..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/BrowserDemoPlugin.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.examples.browser.demos;
-
-import org.eclipse.ui.plugin.*;
-import org.osgi.framework.BundleContext;
-import java.util.*;
-import org.eclipse.core.runtime.*;
-
-public class BrowserDemoPlugin extends AbstractUIPlugin {
-
- public static BrowserDemoPlugin plugin;
- ResourceBundle resourceBundle;
- public static String PLUGIN_PATH = null;
-
- public BrowserDemoPlugin() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle.getBundle("org.eclipse.swt.examples.browser.demos.BrowserDemoPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- PLUGIN_PATH = Platform.resolve(plugin.getBundle().getEntry(".")).toString();
- }
-
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- public static BrowserDemoPlugin getDefault() {
- return plugin;
- }
-
- public static String getResourceString(String key) {
- ResourceBundle bundle = BrowserDemoPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/Pawns.java b/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/Pawns.java
deleted file mode 100644
index 732f1e5eba..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/Pawns.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.examples.browser.demos;
-
-public class Pawns {
-
- /* Current board representation in compacted form */
- byte[] game = new byte[64];
- /* Best move */
- int bestIndex = -1;
- /* Related best score */
- int bestScore = Integer.MIN_VALUE;
- /* Estimated strategic value of each cell based on proximity to walls */
- static int[] gameWallWeight = new int[64];
- Thread thread = null;
- boolean threadStop = false;
-
- final static byte EMPTY = 0;
- final static byte WHITE = 1;
- final static byte BLACK = 2;
- final static byte WALL = 3;
-
-public Pawns() {
-}
-
-/* Provide the current game and ignitiate the search of the best move for the given type
- * Must return immediately as it will be called from the UI thread.
- * The UI thread will fetch the best move any time thereafter.
- */
-public void playRequest(byte[][] game, int type) {
- threadStop = true;
- synchronized (this) {
- bestIndex = -1;
- bestScore = Integer.MIN_VALUE;
- convert(game, this.game);
- initPawnBorders(this.game, gameWallWeight);
- /* Quickly compute a legal move */
- for (int i = 0; i < this.game.length; i++) {
- if (this.game[i] == EMPTY) {
- bestIndex = i;
- break;
- }
- }
- new Thread() {
- public void run() {
- synchronized(Pawns.this) {
- threadStop = false;
- int[] result = new int[2];
- /* if long time, must check for threadStop and exit early */
- evalBest(Pawns.this.game, BLACK, 2, result);
- bestIndex = result[0];
- bestScore = result[1];
- }
- }
- }.start();
- }
-}
-
-/* Fetch best move in natural coordinates for the board previously given in
- * the call to playRequest.
- */
-public void getBestMove(int[] point) {
- convert(bestIndex, point);
- threadStop = true;
-}
-
-/* Given an expanded representation of the board, format internal compact mode */
-static void convert(byte[][] board, byte[] g) {
- for (int i = 0; i < board.length; i++) System.arraycopy(board[i], 0, g, i * 8, 8);
-}
-/* Update given compact model based on player move in natural coordinates */
-static void set(byte[] g, int x, int y, byte type) {
- g[x*8+y] = type;
-}
-/* Given an index in compact representation, return natural coordinates */
-static void convert(int index, /*out [0] x [1] y */int[] point) {
- point[0] = index / 8;
- point[1] = index % 8;
-}
-/* Given an index into the compact model and the neighbour code,
- * return the index of the corresponding neighbour index.
- * Returns -1 if there is no neighbour.
- *
- * Neighbour code for the index X
- * 0 1 2
- * 3 X 4
- * 5 6 7
- */
-static int getNeighbourIndex(byte[] g, int index, int neighbour) {
- if (index < 0 || index >= g.length) return -1;
- int result = -1;
- switch (neighbour) {
- case 0: result = index < 8 || index % 8 == 0 ? -1 : index - 9; break;
- case 1: result = index < 8 ? -1 : index - 8; break;
- case 2: result = index < 8 || index % 8 == 7 ? -1 : index - 7; break;
- case 3: result = index % 8 == 0 ? -1 : index - 1; break;
- case 4: result = index % 8 == 7 ? -1 : index + 1; break;
- case 5: result = index % 8 == 0 || index >= 56 ? -1 : index + 7; break;
- case 6: result = index >= 56 ? -1 : index + 8; break;
- case 7: result = index % 8 == 7 || index >= 56 ? -1 : index + 9; break;
- }
- return result;
-}
-/* Make the player type play at index on given compact board
- * Compute all pawns that must be reversed.
- */
-static void play(byte[] g, int index, byte type) {
- byte opponentType = type == WHITE ? BLACK : WHITE;
- for (int neighbour = 0; neighbour <= 7; neighbour++) {
- int nIndex = getNeighbourIndex(g, index, neighbour);
- int[] reversiIndeces = new int[6];
- int nReversi = 0;
- while (nIndex != -1 && nReversi < 6 && g[nIndex] == opponentType) {
- reversiIndeces[nReversi] = nIndex;
- nReversi++;
- nIndex = getNeighbourIndex(g, nIndex, neighbour);
- }
- if (nReversi > 0 && nIndex != -1 && g[nIndex] == type) {
- for (int i = 0; i < nReversi; i++) g[reversiIndeces[i]] = type;
- }
- }
- g[index] = type;
-}
-/* Evaluate the given compact model based on pawns distribution
- * High means white has advantage. Below zero means black has advantage.
- */
-static int eval(byte[] g) {
- int cntWhite = 0, cntBlack = 0, cntEmpty = 0;
- int cntWhiteWallAdvantage = 0, cntBlackWallAdvantage = 0;
- for (int i = 0; i < 64; i++) {
- if (g[i] == WHITE) {
- cntWhite++;
- cntWhiteWallAdvantage += gameWallWeight[i];
- }
- else if (g[i] == BLACK) {
- cntBlack++;
- cntBlackWallAdvantage += gameWallWeight[i];
- }
- else if (g[i] == EMPTY) cntEmpty++;
- }
- if (cntEmpty == 0) {
- if (cntWhite > cntBlack) return Integer.MAX_VALUE; /* White wins */
- if (cntWhite < cntBlack) return Integer.MIN_VALUE; /* Black wins */
- return 0; /* Stalemate */
- }
- return cntWhite + cntWhiteWallAdvantage - cntBlack - cntBlackWallAdvantage;
-}
-
-/* Recognize pawns protected by walls or borders
- * TBD - note this should be called only once for each cell and stored
- * in a separate byte[] gWallGain
- * */
-static void initPawnBorders(byte[] g, int[] gameWallWeight) {
- /* A pawn has 8 neighbours on 4 axes.
- * Strategic pawns have one side of each axis protected by a wall and the other
- * side not closed by a wall.
- * A pawn cannot be reversed when each of its 4 axes are protected by a wall on
- * one side. Pawns that have more than 4 walls are less interesting since they
- * are not open enough to the board.
- *
- * Nbr walls, nbr axis covered, estimated value
- * 0 n/a 0
- * 1 1 2
- * 2 1 1
- * 2 2 6
- * 3 2 4
- * 4 2 2
- * 3 3 9
- * 4 3 8
- * 4 4 16
- * 5 4 14
- * 6 4 9
- * 7 4 6
- * 8 4 0
- */
- int[] nTypes = new int[8];
- for (int i = 0; i < 64; i++) {
- int nWalls = 0;
- int nAxis = 0;
- for (int n = 0; n < 8; n++) {
- int nIndex = getNeighbourIndex(g, i, n);
- nTypes[n] = nIndex != -1 ? g[nIndex] : WALL;
- if (nTypes[n] == WALL) nWalls++;
- }
- int score = nWalls;
- if (nWalls > 0) {
- if (nTypes[0] == WALL || nTypes[7] == WALL) nAxis++;
- if (nTypes[1] == WALL || nTypes[6] == WALL) nAxis++;
- if (nTypes[2] == WALL || nTypes[5] == WALL) nAxis++;
- if (nTypes[4] == WALL || nTypes[3] == WALL) nAxis++;
- switch (nAxis) {
- case 4: switch (nWalls) { case 4: score = 16; break; case 5: score = 14; break; case 6: score = 9; case 7: score = 6; break; case 8: score = 0; break;} break;
- case 3: switch (nWalls) { case 3: score = 9; break; case 4: score = 8;} break;
- case 2: switch (nWalls) { case 2: score = 6; break; case 3: score = 4; break; case 4: score = 2; } break;
- case 1: switch (nWalls) { case 1: score = 2; break; case 2: score = 1; break;} break;
- }
- }
- gameWallWeight[i] = score;
- }
-}
-
-/* Evaluate the best move for player type for the given board, doing a depth 1 search */
-static void evalBest(byte[] g, byte type, int depth, /* out [0] best move, [1] minimax */int[] result) {
- byte[] tmp = new byte[64];
- byte opponentType = type == WHITE ? BLACK : WHITE;
- result[0] = -1; result[1] = Integer.MIN_VALUE;
- for (int i = 0; i < 64; i++) {
- if (g[i] == EMPTY) {
- System.arraycopy(g, 0, tmp, 0, 64);
- play(tmp, i, type);
- int score = eval(tmp);
- if (depth > 1) {
- int[] tmpResult = new int[2];
- evalBest(tmp, opponentType, depth - 1, tmpResult);
- score = tmpResult[1];
- }
- if ((type == WHITE && score > result[1]) || (type == BLACK && score < result[1]) || result[0] == -1) {
- result[0] = i;
- result[1] = score;
- }
- }
- }
-}
-}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/BrowserDemoView.java b/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/BrowserDemoView.java
deleted file mode 100644
index 1393e76f79..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/BrowserDemoView.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.examples.browser.demos.views;
-
-import org.eclipse.ui.part.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.browser.*;
-
-public class BrowserDemoView extends ViewPart {
- Action pawnAction;
- Action editAction;
- Composite parent;
-
- public BrowserDemoView() {
- }
- public void createPartControl(Composite parent) {
- this.parent = parent;
- parent.setLayout(new FillLayout());
- try {
- Browser browser = new Browser(parent, SWT.NONE);
- browser.dispose();
- } catch (SWTError e) {
- Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY);
- text.setText("Browser widget cannot be instantiated. The exact error is:\r\n"+e);
- parent.layout(true);
- return;
- }
- TabFolder folder = new TabFolder(parent, SWT.NONE);
- TabItem item = new TabItem(folder, SWT.NONE);
- new PawnTab(item);
-
- item = new TabItem(folder, SWT.NONE);
- new EditorTab(item);
- }
-
- public void setFocus() {
- }
-
-
-}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/EditorTab.java b/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/EditorTab.java
deleted file mode 100644
index 8053165e0b..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/EditorTab.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.examples.browser.demos.views;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.browser.*;
-import org.eclipse.swt.graphics.*;
-
-public class EditorTab {
- Browser browser;
- Text htmlText, scriptText;
- Button htmlButton, scriptButton;
- static String html =
- "<html>\r\n"+
- " <body>\r\n"+
- " <h1 id='myid'>HTML Document</h1>\r\n"+
- " <h2>Set HTML content</h2>\r\n"+
- " <ol>\r\n"+
- " <li>Enter html data into the 'setText' pane</li>\r\n"+
- " <li>Click on 'setText' to set the new content</li>\r\n"+
- " </ol>\r\n"+
- " <h2>Query or modify HTML document</h2>\r\n"+
- " <ol>\r\n"+
- " <li>Enter javascript commands into the 'execute' pane</li>\r\n"+
- " <li>Click on 'execute' to run the javascript in the current document</li>\r\n"+
- " </ol>\r\n"+
- " </body>\r\n"+
- "</html>";
-
- static String script =
- "var node = document.createElement('P');\r\n"+
- "var text = document.createTextNode('Content inserted!');\r\n"+
- "node.appendChild(text);\r\n"+
- "document.getElementById('myid').appendChild(node);\r\n\r\n"+
- "document.bgColor = 'yellow';";
-
- public EditorTab(TabItem item) {
- final Composite parent = new Composite(item.getParent(), SWT.NONE);
- item.setText("Editor");
- item.setControl(parent);
-
- try {
- browser = new Browser(parent, SWT.NONE);
- } catch (SWTError e) {
- e.printStackTrace();
- return;
- }
- final Sash sash = new Sash(parent, SWT.VERTICAL);
- Composite panel = new Composite(parent, SWT.NONE);
- final FormLayout form = new FormLayout();
- parent.setLayout(form);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(sash, 0);
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- browser.setLayoutData(data);
-
- final FormData sashData = new FormData();
- sashData.left = new FormAttachment(50, 0);
- sashData.top = new FormAttachment(0, 0);
- sashData.bottom = new FormAttachment(100, 0);
- sash.setLayoutData(sashData);
- sash.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- Rectangle rect = sash.getBounds();
- Rectangle parentRect = sash.getParent().getClientArea();
- int right = parentRect.width - rect.width - 20;
- e.x = Math.max(Math.min(e.x, right), 20);
- if (e.x != rect.x) {
- sashData.left = new FormAttachment(0, e.x);
- parent.layout();
- }
- }
- });
- data = new FormData();
- data.left = new FormAttachment(sash, 0);
- data.right = new FormAttachment(100, 0);
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- panel.setLayoutData(data);
-
- /* Initialize Panel */
- panel.setLayout(new FillLayout(SWT.VERTICAL));
- Group htmlGroup = new Group(panel, SWT.NONE);
- htmlGroup.setText("setText");
- htmlText = new Text(htmlGroup, SWT.MULTI);
- htmlButton = new Button(htmlGroup, SWT.PUSH);
- htmlButton.setText("setText");
- GridLayout gridLayout = new GridLayout();
- htmlGroup.setLayout(gridLayout);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- htmlText.setLayoutData(gridData);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.END;
- htmlButton.setLayoutData(gridData);
- htmlGroup.layout();
-
- Group scriptGroup = new Group(panel, SWT.NONE);
- scriptGroup.setText("execute");
- scriptText = new Text(scriptGroup, SWT.MULTI);
- scriptButton = new Button(scriptGroup, SWT.PUSH);
- scriptButton.setText("execute");
- gridLayout = new GridLayout();
- scriptGroup.setLayout(gridLayout);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- scriptText.setLayoutData(gridData);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.END;
- scriptButton.setLayoutData(gridData);
- scriptGroup.layout();
-
- browser.setText(html);
- htmlText.setText(html);
- scriptText.setText(script);
- parent.layout();
-
- Listener listener = new Listener() {
- public void handleEvent(Event e) {
- Widget w = e.widget;
- if (w == htmlButton) browser.setText(htmlText.getText());
- if (w == scriptButton) browser.execute(scriptText.getText());
- }
- };
-
- htmlButton.addListener(SWT.Selection, listener);
- scriptButton.addListener(SWT.Selection, listener);
- }
-}
diff --git a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/PawnTab.java b/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/PawnTab.java
deleted file mode 100644
index 513f12efe1..0000000000
--- a/examples/org.eclipse.swt.examples.browser.demos/src/org/eclipse/swt/examples/browser/demos/views/PawnTab.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.examples.browser.demos.views;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.browser.*;
-import org.eclipse.swt.examples.browser.demos.BrowserDemoPlugin;
-import org.eclipse.swt.examples.browser.demos.Pawns;
-
-public class PawnTab {
-
- Action pawnAction;
- Action editAction;
-
- Browser browser = null;
- ReversiListener reversiListener;
-
- final static int TYPE_WELCOME = 1;
- final static int TYPE_START = 2;
- final static int TYPE_BOARD = 3;
- final static int TYPE_BOARD_OVER = 4;
-
- final static String URL = "http://www.org.eclipse.swt.examples.browser.demos.pawns/";
- static String PLUGIN_PATH = BrowserDemoPlugin.PLUGIN_PATH;
- static String CSS_FOLDER = "css2";
- static String URL_CSS = PLUGIN_PATH+CSS_FOLDER+"/style.css";
- static String URL_WELCOME =PLUGIN_PATH+CSS_FOLDER+"/welcome.html";
-
- final static String ACTION_START_2_PLAYERS = "actionstart2players";
- final static String ACTION_START_1_PLAYER = "actionstart1player";
- final static String ACTION_WHITE = "actionwhite";
- final static String ACTION_BLACK = "actionblack";
- final static String ACTION_THEME = "actiontheme";
-
- static byte[][] game = null;
- static boolean isWhite = true;
- static int cntWhite = 0, cntBlack = 0;
- static boolean computer = false;
- static int cx, cy;
- final static byte EMPTY = 0;
- final static byte WHITE = 1;
- final static byte BLACK = 2;
- final static byte WALL = 3;
-
- static Pawns ttr = null;
- static int[] move = new int[2];
- static Menu menu = null;
-
- public PawnTab(TabItem item) {
- try {
- browser = new Browser(item.getParent(), SWT.NONE);
- } catch (SWTError e) {
- e.printStackTrace();
- return;
- }
- item.setText("Pawns");
- item.setControl(browser);
-
- menu = new Menu(browser.getShell(), SWT.POP_UP);
- MenuItem item2 = new MenuItem(menu, SWT.PUSH);
- item2.setText("End Game");
- item2.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- game = null;
- isWhite = true;
- cntWhite = 0; cntBlack = 0;
- ttr = null;
- browser.setUrl(URL_WELCOME);
- }
- });
- browser.setMenu(menu);
-
- reversiListener = new ReversiListener();
- browser.addLocationListener(reversiListener);
- browser.setUrl(URL_WELCOME);
- }
-
- static String getHtml(int type) {
- String html = null;
- switch (type) {
- case TYPE_BOARD:
- case TYPE_BOARD_OVER: {
- html = "<html><header><link rel=\"stylesheet\" type=\"text/css\" href=\""+URL_CSS+"\"></header><body><div class=\"board\"><table><tbody>";
- String classPlayerWhite = "playerwhite", classPlayerBlack = "playerblack";
- if (type == TYPE_BOARD_OVER) {
- if (cntWhite > cntBlack) {
- classPlayerWhite += " winner";
- classPlayerBlack += " loser";
- } else {
- classPlayerWhite += " loser";
- classPlayerBlack += " winner";
- }
- }
- String white = "<td class=\"white\"/>";
- String black = "<td class=\"black\"/>";
- String wall = "<td class=\"wall\"/>";
- for (int i = 0; i < game.length; i++) {
- html += "<tr>";
- for (int j = 0; j < game[0].length; j++) {
- switch (game[i][j]) {
- case EMPTY: {
- String empty = "<td class=\""+(isWhite ? "whitelink" : "blacklink")+"\">"+ (isWhite || (!isWhite && !computer) ? "<a href=\""+URL+(isWhite ? ACTION_WHITE : ACTION_BLACK)+"/xx"+i+"yy"+j+"\" class=\"empty\"/>" : "<div class=\"empty\"/>")+"</td>";
- html += empty; break;
- }
- case WHITE: html += white; break;
- case BLACK: html += black; break;
- case WALL: html += wall; break;
- }
- }
- html +="</tr>";
- }
- html += "</tbody></table></div>";
- html += "<div class=\""+classPlayerWhite+"\">"+cntWhite+"</div>";
- html += "<div class=\""+classPlayerBlack+"\">"+cntBlack+"</div>";
- html += "</body></html>";
- break;
- }
- }
- return html;
- }
-
- public class ReversiListener implements LocationListener {
- public void changed(LocationEvent e) {
- }
- public void changing(LocationEvent e) {
- try {
- final Browser browser = (Browser)e.widget;
- if (e.location.indexOf(ACTION_START_1_PLAYER) != -1 || e.location.indexOf(ACTION_START_2_PLAYERS) != -1) {
- computer = e.location.indexOf(ACTION_START_1_PLAYER) != -1;
- game = new byte[8][8];
- if (computer) ttr = new Pawns();
- for (int i = 0; i < 5; i++) game[(int)(Math.random()*game.length)][(int)(Math.random()*game[0].length)] = WALL;
- e.display.asyncExec(new Runnable() {
- public void run() {
- browser.setText(getHtml(TYPE_BOARD));
- }});
- e.doit = false;
- return;
- }
- if (e.location.indexOf(ACTION_THEME) != -1) {
- int index = e.location.indexOf(ACTION_THEME) + ACTION_THEME.length() + 1;
- CSS_FOLDER = e.location.substring(index, index + 4);
- URL_CSS = PLUGIN_PATH+CSS_FOLDER+"/style.css";
- URL_WELCOME = PLUGIN_PATH+CSS_FOLDER+"/welcome.html";
- e.display.asyncExec(new Runnable() {
- public void run() {
- browser.setUrl(URL_WELCOME);
- }});
- e.doit = false;
- return;
- }
- byte player = EMPTY;
- if (e.location.indexOf(ACTION_WHITE) != -1) player = WHITE;
- else if (e.location.indexOf(ACTION_BLACK) != -1) player = BLACK;
- if (player != EMPTY) {
- int index = e.location.indexOf("xx") + 2;
- int x = Integer.parseInt(e.location.substring(index, index + 1));
- index = e.location.indexOf("yy") + 2;
- int y = Integer.parseInt(e.location.substring(index, index + 1));
- boolean hasMore = add(x, y, player);
- isWhite = player != WHITE;
- browser.setText(getHtml(hasMore ? TYPE_BOARD : TYPE_BOARD_OVER));
- if (computer && hasMore && !isWhite) play(e.display, browser, 5000);
- e.doit = false;
- }
- }catch (Exception e1 ) {
- e1.printStackTrace();
- }
- }
- }
-
- public static boolean add(int x, int y, byte color) {
- game[x][y] = color;
- int cnt = Math.min(x, y), n = 0;
- int other_color = color == WHITE ? BLACK : WHITE;
- for (int d = 1; d <= cnt; d++) {
- if (game[x-d][y-d] == other_color) n++;
- else if (game[x-d][y-d] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x-d][y-d] = color; break; }
- }
- cnt = Math.min(game.length - 1 - x, game[0].length - 1 - y); n = 0;
- for (int d = 1; d <= cnt; d++) {
- if (game[x+d][y+d] == other_color) n++;
- else if (game[x+d][y+d] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x+d][y+d] = color; break; }
- }
- cnt = Math.min(game.length - 1 - x, y); n = 0;
- for (int d = 1; d <= cnt; d++) {
- if (game[x+d][y-d] == other_color) n++;
- else if (game[x+d][y-d] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x+d][y-d] = color; break; }
- }
- cnt = Math.min(x, game[0].length - 1 - y); n = 0;
- for (int d = 1; d <= cnt; d++) {
- if (game[x-d][y+d] == other_color) n++;
- else if (game[x-d][y+d] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x-d][y+d] = color; break; }
- }
- cnt = y; n = 0;
- for (int d = 1; d <= cnt; d++) {
- if (game[x][y-d] == other_color) n++;
- else if (game[x][y-d] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x][y-d] = color; break; }
- }
- cnt = game[0].length - 1 - y; n = 0;
- for (int d = 1; d <= cnt; d++) {
- if (game[x][y+d] == other_color) n++;
- else if (game[x][y+d] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x][y+d] = color; break; }
- }
- cnt = x; n = 0;
- for (int d = 1; d <= cnt; d++) {
- if (game[x-d][y] == other_color) n++;
- else if (game[x-d][y] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x-d][y] = color; break; }
- }
- cnt = game.length - 1 - x; n = 0;
- for (int d = 1; d <= cnt; d++) {
- if (game[x+d][y] == other_color) n++;
- else if (game[x+d][y] != color) break;
- else { if (n > 0) for (d = 1; d <= n; d++) game[x+d][y] = color; break; }
- }
-
- boolean hasMore = false;
- cntWhite = 0; cntBlack = 0;
- for (int i = 0; i < game.length; i++)
- for (int j = 0; j < game[0].length; j++) {
- switch (game[i][j]) {
- case EMPTY: hasMore = true; break;
- case WHITE: cntWhite++; break;
- case BLACK: cntBlack++; break;
- }
- }
- return hasMore;
- }
-
- public static void play(final Display display, final Browser browser, int delay) {
- ttr.playRequest(game, BLACK);
- display.timerExec(3000, new Runnable() {
- public void run() {
- ttr.getBestMove(move);
- boolean hasMore = add(move[0], move[1], BLACK);
- isWhite = true;
- browser.setText(getHtml(hasMore ? TYPE_BOARD : TYPE_BOARD_OVER));
- }
- });
- }
-
- public static void main(String[] args) {
- }
-}