Ignore:
Timestamp:
03/07/06 11:38:06 (19 years ago)
Author:
boris
Message:
  • added 'custon omc-path setting'
  • redone the modelica preference page a bit
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.mdt.core/src/org/modelica/mdt/core/preferences/PreferenceManager.java

    r389 r395  
    4848
    4949/**
    50  * Class used to initialize default preference values.
     50 * This class manages the settings for the omc plugin (and at the moment the omc
     51 * and ui plugin as well, but that's just uggly)
     52 *
     53 * The class provides two services, it sets the default settings and
     54 * gives an easy access to current settings via the get<Setting_Name> methods.
     55 *
     56 * This class does not provides means for changing settings. To modify the
     57 * settings the preference store object should be fetched from the core plugin.
     58 *
     59 * Following settings are available:
     60 *
     61 * DisplayCompErrors:
     62 *  if set to false then compatibility error dialogs will not be displayed when
     63 *  omc replys with something unexpected, the error will only be logged
     64 * 
     65 * UseStandardOmcPath:
     66 *  if set to true the OPENMODELICAHOME environment variable will be used to
     67 *  find the omc binary. if set to false the CustomOmcPath settings value will
     68 *  be used instead, se below.
     69 * 
     70 * CustomOmcPath:
     71 *  the value of this setting can be used as alternative path to find omc binary.
     72 *  used if UseStandardOmcPath settings is set to false, se above.
    5173 */
    5274public class PreferenceManager extends AbstractPreferenceInitializer
    5375{
    54 
     76    /* settings tags in the preference store */
    5577    public static final String DISPLAY_COMPATIBILTY_ERRORS =
    56         "DisplayCompatibilityErrors";   
     78        "DisplayCompatibilityErrors";
     79    public static final String USE_STANDARD_OMC_PATH =
     80        "UseStandardOmcPath";
     81    public static final String CUSTOM_OMC_PATH =
     82        "CustomOmcPath";   
    5783   
    5884    private static IPreferenceStore store = null;
     
    6389    public void initializeDefaultPreferences()
    6490    {
    65         /* setup default settings */
    66         getStore().setDefault(DISPLAY_COMPATIBILTY_ERRORS, true);
     91        /*
     92         * setup default settings
     93         */
     94        IPreferenceStore store = getStore();
     95
     96        store.setDefault(DISPLAY_COMPATIBILTY_ERRORS, true);
     97        store.setDefault(USE_STANDARD_OMC_PATH, true);
     98        store.setDefault(CUSTOM_OMC_PATH, "");
    6799    }
    68100   
     
    77109
    78110    /**
    79      * @return the current setting for display compatibility errors
     111     * @return current setting for 'display compatibility errors'
    80112     */
    81113    public static boolean getDisplayCompErrors()
     
    83115        return getStore().getBoolean(DISPLAY_COMPATIBILTY_ERRORS);
    84116    }
     117   
     118    /**
     119     * @return current settig for 'use standard omc path (that is $OPENMODELICAHOME)'
     120     */
     121    public static boolean getUseStandardOmcPath()
     122    {
     123        return getStore().getBoolean(USE_STANDARD_OMC_PATH);
     124    }
     125   
     126    /**
     127     * @return current settig for 'custom omc path'
     128     */
     129    public static String getCustomOmcPath()
     130    {
     131        return getStore().getString(CUSTOM_OMC_PATH);
     132    }
    85133}
Note: See TracChangeset for help on using the changeset viewer.