You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by eb...@apache.org on 2019/06/07 14:57:49 UTC
[netbeans] branch master updated (4a8d8bf -> ecb4599)
This is an automated email from the ASF dual-hosted git repository.
ebakke pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git.
from 4a8d8bf Merge pull request #1271 from sdedic/bugfix/2577-filtering_modules
new 43e3197 Make ImageUtilities.loadImageIcon cache its result.
new ecb4599 Fix missing revalidate after exiting Full Screen & Show Only Editor.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../netbeans/core/windows/EditorOnlyDisplayer.java | 3 +++
.../src/org/openide/util/ImageUtilities.java | 15 +++++++++++----
.../src/org/openide/util/ImageUtilitiesTest.java | 22 +++++++++++++++++-----
3 files changed, 31 insertions(+), 9 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[netbeans] 02/02: Fix missing revalidate after exiting Full Screen
& Show Only Editor.
Posted by eb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ebakke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit ecb45997fed0b2e95b4103c6c1e4e102dbe2fbda
Author: Eirik Bakke <eb...@ultorg.com>
AuthorDate: Mon Jan 21 10:53:06 2019 -0500
Fix missing revalidate after exiting Full Screen & Show Only Editor.
This fixes a small bug that I observed in my NetBeans Platform application when
running on Windows 10 with the NetBeans status bar disabled; it relates to my
earlier patch for NETBEANS-731 "Hide (and auto-show) menu bar in full screen
mode". This patch has been working in my IDE without issue for 6 months.
---
.../src/org/netbeans/core/windows/EditorOnlyDisplayer.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/platform/core.windows/src/org/netbeans/core/windows/EditorOnlyDisplayer.java b/platform/core.windows/src/org/netbeans/core/windows/EditorOnlyDisplayer.java
index 8c85262..884fd83 100644
--- a/platform/core.windows/src/org/netbeans/core/windows/EditorOnlyDisplayer.java
+++ b/platform/core.windows/src/org/netbeans/core/windows/EditorOnlyDisplayer.java
@@ -143,6 +143,9 @@ public class EditorOnlyDisplayer {
JFrame frame = ( JFrame ) WindowManagerImpl.getInstance().getMainWindow();
frame.setContentPane( originalContentPane );
originalContentPane = null;
+ frame.invalidate();
+ frame.revalidate();
+ frame.repaint();
setShowEditorToolbar( originalShowEditorToolbar );
if( restoreFocus )
restoreFocus();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[netbeans] 01/02: Make ImageUtilities.loadImageIcon cache its
result.
Posted by eb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ebakke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit 43e319710e9263390601ce35f7cc2c4d1abdb76b
Author: Eirik Bakke <eb...@ultorg.com>
AuthorDate: Fri Jun 7 10:53:04 2019 -0400
Make ImageUtilities.loadImageIcon cache its result.
This fixes the test failures I just introduced in ActionsTest. It also ensures
that everything that was cached in ImageUtilities before still remains cached
after the recent changes.
Also use System.identityHashCode(image) rather than image.hashCode in
ImageUtilities' internal cache key classes, to be consistent with using
referential equality in equals() implementations.
---
.../src/org/openide/util/ImageUtilities.java | 15 +++++++++++----
.../src/org/openide/util/ImageUtilitiesTest.java | 22 +++++++++++++++++-----
2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java b/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
index 5171bd9..4af5cc8 100644
--- a/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
+++ b/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java
@@ -216,7 +216,7 @@ public final class ImageUtilities {
if( image == null ) {
return null;
}
- return IconImageIcon.create(image);
+ return image.asImageIcon();
}
private static boolean isDarkLaF() {
@@ -844,7 +844,7 @@ public final class ImageUtilities {
@Override
public int hashCode() {
int hash = ((x << 3) ^ y) << 4;
- hash = hash ^ baseImage.hashCode() ^ overlayImage.hashCode();
+ hash = hash ^ System.identityHashCode(baseImage) ^ System.identityHashCode(overlayImage);
return hash;
}
@@ -878,8 +878,7 @@ public final class ImageUtilities {
@Override
public int hashCode() {
- int hash = image.hashCode() ^ str.hashCode();
- return hash;
+ return System.identityHashCode(image) ^ str.hashCode();
}
@Override
@@ -943,6 +942,8 @@ public final class ImageUtilities {
// May be null.
final Icon delegateIcon;
final URL url;
+ // May be null.
+ ImageIcon imageIconVersion;
public static ToolTipImage createNew(String toolTipText, Image image, URL url) {
ImageUtilities.ensureLoaded(image);
@@ -980,6 +981,12 @@ public final class ImageUtilities {
this.url = url;
}
+ public synchronized ImageIcon asImageIcon() {
+ if (imageIconVersion == null)
+ imageIconVersion = IconImageIcon.create(this);
+ return imageIconVersion;
+ }
+
public ToolTipImage(Icon delegateIcon, String toolTipText, int imageType) {
// BufferedImage must have width/height > 0.
super(Math.max(1, delegateIcon.getIconWidth()),
diff --git a/platform/openide.util.ui/test/unit/src/org/openide/util/ImageUtilitiesTest.java b/platform/openide.util.ui/test/unit/src/org/openide/util/ImageUtilitiesTest.java
index de8f537..be2eb29 100644
--- a/platform/openide.util.ui/test/unit/src/org/openide/util/ImageUtilitiesTest.java
+++ b/platform/openide.util.ui/test/unit/src/org/openide/util/ImageUtilitiesTest.java
@@ -242,6 +242,18 @@ public class ImageUtilitiesTest extends TestCase {
assertEquals("Tool tip text should be empty, but it is " + str, expected, str);
}
+ public void testLoadImageCached() {
+ Image image1 = ImageUtilities.loadImage("org/openide/util/testimage.png", false);
+ Image image2 = ImageUtilities.loadImage("org/openide/util/testimage.png", false);
+ assertSame("Expected same instance", image1, image2);
+ }
+
+ public void testLoadImageIconCached() {
+ ImageIcon icon1 = ImageUtilities.loadImageIcon("org/openide/util/testimage.png", false);
+ ImageIcon icon2 = ImageUtilities.loadImageIcon("org/openide/util/testimage.png", false);
+ assertSame("Expected same instance", icon1, icon2);
+ }
+
public void testConversions() {
/* Note: these are rather implementation-oriented tests. Implementation changes in
ImageUtilities (addition or removal of caches etc.) might require this test to be
@@ -275,18 +287,18 @@ public class ImageUtilitiesTest extends TestCase {
/* An Icon/Image loaded via loadImage can be freely passed through icon2Image/image2Icon
without a new instance being created. */
- assertEquals("Should be same instance",
+ assertSame("Should be same instance",
image,
icon2Image(imageIcon));
- assertEquals("Should be same instance",
+ assertSame("Should be same instance",
icon2Image(imageIcon),
icon2Image(imageIcon));
if (!useExternalImage) {
/* In the useExternalImage case, the original instance will be converted to a
ToolTipImage, so we won't have the same instance here. */
- assertEquals("Should be same instance",
+ assertSame("Should be same instance",
image,
icon2Image(image2Icon(image)));
}
@@ -298,12 +310,12 @@ public class ImageUtilitiesTest extends TestCase {
image2Icon(icon2Image(imageIcon)));
Icon iconFromImage2Icon = image2Icon(image);
- assertEquals("Should be same instance",
+ assertSame("Should be same instance",
iconFromImage2Icon,
image2Icon(icon2Image(iconFromImage2Icon)));
Icon iconFromImageIconRoundabout = image2Icon(icon2Image(imageIcon));
- assertEquals("Should be same instance",
+ assertSame("Should be same instance",
iconFromImageIconRoundabout,
image2Icon(icon2Image(iconFromImageIconRoundabout)));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists