Class CommandInterfaceUtil


  • public class CommandInterfaceUtil
    extends Object
    Command interface util.
    • Constructor Detail

      • CommandInterfaceUtil

        public CommandInterfaceUtil()
    • Method Detail

      • containsBmObject

        public static <T extends org.eclipse.emf.ecore.EObject> boolean containsBmObject​(Collection<? extends T> collection,
                                                                                         T object)
        Checks if the collection contains the given BM object.
        Parameters:
        collection - the collection.
        object - the BM object.
        Returns:
        true if contains, false otherwise.
      • copyVisibility

        public static AdjustableBoolean copyVisibility​(AdjustableBoolean original)
        Copies visibility.
        Parameters:
        original - the original visibility.
        Returns:
        the copy
      • getCommandGroupCategory

        public static CommandGroupCategory getCommandGroupCategory​(org.eclipse.emf.ecore.EObject eObject)
        Gets command group category.
        Parameters:
        eObject - the interface object
        Returns:
        the category, may be null
      • getCommandGroupCategoryByCommandProxyUri

        public static CommandGroupCategory getCommandGroupCategoryByCommandProxyUri​(Command command)
        Gets command group category by command proxy URI.
        Parameters:
        command - the command
        Returns:
        the category, may be null
      • getCommandGroupName

        public static String getCommandGroupName​(CommandGroup group,
                                                 ScriptVariant scriptVariant)
        Gets command name.
        Parameters:
        group - the group
        scriptVariant - the script variant
        Returns:
        the name
      • getCommandGroupRepresentationBasename

        public static String getCommandGroupRepresentationBasename​(CommandGroup group,
                                                                   String languageCode,
                                                                   ScriptVariant scriptVariant)
        Gets basename of a command group representation. The basename here is a group name without category prefix.
        Parameters:
        group - the group
        languageCode - the language code
        scriptVariant - the script variant
        Returns:
        the basename of group representation
      • getCommandInterface

        public static CommandInterface getCommandInterface​(org.eclipse.emf.ecore.EObject eObject)
        Gets command interface.
        Parameters:
        eObject - the interface object
        Returns:
        the command interface, may be null
      • getCommandName

        public static String getCommandName​(Command command,
                                            ScriptVariant scriptVariant)
        Gets command name.
        Parameters:
        command - the command
        scriptVariant - the script variant
        Returns:
        the name
      • getCommandRepresentation

        public static String getCommandRepresentation​(Command command,
                                                      String languageCode,
                                                      ScriptVariant scriptVariant)
        Gets command representation.
        Parameters:
        command - the command
        languageCode - the language code
        scriptVariant - the script variant
        Returns:
        the command representation
      • getConfiguration

        public static Configuration getConfiguration​(org.eclipse.emf.ecore.EObject source)
        Gets configuration by resolve configuration uri on source editing support.
        Parameters:
        source - the source
        Returns:
        the configuration
      • getConfigurationCommandInterfaceItem

        public static ConfigurationCommandInterfaceItem getConfigurationCommandInterfaceItem​(SubsystemCommandInterface subsystemCommandInterface)
        Gets interface section item by subsystem interface.
        Parameters:
        subsystemCommandInterface - the subsystem interface
        Returns:
        the interface section item, may be null
      • getContainerCommandInterface

        public static CommandInterface getContainerCommandInterface​(org.eclipse.emf.ecore.EObject eObject)
        Gets e-object container command interface.
        Parameters:
        eObject - the inteface object
        Returns:
        the command interface, may be null
      • getFullyQualifiedName

        public static org.eclipse.xtext.naming.QualifiedName getFullyQualifiedName​(MdObject mdObject)
        Gets md-object fully qualified name.
        Parameters:
        mdObject - the md-object
        Returns:
        the fqn
      • getMdObjectByInterfaceItem

        public static MdObject getMdObjectByInterfaceItem​(org.eclipse.emf.ecore.EObject interfaceItem)
        Gets md-object by command interface item.
        Parameters:
        interfaceItem - the command interface item
        Returns:
        the md-object, may be null
      • getMdObjectRepresentation

        public static String getMdObjectRepresentation​(MdObject mdObject,
                                                       String languageCode,
                                                       boolean isObject)
        Gets md-object representation.
        Parameters:
        mdObject - the md-object
        languageCode - the language code
        isObject - if true gets object representation, false - list
        Returns:
        the representation
      • getParentSubsystemCommandInterface

        public static SubsystemCommandInterface getParentSubsystemCommandInterface​(SubsystemCommandInterface subsystemCommandInterface)
        Gets parent subsystem interface.
        Parameters:
        subsystemCommandInterface - the child subsystem interface
        Returns:
        the parent, may be null
      • getRealCommand

        public static Command getRealCommand​(Command command)
        Gets cmi model command.
        Parameters:
        command - the command, may be stub ds-object
        Returns:
        the cmi model command
      • getRealCommandGroup

        public static CommandGroup getRealCommandGroup​(CommandGroup commandGroup)
        Gets cmi model command group.
        Parameters:
        commandGroup - the command group, may be stub ds-object
        Returns:
        the cmi model command group
      • getRealSectionSubsystem

        public static Subsystem getRealSectionSubsystem​(Subsystem subsystem)
        Gets cmi model subsystem.
        Parameters:
        subsystem - the subsystem, may be stub ds-object
        Returns:
        the cmi model subsystem
      • getSubsystem

        public static Subsystem getSubsystem​(Object obj)
        Gets subsystem
        Parameters:
        obj - the interface object
        Returns:
        the subsystem, may be null
      • getSubsystemCommandInterface

        public static SubsystemCommandInterface getSubsystemCommandInterface​(ConfigurationCommandInterfaceItem configurationCommandInterfaceItem)
        Gets subsystem interface by interface section item.
        Parameters:
        configurationCommandInterfaceItem - the interface section item
        Returns:
        the subsystem interface, may be null
      • getSubsystemOwner

        public static MdObject getSubsystemOwner​(MdObject mdObject,
                                                 Subsystem subsystem)
        Gets subsystem owner
        Parameters:
        mdObject - the start subsystem container
        subsystem - the subsystem
        Returns:
        the owner container, may be null
      • getSubsystems

        public static List<Subsystem> getSubsystems​(MdObject mdObject)
        Gets subsystem container subsystems.
        Parameters:
        mdObject - the container
        Returns:
        the subsystems
      • getUsedRoles

        public static Set<Role> getUsedRoles​(CommandInterfaceRoot root)
        Gets interface used roles.
        Parameters:
        root - the command interface
        Returns:
        the used roles with none default visibility
      • hasInterfaceSubsystem

        public static boolean hasInterfaceSubsystem​(Configuration configuration)
        Is configuration has someone interface subsystem.
        Parameters:
        configuration - the configuration
        Returns:
        is has
      • isCorrectNewOwner

        public static boolean isCorrectNewOwner​(MdObject newOwner,
                                                Subsystem subsystem)
        Is correct new owner for moved subsystem.
        Parameters:
        newOwner - the new owner
        subsystem - the moved subsystem
        Returns:
        true if is
      • isNewSubsystemOwnerNotEqualsCurrent

        public static boolean isNewSubsystemOwnerNotEqualsCurrent​(MdObject newOwner,
                                                                  Subsystem subsystem)
        Is new owner for moved subsystem not equal old owner.
        Parameters:
        newOwner - the new owner
        subsystem - the moved subsystem
        Returns:
        true if is
      • isRealSection

        public static boolean isRealSection​(Object obj)
        Is object cmi model subsystem, non proxy or stub ds-object
        Parameters:
        obj - the object
        Returns:
        true if is
      • isSubsystemOwnerNotConsistsSubsystemWithSameName

        public static boolean isSubsystemOwnerNotConsistsSubsystemWithSameName​(MdObject newOwner,
                                                                               Subsystem subsystem)
        Cheks if new subsystem owner do not consists subsystem with same name.
        Parameters:
        newOwner - the new owner
        subsystem - the moved subsystem
        Returns:
        true if is
      • removeBmObjectFromList

        public static <T extends org.eclipse.emf.ecore.EObject> void removeBmObjectFromList​(Collection<? extends T> list,
                                                                                            T object)
        Removes the given BM object from the list.
        Parameters:
        list - the list
        object - the BM object.
      • setCommandVisibility

        public static void setCommandVisibility​(CommandInterface commandInterface,
                                                Command command,
                                                AdjustableBoolean visibility)
        Sets command visibility and add changes to affected objects.
        Parameters:
        commandInterface - the command interface
        command - the command
        visibility - the visibility
        affectedObjects - the affected objects
      • setSubsystemVisibility

        public static void setSubsystemVisibility​(CommandInterface commandInterface,
                                                  Subsystem subsystem,
                                                  AdjustableBoolean visibility)
        Sets subsystem visibility and add changes to affected objects.
        Parameters:
        commandInterface - the command interface
        subsystem - the subsystem
        visibility - the visibility
        affectedObjects - the affected objects