mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-149666 Bookmark icons are not shown for files in Project View: allow testing element icons
This commit is contained in:
@@ -51,6 +51,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.RetrievableIcon;
|
||||
import com.intellij.util.NotNullProducer;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.Processor;
|
||||
@@ -353,7 +354,13 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyCheckedIcon implements Icon {
|
||||
private static class MyCheckedIcon implements Icon, RetrievableIcon {
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon retrieve() {
|
||||
return PlatformIcons.CHECK_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
(darkBackground() ? AllIcons.Actions.CheckedGrey : AllIcons.Actions.CheckedBlack).paintIcon(c, g, x, y);
|
||||
|
||||
@@ -46,7 +46,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class DeferredIconImpl<T> implements DeferredIcon {
|
||||
public class DeferredIconImpl<T> implements DeferredIcon, RetrievableIcon {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ui.DeferredIconImpl");
|
||||
private static final int MIN_AUTO_UPDATE_MILLIS = 950;
|
||||
private static final RepaintScheduler ourRepaintScheduler = new RepaintScheduler();
|
||||
@@ -248,6 +248,12 @@ public class DeferredIconImpl<T> implements DeferredIcon {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon retrieve() {
|
||||
return evaluate();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Icon evaluate() {
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.ui.RetrievableIcon;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.ImageLoader;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
@@ -42,8 +43,6 @@ import java.lang.ref.Reference;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
@@ -317,7 +316,13 @@ public final class IconLoader {
|
||||
}
|
||||
|
||||
public static Icon getTransparentIcon(@NotNull final Icon icon, final float alpha) {
|
||||
return new Icon() {
|
||||
return new RetrievableIcon() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon retrieve() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return icon.getIconHeight();
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class is mostly for testing purposes: in case an icon is hidden behind a private or a restricted interface,
|
||||
* marking it as RetrievableIcon will help get the actual icon and perform checks.
|
||||
*/
|
||||
public interface RetrievableIcon extends Icon {
|
||||
@Nullable
|
||||
Icon retrieve();
|
||||
}
|
||||
Reference in New Issue
Block a user