Package com.intellij.openapi.vfs

Examples of com.intellij.openapi.vfs.VirtualFile


  @Override
  public void actionPerformed(AnActionEvent e)
  {
    Project project = e.getData(PlatformDataKeys.PROJECT);
    Editor editor = e.getData(PlatformDataKeys.EDITOR);
    VirtualFile vFile = RevuUtils.getVirtualFile(e);

    if ((project == null) || (vFile == null))
    {
      return;
    }
View Full Code Here


  @Override
  public void update(AnActionEvent e)
  {
    boolean enabled = false;
    Project project = e.getData(PlatformDataKeys.PROJECT);
    VirtualFile vFile = RevuUtils.getVirtualFile(e);

    if ((project != null) && (vFile != null))
    {
      Collection<Review> reviews = RevuUtils.getActiveReviewsForCurrentUser(project);
      for (Review review : reviews)
View Full Code Here

    }
    else
    {
      e.getPresentation().setText(RevuBundle.message("reviewing.annotate.review.text", review.getName()));

      VirtualFile vFile = e.getData(PlatformDataKeys.VIRTUAL_FILE);
      e.getPresentation().setEnabled((vFile != null)
        && RevuVcsUtils.isUnderVcs(project, vFile)
        && fileScopeManager.belongsToScope(project, review, vFile));
    }
  }
View Full Code Here

    }
    else
    {
      if (editor == null)
      {
        VirtualFile selectedFile = context.getSelectedFile();
        if (selectedFile == null)
        {
          return;
        }
View Full Code Here

    if (project == null)
    {
      return;
    }

    final VirtualFile file = FileDocumentManager.getInstance().getFile(editor.getDocument());
    if (file == null)
    {
      return;
    }

    final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
    AbstractVcs vcs = plVcsManager.getVcsFor(file);
    if (vcs == null)
    {
      return;
    }

    final AnnotationProvider annotationProvider = vcs.getAnnotationProvider();
    if (annotationProvider == null)
    {
      return;
    }

    final Ref<FileAnnotation> fileAnnotationRef = new Ref<FileAnnotation>();
    final Ref<VcsException> exceptionRef = new Ref<VcsException>();

    final BackgroundableActionEnabledHandler handler =
      ((ProjectLevelVcsManagerImpl) plVcsManager).getBackgroundableActionHandler(
        VcsBackgroundableActions.ANNOTATE);
    handler.register(file.getPath());

    ProgressManager.getInstance()
      .run(new Task.Backgroundable(project, VcsBundle.message("retrieving.annotations"), true,
        BackgroundFromStartOption.getInstance())
      {
        public void run(@NotNull ProgressIndicator indicator)
        {
          try
          {
            fileAnnotationRef.set(annotationProvider.annotate(file));
          }
          catch (VcsException e)
          {
            exceptionRef.set(e);
          }
        }

        @Override
        public void onCancel()
        {
          onSuccess();
        }

        @Override
        public void onSuccess()
        {
          handler.completed(file.getPath());

          if (!exceptionRef.isNull())
          {
            AbstractVcsHelper.getInstance(project)
              .showErrors(Arrays.asList(exceptionRef.get()), VcsBundle.message("message.title.annotate"));
View Full Code Here

            EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
              .clone();
        }

        PsiElement psiElement = node.getPsiElement();
        VirtualFile vFile = (psiElement == null)
          ? null
            : ((psiElement instanceof PsiDirectory)
              ? ((PsiDirectory) psiElement).getVirtualFile()
                : (psiElement.getContainingFile() == null) ? null : psiElement.getContainingFile().getVirtualFile());
View Full Code Here

    if (fileChooser == null)
    {
      fileChooser = new ReviewFileChooser(project);
    }

    VirtualFile vFile = fileChooser.selectFileToOpen(
      RevuVfsUtils.findFile(RevuUtils.getWorkspaceSettings(project).getLastSelectedReviewDir()));
    if (vFile != null)
    {
      ReviewManager reviewManager = project.getComponent(ReviewManager.class);
      Review review = reviewManager.getReviewByFile(new File(vFile.getPath()));
      if (review != null)
      {
        Messages.showWarningDialog(project,
          RevuBundle.message("projectSettings.review.import.fileAlreadyExists.text", review.getName()),
          RevuBundle.message("projectSettings.review.import.error.title"));
        return;
      }

      //@TODO check path outside from project
      review = new Review();
      review.setFile(new File(vFile.getPath()));

      if (!reviewManager.load(review, false))
      {
        return;
      }
View Full Code Here

      DefaultMutableTreeNode result = new DefaultMutableTreeNode();

      for (Issue issue : review.getIssues())
      {
        VirtualFile vFile = issue.getFile();
        if (vFile != null)
        {
          addNode(result, vFile.getParent());
        }
      }

      return result;
    }
View Full Code Here

  public void internalUpdateUI(@Nullable Issue data, boolean requestFocus)
  {
    super.internalUpdateUI(data, requestFocus);

    final VirtualFile file = (data == null) ? null : data.getFile();
    boolean currentIdModified = (data != null) && (file != null) && RevuVcsUtils.fileIsModifiedFromVcs(project, file);
    String currentRev = RevuVcsUtils.formatRevision((file == null)
        ? null : RevuVcsUtils.getVcsRevisionNumber(project, file), currentIdModified);
    String initialRev = RevuVcsUtils.formatRevision((data == null) ? null : data.getVcsRev(),
      (data != null) && (data.getLocalRev() != null));
View Full Code Here

  {
    public void editorCreated(EditorFactoryEvent event)
    {
      final Editor editor = event.getEditor();

      VirtualFile vFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
      if (vFile == null)
      {
        return;
      }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.vfs.VirtualFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.