use of com.intellij.openapi.vcs.FileStatusManager in project intellij-community by JetBrains.
the class LineStatusTrackerManager method shouldBeInstalled.
private boolean shouldBeInstalled(@Nullable final VirtualFile virtualFile) {
if (isDisabled())
return false;
if (virtualFile == null || virtualFile instanceof LightVirtualFile)
return false;
final FileStatusManager statusManager = FileStatusManager.getInstance(myProject);
if (statusManager == null)
return false;
if (!myStatusProvider.isSupported(virtualFile)) {
log("shouldBeInstalled failed: no support found", virtualFile);
return false;
}
final FileStatus status = statusManager.getStatus(virtualFile);
if (status == FileStatus.NOT_CHANGED || status == FileStatus.ADDED || status == FileStatus.UNKNOWN || status == FileStatus.IGNORED) {
log("shouldBeInstalled skipped: status=" + status, virtualFile);
return false;
}
return true;
}
use of com.intellij.openapi.vcs.FileStatusManager in project intellij-community by JetBrains.
the class FileOrDirectoryTreeNode method getAttributes.
@NotNull
@Override
public SimpleTextAttributes getAttributes() {
if (!getFilePointer().isValid()) {
return myInvalidAttributes;
}
VirtualFile file = getFilePointer().getFile();
FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
FileStatus status = fileStatusManager.getStatus(file);
SimpleTextAttributes attributes = getAttributesFor(status);
return myFilterAttributes == null ? attributes : SimpleTextAttributes.merge(myFilterAttributes, attributes);
}
use of com.intellij.openapi.vcs.FileStatusManager 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.FileStatusManager in project intellij-community by JetBrains.
the class FileEditorManagerImpl method getFileColor.
//-------------------------------------------------------
/**
* @return color of the {@code file} which corresponds to the
* file's status
*/
public Color getFileColor(@NotNull final VirtualFile file) {
final FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
Color statusColor = fileStatusManager != null ? fileStatusManager.getStatus(file).getColor() : UIUtil.getLabelForeground();
if (statusColor == null)
statusColor = UIUtil.getLabelForeground();
return statusColor;
}
use of com.intellij.openapi.vcs.FileStatusManager in project intellij-community by JetBrains.
the class CloseEditorsActionBase method getFilesToClose.
protected ArrayList<Pair<EditorComposite, EditorWindow>> getFilesToClose(final AnActionEvent event) {
final ArrayList<Pair<EditorComposite, EditorWindow>> res = new ArrayList<>();
final DataContext dataContext = event.getDataContext();
final Project project = event.getData(CommonDataKeys.PROJECT);
final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
final EditorWindow editorWindow = EditorWindow.DATA_KEY.getData(dataContext);
final EditorWindow[] windows;
if (editorWindow != null) {
windows = new EditorWindow[] { editorWindow };
} else {
windows = editorManager.getWindows();
}
final FileStatusManager fileStatusManager = FileStatusManager.getInstance(project);
if (fileStatusManager != null) {
for (int i = 0; i != windows.length; ++i) {
final EditorWindow window = windows[i];
final EditorComposite[] editors = window.getEditors();
for (final EditorComposite editor : editors) {
if (isFileToClose(editor, window)) {
res.add(Pair.create(editor, window));
}
}
}
}
return res;
}
Aggregations