Search in sources :

Example 6 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class SvnIgnoreTest method testImpl.

private void testImpl(VirtualFile file) {
    VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
    clManager.ensureUpToDate(false);
    Assert.assertTrue(clManager.getDefaultChangeList().getChanges().isEmpty());
    VcsDirtyScopeManager.getInstance(myProject).fileDirty(file);
    clManager.ensureUpToDate(false);
    Assert.assertTrue(clManager.getDefaultChangeList().getChanges().isEmpty());
    final FileStatus status = clManager.getStatus(file);
    Assert.assertTrue(status.getText(), FileStatus.IGNORED.equals(status));
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus)

Example 7 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class InspectionTreeCellRenderer method getMainForegroundAttributes.

private static SimpleTextAttributes getMainForegroundAttributes(InspectionTreeNode node) {
    SimpleTextAttributes foreground = SimpleTextAttributes.REGULAR_ATTRIBUTES;
    if (node instanceof RefElementNode) {
        RefEntity refElement = ((RefElementNode) node).getElement();
        if (refElement instanceof RefElement) {
            refElement = ((RefElement) refElement).getContainingEntry();
            if (((RefElement) refElement).isEntry() && ((RefElement) refElement).isPermanentEntry()) {
                foreground = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.blue);
            }
        }
    }
    final FileStatus nodeStatus = node.getNodeStatus();
    if (nodeStatus != FileStatus.NOT_CHANGED) {
        foreground = new SimpleTextAttributes(foreground.getBgColor(), nodeStatus.getColor(), foreground.getWaveColor(), foreground.getStyle());
    }
    return foreground;
}
Also used : RefElement(com.intellij.codeInspection.reference.RefElement) FileStatus(com.intellij.openapi.vcs.FileStatus) RefEntity(com.intellij.codeInspection.reference.RefEntity) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes)

Example 8 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class ChangeListTodosTreeStructure method accept.

@Override
public boolean accept(final PsiFile psiFile) {
    if (!psiFile.isValid())
        return false;
    VirtualFile file = psiFile.getVirtualFile();
    ChangeListManager listManager = ChangeListManager.getInstance(myProject);
    FileStatus status = listManager.getStatus(file);
    if (status == FileStatus.NOT_CHANGED)
        return false;
    FilePath filePath = VcsUtil.getFilePath(file);
    final Collection<Change> changes = listManager.getDefaultChangeList().getChanges();
    for (Change change : changes) {
        ContentRevision afterRevision = change.getAfterRevision();
        if (afterRevision != null && afterRevision.getFile().equals(filePath)) {
            return (myTodoFilter != null && myTodoFilter.accept(mySearchHelper, psiFile) || (myTodoFilter == null && mySearchHelper.getTodoItemsCount(psiFile) > 0));
        }
    }
    return false;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FilePath(com.intellij.openapi.vcs.FilePath) FileStatus(com.intellij.openapi.vcs.FileStatus) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) Change(com.intellij.openapi.vcs.changes.Change) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager)

Example 9 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class PsiChangeTracker method getElementsChanged.

public static <T extends PsiElement> Map<T, FileStatus> getElementsChanged(PsiElement file, PsiElement oldFile, final PsiFilter<T> filter) {
    final HashMap<T, FileStatus> result = new HashMap<>();
    final List<T> oldElements = new ArrayList<>();
    final List<T> elements = new ArrayList<>();
    if (file == null) {
        oldFile.accept(filter.createVisitor(oldElements));
        calculateStatuses(elements, oldElements, result, filter);
        return result;
    }
    final Project project = file.getProject();
    file.accept(filter.createVisitor(elements));
    final VirtualFile vf = file.getContainingFile().getVirtualFile();
    FileStatus status = vf == null ? null : FileStatusManager.getInstance(project).getStatus(vf);
    if (status == null && oldFile == null) {
        status = FileStatus.ADDED;
    }
    if (status == FileStatus.ADDED || status == FileStatus.DELETED || status == FileStatus.DELETED_FROM_FS || status == FileStatus.UNKNOWN) {
        for (T element : elements) {
            result.put(element, status);
        }
        return result;
    }
    if (oldFile == null)
        return result;
    oldFile.accept(filter.createVisitor(oldElements));
    calculateStatuses(elements, oldElements, result, filter);
    return result;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) FileStatus(com.intellij.openapi.vcs.FileStatus) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 10 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class FileStatusColorsPageFactory method collectFileTypes.

private static Collection<String> collectFileTypes() {
    ArrayList<String> result = new ArrayList<>();
    FileStatus[] statuses = FileStatusFactory.getInstance().getAllFileStatuses();
    for (FileStatus status : statuses) {
        result.add(status.getText());
    }
    return result;
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus) ArrayList(java.util.ArrayList)

Aggregations

FileStatus (com.intellij.openapi.vcs.FileStatus)29 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 Change (com.intellij.openapi.vcs.changes.Change)7 NotNull (org.jetbrains.annotations.NotNull)6 FilePath (com.intellij.openapi.vcs.FilePath)5 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)5 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)4 FileStatusManager (com.intellij.openapi.vcs.FileStatusManager)3 ArrayList (java.util.ArrayList)3 PsiElement (com.intellij.psi.PsiElement)2 GitContentRevision (git4idea.GitContentRevision)2 RefElement (com.intellij.codeInspection.reference.RefElement)1 RefEntity (com.intellij.codeInspection.reference.RefEntity)1 NavigationItemFileStatus (com.intellij.navigation.NavigationItemFileStatus)1 Application (com.intellij.openapi.application.Application)1 FilePatch (com.intellij.openapi.diff.impl.patch.FilePatch)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 DumbAwareRunnable (com.intellij.openapi.project.DumbAwareRunnable)1 Project (com.intellij.openapi.project.Project)1 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1