Top Description Fields Constructors Methods
org.eclipse.swt.program

public final Class Program

extends Object
Class Inheritance
Imports
java.io.*, java.nio.file.*, .Path, java.util.*, org.eclipse.swt.*, org.eclipse.swt.graphics.*, org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*, org.eclipse.swt.internal.gtk3.*, org.eclipse.swt.internal.gtk4.*

Instances of this class represent programs and their associated file extensions in the operating system.
See Also
Program snippets, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv boolean
pack-priv String
pack-priv static Map<String, List<String>>
pack-priv static long
pack-priv String
pack-priv static final String
pack-priv static final String

Constructor Summary

AccessConstructor and Description
pack-priv
Program()

Prevents uninitialized instances from being created outside the package.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the object is the same as this object and false otherwise
equals
(Object
the object to compare with this object
other
)

Overrides java.lang.Object.equals.

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
public boolean

Returns:

true if the file is launched, otherwise false
execute
(String
the file or program name
fileName
)

Executes the program with the file as the single argument in the operating system.

public static Program

Returns:

the program or null
findProgram
(String
the program extension
extension
)

Finds the program that is associated with an extension.

public static String[]

Returns:

an array of extensions
getExtensions
()

Answer all program extensions in the operating system.

public ImageData

Returns:

the image data for the program, may be null
getImageData
()

Returns the receiver's image data at 100% zoom level.

public ImageData

Returns:

the image data for the program, may be null
getImageData
(int
The zoom level in % of the standard resolution
zoom
)

Returns the receiver's image data based on the given zoom level.

public String

Returns:

the name of the program
getName
()

Returns the receiver's name.

public static Program[]

Returns:

an array of programs
getPrograms
()

Answers all available programs in the operating system.

pack-priv boolean
gio_execute(String fileName)

GIO - Execute the program for the given file.

pack-priv static Map<String, List<String>>
pack-priv static String
pack-priv static Program
pack-priv static Program
gio_getProgram(long application)

pack-priv static boolean
gio_launch(String fileName)

GIO - Launch the default program for the given file.

public int

Returns:

the receiver's hash
hashCode
()

Overrides java.lang.Object.hashCode.

Returns an integer hash code for the receiver.
pack-priv static boolean
isExecutable(String fileName)

public static boolean

Returns:

true if the file is launched, otherwise false
launch
(String
the file or program name or URL (http:// or https://)
fileName
)

Launches the operating system executable associated with the file or URL (http:// or https://).

public static boolean

Returns:

true if the file is launched, otherwise false
launch
(String
the file name or program name or URL (http:// or https://)
fileName
,
String
the name of the working directory or null
workingDir
)

Launches the operating system executable associated with the file or URL (http:// or https://).

pack-priv static String[]
public String

Returns:

a string representation of the program
toString
()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

commandback to summary
pack-priv String command
gioExpectUriback to summary
pack-priv boolean gioExpectUri
iconPathback to summary
pack-priv String iconPath
mimeTableback to summary
pack-priv static Map<String, List<String>> mimeTable
modTimeback to summary
pack-priv static long modTime
nameback to summary
pack-priv String name
PREFIX_HTTPback to summary
pack-priv static final String PREFIX_HTTP
PREFIX_HTTPSback to summary
pack-priv static final String PREFIX_HTTPS

Constructor Detail

Programback to summary
pack-priv Program()

Prevents uninitialized instances from being created outside the package.

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Parameters
other:Object

the object to compare with this object

Returns:boolean

true if the object is the same as this object and false otherwise

Annotations
@Override
See Also
hashCode()
executeback to summary
public boolean execute(String fileName)

Executes the program with the file as the single argument in the operating system. It is the responsibility of the programmer to ensure that the file contains valid data for this program.

Parameters
fileName:String

the file or program name

Returns:boolean

true if the file is launched, otherwise false

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT when fileName is null
findProgramback to summary
public static Program findProgram(String extension)

Finds the program that is associated with an extension. The extension may or may not begin with a '.'. Note that a Display must already exist to guarantee that this method returns an appropriate result.

Parameters
extension:String

the program extension

Returns:Program

the program or null

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT when extension is null
getExtensionsback to summary
public static String[] getExtensions()

Answer all program extensions in the operating system. Note that a Display must already exist to guarantee that this method returns an appropriate result.

Returns:String[]

an array of extensions

getImageDataback to summary
public ImageData getImageData()

Returns the receiver's image data at 100% zoom level. This is the icon that is associated with the receiver in the operating system.

Returns:ImageData

the image data for the program, may be null

getImageDataback to summary
public ImageData getImageData(int zoom)

Returns the receiver's image data based on the given zoom level. This is the icon that is associated with the receiver in the operating system.

Parameters
zoom:int

The zoom level in % of the standard resolution

Returns:ImageData

the image data for the program, may be null

Since
3.125
getNameback to summary
public String getName()

Returns the receiver's name. This is as short and descriptive a name as possible for the program. If the program has no descriptive name, this string may be the executable name, path or empty.

Returns:String

the name of the program

getProgramsback to summary
public static Program[] getPrograms()

Answers all available programs in the operating system. Note that a Display must already exist to guarantee that this method returns an appropriate result.

Returns:Program[]

an array of programs

gio_executeback to summary
pack-priv boolean gio_execute(String fileName)

GIO - Execute the program for the given file.

gio_getMimeInfoback to summary
pack-priv static Map<String, List<String>> gio_getMimeInfo()
gio_getMimeTypeback to summary
pack-priv static String gio_getMimeType(String extension)
gio_getProgramback to summary
pack-priv static Program gio_getProgram(String mimeType)
gio_getProgramback to summary
pack-priv static Program gio_getProgram(long application)
gio_launchback to summary
pack-priv static boolean gio_launch(String fileName)

GIO - Launch the default program for the given file.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns an integer hash code for the receiver. Any two objects that return true when passed to equals must return the same value for this method.

Returns:int

the receiver's hash

Annotations
@Override
See Also
equals(Object)
isExecutableback to summary
pack-priv static boolean isExecutable(String fileName)
launchback to summary
public static boolean launch(String fileName)

Launches the operating system executable associated with the file or URL (http:// or https://). If the file is an executable then the executable is launched. Note that a Display must already exist to guarantee that this method returns an appropriate result.

Parameters
fileName:String

the file or program name or URL (http:// or https://)

Returns:boolean

true if the file is launched, otherwise false

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT when fileName is null
launchback to summary
public static boolean launch(String fileName, String workingDir)

Launches the operating system executable associated with the file or URL (http:// or https://). If the file is an executable then the executable is launched. The program is launched with the specified working directory only when the workingDir exists and fileName is an executable. Note that a Display must already exist to guarantee that this method returns an appropriate result.

Parameters
fileName:String

the file name or program name or URL (http:// or https://)

workingDir:String

the name of the working directory or null

Returns:boolean

true if the file is launched, otherwise false

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT when fileName is null
Since
3.6
parseCommandback to summary
pack-priv static String[] parseCommand(String cmd)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.

Returns:String

a string representation of the program

Annotations
@Override