[hg] main-silver: #221379 - Cannot select single inspection only...

  • From: Roman Svitanic < >
  • To:
  • Subject: [hg] main-silver: #221379 - Cannot select single inspection only...
  • Date: Mon, 01 Jul 2013 07:11:24 -0700

changeset 19a0a5c6aa2a in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/19a0a5c6aa2a
description:
        #221379 - Cannot select single inspection only by keyboard

diffstat:

 code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java |  34 
++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diffs (51 lines):

diff --git 
a/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java 
b/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java
--- a/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java
+++ b/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java
@@ -50,6 +50,8 @@
 import java.awt.Insets;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
 import java.beans.BeanInfo;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -282,6 +284,38 @@
                 }
             }
         });
+
+        inspectionCombo.addKeyListener(new KeyAdapter() {
+            @Override
+            public void keyPressed(KeyEvent e) {
+                int direction = 1;
+                switch (e.getKeyCode()) {
+                    case KeyEvent.VK_DOWN:
+                        direction = 1;
+                        break;
+                    case KeyEvent.VK_UP:
+                        direction = -1;
+                        break;
+                }
+                int currentIndex = inspectionCombo.getSelectedIndex() + 
direction;
+                Object tempItem = inspectionCombo.getItemAt(currentIndex);
+                if (tempItem instanceof AnalyzerAndWarning) {
+                    return;
+                } else {
+                    currentIndex += direction;
+                }
+                Object nextItem = inspectionCombo.getItemAt(currentIndex);
+                while (!(nextItem instanceof AnalyzerAndWarning)) {
+                    currentIndex += direction;
+                    nextItem = inspectionCombo.getItemAt(currentIndex);
+                    if (nextItem == null) {
+                        return;
+                    }
+                }
+                inspectionCombo.setSelectedItem((AnalyzerAndWarning) 
nextItem);
+                e.consume();
+            }
+        });
     }
 
     void started() {

[hg] main-silver: #221379 - Cannot select single inspection only...

Roman Svitanic 07/01/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 348 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close