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
FieldsModifier and TypeFieldDescriptionstatic final int
Minimum complexity value for a TreeNode to be shown under an Advanced TreeNodestatic final int
Complexity value for a complex TreeNodes (under Advanced)static final String
Common copyright noticestatic final int
Complexity value for a QSG TreeNodes (not under Advanced)static final String
CMVC descriptors - expanded during extractionstatic final int
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
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 TreeNodeabstract int
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 Namesstatic int
compareBySequence
(TreeNode child1, TreeNode child2) Compares two child TreeNodes based on their Sequence valuesCreate a File representing this TreeNode, for use when the TreeNode is drag-dropped in FileTransfer format.TreeNode[]
Returns an array containing the actual child TreeNodes of this TreeNode (visible and invisible)int
Returns the complexity value of this TreeNodeabstract String
Return the id of the content page to be shown when this TreeNode is selected.abstract String
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 TreeNodeabstract 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 the object associated with this TreeNode.Returns the parent of this TreeNodeGet the id of the owning Plug-in for this TreeNodeReturns the real parent of this TreeNode, i.e.abstract String
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.Get the Id of this TreeNodeTreeNode[]
Returns an array containing the visible child TreeNodes of this TreeNodeboolean
Returns whether this TreeNode has childrenabstract boolean
Gets whether children should only be added to this TreeNode when the TreeNode is expanded, rather than when the Tree is first createdboolean
Gets whether this TreeNode is an Advanced TreeNodeboolean
isChildExist
(String childId) Check whether a child TreeNode with the specified id existsabstract boolean
Gets whether the context menu for this TreeNode should be created from the associated object rather than from the TreeNodeboolean
Get whether this TreeNode is currently expandedstatic boolean
isPluginEnabled
(String plugin_id) Returns whether the specified plug-in is currently enabled (on the Preferences dialog)boolean
Returns whether this TreeNode is currently visiblevoid
removeChildFromNode
(TreeNode child) This method removes the given child to this TreeNodevoid
Removes this TreeNode from the MQ Navigator viewvoid
setChildrenVisibility
(boolean visible) Set the visibility flag for all children of this TreeNode.void
setComplexity
(int complex) Sets the complexity value of this TreeNodevoid
Sets the parent of this TreeNodevoid
setPlugin_id
(String string) Set the id of the owning Plug-in for this TreeNodevoid
setVisible
(boolean isVis) Sets whether this TreeNode is currently visibleboolean
testAttribute
(Object target, String name, String value) Returns whether the specific attribute matches the state of the target object.abstract String
toString()
Return the name of this TreeNodevoid
update()
Update the icon and label of this TreeNode, and all its offspringvoid
Update the icon and label of this TreeNode onlyMethods 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
-
Field Details
-
COPYRIGHT_NOTICE
Common copyright notice- See Also:
-
SCCSID
CMVC descriptors - expanded during extraction- See Also:
-
ADVANCED_COMPLEXITY_THRESHOLD
public static final int ADVANCED_COMPLEXITY_THRESHOLDMinimum complexity value for a TreeNode to be shown under an Advanced TreeNode- See Also:
-
SIMPLE_COMPLEXITY
public static final int SIMPLE_COMPLEXITYComplexity value for a simple TreeNodes (not under Advanced)- See Also:
-
QSG_COMPLEXITY
public static final int QSG_COMPLEXITYComplexity value for a QSG TreeNodes (not under Advanced)- See Also:
-
COMPLEX_COMPLEXITY
public static final int COMPLEX_COMPLEXITYComplexity value for a complex TreeNodes (under Advanced)- See Also:
-
-
Constructor Details
-
TreeNode
Constructor- Parameters:
parent
- parent TreeNodeobject
- object associated with this TreeNodeplugin_id
- the id of the owning plug-in
-
-
Method Details
-
toString
Return the name of this TreeNode -
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
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
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
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
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 comparisonchild2
- 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 usemanager
- 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
-
testAttribute
Returns whether the specific attribute matches the state of the target object.- Specified by:
testAttribute
in interfaceorg.eclipse.ui.IActionFilter
- Parameters:
target
- the target objectname
- the attribute namevalue
- the attribute value- Returns:
- boolean true if the attribute matches; false otherwise
-
isPluginEnabled
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
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 classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Parameters:
child
- the childTreeNode to addcomplex
- the complexity value for the child being added
-
removeChildFromNode
This method removes the given child to this TreeNode- Overrides:
removeChildFromNode
in classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Parameters:
child
- the child TreeNode to remove
-
getParent
Returns the parent of this TreeNode- Overrides:
getParent
in classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Returns:
- TreeNode the parent TreeNode
-
getRealParent
Returns the real parent of this TreeNode, i.e. not an advanced TreeNode- Returns:
- TreeNode the real parent TreeNode
-
setParent
Sets the parent of this TreeNode- Overrides:
setParent
in classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Parameters:
newParent
- the new parent for this TreeNode
-
getVisibleChildren
Returns an array containing the visible child TreeNodes of this TreeNode- Returns:
- TreeNode[] an array of child TreeNodes
-
getChildren
Returns an array containing the actual child TreeNodes of this TreeNode (visible and invisible)- Overrides:
getChildren
in classcom.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 classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Returns:
- boolean true if this TreeNode has any children, false otherwise
-
getObject
Returns the object associated with this TreeNode.- Overrides:
getObject
in classcom.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 classcom.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 classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Returns:
- int the complexity value for this TreeNode
-
compareBySequence
Compares two child TreeNodes based on their Sequence values- Parameters:
child1
- the first child TreeNode for comparisonchild2
- the second child TreeNode for comparison- Returns:
- int how child1 compares to child2
-
compareByName
Compares two child TreeNodes based on their Names- Parameters:
child1
- the first child TreeNode for comparisonchild2
- 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 classcom.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 classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Returns:
- boolean true if this TreeNode is currently visible, false otherwise
-
isChildExist
Check whether a child TreeNode with the specified id exists- Overrides:
isChildExist
in classcom.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
Get the Id of this TreeNode- Overrides:
getTreeNodeId
in classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Returns:
- String the Id of this TreeNode
-
getPlugin_id
Get the id of the owning Plug-in for this TreeNode- Overrides:
getPlugin_id
in classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Returns:
- String the id of the owning Plug-in
-
setPlugin_id
Set the id of the owning Plug-in for this TreeNode- Overrides:
setPlugin_id
in classcom.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 classcom.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 classcom.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 classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
-
updateItem
public void updateItem()Update the icon and label of this TreeNode only- Overrides:
updateItem
in classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
-
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 classcom.ibm.mq.explorer.ui.internal.navigator.TreeNodeBase
- Returns:
- File the created file
-