mars
Class Settings

java.lang.Object
  |
  +--mars.Settings

public class Settings
extends java.lang.Object

Contains various IDE settings. Persistent settings are maintained for the current user and on the current machine using Java's Preference objects. Failing that, default setting values come from Settings.properties file. If both of those fail, default values come from static arrays defined in this class. The latter can can be modified prior to instantiating Settings object. NOTE: If the Preference objects fail due to security exceptions, changes to settings will not carry over from one MARS session to the next.


Field Summary
static boolean[] defaultBooleanSettingsValues
          Last resort default values for boolean settings; will use only if neither the Preferences nor the properties file work.
static java.lang.String[] defaultStringSettingsValues
          Last resort default values for String settings; will use only if neither the Preferences nor the properties file work.
 
Constructor Summary
Settings()
          Create Settings object and set to saved values.
 
Method Summary
 boolean getAssembleAllEnabled()
          Setting for whether the assemble operation applies only to the file currently open in the editor or whether it applies to all files in that file's directory (primitive project capability).
 boolean getAssembleOnOpenEnabled()
          Setting for whether selected program will be automatically assembled upon opening.
 boolean getBackSteppingEnabled()
          Return whether backstepping is permitted at this time.
 boolean getBareMachineEnabled()
          Setting for whether user programs limited to "bare machine" formatted basic instructions.
 boolean getDisplayAddressesInHex()
          Setting for whether Addresses in the Execute pane will be displayed in hexadecimal.
 boolean getDisplayValuesInHex()
          Setting for whether values in the Execute pane will be displayed in hexadecimal.
 java.lang.String getExceptionHandler()
          Name of currently selected exception handler file.
 boolean getExceptionHandlerEnabled()
          Setting for whether the currently selected exception handler (a MIPS source file) will be automatically included in each assemble operation.
 boolean getExtendedAssemblerEnabled()
          Setting for whether user programs can use pseudo-instructions or extended addressing modes or alternative instruction formats (all are implemented as pseudo-instructions).
 boolean getLabelWindowVisibility()
          Default concerning whether or not to display the Labels Window -- symbol table.
 void reset()
          Reset settings to default values, as described in the constructor comments.
 void setAssembleAllEnabled(boolean value)
          Establish setting for whether a file will be assembled by itself (false) or along with all other files in its directory (true).
 void setAssembleOnOpenEnabled(boolean value)
          Establish setting for whether a file will be automatically assembled as soon as it is opened.
 void setDisplayAddressesInHex(boolean value)
          Establish setting for whether addresses in the Execute pane will be displayed in hexadecimal format.
 void setDisplayValuesInHex(boolean value)
          Establish setting for whether values in the Execute pane will be displayed in hexadecimal format.
 void setExceptionHandler(java.lang.String newFilename)
          Set name of exception handler file and write it to settings properties file.
 void setExceptionHandlerEnabled(boolean value)
          Establish setting for whether the currently selected exception handler (a MIPS source file) will be automatically included in each assemble operation.
 void setExtendedAssemblerEnabled(boolean value)
          Establish setting for whether or not pseudo-instructions and formats are permitted in user programs.
 void setLabelWindowVisibility(boolean value)
          Establish setting for whether the labels window (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultBooleanSettingsValues

public static boolean[] defaultBooleanSettingsValues
Last resort default values for boolean settings; will use only if neither the Preferences nor the properties file work. If you wish to change them, do so before instantiating the Settings object. Values are matched to keys by list position: ExtendedAssembler, BareMachine, AssembleOnOpen, AssembleAll, LabelWindowVisibility, DisplayAddressesInHex, DisplayValuesInHex, LoadExceptionHandler.


defaultStringSettingsValues

public static java.lang.String[] defaultStringSettingsValues
Last resort default values for String settings; will use only if neither the Preferences nor the properties file work. If you wish to change, do so before instantiating the Settings object. Must match key by list position: ExceptionHandler.

Constructor Detail

Settings

public Settings()
Create Settings object and set to saved values. If saved values not found, will set based on defaults stored in Settings.properties file. If file problems, will set based on defaults stored in this class.

Method Detail

getBackSteppingEnabled

public boolean getBackSteppingEnabled()
Return whether backstepping is permitted at this time. Backstepping is ability to undo execution steps one at a time. Available only in the IDE. This is not a persistent setting and is not under MARS user control.

Returns:
true if backstepping is permitted, false otherwise.

reset

public void reset()
Reset settings to default values, as described in the constructor comments.


getBareMachineEnabled

public boolean getBareMachineEnabled()
Setting for whether user programs limited to "bare machine" formatted basic instructions. This was added 8 Aug 2006 but is fixed at false for now, due to uncertainty as to what exactly constitutes "bare machine".

Returns:
true if only bare machine instructions allowed, false otherwise.

getExtendedAssemblerEnabled

public boolean getExtendedAssemblerEnabled()
Setting for whether user programs can use pseudo-instructions or extended addressing modes or alternative instruction formats (all are implemented as pseudo-instructions).

Returns:
true if pseudo-instructions and formats permitted, false otherwise.

getAssembleOnOpenEnabled

public boolean getAssembleOnOpenEnabled()
Setting for whether selected program will be automatically assembled upon opening. This can be useful if user employs an external editor such as MIPSter.

Returns:
true if file is to be automatically assembled upon opening and false otherwise.

getDisplayAddressesInHex

public boolean getDisplayAddressesInHex()
Setting for whether Addresses in the Execute pane will be displayed in hexadecimal.

Returns:
true if addresses are displayed in hexadecimal and false otherwise (decimal).

getDisplayValuesInHex

public boolean getDisplayValuesInHex()
Setting for whether values in the Execute pane will be displayed in hexadecimal.

Returns:
true if values are displayed in hexadecimal and false otherwise (decimal).

getAssembleAllEnabled

public boolean getAssembleAllEnabled()
Setting for whether the assemble operation applies only to the file currently open in the editor or whether it applies to all files in that file's directory (primitive project capability). If the "assemble on open" setting is set, this "assemble all" setting will be applied as soon as the file is opened.

Returns:
true if all files are to be assembled, false if only the file open in editor.

getExceptionHandlerEnabled

public boolean getExceptionHandlerEnabled()
Setting for whether the currently selected exception handler (a MIPS source file) will be automatically included in each assemble operation.

Returns:
true if exception handler is to be included in assemble, false otherwise.

getLabelWindowVisibility

public boolean getLabelWindowVisibility()
Default concerning whether or not to display the Labels Window -- symbol table.

Returns:
true if label window is to be displayed, false otherwise.

getExceptionHandler

public java.lang.String getExceptionHandler()
Name of currently selected exception handler file.

Returns:
String pathname of current exception handler file, null if none.

setExtendedAssemblerEnabled

public void setExtendedAssemblerEnabled(boolean value)
Establish setting for whether or not pseudo-instructions and formats are permitted in user programs. User can change this setting via the IDE. If setting changes, new setting will be written to properties file.

Parameters:
value - True to permit, false otherwise.

setAssembleOnOpenEnabled

public void setAssembleOnOpenEnabled(boolean value)
Establish setting for whether a file will be automatically assembled as soon as it is opened. This is handy for those using an external text editor such as Mipster. If setting changes, new setting will be written to properties file.

Parameters:
value - True to automatically assemble, false otherwise.

setAssembleAllEnabled

public void setAssembleAllEnabled(boolean value)
Establish setting for whether a file will be assembled by itself (false) or along with all other files in its directory (true). This permits multi-file programs and a primitive "project" capability. If setting changes, new setting will be written to properties file.

Parameters:
value - True to assemble all, false otherwise.

setDisplayAddressesInHex

public void setDisplayAddressesInHex(boolean value)
Establish setting for whether addresses in the Execute pane will be displayed in hexadecimal format.

Parameters:
value - True to display addresses in hexadecimal, false for decimal.

setDisplayValuesInHex

public void setDisplayValuesInHex(boolean value)
Establish setting for whether values in the Execute pane will be displayed in hexadecimal format.

Parameters:
value - True to display values in hexadecimal, false for decimal.

setLabelWindowVisibility

public void setLabelWindowVisibility(boolean value)
Establish setting for whether the labels window (i.e. symbol table) will be displayed as part of the Text Segment display. If setting changes, new setting will be written to properties file.

Parameters:
value - True to dispay labels window, false otherwise.

setExceptionHandlerEnabled

public void setExceptionHandlerEnabled(boolean value)
Establish setting for whether the currently selected exception handler (a MIPS source file) will be automatically included in each assemble operation. If setting changes, new setting will be written to properties file.

Parameters:
value - True to assemble exception handler, false otherwise

setExceptionHandler

public void setExceptionHandler(java.lang.String newFilename)
Set name of exception handler file and write it to settings properties file.

Parameters:
newFilename - name of exception handler file