本文整理汇总了Java中com.intellij.openapi.vcs.VcsKey类的典型用法代码示例。如果您正苦于以下问题:Java VcsKey类的具体用法?Java VcsKey怎么用?Java VcsKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VcsKey类属于com.intellij.openapi.vcs包,在下文中一共展示了VcsKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAction
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
@NotNull
@Override
protected AnAction createAction(CheckoutProvider provider) {
return new CheckoutAction(provider) {
@Override
protected CheckoutProvider.Listener getListener(Project project) {
return new CheckoutProvider.Listener() {
@Override
public void directoryCheckedOut(File directory, VcsKey vcs) {
final VirtualFile dir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(directory);
if (dir != null) {
PlatformProjectOpenProcessor.getInstance().doOpenProject(dir, null, false);
}
}
@Override
public void checkoutCompleted() {
}
};
}
};
}
示例2: getProjectUsages
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
@NotNull
@Override
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) throws CollectUsagesException {
VcsLogManager logManager = VcsLogContentProvider.findLogManager(project);
VisiblePack dataPack = getDataPack(logManager);
if (dataPack != null) {
PermanentGraph<Integer> permanentGraph = dataPack.getPermanentGraph();
MultiMap<VcsKey, VirtualFile> groupedRoots = groupRootsByVcs(dataPack.getLogProviders());
Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
usages.add(new UsageDescriptor("vcs.log.commit.count", permanentGraph.getAllCommits().size()));
for (VcsKey vcs : groupedRoots.keySet()) {
//noinspection StringToUpperCaseOrToLowerCaseWithoutLocale
usages.add(new UsageDescriptor("vcs.log." + vcs.getName().toLowerCase() + ".root.count", groupedRoots.get(vcs).size()));
}
return usages;
}
return Collections.emptySet();
}
示例3: createMockRepositoryCreator
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
@NotNull
private VcsRepositoryCreator createMockRepositoryCreator() {
return new VcsRepositoryCreator() {
@NotNull
@Override
public VcsKey getVcsKey() {
return myVcs.getKeyInstanceMethod();
}
@Nullable
@Override
public Repository createRepositoryIfValid(@NotNull VirtualFile root) {
READY_TO_READ.countDown();
try {
//wait until reading thread gets existing info
if (!CONTINUE_MODIFY.await(1, TimeUnit.SECONDS)) return null;
}
catch (InterruptedException e) {
return null;
}
return new MockRepositoryImpl(myProject, root, myProject);
}
};
}
示例4: isRecent
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
@Override
@Nullable
public ThreeState isRecent(final VirtualFile vf,
final VcsKey vcsKey,
final VcsRevisionNumber number,
final TextRange range,
final long boundTime) {
TreeMap<Integer, Long> treeMap;
synchronized (myLock) {
treeMap = myCache.get(new HistoryCacheWithRevisionKey(VcsContextFactory.SERVICE.getInstance().createFilePathOn(vf), vcsKey, number));
}
if (treeMap != null) {
Map.Entry<Integer, Long> last = treeMap.floorEntry(range.getEndOffset());
if (last == null || last.getKey() < range.getStartOffset()) return ThreeState.NO;
Map.Entry<Integer, Long> first = treeMap.ceilingEntry(range.getStartOffset());
assert first != null;
final SortedMap<Integer,Long> interval = treeMap.subMap(first.getKey(), last.getKey());
for (Map.Entry<Integer, Long> entry : interval.entrySet()) {
if (entry.getValue() >= boundTime) return ThreeState.YES;
}
return ThreeState.NO;
}
return ThreeState.UNSURE;
}
示例5: register
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
@Override
public void register(final VirtualFile vf, final VcsKey vcsKey, final VcsRevisionNumber number, final FileAnnotation fa) {
final HistoryCacheWithRevisionKey key = new HistoryCacheWithRevisionKey(VcsContextFactory.SERVICE.getInstance().createFilePathOn(vf), vcsKey, number);
synchronized (myLock) {
if (myCache.get(key) != null) return;
}
final long absoluteLimit = System.currentTimeMillis() - VcsContentAnnotationSettings.ourAbsoluteLimit;
final TreeMap<Integer, Long> map = new TreeMap<Integer, Long>();
final int lineCount = fa.getLineCount();
for (int i = 0; i < lineCount; i++) {
Date lineDate = fa.getLineDate(i);
if (lineDate == null) return;
if (lineDate.getTime() >= absoluteLimit) map.put(i, lineDate.getTime());
}
synchronized (myLock) {
myCache.put(key, map);
}
}
示例6: putIntoCurrentCache
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
private static VcsRevisionNumber putIntoCurrentCache(final ContentRevisionCache cache,
FilePath path,
@NotNull VcsKey vcsKey,
final CurrentRevisionProvider loader) throws VcsException, IOException {
VcsRevisionNumber loadedRevisionNumber;
Pair<VcsRevisionNumber, Long> currentRevision;
while (true) {
loadedRevisionNumber = loader.getCurrentRevision();
currentRevision = cache.getCurrent(path, vcsKey);
if (loadedRevisionNumber.equals(currentRevision.getFirst())) return loadedRevisionNumber;
if (cache.putCurrent(path, loadedRevisionNumber, vcsKey, currentRevision.getSecond())) {
return loadedRevisionNumber;
}
}
}
示例7: getOrLoadCurrentAsBytes
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
public static Pair<VcsRevisionNumber, byte[]> getOrLoadCurrentAsBytes(final Project project, FilePath path, @NotNull VcsKey vcsKey,
final CurrentRevisionProvider loader) throws VcsException, IOException {
ContentRevisionCache cache = ProjectLevelVcsManager.getInstance(project).getContentRevisionCache();
VcsRevisionNumber currentRevision;
Pair<VcsRevisionNumber, byte[]> loaded;
while (true) {
currentRevision = putIntoCurrentCache(cache, path, vcsKey, loader);
final byte[] cachedCurrent = cache.getBytes(path, currentRevision, vcsKey, UniqueType.REPOSITORY_CONTENT);
if (cachedCurrent != null) {
return Pair.create(currentRevision, cachedCurrent);
}
checkLocalFileSize(path);
loaded = loader.get();
if (loaded.getFirst().equals(currentRevision)) break;
}
cache.put(path, currentRevision, vcsKey, UniqueType.REPOSITORY_CONTENT, loaded.getSecond());
return loaded;
}
示例8: VcsAnnotationLocalChangesListenerImpl
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
public VcsAnnotationLocalChangesListenerImpl(Project project, final ProjectLevelVcsManager vcsManager) {
myLock = new Object();
myUpdateStuff = createUpdateStuff();
myUpdater = new ZipperUpdater(ApplicationManager.getApplication().isUnitTestMode() ? 10 : 300, Alarm.ThreadToUse.POOLED_THREAD, project);
myConnection = project.getMessageBus().connect();
myLocalFileSystem = LocalFileSystem.getInstance();
VcsAnnotationRefresher handler = createHandler();
myDirtyPaths = new HashSet<String>();
myDirtyChanges = new HashMap<String, VcsRevisionNumber>();
myDirtyFiles = new HashSet<VirtualFile>();
myFileAnnotationMap = MultiMap.createSet();
myVcsManager = vcsManager;
myVcsKeySet = new HashSet<VcsKey>();
myConnection.subscribe(VcsAnnotationRefresher.LOCAL_CHANGES_CHANGED, handler);
}
示例9: createUpdateStuff
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
private Runnable createUpdateStuff() {
return new Runnable() {
@Override
public void run() {
final Set<String> paths = new HashSet<String>();
final Map<String, VcsRevisionNumber> changes = new HashMap<String, VcsRevisionNumber>();
final Set<VirtualFile> files = new HashSet<VirtualFile>();
Set<VcsKey> vcsToRefresh;
synchronized (myLock) {
vcsToRefresh = new HashSet<VcsKey>(myVcsKeySet);
paths.addAll(myDirtyPaths);
changes.putAll(myDirtyChanges);
files.addAll(myDirtyFiles);
myDirtyPaths.clear();
myDirtyChanges.clear();
myVcsKeySet.clear();
myDirtyFiles.clear();
}
closeForVcs(vcsToRefresh);
checkByDirtyScope(paths, changes, files);
}
};
}
示例10: addChangeToIdx
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
private void addChangeToIdx(final Change change, final VcsKey key) {
final ContentRevision afterRevision = change.getAfterRevision();
final ContentRevision beforeRevision = change.getBeforeRevision();
if (afterRevision != null) {
add(afterRevision.getFile(), change.getFileStatus(), key, beforeRevision == null ? VcsRevisionNumber.NULL : beforeRevision.getRevisionNumber());
}
if (beforeRevision != null) {
if (afterRevision != null) {
if (! Comparing.equal(beforeRevision.getFile(), afterRevision.getFile())) {
add(beforeRevision.getFile(), FileStatus.DELETED, key, beforeRevision.getRevisionNumber());
}
} else {
add(beforeRevision.getFile(), change.getFileStatus(), key, beforeRevision.getRevisionNumber());
}
}
}
示例11: createUpdateSessionAdapter
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
private UpdateSessionAdapter createUpdateSessionAdapter(final UpdatedFiles updatedFiles, final CvsResult result) {
return new UpdateSessionAdapter(result.getErrorsAndWarnings(), result.isCanceled()) {
public void onRefreshFilesCompleted() {
final FileGroup mergedWithConflictsGroup = updatedFiles.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID);
final FileGroup binaryMergedGroup = updatedFiles.getGroupById(CvsUpdatePolicy.BINARY_MERGED_ID);
if (!mergedWithConflictsGroup.isEmpty() || !binaryMergedGroup.isEmpty()) {
Collection<String> paths = new ArrayList<String>();
paths.addAll(mergedWithConflictsGroup.getFiles());
paths.addAll(binaryMergedGroup.getFiles());
final List<VirtualFile> list = invokeManualMerging(paths, myProject);
FileGroup mergedGroup = updatedFiles.getGroupById(FileGroup.MERGED_ID);
final VcsKey vcsKey = CvsVcs2.getKey();
for(VirtualFile mergedFile: list) {
String path = FileUtil.toSystemDependentName(mergedFile.getPresentableUrl());
mergedWithConflictsGroup.remove(path);
binaryMergedGroup.remove(path);
mergedGroup.add(path, vcsKey, null);
}
}
}
};
}
示例12: execute
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
public void execute(final UpdatedFiles updatedFiles) {
if (myConflictedVirtualFiles.isEmpty()) {
return;
}
final AbstractVcsHelper vcsHelper = AbstractVcsHelper.getInstance(myProject);
List<VirtualFile> mergedFiles = vcsHelper.showMergeDialog(myConflictedVirtualFiles, new SvnMergeProvider(myProject));
final FileGroup mergedGroup = updatedFiles.getGroupById(FileGroup.MERGED_ID);
final FileGroup conflictedGroup = updatedFiles.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID);
final VcsKey vcsKey = SvnVcs.getKey();
for (final VirtualFile mergedFile : mergedFiles) {
String path = FileUtil.toSystemDependentName(mergedFile.getPresentableUrl());
conflictedGroup.remove(path);
mergedGroup.add(path, vcsKey, null);
mergedFile.refresh(false, false);
// for additionally created files removal to be detected
mergedFile.getParent().refresh(false, false);
if (myChangesUnderProjectRoot) {
myDirtyScopeManager.fileDirty(mergedFile);
}
}
}
示例13: testUpdateDirectories_FilesStale
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
@Test
public void testUpdateDirectories_FilesStale() {
SyncResults syncResults = new SyncResults(false, ImmutableList.of("/path/to/file1", "/path/to/directory"), ImmutableList.of("/path/to/newFile"),
ImmutableList.of("/path/to/file2"), ImmutableList.of(new SyncException("test exception")));
FilePath[] filePaths = setupUpdate(syncResults);
UpdateSession session = updateEnvironment.updateDirectories(filePaths, mockUpdatedFiles, mockProgressIndicator, mockUpdatesContext);
verify(mockFileGroupRemove).add(eq("/path/to/file2"), any(VcsKey.class), isNull(VcsRevisionNumber.class));
verify(mockFileGroupCreate).add(eq("/path/to/newFile"), any(VcsKey.class), isNull(VcsRevisionNumber.class));
verify(mockFileGroupUpdate).add(eq("/path/to/file1"), any(VcsKey.class), isNull(VcsRevisionNumber.class));
verify(mockFileGroupUpdate).add(eq("/path/to/directory"), any(VcsKey.class), isNull(VcsRevisionNumber.class));
verifyNoMoreInteractions(mockFileGroupRemove, mockFileGroupCreate, mockFileGroupUpdate, mockConflictsHandler);
verifyNoMoreInteractions(mockConflictsHandler);
assertEquals(1, session.getExceptions().size());
verifyStatic(times(1));
TfsFileUtil.refreshAndInvalidate(mockProject, filePaths, false);
}
示例14: getOrLoadCurrentAsBytes
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
public static Pair<VcsRevisionNumber, byte[]> getOrLoadCurrentAsBytes(final Project project, FilePath path, @NotNull VcsKey vcsKey,
final CurrentRevisionProvider loader) throws VcsException, IOException {
ContentRevisionCache cache = ProjectLevelVcsManager.getInstance(project).getContentRevisionCache();
VcsRevisionNumber currentRevision;
Pair<VcsRevisionNumber, byte[]> loaded;
while (true) {
currentRevision = putIntoCurrentCache(cache, path, vcsKey, loader);
final byte[] cachedCurrent = cache.getBytes(path, currentRevision, vcsKey, UniqueType.REPOSITORY_CONTENT);
if (cachedCurrent != null) {
return new Pair<VcsRevisionNumber, byte[]>(currentRevision, cachedCurrent);
}
checkLocalFileSize(path);
loaded = loader.get();
if (loaded.getFirst().equals(currentRevision)) break;
}
cache.put(path, currentRevision, vcsKey, UniqueType.REPOSITORY_CONTENT, loaded.getSecond());
return loaded;
}
示例15: getProjectUsages
import com.intellij.openapi.vcs.VcsKey; //导入依赖的package包/类
@Nonnull
@Override
public Set<UsageDescriptor> getProjectUsages(@Nonnull Project project) throws CollectUsagesException {
VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
VcsLogData logData = projectLog.getDataManager();
if (logData != null) {
DataPack dataPack = logData.getDataPack();
if (dataPack.isFull()) {
PermanentGraph<Integer> permanentGraph = dataPack.getPermanentGraph();
MultiMap<VcsKey, VirtualFile> groupedRoots = groupRootsByVcs(dataPack.getLogProviders());
Set<UsageDescriptor> usages = ContainerUtil.newHashSet();
usages.add(StatisticsUtilKt.getCountingUsage("data.commit.count", permanentGraph.getAllCommits().size(),
asList(0, 1, 100, 1000, 10 * 1000, 100 * 1000, 500 * 1000)));
for (VcsKey vcs : groupedRoots.keySet()) {
usages.add(StatisticsUtilKt.getCountingUsage("data." + vcs.getName().toLowerCase() + ".root.count", groupedRoots.get(vcs).size(),
asList(0, 1, 2, 5, 8, 15, 30, 50, 100, 500, 1000)));
}
return usages;
}
}
return Collections.emptySet();
}