当前位置: 首页>>代码示例>>Java>>正文


Java VcsContext.getProject方法代码示例

本文整理汇总了Java中com.intellij.openapi.vcs.actions.VcsContext.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java VcsContext.getProject方法的具体用法?Java VcsContext.getProject怎么用?Java VcsContext.getProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vcs.actions.VcsContext的用法示例。


在下文中一共展示了VcsContext.getProject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  try {

    final VcsContext context = CvsContextWrapper.createCachedInstance(e);
    final VirtualFile[] files = context.getSelectedFiles();
    if (files.length == 0) return;
    final Project project = context.getProject();
    final ReadonlyStatusHandler.OperationStatus operationStatus =
      ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(files);
    if (operationStatus.hasReadonlyFiles()) {
      return;
    }
    AbstractVcsHelper.getInstance(project).showMergeDialog(Arrays.asList(files), new CvsMergeProvider());
  }
  catch (Exception e1) {
    LOG.error(e1);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MergeAction.java

示例2: actionPerformed

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  try {

    final VcsContext context = CvsContextWrapper.createCachedInstance(e);
    final VirtualFile[] files = context.getSelectedFiles();
    if (files == null || files.length == 0) return;
    final ReadonlyStatusHandler.OperationStatus operationStatus =
      ReadonlyStatusHandler.getInstance(context.getProject()).ensureFilesWritable(files);
    if (operationStatus.hasReadonlyFiles()) {
      return;
    }
    final Project project = context.getProject();
    AbstractVcsHelper.getInstance(project).showMergeDialog(Arrays.asList(files), new CvsMergeProvider());
  }
  catch (Exception e1) {
    LOG.error(e1);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:MergeAction.java

示例3: isEnabled

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
private boolean isEnabled(VcsContext context) {
    VirtualFile selectedFile = getSelectedFile(context);
    if (selectedFile == null) {
        return false;
    }
    Project project = context.getProject();
    if (project == null) {
        return false;
    }
    AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(selectedFile);
    if (vcs == null) {
        return false;
    }
    VcsHistoryProvider vcsHistoryProvider = vcs.getVcsHistoryProvider();
    if (vcsHistoryProvider == null) {
        return false;
    }
    if (selectedFile.isDirectory() && !vcsHistoryProvider.supportsHistoryForDirectories()) {
        return false;
    }
    return canFileHaveHistory(project, selectedFile) && vcsHistoryProvider.canShowHistoryFor(selectedFile);
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:23,代码来源:DevMotiveAction.java

示例4: getRoots

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
public FilePath[] getRoots(VcsContext context, final ActionInfo actionInfo) {
  ArrayList<FilePath> result = new ArrayList<FilePath>();
  Project project = context.getProject();
  final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
  final AbstractVcs[] vcses = vcsManager.getAllActiveVcss();
  for(AbstractVcs vcs: vcses) {
    if (actionInfo.getEnvironment(vcs) != null) {
      final VirtualFile[] files = vcsManager.getRootsUnderVcs(vcs);
      for(VirtualFile file: files) {
        result.add(VcsUtil.getFilePath(file));
      }
    }
  }
  return result.toArray(new FilePath[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ScopeInfo.java

示例5: actionPerformed

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Override
protected void actionPerformed(@NotNull VcsContext e) {
  if (e.getProject() == null) return;
  final ToolWindowManager manager = ToolWindowManager.getInstance(e.getProject());
  if (manager != null) {
    final ToolWindow window = manager.getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
    if (window != null) {
      window.show(null);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ShowChangesViewAction.java

示例6: startAction

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
private void startAction(VcsContext context) {
  if (!myStartLvcsAction) return;

  Project project = context.getProject();
  if (project == null || getTitle(context) == null) return;

  String name = CvsBundle.getCvsDisplayName() + ": " + getTitle(context);
  myLocalHistoryAction = LocalHistory.getInstance().startAction(name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AbstractAction.java

示例7: start

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
protected void start(VcsContext context) {
  final Project project = context.getProject();
  if (project != null) {
    if (ApplicationManager.getApplication().isDispatchThread() && myAutoSave) {
      ApplicationManager.getApplication().saveAll();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AbstractAction.java

示例8: filterRoots

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@NotNull
private FilePath[] filterRoots(FilePath[] roots, VcsContext vcsContext) {
  final ArrayList<FilePath> result = new ArrayList<FilePath>();
  final Project project = vcsContext.getProject();
  for (FilePath file : roots) {
    AbstractVcs vcs = VcsUtil.getVcsFor(project, file);
    if (vcs != null) {
      if (!myScopeInfo.filterExistsInVcs() || AbstractVcs.fileInVcsByFileStatus(project, file)) {
        UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
        if (updateEnvironment != null) {
          result.add(file);
        }
      }
      else {
        final VirtualFile virtualFile = file.getVirtualFile();
        if (virtualFile != null && virtualFile.isDirectory()) {
          final VirtualFile[] vcsRoots = ProjectLevelVcsManager.getInstance(vcsContext.getProject()).getAllVersionedRoots();
          for(VirtualFile vcsRoot: vcsRoots) {
            if (VfsUtil.isAncestor(virtualFile, vcsRoot, false)) {
              result.add(file);
            }
          }
        }
      }
    }
  }
  return result.toArray(new FilePath[result.size()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:AbstractCommonUpdateAction.java

示例9: getRoots

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
public FilePath[] getRoots(VcsContext context, final ActionInfo actionInfo) {
  ArrayList<FilePath> result = new ArrayList<FilePath>();
  Project project = context.getProject();
  final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
  final AbstractVcs[] vcses = vcsManager.getAllActiveVcss();
  for(AbstractVcs vcs: vcses) {
    if (actionInfo.getEnvironment(vcs) != null) {
      final VirtualFile[] files = vcsManager.getRootsUnderVcs(vcs);
      for(VirtualFile file: files) {
        result.add(new FilePathImpl(file));
      }
    }
  }
  return result.toArray(new FilePath[result.size()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ScopeInfo.java

示例10: actionPerformed

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
protected void actionPerformed(VcsContext e) {
  if (e.getProject() == null) return;
  final ToolWindowManager manager = ToolWindowManager.getInstance(e.getProject());
  if (manager != null) {
    final ToolWindow window = manager.getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
    if (window != null) {
      window.show(null);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:ShowChangesViewAction.java

示例11: actionPerformed

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Override
protected void actionPerformed(VcsContext context) {
    VirtualFile selectedFile = getSelectedFile(context);
    if (selectedFile == null) {
        return;
    }
    Project project = context.getProject();
    AbstractVcs activeVcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(selectedFile);
    if (activeVcs == null || activeVcs.getVcsHistoryProvider() == null) {
        return;
    }

    AliContentFactory.addDevMotiveContent(project, selectedFile, null, activeVcs.getName(), null, true);
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:15,代码来源:DevMotiveAction.java

示例12: update

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Override
protected void update(VcsContext context, Presentation presentation) {
    presentation.setText("Development History (Dev Motive)");
    Project project = context.getProject();
    boolean visible = project != null && ProjectLevelVcsManager.getInstance(project).hasActiveVcss();
    presentation.setVisible(visible);
    presentation.setEnabled(visible && isEnabled(context) && ServerType.AGM.equals(project.getComponent(RestService.class).getServerTypeIfAvailable()));
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:9,代码来源:DevMotiveAction.java

示例13: actionPerformed

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Override
protected void actionPerformed(@NotNull final VcsContext context) {
  final Project project = context.getProject();

  boolean showUpdateOptions = myActionInfo.showOptions(project);

  LOG.debug(String.format("project: %s, show update options: %s", project, showUpdateOptions));

  if (project != null) {
    try {
      final FilePath[] filePaths = myScopeInfo.getRoots(context, myActionInfo);
      final FilePath[] roots = DescindingFilesFilter.filterDescindingFiles(filterRoots(filePaths, context), project);
      if (roots.length == 0) {
        LOG.debug("No roots found.");
        return;
      }

      final Map<AbstractVcs, Collection<FilePath>> vcsToVirtualFiles = createVcsToFilesMap(roots, project);

      for (AbstractVcs vcs : vcsToVirtualFiles.keySet()) {
        final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
        if ((updateEnvironment != null) && (! updateEnvironment.validateOptions(vcsToVirtualFiles.get(vcs)))) {
          // messages already shown
          LOG.debug("Options not valid for files: " + vcsToVirtualFiles);
          return;
        }
      }

      if (showUpdateOptions || OptionsDialog.shiftIsPressed(context.getModifiers())) {
        showOptionsDialog(vcsToVirtualFiles, project, context);
      }

      if (ApplicationManager.getApplication().isDispatchThread()) {
        ApplicationManager.getApplication().saveAll();
      }
      Task.Backgroundable task = new Updater(project, roots, vcsToVirtualFiles);
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        task.run(new EmptyProgressIndicator());
      }
      else {
        ProgressManager.getInstance().run(task);
      }
    }
    catch (ProcessCanceledException ignored) {
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:AbstractCommonUpdateAction.java

示例14: update

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Override
 protected void update(VcsContext vcsContext, Presentation presentation) {
   Project project = vcsContext.getProject();

   if (project != null) {
     final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
     final boolean underVcs = vcsManager.hasActiveVcss();
     if (! underVcs) {
       presentation.setVisible(false);
       return;
     }

     String actionName = getCompleteActionName(vcsContext);
     if (myActionInfo.showOptions(project) || OptionsDialog.shiftIsPressed(vcsContext.getModifiers())) {
       actionName += "...";
     }

     presentation.setText(actionName);

     presentation.setVisible(true);
     presentation.setEnabled(true);

     if (supportingVcsesAreEmpty(vcsManager, myActionInfo)) {
       presentation.setVisible(myAlwaysVisible);
       presentation.setEnabled(false);
       return;
     }

     if (filterRootsBeforeAction()) {
       FilePath[] roots = filterRoots(myScopeInfo.getRoots(vcsContext, myActionInfo), vcsContext);
       if (roots.length == 0) {
         presentation.setVisible(myAlwaysVisible);
         presentation.setEnabled(false);
         return;
       }
     }

     if (presentation.isVisible() && presentation.isEnabled() &&
         vcsManager.isBackgroundVcsOperationRunning()) {
       presentation.setEnabled(false);
     }
   } else {
     presentation.setVisible(false);
     presentation.setEnabled(false);
   }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:AbstractCommonUpdateAction.java

示例15: approximatelyHasRoots

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Override
protected boolean approximatelyHasRoots(VcsContext dataContext) {
  final Project project = dataContext.getProject();
  final ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
  return manager.hasAnyMappings();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:AbstractCommitChangesAction.java


注:本文中的com.intellij.openapi.vcs.actions.VcsContext.getProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。