This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 38542

Summary: Problems w/ new Action.iconBase w.r.t. localization and file extension
Product: platform Reporter: Jesse Glick <jglick>
Component: ActionsAssignee: David Strupl <dstrupl>
Status: VERIFIED FIXED    
Severity: blocker CC: apireviews
Priority: P2    
Version: 3.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 32256    

Description Jesse Glick 2004-01-08 14:00:44 UTC
Sorry for the late notice, but I just realized a
couple of things wrong with how issue #32256 is
implemented - hopefully not hard to fix. As it
stands, the impl (and I guess the API) forces you
to use GIFs for icons, or at least images named
*.gif. But GIF is sort of a deprecated image
format; PNG is better for the future, generally.
We should definitely ensure that everything
supports PNGs.

SystemAction.iconResource takes a full image path
with extension so it is clean. But the 'iconBase'
attr on Action does not. IMHO it should include
the extension, and when computing variants, insert
their suffixes before the last '.' (as is normal
for localized & branded variants of resources, too
- see e.g. nbres URL protocol).

See issue #32102 for more background. Actions,
like SystemAction, is already using the variant of
Utilities.loadImage that autolocalizes the image,
so this is not a problem (I think).

Currently it seems that a SystemAction specifying
an iconResource of foo/bar.png will wind up with
*no* icon, as Actions will try to load
foo/bar.gif. This is definitely a bug (regression).

Also it seems that Actions.updateButtonIcon first
calls button.setIcon with a SMALL_ICON, *then*
checks for iconBase and possibly calls setIcon
again - you should avoid calling setIcon twice.
This will be the normal case since SystemAction
would (I guess) return non-null for both keys.
Decide which one takes precedence and use it.
Comment 1 David Strupl 2004-01-08 21:36:36 UTC
Fixed in the trunk:

Checking in arch/arch-openide-actions.xml;
/cvs/openide/arch/arch-openide-actions.xml,v  <-- 
arch-openide-actions.xml
new revision: 1.21; previous revision: 1.20
done
Processing log script arguments...
More commits to come...
Checking in src/org/openide/awt/Actions.java;
/cvs/openide/src/org/openide/awt/Actions.java,v  <--  Actions.java
new revision: 1.89; previous revision: 1.88
done
Processing log script arguments...
More commits to come...
Checking in src/org/openide/util/actions/SystemAction.java;
/cvs/openide/src/org/openide/util/actions/SystemAction.java,v  <-- 
SystemAction.java
new revision: 1.72; previous revision: 1.71
done
Processing log script arguments...
More commits to come...
Checking in test/unit/src/org/openide/awt/ActionsTest.java;
/cvs/openide/test/unit/src/org/openide/awt/ActionsTest.java,v  <-- 
ActionsTest.java
new revision: 1.2; previous revision: 1.1
done
Processing log script arguments...
Mailing the commit message to cvs@openide.netbeans.org (from
dstrupl@netbeans.org)
Comment 2 Lukas Hasik 2004-02-26 17:10:25 UTC
unit test included -> verified