Class ToolManagerImpl

  • All Implemented Interfaces:
    ToolManager, java.beans.PropertyChangeListener, java.util.EventListener

    public class ToolManagerImpl
    extends java.lang.Object
    implements ToolManager, java.beans.PropertyChangeListener
    Tool manager that knows about all the running tools for each workspace in the project; the tool manager is responsible for launching new tools, and managing connections among tools.
    • Constructor Detail

      • ToolManagerImpl

        public ToolManagerImpl​(Project project)
    • Method Detail

      • getConsumerTools

        public PluginTool[] getConsumerTools()
        Description copied from interface: ToolManager
        Get a list of tools that consume at least one tool event.
        Specified by:
        getConsumerTools in interface ToolManager
        Returns:
        zero-length array if no tool consumes any events
      • getProducerTools

        public PluginTool[] getProducerTools()
        Description copied from interface: ToolManager
        Get a list of tools that produce at least one tool event.
        Specified by:
        getProducerTools in interface ToolManager
        Returns:
        zero-length array if no tool produces any events
      • getRunningTools

        public PluginTool[] getRunningTools()
        Description copied from interface: ToolManager
        Get a list running tools across all workspaces.
        Specified by:
        getRunningTools in interface ToolManager
        Returns:
        zero-length array if there are no running tools.
      • getConnection

        public ToolConnection getConnection​(PluginTool producer,
                                            PluginTool consumer)
        Description copied from interface: ToolManager
        Get the connection object for the producer and consumer tools
        Specified by:
        getConnection in interface ToolManager
        Parameters:
        producer - tool that is producing the tool event
        consumer - tool that is consuming the tool event
        Returns:
        the connection
      • getWorkspaces

        public Workspace[] getWorkspaces()
        Description copied from interface: ToolManager
        Get list of known workspaces.
        Specified by:
        getWorkspaces in interface ToolManager
        Returns:
        an array of known workspaces
      • saveToXml

        public org.jdom.Element saveToXml()
        Saves this object to an XML element
        Returns:
        the element containing the tool XML
      • restoreFromXml

        public void restoreFromXml​(org.jdom.Element root)
        restores the object from an XML element
        Parameters:
        root - root element of saved XML state
      • hasChanged

        public boolean hasChanged()
        Return whether any tools have changed, or if any tools were added or removed from any of the workspaces.
        Returns:
        true if any tools in this workspace have changed
      • close

        public void close()
        Close all running tools in the project.
      • saveSessionTools

        public boolean saveSessionTools()
        Save the tools that are opened and changed, that will be brought back up when the project is reopened
        Returns:
        true if the session was saved
      • dispose

        public void dispose()
      • dumpConnectionList

        public void dumpConnectionList()
        Debug method for printing out the list of connections.
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • clearWorkspaceChanged

        public void clearWorkspaceChanged()
        Clear the flag so the user does not get prompted to save the project; flag gets set to true when a workspace is created, and a workspace is created when a new project is created.
      • getToolServices

        public ToolServices getToolServices()
        Get any tool services available from this tool
        Returns:
        ToolServices list of tool services this tool can provide.
      • toolChanged

        public void toolChanged​(PluginTool tool)
        Description copied from interface: ToolManager
        A configuration change was made to the tool; a plugin was added or removed.
        Specified by:
        toolChanged in interface ToolManager
        Parameters:
        tool - tool that changed
      • getTool

        public PluginTool getTool​(java.lang.String toolName)
        Called by WorkspaceImpl when it is restoring its state.
        Parameters:
        toolName - the name of the tool
        Returns:
        the tool
      • disconnectTool

        public void disconnectTool​(PluginTool tool)
        Description copied from interface: ToolManager
        Removes all connections involving tool
        Specified by:
        disconnectTool in interface ToolManager
        Parameters:
        tool - tool for which to remove all connections
      • canAutoSave

        public boolean canAutoSave​(PluginTool tool)
      • toolSaved

        public void toolSaved​(PluginTool tool,
                              boolean toolChanged)