Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.swt.program
Class Program


java.lang.Object
  extended by 
org.eclipse.swt.program.Program

public final class Program
extends Object

Instances of this class represent programs and their associated file extensions in the operating system.

See Also:
Program snippets, Sample code and further information

Method Summary
 boolean equals ( Object other)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 boolean execute ( String fileName)
          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[] getExtensions ()
          Answer all program extensions in the operating system.
  ImageData getImageData ()
          Returns the receiver's image data.
  String getName ()
          Returns the receiver's name.
static  Program[] getPrograms ()
          Answers all available programs in the operating system.
 int hashCode ()
          Returns an integer hash code for the receiver.
static boolean launch ( String fileName)
          Launches the operating system executable associated with the file or URL (https:// or https://).
  String toString ()
          Returns a string containing a concise, human-readable description of the receiver.
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

findProgram

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 - the program extension
Returns:
the program or null
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT when extension is null

getExtensions

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:
an array of extensions

getPrograms

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:
an array of programs

launch

public static boolean launch(
String fileName)
Launches the operating system executable associated with the file or URL (https:// 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 - the file or program name or URL (https:// or https://)
Returns:
true if the file is launched, otherwise false
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT when fileName is null

execute

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 - the file or program name
Returns:
true if the file is launched, otherwise false
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT when fileName is null

getImageData

public 
ImageData getImageData()
Returns the receiver's image data. This is the icon that is associated with the receiver in the operating system.

Returns:
the image data for the program, may be null

getName

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:
the name of the program

equals

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

Overrides:
equals in class Object
Parameters:
other - the object to compare with this object
Returns:
true if the object is the same as this object and false otherwise
See Also:
hashCode()

hashCode

public int 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.

Overrides:
hashCode in class Object
Returns:
the receiver's hash
See Also:
equals(Object)

toString

public 
String toString()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a string representation of the program

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire