Perforce: prompt about offline state before commit or update

This commit is contained in:
irengrig
2011-05-26 13:29:27 +04:00
parent f6800da593
commit 5f9b5b68eb
2 changed files with 21 additions and 4 deletions
@@ -129,6 +129,11 @@ public abstract class AbstractCommonCheckinAction extends AbstractVcsAction {
return;
}
/*if (! checkEnvironments(plVcsManager)) {
presentation.setEnabled(false);
return;
}*/
if (! approximatelyHasRoots(vcsContext)) {
presentation.setEnabled(false);
return;
@@ -141,6 +146,16 @@ public abstract class AbstractCommonCheckinAction extends AbstractVcsAction {
presentation.setVisible(true);
}
/*protected static boolean checkEnvironments(ProjectLevelVcsManager plVcsManager) {
final AbstractVcs[] allActiveVcss = plVcsManager.getAllActiveVcss();
for (AbstractVcs vcs : allActiveVcss) {
if (vcs.getCheckinEnvironment() != null) {
return true;
}
}
return false;
}*/
protected boolean forceSyncUpdate(final AnActionEvent e) {
return true;
}
@@ -91,10 +91,6 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
final Map<AbstractVcs, Collection<FilePath>> vcsToVirtualFiles = createVcsToFilesMap(roots, project);
if (showUpdateOptions || OptionsDialog.shiftIsPressed(context.getModifiers())) {
showOptionsDialog(vcsToVirtualFiles, project, context);
}
for (AbstractVcs vcs : vcsToVirtualFiles.keySet()) {
final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
if ((updateEnvironment != null) && (! updateEnvironment.validateOptions(vcsToVirtualFiles.get(vcs)))) {
@@ -103,6 +99,10 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
}
}
if (showUpdateOptions || OptionsDialog.shiftIsPressed(context.getModifiers())) {
showOptionsDialog(vcsToVirtualFiles, project, context);
}
if (ApplicationManager.getApplication().isDispatchThread()) {
ApplicationManager.getApplication().saveAll();
}
@@ -257,6 +257,7 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
if (supportingVcsesAreEmpty(vcsManager, myActionInfo)) {
presentation.setVisible(myAlwaysVisible);
presentation.setEnabled(false);
return;
}
if (filterRootsBeforeAction()) {
@@ -264,6 +265,7 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
if (roots.length == 0) {
presentation.setVisible(myAlwaysVisible);
presentation.setEnabled(false);
return;
}
}