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 48339
Collapse All | Expand All

(-)src/org/netbeans/core/output2/AbstractLines.java (-2 / +17 lines)
Lines 12-17 Link Here
12
 */
12
 */
13
package org.netbeans.core.output2;
13
package org.netbeans.core.output2;
14
14
15
import java.util.HashSet;
16
import java.util.Set;
15
import org.openide.windows.OutputListener;
17
import org.openide.windows.OutputListener;
16
import org.openide.ErrorManager;
18
import org.openide.ErrorManager;
17
import org.openide.util.Mutex;
19
import org.openide.util.Mutex;
Lines 494-503 Link Here
494
        }
496
        }
495
    }
497
    }
496
498
497
    public void addListener (int line, OutputListener l) {
499
    public void addListener (int line, OutputListener l, boolean important) {
498
        linesToListeners.put(line, l);
500
        linesToListeners.put(line, l);
501
        if (important) {
502
            importantLines.add(line);
503
        }
499
    }
504
    }
500
505
    
506
    private IntList importantLines = new IntList(10);
507
    
508
    public int firstImportantListenerLine() {
509
        return importantLines.size() == 0 ? -1 : importantLines.get(0);
510
    }
511
    
512
    public boolean isImportantHyperlink(int line) {
513
        return importantLines.contains(line);
514
    }
515
    
501
    /**
516
    /**
502
     * A minor hook to let unit tests decide if caching is on or off.
517
     * A minor hook to let unit tests decide if caching is on or off.
503
     * @param val
518
     * @param val
(-)src/org/netbeans/core/output2/ErrWriter.java (-1 / +5 lines)
Lines 46-54 Link Here
46
    }
46
    }
47
47
48
    public void println(String s, OutputListener l) throws java.io.IOException {
48
    public void println(String s, OutputListener l) throws java.io.IOException {
49
        println(s, l, false);
50
    }
51
52
    public void println(String s, OutputListener l, boolean important) throws java.io.IOException {
49
        closed = false;
53
        closed = false;
50
        synchronized (wrapped) {
54
        synchronized (wrapped) {
51
            wrapped.println (s, l);
55
            wrapped.println (s, l, important);
52
            ((AbstractLines) wrapped.getLines()).markErr();
56
            ((AbstractLines) wrapped.getLines()).markErr();
53
        }
57
        }
54
    }
58
    }
(-)src/org/netbeans/core/output2/ExtPlainView.java (-11 / +18 lines)
Lines 49-55 Link Here
49
            doc.getText(p0, p1 - p0, s);
49
            doc.getText(p0, p1 - p0, s);
50
            g.setColor(getColorForLocation(p0, doc, true));
50
            g.setColor(getColorForLocation(p0, doc, true));
51
            int ret = Utilities.drawTabbedText(s, x, y, g, this, p0);
51
            int ret = Utilities.drawTabbedText(s, x, y, g, this, p0);
52
            if (g.getColor() == WrappedTextView.selectedLinkFg) {
52
            if (g.getColor() == WrappedTextView.selectedLinkFg || g.getColor() == WrappedTextView.selectedImportantLinkFg) {
53
                //#47263 - start hyperlink underline at first
53
                //#47263 - start hyperlink underline at first
54
                //non-whitespace character
54
                //non-whitespace character
55
                underline(g, s, x, p0, y);
55
                underline(g, s, x, p0, y);
Lines 70-76 Link Here
70
            doc.getText(p0, p1 - p0, s);
70
            doc.getText(p0, p1 - p0, s);
71
            g.setColor(getColorForLocation(p0, doc, false));
71
            g.setColor(getColorForLocation(p0, doc, false));
72
            int ret = Utilities.drawTabbedText(s, x, y, g, this, p0);
72
            int ret = Utilities.drawTabbedText(s, x, y, g, this, p0);
73
            if (g.getColor() == WrappedTextView.unselectedLinkFg) {
73
            if (g.getColor() == WrappedTextView.selectedLinkFg || g.getColor() == WrappedTextView.selectedImportantLinkFg) {
74
                //#47263 - start hyperlink underline at first
74
                //#47263 - start hyperlink underline at first
75
                //non-whitespace character
75
                //non-whitespace character
76
                underline(g, s, x, p0, y);
76
                underline(g, s, x, p0, y);
Lines 111-127 Link Here
111
        OutputDocument od = (OutputDocument) d;
111
        OutputDocument od = (OutputDocument) d;
112
        int line = od.getElementIndex (start);
112
        int line = od.getElementIndex (start);
113
        boolean hyperlink = od.getLines().isHyperlink(line);
113
        boolean hyperlink = od.getLines().isHyperlink(line);
114
        boolean important = hyperlink ? od.getLines().isImportantHyperlink(line) : false;
114
        boolean isErr = od.getLines().isErr(line);
115
        boolean isErr = od.getLines().isErr(line);
116
        
115
        return hyperlink ? 
117
        return hyperlink ? 
116
            selected ? 
118
            (important ? 
117
                WrappedTextView.selectedLinkFg : 
119
                (selected ? 
118
                WrappedTextView.unselectedLinkFg :
120
                    WrappedTextView.selectedImportantLinkFg : 
119
            selected ? isErr ? 
121
                    WrappedTextView.unselectedImportantLinkFg) :
120
                WrappedTextView.selectedErr : 
122
                (selected ?
121
                WrappedTextView.selectedFg : 
123
                    WrappedTextView.selectedLinkFg : 
122
            isErr ? 
124
                    WrappedTextView.unselectedLinkFg)) :
123
                WrappedTextView.unselectedErr : 
125
            (selected ? 
124
                WrappedTextView.unselectedFg;
126
                (isErr ? 
127
                    WrappedTextView.selectedErr : 
128
                    WrappedTextView.selectedFg) : 
129
                (isErr ? 
130
                    WrappedTextView.unselectedErr : 
131
                    WrappedTextView.unselectedFg));
125
    }
132
    }
126
133
127
}
134
}
(-)src/org/netbeans/core/output2/Lines.java (+9 lines)
Lines 73-78 Link Here
73
     * @return A line number, or -1 if there are no listeners
73
     * @return A line number, or -1 if there are no listeners
74
     */
74
     */
75
    int firstListenerLine ();
75
    int firstListenerLine ();
76
    
77
    /**
78
     * Get the index of the first line which has an important listener
79
     * @return A line number, or -1 if there are no important listeners
80
     */
81
    
82
    int firstImportantListenerLine();
83
    
84
    boolean isImportantHyperlink(int line);
76
85
77
    /**
86
    /**
78
     * Get the nearest listener to the passed line index
87
     * Get the nearest listener to the passed line index
(-)src/org/netbeans/core/output2/NbWriter.java (+4 lines)
Lines 43-48 Link Here
43
    }
43
    }
44
44
45
    
45
    
46
    public void println(String s, OutputListener l, boolean important) throws IOException {
47
        ((OutWriter) out).println (s, l, important);
48
    }
49
46
    /**
50
    /**
47
     * Replaces the wrapped OutWriter.
51
     * Replaces the wrapped OutWriter.
48
     *
52
     *
(-)src/org/netbeans/core/output2/OutWriter.java (-3 / +8 lines)
Lines 429-448 Link Here
429
429
430
430
431
        public synchronized void println(String s, OutputListener l) throws IOException {
431
        public synchronized void println(String s, OutputListener l) throws IOException {
432
            println(s, l, false);
433
        }
434
435
        
436
        public synchronized void println(String s, OutputListener l, boolean important) throws IOException {
432
            if (checkError()) {
437
            if (checkError()) {
433
                return;
438
                return;
434
            }
439
            }
435
            int addedCount = doPrintln (s);
440
            int addedCount = doPrintln (s);
436
            if (addedCount == 1) {
441
            if (addedCount == 1) {
437
                lines.addListener(lines.getLineCount() - 1, l);
442
                lines.addListener(lines.getLineCount() - 1, l, important);
438
            } else {
443
            } else {
439
                int newCount = lines.getLineCount();
444
                int newCount = lines.getLineCount();
440
                for (int i=newCount - addedCount; i < newCount; i++) {
445
                for (int i=newCount - addedCount; i < newCount; i++) {
441
                    lines.addListener (i, l);
446
                    lines.addListener (i, l, important);
442
                }
447
                }
443
            }
448
            }
444
        }
449
        }
445
450
        
446
    /**
451
    /**
447
     * A useless writer object to pass to the superclass constructor.  We override all methods
452
     * A useless writer object to pass to the superclass constructor.  We override all methods
448
     * of it anyway.
453
     * of it anyway.
(-)src/org/netbeans/core/output2/OutputTab.java (-17 / +21 lines)
Lines 164-186 Link Here
164
        if (out != null) {
164
        if (out != null) {
165
            if (Controller.log) Controller.log ("Looking for first appropriate" +
165
            if (Controller.log) Controller.log ("Looking for first appropriate" +
166
                " listener line to send the caret to");
166
                " listener line to send the caret to");
167
            int[] lines = out.getLines().allListenerLines();
167
            result = out.getLines().firstImportantListenerLine();
168
            for (int i=0; i < lines.length; i++) {
168
            // mkleint - still use the old way as fallback until modules start using OutputWriter.println(String, Listener, boolean imporant);
169
                try {
169
//            if (result == -1) {
170
                    String s = out.getLines().getLine(lines[i]);
170
//                int[] lines = out.getLines().allListenerLines();
171
                    if (s.indexOf("[deprecation]") == -1 && s.indexOf("warning") == -1 && s.indexOf("stopped") == -1) {
171
//                for (int i=0; i < lines.length; i++) {
172
                        result = lines[i];
172
//                    try {
173
                        if (Controller.log) Controller.log ("Line to navigate to" +
173
//                        String s = out.getLines().getLine(lines[i]);
174
                            "is line " + lines[i] + ": " + s);
174
//                        if (s.indexOf("[deprecation]") == -1 && s.indexOf("warning") == -1 && s.indexOf("stopped") == -1) {
175
                        break;
175
//                            result = lines[i];
176
                    }
176
//                            if (Controller.log) Controller.log("Line to navigate to" +
177
                    if (Controller.log) Controller.log ("Ignoring " +
177
//                                    "is line " + lines[i] + ": " + s);
178
                        " \"" + s + "\"\n  it is just a deprecation msg");
178
//                            break;
179
                } catch (Exception e) {
179
//                        }
180
                    ErrorManager.getDefault().notify(e);
180
//                        if (Controller.log) Controller.log("Ignoring " +
181
                    break;
181
//                                " \"" + s + "\"\n  it is just a deprecation msg");
182
                }
182
//                    } catch (Exception e) {
183
            }
183
//                        ErrorManager.getDefault().notify(e);
184
//                        break;
185
//                    }
186
//                }
187
//            }
184
        }
188
        }
185
        return result;
189
        return result;
186
    }
190
    }
(-)src/org/netbeans/core/output2/WrappedTextView.java (-3 / +18 lines)
Lines 81-86 Link Here
81
    static Color unselectedFg;
81
    static Color unselectedFg;
82
    static Color selectedLinkFg;
82
    static Color selectedLinkFg;
83
    static Color unselectedLinkFg;
83
    static Color unselectedLinkFg;
84
    static Color selectedImportantLinkFg;
85
    static Color unselectedImportantLinkFg;
84
    static Color selectedErr;
86
    static Color selectedErr;
85
    static Color unselectedErr;
87
    static Color unselectedErr;
86
    static final Color arrowColor = new Color (80, 162, 80);
88
    static final Color arrowColor = new Color (80, 162, 80);
Lines 98-109 Link Here
98
        }
100
        }
99
101
100
        selectedLinkFg = UIManager.getColor("nb.output.link.foreground.selected"); //NOI18N
102
        selectedLinkFg = UIManager.getColor("nb.output.link.foreground.selected"); //NOI18N
101
        if (selectedLinkFg == null) selectedLinkFg = Color.BLUE;
103
        if (selectedLinkFg == null) selectedLinkFg = Color.BLUE.darker();
102
        
104
        
103
        unselectedLinkFg = UIManager.getColor("nb.output.link.foreground"); //NOI18N
105
        unselectedLinkFg = UIManager.getColor("nb.output.link.foreground"); //NOI18N
104
        if (unselectedLinkFg == null) {
106
        if (unselectedLinkFg == null) {
105
            unselectedLinkFg = selectedLinkFg;
107
            unselectedLinkFg = selectedLinkFg;
106
        }
108
        }
109
        
110
        selectedImportantLinkFg = UIManager.getColor("nb.output.link.foreground.important.selected"); //NOI18N
111
        if (selectedImportantLinkFg == null) {
112
            selectedImportantLinkFg = selectedLinkFg.brighter();
113
        }
114
        
115
        unselectedImportantLinkFg = UIManager.getColor("nb.output.link.foreground.important"); //NOI18N
116
        if (unselectedImportantLinkFg == null) {
117
            unselectedImportantLinkFg = selectedImportantLinkFg;
118
        }
107
119
108
        selectedErr = UIManager.getColor ("nb.output.err.foreground.selected"); //NOI18N
120
        selectedErr = UIManager.getColor ("nb.output.err.foreground.selected"); //NOI18N
109
        if (selectedErr == null) {
121
        if (selectedErr == null) {
Lines 569-576 Link Here
569
        OutputDocument od = (OutputDocument) d;
581
        OutputDocument od = (OutputDocument) d;
570
        int line = od.getElementIndex (start);
582
        int line = od.getElementIndex (start);
571
        boolean hyperlink = od.getLines().isHyperlink(line);
583
        boolean hyperlink = od.getLines().isHyperlink(line);
584
        boolean important = hyperlink ? od.getLines().isImportantHyperlink(line) : false;
572
        boolean isErr = od.getLines().isErr(line);
585
        boolean isErr = od.getLines().isErr(line);
573
        return hyperlink ? selected ? selectedLinkFg : unselectedLinkFg :
586
        return hyperlink ? (important ? (selected ? selectedImportantLinkFg : unselectedImportantLinkFg) : 
574
            selected ? isErr ? selectedErr : selectedFg : isErr ? unselectedErr : unselectedFg;
587
                                        (selected ? selectedLinkFg : unselectedLinkFg)) :
588
                           (selected ? (isErr ? selectedErr : selectedFg) : 
589
                                       (isErr ? unselectedErr : unselectedFg));
575
    }
590
    }
576
}
591
}

Return to bug 48339