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.

View | Details | Raw Unified | Return to bug 208081
Collapse All | Expand All

(-)a/openide.awt/arch.xml (+10 lines)
Lines 478-483 Link Here
478
        of this key include <code>default</code>, <code>never</code> or <code>always</code>.
478
        of this key include <code>default</code>, <code>never</code> or <code>always</code>.
479
     </api>
479
     </api>
480
    </li>
480
    </li>
481
    <li>
482
     <api name="ICONS_IN_POPUP" category="stable" type="export" group="branding">
483
        There is a way to enable icons in popup menu items created via
484
        <a href="@TOP@/org/openide/awt/Actions.html">Actions</a> factory methods
485
        in your own application build on top of NetBeans Platform.
486
        Just provide branding for <code>org/openide/awt/Bundle.properties</code>
487
        file and modify <code>ICONS_IN_POPUP=always</code>. Other possible values
488
        of this key include <code>default</code>, <code>never</code> or <code>always</code>.
489
     </api>
490
    </li>
481
  </ul>
491
  </ul>
482
 </answer>
492
 </answer>
483
493
(-)a/openide.awt/src/org/openide/awt/Actions.java (-1 / +14 lines)
Lines 1195-1200 Link Here
1195
    private static class MenuBridge extends ButtonBridge {
1195
    private static class MenuBridge extends ButtonBridge {
1196
        /** behave like menu or popup */
1196
        /** behave like menu or popup */
1197
        private boolean popup;
1197
        private boolean popup;
1198
        private final boolean showIconInPopup = showIconsInPopup();
1198
1199
1199
        /** Constructor.
1200
        /** Constructor.
1200
        * @param popup pop-up menu
1201
        * @param popup pop-up menu
Lines 1213-1218 Link Here
1213
            }
1214
            }
1214
        }
1215
        }
1215
1216
1217
        private boolean showIconsInPopup() {
1218
            String msg = NbBundle.getMessage(Actions.class, "ICONS_IN_POPUP"); // NOI18N
1219
            if ("always".equals(msg)) { // NOI18N
1220
                return true;
1221
            } else if ("never".equals(msg)) { // NOI18N
1222
                return false;
1223
            } else {
1224
                assert "default".equals(msg); // NOI18N
1225
                return false;
1226
            }
1227
        }
1228
1216
        protected @Override void prepare() {
1229
        protected @Override void prepare() {
1217
            if (popup) {
1230
            if (popup) {
1218
                // popups generally get no hierarchy events, yet we need to listen to other changes
1231
                // popups generally get no hierarchy events, yet we need to listen to other changes
Lines 1238-1244 Link Here
1238
                updateKey((JMenuItem) comp, action);
1251
                updateKey((JMenuItem) comp, action);
1239
            }
1252
            }
1240
1253
1241
            if (!popup) {
1254
            if (!popup || showIconInPopup) {
1242
                if (
1255
                if (
1243
                    (changedProperty == null) || changedProperty.equals(SystemAction.PROP_ICON) ||
1256
                    (changedProperty == null) || changedProperty.equals(SystemAction.PROP_ICON) ||
1244
                        changedProperty.equals(Action.SMALL_ICON) || changedProperty.equals("iconBase")
1257
                        changedProperty.equals(Action.SMALL_ICON) || changedProperty.equals("iconBase")
(-)a/openide.awt/src/org/openide/awt/Bundle.properties (+1 lines)
Lines 125-127 Link Here
125
# either: default, never or always
125
# either: default, never or always
126
#NOI18N
126
#NOI18N
127
USE_MNEMONICS=default
127
USE_MNEMONICS=default
128
ICONS_IN_POPUP=default
(-)a/openide.awt/test/unit/src/org/openide/awt/ActionsTest.java (+26 lines)
Lines 49-54 Link Here
49
import java.awt.event.ActionEvent;
49
import java.awt.event.ActionEvent;
50
import java.awt.event.KeyEvent;
50
import java.awt.event.KeyEvent;
51
import java.awt.image.BufferedImage;
51
import java.awt.image.BufferedImage;
52
import java.util.Locale;
52
import javax.swing.AbstractAction;
53
import javax.swing.AbstractAction;
53
import javax.swing.AbstractButton;
54
import javax.swing.AbstractButton;
54
import javax.swing.Action;
55
import javax.swing.Action;
Lines 306-311 Link Here
306
    }
307
    }
307
    
308
    
308
    /**
309
    /**
310
     * #208081
311
     */
312
    public void testIconInPopup() {
313
        Locale.setDefault(new Locale("ic", "ON"));
314
        Action action = new TestAction();
315
        JMenuItem menuItem = new JMenuItem();
316
        Actions.connect(menuItem, action, true);
317
        Icon icon = menuItem.getIcon();
318
        assertNotNull(icon);
319
        checkIfLoadedCorrectIcon(icon, menuItem, 0, "Enabled icon");
320
    }
321
322
    /**
323
     * #208081
324
     */
325
    public void testNoIconInPopup() {
326
        Locale.setDefault(new Locale("ic", "OF"));
327
        Action action = new TestAction();
328
        JMenuItem menuItem = new JMenuItem();
329
        Actions.connect(menuItem, action, true);
330
        Icon icon = menuItem.getIcon();
331
        assertNull(icon);
332
    }
333
    
334
    /**
309
     * Test whether pressed, rollover and disabled 24x24 icons
335
     * Test whether pressed, rollover and disabled 24x24 icons
310
     * work for SystemAction.
336
     * work for SystemAction.
311
     */
337
     */
(-)a/openide.awt/test/unit/src/org/openide/awt/Bundle_ic_OF.properties (+41 lines)
Line 0 Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 2011 Oracle and/or its affiliates. All rights reserved.
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
7
#
8
# The contents of this file are subject to the terms of either the GNU
9
# General Public License Version 2 only ("GPL") or the Common
10
# Development and Distribution License("CDDL") (collectively, the
11
# "License"). You may not use this file except in compliance with the
12
# License. You can obtain a copy of the License at
13
# http://www.netbeans.org/cddl-gplv2.html
14
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
# specific language governing permissions and limitations under the
16
# License.  When distributing the software, include this License Header
17
# Notice in each file and include the License file at
18
# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
19
# particular file as subject to the "Classpath" exception as provided
20
# by Oracle in the GPL Version 2 section of the License file that
21
# accompanied this code. If applicable, add the following below the
22
# License Header, with the fields enclosed by brackets [] replaced by
23
# your own identifying information:
24
# "Portions Copyrighted [year] [name of copyright owner]"
25
#
26
# If you wish your version of this file to be governed by only the CDDL
27
# or only the GPL Version 2, indicate your decision by adding
28
# "[Contributor] elects to include this software in this distribution
29
# under the [CDDL or GPL Version 2] license." If you do not indicate a
30
# single choice of license, a recipient has the option to distribute
31
# your version of this file under either the CDDL, the GPL Version 2 or
32
# to extend the choice of license to its licensees as provided above.
33
# However, if you add GPL Version 2 code and therefore, elected the GPL
34
# Version 2 license, then the option applies only if the new code is
35
# made subject to such option by the copyright holder.
36
#
37
# Contributor(s):
38
#
39
# Portions Copyrighted 2011 Sun Microsystems, Inc.
40
41
ICONS_IN_POPUP=never
(-)a/openide.awt/test/unit/src/org/openide/awt/Bundle_ic_ON.properties (+41 lines)
Line 0 Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 2011 Oracle and/or its affiliates. All rights reserved.
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
7
#
8
# The contents of this file are subject to the terms of either the GNU
9
# General Public License Version 2 only ("GPL") or the Common
10
# Development and Distribution License("CDDL") (collectively, the
11
# "License"). You may not use this file except in compliance with the
12
# License. You can obtain a copy of the License at
13
# http://www.netbeans.org/cddl-gplv2.html
14
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
# specific language governing permissions and limitations under the
16
# License.  When distributing the software, include this License Header
17
# Notice in each file and include the License file at
18
# nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
19
# particular file as subject to the "Classpath" exception as provided
20
# by Oracle in the GPL Version 2 section of the License file that
21
# accompanied this code. If applicable, add the following below the
22
# License Header, with the fields enclosed by brackets [] replaced by
23
# your own identifying information:
24
# "Portions Copyrighted [year] [name of copyright owner]"
25
#
26
# If you wish your version of this file to be governed by only the CDDL
27
# or only the GPL Version 2, indicate your decision by adding
28
# "[Contributor] elects to include this software in this distribution
29
# under the [CDDL or GPL Version 2] license." If you do not indicate a
30
# single choice of license, a recipient has the option to distribute
31
# your version of this file under either the CDDL, the GPL Version 2 or
32
# to extend the choice of license to its licensees as provided above.
33
# However, if you add GPL Version 2 code and therefore, elected the GPL
34
# Version 2 license, then the option applies only if the new code is
35
# made subject to such option by the copyright holder.
36
#
37
# Contributor(s):
38
#
39
# Portions Copyrighted 2011 Sun Microsystems, Inc.
40
41
ICONS_IN_POPUP=always

Return to bug 208081