edu.rice.cs.drjava.config
Class KeyStrokeOption

java.lang.Object
  extended by edu.rice.cs.drjava.config.OptionParser<T>
      extended by edu.rice.cs.drjava.config.Option<KeyStroke>
          extended by edu.rice.cs.drjava.config.KeyStrokeOption
All Implemented Interfaces:
FormatStrategy<KeyStroke>, ParseStrategy<KeyStroke>

public class KeyStrokeOption
extends Option<KeyStroke>

Class representing all configuration options with values of type KeyStroke. Only runs in the event thread, so no synchronization is necessary (or advisable).


Field Summary
static KeyStroke NULL_KEYSTROKE
           
 
Fields inherited from class edu.rice.cs.drjava.config.OptionParser
defaultValue, name
 
Constructor Summary
KeyStrokeOption(String key, KeyStroke def)
          Standard constructor
 
Method Summary
 String format(KeyStroke k)
          Formats a statically typed T value as a String.
 KeyStroke parse(String s)
          The ability to parse a string to an object of type T.
 
Methods inherited from class edu.rice.cs.drjava.config.Option
getDefaultString
 
Methods inherited from class edu.rice.cs.drjava.config.OptionParser
getDefault, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_KEYSTROKE

public static final KeyStroke NULL_KEYSTROKE
Constructor Detail

KeyStrokeOption

public KeyStrokeOption(String key,
                       KeyStroke def)
Standard constructor

Parameters:
key - The name of this option.
Method Detail

parse

public KeyStroke parse(String s)
Description copied from class: OptionParser
The ability to parse a string to an object of type T. All concrete versions of this class must override this method to provide some sort of parser implementation.

Specified by:
parse in interface ParseStrategy<KeyStroke>
Specified by:
parse in class OptionParser<KeyStroke>
Parameters:
s - The String to be parsed; must be the string representation of the KeyStroke to be created. Uses the method KeyStroke.getKeyStroke(String s) which returns a KeyStroke if the string is correctly formatted or null otherwise.
Returns:
The KeyStroke object corresponding to the input string "s".

format

public String format(KeyStroke k)
Description copied from class: Option
Formats a statically typed T value as a String. The default implementation uses the toString() method.

Specified by:
format in interface FormatStrategy<KeyStroke>
Overrides:
format in class Option<KeyStroke>
Parameters:
k - The instance of class KeyStroke to be formatted.
Returns:
A String representing the KeyStroke "k".