Class EnvironmentOptions
- java.lang.Object
-
- com.nomagic.magicdraw.core.options.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EnvironmentOptions.EnvironmentChangeListener
Receives events when environment options change in the environment options dialog after "Ok" is pressed.private class
com.nomagic.magicdraw.core.options.EnvironmentOptions.ListenersIterator
Iterates through environment change listeners.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<OptionsGroup>
externalGroups
External groups registered by MagicDraw plugins - these options are sorted.private java.util.List<OptionsGroup>
internalGroups
Internal groups registered by MagicDraw core.private java.util.List<java.lang.ref.WeakReference<EnvironmentOptions.EnvironmentChangeListener>>
listeners
static java.lang.String
OPTIONS_FILE_PATH
-
Constructor Summary
Constructors Constructor Description EnvironmentOptions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEnvironmentChangeListener(EnvironmentOptions.EnvironmentChangeListener listener)
Adds environment change listener to environment options.void
addGroup(OptionsGroup group)
Adds an option group to the environment options.private void
addInternalGroup(OptionsGroup group)
void
applyLoadedData(com.nomagic.magicdraw.lic.MDVersion version, StyleManager styleManager, boolean pluginsLoaded)
private void
checkGroup(OptionsGroup group)
Check if given group already defined.private static StyleManager
convertFromMagicDraw70(StyleManager styleManager)
com.nomagic.magicdraw.core.options.BrowserOptionsGroup
getBrowserOptions()
CircularLayouterOptionsGroup
getCircularLayouterOptionsGroup()
ClassDiagramLayouterOptionsGroup
getClassDiagramLayouterOptionsGroup()
com.nomagic.magicdraw.core.options.CompositionInspectionGroup
getCompositionInspectionOptions()
com.nomagic.magicdraw.core.options.CustomMetalThemeOptionsGroup
getCustomMetalThemeOptions()
com.nomagic.magicdraw.core.options.DiagramOptionsGroup
getDiagramOptions()
com.nomagic.magicdraw.core.options.ExperienceOptionsGroup
getExperienceOptionsGroup()
com.nomagic.magicdraw.core.options.ExternalToolsOptionsGroup
getExternalToolsOptions()
com.nomagic.magicdraw.core.options.FloatingOptionsGroup
getFloatingOptions()
com.nomagic.magicdraw.core.options.GeneralOptionsGroup
getGeneralOptions()
OptionsGroup
getGroup(java.lang.String id)
java.util.List<OptionsGroup>
getGroups()
HierarchicLayouterOptionsGroup
getHierarchicLayouterOptionsGroup()
com.nomagic.magicdraw.core.options.KeyboardOptionsGroup
getKeyboardOptions()
com.nomagic.magicdraw.core.options.LaunchersOptionsGroup
getLaunchersOptionsGroup()
OrganicRouterOptionsGroup
getLinkRouterOptionsGroup()
com.nomagic.magicdraw.core.options.NetworkOptionsGroup
getNetworkOptions()
com.nomagic.magicdraw.core.options.NotificationOptionsGroup
getNotificationOptions()
Returns notification options groupOrganicLayouterOptionsGroup
getOrganicLayouterOptionsGroup()
OrthogonalLayouterOptionsGroup
getOrthogonalLayouterOptionsGroup()
PathVariablesOptionsGroup
getPathVariablesOptions()
Get path variables options.com.nomagic.magicdraw.core.options.ResourcesOptionsGroup
getResourcesOptions()
com.nomagic.magicdraw.core.options.SpecificationPropertiesOptionsGroup
getSpecificationPropertiesOptionsGroup()
com.nomagic.magicdraw.spellchecker.SpellingOptionsGroup
getSpellingOptions()
com.nomagic.magicdraw.core.options.SymbolPropertiesOptionsGroup
getSymbolPropertiesOptionsGroup()
TeamworkOptionsGroup
getTeamworkOptions()
TreeLayouterOptionsGroup
getTreeLayouterOptionsGroup()
void
insertEnvironmentChangeListener(EnvironmentOptions.EnvironmentChangeListener listener)
Adds environment change listener to environment options.static StyleManager
load(boolean silent)
Load propertiesvoid
optionsChanged(java.util.List<Property> props)
void
removeEnvironmentChangeListener(EnvironmentOptions.EnvironmentChangeListener listener)
Removes environment change listener.void
removeGroup(OptionsGroup group)
void
save()
Saves properties
-
-
-
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.
-
listeners
private final java.util.List<java.lang.ref.WeakReference<EnvironmentOptions.EnvironmentChangeListener>> listeners
-
-
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()
-
getTeamworkOptions
public TeamworkOptionsGroup getTeamworkOptions()
-
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()
-
getOrganicLayouterOptionsGroup
public OrganicLayouterOptionsGroup getOrganicLayouterOptionsGroup()
-
getHierarchicLayouterOptionsGroup
public HierarchicLayouterOptionsGroup getHierarchicLayouterOptionsGroup()
-
getCircularLayouterOptionsGroup
public CircularLayouterOptionsGroup getCircularLayouterOptionsGroup()
-
getClassDiagramLayouterOptionsGroup
public ClassDiagramLayouterOptionsGroup getClassDiagramLayouterOptionsGroup()
-
getOrthogonalLayouterOptionsGroup
public OrthogonalLayouterOptionsGroup getOrthogonalLayouterOptionsGroup()
-
getTreeLayouterOptionsGroup
public TreeLayouterOptionsGroup getTreeLayouterOptionsGroup()
-
getLinkRouterOptionsGroup
public OrganicRouterOptionsGroup getLinkRouterOptionsGroup()
-
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)
-
convertFromMagicDraw70
private static StyleManager convertFromMagicDraw70(StyleManager styleManager)
-
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.
-
insertEnvironmentChangeListener
public void insertEnvironmentChangeListener(EnvironmentOptions.EnvironmentChangeListener listener)
Adds environment change listener to environment options. NOTE: 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
- instance ofEnvironmentOptions.EnvironmentChangeListener
-
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
-
-