|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.DrJava
public class DrJava
Startup class for DrJava consisting entirely of static members. The main method reads the .drjava file (creating one if none exists) to get the critical information required to start the main JVM for DrJava: (i) the location of tools.jar in the Java JDK installed on this machine (so DrJava can invoke the javac compiler stored in tools.jar) (ii) the argument string for invoking the main JVM (notably -X options used to determine maximum heap size, etc.) Here is a summary of the launch mechanism of DrJava: 1. DrJava.main will be started. 2. DrJava.handleCommandLineArgs scans the command line arguments. 2.1. This involves determining if the -new parameter forces a new instance. 3. DrJava.configureAndLoadDrJavaRoot determines if remote control should be used: 3.1. If -new doesn't force a new instance 3.2. and REMOTE_CONTROL_ENABLED 3.3. and files have been specified on the command line 3.4. and the remote control server can be contacted 3.5. then DrJava will open the files in an existing instance and quit 4. DrJava.configureAndLoadDrJavaRoot determines if a restart is necessary: 4.1. If MASTER_JVM_XMX is set 4.2. or MASTER_JVM_ARGS is set 4.3. then DrJava will attempt to restart itself with the specified JVM arguments 4.4. Files that have arrived via Mac OS X's handleOpenFile event up to this point are included in the main arguments for the restarted DrJava. 4.5. If that fails, DrJava will ask if the user wants to delete the settings in the .drjava file 4.5.1. If the user says "yes", DrJava will attempt another restart. If that fails, DrJava gives up. 4.5.2. If the user says "no", DrJava gives up. 4.6. If additional files arrive via the handleOpenFile event, DrJava will attempt to use the remote control to open the files in the restarted DrJava. 4.6.1. DrJava will perform NUM_REMOTE_CONTROL_RETRIES attempts to contact the remote control server, with WAIT_BEFORE_REMOTE_CONTROL_RETRY ms of sleep time in between. 5. If neither the remote control was used nor a restart was necessary, DrJava will call DrJavaRoot.main. 5.1. Files that have arrived via Mac OS X's handleOpenFile event up to this point are included in the arguments for DrJavaRoot.main. 5.2. If additional files arrive via the handleOpenFile event, DrJava will MainFrame.handleRemoteOpenFile.
| Field Summary | |
|---|---|
(package private) static boolean |
_alreadyRestarted
true if DrJava has already launched the new instance. |
private static FileConfiguration |
_config
Configuration object with all customized and default values. |
(package private) static boolean |
_doRestart
true if a new DrJava needs to be restarted to adjust parameters. |
private static ArrayList<String> |
_filesToOpen
|
(package private) static boolean |
_forceNewInstance
true if a new instance of DrJava should be started instead of connecting to an already running instance. |
private static ArrayList<String> |
_jvmArgs
|
static Log |
_log
|
private static File |
_propertiesFile
Properties file used by the configuration object. |
(package private) static boolean |
_restartedDrJavaUsesRemoteControl
true if the restarted DrJava will use remote control, and we can try to pass along files to open that arrived too late. |
(package private) static boolean |
_showDebugConsole
|
private static String |
DEFAULT_MAX_HEAP_SIZE_ARG
|
static File |
DEFAULT_PROPERTIES_FILE
Default properties file used by the configuration object, i.e. |
private static int |
NUM_REMOTE_CONTROL_RETRIES
Number of times we retry opening with the remote control. |
static String |
RESOURCE_BUNDLE_NAME
Name of the resource bundle that controls whether options are editable or not. |
private static int |
WAIT_BEFORE_DECLARING_SUCCESS
Time in millisecond before restarting DrJava to change the heap size, etc. |
private static int |
WAIT_BEFORE_REMOTE_CONTROL_RETRY
Time in millisecond that we wait before making another remote control attempt. |
| Constructor Summary | |
|---|---|
DrJava()
|
|
| Method Summary | |
|---|---|
(package private) static FileConfiguration |
_initConfig()
Initializes the configuration object with the current notion of the properties file. |
protected static void |
_saveConfig()
Saves the contents of the config file. |
static void |
addFileToOpen(String s)
Add a file to the list of files to open. |
static void |
cleanUp()
|
static void |
clearFilesToOpen()
Clear the list of files to open. |
static void |
configureAndLoadDrJavaRoot(String[] args)
|
(package private) static void |
displayUsage()
Displays a usage message about the available options. |
static FileConfiguration |
getConfig()
Returns the configuration object with all customized and default values. |
static String[] |
getFilesToOpen()
|
static File |
getPropertiesFile()
Returns the properties file used by the configuration object. |
static boolean |
getShowDebugConsole()
|
(package private) static boolean |
handleCommandLineArgs(String[] args)
Handles any command line arguments that have been specified. |
static void |
main(String[] args)
Starts running DrJava. |
static boolean |
openWithRemoteControl(ArrayList<String> files,
int numAttempts)
Open the specified files using the remote control. |
(package private) static void |
setPropertiesFile(String fileName)
Switches the config object to use a custom config file. |
static boolean |
warnIfLinuxWithCompiz()
Warn if this system is Linux with Compiz. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static volatile Log _log
private static final String DEFAULT_MAX_HEAP_SIZE_ARG
private static final ArrayList<String> _filesToOpen
private static final ArrayList<String> _jvmArgs
static volatile boolean _showDebugConsole
static volatile boolean _forceNewInstance
static volatile boolean _doRestart
static volatile boolean _alreadyRestarted
static volatile boolean _restartedDrJavaUsesRemoteControl
private static final int WAIT_BEFORE_DECLARING_SUCCESS
private static final int NUM_REMOTE_CONTROL_RETRIES
private static final int WAIT_BEFORE_REMOTE_CONTROL_RETRY
public static final File DEFAULT_PROPERTIES_FILE
private static volatile File _propertiesFile
private static volatile FileConfiguration _config
public static final String RESOURCE_BUNDLE_NAME
| Constructor Detail |
|---|
public DrJava()
| Method Detail |
|---|
public static File getPropertiesFile()
public static FileConfiguration getConfig()
public static String[] getFilesToOpen()
public static void addFileToOpen(String s)
public static void clearFilesToOpen()
public static boolean openWithRemoteControl(ArrayList<String> files,
int numAttempts)
files - files to open with remote controlnumAttempts - of attempts to be made
public static boolean getShowDebugConsole()
public static void main(String[] args)
args - Command line argument arraypublic static void configureAndLoadDrJavaRoot(String[] args)
static boolean handleCommandLineArgs(String[] args)
static void displayUsage()
static void setPropertiesFile(String fileName)
static FileConfiguration _initConfig()
throws IllegalStateException
IllegalStateException - if config has already been assignedprotected static void _saveConfig()
public static void cleanUp()
public static boolean warnIfLinuxWithCompiz()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||