package bluej.groupwork.ui;
import bluej.Config;
import bluej.groupwork.TeamStatusInfo;
import bluej.groupwork.TeamStatusInfo.Status;
import bluej.pkgmgr.BlueJPackageFile;
import bluej.pkgmgr.Project;
import threadchecker.OnThread;
import threadchecker.Tag;
| Class to determine team resource descriptions for use in dialogs
|
| @author Bruce Quig
|
@OnThread(Tag.FXPlatform)
public class ResourceDescriptor
{
| Builds and returns a team resource description for a file.
|
| @param project The project that includes the file.
| @param info Team status information for the file.
| @param annotate Should annotation be added to the description.
| @return A description for the file's team status.
|
public static String getResource(Project project, TeamStatusInfo info, boolean annotate)
{
boolean isPkgFile = BlueJPackageFile.isPackageFileName(info.getFile().getName());
String status = getStatusName(project, info, isPkgFile);
if (annotate) {
Status infoStatus = info.getStatus();
switch (infoStatus) {
case DELETED:
status += " (" + Config.getString("team.status.delete") + ")";
break;
case NEEDS_ADD:
status += " (" + Config.getString("team.status.add") + ")";
break;
case NEEDS_CHECKOUT:
status += " (" + Config.getString("team.status.new") + ")";
break;
case REMOVED:
case CONFLICT_LMRD:
status += " (" + Config.getString("team.status.removed") + ")";
break;
case NEEDS_MERGE:
if (!isPkgFile) {
status += " (" + Config.getString("team.status.needsmerge") + ")";
}
break;
default:
break;
}
if (info.getRemoteStatus() == Status.NEEDS_CHECKOUT
|| info.getRemoteStatus() == Status.DELETED) {
if (!isPkgFile) {
status += "(" + Config.getString("team.status.needsupdate") + ")";
}
}
}
return status;
}
| Builds and returns a team resource description for a file's update status.
|
| @param project The project that includes the file.
| @param updateStatus Update status information for the file.
| @param annotate Should annotation be added to the description.
| @return A description for the file's team status.
|
public static String getResource(Project project, UpdateStatus updateStatus, boolean annotate)
{
if (updateStatus.infoStatus != null)
{
return getResource(project, updateStatus.infoStatus, annotate);
}
else
{
return updateStatus.stringStatus;
}
}
| Builds and returns a resource description for a file in a distributed version control system.
|
| @param project The project that includes the file.
| @param info Team status information for the file.
| @param annotate Should annotation be added to the description.
| @param remote Which description is needed, the remote one (<code>true</code>) or the
| local one (<code>false</code>).
| @return A description for the file's team status.
|
public static String getDCVSResource(Project project, TeamStatusInfo info, boolean annotate, boolean remote)
{
boolean isPkgFile = BlueJPackageFile.isPackageFileName(info.getFile().getName());
String status = getStatusName(project, info, isPkgFile);
if (annotate) {
Status infoStatus = info.getStatus(!remote);
switch (infoStatus) {
case DELETED:
case NEEDS_ADD:
case NEEDS_CHECKOUT:
case REMOVED:
case CONFLICT_LMRD:
case NEEDS_UPDATE:
case NEEDS_COMMIT:
status += " - " + infoStatus.getDCVSStatusString(remote);
break;
case NEEDS_MERGE:
if (!isPkgFile) {
status += " - " + infoStatus.getDCVSStatusString(remote);
}
break;
default:
break;
}
}
return status;
}
| Builds and returns a resource description for a file in a distributed version control system.
|
| @param project The project that includes the file.
| @param updateStatus Update status information for the file.
| @param annotate Should annotation be added to the description.
| @param remote Which description is needed, the remote one (<code>true</code>) or the local one (<code>false</code>).
| @return A description for the file's team status.
|
public static String getDCVSResource(Project project, UpdateStatus updateStatus, boolean annotate, boolean remote)
{
if (updateStatus.infoStatus != null)
{
return getDCVSResource(project, updateStatus.infoStatus, annotate, remote);
}
else
{
return updateStatus.stringStatus;
}
}
| Get the display form of class/file name from a team status.
|
| @param project The project which the file belongs to
| @param info The team status info for the file
| @param isPkgFile Whether the file is a package file (project.bluej)
|
private static String getStatusName(Project project, TeamStatusInfo info, boolean isPkgFile)
{
String status;
String packageName = project.getPackageForFile(info.getFile());
packageName = packageName == null ? "" : packageName;
if (! packageName.isEmpty())
{
packageName = "[" + packageName + "] ";
}
if (isPkgFile)
{
status = packageName + Config.getString("team.commit.layout");
}
else
{
status = packageName + info.getFile().getName();
}
return status;
}
}
top,
use,
map,
class ResourceDescriptor
. getResource
. getResource
. getDCVSResource
. getDCVSResource
. getStatusName
191 neLoCode
+ 29 LoComm