From 59048e0c4bf2bf3bb637063bf2289800f554f052 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 29 Mar 2017 19:11:57 +0300 Subject: [PATCH] speedup SimpleColoredComponent based renderers --- .../src/com/intellij/ui/ColoredListCellRenderer.java | 7 ++++++- .../src/com/intellij/ui/ColoredTreeCellRenderer.java | 7 ++++++- .../src/com/intellij/ui/SimpleColoredComponent.java | 2 +- .../src/com/intellij/ui/SimpleColoredRenderer.java | 7 ++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java b/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java index 3288c918ab77..518e8630e787 100644 --- a/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/ColoredListCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -101,6 +101,11 @@ public abstract class ColoredListCellRenderer extends SimpleColoredComponent } } + @Override + void revalidateAndRepaint() { + // no need for this in a renderer + } + @Override @NotNull public Dimension getPreferredSize() { diff --git a/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java b/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java index fd5f840f4346..90e6c0afa708 100644 --- a/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/ColoredTreeCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -170,6 +170,11 @@ public abstract class ColoredTreeCellRenderer extends SimpleColoredComponent imp } } + @Override + void revalidateAndRepaint() { + // no need for this in a renderer + } + /** * This method is invoked only for customization of component. * All component attributes are cleared when this method is being invoked. diff --git a/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java b/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java index 8bd9e50cf4dc..2ac4fbc9a724 100644 --- a/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java +++ b/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java @@ -198,7 +198,7 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co } } - private void revalidateAndRepaint() { + void revalidateAndRepaint() { if (myAutoInvalidate) { revalidate(); } diff --git a/platform/platform-api/src/com/intellij/ui/SimpleColoredRenderer.java b/platform/platform-api/src/com/intellij/ui/SimpleColoredRenderer.java index 2cea564c6e94..e225f09746ea 100644 --- a/platform/platform-api/src/com/intellij/ui/SimpleColoredRenderer.java +++ b/platform/platform-api/src/com/intellij/ui/SimpleColoredRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -31,6 +31,11 @@ public class SimpleColoredRenderer extends SimpleColoredComponent { super.append(fragment, modifyAttributes(attributes), isMainText); } + @Override + void revalidateAndRepaint() { + // no need for this in a renderer + } + protected SimpleTextAttributes modifyAttributes(final SimpleTextAttributes attributes) { return myCellState.modifyAttributes(attributes); }