Package org.rstudio.studio.client.common.vcs

Examples of org.rstudio.studio.client.common.vcs.StatusAndPath$PathComparator


                  {
                     clearDiff();
                     return;
                  }

                  StatusAndPath vcsStatus = StatusAndPath.fromInfo(
                        event.getFileChange().getFile().getGitStatus());
                  if (paths.get(0).getRawPath().equals(vcsStatus.getRawPath()))
                  {
                     gitState.refresh(false);
                  }
               }
            });
View Full Code Here


      {
         clearDiff();
         return;
      }

      final StatusAndPath item = paths.get(0);

      if (allowModeSwitch)
      {
         if (!softModeSwitch_)
         {
            boolean staged = item.getStatus().charAt(0) != ' ' &&
                             item.getStatus().charAt(1) == ' ';
            HasValue<Boolean> checkbox = staged ?
                                         view_.getStagedCheckBox() :
                                         view_.getUnstagedCheckBox();
            if (!checkbox.getValue())
            {
               clearDiff();
               checkbox.setValue(true, true);
            }
         }
         else
         {
            if (view_.getStagedCheckBox().getValue()
                && (item.getStatus().charAt(0) == ' ' || item.getStatus().charAt(0) == '?'))
            {
               clearDiff();
               view_.getUnstagedCheckBox().setValue(true, true);
            }
            else if (view_.getUnstagedCheckBox().getValue()
                     && item.getStatus().charAt(1) == ' ')
            {
               clearDiff();
               view_.getStagedCheckBox().setValue(true, true);
            }
         }
      }
      softModeSwitch_ = false;

      if (!item.getPath().equals(currentFilename_))
      {
         clearDiff();
         currentFilename_ = item.getPath();
      }

      diffInvalidation_.invalidate();
      final Token token = diffInvalidation_.getInvalidationToken();

      final PatchMode patchMode = view_.getStagedCheckBox().getValue()
                                  ? PatchMode.Stage
                                  : PatchMode.Working;
      server_.gitDiffFile(
            item.getPath(),
            patchMode,
            view_.getContextLines().getValue(),
            overrideSizeWarning_,
            new SimpleRequestCallback<DiffResult>("Diff Error")
            {
               @Override
               public void onResponseReceived(DiffResult diffResult)
               {
                  if (token.isInvalid())
                     return;

                  // Use lastResponse_ to prevent unnecessary flicker
                  String response = diffResult.getDecodedValue();
                  if (response.equals(currentResponse_))
                     return;
                  currentResponse_ = response;
                  currentSourceEncoding_ = diffResult.getSourceEncoding();

                  UnifiedParser parser = new UnifiedParser(response);
                  parser.nextFilePair();

                  ArrayList<ChunkOrLine> allLines = new ArrayList<ChunkOrLine>();

                  activeChunks_.clear();
                  for (DiffChunk chunk;
                       null != (chunk = parser.nextChunk());)
                  {
                     activeChunks_.add(chunk);
                     allLines.add(new ChunkOrLine(chunk));
                     for (Line line : chunk.getLines())
                        allLines.add(new ChunkOrLine(line));
                  }

                  view_.setShowActions(
                        !"??".equals(item.getStatus()) &&
                        !"UU".equals(item.getStatus()));
                  view_.setData(allLines, patchMode);
               }

               @Override
               public void onError(ServerError error)
View Full Code Here

               registrations.removeHandler();

            FileChange fileChange = event.getFileChange();
            FileSystemItem file = fileChange.getFile();

            StatusAndPath status = StatusAndPath.fromInfo(
                  getStatusFromFile(file));

            if (needsFullRefresh(file))
            {
               refresh(false);
               return;
            }

            if (status_ != null && status != null)
            {
               for (int i = 0; i < status_.size(); i++)
               {
                  if (status.getRawPath().equals(status_.get(i).getRawPath()))
                  {
                     if (StringUtil.notNull(status.getStatus()).trim().length() == 0)
                        status_.remove(i);
                     else
                        status_.set(i, status);
                     handlers_.fireEvent(new VcsRefreshEvent(Reason.FileChange));
                     return;
                  }
               }

               if (status.getStatus().trim().length() != 0)
               {
                  status_.add(status);
                  handlers_.fireEvent(new VcsRefreshEvent(Reason.FileChange));
                  return;
               }
View Full Code Here

                  {
                     clearDiff();
                     return;
                  }

                  StatusAndPath vcsStatus = StatusAndPath.fromInfo(
                        event.getFileChange().getFile().getSVNStatus());
                  if (paths.get(0).getRawPath().equals(vcsStatus.getRawPath()))
                  {
                     svnState.refresh(false);
                  }
               }
            });
View Full Code Here

      {
         clearDiff();
         return;
      }

      final StatusAndPath item = paths.get(0);

      if (!item.getPath().equals(currentFilename_))
      {
         clearDiff();
         currentFilename_ = item.getPath();
      }
     
      // bail if this is an undiffable status
      if (undiffableStatuses_.contains(item.getStatus()))
         return;

      diffInvalidation_.invalidate();
      final Token token = diffInvalidation_.getInvalidationToken();

      server_.svnDiffFile(
            item.getPath(),
            view_.getContextLines().getValue(),
            overrideSizeWarning_,
            new SimpleRequestCallback<DiffResult>("Diff Error")
            {
               @Override
               public void onResponseReceived(DiffResult diffResult)
               {
                  if (token.isInvalid())
                     return;

                  String response = diffResult.getDecodedValue();

                  // Use lastResponse_ to prevent unnecessary flicker
                  if (response.equals(currentResponse_))
                     return;
                  currentResponse_ = response;
                  currentEncoding_ = diffResult.getSourceEncoding();

                  SVNDiffParser parser = new SVNDiffParser(response);
                  parser.nextFilePair();

                  ArrayList<ChunkOrLine> allLines = new ArrayList<ChunkOrLine>();

                  activeChunks_.clear();
                  for (DiffChunk chunk;
                       null != (chunk = parser.nextChunk());)
                  {
                     if (!chunk.shouldIgnore())
                     {
                        activeChunks_.add(chunk);
                        allLines.add(new ChunkOrLine(chunk));
                     }

                     for (Line line : chunk.getLines())
                        allLines.add(new ChunkOrLine(line));
                  }

                  view_.getLineTableDisplay().setShowActions(
                        !"?".equals(item.getStatus()));
                  view_.setData(allLines);
               }

               @Override
               public void onError(ServerError error)
View Full Code Here

                  new ArrayList<StatusAndPath>(svnState.getStatus());

            boolean usesChangelists = false;
            for (int i = items.size()-1; i >= 0; i--)
            {
               StatusAndPath item = items.get(i);

               if (!StringUtil.isNullOrEmpty(item.getChangelist()))
                  usesChangelists = true;

               if (rejectItem(item))
                  items.remove(i);
            }
View Full Code Here

   {
      // special case for a single directory with property changes
      ArrayList<StatusAndPath> items = display_.getSelectedItems();
      if (items.size() == 1)
      {
         StatusAndPath item = items.get(0);
         if (item.isDirectory() && item.getStatus().equals("M"))
         {
            String path = item.getPath();
            if (path.equals("."))
               path = "";
            IgnoreList ignoreList = new IgnoreList(path,
                                                   new ArrayList<String>());
            pIgnore_.get().showDialog(ignoreList, ignoreStrategy_);
View Full Code Here

TOP

Related Classes of org.rstudio.studio.client.common.vcs.StatusAndPath$PathComparator

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.