From: <va...@us...> - 2009-05-09 21:56:22
|
Revision: 15232 http://jedit.svn.sourceforge.net/jedit/?rev=15232&view=rev Author: vanza Date: 2009-05-09 21:56:15 +0000 (Sat, 09 May 2009) Log Message: ----------- Make the IconComposer available for all node types. This breaks the API for VersionControlService (not a big deal since no stable version of PV has that functionality). Modified Paths: -------------- plugins/ProjectViewer/trunk/projectviewer/config/VersionControlService.java plugins/ProjectViewer/trunk/projectviewer/vpt/IconComposer.java plugins/ProjectViewer/trunk/projectviewer/vpt/VPTCellRenderer.java Modified: plugins/ProjectViewer/trunk/projectviewer/config/VersionControlService.java =================================================================== --- plugins/ProjectViewer/trunk/projectviewer/config/VersionControlService.java 2009-05-09 15:20:33 UTC (rev 15231) +++ plugins/ProjectViewer/trunk/projectviewer/config/VersionControlService.java 2009-05-09 21:56:15 UTC (rev 15232) @@ -21,7 +21,7 @@ import javax.swing.Icon; import org.gjt.sp.jedit.io.VFSFile; -import projectviewer.vpt.VPTFile; +import projectviewer.vpt.VPTNode; import projectviewer.vpt.VPTProject; @@ -41,31 +41,34 @@ public interface VersionControlService extends OptionsService { - /** Key in the project's properties identifying the version control service. */ public static final String VC_SERVICE_KEY = "projectviewer.version_control_service"; + /** Special value designating that no special status is available for the node. */ + public static final int VC_STATUS_NORMAL = 0; + /** * This method should return an integer identifying the current - * state of the given file. + * state of the given node. * - * This method will be called every time the file's tree node needs + * This method will be called every time the tree node needs * to be repainted, so it shouldn't take long to return. It's * extremely encouraged that implementations do some sort of caching * to make this method return quickly. * - * @param f The file. + * @param node The node. * - * @return A service-specific identifier for the file state. + * @return A service-specific identifier for the file state, or + * VC_STATUS_NORMAL. */ - public int getFileState(VPTFile f); + public int getNodeState(VPTNode node); /** * This should return the status icon to be used to represent the * given state. * - * @param state The value retrieved from {@link #getFileState(VPTFile)}. + * @param state The value retrieved from {@link #getNodeState(VPTNode)}. * * @return The icon for the given state, or null for no icon. */ Modified: plugins/ProjectViewer/trunk/projectviewer/vpt/IconComposer.java =================================================================== --- plugins/ProjectViewer/trunk/projectviewer/vpt/IconComposer.java 2009-05-09 15:20:33 UTC (rev 15231) +++ plugins/ProjectViewer/trunk/projectviewer/vpt/IconComposer.java 2009-05-09 21:56:15 UTC (rev 15232) @@ -102,28 +102,34 @@ * <li>bottom right: error list status (if ErrorList is available).</li> * </ul> * - * @param f File node to query. + * @param node Node to query. * @param baseIcon Icon where to overlay status icons. * * @return A new icon with the overlayed status icons. */ - public Icon composeIcon(VPTFile f, + public Icon composeIcon(VPTNode node, Icon baseIcon) { - VFSFile vfsf = f.getFile(); int msg_state = MSG_STATE_NONE; - if (ProjectViewerConfig.getInstance().isErrorListAvailable()) { - msg_state = Helper.getMessageState(f.getURL()); + int file_state = FILE_STATE_NORMAL; + if (node.isFile()) { + VPTFile f = (VPTFile) node; + VFSFile vfsf = f.getFile(); + file_state = (vfsf != null) ? getFileState(vfsf, f.getURL()) + : FILE_STATE_NOT_FOUND; + if (ProjectViewerConfig.getInstance().isErrorListAvailable()) { + msg_state = Helper.getMessageState(f.getURL()); + } } - int file_state = (vfsf != null) ? getFileState(vfsf, f.getURL()) : FILE_STATE_NOT_FOUND; - Icon tr = null; // unused Icon tl = null; // vc_state if (vcservice != null) { - int vcstate = vcservice.getFileState(f); - tl = vcservice.getIcon(vcstate); + int vcstate = vcservice.getNodeState(node); + if (vcstate != VersionControlService.VC_STATUS_NORMAL) { + tl = vcservice.getIcon(vcstate); + } } Icon bl = null; // file_state Modified: plugins/ProjectViewer/trunk/projectviewer/vpt/VPTCellRenderer.java =================================================================== --- plugins/ProjectViewer/trunk/projectviewer/vpt/VPTCellRenderer.java 2009-05-09 15:20:33 UTC (rev 15231) +++ plugins/ProjectViewer/trunk/projectviewer/vpt/VPTCellRenderer.java 2009-05-09 21:56:15 UTC (rev 15232) @@ -113,8 +113,8 @@ boolean underlined; Icon icon = node.getIcon(expanded); - if (node.isFile() && ic != null) { - icon = ic.composeIcon((VPTFile) node, icon); + if (ic != null && (node.isFile() || node.isDirectory())) { + icon = ic.composeIcon(node, icon); } setIcon(icon); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |