Java Code Examples for com.intellij.openapi.vcs.FileStatusManager#getStatus()
The following examples show how to use
com.intellij.openapi.vcs.FileStatusManager#getStatus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipleItemAction.java From azure-devops-intellij with MIT License | 6 votes |
/** * This method enables the action if one or more items are selected. * * @param project * @param files * @return */ protected boolean isEnabled(final Project project, final VirtualFile[] files) { if (files.length == 0 || project == null) { return false; } final FileStatusManager fileStatusManager = FileStatusManager.getInstance(project); for (VirtualFile file : files) { final FileStatus fileStatus = fileStatusManager.getStatus(file); if (fileStatus != FileStatus.NOT_CHANGED && fileStatus != FileStatus.MODIFIED && fileStatus != FileStatus.HIJACKED) { return false; } } return true; }
Example 2
Source File: TfsFileUtil.java From azure-devops-intellij with MIT License | 6 votes |
/** * Recursively look for files that have a status UNKNOWN * * @param files * @param fileStatusManager * @return */ public static boolean findUnknownFiles(final VirtualFile[] files, final FileStatusManager fileStatusManager) { for (VirtualFile file : files) { // if directory then check children if (file.isDirectory()) { if (findUnknownFiles(file.getChildren(), fileStatusManager)) { return true; } } else { final FileStatus fileStatus = fileStatusManager.getStatus(file); if (fileStatus == FileStatus.UNKNOWN) { return true; } } } return false; }
Example 3
Source File: LineStatusTrackerManager.java From consulo with Apache License 2.0 | 6 votes |
private boolean shouldBeInstalled(@javax.annotation.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; }
Example 4
Source File: FileEditorManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public boolean isChanged(@Nonnull 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; }
Example 5
Source File: FileOrDirectoryTreeNode.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @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); }