You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ma...@apache.org on 2019/05/01 09:15:08 UTC

[netbeans] branch master updated: [NETBEANS-2274] Remove special casing of JComboBox handling in language chooser

This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b50603  [NETBEANS-2274] Remove special casing of JComboBox handling in language chooser
     new c8dfa3d  Merge pull request #1208 from matthiasblaesing/netbeans-2274
0b50603 is described below

commit 0b50603f2963c2ced35eca2b1aefe799e28be95e
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Sun Apr 21 22:43:57 2019 +0200

    [NETBEANS-2274] Remove special casing of JComboBox handling in language chooser
    
    In the Options Dialog, the Panel "Fonts & Colors" and there the subpanel
    Syntax Pane relies on undocumented ActionEvent#getModifiers behavior.
    
    The currently choosen language is only updated when:
    
    - the new language is acknowledged with a space/enter keypress
    - or choosen with a left mouse click
    
    Two problems:
    1. The language in the combobox and the currently select language can
       drift apart. (use only cursor keys to change selection)
    2. On Ubuntu Linux (OpenJDK 1.8u191) it was observed, that the
       undocumented behaviour, the action handler relied on, was not
       present.
    
    Both problems are solved by using the default behaviour of the JComboBox:
    
    Everytime the selection changes and action event is fired, regardless
    of the source of the selection change.
---
 .../modules/options/colors/SyntaxColoringPanel.java        | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/ide/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java b/ide/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
index 380c84a..0c434e8 100644
--- a/ide/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
+++ b/ide/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java
@@ -26,10 +26,8 @@ import java.awt.Font;
 import java.awt.Insets;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.awt.event.InputEvent;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
-import java.awt.event.KeyEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyEditor;
@@ -121,14 +119,6 @@ public class SyntaxColoringPanel extends JPanel implements ActionListener,
         cbEffectColor.getAccessibleContext ().setAccessibleName (loc ("AN_Efects_Color"));
         cbEffectColor.getAccessibleContext ().setAccessibleDescription (loc ("AD_Efects_Color"));
         cbLanguage.addActionListener (this);
-        cbLanguage.addKeyListener(new java.awt.event.KeyAdapter() {
-            @Override
-            public void keyReleased(KeyEvent evt) {
-                if (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_SPACE) {
-                    updateLanguageCombobox();
-                }
-            }
-        });
         lCategories.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
         lCategories.setVisibleRowCount (3);
         lCategories.setCellRenderer (new CategoryRenderer ());
@@ -369,9 +359,7 @@ public class SyntaxColoringPanel extends JPanel implements ActionListener,
             updateData ();
 	} else
 	if (evt.getSource () == cbLanguage) {
-            if(evt.getModifiers() == InputEvent.BUTTON1_MASK) { // mouse clicked
-                updateLanguageCombobox();
-            }
+            updateLanguageCombobox();
 	} else
         if (evt.getSource () == bFont) {
             PropertyEditor pe = PropertyEditorManager.findEditor (Font.class);


---------------------------------------------------------------------
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