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

mbien 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 3917a2a04e Updated test results window and test coverage bar
     new 8d2aec2a82 Merge pull request #6695 from mbien/test-window-update
3917a2a04e is described below

commit 3917a2a04e5af314b9b21e754c5097e05b2fcd90
Author: Michael Bien <[email protected]>
AuthorDate: Tue Nov 14 07:05:09 2023 +0100

    Updated test results window and test coverage bar
    
     - flat look without gradients + new in-progress animation
     - visual indication that the stacktrace links are clickable
     - uninteresting stack frames (e.g from the junit testing framework)
       are grayed out and not underscored
     - increased initial width of tree component via splitter location
     - added BUILD SUCCESS output line coloring, analog to failure msg
     - minor code cleanup in the touched files
---
 .../modules/gsf/codecoverage/CoverageBar.java      | 171 +++------------------
 .../modules/gsf/testrunner/ui/ResultBar.java       | 138 +++++------------
 .../modules/gsf/testrunner/ui/ResultPanelTree.java |  10 +-
 .../modules/gsf/testrunner/ui/ResultTreeView.java  |   2 +
 .../modules/gsf/testrunner/ui/StatisticsPanel.java |  73 +++------
 .../gsf/testrunner/ui/TestRunnerSettings.java      |   2 +-
 .../junit/ui/api/JUnitCallstackFrameNode.java      |  40 ++++-
 .../modules/junit/ui/api/JUnitTestMethodNode.java  |   1 +
 .../modules/junit/ui/wizards/JavaChildren.java     |   1 -
 .../maven/output/GlobalOutputProcessor.java        |  30 ++--
 10 files changed, 136 insertions(+), 332 deletions(-)

diff --git 
a/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageBar.java
 
b/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageBar.java
index 82ba678633..9250cabb01 100644
--- 
a/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageBar.java
+++ 
b/ide/gsf.codecoverage/src/org/netbeans/modules/gsf/codecoverage/CoverageBar.java
@@ -18,22 +18,15 @@
  */
 package org.netbeans.modules.gsf.codecoverage;
 
-import java.awt.AlphaComposite;
 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.FontMetrics;
-import java.awt.GradientPaint;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Insets;
-import java.awt.Rectangle;
 import java.awt.event.HierarchyEvent;
-import java.awt.event.HierarchyListener;
 import java.awt.event.MouseEvent;
-import java.awt.image.BufferedImage;
-import java.awt.image.ConvolveOp;
-import java.awt.image.Kernel;
 import javax.swing.JComponent;
 import javax.swing.JLabel;
 import javax.swing.ToolTipManager;
@@ -50,10 +43,9 @@ import org.openide.awt.GraphicsUtils;
  */
 public class CoverageBar extends JComponent {
 
-    private static final Color NOT_COVERED_LIGHT = new Color(255, 160, 160);
-    private static final Color NOT_COVERED_DARK = new Color(180, 50, 50);
-    private static final Color COVERED_LIGHT = new Color(160, 255, 160);
-    private static final Color COVERED_DARK = new Color(30, 180, 30);
+    private static final Color TEXT_COLOR = Color.WHITE;
+    private static final Color NOT_COVERED_COLOR = new Color(180, 50, 50);
+    private static final Color COVERED_COLOR = new Color(30, 180, 30);
     private boolean emphasize;
     private boolean selected;
     /**
@@ -66,15 +58,12 @@ public class CoverageBar extends JComponent {
     private int inferredLines;
 
     public CoverageBar() {
-        addHierarchyListener(new HierarchyListener() {
-            @Override
-            public void hierarchyChanged(HierarchyEvent e) {
-                if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 
0) {
-                    if (isShowing()) {
-                        
ToolTipManager.sharedInstance().registerComponent(CoverageBar.this);
-                    } else {
-                        
ToolTipManager.sharedInstance().unregisterComponent(CoverageBar.this);
-                    }
+        addHierarchyListener((HierarchyEvent e) -> {
+            if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
+                if (isShowing()) {
+                    
ToolTipManager.sharedInstance().registerComponent(CoverageBar.this);
+                } else {
+                    
ToolTipManager.sharedInstance().unregisterComponent(CoverageBar.this);
                 }
             }
         });
@@ -147,61 +136,31 @@ public class CoverageBar extends JComponent {
             return;
         }
 
+        // for font anti aliasing
+        GraphicsUtils.configureDefaultRenderingHints(g);
+
         int amountFull = (int) (barRectWidth * coveragePercentage / 100.0f);
 
         Graphics2D g2 = (Graphics2D) g;
 
         g2.setColor(getBackground());
 
-        Color notCoveredLight = NOT_COVERED_LIGHT;
-        Color notCoveredDark = NOT_COVERED_DARK;
-        Color coveredLight = COVERED_LIGHT;
-        Color coveredDark = COVERED_DARK;
-        if (emphasize) {
-            coveredDark = coveredDark.darker();
-        } else if (selected) {
-            coveredLight = coveredLight.brighter();
+        Color notCoveredDark = NOT_COVERED_COLOR;
+        Color coveredDark = COVERED_COLOR;
+        if (emphasize || selected) {
             coveredDark = coveredDark.darker();
-        }
-        if (emphasize) {
-            notCoveredDark = notCoveredDark.darker();
-        } else if (selected) {
-            notCoveredLight = notCoveredLight.brighter();
             notCoveredDark = notCoveredDark.darker();
         }
 
-        g2.setPaint(new GradientPaint(0, 0, notCoveredLight,
-            0, height / 2, notCoveredDark));
-        g2.fillRect(amountFull, 1, width - 1, height / 2);
-        g2.setPaint(new GradientPaint(0, height / 2, notCoveredDark,
-            0, 2 * height, notCoveredLight));
-        g2.fillRect(amountFull, height / 2, width - 1, height / 2);
-
-        g2.setColor(getForeground());
+        g2.setPaint(notCoveredDark);
+        g2.fillRect(amountFull, 1, width - 1, height - 1);
 
-        g2.setPaint(new GradientPaint(0, 0, coveredLight,
-            0, height / 2, coveredDark));
-        g2.fillRect(1, 1, amountFull, height / 2);
-        g2.setPaint(new GradientPaint(0, height / 2, coveredDark,
-            0, 2 * height, coveredLight));
-        g2.fillRect(1, height / 2, amountFull, height / 2);
-
-        Rectangle oldClip = g2.getClipBounds();
         if (coveragePercentage > 0.0f) {
             g2.setColor(coveredDark);
-            g2.clipRect(0, 0, amountFull + 1, height);
-            g2.drawRect(0, 0, width - 1, height - 1);
-        }
-        if (coveragePercentage < 100.0f) {
-            g2.setColor(notCoveredDark);
-            g2.setClip(oldClip);
-            g2.clipRect(amountFull, 0, width, height);
-            g2.drawRect(0, 0, width - 1, height - 1);
+            g2.fillRect(1, 1, amountFull, height - 1);
         }
-        g2.setClip(oldClip);
 
-        g2.setFont(getFont());
-        paintDropShadowText(g2, barRectWidth, barRectHeight);
+        paintText(g2, barRectWidth, barRectHeight);
     }
 
     @Override
@@ -240,104 +199,18 @@ public class CoverageBar extends JComponent {
         return pref;
     }
 
-    //@Override JDK6
     @Override
     public int getBaseline(int w, int h) {
         FontMetrics fm = getFontMetrics(getFont());
         return h - fm.getDescent() - ((h - fm.getHeight()) / 2);
     }
 
-    
///////////////////////////////////////////////////////////////////////////////
-    // The following code is related to painting drop-shadow text. It is
-    // directly based on code in openide.actions/**/HeapView.java by Scott 
Violet.
-    
///////////////////////////////////////////////////////////////////////////////
-    /**
-     * Image containing text.
-     */
-    private BufferedImage textImage;
-    /**
-     * Image containing the drop shadow.
-     */
-    private BufferedImage dropShadowImage;
-    /**
-     * Color for the text before blurred.
-     */
-    private static final Color TEXT_BLUR_COLOR = Color.WHITE;
-    /**
-     * Color for text drawn on top of blurred text.
-     */
-    private static final Color TEXT_COLOR = Color.WHITE;
-    /**
-     * Size used for Kernel used to generate drop shadow.
-     */
-    private static final int KERNEL_SIZE = 3;
-    /**
-     * Factor used for Kernel used to generate drop shadow.
-     */
-    private static final float BLUR_FACTOR = 0.1f;
-    /**
-     * How far to shift the drop shadow along the horizontal axis.
-     */
-    private static final int SHIFT_X = 0;
-    /**
-     * How far to shift the drop shadow along the vertical axis.
-     */
-    private static final int SHIFT_Y = 1;
-    /**
-     * Used to generate drop shadown.
-     */
-    private ConvolveOp blur;
-
-    /**
-     * Renders the text using a drop shadow.
-     */
-    private void paintDropShadowText(Graphics g, int w, int h) {
-        if (textImage == null) {
-            textImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
-            dropShadowImage = new BufferedImage(w, h, 
BufferedImage.TYPE_INT_ARGB);
-        }
-        // Step 1: render the text.
-        Graphics2D textImageG = textImage.createGraphics();
-        textImageG.setComposite(AlphaComposite.Clear);
-        textImageG.fillRect(0, 0, w, h);
-        textImageG.setComposite(AlphaComposite.SrcOver);
-        textImageG.setColor(TEXT_BLUR_COLOR);
-        paintText(textImageG, w, h);
-        textImageG.dispose();
-
-        // Step 2: copy the image containing the text to dropShadowImage using
-        // the blur effect, which generates a nice drop shadow.
-        Graphics2D blurryImageG = dropShadowImage.createGraphics();
-        blurryImageG.setComposite(AlphaComposite.Clear);
-        blurryImageG.fillRect(0, 0, w, h);
-        blurryImageG.setComposite(AlphaComposite.SrcOver);
-        if (blur == null) {
-            // Configure structures needed for rendering drop shadow.
-            int kw = KERNEL_SIZE, kh = KERNEL_SIZE;
-            float blurFactor = BLUR_FACTOR;
-            float[] kernelData = new float[kw * kh];
-            for (int i = 0; i < kernelData.length; i++) {
-                kernelData[i] = blurFactor;
-            }
-            blur = new ConvolveOp(new Kernel(kw, kh, kernelData));
-        }
-        blurryImageG.drawImage(textImage, blur, SHIFT_X, SHIFT_Y);
+    private void paintText(Graphics g, int w, int h) {
         if (emphasize) {
-            blurryImageG.setColor(Color.YELLOW);
+            g.setColor(Color.YELLOW);
         } else {
-            blurryImageG.setColor(TEXT_COLOR);
+            g.setColor(TEXT_COLOR);
         }
-        blurryImageG.setFont(getFont());
-
-        // Step 3: render the text again on top.
-        paintText(blurryImageG, w, h);
-        blurryImageG.dispose();
-
-        // And finally copy it.
-        g.drawImage(dropShadowImage, 0, 0, null);
-    }
-
-    private void paintText(Graphics g, int w, int h) {
         g.setFont(getFont());
         String text = getString();
         FontMetrics fm = g.getFontMetrics();
diff --git 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultBar.java
 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultBar.java
index 01c77cab64..bb99c7a4c0 100644
--- 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultBar.java
+++ 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultBar.java
@@ -24,7 +24,6 @@ import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.FontMetrics;
-import java.awt.GradientPaint;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Insets;
@@ -48,21 +47,18 @@ import org.openide.awt.GraphicsUtils;
  * I was initially using a JProgressBar, with the BasicProgressBarUI 
associated with it
  * (to get red/green colors set correctly even on OSX), but it was pretty plain
  * and ugly looking - no nice gradients etc. Hence this component.
- * @todo Add a getBaseline
  *
  * @author Tor Norbye
  */
-public final class ResultBar extends JComponent implements ActionListener{
-    private static final Color NOT_COVERED_LIGHT = new Color(255, 160, 160);
-    private static final Color NOT_COVERED_DARK = new Color(180, 50, 50);
-    private static final Color COVERED_LIGHT = new Color(160, 255, 160);
-    private static final Color COVERED_DARK = new Color(30, 180, 30);
-    private static final Color NO_TESTS_LIGHT = new Color(200, 200, 200);
-    private static final Color NO_TESTS_DARK = new Color(110, 110, 110);
-    private static final Color ABORTED_TESTS_LIGHT = new Color(246, 232, 206);
-    private static final Color ABORTED_TESTS_DARK = new Color(214, 157, 41);
-    private boolean emphasize;
-    private boolean selected;
+public final class ResultBar extends JComponent implements ActionListener {
+
+    private static final Color NOT_COVERED_COLOR = new Color(180, 50, 50);
+    private static final Color COVERED_COLOR = new Color(30, 180, 30);
+    private static final Color NO_TESTS_COLOR = new Color(110, 110, 110);
+    private static final Color ABORTED_TESTS_COLOR = new Color(214, 157, 41);
+    private static final Color TEXT_COLOR = new Color(255, 255, 255);
+    private static final Color ANIMATION_COLOR = new Color(190, 190, 190);
+
     /** Passed tests percentage:  0.0f <= x <= 100f */
     private float passedPercentage = 0.0f;
     /** Skipped tests percentage:  0.0f <= x <= 100f */
@@ -70,8 +66,8 @@ public final class ResultBar extends JComponent implements 
ActionListener{
     /** Aborted tests percentage:  0.0f <= x <= 100f */
     private float abortedPercentage = 0.0f;
 
-    private Timer timer = new Timer(100, this);
-    private int phase = 1;
+    private final Timer timer = new Timer(100, this);
+    private final long startTime;
     private boolean passedReported = false;
     private boolean skippedReported = false;
     private boolean abortedReported = false;
@@ -79,14 +75,16 @@ public final class ResultBar extends JComponent implements 
ActionListener{
     public ResultBar() {
         updateUI();
         timer.start();
+        startTime = System.currentTimeMillis();
     }
 
     public void stop(){
         timer.stop();
+        repaint();
     }
 
+    @Override
     public void actionPerformed(ActionEvent e) {
-        phase = (phase < getHeight()-1) ? phase + 1 : 1;
         repaint();
     }
 
@@ -95,48 +93,23 @@ public final class ResultBar extends JComponent implements 
ActionListener{
     }
 
     public void setPassedPercentage(float passedPercentage) {
-        if(Float.isNaN(passedPercentage)) { // #167230
-            passedPercentage = 0.0f;
-        }
-        this.passedPercentage = passedPercentage;
+        this.passedPercentage = Float.isNaN(passedPercentage) ? 0.0f : 
passedPercentage; // #167230
         this.passedReported = true;
         repaint();
     }
 
     public void setSkippedPercentage(float skippedPercentage) {
-        if(Float.isNaN(skippedPercentage)) { // #167230
-            skippedPercentage = 0.0f;
-        }
-        this.skippedPercentage = skippedPercentage;
+        this.skippedPercentage = Float.isNaN(skippedPercentage) ? 0.0f : 
skippedPercentage; // #167230
         this.skippedReported = true;
         repaint();
     }
 
     public void setAbortedPercentage(float abortedPercentage) {
-        if(Float.isNaN(abortedPercentage)) { // #167230
-            abortedPercentage = 0.0f;
-        }
-        this.abortedPercentage = abortedPercentage;
+        this.abortedPercentage = Float.isNaN(abortedPercentage) ? 0.0f : 
abortedPercentage; // #167230
         this.abortedReported = true;
         repaint();
     }
 
-    public boolean isSelected() {
-        return selected;
-    }
-
-    public void setSelected(boolean selected) {
-        this.selected = selected;
-    }
-
-    public boolean isEmphasize() {
-        return emphasize;
-    }
-
-    public void setEmphasize(boolean emphasize) {
-        this.emphasize = emphasize;
-    }
-
     private String getString() {
         // #183996 (PHP project) requires to use the format "%.2f".
         // It lets to have not rounding a value if number of tests <= 10000
@@ -169,74 +142,43 @@ public final class ResultBar extends JComponent 
implements ActionListener{
         GraphicsUtils.configureDefaultRenderingHints(g);
 
         int width = getWidth();
-        int barRectWidth = width;
         int height = getHeight();
-        int barRectHeight = height;
 
-        if (barRectWidth <= 0 || barRectHeight <= 0) {
+        if (width <= 0 || height <= 0) {
             return;
         }
 
-        int amountFull = (int) (barRectWidth * passedPercentage / 100.0f);
-        int amountSkip = (int) (barRectWidth * skippedPercentage / 100.0f);
-        int amountAbort = (int) (barRectWidth * abortedPercentage / 100.0f);
-        int amountFail = Math.abs(barRectWidth - amountFull - amountSkip - 
amountAbort);
-        if(amountFail <= 1) {
-            amountFail = 0;
-        }
-
-        Color notCoveredLight = NOT_COVERED_LIGHT;
-        Color notCoveredDark = NOT_COVERED_DARK;
-        Color coveredLight = COVERED_LIGHT;
-        Color coveredDark = COVERED_DARK;
-        Color noTestsLight = NO_TESTS_LIGHT;
-        Color noTestsDark = NO_TESTS_DARK;
-        Color abortedTestsLight = ABORTED_TESTS_LIGHT;
-        Color abortedTestsDark = ABORTED_TESTS_DARK;
-        if (emphasize) {
-            coveredDark = coveredDark.darker();
-            notCoveredDark = notCoveredDark.darker();
-            noTestsDark = noTestsDark.darker();
-            abortedTestsDark = abortedTestsDark.darker();
-        } else if (selected) {
-            coveredLight = coveredLight.brighter();
-            coveredDark = coveredDark.darker();
-            notCoveredLight = notCoveredLight.brighter();
-            notCoveredDark = notCoveredDark.darker();
-            noTestsLight = noTestsLight.brighter();
-            noTestsDark = noTestsDark.darker();
-            abortedTestsLight = abortedTestsLight.brighter();
-            abortedTestsDark = abortedTestsDark.darker();
-        }
         Graphics2D g2 = (Graphics2D) g;
         // running with no results yet -> gray
-        Color light = noTestsLight;
-        Color dark = noTestsDark;
+        Color fillColor = NO_TESTS_COLOR;
 
         if (abortedReported || skippedReported || passedReported) {
             // running with at least one result or finished
             if (passedPercentage == 100.0) {
                 // contains only successful tests -> green
-                light = coveredLight;
-                dark = coveredDark;
+                fillColor = COVERED_COLOR;
             } else if (abortedPercentage > 0.0) {
                 // contains aborted tests -> abort color
-                light = abortedTestsLight;
-                dark = abortedTestsDark;
+                fillColor = ABORTED_TESTS_COLOR;
             } else if(100.0f - passedPercentage - abortedPercentage - 
skippedPercentage > 0.0001) {
                 // contains failed tests -> red
-                light = notCoveredLight;
-                dark = notCoveredDark;
+                fillColor = NOT_COVERED_COLOR;
             } else if (skippedPercentage > 0.0) {
                 // contains ignored tests -> gray
-                light = noTestsLight;
-                dark = noTestsDark;
+                fillColor = NO_TESTS_COLOR;
             }
         }
-        g2.setPaint(new GradientPaint(0, phase, light, 0, phase + height / 2, 
dark, true));
-        g2.fillRect(0, 0, barRectWidth, height);
+        g2.setPaint(fillColor);
+        g2.fillRect(0, 0, width-1, height-1);
+
+        if (timer.isRunning()) {
+            g2.setPaint(ANIMATION_COLOR);
+            float step = (System.currentTimeMillis()-startTime) / 150.0f;
+            g2.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_SQUARE, 
BasicStroke.JOIN_MITER, 10.0f, new float[] {10.0f}, step));
+            g2.drawRect(2, 2, width-6, height-6);
+        }
 
-        paintText(g2, barRectWidth, barRectHeight);
+        paintText(g2, width, height);
     }
 
     @Override
@@ -252,8 +194,7 @@ public final class ResultBar extends JComponent implements 
ActionListener{
         if (stringWidth > size.width) {
             size.width = stringWidth;
         }
-        int stringHeight = fontSizer.getHeight() +
-                fontSizer.getDescent();
+        int stringHeight = fontSizer.getHeight() + fontSizer.getDescent();
         if (stringHeight > size.height) {
             size.height = stringHeight;
         }
@@ -277,14 +218,14 @@ public final class ResultBar extends JComponent 
implements ActionListener{
         return pref;
     }
 
-    //@Override JDK6
+    @Override
     public int getBaseline(int w, int h) {
         FontMetrics fm = getFontMetrics(getFont());
         return h - fm.getDescent() - ((h - fm.getHeight()) / 2);
     }
 
     /**
-     * Renders the text with a slightly contrasted outline.
+     * Renders the text.
      */
     private void paintText(Graphics2D g, int w, int h) {
         // Similar to org.openide.actions.HeapView.paintText.
@@ -295,13 +236,10 @@ public final class ResultBar extends JComponent 
implements ActionListener{
         Shape outline = gv.getOutline();
         Rectangle2D bounds = outline.getBounds2D();
         double x = Math.max(0, (w - bounds.getWidth()) / 2.0);
-        double y = h / 2.0 + fm.getAscent() / 2.0 - 1;
+        double y = h / 2.0 + fm.getAscent() / 2.0 - 2;
         AffineTransform oldTransform = g.getTransform();
         g.translate(x, y);
-        g.setColor(new Color(0, 0, 0, 100));
-        g.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_ROUND, 
BasicStroke.JOIN_ROUND));
-        g.draw(outline);
-        g.setColor(Color.WHITE);
+        g.setColor(TEXT_COLOR);
         g.fill(outline);
         g.setTransform(oldTransform);
     }
diff --git 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultPanelTree.java
 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultPanelTree.java
index 7d25f2b44e..adb812a7ea 100644
--- 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultPanelTree.java
+++ 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultPanelTree.java
@@ -72,7 +72,7 @@ final class ResultPanelTree extends JPanel implements 
ExplorerManager.Provider,
     private final ResultDisplayHandler displayHandler;
 
     private final ResultBar resultBar = new ResultBar();
-    private StatisticsPanel statPanel;
+    private final StatisticsPanel statPanel;
 
     ResultPanelTree(ResultDisplayHandler displayHandler, StatisticsPanel 
statPanel) {
         super(new BorderLayout());
@@ -248,6 +248,7 @@ final class ResultPanelTree extends JPanel implements 
ExplorerManager.Provider,
 
     /**
      */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (ExplorerManager.PROP_SELECTED_NODES.equals(
                         e.getPropertyName())) {
@@ -339,7 +340,7 @@ final class ResultPanelTree extends JPanel implements 
ExplorerManager.Provider,
     }
 
     private List<TestMethodNode> getFailedTestMethodNodes() {
-        List<TestMethodNode> result = new ArrayList<TestMethodNode>();
+        List<TestMethodNode> result = new ArrayList<>();
         for (Node each : 
explorerManager.getRootContext().getChildren().getNodes()) {
             if (each instanceof TestsuiteNode) {
                 TestsuiteNode suite = (TestsuiteNode) each;
@@ -362,8 +363,8 @@ final class ResultPanelTree extends JPanel implements 
ExplorerManager.Provider,
     }
 
     private List<TestsuiteNode> getFailedSuiteNodes(TestsuiteNode selected) {
-        List<TestsuiteNode> before = new ArrayList<TestsuiteNode>();
-        List<TestsuiteNode> after = new ArrayList<TestsuiteNode>();
+        List<TestsuiteNode> before = new ArrayList<>();
+        List<TestsuiteNode> after = new ArrayList<>();
         boolean selectedEncountered = false;
         for (Node each : 
explorerManager.getRootContext().getChildren().getNodes()) {
             if (each instanceof TestsuiteNode) {
@@ -511,6 +512,7 @@ final class ResultPanelTree extends JPanel implements 
ExplorerManager.Provider,
     }
     /**
      */
+    @Override
     public ExplorerManager getExplorerManager() {
         return explorerManager;
     }
diff --git 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultTreeView.java
 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultTreeView.java
index 1f92b3ba47..39d8a112b1 100644
--- 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultTreeView.java
+++ 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/ResultTreeView.java
@@ -68,6 +68,7 @@ final class ResultTreeView extends BeanTreeView implements 
Runnable {
      */
     private final class DelegatingTreeCellRenderer implements TreeCellRenderer 
{
 
+        @Override
         public Component getTreeCellRendererComponent(JTree tree,
                                                       Object value,
                                                       boolean selected,
@@ -126,6 +127,7 @@ final class ResultTreeView extends BeanTreeView implements 
Runnable {
     
     /**
      */
+    @Override
     public void run() {
         tree.setScrollsOnExpand(true);
     }
diff --git 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java
 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java
index 1e96f7189d..73b1acfff7 100644
--- 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java
+++ 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/StatisticsPanel.java
@@ -21,8 +21,6 @@ package org.netbeans.modules.gsf.testrunner.ui;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.util.List;
@@ -34,8 +32,6 @@ import javax.swing.JToggleButton;
 import javax.swing.JToolBar;
 import javax.swing.SwingConstants;
 import javax.swing.UIManager;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
 import org.netbeans.modules.gsf.testrunner.ui.api.Manager;
 import org.netbeans.modules.gsf.testrunner.api.Report;
 import org.netbeans.modules.gsf.testrunner.api.RerunHandler;
@@ -184,23 +180,20 @@ public final class StatisticsPanel extends JPanel {
        newButton.getAccessibleContext().setAccessibleName(accessibleName);
        boolean isSelected = 
NbPreferences.forModule(StatisticsPanel.class).getBoolean(property, false);
        newButton.setSelected(isSelected);
-       newButton.addItemListener(new ItemListener() {
-           @Override
-           public void itemStateChanged(ItemEvent e) {
-               boolean selected;
-               switch (e.getStateChange()) {
-                   case ItemEvent.SELECTED:
-                       selected = true;
-                       break;
-                   case ItemEvent.DESELECTED:
-                       selected = false;
-                       break;
-                   default:
-                       return;
-               }
-               ResultWindow.getInstance().updateOptionStatus(property, 
selected);
-           }
-       });
+       newButton.addItemListener((ItemEvent e) -> {
+            boolean selected;
+            switch (e.getStateChange()) {
+                case ItemEvent.SELECTED:
+                    selected = true;
+                    break;
+                case ItemEvent.DESELECTED:
+                    selected = false;
+                    break;
+                default:
+                    return;
+            }
+            ResultWindow.getInstance().updateOptionStatus(property, selected);
+        });
        return newButton;
     }
 
@@ -229,24 +222,9 @@ public final class StatisticsPanel extends JPanel {
 
         final RerunHandler rerunHandler = 
displayHandler.getSession().getRerunHandler();
         if (rerunHandler != null) {
-            rerunButton.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent e) {
-                    rerunHandler.rerun();
-                }
-            });
-            rerunFailedButton.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent e) {
-                    rerunHandler.rerun(treePanel.getFailedTests());
-                }
-            });
-            rerunHandler.addChangeListener(new ChangeListener() {
-                @Override
-                public void stateChanged(ChangeEvent e) {
-                    updateButtons();
-                }
-            });
+            rerunButton.addActionListener(e -> rerunHandler.rerun());
+            rerunFailedButton.addActionListener(e -> 
rerunHandler.rerun(treePanel.getFailedTests()));
+            rerunHandler.addChangeListener(e -> updateButtons());
             updateButtons();
         }
     }
@@ -356,24 +334,11 @@ public final class StatisticsPanel extends JPanel {
     private void createNextPrevFailureButtons() {
         nextFailure = new 
JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/gsf/testrunner/resources/nextmatch.png",
 true));
         nextFailure.setToolTipText(Bundle.MSG_NextFailure());
-        nextFailure.addActionListener(new ActionListener() {
-
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                selectNextFailure();
-            }
-        });
+        nextFailure.addActionListener(e -> selectNextFailure());
 
         previousFailure = new 
JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/gsf/testrunner/resources/prevmatch.png",
 true));
-
         previousFailure.setToolTipText(Bundle.MSG_PreviousFailure());
-        previousFailure.addActionListener(new ActionListener() {
-
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                selectPreviousFailure();
-            }
-        });
+        previousFailure.addActionListener(e -> selectPreviousFailure());
     }
 
     void selectPreviousFailure() {
diff --git 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/TestRunnerSettings.java
 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/TestRunnerSettings.java
index 04fc784c6c..4b2883a9a3 100644
--- 
a/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/TestRunnerSettings.java
+++ 
b/ide/gsf.testrunner.ui/src/org/netbeans/modules/gsf/testrunner/ui/TestRunnerSettings.java
@@ -33,7 +33,7 @@ public final class TestRunnerSettings {
     private static final String RESULTS_SPLITPANE_DIVIDER_HORIZONTAL = 
"resultsSplitDividerHorizontal"; //NOI18N
     private static final String RESULTS_SPLITPANE_ORIENTATION = 
"resultsSplitOrientation"; //NOI18N
     private static final int DEFAULT_DIVIDER_LOCATION_VERTICAL = 120;
-    private static final int DEFAULT_DIVIDER_LOCATION_HORIZONTAL = 300;
+    private static final int DEFAULT_DIVIDER_LOCATION_HORIZONTAL = 500;
     private static final int DEFAULT_DIVIDER_ORIENTATION = 
JSplitPane.HORIZONTAL_SPLIT;
 
     private static final TestRunnerSettings INSTANCE = new 
TestRunnerSettings();
diff --git 
a/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitCallstackFrameNode.java
 
b/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitCallstackFrameNode.java
index d4d0adcb5d..f8c5f42be5 100644
--- 
a/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitCallstackFrameNode.java
+++ 
b/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitCallstackFrameNode.java
@@ -19,10 +19,10 @@
 
 package org.netbeans.modules.junit.ui.api;
 
+import java.awt.Color;
 import org.netbeans.modules.java.testrunner.ui.api.JumpAction;
-import java.util.ArrayList;
-import java.util.List;
 import javax.swing.Action;
+import javax.swing.UIManager;
 import org.netbeans.modules.gsf.testrunner.ui.api.CallstackFrameNode;
 
 /**
@@ -41,12 +41,40 @@ public class JUnitCallstackFrameNode extends 
CallstackFrameNode{
 
     @Override
     public Action[] getActions(boolean context) {
-        List<Action> actions = new ArrayList<Action>();
         Action preferred = getPreferredAction();
-        if (preferred != null){
-            actions.add(preferred);
+        if (preferred != null) {
+            return new Action[] { preferred };
         }
-        return actions.toArray(new Action[actions.size()]);
+        return new Action[0];
+    }
+
+    @Override
+    public String getDisplayName() {
+        String line = super.getDisplayName();
+        String trimmed = line.trim();
+        if (trimmed.startsWith("at ") && line.endsWith(")")) {
+            return isRelevant(trimmed) ?
+                    "<html>    <a href=\"\">"+line+"</a></html>" 
+                  : "<html>    <font 
color="+hiddenColor()+">"+line+"</font></html>";
+        }
+        return line;
+    }
+
+    private static String hiddenColor() {
+        // note: the tree adjusts the color automatically if the contrast is 
too low
+        // which would have the opposite effect of what we are trying to 
achieve here
+        float a = 0.6f;
+        Color f = UIManager.getColor("Tree.foreground");
+        Color b = UIManager.getColor("Tree.background");
+        return String.format("#%02x%02x%02x", 
+                (int)(b.getRed()   + a * (f.getRed()   - b.getRed())),
+                (int)(b.getGreen() + a * (f.getGreen() - b.getGreen())),
+                (int)(b.getBlue()  + a * (f.getBlue()  - b.getBlue())));
+    }
+
+    private boolean isRelevant(String stackFrame) {
+        return !stackFrame.startsWith("at org.junit.Ass")
+            && !stackFrame.startsWith("at org.junit.jupiter.api.Ass");
     }
 
     @Override
diff --git 
a/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitTestMethodNode.java 
b/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitTestMethodNode.java
index 8d4368bf43..d8adde4f1c 100644
--- 
a/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitTestMethodNode.java
+++ 
b/java/junit.ui/src/org/netbeans/modules/junit/ui/api/JUnitTestMethodNode.java
@@ -52,6 +52,7 @@ public class JUnitTestMethodNode extends TestMethodNode {
         return new JumpAction(this, null, projectType, testingFramework);
     }
 
+    @Override
     public JUnitTestcase getTestcase() {
         return (JUnitTestcase) testcase;
     }
diff --git 
a/java/junit.ui/src/org/netbeans/modules/junit/ui/wizards/JavaChildren.java 
b/java/junit.ui/src/org/netbeans/modules/junit/ui/wizards/JavaChildren.java
index 5d1129186f..b884824eed 100644
--- a/java/junit.ui/src/org/netbeans/modules/junit/ui/wizards/JavaChildren.java
+++ b/java/junit.ui/src/org/netbeans/modules/junit/ui/wizards/JavaChildren.java
@@ -20,7 +20,6 @@
 package org.netbeans.modules.junit.ui.wizards;
 
 import org.openide.filesystems.FileObject;
-import org.openide.loaders.DataObject;
 import org.openide.nodes.Children;
 import org.openide.nodes.FilterNode;
 import org.openide.nodes.Node;
diff --git 
a/java/maven/src/org/netbeans/modules/maven/output/GlobalOutputProcessor.java 
b/java/maven/src/org/netbeans/modules/maven/output/GlobalOutputProcessor.java
index 059dc96793..cae0330e22 100644
--- 
a/java/maven/src/org/netbeans/modules/maven/output/GlobalOutputProcessor.java
+++ 
b/java/maven/src/org/netbeans/modules/maven/output/GlobalOutputProcessor.java
@@ -18,7 +18,6 @@
  */
 package org.netbeans.modules.maven.output;
 
-import java.awt.Color;
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -50,7 +49,6 @@ import org.openide.util.Exceptions;
 import org.openide.util.NbBundle.Messages;
 import org.openide.util.RequestProcessor;
 import org.openide.windows.IOColors;
-import org.openide.windows.InputOutput;
 import org.openide.windows.OutputEvent;
 import org.openide.windows.OutputListener;
 
@@ -60,7 +58,6 @@ import org.openide.windows.OutputListener;
  */
 public class GlobalOutputProcessor implements OutputProcessor {
     private static final String SECTION_SESSION = "session-execute"; //NOI18N
-    private static final String SECTION_PROJECT = "project-execute"; //NOI18N
     private static final Pattern LOW_MVN = Pattern.compile("(.*)Error 
resolving version for (.*): Plugin requires Maven version (.*)"); //NOI18N
     private static final Pattern HELP = Pattern.compile("(?:\\[ERROR\\] 
)?\\[Help \\d+\\] (https?://.+)"); // NOI18N
     /**
@@ -88,16 +85,22 @@ public class GlobalOutputProcessor implements 
OutputProcessor {
 
     @Messages("TXT_ChangeSettings=NetBeans: Click here to change your 
settings.")
     @Override public void processLine(String line, OutputVisitor visitor) {
+
         //silly prepend of  [INFO} to reuse the same regexp
         if (CommandLineOutputHandler.startPatternM3.matcher("[INFO] " + 
line).matches() || CommandLineOutputHandler.startPatternM2.matcher("[INFO] " + 
line).matches()) {
             visitor.setOutputType(IOColors.OutputType.LOG_DEBUG);
             return;
-        } 
-        if (line.startsWith("BUILD SUCCESS")) { //NOI18N 3.0.4 has build 
success, some older versions have build successful
-            visitor.setOutputType(IOColors.OutputType.LOG_SUCCESS);
-            return;
         }
-        
+        if (line.startsWith("BUILD ")) {
+            if (line.startsWith("BUILD SUCCESS")) {
+                visitor.setOutputType(IOColors.OutputType.LOG_SUCCESS);
+                return;
+            } else if (line.startsWith("BUILD FAILURE"))  {
+                visitor.setOutputType(IOColors.OutputType.LOG_FAILURE);
+                return; 
+            }
+        }
+
         //reactor summary processing ---- 
         if (line.startsWith("Reactor Summary:")) {
             processReactorSummary = true;
@@ -121,16 +124,9 @@ public class GlobalOutputProcessor implements 
OutputProcessor {
                         @Override
                         public void outputLineSelected(OutputEvent ev) {
                         }
-
-                        @Override
+                        @Override 
                         public void outputLineAction(OutputEvent ev) {
-                            RequestProcessor.getDefault().post(new Runnable() {
-
-                                @Override
-                                public void run() {
-                                    next.getEndOffset().scrollTo();
-                                }
-                            });
+                            
RequestProcessor.getDefault().post(next.getEndOffset()::scrollTo);
                         }
 
                         @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Reply via email to