package bluej.groupwork.actions;
import bluej.Config;
import threadchecker.OnThread;
import threadchecker.Tag;
| A class to group team actions for a project, and manage enable/disable
| of the actions.
|
| @author Davin McCall
|
@OnThread(Tag.FXPlatform)
public class TeamActionGroup
{
private final String commitLabel;
private final boolean initialTeamMode;
private final boolean initialIsDVCS;
private StatusAction statusAction;
private UpdateDialogAction updateAction;
private TeamSettingsAction teamSettingsAction;
private CommitCommentAction commitCommentAction;
private ShareAction shareAction;
private ShowLogAction showLogAction;
| Construct a new team action group, with various actions disabled
| or enabled depending whether we are in team mode or non-team mode.
|
| @param teamMode should teamMode be enabled
|
public TeamActionGroup(boolean teamMode)
{
this(teamMode, false);
}
| Construct a new team action group, with various actions disabled
| or enabled depending whether we are in team mode or non-team mode.
|
| @param teamMode should teamMode be enabled
| @param isDVCS is this a distributed version control? (e.g. git).
|
public TeamActionGroup(boolean teamMode, boolean isDVCS)
{
String label = "team.commit";
if (isDVCS){
label = "team.commitPush";
}
this.commitLabel = label;
this.initialTeamMode = teamMode;
this.initialIsDVCS = isDVCS;
}
private void createAll()
{
if (statusAction == null)
{
statusAction = new StatusAction();
updateAction = new UpdateDialogAction();
teamSettingsAction = new TeamSettingsAction();
commitCommentAction = new CommitCommentAction(commitLabel);
shareAction = new ShareAction();
showLogAction = new ShowLogAction();
setTeamMode(initialTeamMode, initialIsDVCS);
}
}
public StatusAction getStatusAction()
{
createAll();
return statusAction;
}
public UpdateDialogAction getUpdateAction()
{
createAll();
return updateAction;
}
public TeamSettingsAction getTeamSettingsAction()
{
createAll();
return teamSettingsAction;
}
public CommitCommentAction getCommitCommentAction()
{
createAll();
return commitCommentAction;
}
public ShareAction getShareAction()
{
createAll();
return shareAction;
}
public ShowLogAction getShowLogAction()
{
createAll();
return showLogAction;
}
public void setTeamMode(boolean enabled, boolean isDCVS)
{
createAll();
statusAction.setEnabled(enabled);
updateAction.setEnabled(enabled);
teamSettingsAction.setEnabled(enabled);
showLogAction.setEnabled(enabled);
String label = "team.commit";
if (isDCVS){
label = "team.commitPush";
}
commitCommentAction.setName(Config.getString(label), true);
commitCommentAction.setEnabled(enabled);
shareAction.setEnabled(!enabled);
}
public void setAllDisabled()
{
createAll();
statusAction.setEnabled(false);
updateAction.setEnabled(false);
teamSettingsAction.setEnabled(false);
commitCommentAction.setEnabled(false);
shareAction.setEnabled(false);
showLogAction.setEnabled(false);
}
}
top,
use,
map,
class TeamActionGroup
. TeamActionGroup
. TeamActionGroup
. createAll
. getStatusAction
. getUpdateAction
. getTeamSettingsAction
. getCommitCommentAction
. getShareAction
. getShowLogAction
. setTeamMode
. setAllDisabled
164 neLoCode
+ 10 LoComm