edu.rice.cs.drjava.platform
Interface PlatformSupport

All Known Implementing Classes:
DefaultPlatform

public interface PlatformSupport

The central interface for all platform-specific code in DrJava. A default platform-neutral implementation is provided in DefaultPlatform.

Version:
$Id: PlatformSupport.java 5393 2010-09-19 18:46:08Z rcartwright $
See Also:
DefaultPlatform

Method Summary
 void afterUISetup(javax.swing.Action about, javax.swing.Action prefs, javax.swing.Action quit)
          Hook for performing general UI setup.
 boolean areDrJavaFileExtensionsRegistered()
           
 void beforeUISetup()
          Hook for performing general UI setup.
 boolean canRegisterFileExtensions()
           
 java.lang.String getJavaSpecVersion()
          Returns the current Java specification version.
 boolean isJavaFileExtensionRegistered()
           
 boolean isMacPlatform()
          Returns whether this is a Mac OS X platform.
 boolean isUsingSystemLAF()
          Utility method to determine if the current Swing look and feel is the platform-specific look and feel for the client platform.
 boolean isWindowsPlatform()
          Returns whether this is a Windows platform.
 boolean openURL(java.net.URL address)
          Utility method for opening a URL in a browser in a platform-specific way.
 boolean registerDrJavaFileExtensions()
          Register .drjava and .djapp file extensions.
 boolean registerJavaFileExtension()
          Register .java file extension.
 void setMnemonic(javax.swing.AbstractButton obj, char mnemonic)
          Set the keyboard mnemonic for the component in a way that is consistent with the current platform.
 void setMnemonic(javax.swing.AbstractButton obj, int mnemonic)
          Set the keyboard mnemonic for the component in a way that is consistent with the current platform.
 void setMnemonic(javax.swing.ButtonModel obj, int mnemonic)
          Set the keyboard mnemonic for the component in a way that is consistent with the current platform.
 void setMnemonicAt(javax.swing.JTabbedPane obj, int tabIndex, int mnemonic)
          Set the keyboard mnemonic for the component in a way that is consistent with the current platform.
 boolean unregisterDrJavaFileExtensions()
          Unregister .drjava and .djapp file extensions.
 boolean unregisterJavaFileExtension()
          Unregister .java file extension.
 

Method Detail

isMacPlatform

boolean isMacPlatform()
Returns whether this is a Mac OS X platform.


isWindowsPlatform

boolean isWindowsPlatform()
Returns whether this is a Windows platform.


getJavaSpecVersion

java.lang.String getJavaSpecVersion()
Returns the current Java specification version.


isUsingSystemLAF

boolean isUsingSystemLAF()
Utility method to determine if the current Swing look and feel is the platform-specific look and feel for the client platform.

Returns:
true if current Swing look and feel is the system look and feel

beforeUISetup

void beforeUISetup()
Hook for performing general UI setup. Called before all other UI setup is done.


afterUISetup

void afterUISetup(javax.swing.Action about,
                  javax.swing.Action prefs,
                  javax.swing.Action quit)
Hook for performing general UI setup. Called after all other UI setup is done.

Parameters:
about - the Action associated with openning the About dialog
prefs - the Action associated with openning the Preferences dialog
quit - the Action associated with quitting the DrJava application

openURL

boolean openURL(java.net.URL address)
Utility method for opening a URL in a browser in a platform-specific way. The default implementation uses Runtime.exec to execute a command specified in Preferences. Platform implementations should attempt the default method first, then try to use a "default browser", if such a thing exists on the specific platform.

Parameters:
address - the URL to open
Returns:
true if the URL was successfully handled, false otherwise

setMnemonic

void setMnemonic(javax.swing.AbstractButton obj,
                 int mnemonic)
Set the keyboard mnemonic for the component in a way that is consistent with the current platform.

Parameters:
obj - the component whose mnemonic should be set
mnemonic - the key code which represents the mnemonic
See Also:
AbstractButton.setMnemonic(int), KeyEvent

setMnemonic

void setMnemonic(javax.swing.AbstractButton obj,
                 char mnemonic)
Set the keyboard mnemonic for the component in a way that is consistent with the current platform.

Parameters:
obj - the component whose mnemonic should be set
mnemonic - a char specifying the mnemonic value
See Also:
AbstractButton.setMnemonic(char)

setMnemonic

void setMnemonic(javax.swing.ButtonModel obj,
                 int mnemonic)
Set the keyboard mnemonic for the component in a way that is consistent with the current platform.

Parameters:
obj - the component whose mnemonic should be set
mnemonic - the key code which represents the mnemonic
See Also:
ButtonModel.setMnemonic(int), KeyEvent

setMnemonicAt

void setMnemonicAt(javax.swing.JTabbedPane obj,
                   int tabIndex,
                   int mnemonic)
Set the keyboard mnemonic for the component in a way that is consistent with the current platform.

Parameters:
obj - the component whose mnemonic should be set
tabIndex - the index of the tab that the mnemonic refers to
mnemonic - the key code which represents the mnemonic
See Also:
JTabbedPane.setMnemonicAt(int,int), KeyEvent

canRegisterFileExtensions

boolean canRegisterFileExtensions()
Returns:
true if file extensions can be registered and unregistered.

registerDrJavaFileExtensions

boolean registerDrJavaFileExtensions()
Register .drjava and .djapp file extensions.

Returns:
true if registering succeeded

unregisterDrJavaFileExtensions

boolean unregisterDrJavaFileExtensions()
Unregister .drjava and .djapp file extensions.

Returns:
true if unregistering succeeded

areDrJavaFileExtensionsRegistered

boolean areDrJavaFileExtensionsRegistered()
Returns:
true if .drjava and .djapp file extensions are registered.

registerJavaFileExtension

boolean registerJavaFileExtension()
Register .java file extension.

Returns:
true if registering succeeded

unregisterJavaFileExtension

boolean unregisterJavaFileExtension()
Unregister .java file extension.

Returns:
true if unregistering succeeded

isJavaFileExtensionRegistered

boolean isJavaFileExtensionRegistered()
Returns:
true if .java file extension is registered.