Java Code Examples for com.intellij.vcsUtil.VcsUtil#getVirtualFiles()
The following examples show how to use
com.intellij.vcsUtil.VcsUtil#getVirtualFiles() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddAction.java From azure-devops-intellij with MIT License | 6 votes |
@Override public void actionPerformed(final AnActionEvent anActionEvent) { final Project project = anActionEvent.getData(CommonDataKeys.PROJECT); final VirtualFile[] files = VcsUtil.getVirtualFiles(anActionEvent); final List<VcsException> errors = new ArrayList<VcsException>(); ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() { public void run() { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); errors.addAll(TFSVcs.getInstance(project).getCheckinEnvironment().scheduleUnversionedFilesForAddition(Arrays.asList(files))); } }, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_ADD_SCHEDULING), false, project); if (!errors.isEmpty()) { AbstractVcsHelper.getInstance(project).showErrors(errors, TFSVcs.TFVC_NAME); } }
Example 2
Source File: MultipleItemAction.java From azure-devops-intellij with MIT License | 4 votes |
@Override public void update(final AnActionEvent anActionEvent) { final Project project = anActionEvent.getData(CommonDataKeys.PROJECT); final VirtualFile[] files = VcsUtil.getVirtualFiles(anActionEvent); anActionEvent.getPresentation().setEnabled(isEnabled(project, files)); }
Example 3
Source File: MultipleItemAction.java From azure-devops-intellij with MIT License | 4 votes |
@Override public void actionPerformed(final AnActionEvent anActionEvent) { logger.info("Starting multiple item action"); final MultipleItemActionContext context = new MultipleItemActionContext(); context.project = anActionEvent.getData(CommonDataKeys.PROJECT); final VirtualFile[] files = VcsUtil.getVirtualFiles(anActionEvent); logger.info("Finding the list of selected files and getting itemInfos for each one"); runWithProgress(context, new Runnable() { public void run() { ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); context.serverContext = TFSVcs.getInstance(context.project).getServerContext(true); // Get the local paths final List<String> localPaths = new ArrayList<String>(files.length); for (final VirtualFile file : files) { final FilePath localPath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(file); localPaths.add(localPath.getPath()); } // Get the item infos loadItemInfoCollection(context, localPaths); // Set the default path and additional parameters if (context.itemInfos.size() > 0) { logger.info("Setting the defaultLocalPath and workingFolder"); context.defaultLocalPath = context.itemInfos.get(0).getLocalItem(); context.isFolder = Path.directoryExists(context.defaultLocalPath); context.workingFolder = context.isFolder ? context.defaultLocalPath : Path.getDirectoryName(context.defaultLocalPath); } } }, TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_TFVC_LABEL_PROGRESS_GATHERING_INFORMATION)); if (context.hasErrors()) { logger.info("Errors found; showing them and exiting"); showErrors(context); return; } if (!context.hasItems()) { // Somehow we got here without items selected or we couldn't find the info for them. // This shouldn't happen, but just in case we won't continue logger.warn("We ended up without any items in the list and no errors occurred. We need to understand how this happened."); return; } // Now that we have all the item infos, we can execute the body of this action logger.info("Calling the subclasses execute method to do the actual work."); execute(context); if (context.cancelled) { return; } if (context.hasErrors()) { logger.info("Errors found; showing them and exiting"); showErrors(context); } }
Example 4
Source File: AddAction.java From azure-devops-intellij with MIT License | 4 votes |
@Override public void update(final AnActionEvent anActionEvent) { final Project project = anActionEvent.getProject(); final VirtualFile[] files = VcsUtil.getVirtualFiles(anActionEvent); anActionEvent.getPresentation().setEnabled(isEnabled(project, files)); }