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
    • Field Detail

      • OPTIONS_FILE_PATH

        public static final java.lang.String OPTIONS_FILE_PATH
      • internalGroups

        private final java.util.List<OptionsGroup> internalGroups
        Internal groups registered by MagicDraw core.
      • externalGroups

        private final java.util.List<OptionsGroup> externalGroups
        External groups registered by MagicDraw plugins - these options are sorted.
    • Constructor Detail

      • EnvironmentOptions

        public EnvironmentOptions()
    • Method Detail

      • addInternalGroup

        private void addInternalGroup​(OptionsGroup group)
      • addGroup

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

        public void removeGroup​(OptionsGroup group)
      • getGroups

        public java.util.List<OptionsGroup> getGroups()
      • getGroup

        public OptionsGroup getGroup​(java.lang.String id)
      • getDiagramOptions

        public com.nomagic.magicdraw.core.options.DiagramOptionsGroup getDiagramOptions()
      • getNotificationOptions

        public com.nomagic.magicdraw.core.options.NotificationOptionsGroup getNotificationOptions()
        Returns notification options group
        Returns:
        notification options group
      • getGeneralOptions

        public com.nomagic.magicdraw.core.options.GeneralOptionsGroup getGeneralOptions()
      • getBrowserOptions

        public com.nomagic.magicdraw.core.options.BrowserOptionsGroup getBrowserOptions()
      • getCompositionInspectionOptions

        public com.nomagic.magicdraw.core.options.CompositionInspectionGroup getCompositionInspectionOptions()
      • getFloatingOptions

        public com.nomagic.magicdraw.core.options.FloatingOptionsGroup getFloatingOptions()
      • getExternalToolsOptions

        public com.nomagic.magicdraw.core.options.ExternalToolsOptionsGroup getExternalToolsOptions()
      • getExperienceOptionsGroup

        public com.nomagic.magicdraw.core.options.ExperienceOptionsGroup getExperienceOptionsGroup()
      • getNetworkOptions

        public com.nomagic.magicdraw.core.options.NetworkOptionsGroup getNetworkOptions()
      • getKeyboardOptions

        public com.nomagic.magicdraw.core.options.KeyboardOptionsGroup getKeyboardOptions()
      • getResourcesOptions

        public com.nomagic.magicdraw.core.options.ResourcesOptionsGroup getResourcesOptions()
      • getPathVariablesOptions

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

        public com.nomagic.magicdraw.spellchecker.SpellingOptionsGroup getSpellingOptions()
      • getCustomMetalThemeOptions

        public com.nomagic.magicdraw.core.options.CustomMetalThemeOptionsGroup getCustomMetalThemeOptions()
      • getLaunchersOptionsGroup

        public com.nomagic.magicdraw.core.options.LaunchersOptionsGroup getLaunchersOptionsGroup()
      • getSpecificationPropertiesOptionsGroup

        public com.nomagic.magicdraw.core.options.SpecificationPropertiesOptionsGroup getSpecificationPropertiesOptionsGroup()
      • getSymbolPropertiesOptionsGroup

        public com.nomagic.magicdraw.core.options.SymbolPropertiesOptionsGroup getSymbolPropertiesOptionsGroup()
      • load

        @CheckForNull
        public static StyleManager load​(boolean silent)
        Load properties
        Parameters:
        silent - silent load mode
        Returns:
        loaded properties
      • applyLoadedData

        public void applyLoadedData​(@CheckForNull
                                    com.nomagic.magicdraw.lic.MDVersion version,
                                    @CheckForNull
                                    StyleManager styleManager,
                                    boolean pluginsLoaded)
      • save

        public void save()
        Saves properties
      • optionsChanged

        public void optionsChanged​(java.util.List<Property> props)
        Parameters:
        props - changed properties
      • 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.
      • checkGroup

        private void checkGroup​(OptionsGroup group)
        Check if given group already defined.
        Parameters:
        group - group