Class EnvironmentOptions


  • @OpenApi
    public class EnvironmentOptions
    extends java.lang.Object

    Represents application environment options.

    Application-related options are referred to as environment options. They are saved in the global.opt file that is located in <USER_HOME_DIR>/.magicdraw/<VERSION_NUMBER>/data.

    You can add custom environment options for MagicDraw.

    To add your own environment options

    • 1. Extend the AbstractPropertyOptionsGroup class.
    • 2. Add the extending class to application environment options.

    Example: Adding custom environment options

     class MyOptionsGroup extends AbstractPropertyOptionsGroup
     {
         ...
     }
    
     Application application = Application.getInstance();
     EnvironmentOptions options = application.getEnvironmentOptions();
     options.addGroup(new ExampleOptionsGroup());
     
    See Also:
    OptionsGroup, AbstractPropertyOptionsGroup
    • Method Detail

      • addGroup

        @OpenApi
        public void addGroup​(OptionsGroup group)
        Adds an option group to the environment options.
        Parameters:
        group - option group to add.
      • getPathVariablesOptions

        @OpenApi
        public PathVariablesOptionsGroup getPathVariablesOptions()
        Get path variables options.
        Returns:
        path variables options group.
      • addEnvironmentChangeListener

        @OpenApi
        public void addEnvironmentChangeListener​(EnvironmentOptions.EnvironmentChangeListener listener)
        Adds environment change listener to environment options. Make sure to have a strong reference to the listener in the client code, because listeners are managed through weak references to avoid memory leaks.
        Parameters:
        listener - listener to add.
      • removeEnvironmentChangeListener

        @OpenApi
        public void removeEnvironmentChangeListener​(EnvironmentOptions.EnvironmentChangeListener listener)
        Removes environment change listener.
        Parameters:
        listener - listener to remove.