package com.jbase.jbuilder5vcs;
import com.borland.primetime.actions.ActionGroup;
import com.borland.primetime.teamdev.vcs.VCSFileStatus;
import com.borland.primetime.teamdev.frontend.VCSIcons;
import javax.swing.Icon;
/**
* Title: jBuilder/Perforce<br>
* Description: Implementation of the VCSFileStatus abstract class to provide status information about <br>
* revisions stored in this VCS.<br>
* This is fundamental to provide support for the VCSCommitBrowser dialog.
* <DL><DT><b>Company:</b></DT><DD>jBase.</DD></DL>
* @author <a href="mailto:nicolasj@jbase.com">Nicolas Jorand</a>
* @version 1.0
* @since JDK 1.3
*/
public class RevisionStatus extends VCSFileStatus
{
public static final String COMMENT_MANDATORY = "Comment is mandatory";
public static final int STATUS_NEW = 0;
public static final int STATUS_ON_WORKSPACE = 1;
public static final int STATUS_ON_DEPOT = 2;
public static final int STATUS_REMOVED = 3; // Not yet implement
private class FileDesc {
public Icon icon;
public String desc;
public FileDesc( Icon icon, String desc ) {
this.icon = icon; this.desc = desc;
}
}
private FileDesc[] descs = {
new FileDesc(VCSIcons.FILE_NEW, "New ! for add on Depot" ),
new FileDesc(VCSIcons.WORKSPACE_CHANGE, "File on Workspace, submit to P4"),
new FileDesc(VCSIcons.FILE_NEEDS_CHECKOUT,"File on the Depot"),
new FileDesc(VCSIcons.FILE_REMOVED, "Removed !")
};
public RevisionStatus( int status ) {
this.status = status;
}
public ActionGroup getActions() {
// We don't need no stinkin' actions...
return null;
}
/**
* Returns the icon that will be displayed in the VCSCommitBrowser
*/
public Icon getStatusIcon() {
return descs[status].icon;
}
/**
* called by VCSCommitBrowser to determine if the file has repository changes
*/
public boolean isModifiedInVCS() {
return status == STATUS_ON_DEPOT;
}
public String getDescription() {
return descs[status].desc;
}
public boolean isModifiedLocally() {
return status == STATUS_ON_WORKSPACE;
}
public boolean isNew() {
return status == STATUS_NEW;
}
}