本文整理汇总了Java中com.intellij.openapi.vcs.AbstractVcs.getRollbackEnvironment方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractVcs.getRollbackEnvironment方法的具体用法?Java AbstractVcs.getRollbackEnvironment怎么用?Java AbstractVcs.getRollbackEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.AbstractVcs
的用法示例。
在下文中一共展示了AbstractVcs.getRollbackEnvironment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processFiles
import com.intellij.openapi.vcs.AbstractVcs; //导入方法依赖的package包/类
protected List<VcsException> processFiles(final AbstractVcs vcs, final List<FilePath> files) {
RollbackEnvironment environment = vcs.getRollbackEnvironment();
if (environment == null) return Collections.emptyList();
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.setText(vcs.getDisplayName() + ": performing rollback...");
}
final List<VcsException> result = new ArrayList<VcsException>(0);
try {
environment.rollbackMissingFileDeletion(files, result, new RollbackProgressModifier(files.size(), indicator));
}
catch (ProcessCanceledException e) {
// for files refresh
}
LocalFileSystem.getInstance().refreshIoFiles(ChangesUtil.filePathsToFiles(files));
return result;
}
示例2: getRollbackOperationName
import com.intellij.openapi.vcs.AbstractVcs; //导入方法依赖的package包/类
/**
* Finds the most appropriate name for the "Rollback" operation for the given VCSs.
* That is: iterates through the all {@link RollbackEnvironment#getRollbackOperationName() RollbackEnvironments} and picks
* the operation name if it is equal to all given VCSs.
* Otherwise picks the {@link DefaultRollbackEnvironment#ROLLBACK_OPERATION_NAME default name}.
* @param vcses affected VCSs.
* @return name for the "rollback" operation to be used in the UI.
*/
@NotNull
public static String getRollbackOperationName(@NotNull Collection<AbstractVcs> vcses) {
String operationName = null;
for (AbstractVcs vcs : vcses) {
final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
if (rollbackEnvironment != null) {
if (operationName == null) {
operationName = rollbackEnvironment.getRollbackOperationName();
}
else if (!operationName.equals(rollbackEnvironment.getRollbackOperationName())) {
// if there are different names, use default
return DefaultRollbackEnvironment.ROLLBACK_OPERATION_NAME;
}
}
}
return operationName != null ? operationName : DefaultRollbackEnvironment.ROLLBACK_OPERATION_NAME;
}