本文整理汇总了Java中com.intellij.openapi.vcs.changes.ChangeListManager.getAffectedFiles方法的典型用法代码示例。如果您正苦于以下问题:Java ChangeListManager.getAffectedFiles方法的具体用法?Java ChangeListManager.getAffectedFiles怎么用?Java ChangeListManager.getAffectedFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.changes.ChangeListManager
的用法示例。
在下文中一共展示了ChangeListManager.getAffectedFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAffectedFiles
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
@NotNull
private static List<VirtualFile> getAffectedFiles(String changeListName, Project project) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListName == null) {
return changeListManager.getAffectedFiles();
}
final LocalChangeList changeList = changeListManager.findChangeList(changeListName);
if (changeList != null) {
List<VirtualFile> files = new ArrayList<VirtualFile>();
for (Change change : changeList.getChanges()) {
final ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision != null) {
final VirtualFile file = afterRevision.getFile().getVirtualFile();
if (file != null) {
files.add(file);
}
}
}
return files;
}
return Collections.emptyList();
}
示例2: getScope
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
@NotNull
public AnalysisScope getScope(@NotNull AnalysisUIOptions uiOptions, @NotNull AnalysisScope defaultScope, @NotNull Project project, Module module) {
AnalysisScope scope;
if (isProjectScopeSelected()) {
scope = new AnalysisScope(project);
uiOptions.SCOPE_TYPE = AnalysisScope.PROJECT;
}
else {
final SearchScope customScope = getCustomScope();
if (customScope != null) {
scope = new AnalysisScope(customScope, project);
uiOptions.SCOPE_TYPE = AnalysisScope.CUSTOM;
uiOptions.CUSTOM_SCOPE_NAME = customScope.getDisplayName();
}
else if (isModuleScopeSelected()) {
scope = new AnalysisScope(module);
uiOptions.SCOPE_TYPE = AnalysisScope.MODULE;
}
else if (isUncommitedFilesSelected()) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
List<VirtualFile> files;
if (myChangeLists.getSelectedItem() == ALL) {
files = changeListManager.getAffectedFiles();
}
else {
files = new ArrayList<VirtualFile>();
for (ChangeList list : changeListManager.getChangeListsCopy()) {
if (!Comparing.strEqual(list.getName(), (String)myChangeLists.getSelectedItem())) continue;
final Collection<Change> changes = list.getChanges();
for (Change change : changes) {
final ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision != null) {
final VirtualFile vFile = afterRevision.getFile().getVirtualFile();
if (vFile != null) {
files.add(vFile);
}
}
}
}
}
scope = new AnalysisScope(project, new HashSet<VirtualFile>(files));
uiOptions.SCOPE_TYPE = AnalysisScope.UNCOMMITTED_FILES;
}
else {
scope = defaultScope;
uiOptions.SCOPE_TYPE = defaultScope.getScopeType();//just not project scope
}
}
uiOptions.ANALYZE_TEST_SOURCES = isInspectTestSources();
scope.setIncludeTestSource(isInspectTestSources());
scope.setScope(getCustomScope());
FindSettings.getInstance().setDefaultScopeName(scope.getDisplayName());
return scope;
}