本文整理汇总了Java中com.intellij.openapi.vcs.changes.ChangeListManager.getChangeListsCopy方法的典型用法代码示例。如果您正苦于以下问题:Java ChangeListManager.getChangeListsCopy方法的具体用法?Java ChangeListManager.getChangeListsCopy怎么用?Java ChangeListManager.getChangeListsCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.changes.ChangeListManager
的用法示例。
在下文中一共展示了ChangeListManager.getChangeListsCopy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDeletePackage
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
@Test
public void testDeletePackage() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
VirtualFile dir = createDirInCommand(myWorkingCopyDir, "child");
createFileInCommand(dir, "a.txt", "content");
runAndVerifyStatusSorted("A child", "A child" + File.separatorChar + "a.txt");
checkin();
deleteFileInCommand(dir);
runAndVerifyStatusSorted("D child", "D child" + File.separatorChar + "a.txt");
refreshVfs();
final AlienDirtyScope dirtyScope = new AlienDirtyScope();
dirtyScope.addDir(VcsUtil.getFilePath(myWorkingCopyDir));
final List<Change> changesManually = getChangesInScope(dirtyScope);
Assert.assertEquals(2, changesManually.size());
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
// since ChangeListManager is runnning, it can take dirty scope itself;... it's easier to just take changes from it
final ChangeListManager clManager = ChangeListManager.getInstance(myProject);
clManager.ensureUpToDate(false);
final List<LocalChangeList> lists = clManager.getChangeListsCopy();
Assert.assertEquals(1, lists.size());
final Collection<Change> changes = lists.get(0).getChanges();
Assert.assertEquals(2, changes.size());
}
示例2: testDeletePackage
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
@Test
public void testDeletePackage() throws Exception {
enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
enableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
VirtualFile dir = createDirInCommand(myWorkingCopyDir, "child");
createFileInCommand(dir, "a.txt", "content");
runAndVerifyStatus("A child", "A child" + File.separatorChar + "a.txt");
checkin();
deleteFileInCommand(dir);
runAndVerifyStatus("D child", "D child" + File.separatorChar + "a.txt");
refreshVfs();
final AlienDirtyScope dirtyScope = new AlienDirtyScope();
dirtyScope.addDir(VcsUtil.getFilePath(myWorkingCopyDir));
final List<Change> changesManually = getChangesInScope(dirtyScope);
Assert.assertEquals(2, changesManually.size());
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
// since ChangeListManager is runnning, it can take dirty scope itself;... it's easier to just take changes from it
final ChangeListManager clManager = ChangeListManager.getInstance(myProject);
clManager.ensureUpToDate(false);
final List<LocalChangeList> lists = clManager.getChangeListsCopy();
Assert.assertEquals(1, lists.size());
final Collection<Change> changes = lists.get(0).getChanges();
Assert.assertEquals(2, changes.size());
}
示例3: actionPerformed
import com.intellij.openapi.vcs.changes.ChangeListManager; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) return;
final ShelvedChangeList[] changeLists = e.getData(ShelvedChangesViewManager.SHELVED_CHANGELIST_KEY);
List<ShelvedChange> changes = e.getData(ShelvedChangesViewManager.SHELVED_CHANGE_KEY);
List<ShelvedBinaryFile> binaryFiles = e.getData(ShelvedChangesViewManager.SHELVED_BINARY_FILE_KEY);
if (changes != null && binaryFiles != null && changes.size() == 0 && binaryFiles.size() == 0) {
changes = null;
binaryFiles = null;
}
LOG.assertTrue(changeLists != null);
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
final List<LocalChangeList> allChangeLists = changeListManager.getChangeListsCopy();
String defaultName = changeLists[0].DESCRIPTION;
LocalChangeList list = null;
if (changeLists.length == 1) {
final LocalChangeList sameNamedList = changeListManager.findChangeList(defaultName);
if (sameNamedList != null) {
list = sameNamedList;
}
else {
list = tryToMatchWithExistingChangelist(changeListManager, defaultName);
}
}
if (list == null) {
list = changeListManager.getDefaultChangeList();
}
final ChangeListChooser chooser = new ChangeListChooser(project, allChangeLists, list,
VcsBundle.message("unshelve.changelist.chooser.title"), defaultName);
if (!chooser.showAndGet()) {
return;
}
FileDocumentManager.getInstance().saveAllDocuments();
final List<ShelvedBinaryFile> finalBinaryFiles = binaryFiles;
final List<ShelvedChange> finalChanges = changes;
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Unshelve Changes", true, BackgroundFromStartOption.getInstance()) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
for (ShelvedChangeList changeList : changeLists) {
ShelveChangesManager.getInstance(project)
.unshelveChangeList(changeList, finalChanges, finalBinaryFiles, chooser.getSelectedList(), true);
}
}
});
}
示例4: 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;
}