use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class SelectFilesToAddTextsToPatchPanel method getBig.
public static Set<Change> getBig(List<Change> changes) {
final Set<Change> exclude = new HashSet<>();
for (Change change : changes) {
// try to estimate size via VF: we assume that base content hasn't been changed much
VirtualFile virtualFile = getVfFromChange(change);
if (virtualFile != null) {
if (isBig(virtualFile)) {
exclude.add(change);
}
continue;
}
// otherwise, to avoid regression we have to process context length
ContentRevision beforeRevision = change.getBeforeRevision();
if (beforeRevision != null) {
try {
String content = beforeRevision.getContent();
if (content == null) {
final FilePath file = beforeRevision.getFile();
LOG.info("null content for " + (file.getPath()) + ", is dir: " + (file.isDirectory()));
continue;
}
if (content.length() > VcsConfiguration.ourMaximumFileForBaseRevisionSize) {
exclude.add(change);
}
} catch (VcsException e) {
LOG.info(e);
}
}
}
return exclude;
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class TextFilePatchInProgress method getNewContentRevision.
public ContentRevision getNewContentRevision() {
if (FilePatchStatus.DELETED.equals(myStatus))
return null;
if (myNewContentRevision == null) {
myConflicts = null;
if (FilePatchStatus.ADDED.equals(myStatus)) {
final FilePath newFilePath = VcsUtil.getFilePath(myIoCurrentBase, false);
final String content = myPatch.getNewFileText();
myNewContentRevision = new SimpleContentRevision(content, newFilePath, myPatch.getAfterVersionId());
} else {
final FilePath newFilePath = detectNewFilePathForMovedOrModified();
myNewContentRevision = new LazyPatchContentRevision(myCurrentBase, newFilePath, myPatch.getAfterVersionId(), myPatch);
if (myCurrentBase != null) {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
public void run() {
((LazyPatchContentRevision) myNewContentRevision).getContent();
}
});
}
}
}
return myNewContentRevision;
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class ShelvedChange method getChange.
public Change getChange(Project project) {
// todo unify with
if (myChange == null) {
File baseDir = new File(project.getBaseDir().getPath());
File file = getAbsolutePath(baseDir, myBeforePath);
FilePath beforePath = VcsUtil.getFilePath(file, false);
beforePath.refresh();
ContentRevision beforeRevision = null;
if (myFileStatus != FileStatus.ADDED) {
beforeRevision = new CurrentContentRevision(beforePath) {
@Override
@NotNull
public VcsRevisionNumber getRevisionNumber() {
return new TextRevisionNumber(VcsBundle.message("local.version.title"));
}
};
}
ContentRevision afterRevision = null;
if (myFileStatus != FileStatus.DELETED) {
FilePath afterPath = VcsUtil.getFilePath(getAbsolutePath(baseDir, myAfterPath), false);
afterRevision = new PatchedContentRevision(project, beforePath, afterPath);
}
myChange = new Change(beforeRevision, afterRevision, myFileStatus);
}
return myChange;
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class ChangesBrowserFilePathNode method render.
@Override
public void render(final ChangesBrowserNodeRenderer renderer, final boolean selected, final boolean expanded, final boolean hasFocus) {
final FilePath path = (FilePath) userObject;
if (path.isDirectory() || !isLeaf()) {
renderer.append(getRelativePath(path), SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (!isLeaf()) {
appendCount(renderer);
}
renderer.setIcon(PlatformIcons.DIRECTORY_CLOSED_ICON);
} else {
if (renderer.isShowFlatten()) {
renderer.append(path.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
FilePath parentPath = path.getParentPath();
renderer.append(spaceAndThinSpace() + FileUtil.getLocationRelativeToUserHome(parentPath.getPresentableUrl()), SimpleTextAttributes.GRAYED_ATTRIBUTES);
} else {
renderer.append(getRelativePath(path), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
renderer.setIcon(path.getFileType().getIcon());
}
}
use of com.intellij.openapi.vcs.FilePath in project intellij-community by JetBrains.
the class ChangesBrowserLocallyDeletedNode method getIcon.
@Nullable
private Icon getIcon() {
Icon result = getUserObject().getAddIcon();
if (result == null) {
FilePath filePath = getUserObject().getPath();
result = filePath.isDirectory() || !isLeaf() ? PlatformIcons.DIRECTORY_CLOSED_ICON : filePath.getFileType().getIcon();
}
return result;
}
Aggregations