[prev in list] [next in list] [prev in thread] [next in thread]
List: jedit-cvs
Subject: [ jEdit-CVS ] plugins/ProjectViewer/projectviewer/vpt VPTFilteredModel.java,1.1,1.2
From: Marcelo Vanzin <vanza () users ! sourceforge ! net>
Date: 2006-03-30 4:29:44
Message-ID: E1FOonD-0006BC-Vl () mail ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/jedit/plugins/ProjectViewer/projectviewer/vpt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12639/projectviewer/vpt
Modified Files:
VPTFilteredModel.java
Log Message:
- fix nodeChanged() and getPathToRoot() for filtered model
- fix javadoc in PVActions.
Index: VPTFilteredModel.java
===================================================================
RCS file: /cvsroot/jedit/plugins/ProjectViewer/projectviewer/vpt/VPTFilteredModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- VPTFilteredModel.java 16 Feb 2006 05:19:08 -0000 1.1
+++ VPTFilteredModel.java 30 Mar 2006 04:29:41 -0000 1.2
@@ -134,7 +134,7 @@
} //}}}
//{{{ +clearCache() : void
- // when the filter has changed, clear the cache
+ /** when the filter has changed, clear the cache */
public void clearCache() {
cache.clear();
} //}}}
@@ -149,7 +149,7 @@
nodeStructureChanged(VPTNode.findProjectFor((VPTNode)node));
} //}}}
- //{{{ #getCompressedDirectories(VPTProject) : List
+ //{{{ #getFilteredNodes(VPTProject) : List
protected List getFilteredNodes(VPTProject node) {
if (cache.get(node)!=null)
return (List)cache.get(node);
@@ -203,13 +203,61 @@
return cd;
} //}}}
- //{{{ +class _FilteredDirectoryNode_
+ //{{{ +getPathToRoot(TreeNode) : TreeNode[]
+ public TreeNode[] getPathToRoot(TreeNode aNode) {
+ // Three possibilities: aNode is a group, aNode is a
+ // project or aNode is a leaf. In the first cases, just
+ // return the normal path to root. Otherwise, need to build
+ // the path...
+ VPTNode node = (VPTNode) aNode;
+ if (node.isGroup() || node.isProject()) {
+ return super.getPathToRoot(aNode);
+ } else if (node.isLeaf()) {
+ VPTProject proj = VPTNode.findProjectFor(node);
+ TreeNode[] proj_path = super.getPathToRoot(proj);
+ // path will be project path + 2 nodes
+ TreeNode[] lpath = new TreeNode[proj_path.length + 2];
+ System.arraycopy(proj_path, 0, lpath, 0, proj_path.length);
+
+ boolean found = false;
+ List filters = getFilteredNodes(proj);
+ for (Iterator i = filters.iterator(); i.hasNext(); ) {
+ FilteredDirectoryNode dnode = (FilteredDirectoryNode) i.next();
+ if (dnode.getFiles().contains(node)) {
+ lpath[lpath.length - 2] = dnode;
+ lpath[lpath.length - 1] = node;
+ found = true;
+ break;
+ }
+ }
+ return (found) ? lpath : null;
+ } else {
+ // shouldn't reach here?
+ return null;
+ }
+ } //}}}
+
+ //{{{ +nodeChanged(TreeNode) : void
+ /** Handles a node changed request. */
+ public void nodeChanged(TreeNode node) {
+ VPTNode n = (VPTNode) node;
+ if (n.isGroup() || n.isProject()) {
+ super.nodeChanged(node);
+ } else {
+ TreeNode[] path_to_node = getPathToRoot(n);
+ if (path_to_node != null) {
+ fireTreeNodesChanged(n, path_to_node, null, null);
+ }
+ }
+ } //}}}
+
+ //{{{ +class FilteredDirectoryNode
public class FilteredDirectoryNode extends VPTDirectory {
private VPTFilterData filterData;
private List files = new ArrayList();
- //{{{ +FilteredDirectoryNode(VPTNode, String) : <init>
+ //{{{ +FilteredDirectoryNode(VPTFilterData, List) : <init>
public FilteredDirectoryNode(VPTFilterData filterData, List openableNodeList)
{
super(new java.io.File(filterData.getName()));
@@ -244,12 +292,13 @@
return files;
} //}}}
+ //{{{ -sortFiles() : void
private void sortFiles()
{
Collections.sort(files);
- }
+ } //}}}
- //{{{ +getFiles() : List
+ //{{{ +getChildCount() : int
public int getChildCount() {
return files.size();
} //}}}
@@ -264,7 +313,7 @@
files.add(node);
} //}}}
- //{{{ +getClipType() : boolean
+ //{{{ +getClipType() : int
public int getClipType() {
return VPTCellRenderer.CLIP_START;
} //}}}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jEdit-CVS mailing list
jEdit-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic