summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2006-09-25 17:54:49 +0000
committerGrant Gayed <ggayed>2006-09-25 17:54:49 +0000
commit819094da718c6570c737d38a3e41a8a9970cd886 (patch)
tree35d499b105bbe882b7cc15b6df54bd1225b453e9
parent781f5f0e8a6f0be9c606a379055c36a56c75488e (diff)
downloadeclipse.platform.swt-819094da718c6570c737d38a3e41a8a9970cd886.tar.gz
eclipse.platform.swt-819094da718c6570c737d38a3e41a8a9970cd886.tar.xz
eclipse.platform.swt-819094da718c6570c737d38a3e41a8a9970cd886.zip
update advanced graphics example in examples launcher
-rwxr-xr-xexamples/org.eclipse.swt.examples/plugin.properties2
-rwxr-xr-xexamples/org.eclipse.swt.examples/plugin.xml2
-rw-r--r--examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java36
3 files changed, 27 insertions, 13 deletions
diff --git a/examples/org.eclipse.swt.examples/plugin.properties b/examples/org.eclipse.swt.examples/plugin.properties
index b838f5b239..66684a4e56 100755
--- a/examples/org.eclipse.swt.examples/plugin.properties
+++ b/examples/org.eclipse.swt.examples/plugin.properties
@@ -128,7 +128,7 @@ launchitem.LayoutExample.description = \
launchitem.AdvancedGraphics.name = Advanced Graphics
launchitem.AdvancedGraphics.description = \
- This example demonstrates how to use advanced graphics operations.
+ This example (updated for 3.3) contains a collection of applications that show the use of advanced graphics operations.
launchitem.TextEditor.name = Text Editor
launchitem.TextEditor.description = \
diff --git a/examples/org.eclipse.swt.examples/plugin.xml b/examples/org.eclipse.swt.examples/plugin.xml
index b21b7046d4..d178a48387 100755
--- a/examples/org.eclipse.swt.examples/plugin.xml
+++ b/examples/org.eclipse.swt.examples/plugin.xml
@@ -164,7 +164,7 @@
category="org.eclipse.swt.examples.launchStandaloneCategory"
id="org.eclipse.swt.examples.graphics.standalonelauncher">
<program
- mainClass="org.eclipse.swt.examples.graphics.AdvancedGraphics"
+ mainClass="org.eclipse.swt.examples.graphics.GraphicsExample"
pluginId="org.eclipse.swt.examples"/>
</item>
</extension>
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java
index e1972d0694..5445531716 100644
--- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java
+++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/graphics/GraphicsExample.java
@@ -49,6 +49,13 @@ public class GraphicsExample {
static final int TIMER = 30;
static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("examples_graphics"); //$NON-NLS-1$
+/*
+ * Default constructor is needed so that example launcher can create an instance.
+ */
+public GraphicsExample() {
+ super();
+}
+
public GraphicsExample(final Composite parent) {
this.parent = parent;
resources = new ArrayList();
@@ -533,6 +540,19 @@ Image loadImage(Device device, String name) {
return image;
}
+public Shell open(final Display display) {
+ Shell shell = new Shell(display);
+ shell.setText(getResourceString("AdvancedGraphics")); //$NON-NLS-1$
+ final GraphicsExample example = new GraphicsExample(shell);
+ shell.addListener(SWT.Close, new Listener() {
+ public void handleEvent(Event event) {
+ example.dispose();
+ }
+ });
+ shell.open();
+ return shell;
+}
+
/**
* Redraws the current tab.
*/
@@ -618,17 +638,11 @@ void startAnimationTimer() {
public static void main(String[] args) {
Display display = new Display();
- Shell shell = new Shell(display);
- shell.setText(getResourceString("SWTGraphics")); //$NON-NLS-1$
- final GraphicsExample example = new GraphicsExample(shell);
- shell.addListener(SWT.Close, new Listener() {
- public void handleEvent(Event event) {
- example.dispose();
- }
- });
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) display.sleep();
+ Shell shell = new GraphicsExample().open(display);
+ while (shell != null && !shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
}
+ display.dispose();
}
}