@NotNull @Override public DiffRequest process( @NotNull UserDataHolder context, @NotNull ProgressIndicator indicator) throws DiffRequestProducerException, ProcessCanceledException { try { DiffContent content1; DiffContent content2; if (FileStatus.ADDED.equals(myFileStatus)) { content1 = DiffContentFactory.getInstance().createEmpty(); } else { byte[] bytes1 = loadContent(myFilePointer, myBefore); content1 = DiffContentFactoryImpl.getInstanceImpl() .createFromBytes(myProject, myFilePath, bytes1); } if (FileStatus.DELETED.equals(myFileStatus)) { content2 = DiffContentFactory.getInstance().createEmpty(); } else { byte[] bytes2 = loadContent(myFilePointer, myAfter); content2 = DiffContentFactoryImpl.getInstanceImpl() .createFromBytes(myProject, myFilePath, bytes2); } String title = DiffRequestFactoryImpl.getContentTitle(myFilePath); return new SimpleDiffRequest(title, content1, content2, "Before update", "After update"); } catch (IOException e) { throw new DiffRequestProducerException("Can't load content", e); } }
public Change next() { final Pair<VirtualFilePointer, FileStatus> pair = myVfIterator.next(); final VirtualFilePointer pointer = pair.getFirst(); MyCheckpointContentRevision before = new MyCheckpointContentRevision(pointer, myBeforeLoader, true); MyCheckpointContentRevision after = new MyCheckpointContentRevision(pointer, myAfterLoader, false); if (FileStatus.ADDED.equals(pair.getSecond())) { before = null; } else if (FileStatus.DELETED.equals(pair.getSecond())) { after = null; } return new Change(before, after, pair.getSecond()); }
private Collection<FilePath> chooseBinaryFiles(List<Change> converted, Set<FilePath> paths) { String singleMessage = ""; if (paths.size() == 1) { final Change change = converted.get(0); final FileStatus status = change.getFileStatus(); final FilePath path = ChangesUtil.getFilePath(change); final String stringPath = TreeConflictRefreshablePanel.filePath(path); if (FileStatus.DELETED.equals(status)) { singleMessage = "Delete binary file " + stringPath + " (according to theirs changes)?"; } else if (FileStatus.ADDED.equals(status)) { singleMessage = "Create binary file " + stringPath + " (according to theirs changes)?"; } else { singleMessage = "Apply changes to binary file " + stringPath + " (according to theirs changes)?"; } } return AbstractVcsHelper.getInstance(myVcs.getProject()) .selectFilePathsToProcess( new ArrayList<FilePath>(paths), TreeConflictRefreshablePanel.TITLE, "Select binary files to patch", TreeConflictRefreshablePanel.TITLE, singleMessage, new VcsShowConfirmationOption() { @Override public Value getValue() { return null; } @Override public void setValue(Value value) {} @Override public boolean isPersistent() { return false; } }); }
public CommitLegendPanel(InfoCalculator infoCalculator) { myInfoCalculator = infoCalculator; final Color background = UIUtil.getListBackground(); myModifiedPanel.setBackground(background); myNewPanel.setBackground(background); myDeletedPanel.setBackground(background); if (UIUtil.isUnderDarcula()) { final Color color = UIUtil.getSeparatorColor(); final TitledBorder border = new TitledBorder(new LineBorder(color, 1)); myModifiedPanel.setBorder(border); myNewPanel.setBorder(border); myDeletedPanel.setBorder(border); } myModifiedLabel.setForeground(FileStatus.MODIFIED.getColor()); myNewLabel.setForeground(FileStatus.ADDED.getColor()); myDeletedLabel.setForeground(FileStatus.DELETED.getColor()); boldLabel(myModifiedLabel, true); boldLabel(myNewLabel, true); boldLabel(myDeletedLabel, true); }