com.ibm.mq.explorer.ui.extensions

Class TreeNode

  • java.lang.Object
    • org.eclipse.core.runtime.PlatformObject
      • com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        • com.ibm.mq.explorer.ui.extensions.TreeNode
  • All Implemented Interfaces:
    org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IActionFilter


    public abstract class TreeNode
    extends com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
    implements org.eclipse.ui.IActionFilter
    Abstract class for classes defining nodes in the TreeViewer in the MQ Navigator View.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int ADVANCED_COMPLEXITY_THRESHOLD
      Minimum complexity value for a TreeNode to be shown under an Advanced TreeNode
      static int COMPLEX_COMPLEXITY
      Complexity value for a complex TreeNodes (under Advanced)
      static java.lang.String COPYRIGHT_NOTICE
      Common copyright notice
      static int QSG_COMPLEXITY
      Complexity value for a QSG TreeNodes (not under Advanced)
      static java.lang.String SCCSID
      CMVC descriptors - expanded during extraction
      static int SIMPLE_COMPLEXITY
      Complexity value for a simple TreeNodes (not under Advanced)
      • Fields inherited from class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase

        ENCODING_TYPE
    • Constructor Summary

      Constructors 
      Constructor and Description
      TreeNode(TreeNode parent, MQExtObject object, java.lang.String plugin_id)
      Constructor
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      void addChildToNode(TreeNode child, int complex)
      This method adds the given child to this TreeNode.
      void appendToContextMenu(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.action.IMenuManager manager)
      appends to the context menu for this TreeNode
      abstract int compare(TreeNode child1, TreeNode child2)
      compares two TreeNodes that are children to this one, and returns their sort order Typically the comparison will based on either the "sequence" or the "title".
      static int compareByName(TreeNode child1, TreeNode child2)
      Compares two child TreeNodes based on their Names
      static int compareBySequence(TreeNode child1, TreeNode child2)
      Compares two child TreeNodes based on their Sequence values
      java.io.File createDragDropFile()
      Create a File representing this TreeNode, for use when the TreeNode is drag-dropped in FileTransfer format.
      TreeNode[] getChildren()
      Returns an array containing the actual child TreeNodes of this TreeNode (visible and invisible)
      int getComplexity()
      Returns the complexity value of this TreeNode
      abstract java.lang.String getContentPageId()
      Return the id of the content page to be shown when this TreeNode is selected.
      abstract java.lang.String getHelpId()
      Return the id of the infopop to be shown when this TreeNode is selected.
      abstract org.eclipse.swt.graphics.Image getIcon()
      Return the icon to use for this TreeNode
      abstract java.lang.String getId()
      Return the id of this TreeNode This is called by a class implementing ITreeNodeFactory to identify the a parent TreeNode, so the extension can decide whether to insert additional child treeNodes under this parent.
      java.lang.Object getObject()
      Returns the object associated with this TreeNode.
      TreeNode getParent()
      Returns the parent of this TreeNode
      java.lang.String getPlugin_id()
      Get the id of the owning Plug-in for this TreeNode
      TreeNode getRealParent()
      Returns the real parent of this TreeNode, i.e.
      abstract java.lang.String getSequence()
      Return the sequence id of this TreeNode This is called by parent TreeNode which chooses to order their child TreeNodes based on their sequence number.
      java.lang.String getTreeNodeId()
      Get the Id of this TreeNode
      TreeNode[] getVisibleChildren()
      Returns an array containing the visible child TreeNodes of this TreeNode
      boolean hasChildren()
      Returns whether this TreeNode has children
      abstract boolean isAddChildrenWhenExpanded()
      Gets whether children should only be added to this TreeNode when the TreeNode is expanded, rather than when the Tree is first created
      boolean isAdvancedTreeNode()
      Gets whether this TreeNode is an Advanced TreeNode
      boolean isChildExist(java.lang.String childId)
      Check whether a child TreeNode with the specified id exists
      abstract boolean isContextMenuFromUiObject()
      Gets whether the context menu for this TreeNode should be created from the associated object rather than from the TreeNode
      boolean isExpanded()
      Get whether this TreeNode is currently expanded
      static boolean isPluginEnabled(java.lang.String plugin_id)
      Returns whether the specified plug-in is currently enabled (on the Preferences dialog)
      boolean isVisible()
      Returns whether this TreeNode is currently visible
      void removeChildFromNode(TreeNode child)
      This method removes the given child to this TreeNode
      void removeFromNavigatorView()
      Removes this TreeNode from the MQ Navigator view
      void setChildrenVisibility(boolean visible)
      Set the visibility flag for all children of this TreeNode.
      void setComplexity(int complex)
      Sets the complexity value of this TreeNode
      void setParent(TreeNode newParent)
      Sets the parent of this TreeNode
      void setPlugin_id(java.lang.String string)
      Set the id of the owning Plug-in for this TreeNode
      void setVisible(boolean isVis)
      Sets whether this TreeNode is currently visible
      boolean testAttribute(java.lang.Object target, java.lang.String name, java.lang.String value)
      Returns whether the specific attribute matches the state of the target object.
      abstract java.lang.String toString()
      Return the name of this TreeNode
      void update()
      Update the icon and label of this TreeNode, and all its offspring
      void updateItem()
      Update the icon and label of this TreeNode only
      • Methods inherited from class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase

        addCommonChoicesToContextMenu, addStandardInfoForDragDropFile, createDragDropFile, createImportExportChild, createXMLMementoForDragDropFile, createXMLMementoForExportDragDropFile, getLoadingChildTreeNode, getMqNavigatorView, getNewObjectProvider, getNLSString, getRealChildren, getRealParent, getTreeNodeComparator, getUiStatusProvider, getUniqueIdentifier, hasChildren, isChildrenAdded, isLoadingAChildTreeNode, isLoadingTreeNode, isRealChildrenAdded, openChild, refresh, refreshVisibleChildren, resetTreeNodeId, setChildren, setChildrenAdded, setChildrenVisibility, setExpanded, setLoadingTreeNode, setMqNavigatorView, setNewObjectProvider, setObject, setOwningTreeNode, setRealChildrenAdded, setTreeNodeComparator, setUiStatusProvider, showStatus
      • Methods inherited from class org.eclipse.core.runtime.PlatformObject

        getAdapter
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • COPYRIGHT_NOTICE

        public static final java.lang.String COPYRIGHT_NOTICE
        Common copyright notice
        See Also:
        Constant Field Values
      • SCCSID

        public static final java.lang.String SCCSID
        CMVC descriptors - expanded during extraction
        See Also:
        Constant Field Values
      • ADVANCED_COMPLEXITY_THRESHOLD

        public static final int ADVANCED_COMPLEXITY_THRESHOLD
        Minimum complexity value for a TreeNode to be shown under an Advanced TreeNode
        See Also:
        Constant Field Values
      • SIMPLE_COMPLEXITY

        public static final int SIMPLE_COMPLEXITY
        Complexity value for a simple TreeNodes (not under Advanced)
        See Also:
        Constant Field Values
      • QSG_COMPLEXITY

        public static final int QSG_COMPLEXITY
        Complexity value for a QSG TreeNodes (not under Advanced)
        See Also:
        Constant Field Values
      • COMPLEX_COMPLEXITY

        public static final int COMPLEX_COMPLEXITY
        Complexity value for a complex TreeNodes (under Advanced)
        See Also:
        Constant Field Values
    • Constructor Detail

      • TreeNode

        public TreeNode(TreeNode parent,
                        MQExtObject object,
                        java.lang.String plugin_id)
        Constructor
        Parameters:
        parent - parent TreeNode
        object - object associated with this TreeNode
        plugin_id - the id of the owning plug-in
    • Method Detail

      • toString

        public abstract java.lang.String toString()
        Return the name of this TreeNode
        Overrides:
        toString in class java.lang.Object
        Returns:
        returns the name of this TreeNode
      • getId

        public abstract java.lang.String getId()
        Return the id of this TreeNode This is called by a class implementing ITreeNodeFactory to identify the a parent TreeNode, so the extension can decide whether to insert additional child treeNodes under this parent.
        Returns:
        returns the id of this TreeNode
      • getSequence

        public abstract java.lang.String getSequence()
        Return the sequence id of this TreeNode This is called by parent TreeNode which chooses to order their child TreeNodes based on their sequence number.
        Returns:
        returns the sequence id of this TreeNode
      • getContentPageId

        public abstract java.lang.String getContentPageId()
        Return the id of the content page to be shown when this TreeNode is selected.
        Returns:
        returns the content page id associated with this TreeNode
      • getHelpId

        public abstract java.lang.String getHelpId()
        Return the id of the infopop to be shown when this TreeNode is selected.
        Returns:
        returns the help id associated with this TreeNode
      • getIcon

        public abstract org.eclipse.swt.graphics.Image getIcon()
        Return the icon to use for this TreeNode
        Returns:
        returns the icon to use for this TreeNode, or null if the stanard folder icon is to be used
      • compare

        public abstract int compare(TreeNode child1,
                                    TreeNode child2)
        compares two TreeNodes that are children to this one, and returns their sort order Typically the comparison will based on either the "sequence" or the "title".
        Parameters:
        child1 - first child for comparison
        child2 - second child for comparison
        Returns:
        how child1 compares to child2
      • isContextMenuFromUiObject

        public abstract boolean isContextMenuFromUiObject()
        Gets whether the context menu for this TreeNode should be created from the associated object rather than from the TreeNode
        Returns:
        returns true if the context menu should be created from the associated object
      • appendToContextMenu

        public void appendToContextMenu(org.eclipse.swt.widgets.Shell shell,
                                        org.eclipse.jface.action.IMenuManager manager)
        appends to the context menu for this TreeNode
        Parameters:
        shell - the Shell to use
        manager - the Menu Manager
      • isAddChildrenWhenExpanded

        public abstract boolean isAddChildrenWhenExpanded()
        Gets whether children should only be added to this TreeNode when the TreeNode is expanded, rather than when the Tree is first created
        Returns:
        returns true if children should only be added to this TreeNode when the TreeNode is expanded
      • removeFromNavigatorView

        public void removeFromNavigatorView()
        Removes this TreeNode from the MQ Navigator view
      • testAttribute

        public boolean testAttribute(java.lang.Object target,
                                     java.lang.String name,
                                     java.lang.String value)
        Returns whether the specific attribute matches the state of the target object.
        Specified by:
        testAttribute in interface org.eclipse.ui.IActionFilter
        Parameters:
        target - the target object
        name - the attribute name
        value - the attribute value
        Returns:
        boolean true if the attribute matches; false otherwise
      • isPluginEnabled

        public static boolean isPluginEnabled(java.lang.String plugin_id)
        Returns whether the specified plug-in is currently enabled (on the Preferences dialog)
        Parameters:
        plugin_id - the id of the plug-in to test
        Returns:
        boolean true if currently enabled, false otherwise
      • addChildToNode

        public void addChildToNode(TreeNode child,
                                   int complex)
        This method adds the given child to this TreeNode.

        "complexity" is a hint that the extension gives to explorer, ranging from 0 (easiest) to 10 (hardest). A value of 0 will interpreted by explorer as "easy" and 10 will be interpreted as "hard",

        In the current implementation of explorer a "complexity" up and including 5 the TreeNode will be added immediately under the parent TreeNode. Otherwise an "Advanced" folder will be added under the parent and the child TreeNode added under the Advanced TreeNode.

        Overrides:
        addChildToNode in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Parameters:
        child - the childTreeNode to add
        complex - the complexity value for the child being added
      • removeChildFromNode

        public void removeChildFromNode(TreeNode child)
        This method removes the given child to this TreeNode
        Overrides:
        removeChildFromNode in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Parameters:
        child - the child TreeNode to remove
      • getParent

        public TreeNode getParent()
        Returns the parent of this TreeNode
        Overrides:
        getParent in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        TreeNode the parent TreeNode
      • getRealParent

        public TreeNode getRealParent()
        Returns the real parent of this TreeNode, i.e. not an advanced TreeNode
        Returns:
        TreeNode the real parent TreeNode
      • setParent

        public void setParent(TreeNode newParent)
        Sets the parent of this TreeNode
        Overrides:
        setParent in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Parameters:
        newParent - the new parent for this TreeNode
      • getVisibleChildren

        public TreeNode[] getVisibleChildren()
        Returns an array containing the visible child TreeNodes of this TreeNode
        Returns:
        TreeNode[] an array of child TreeNodes
      • getChildren

        public TreeNode[] getChildren()
        Returns an array containing the actual child TreeNodes of this TreeNode (visible and invisible)
        Overrides:
        getChildren in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        TreeNode[] an array of child TreeNodes
      • hasChildren

        public boolean hasChildren()
        Returns whether this TreeNode has children
        Overrides:
        hasChildren in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        boolean true if this TreeNode has any children, false otherwise
      • getObject

        public java.lang.Object getObject()
        Returns the object associated with this TreeNode.
        Overrides:
        getObject in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        Object the associated object
      • setComplexity

        public void setComplexity(int complex)
        Sets the complexity value of this TreeNode
        Overrides:
        setComplexity in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Parameters:
        complex - the complexity value for this TreeNode
      • getComplexity

        public int getComplexity()
        Returns the complexity value of this TreeNode
        Overrides:
        getComplexity in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        int the complexity value for this TreeNode
      • compareBySequence

        public static int compareBySequence(TreeNode child1,
                                            TreeNode child2)
        Compares two child TreeNodes based on their Sequence values
        Parameters:
        child1 - the first child TreeNode for comparison
        child2 - the second child TreeNode for comparison
        Returns:
        int how child1 compares to child2
      • compareByName

        public static int compareByName(TreeNode child1,
                                        TreeNode child2)
        Compares two child TreeNodes based on their Names
        Parameters:
        child1 - the first child TreeNode for comparison
        child2 - the second child TreeNode for comparison
        Returns:
        int how child1 compares to child2
      • setVisible

        public void setVisible(boolean isVis)
        Sets whether this TreeNode is currently visible
        Overrides:
        setVisible in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Parameters:
        isVis - true if the TreeNode is to be made visible, false otherwise
      • setChildrenVisibility

        public void setChildrenVisibility(boolean visible)
        Set the visibility flag for all children of this TreeNode.
        Parameters:
        visible - true if all children of the TreeNode are to be visible, false otherwise
      • isVisible

        public boolean isVisible()
        Returns whether this TreeNode is currently visible
        Overrides:
        isVisible in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        boolean true if this TreeNode is currently visible, false otherwise
      • isChildExist

        public boolean isChildExist(java.lang.String childId)
        Check whether a child TreeNode with the specified id exists
        Overrides:
        isChildExist in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Parameters:
        childId - child id to test
        Returns:
        boolean true if a child TreeNode with the specified id exists, false otherwise
      • getTreeNodeId

        public java.lang.String getTreeNodeId()
        Get the Id of this TreeNode
        Overrides:
        getTreeNodeId in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        String the Id of this TreeNode
      • getPlugin_id

        public java.lang.String getPlugin_id()
        Get the id of the owning Plug-in for this TreeNode
        Overrides:
        getPlugin_id in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        String the id of the owning Plug-in
      • setPlugin_id

        public void setPlugin_id(java.lang.String string)
        Set the id of the owning Plug-in for this TreeNode
        Overrides:
        setPlugin_id in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Parameters:
        string - the id of the owning Plug-in for this TreeNode
      • isExpanded

        public boolean isExpanded()
        Get whether this TreeNode is currently expanded
        Overrides:
        isExpanded in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        boolean true if the TreeNode is currently expanded, false otherwise
      • isAdvancedTreeNode

        public boolean isAdvancedTreeNode()
        Gets whether this TreeNode is an Advanced TreeNode
        Overrides:
        isAdvancedTreeNode in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        boolean returns true if this is an advanced TreeNode.
      • update

        public void update()
        Update the icon and label of this TreeNode, and all its offspring
        Overrides:
        update in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
      • updateItem

        public void updateItem()
        Update the icon and label of this TreeNode only
        Overrides:
        updateItem in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
      • createDragDropFile

        public java.io.File createDragDropFile()
        Create a File representing this TreeNode, for use when the TreeNode is drag-dropped in FileTransfer format. This default implementation creates an XML file with the following keys defined:
        • Name
        • Id
        • PluginId
            Parent
          • Name
          • Id
          • PluginId These keys are defined in the class DragDropFile.java. Override this method as required.
        Overrides:
        createDragDropFile in class com.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
        Returns:
        File the created file