sidekick
Class SideKickParsedData

java.lang.Object
  extended by sidekick.SideKickParsedData

public class SideKickParsedData
extends java.lang.Object

Stores a buffer structure tree.

Version:
$Revision: 8752 $ Plugins can extend this class to persist plugin-specific information. For example, the XML plugin stores code completion-related structures using a subclass.

Field Summary
 javax.swing.tree.DefaultMutableTreeNode root
          Plugin parsers should add nodes to the root node.
 javax.swing.tree.DefaultTreeModel tree
           
 
Constructor Summary
SideKickParsedData(java.lang.String fileName)
           
 
Method Summary
protected  boolean canAddToPath(javax.swing.tree.TreeNode node)
          Subclasses can override this to handle special case nodes that may not be suitable for adding to the path.
 IAsset getAsset(javax.swing.tree.TreeNode node)
          Convenience method to get the IAsset from the user object in the node
 IAsset getAssetAtOffset(int pos)
           
 Asset getAssetAtPosition(int pos)
          Deprecated. use getAssetAtOffset(int) instead
protected  javax.swing.tree.TreeNode getNodeAt(javax.swing.tree.TreeNode parent, int offset)
           
static SideKickParsedData getParsedData(org.gjt.sp.jedit.View view)
          Returns an instance of this class for the specified view.
 javax.swing.tree.TreePath getTreePathForPosition(int dot)
           
static void setParsedData(org.gjt.sp.jedit.View view, SideKickParsedData data)
          Sets the instance of this class for the specified view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tree

public javax.swing.tree.DefaultTreeModel tree

root

public javax.swing.tree.DefaultMutableTreeNode root
Plugin parsers should add nodes to the root node.

Constructor Detail

SideKickParsedData

public SideKickParsedData(java.lang.String fileName)
Parameters:
fileName - The file name being parsed, used as the root of the tree.
Method Detail

getParsedData

public static SideKickParsedData getParsedData(org.gjt.sp.jedit.View view)
Returns an instance of this class for the specified view. Note that this will only return a valid object after the SideKick.parse() method is called.

Parameters:
view - The view.

setParsedData

public static void setParsedData(org.gjt.sp.jedit.View view,
                                 SideKickParsedData data)
Sets the instance of this class for the specified view.

Parameters:
view - The view.
data - The instance.

getTreePathForPosition

public javax.swing.tree.TreePath getTreePathForPosition(int dot)
Parameters:
dot -

getNodeAt

protected javax.swing.tree.TreeNode getNodeAt(javax.swing.tree.TreeNode parent,
                                              int offset)

canAddToPath

protected boolean canAddToPath(javax.swing.tree.TreeNode node)
Subclasses can override this to handle special case nodes that may not be suitable for adding to the path. See JavaSideKick for an example.

Parameters:
node - a TreeNode that is being considered for adding to a tree path.
Returns:
true if it is okay to add the node. This default implementation always returns true.

getAssetAtPosition

public Asset getAssetAtPosition(int pos)
Deprecated. use getAssetAtOffset(int) instead


getAssetAtOffset

public IAsset getAssetAtOffset(int pos)
Parameters:
pos - TODO: explain what pos means.

getAsset

public IAsset getAsset(javax.swing.tree.TreeNode node)
Convenience method to get the IAsset from the user object in the node

Parameters:
node - a DefaultMutableTreeNode. Anything else will cause this method to return null.
Returns:
the IAsset contained in the user object in the node.