Package org.eclipse.swt.program
Class Program
java.lang.Object
org.eclipse.swt.program.Program
Instances of this class represent programs and
their associated file extensions in the operating
system.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.boolean
Executes the program with the file as the single argument in the operating system.static Program
findProgram
(String extension) Finds the program that is associated with an extension.static String[]
Answer all program extensions in the operating system.Returns the receiver's image data at 100% zoom level.getImageData
(int zoom) Returns the receiver's image data based on the given zoom level.getName()
Returns the receiver's name.static Program[]
Answers all available programs in the operating system.int
hashCode()
Returns an integer hash code for the receiver.static boolean
Launches the operating system executable associated with the file or URL (http:// or https://).static boolean
Launches the operating system executable associated with the file or URL (http:// or https://).toString()
Returns a string containing a concise, human-readable description of the receiver.
-
Method Details
-
findProgram
Finds the program that is associated with an extension. The extension may or may not begin with a '.'. Note that aDisplay
must already exist to guarantee that this method returns an appropriate result.- Parameters:
extension
- the program extension- Returns:
- the program or
null
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT when extension is null
-
getExtensions
Answer all program extensions in the operating system. Note that aDisplay
must already exist to guarantee that this method returns an appropriate result.- Returns:
- an array of extensions
-
getPrograms
Answers all available programs in the operating system. Note that aDisplay
must already exist to guarantee that this method returns an appropriate result.- Returns:
- an array of programs
-
launch
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 aDisplay
must already exist to guarantee that this method returns an appropriate result.- Parameters:
fileName
- the file or program name or URL (http:// or https://)- Returns:
true
if the file is launched, otherwisefalse
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT when fileName is null
-
launch
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 theworkingDir
exists andfileName
is an executable. Note that aDisplay
must already exist to guarantee that this method returns an appropriate result.- Parameters:
fileName
- the file name or program name or URL (http:// or https://)workingDir
- the name of the working directory or null- Returns:
true
if the file is launched, otherwisefalse
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT when fileName is null
- Since:
- 3.6
-
execute
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
- the file or program name- Returns:
true
if the file is launched, otherwisefalse
- Throws:
IllegalArgumentException
-- ERROR_NULL_ARGUMENT when fileName is null
-
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:
- the image data for the program, may be null
-
getImageData
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
- The zoom level in % of the standard resolution- Returns:
- the image data for the program, may be null
- Since:
- 3.125
-
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:
- the name of the program
-
equals
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. -
hashCode
public int hashCode()Returns an integer hash code for the receiver. Any two objects that returntrue
when passed toequals
must return the same value for this method. -
toString
Returns a string containing a concise, human-readable description of the receiver.
-