本文整理汇总了Java中com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl类的典型用法代码示例。如果您正苦于以下问题:Java ProjectLevelVcsManagerImpl类的具体用法?Java ProjectLevelVcsManagerImpl怎么用?Java ProjectLevelVcsManagerImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectLevelVcsManagerImpl类属于com.intellij.openapi.vcs.impl包,在下文中一共展示了ProjectLevelVcsManagerImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractBranchName
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
public static String extractBranchName(Project project) {
String branch = "";
ProjectLevelVcsManager instance = ProjectLevelVcsManagerImpl.getInstance(project);
if (instance.checkVcsIsActive("Git")) {
GitLocalBranch currentBranch = GitBranchUtil.getCurrentRepository(project).getCurrentBranch();
if (currentBranch != null) {
// Branch name matches Ticket Name
branch = currentBranch.getName().trim();
}
} else if (instance.checkVcsIsActive("Mercurial")) {
branch = HgUtil.getCurrentRepository(project).getCurrentBranch().trim();
}
return branch;
}
示例2: isEnabled
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
protected boolean isEnabled(VcsContext context) {
VirtualFile[] selectedFiles = context.getSelectedFiles();
if (selectedFiles == null) return false;
if (selectedFiles.length == 0) return false;
VirtualFile file = selectedFiles[0];
Project project = context.getProject();
if (project == null) return false;
final ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(project);
final BackgroundableActionEnabledHandler handler =
vcsManager.getBackgroundableActionHandler(VcsBackgroundableActions.HISTORY_FOR_SELECTION);
if (handler.isInProgress(VcsBackgroundableActions.keyFrom(file))) return false;
AbstractVcs vcs = vcsManager.getVcsFor(file);
if (vcs == null) return false;
VcsHistoryProvider vcsHistoryProvider = vcs.getVcsBlockHistoryProvider();
if (vcsHistoryProvider == null) return false;
if (! AbstractVcs.fileInVcsByFileStatus(project, VcsUtil.getFilePath(file))) return false;
VcsSelection selection = VcsSelectionUtil.getSelection(context);
if (selection == null) {
return false;
}
return true;
}
示例3: isEnabled
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
public boolean isEnabled(@NotNull AnActionEvent e) {
if (e.getProject() == null) return false;
VcsFileRevision fileRevision = getFileRevision(e);
if (fileRevision == null) return false;
VirtualFile file = getFile(e);
if (file == null) return false;
AbstractVcs vcs = getVcs(e);
if (vcs == null) return false;
AnnotationProvider provider = vcs.getCachingAnnotationProvider();
if (provider == null || !provider.isAnnotationValid(fileRevision)) return false;
final ProjectLevelVcsManagerImpl plVcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(vcs.getProject());
if (plVcsManager.getBackgroundableActionHandler(VcsBackgroundableActions.ANNOTATE).isInProgress(key(file))) return false;
return true;
}
示例4: isEnabled
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
private static boolean isEnabled(final VcsContext context) {
VirtualFile[] selectedFiles = context.getSelectedFiles();
if (selectedFiles.length != 1) {
return false;
}
VirtualFile file = selectedFiles[0];
if (file.isDirectory()) return false;
Project project = context.getProject();
if (project == null || project.isDisposed()) return false;
final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
final BackgroundableActionEnabledHandler handler = ((ProjectLevelVcsManagerImpl)plVcsManager)
.getBackgroundableActionHandler(VcsBackgroundableActions.ANNOTATE);
if (handler.isInProgress(file.getPath())) return false;
final AbstractVcs vcs = plVcsManager.getVcsFor(file);
if (vcs == null) return false;
final AnnotationProvider annotationProvider = vcs.getAnnotationProvider();
if (annotationProvider == null) return false;
final FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
if (fileStatus == FileStatus.UNKNOWN || fileStatus == FileStatus.ADDED || fileStatus == FileStatus.IGNORED) {
return false;
}
return hasTextEditor(file);
}
示例5: initRepository
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
@NotNull
@Override
protected Repository initRepository(@NotNull String name) {
String tempDirectory = FileUtil.getTempDirectory();
String root = tempDirectory + "/" + name;
assertTrue(new File(root).mkdirs());
HgPlatformTest.initRepo(root);
touch("a.txt");
hg("add a.txt");
hg("commit -m another");
hg("up -r 0");
ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(myProject);
vcsManager.setDirectoryMapping(root, HgVcs.VCS_NAME);
VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(root));
HgRepository repository = HgUtil.getRepositoryManager(myProject).getRepositoryForRoot(file);
assertNotNull("Couldn't find repository for root " + root, repository);
return repository;
}
示例6: SvnBranchConfigurationManager
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
public SvnBranchConfigurationManager(final Project project,
final ProjectLevelVcsManager vcsManager,
final SvnLoadedBranchesStorage storage) {
myProject = project;
myVcsManager = vcsManager;
myStorage = storage;
myBranchesLoader = new ProgressManagerQueue(myProject, "Subversion Branches Preloader");
// TODO: Seems that ProgressManagerQueue is not suitable here at least for some branches loading tasks. For instance,
// TODO: for DefaultConfigLoader it would be better to run modal cancellable task - so branches structure could be detected and
// TODO: shown in dialog. Currently when "Configure Branches" is invoked for the first time - no branches are shown.
// TODO: If "Cancel" is pressed and "Configure Branches" invoked once again - already detected (in background) branches are shown.
((ProjectLevelVcsManagerImpl) vcsManager).addInitializationRequest(VcsInitObject.BRANCHES, new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
myBranchesLoader.start();
}
});
}
});
myBunch = new NewRootBunch(project, myBranchesLoader);
}
示例7: preloadBranches
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
private void preloadBranches(@NotNull final Collection<Pair<VirtualFile, SvnBranchConfigurationNew>> branchPoints) {
((ProjectLevelVcsManagerImpl) myVcsManager).addInitializationRequest(VcsInitObject.BRANCHES, new Runnable() {
public void run() {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
public void run() {
try {
for (Pair<VirtualFile, SvnBranchConfigurationNew> pair : branchPoints) {
myBunch.reloadBranches(pair.getFirst(), null, pair.getSecond());
}
}
catch (ProcessCanceledException e) {
//
}
}
});
}
});
}
示例8: isEnabled
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
protected boolean isEnabled(VcsContext context) {
VirtualFile[] selectedFiles = context.getSelectedFiles();
if (selectedFiles == null) return false;
if (selectedFiles.length == 0) return false;
VirtualFile file = selectedFiles[0];
Project project = context.getProject();
if (project == null) return false;
final ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(project);
final BackgroundableActionEnabledHandler handler =
vcsManager.getBackgroundableActionHandler(VcsBackgroundableActions.HISTORY_FOR_SELECTION);
if (handler.isInProgress(VcsBackgroundableActions.keyFrom(file))) return false;
AbstractVcs vcs = vcsManager.getVcsFor(file);
if (vcs == null) return false;
VcsHistoryProvider vcsHistoryProvider = vcs.getVcsBlockHistoryProvider();
if (vcsHistoryProvider == null) return false;
if (! AbstractVcs.fileInVcsByFileStatus(project, new FilePathImpl(file))) return false;
VcsSelection selection = VcsSelectionUtil.getSelection(context);
if (selection == null) {
return false;
}
return true;
}
示例9: isEnabled
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
private static boolean isEnabled(final VcsContext context) {
VirtualFile[] selectedFiles = context.getSelectedFiles();
if (selectedFiles == null) return false;
if (selectedFiles.length != 1) return false;
VirtualFile file = selectedFiles[0];
if (file.isDirectory()) return false;
Project project = context.getProject();
if (project == null || project.isDisposed()) return false;
final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
final BackgroundableActionEnabledHandler handler = ((ProjectLevelVcsManagerImpl)plVcsManager)
.getBackgroundableActionHandler(VcsBackgroundableActions.ANNOTATE);
if (handler.isInProgress(file.getPath())) return false;
final AbstractVcs vcs = plVcsManager.getVcsFor(file);
if (vcs == null) return false;
final AnnotationProvider annotationProvider = vcs.getAnnotationProvider();
if (annotationProvider == null) return false;
final FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
if (fileStatus == FileStatus.UNKNOWN || fileStatus == FileStatus.ADDED || fileStatus == FileStatus.IGNORED) {
return false;
}
return hasTextEditor(file);
}
示例10: update
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
public void update(AnActionEvent e) {
VirtualFile revVFile = e.getData( VcsDataKeys.VCS_VIRTUAL_FILE );
VcsFileRevision revision = e.getData( VcsDataKeys.VCS_FILE_REVISION );
final Boolean nonLocal = e.getData(VcsDataKeys.VCS_NON_LOCAL_HISTORY_SESSION);
FileType fileType = revVFile == null ? null : revVFile.getFileType();
boolean enabled = revision != null && revVFile != null && !fileType.isBinary() && ! Boolean.TRUE.equals(nonLocal);
if (enabled) {
final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(myVcs.getProject());
enabled = (! (((ProjectLevelVcsManagerImpl) plVcsManager).getBackgroundableActionHandler(
VcsBackgroundableActions.ANNOTATE).isInProgress(key(revVFile))));
}
e.getPresentation()
.setEnabled(enabled &&
myHistorySession.isContentAvailable(revision) &&
myAnnotationProvider != null && myAnnotationProvider.isAnnotationValid(revision));
}
示例11: setUp
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
myBranchVcsRoot = new File(myTempDirFixture.getTempDirPath(), "branch");
myBranchVcsRoot.mkdir();
myProjectLevelVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
myProjectLevelVcsManager.setDirectoryMapping(myBranchVcsRoot.getAbsolutePath(), SvnVcs.VCS_NAME);
myWCInfo = new WCInfo(myBranchVcsRoot.getAbsolutePath(), SVNURL.parseURIEncoded(myRepoUrl + "/branch"), WorkingCopyFormat.ONE_DOT_SIX,
myRepoUrl, true, null, SVNDepth.INFINITY);
myOneShotMergeInfoHelper = new OneShotMergeInfoHelper(myProject, myWCInfo, myRepoUrl + "/trunk");
SvnConfiguration.getInstance(myProject).CHECK_NESTED_FOR_QUICK_MERGE = true;
// AbstractVcs vcsFound = myProjectLevelVcsManager.findVcsByName(SvnVcs.VCS_NAME);
// Assert.assertEquals(1, myProjectLevelVcsManager.getRootsUnderVcs(vcsFound).length);
}
示例12: isEnabled
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
protected boolean isEnabled(VcsContext context) {
Project project = context.getProject();
if (project == null) return false;
VcsSelection selection = VcsSelectionUtil.getSelection(context);
if (selection == null) return false;
VirtualFile file = FileDocumentManager.getInstance().getFile(selection.getDocument());
if (file == null) return false;
final ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(project);
final BackgroundableActionEnabledHandler handler = vcsManager.getBackgroundableActionHandler(VcsBackgroundableActions.HISTORY_FOR_SELECTION);
if (handler.isInProgress(VcsBackgroundableActions.keyFrom(file))) return false;
AbstractVcs activeVcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
if (activeVcs == null) return false;
VcsHistoryProvider provider = activeVcs.getVcsBlockHistoryProvider();
if (provider == null) return false;
if (!AbstractVcs.fileInVcsByFileStatus(project, VcsUtil.getFilePath(file))) return false;
return true;
}
示例13: isEnabled
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
@Nullable
protected static AbstractVcs isEnabled(final VcsContext vcsContext, @Nullable final VcsBackgroundableActions actionKey) {
if (!(isVisible(vcsContext))) return null;
final Project project = vcsContext.getProject();
if (project == null) return null;
final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
final VirtualFile[] selectedFilePaths = vcsContext.getSelectedFiles();
if (selectedFilePaths.length != 1) return null;
final VirtualFile selectedFile = selectedFilePaths[0];
if (selectedFile.isDirectory()) return null;
if (actionKey != null) {
final BackgroundableActionEnabledHandler handler = ((ProjectLevelVcsManagerImpl)vcsManager).getBackgroundableActionHandler(actionKey);
if (handler.isInProgress(VcsBackgroundableActions.keyFrom(selectedFile))) return null;
}
final AbstractVcs vcs = vcsManager.getVcsFor(selectedFile);
if (vcs == null) return null;
final DiffProvider diffProvider = vcs.getDiffProvider();
if (diffProvider == null) return null;
if (AbstractVcs.fileInVcsByFileStatus(project, VcsUtil.getFilePath(selectedFile))) {
return vcs;
}
return null;
}
示例14: markRunningProgress
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
private static void markRunningProgress(@NotNull DiffViewerBase viewer, @NotNull Side side, boolean running) {
final ProjectLevelVcsManagerImpl plVcsManager = (ProjectLevelVcsManagerImpl)ProjectLevelVcsManager.getInstance(viewer.getProject());
final BackgroundableActionEnabledHandler handler = plVcsManager.getBackgroundableActionHandler(VcsBackgroundableActions.ANNOTATE);
if (running) {
handler.register(key(viewer, side));
}
else {
handler.completed(key(viewer, side));
}
}
示例15: DiffActionExecutor
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; //导入依赖的package包/类
protected DiffActionExecutor(final DiffProvider diffProvider, final VirtualFile selectedFile, final Project project,
final VcsBackgroundableActions actionKey) {
final ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(project);
myHandler = vcsManager.getBackgroundableActionHandler(actionKey);
myDiffProvider = diffProvider;
mySelectedFile = selectedFile;
myProject = project;
}