mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
cleanup
This commit is contained in:
@@ -42,10 +42,12 @@ public class AlternativeJreClassFinder extends NonClasspathClassFinder {
|
||||
public AlternativeJreClassFinder(Project project, DebuggerManagerEx manager) {
|
||||
super(project);
|
||||
manager.addDebuggerManagerListener(new DebuggerManagerAdapter() {
|
||||
@Override
|
||||
public void sessionCreated(DebuggerSession session) {
|
||||
clearCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sessionRemoved(DebuggerSession session) {
|
||||
clearCache();
|
||||
}
|
||||
@@ -79,7 +81,7 @@ public class AlternativeJreClassFinder extends NonClasspathClassFinder {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
private static Collection<VirtualFile> getClassRoots(@NotNull Sdk jre) {
|
||||
return Arrays.asList(jre.getRootProvider().getFiles(OrderRootType.CLASSES));
|
||||
}
|
||||
@@ -89,7 +91,7 @@ public class AlternativeJreClassFinder extends NonClasspathClassFinder {
|
||||
return Arrays.asList(jre.getRootProvider().getFiles(OrderRootType.SOURCES));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public static GlobalSearchScope getSearchScope(@NotNull Sdk jre) {
|
||||
return new NonClasspathDirectoriesScope(getClassRoots(jre));
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
private final Map<String, String> myBuilderParams;
|
||||
private final CanceledStatus myCancelStatus;
|
||||
private volatile float myDone = -1.0f;
|
||||
private EventDispatcher<BuildListener> myListeners = EventDispatcher.create(BuildListener.class);
|
||||
private final EventDispatcher<BuildListener> myListeners = EventDispatcher.create(BuildListener.class);
|
||||
|
||||
public CompileContextImpl(CompileScope scope,
|
||||
ProjectDescriptor pd,
|
||||
MessageHandler delegateMessageHandler,
|
||||
Map<String, String> builderParams,
|
||||
CanceledStatus cancelStatus) throws ProjectBuildException {
|
||||
CompileContextImpl(CompileScope scope,
|
||||
ProjectDescriptor pd,
|
||||
MessageHandler delegateMessageHandler,
|
||||
Map<String, String> builderParams,
|
||||
CanceledStatus cancelStatus) {
|
||||
myProjectDescriptor = pd;
|
||||
myBuilderParams = Collections.unmodifiableMap(builderParams);
|
||||
myCancelStatus = cancelStatus;
|
||||
@@ -69,6 +69,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompilationStartStamp(Collection<BuildTarget<?>> targets, long stamp) {
|
||||
synchronized (myCompilationStartStamp) {
|
||||
for (BuildTarget<?> target : targets) {
|
||||
@@ -151,6 +152,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
return myScope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processMessage(BuildMessage msg) {
|
||||
if (msg.getKind() == BuildMessage.Kind.ERROR) {
|
||||
Utils.ERRORS_DETECTED_KEY.set(this, Boolean.TRUE);
|
||||
|
||||
@@ -67,6 +67,7 @@ public class LayeredIcon extends JBUI.AuxScalableJBIcon {
|
||||
myHeight = icon.myHeight;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LayeredIcon copy() {
|
||||
return new LayeredIcon(this);
|
||||
|
||||
@@ -64,6 +64,7 @@ public class RowIcon extends JBUI.AuxScalableJBIcon {
|
||||
myScaledIcons = null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected RowIcon copy() {
|
||||
return new RowIcon(this);
|
||||
|
||||
@@ -46,7 +46,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class DeferredIconImpl<T> extends JBUI.CachingScalableJBIcon implements DeferredIcon, RetrievableIcon {
|
||||
public class DeferredIconImpl<T> extends JBUI.CachingScalableJBIcon<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();
|
||||
@@ -68,13 +68,13 @@ public class DeferredIconImpl<T> extends JBUI.CachingScalableJBIcon implements D
|
||||
private final IconListener<T> myEvalListener;
|
||||
private static final TransferToEDTQueue<Runnable> ourLaterInvocator = TransferToEDTQueue.createRunnableMerger("Deferred icon later invocator", 200);
|
||||
|
||||
protected DeferredIconImpl(DeferredIconImpl icon) {
|
||||
private DeferredIconImpl(@NotNull DeferredIconImpl<T> icon) {
|
||||
super(icon);
|
||||
myDelegateIcon = icon.myDelegateIcon;
|
||||
myScaledDelegateIcon = icon.myDelegateIcon;
|
||||
myEvaluator = icon.myEvaluator;
|
||||
myIsScheduled = icon.myIsScheduled;
|
||||
myParam = (T)icon.myParam;
|
||||
myParam = icon.myParam;
|
||||
myNeedReadAction = icon.myNeedReadAction;
|
||||
myDone = icon.myDone;
|
||||
myAutoUpdatable = icon.myAutoUpdatable;
|
||||
@@ -83,9 +83,10 @@ public class DeferredIconImpl<T> extends JBUI.CachingScalableJBIcon implements D
|
||||
myEvalListener = icon.myEvalListener;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected DeferredIconImpl copy() {
|
||||
return new DeferredIconImpl(this);
|
||||
protected DeferredIconImpl<T> copy() {
|
||||
return new DeferredIconImpl<>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,7 +94,6 @@ public class DeferredIconImpl<T> extends JBUI.CachingScalableJBIcon implements D
|
||||
if (getScale() != scale && myDelegateIcon instanceof ScalableIcon) {
|
||||
myScaledDelegateIcon = ((ScalableIcon)myDelegateIcon).scale(scale);
|
||||
super.setScale(scale);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DeferredIconImpl<T> extends JBUI.CachingScalableJBIcon implements D
|
||||
private static final boolean CHECK_CONSISTENCY = ApplicationManager.getApplication().isUnitTestMode();
|
||||
}
|
||||
|
||||
public DeferredIconImpl(Icon baseIcon, T param, @NotNull Function<T, Icon> evaluator, @NotNull IconListener<T> listener, boolean autoUpdatable) {
|
||||
DeferredIconImpl(Icon baseIcon, T param, @NotNull Function<T, Icon> evaluator, @NotNull IconListener<T> listener, boolean autoUpdatable) {
|
||||
this(baseIcon, param, true, evaluator, listener, autoUpdatable);
|
||||
}
|
||||
|
||||
@@ -371,6 +371,7 @@ public class DeferredIconImpl<T> extends JBUI.CachingScalableJBIcon implements D
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface IconListener<T> {
|
||||
void evalDone(DeferredIconImpl<T> source, T key, @NotNull Icon result);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.util.ScalableIcon;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -44,6 +45,7 @@ public class SizedIcon extends JBUI.CachingScalableJBIcon {
|
||||
myScaledDelegate = null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected SizedIcon copy() {
|
||||
return new SizedIcon(this);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class MessageBusImpl implements MessageBus {
|
||||
* Child bus's order is its parent order plus one more element, an int that's bigger than that of all sibling buses that come before
|
||||
* Sorting by these vectors lexicographically gives DFS order
|
||||
*/
|
||||
private final AtomicReference<List<Integer>> myOrderRef = new AtomicReference<List<Integer>>();
|
||||
private final AtomicReference<List<Integer>> myOrderRef = new AtomicReference<List<Integer>>(Collections.<Integer>emptyList());
|
||||
|
||||
private final ConcurrentMap<Topic, Object> mySyncPublishers = ContainerUtil.newConcurrentMap();
|
||||
private final ConcurrentMap<Topic, Object> myAsyncPublishers = ContainerUtil.newConcurrentMap();
|
||||
@@ -82,8 +82,7 @@ public class MessageBusImpl implements MessageBus {
|
||||
private final Disposable myConnectionDisposable;
|
||||
|
||||
public MessageBusImpl(@NotNull Object owner, @NotNull MessageBus parentBus) {
|
||||
myOwner = owner + " of " + owner.getClass();
|
||||
myConnectionDisposable = Disposer.newDisposable(myOwner);
|
||||
this(owner);
|
||||
myParentBus = (MessageBusImpl)parentBus;
|
||||
myParentBus.onChildBusCreated(this);
|
||||
LOG.assertTrue(myParentBus.myChildBuses.contains(this));
|
||||
@@ -93,7 +92,6 @@ public class MessageBusImpl implements MessageBus {
|
||||
private MessageBusImpl(Object owner) {
|
||||
myOwner = owner + " of " + owner.getClass();
|
||||
myConnectionDisposable = Disposer.newDisposable(myOwner);
|
||||
myOrderRef.set(Collections.<Integer>emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.awt.*;
|
||||
*/
|
||||
public class ColorIcon extends EmptyIcon {
|
||||
private final Color myColor;
|
||||
private boolean myBorder;
|
||||
private int myColorSize;
|
||||
private final boolean myBorder;
|
||||
private final int myColorSize;
|
||||
|
||||
public ColorIcon(int size, int colorSize, @NotNull Color color, final boolean border) {
|
||||
super(size, size);
|
||||
@@ -50,6 +50,7 @@ public class ColorIcon extends EmptyIcon {
|
||||
myColorSize = icon.myColorSize;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ColorIcon copy() {
|
||||
return new ColorIcon(this);
|
||||
@@ -77,7 +78,7 @@ public class ColorIcon extends EmptyIcon {
|
||||
}
|
||||
}
|
||||
|
||||
protected int getColorSize() {
|
||||
private int getColorSize() {
|
||||
return scaleVal(myColorSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
|
||||
|
||||
protected final int width;
|
||||
protected final int height;
|
||||
private boolean myUseCache;
|
||||
private final boolean myUseCache;
|
||||
|
||||
static {
|
||||
JBUI.addPropertyChangeListener(JBUI.USER_SCALE_FACTOR_PROPERTY, new PropertyChangeListener() {
|
||||
@@ -96,7 +96,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
|
||||
private EmptyIcon(int width, int height, boolean useCache) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.myUseCache = useCache;
|
||||
myUseCache = useCache;
|
||||
}
|
||||
|
||||
protected EmptyIcon(EmptyIcon icon) {
|
||||
@@ -106,6 +106,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
|
||||
myUseCache = icon.myUseCache;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected EmptyIcon copy() {
|
||||
return new EmptyIcon(this);
|
||||
@@ -123,7 +124,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
|
||||
|
||||
private static EmptyIcon create(int width, int height, boolean preScaled) {
|
||||
Integer key = key(width, height, preScaled);
|
||||
EmptyIcon icon = (key != null) ? cache.get(key) : null;
|
||||
EmptyIcon icon = key != null ? cache.get(key) : null;
|
||||
if (icon == null) {
|
||||
icon = new EmptyIcon(width, height, true);
|
||||
icon.setJBUIPreScaled(preScaled);
|
||||
@@ -133,7 +134,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
|
||||
}
|
||||
|
||||
private static Integer key(int width, int height, boolean preScaled) {
|
||||
return (width == height && width < 129) ? preScaled ? width : JBUI.scale(width) : null;
|
||||
return width == height && width < 129 ? preScaled ? width : JBUI.scale(width) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,6 +180,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
|
||||
super(icon);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected EmptyIconUIResource copy() {
|
||||
return new EmptyIconUIResource(this);
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JBUI {
|
||||
* @see UIUtil#isJDKManagedHiDPIScreen()
|
||||
* @see UIUtil#isJDKManagedHiDPIScreen(Graphics2D)
|
||||
* @see UIUtil#drawImage(Graphics, Image, int, int, int, int, ImageObserver)
|
||||
* @see UIUtil#createImage(Graphics2D, int, int, int)
|
||||
* @see UIUtil#createImage(Graphics, int, int, int)
|
||||
* @see UIUtil#createImage(int, int, int)
|
||||
*/
|
||||
public enum ScaleType {
|
||||
@@ -137,7 +137,7 @@ public class JBUI {
|
||||
/**
|
||||
* The system scale factor, corresponding to the default monitor device.
|
||||
*/
|
||||
public static final Float SYSTEM_SCALE_FACTOR = sysScale();
|
||||
private static final Float SYSTEM_SCALE_FACTOR = sysScale();
|
||||
|
||||
/**
|
||||
* The user space scale factor.
|
||||
@@ -189,12 +189,7 @@ public class JBUI {
|
||||
UIUtil.initSystemFontData();
|
||||
Pair<String, Integer> fdata = UIUtil.getSystemFontData();
|
||||
|
||||
int size;
|
||||
if (fdata != null) {
|
||||
size = fdata.getSecond();
|
||||
} else {
|
||||
size = Fonts.label().getSize();
|
||||
}
|
||||
int size = fdata == null ? Fonts.label().getSize() : fdata.getSecond();
|
||||
return size / UIUtil.DEF_SYSTEM_FONT_SIZE;
|
||||
}
|
||||
|
||||
@@ -424,14 +419,13 @@ public class JBUI {
|
||||
* @return whether HiDPI-awareness is assumed for the scale factor
|
||||
*/
|
||||
public static boolean isHiDPI(@Nullable Graphics2D g, ScaleType type) {
|
||||
return g != null ? isHiDPI(g.getDeviceConfiguration().getDevice(), type) :
|
||||
isHiDPI((GraphicsDevice)null, type);
|
||||
return isHiDPI(g == null ? null : g.getDeviceConfiguration().getDevice(), type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the scale factor associated with the graphics device assumes HiDPI-awareness.
|
||||
*
|
||||
* @param g the graphics device
|
||||
* @param gd the graphics device
|
||||
* @param type the type of the scale factor
|
||||
* @return whether HiDPI-awareness is assumed for the scale factor
|
||||
*/
|
||||
@@ -461,7 +455,7 @@ public class JBUI {
|
||||
* Equivalent of {@link #isHiDPI(Graphics2D, ScaleType)} called for the graphics of specified component.
|
||||
*
|
||||
* @see #isHiDPI(Graphics2D, ScaleType)
|
||||
* @param component if it's <code>null</code> the graphics of the default screen device will be used
|
||||
* @param component if it's {@code null} the graphics of the default screen device will be used
|
||||
*/
|
||||
public static boolean isHiDPI(@Nullable Component component) {
|
||||
Graphics graphics = component != null? component.getGraphics() : null;
|
||||
@@ -559,25 +553,12 @@ public class JBUI {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComboBox {
|
||||
/**
|
||||
* JComboBox<String> comboBox = new ComboBox<>(new String[] {"First", "Second", "Third"});
|
||||
* comboBox.setEditable(true);
|
||||
* comboBox.setEditor(JBUI.ComboBox.compositeComboboxEditor(new JTextField(), new JLabel(AllIcons.Icon_CE)));
|
||||
*
|
||||
* @param components an array of JComponent objects. The first one is the editable text component.
|
||||
*/
|
||||
/* public static ComboBoxCompositeEditor compositeComboboxEditor (JComponent ... components) {
|
||||
return new ComboBoxCompositeEditor(components);
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* An Icon dynamically sticking to JBUI.scale to meet HiDPI.
|
||||
*
|
||||
* @author tav
|
||||
*/
|
||||
public static abstract class JBIcon implements Icon {
|
||||
public abstract static class JBIcon implements Icon {
|
||||
private float myInitialJBUIScale = currentJBUIScale();
|
||||
|
||||
protected JBIcon() {}
|
||||
@@ -643,7 +624,7 @@ public class JBUI {
|
||||
*
|
||||
* @author tav
|
||||
*/
|
||||
public static abstract class ScalableJBIcon extends JBIcon implements ScalableIcon {
|
||||
public abstract static class ScalableJBIcon extends JBIcon implements ScalableIcon {
|
||||
private float myScale = 1f;
|
||||
|
||||
protected ScalableJBIcon() {}
|
||||
@@ -718,7 +699,7 @@ public class JBUI {
|
||||
* @author tav
|
||||
* @author Aleksey Pivovarov
|
||||
*/
|
||||
public static abstract class CachingScalableJBIcon<T extends CachingScalableJBIcon> extends ScalableJBIcon {
|
||||
public abstract static class CachingScalableJBIcon<T extends CachingScalableJBIcon> extends ScalableJBIcon {
|
||||
private CachingScalableJBIcon myScaledIconCache;
|
||||
|
||||
protected CachingScalableJBIcon() {}
|
||||
@@ -835,7 +816,7 @@ public class JBUI {
|
||||
|
||||
@Override
|
||||
public boolean needUpdateJBUIScale(@Nullable Graphics2D g) {
|
||||
return needUpdateJBUIScale() || (g != null && needUpdateJBUIScale(sysScale(g), ScaleType.SYS));
|
||||
return needUpdateJBUIScale() || g != null && needUpdateJBUIScale(sysScale(g), ScaleType.SYS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -851,8 +832,8 @@ public class JBUI {
|
||||
*
|
||||
* @author tav
|
||||
*/
|
||||
public static abstract class AuxJBIcon extends JBIcon implements JBUIScaleTrackable {
|
||||
private JBUIScaleTracker myJBUIScaleDelegate = new JBUIScaleTracker();
|
||||
public abstract static class AuxJBIcon extends JBIcon implements JBUIScaleTrackable {
|
||||
private final JBUIScaleTracker myJBUIScaleDelegate = new JBUIScaleTracker();
|
||||
|
||||
@Override
|
||||
public boolean updateJBUIScale() {
|
||||
@@ -885,8 +866,8 @@ public class JBUI {
|
||||
*
|
||||
* @author tav
|
||||
*/
|
||||
public static abstract class AuxScalableJBIcon extends CachingScalableJBIcon implements JBUIScaleTrackable {
|
||||
private JBUIScaleTracker myJBUIScaleDelegate = new JBUIScaleTracker();
|
||||
public abstract static class AuxScalableJBIcon extends CachingScalableJBIcon implements JBUIScaleTrackable {
|
||||
private final JBUIScaleTracker myJBUIScaleDelegate = new JBUIScaleTracker();
|
||||
|
||||
protected AuxScalableJBIcon() {}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public class TwoColorsIcon extends ColorIcon {
|
||||
mySecondColor = icon.mySecondColor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected TwoColorsIcon copy() {
|
||||
return new TwoColorsIcon(this);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class GradleClassFinder extends NonClasspathClassFinder {
|
||||
}
|
||||
};
|
||||
|
||||
public GradleClassFinder(Project project, @NotNull GradleBuildClasspathManager buildClasspathManager) {
|
||||
public GradleClassFinder(@NotNull Project project, @NotNull GradleBuildClasspathManager buildClasspathManager) {
|
||||
super(project, JavaFileType.DEFAULT_EXTENSION, GroovyFileType.DEFAULT_EXTENSION);
|
||||
myBuildClasspathManager = buildClasspathManager;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.designer.propertyTable.renderers;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.SimpleColoredComponent;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -42,6 +43,7 @@ public final class ColorIcon extends EmptyIcon {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected ColorIcon copy() {
|
||||
return new ColorIcon(this);
|
||||
}
|
||||
|
||||
@@ -45,13 +45,7 @@ public class ColorIconCache {
|
||||
}
|
||||
|
||||
public Icon getIcon(@NotNull final Color color, final int size) {
|
||||
Icon icon = ourCache.get(color).get(size);
|
||||
if (icon == null) {
|
||||
icon = new ColorIcon(size, color);
|
||||
ourCache.get(color).put(size, icon);
|
||||
}
|
||||
|
||||
return icon;
|
||||
return ourCache.get(color).computeIfAbsent(size, s -> new ColorIcon(s, color));
|
||||
}
|
||||
|
||||
public static class ColorIcon extends EmptyIcon {
|
||||
@@ -74,6 +68,7 @@ public class ColorIconCache {
|
||||
if (icon.myColours != null) myColours = Arrays.copyOf(icon.myColours, icon.myColours.length);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ColorIcon copy() {
|
||||
return new ColorIcon(this);
|
||||
|
||||
Reference in New Issue
Block a user