use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.
the class BookmarkItem method setupRenderer.
public static void setupRenderer(SimpleColoredComponent renderer, Project project, Bookmark bookmark, boolean selected) {
VirtualFile file = bookmark.getFile();
if (!file.isValid()) {
return;
}
PsiManager psiManager = PsiManager.getInstance(project);
PsiElement fileOrDir = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
if (fileOrDir != null) {
renderer.setIcon(fileOrDir.getIcon(0));
}
String description = bookmark.getDescription();
if (description != null) {
renderer.append(description + " ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
renderer.append(file.getName(), SimpleTextAttributes.fromTextAttributes(attributes));
if (bookmark.getLine() >= 0) {
renderer.append(":", SimpleTextAttributes.GRAYED_ATTRIBUTES);
renderer.append(String.valueOf(bookmark.getLine() + 1), SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
renderer.append(" (" + VfsUtilCore.getRelativeLocation(file, project.getBaseDir()) + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
if (!selected) {
FileColorManager colorManager = FileColorManager.getInstance(project);
if (fileOrDir instanceof PsiFile) {
Color color = colorManager.getRendererBackground((PsiFile) fileOrDir);
if (color != null) {
renderer.setBackground(color);
}
}
}
}
use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.
the class AbstractTreeNode method setForcedForeground.
protected void setForcedForeground(@NotNull PresentationData presentation) {
final FileStatus status = getFileStatus();
Color fgColor = getFileStatusColor(status);
fgColor = fgColor == null ? status.getColor() : fgColor;
if (valueIsCut()) {
fgColor = CopyPasteManager.CUT_COLOR;
}
if (presentation.getForcedTextForeground() == null) {
presentation.setForcedTextForeground(fgColor);
}
}
use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.
the class FileEditorManagerImpl method isChanged.
@Override
public boolean isChanged(@NotNull final EditorComposite editor) {
final FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
if (fileStatusManager == null)
return false;
FileStatus status = fileStatusManager.getStatus(editor.getFile());
return status != FileStatus.UNKNOWN && status != FileStatus.NOT_CHANGED;
}
use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.
the class MoveChangesToAnotherListAction method getChangesForSelectedFiles.
@NotNull
private static List<Change> getChangesForSelectedFiles(@NotNull Project project, @NotNull VirtualFile[] selectedFiles, @NotNull List<VirtualFile> unversionedFiles, @NotNull List<VirtualFile> changedFiles) {
List<Change> changes = new ArrayList<>();
ChangeListManager changeListManager = ChangeListManager.getInstance(project);
for (VirtualFile vFile : selectedFiles) {
Change change = changeListManager.getChange(vFile);
if (change == null) {
FileStatus status = changeListManager.getStatus(vFile);
if (FileStatus.UNKNOWN.equals(status)) {
unversionedFiles.add(vFile);
changedFiles.add(vFile);
} else if (FileStatus.NOT_CHANGED.equals(status) && vFile.isDirectory()) {
addAllChangesUnderPath(changeListManager, VcsUtil.getFilePath(vFile), changes, changedFiles);
}
} else {
FilePath afterPath = ChangesUtil.getAfterPath(change);
if (afterPath != null && afterPath.isDirectory()) {
addAllChangesUnderPath(changeListManager, afterPath, changes, changedFiles);
} else {
changes.add(change);
changedFiles.add(vFile);
}
}
}
return changes;
}
use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.
the class SelectInChangesViewTarget method canSelect.
public boolean canSelect(final SelectInContext context) {
final VirtualFile file = context.getVirtualFile();
FileStatus fileStatus = FileStatusManager.getInstance(myProject).getStatus(file);
return ProjectLevelVcsManager.getInstance(myProject).getAllActiveVcss().length != 0 && !fileStatus.equals(FileStatus.NOT_CHANGED);
}
Aggregations