mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
IJPL-185498 Add isDirectory parameter to FilePathIconProvider
Merge-request: IJ-MR-161288 Merged-by: Filipp Smorygo <Philipp.Smorygo@jetbrains.com> GitOrigin-RevId: f11221d5e3ca6c4fdfcfa2ba9873700d1a1f1952
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2e54d8b4a8
commit
129c65214c
@@ -1209,7 +1209,8 @@ c:com.intellij.openapi.vcs.changes.ExternallyRenamedChange
|
||||
- setRenamedOrMovedTarget(com.intellij.openapi.vcs.FilePath):V
|
||||
com.intellij.openapi.vcs.changes.FilePathIconProvider
|
||||
- sf:EP_NAME:com.intellij.openapi.extensions.ExtensionPointName
|
||||
- a:getIcon(com.intellij.openapi.vcs.FilePath,com.intellij.openapi.project.Project):javax.swing.Icon
|
||||
- getIcon(com.intellij.openapi.vcs.FilePath,com.intellij.openapi.project.Project):javax.swing.Icon
|
||||
- getIcon(com.intellij.openapi.vcs.FilePath,Z,com.intellij.openapi.project.Project):javax.swing.Icon
|
||||
f:com.intellij.openapi.vcs.changes.FilePathsHelper
|
||||
- s:convertPath(com.intellij.openapi.vcs.FilePath):java.lang.String
|
||||
- s:convertPath(java.lang.String):java.lang.String
|
||||
|
||||
@@ -22,10 +22,25 @@ public interface FilePathIconProvider {
|
||||
ExtensionPointName.create("com.intellij.openapi.vcs.changes.ui.filePathIconProvider");
|
||||
|
||||
/**
|
||||
* @deprecated Do not call this method directly because the `isDirectory` property of filePath is not reliable enough.
|
||||
* Use {@link #getIcon(FilePath, boolean, Project)} instead.
|
||||
*
|
||||
* @param filePath file for which icon is shown
|
||||
* @param project current opened project
|
||||
* @return {@code null} if there is no appropriate icon for given file path
|
||||
*/
|
||||
@Nullable
|
||||
Icon getIcon(@NotNull FilePath filePath, @Nullable Project project);
|
||||
@Deprecated(forRemoval = true)
|
||||
default @Nullable Icon getIcon(@NotNull FilePath filePath, @Nullable Project project) {
|
||||
throw new UnsupportedOperationException("Implementors must override at least one of getIcon() methods");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePath file for which icon is shown
|
||||
* @param isDirectory flag that indicates if file is directory or not
|
||||
* @param project current opened project
|
||||
* @return {@code null} if there is no appropriate icon for given file path
|
||||
*/
|
||||
default @Nullable Icon getIcon(@NotNull FilePath filePath, boolean isDirectory, @Nullable Project project) {
|
||||
return getIcon(filePath, project);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ChangesBrowserNodeRenderer extends ColoredTreeCellRenderer {
|
||||
* @param isDirectory directory flag is specified explicitly, as {@link FilePath#isDirectory()} can be unreliable
|
||||
*/
|
||||
public void setIcon(@NotNull FilePath filePath, boolean isDirectory) {
|
||||
Icon icon = FilePathIconProvider.EP_NAME.computeSafeIfAny(provider -> provider.getIcon(filePath, myProject));
|
||||
Icon icon = FilePathIconProvider.EP_NAME.computeSafeIfAny(provider -> provider.getIcon(filePath, isDirectory, myProject));
|
||||
if (icon != null) {
|
||||
setIcon(icon);
|
||||
return;
|
||||
|
||||
@@ -102,7 +102,7 @@ class RepositoryBrowserPanel(
|
||||
}
|
||||
if (file is VcsVirtualFile) {
|
||||
val localPath = getLocalFilePath(file)
|
||||
val icon = FilePathIconProvider.EP_NAME.computeSafeIfAny { it.getIcon(localPath, project) }
|
||||
val icon = FilePathIconProvider.EP_NAME.computeSafeIfAny { it.getIcon(localPath, false, project) }
|
||||
if (icon != null) return icon
|
||||
}
|
||||
return FileTypeManager.getInstance().getFileTypeByFileName(file.nameSequence).icon
|
||||
|
||||
Reference in New Issue
Block a user