summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Program
diff options
context:
space:
mode:
authorGrant Gayed <ggayed>2003-11-28 20:56:11 +0000
committerGrant Gayed <ggayed>2003-11-28 20:56:11 +0000
commitda59fb2bf87bed95c8760f865579057392b251e7 (patch)
tree4fa8517128ca39e5d1f913cd8a69929dbd1a7af3 /bundles/org.eclipse.swt/Eclipse SWT Program
parentbcea5eebac5e467124552ade5da6f08e529a36c6 (diff)
downloadeclipse.platform.swt-da59fb2bf87bed95c8760f865579057392b251e7.tar.gz
eclipse.platform.swt-da59fb2bf87bed95c8760f865579057392b251e7.tar.xz
eclipse.platform.swt-da59fb2bf87bed95c8760f865579057392b251e7.zip
47556
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Program')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java40
1 files changed, 36 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
index 855c42edea..6ea0287971 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
@@ -84,7 +84,15 @@ static int getDesktop(Display display) {
* </ul>
*/
public static Program findProgram(String extension) {
- return findProgram(Display.getCurrent(), extension);
+ boolean disposeDisplay = false;
+ Display display = Display.getCurrent ();
+ if (display == null) {
+ display = new Display ();
+ disposeDisplay = true;
+ }
+ Program result = findProgram (display, extension);
+ if (disposeDisplay) display.dispose ();
+ return result;
}
/*
@@ -140,7 +148,15 @@ private static Program findProgram(Display display, String extension) {
* @return an array of extensions
*/
public static String[] getExtensions() {
- return getExtensions(Display.getCurrent());
+ boolean disposeDisplay = false;
+ Display display = Display.getCurrent ();
+ if (display == null) {
+ display = new Display ();
+ disposeDisplay = true;
+ }
+ String [] result = getExtensions (display);
+ if (disposeDisplay) display.dispose ();
+ return result;
}
/*
@@ -181,7 +197,15 @@ private static String[] getExtensions(Display display) {
* @return an array of programs
*/
public static Program[] getPrograms() {
- return getPrograms(Display.getCurrent());
+ boolean disposeDisplay = false;
+ Display display = Display.getCurrent ();
+ if (display == null) {
+ display = new Display ();
+ disposeDisplay = true;
+ }
+ Program [] result = getPrograms (display);
+ if (disposeDisplay) display.dispose ();
+ return result;
}
/*
@@ -403,7 +427,15 @@ private static String[] parseCommand(String cmd) {
* </ul>
*/
public static boolean launch(String fileName) {
- return launch(Display.getCurrent(), fileName);
+ boolean disposeDisplay = false;
+ Display display = Display.getCurrent ();
+ if (display == null) {
+ display = new Display ();
+ disposeDisplay = true;
+ }
+ boolean result = launch (display, fileName);
+ if (disposeDisplay) display.dispose ();
+ return result;
}
/*