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

(-)a/core.output2/manifest.mf (+1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.core.output2/1
2
OpenIDE-Module: org.netbeans.core.output2/1
3
OpenIDE-Module-Layer: org/netbeans/core/output2/layer.xml
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/output2/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/core/output2/Bundle.properties
4
OpenIDE-Module-Provides: org.openide.windows.IOProvider
5
OpenIDE-Module-Provides: org.openide.windows.IOProvider
5
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
(-)a/core.output2/nbproject/project.xml (+18 lines)
Lines 50-55 Link Here
50
            <code-name-base>org.netbeans.core.output2</code-name-base>
50
            <code-name-base>org.netbeans.core.output2</code-name-base>
51
            <module-dependencies>
51
            <module-dependencies>
52
                <dependency>
52
                <dependency>
53
                    <code-name-base>org.jdesktop.beansbinding</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <release-version>1</release-version>
58
                        <specification-version>1.16</specification-version>
59
                    </run-dependency>
60
                </dependency>
61
                <dependency>
62
                    <code-name-base>org.netbeans.modules.options.api</code-name-base>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
65
                    <run-dependency>
66
                        <release-version>1</release-version>
67
                        <specification-version>1.27</specification-version>
68
                    </run-dependency>
69
                </dependency>
70
                <dependency>
53
                    <code-name-base>org.netbeans.swing.plaf</code-name-base>
71
                    <code-name-base>org.netbeans.swing.plaf</code-name-base>
54
                    <build-prerequisite/>
72
                    <build-prerequisite/>
55
                    <compile-dependency/>
73
                    <compile-dependency/>
(-)a/core.output2/src/org/netbeans/core/output2/AbstractLines.java (-24 / +7 lines)
Lines 62-67 Link Here
62
import javax.swing.UIManager;
62
import javax.swing.UIManager;
63
import javax.swing.event.ChangeEvent;
63
import javax.swing.event.ChangeEvent;
64
import javax.swing.event.ChangeListener;
64
import javax.swing.event.ChangeListener;
65
import org.netbeans.core.output2.options.OutputOptions;
65
import org.openide.filesystems.FileUtil;
66
import org.openide.filesystems.FileUtil;
66
import org.openide.util.Exceptions;
67
import org.openide.util.Exceptions;
67
import org.openide.util.Mutex;
68
import org.openide.util.Mutex;
Lines 836-865 Link Here
836
        if (DEF_COLORS != null) {
837
        if (DEF_COLORS != null) {
837
            return DEF_COLORS;
838
            return DEF_COLORS;
838
        }
839
        }
839
        Color out = UIManager.getColor("nb.output.foreground"); //NOI18N
840
        return DEF_COLORS = new Color[]{
840
        if (out == null) {
841
            OutputOptions.getDefault().getColorStandard(),
841
            out = UIManager.getColor("textText");
842
            OutputOptions.getDefault().getColorError(),
842
            if (out == null) {
843
            OutputOptions.getDefault().getColorLink(),
843
                out = Color.BLACK;
844
            OutputOptions.getDefault().getColorLinkImportant()
844
            }
845
        };
845
        }
846
847
        Color err = UIManager.getColor("nb.output.err.foreground"); //NOI18N
848
        if (err == null) {
849
            err = LFCustoms.shiftColor(Color.red);
850
        }
851
852
        Color hyperlink = UIManager.getColor("nb.output.link.foreground"); //NOI18N
853
        if (hyperlink == null) {
854
            hyperlink = LFCustoms.shiftColor(Color.blue);
855
        }
856
857
        Color hyperlinkImp = UIManager.getColor("nb.output.link.foreground.important"); //NOI18N
858
        if (hyperlinkImp == null) {
859
            hyperlinkImp = hyperlink;
860
        }
861
862
        return DEF_COLORS = new Color[]{out, err, hyperlink, hyperlinkImp};
863
    }
846
    }
864
847
865
    public void setDefColor(IOColors.OutputType type, Color color) {
848
    public void setDefColor(IOColors.OutputType type, Color color) {
(-)a/core.output2/src/org/netbeans/core/output2/Bundle.properties (-3 / +3 lines)
Lines 110-116 Link Here
110
ACTION_FIND_PREVIOUS=Find Previous
110
ACTION_FIND_PREVIOUS=Find Previous
111
ACTION_LARGER_FONT=Larger Font
111
ACTION_LARGER_FONT=Larger Font
112
ACTION_SMALLER_FONT=Smaller Font
112
ACTION_SMALLER_FONT=Smaller Font
113
ACTION_FONT_TYPE=Choose Font...
113
ACTION_SETTINGS=Settings...
114
ACTION_FILTER=Filter...
114
ACTION_FILTER=Filter...
115
115
116
#Popup menu accelerators
116
#Popup menu accelerators
Lines 128-134 Link Here
128
ACTION_CLEAR.accel=C-L
128
ACTION_CLEAR.accel=C-L
129
ACTION_LARGER_FONT.accel=C-EQUALS
129
ACTION_LARGER_FONT.accel=C-EQUALS
130
ACTION_SMALLER_FONT.accel=C-MINUS
130
ACTION_SMALLER_FONT.accel=C-MINUS
131
ACTION_FONT_TYPE.accel=
131
ACTION_SETTINGS.accel=
132
ACTION_FILTER.accel=C-G
132
ACTION_FILTER.accel=C-G
133
133
134
#Macintosh popup menu accelerators
134
#Macintosh popup menu accelerators
Lines 136-142 Link Here
136
ACTION_PASTE.accel.mac=M-V
136
ACTION_PASTE.accel.mac=M-V
137
ACTION_LARGER_FONT.accel.mac=M-EQUALS
137
ACTION_LARGER_FONT.accel.mac=M-EQUALS
138
ACTION_SMALLER_FONT.accel.mac=M-MINUS
138
ACTION_SMALLER_FONT.accel.mac=M-MINUS
139
ACTION_FONT_TYPE.accel.mac=
139
ACTION_SETTINGS.accel.mac=
140
ACTION_WRAP.accel.mac=M-R 
140
ACTION_WRAP.accel.mac=M-R 
141
ACTION_SAVEAS.accel.mac=M-S
141
ACTION_SAVEAS.accel.mac=M-S
142
ACTION_CLOSE.accel.mac=M-F4
142
ACTION_CLOSE.accel.mac=M-F4
(-)a/core.output2/src/org/netbeans/core/output2/Controller.java (-3 / +18 lines)
Lines 64-70 Link Here
64
import javax.swing.SwingUtilities;
64
import javax.swing.SwingUtilities;
65
import javax.swing.UIManager;
65
import javax.swing.UIManager;
66
import javax.swing.text.Document;
66
import javax.swing.text.Document;
67
import org.netbeans.core.output2.options.OutputOptions;
67
import org.openide.util.Exceptions;
68
import org.openide.util.Exceptions;
69
import org.openide.util.Lookup;
68
import org.openide.util.NbPreferences;
70
import org.openide.util.NbPreferences;
69
import org.openide.windows.IOColors;
71
import org.openide.windows.IOColors;
70
import org.openide.windows.IOContainer;
72
import org.openide.windows.IOContainer;
Lines 188-193 Link Here
188
    }
190
    }
189
191
190
    void changeFont(Font font) {
192
    void changeFont(Font font) {
193
        updateFontPreferences(font);
194
        for (OutputTab tab : getAllTabs()) {
195
            if (allMonospaced || !tab.getOutputPane().isWrapped()) {
196
                tab.getOutputPane().setViewFont(currentFont);
197
            }
198
        }
199
    }
200
201
    private void updateFontPreferences(Font font) {
191
        currentFont = font == null ? getDefaultFont() : font;
202
        currentFont = font == null ? getDefaultFont() : font;
192
        allMonospaced = isDefaultFontType(currentFont);
203
        allMonospaced = isDefaultFontType(currentFont);
193
        if (allMonospaced) {
204
        if (allMonospaced) {
Lines 198-206 Link Here
198
        NbPreferences.forModule(Controller.class).putInt(KEY_FONTSIZE, currentFont.getSize());
209
        NbPreferences.forModule(Controller.class).putInt(KEY_FONTSIZE, currentFont.getSize());
199
        NbPreferences.forModule(Controller.class).putInt(KEY_FONTSTYLE, currentFont.getStyle());
210
        NbPreferences.forModule(Controller.class).putInt(KEY_FONTSTYLE, currentFont.getStyle());
200
        NbPreferences.forModule(Controller.class).put(KEY_FONTNAME, currentFont.getName());
211
        NbPreferences.forModule(Controller.class).put(KEY_FONTNAME, currentFont.getName());
201
        for (OutputTab tab : getAllTabs()) {
212
    }
202
            if (allMonospaced || !tab.getOutputPane().isWrapped()) {
213
203
                tab.getOutputPane().setViewFont(currentFont);
214
    public void updateOptions(OutputOptions options) {
215
        updateFontPreferences(options.getFont());
216
        for (OutputTab ot : getAllTabs()) {
217
            if (ot.getIO().getIOContainer().equals(IOContainer.getDefault())) {
218
                ot.getIO().getOptions().assign(options);
204
            }
219
            }
205
        }
220
        }
206
    }
221
    }
(-)a/core.output2/src/org/netbeans/core/output2/ExtPlainView.java (+20 lines)
Lines 52-57 Link Here
52
import javax.swing.text.*;
52
import javax.swing.text.*;
53
import java.awt.*;
53
import java.awt.*;
54
import javax.swing.text.Position.Bias;
54
import javax.swing.text.Position.Bias;
55
import org.netbeans.core.output2.options.OutputOptions;
55
import org.openide.windows.IOColors;
56
import org.openide.windows.IOColors;
56
57
57
/**
58
/**
Lines 193-198 Link Here
193
    }
194
    }
194
195
195
    private void underline(Graphics g, Segment s, int x, int p0, int y) {
196
    private void underline(Graphics g, Segment s, int x, int p0, int y) {
197
        if (!isLinkUndeliningEnabled(this)) {
198
            return;
199
        }
196
        int textLen = Utilities.getTabbedTextWidth(s, metrics, tabBase, this, p0);
200
        int textLen = Utilities.getTabbedTextWidth(s, metrics, tabBase, this, p0);
197
        int underlineShift = g.getFontMetrics().getDescent() - 1;
201
        int underlineShift = g.getFontMetrics().getDescent() - 1;
198
        g.drawLine(x, y + underlineShift, x + textLen, y + underlineShift);
202
        g.drawLine(x, y + underlineShift, x + textLen, y + underlineShift);
Lines 454-457 Link Here
454
        return pos;
458
        return pos;
455
    }
459
    }
456
460
461
    static boolean isLinkUndeliningEnabled(View v) {
462
        Container pane = v.getContainer();
463
        if (pane != null) {
464
            OutputTab tab = (OutputTab) SwingUtilities.getAncestorOfClass(
465
                    OutputTab.class, pane);
466
            if (tab != null) {
467
                OutputTab outputTab = (OutputTab) tab;
468
                OutputOptions.LinkStyle linkStyle;
469
                linkStyle = outputTab.getIO().getOptions().getLinkStyle();
470
                if (linkStyle == OutputOptions.LinkStyle.NONE) {
471
                    return false;
472
                }
473
            }
474
        }
475
        return true;
476
    }
457
}
477
}
(-)a/core.output2/src/org/netbeans/core/output2/NbIO.java (-2 / +21 lines)
Lines 53-58 Link Here
53
import java.awt.*;
53
import java.awt.*;
54
import java.io.IOException;
54
import java.io.IOException;
55
import java.io.Reader;
55
import java.io.Reader;
56
import org.netbeans.core.output2.options.OutputOptions;
56
import org.openide.util.Exceptions;
57
import org.openide.util.Exceptions;
57
import org.openide.util.Lookup;
58
import org.openide.util.Lookup;
58
import org.openide.util.lookup.Lookups;
59
import org.openide.util.lookup.Lookups;
Lines 75-80 Link Here
75
    private Boolean focusTaken = null;
76
    private Boolean focusTaken = null;
76
    private boolean closed = false;
77
    private boolean closed = false;
77
    private final String name;
78
    private final String name;
79
    private OutputOptions options = OutputOptions.getDefault().makeCopy();
78
    
80
    
79
    private Action[] actions;
81
    private Action[] actions;
80
82
Lines 277-283 Link Here
277
        if (lookup == null) {
279
        if (lookup == null) {
278
            ioTab = new IOTabImpl();
280
            ioTab = new IOTabImpl();
279
            ioColors = new IOColorsImpl();
281
            ioColors = new IOColorsImpl();
280
            lookup = Lookups.fixed(ioTab, ioColors, new IOPositionImpl(), new IOColorLinesImpl(), new IOColorPrintImpl(), new IOSelectImpl());
282
            lookup = Lookups.fixed(ioTab, ioColors, new IOPositionImpl(),
283
                    new IOColorLinesImpl(), new IOColorPrintImpl(),
284
                    new IOSelectImpl(), options);
281
        }
285
        }
282
        return lookup;
286
        return lookup;
283
    }
287
    }
Lines 521-527 Link Here
521
525
522
        @Override
526
        @Override
523
        protected Color getColor(OutputType type) {
527
        protected Color getColor(OutputType type) {
524
            return clrs[type.ordinal()] != null ? clrs[type.ordinal()] : AbstractLines.getDefColors()[type.ordinal()];
528
            return clrs[type.ordinal()] != null ? clrs[type.ordinal()] : options.getColorForType(type);
525
        }
529
        }
526
530
527
        @Override
531
        @Override
Lines 530-533 Link Here
530
            post(NbIO.this, IOEvent.CMD_DEF_COLORS, type);
534
            post(NbIO.this, IOEvent.CMD_DEF_COLORS, type);
531
        }
535
        }
532
    }
536
    }
537
538
    /**
539
     * Set option values. The object itself is not replaced, all registered
540
     * listeners remains untouched.
541
     */
542
    void setOptions(OutputOptions options) {
543
        this.options.assign(options);
544
    }
545
546
    /**
547
     * Get Options object.
548
     */
549
    OutputOptions getOptions() {
550
        return this.options;
551
    }
533
}
552
}
(-)a/core.output2/src/org/netbeans/core/output2/OutputTab.java (-7 / +74 lines)
Lines 44-49 Link Here
44
44
45
package org.netbeans.core.output2;
45
package org.netbeans.core.output2;
46
46
47
import java.awt.Color;
47
import java.awt.Dialog;
48
import java.awt.Dialog;
48
import java.awt.Component;
49
import java.awt.Component;
49
import java.awt.Container;
50
import java.awt.Container;
Lines 54-59 Link Here
54
import java.awt.Point;
55
import java.awt.Point;
55
import java.awt.event.ActionEvent;
56
import java.awt.event.ActionEvent;
56
import java.awt.event.KeyEvent;
57
import java.awt.event.KeyEvent;
58
import java.beans.PropertyChangeEvent;
57
import java.beans.PropertyChangeListener;
59
import java.beans.PropertyChangeListener;
58
import java.beans.PropertyEditor;
60
import java.beans.PropertyEditor;
59
import java.beans.PropertyEditorManager;
61
import java.beans.PropertyEditorManager;
Lines 82-87 Link Here
82
import javax.swing.event.PopupMenuEvent;
84
import javax.swing.event.PopupMenuEvent;
83
import javax.swing.event.PopupMenuListener;
85
import javax.swing.event.PopupMenuListener;
84
import javax.swing.text.Document;
86
import javax.swing.text.Document;
87
import org.netbeans.api.options.OptionsDisplayer;
85
import org.netbeans.core.output2.Controller.ControllerOutputEvent;
88
import org.netbeans.core.output2.Controller.ControllerOutputEvent;
86
import org.netbeans.core.output2.ui.AbstractOutputPane;
89
import org.netbeans.core.output2.ui.AbstractOutputPane;
87
import org.netbeans.core.output2.ui.AbstractOutputTab;
90
import org.netbeans.core.output2.ui.AbstractOutputTab;
Lines 99-105 Link Here
99
import org.openide.xml.XMLUtil;
102
import org.openide.xml.XMLUtil;
100
103
101
import static org.netbeans.core.output2.OutputTab.ACTION.*;
104
import static org.netbeans.core.output2.OutputTab.ACTION.*;
102
import org.openide.windows.IOProvider;
105
import org.netbeans.core.output2.options.OutputOptions;
106
import org.openide.util.WeakListeners;
107
import org.openide.windows.IOColors;
103
108
104
109
105
/**
110
/**
Lines 108-113 Link Here
108
final class OutputTab extends AbstractOutputTab implements IOContainer.CallBacks {
113
final class OutputTab extends AbstractOutputTab implements IOContainer.CallBacks {
109
    private final NbIO io;
114
    private final NbIO io;
110
    private OutWriter outWriter;
115
    private OutWriter outWriter;
116
    private PropertyChangeListener optionsListener;
111
117
112
    OutputTab(NbIO io) {
118
    OutputTab(NbIO io) {
113
        this.io = io;
119
        this.io = io;
Lines 122-127 Link Here
122
        getActionMap().put("jumpNext", action(NEXT_ERROR)); // NOI18N
128
        getActionMap().put("jumpNext", action(NEXT_ERROR)); // NOI18N
123
        getActionMap().put(FindAction.class.getName(), action(FIND));
129
        getActionMap().put(FindAction.class.getName(), action(FIND));
124
        getActionMap().put(javax.swing.text.DefaultEditorKit.copyAction, action(COPY));
130
        getActionMap().put(javax.swing.text.DefaultEditorKit.copyAction, action(COPY));
131
        applyOptions();
132
    }
133
134
    private void applyOptions() {
135
        Lines lines = getDocument().getLines();
136
        OutputOptions opts = io.getOptions();
137
        lines.setDefColor(IOColors.OutputType.OUTPUT,
138
                opts.getColorStandard());
139
        lines.setDefColor(IOColors.OutputType.ERROR,
140
                opts.getColorError());
141
        lines.setDefColor(IOColors.OutputType.HYPERLINK,
142
                opts.getColorLink());
143
        lines.setDefColor(IOColors.OutputType.HYPERLINK_IMPORTANT,
144
                opts.getColorLinkImportant());
145
        Color bg = io.getOptions().getColorBackground();
146
        getOutputPane().getTextView().setBackground(bg);
147
        getOutputPane().setViewFont(io.getOptions().getFont());
148
        initOptionsListener();
125
    }
149
    }
126
150
127
    private final TabAction action(ACTION a) {
151
    private final TabAction action(ACTION a) {
Lines 153-158 Link Here
153
        // get new OutWriter
177
        // get new OutWriter
154
        outWriter = io.out();
178
        outWriter = io.out();
155
        setDocument(new OutputDocument(outWriter));
179
        setDocument(new OutputDocument(outWriter));
180
        applyOptions();
156
    }
181
    }
157
182
158
    public OutputDocument getDocument() {
183
    public OutputDocument getDocument() {
Lines 593-599 Link Here
593
                    popup.add(item);
618
                    popup.add(item);
594
                } else {
619
                } else {
595
                    if ((popupItems[i] == ACTION.CLOSE && !io.getIOContainer().isCloseable(this))
620
                    if ((popupItems[i] == ACTION.CLOSE && !io.getIOContainer().isCloseable(this))
596
                            || (popupItems[i] == ACTION.FONT_TYPE && getOutputPane().isWrapped())) {
621
                            || (popupItems[i] == ACTION.SETTINGS && getOutputPane().isWrapped())) {
597
                        continue;
622
                        continue;
598
                    }
623
                    }
599
                    JMenuItem item = popup.add(ta);
624
                    JMenuItem item = popup.add(ta);
Lines 697-710 Link Here
697
        io.getIOContainer().setTitle(this, escaped.replace("&apos;", "'"));
722
        io.getIOContainer().setTitle(this, escaped.replace("&apos;", "'"));
698
    }
723
    }
699
724
725
    private void initOptionsListener() {
726
        optionsListener = new PropertyChangeListener() {
727
            @Override
728
            public void propertyChange(PropertyChangeEvent evt) {
729
                String pn = evt.getPropertyName();
730
                Lines lines = getDocument().getLines();
731
                OutputOptions opts = io.getOptions();
732
                if (OutputOptions.PROP_COLOR_STANDARD.equals(pn)) {
733
                    lines.setDefColor(IOColors.OutputType.OUTPUT,
734
                            opts.getColorStandard());
735
                } else if (OutputOptions.PROP_COLOR_ERROR.equals(pn)) {
736
                    lines.setDefColor(IOColors.OutputType.ERROR,
737
                            opts.getColorError());
738
                } else if (OutputOptions.PROP_COLOR_LINK.equals(pn)) {
739
                    lines.setDefColor(IOColors.OutputType.HYPERLINK,
740
                            opts.getColorLink());
741
                } else if (OutputOptions.PROP_COLOR_LINK_IMPORTANT.equals(pn)) {
742
                    lines.setDefColor(IOColors.OutputType.HYPERLINK_IMPORTANT,
743
                            opts.getColorLinkImportant());
744
                } else if (OutputOptions.PROP_COLOR_BACKGROUND.equals(pn)) {
745
                    Color bg = io.getOptions().getColorBackground();
746
                    getOutputPane().getTextView().setBackground(bg);
747
                } else if (OutputOptions.PROP_FONT.equals(pn)) {
748
                    Font font = io.getOptions().getFont();
749
                    if (getOutputPane().isWrapped()
750
                            && getIO().getIOContainer() == IOContainer.getDefault()) {
751
                        Font dfltFont = OutputOptions.getDefaultFont();
752
                        if (!font.getFamily().equals(dfltFont.getFamily())
753
                                || font.getStyle() != dfltFont.getStyle()) {
754
                            font = Controller.getDefault().getCurrentFontMS();
755
                        }
756
                    }
757
                    getOutputPane().setViewFont(font);
758
                }
759
                OutputTab.this.repaint();
760
            }
761
        };
762
        this.io.getOptions().addPropertyChangeListener(
763
                WeakListeners.propertyChange(optionsListener, io.getOptions()));
764
    }
765
700
    static enum ACTION { COPY, WRAP, SAVEAS, CLOSE, NEXT_ERROR, PREV_ERROR,
766
    static enum ACTION { COPY, WRAP, SAVEAS, CLOSE, NEXT_ERROR, PREV_ERROR,
701
                         SELECT_ALL, FIND, FIND_NEXT, NAVTOLINE, POSTMENU,
767
                         SELECT_ALL, FIND, FIND_NEXT, NAVTOLINE, POSTMENU,
702
                         FIND_PREVIOUS, CLEAR, NEXTTAB, PREVTAB, LARGER_FONT,
768
                         FIND_PREVIOUS, CLEAR, NEXTTAB, PREVTAB, LARGER_FONT,
703
                         SMALLER_FONT, FONT_TYPE, FILTER, PASTE }
769
                         SMALLER_FONT, SETTINGS, FILTER, PASTE }
704
770
705
    private static final ACTION[] popupItems = new ACTION[] {
771
    private static final ACTION[] popupItems = new ACTION[] {
706
        COPY, PASTE, null, FIND, FIND_NEXT, FIND_PREVIOUS, FILTER, null,
772
        COPY, PASTE, null, FIND, FIND_NEXT, FIND_PREVIOUS, FILTER, null,
707
        WRAP, LARGER_FONT, SMALLER_FONT, FONT_TYPE, null,
773
        WRAP, LARGER_FONT, SMALLER_FONT, SETTINGS, null,
708
        SAVEAS, CLEAR, CLOSE,
774
        SAVEAS, CLEAR, CLOSE,
709
    };
775
    };
710
776
Lines 733-739 Link Here
733
                case FILTER:
799
                case FILTER:
734
                case LARGER_FONT:
800
                case LARGER_FONT:
735
                case SMALLER_FONT:
801
                case SMALLER_FONT:
736
                case FONT_TYPE:
802
                case SETTINGS:
737
                case CLEAR:
803
                case CLEAR:
738
                    action = new TabAction(a, "ACTION_"+a.name());
804
                    action = new TabAction(a, "ACTION_"+a.name());
739
                    break;
805
                    break;
Lines 923-930 Link Here
923
                case LARGER_FONT:
989
                case LARGER_FONT:
924
                    Controller.getDefault().changeFontSizeBy(1, getOutputPane().isWrapped());
990
                    Controller.getDefault().changeFontSizeBy(1, getOutputPane().isWrapped());
925
                    break;
991
                    break;
926
                case FONT_TYPE:
992
                case SETTINGS:
927
                    showFontChooser();
993
                    OptionsDisplayer.getDefault().open(
994
                            "Advanced/OutputSettings");                 //NOI18N
928
                    break;
995
                    break;
929
                case FILTER:
996
                case FILTER:
930
                    if (origPane != null) {
997
                    if (origPane != null) {
(-)a/core.output2/src/org/netbeans/core/output2/WrappedTextView.java (+3 lines)
Lines 470-475 Link Here
470
    }
470
    }
471
471
472
    private void underline(Graphics g, Segment seg, int charpos, int lenToDraw, int x, int y) {
472
    private void underline(Graphics g, Segment seg, int charpos, int lenToDraw, int x, int y) {
473
        if (!ExtPlainView.isLinkUndeliningEnabled(this)) {
474
            return;
475
        }
473
        int underlineStart = margin() + x;
476
        int underlineStart = margin() + x;
474
        FontMetrics fm = g.getFontMetrics();
477
        FontMetrics fm = g.getFontMetrics();
475
        int underlineEnd = underlineStart + fm.charsWidth(seg.array, charpos, lenToDraw);
478
        int underlineEnd = underlineStart + fm.charsWidth(seg.array, charpos, lenToDraw);
(-)a/core.output2/src/org/netbeans/core/output2/layer.xml (+19 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
3
<filesystem>
4
    <folder name="OptionsExport">
5
        <!-- category -->
6
        <folder name="Arbitrary">
7
            <!-- category display name -->
8
            <attr name="displayName"
9
              stringvalue="Output"/>
10
            <!-- item -->
11
            <file name="arbOpt">
12
                <attr name="include"
13
                  stringvalue="config/Preferences/org/netbeans/core/output2.properties"/>
14
                <attr name="displayName"
15
                  stringvalue="Appearance"/>
16
            </file>
17
        </folder>
18
    </folder>
19
</filesystem>
(-)a/core.output2/src/org/netbeans/core/output2/options/Bundle.properties (+21 lines)
Line 0 Link Here
1
OutputSettingsPanel.lblFontFamily.text=&Font:
2
OutputSettingsPanel.lblFontSize.text=Font Si&ze:
3
OutputSettingsPanel.lblStandardColor.text=&Standard Color:
4
OutputSettingsPanel.lblErrorColor.text=&Error Color:
5
OutputSettingsPanel.lblBackgroundColor.text=&Background Color:
6
OutputSettingsPanel.lblLinkColor.text=&Link Color:
7
OutputSettingsPanel.lblLinkStyle.text=Link St&yle:
8
OutputSettingsPanel.lblTitle.text=Output Window Settings
9
OutputSettingsPanel.btnSelectFont.text=...
10
OutputSettingsPanel.fldFontFamily.text=
11
OutputSettingsPanel.jLabel1.text=Im&portant Link Color:
12
OutputSettingsPanel.btnRestore.text=&Restore
13
OutputSettingsPanel.btnSelectFont.toolTipText=Select font family, style and size
14
OutputSettingsPanel.btnRestore.toolTipText=Restore default settings
15
OutputSettingsPanel.spnFontSize.toolTipText=Adjust font size
16
OutputSettingsPanel.cmbBackgroundColor.toolTipText=Select background color
17
OutputSettingsPanel.cmbStandardColor.toolTipText=Select standard text foreground color
18
OutputSettingsPanel.cmbErrorColor.toolTipText=Select error text foreground color
19
OutputSettingsPanel.cmbLinkColor.toolTipText=Select link foreground color
20
OutputSettingsPanel.cmbImportantLinkColor.toolTipText=Select important link foreground color
21
OutputSettingsPanel.cmbLinkStyle.toolTipText=Select link style
(-)a/core.output2/src/org/netbeans/core/output2/options/LinkStyleModel.java (+164 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.output2.options;
43
44
import javax.swing.ComboBoxModel;
45
import javax.swing.event.ListDataListener;
46
import org.netbeans.core.output2.options.OutputOptions.LinkStyle;
47
import org.openide.util.NbBundle;
48
49
/**
50
 * List mode for Link Style combo box.
51
 *
52
 * @author jhavlin
53
 */
54
@NbBundle.Messages({
55
    "LBL_Underline=Underline", //NOI18N
56
    "LBL_None=None" //NOI18N
57
})
58
public class LinkStyleModel implements ComboBoxModel {
59
60
    private class LinkStyleItem {
61
62
        private LinkStyle linkStyle;
63
        private String displayName;
64
65
        public LinkStyleItem(LinkStyle linkStyle, String displayName) {
66
            this.linkStyle = linkStyle;
67
            this.displayName = displayName;
68
        }
69
70
        public LinkStyle getLinkStyle() {
71
            return linkStyle;
72
        }
73
74
        @Override
75
        public String toString() {
76
            return displayName;
77
        }
78
    }
79
80
    /* Instances of combo box items. */
81
    private LinkStyleItem none = new LinkStyleItem(LinkStyle.NONE,
82
            Bundle.LBL_None());
83
    private LinkStyleItem underline = new LinkStyleItem(LinkStyle.UNDERLINE,
84
            Bundle.LBL_Underline());
85
    /**
86
     * The currently selected item.
87
     */
88
    private LinkStyleItem selectedItem = underline;
89
90
    @Override
91
    public void setSelectedItem(Object anItem) {
92
        if (anItem instanceof LinkStyleItem) {
93
            selectedItem = (LinkStyleItem) anItem;
94
        } else {
95
            throw new IllegalArgumentException();
96
        }
97
    }
98
99
    @Override
100
    public Object getSelectedItem() {
101
        return selectedItem;
102
    }
103
104
    @Override
105
    public int getSize() {
106
        return 2;
107
    }
108
109
    @Override
110
    public Object getElementAt(int index) {
111
        switch (index) {
112
            case 0:
113
                return underline;
114
            case 1:
115
                return none;
116
            default:
117
                throw new IndexOutOfBoundsException();
118
        }
119
    }
120
121
    @Override
122
    public void addListDataListener(ListDataListener l) {
123
        // Nothing, model is constant.
124
    }
125
126
    @Override
127
    public void removeListDataListener(ListDataListener l) {
128
        // Nothing, model is constant.
129
    }
130
131
    LinkStyle getLinkStyle() {
132
        return selectedItem.getLinkStyle();
133
    }
134
135
    void setLinkStyle(LinkStyle style) {
136
        if (style != selectedItem.getLinkStyle()) {
137
            switch (style) {
138
                case NONE:
139
                    selectedItem = none;
140
                    break;
141
                case UNDERLINE:
142
                    selectedItem = underline;
143
                    break;
144
                default:
145
                    throw new IllegalArgumentException();
146
            }
147
        }
148
    }
149
150
    private LinkStyleItem linkStyleItemFor(LinkStyle linkStyle) {
151
        switch (linkStyle) {
152
            case NONE:
153
                return none;
154
            case UNDERLINE:
155
                return underline;
156
            default:
157
                throw new IllegalArgumentException();
158
        }
159
    }
160
161
    public Object itemFor(LinkStyle linkStyle) {
162
        return linkStyleItemFor(linkStyle);
163
    }
164
}
(-)a/core.output2/src/org/netbeans/core/output2/options/OutputOptions.java (+439 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.output2.options;
43
44
import java.awt.Color;
45
import java.awt.EventQueue;
46
import java.awt.Font;
47
import java.beans.PropertyChangeEvent;
48
import java.beans.PropertyChangeListener;
49
import java.beans.PropertyChangeSupport;
50
import java.util.logging.Level;
51
import java.util.logging.Logger;
52
import java.util.prefs.BackingStoreException;
53
import java.util.prefs.Preferences;
54
import javax.swing.UIManager;
55
import org.netbeans.core.output2.Controller;
56
import org.netbeans.swing.plaf.LFCustoms;
57
import org.openide.util.NbPreferences;
58
import org.openide.util.Parameters;
59
import org.openide.util.RequestProcessor;
60
import org.openide.windows.IOColors;
61
62
/**
63
 *
64
 * @author jhavlin
65
 */
66
public class OutputOptions {
67
68
    public enum LinkStyle {
69
        NONE, UNDERLINE
70
    }
71
72
    private static OutputOptions DEFAULT = null;
73
    private boolean initialized = false;
74
    private static final Logger LOG = Logger.getLogger(
75
            OutputOptions.class.getName());
76
    private static final String PREFIX = "output.settings.";            //NOI18N
77
    public static final String PROP_FONT = "font";                      //NOI18N
78
    private static final String PROP_FONT_FAMILY = "font.family";       //NOI18N
79
    private static final String PROP_FONT_SIZE = "font.size";           //NOI18N
80
    private static final String PROP_FONT_STYLE = "font.style";         //NOI18N
81
    public static final String PROP_COLOR_STANDARD = "color.standard";  //NOI18N
82
    public static final String PROP_COLOR_ERROR = "color.error";        //NOI18N
83
    public static final String PROP_COLOR_LINK = "color.link";          //NOI18N
84
    public static final String PROP_COLOR_LINK_IMPORTANT =
85
            "color.link.important";                                     //NOI18N
86
    public static final String PROP_COLOR_BACKGROUND =
87
            "color.backgorund";                                         //NOI18N
88
    public static final String PROP_STYLE_LINK = "style.link";          //NOI18N
89
    private static final String PROP_INITIALIZED = "initialized";       //NOI18N
90
    private static final int MIN_FONT_SIZE = 3;
91
    private static Font defaultFont = null;
92
    private Font font = null;
93
    private Color colorStandard;
94
    private Color colorError;
95
    private Color colorLink;
96
    private Color colorLinkImportant;
97
    private Color colorBackground;
98
    private LinkStyle linkStyle = LinkStyle.UNDERLINE;
99
    private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
100
101
    private OutputOptions(boolean initFromDisk) {
102
        resetToDefault();
103
        if (!initFromDisk) {
104
            return;
105
        }
106
        RequestProcessor.getDefault().post(new Runnable() {
107
            @Override
108
            public void run() {
109
                loadFrom(NbPreferences.forModule(Controller.class));
110
            }
111
        });
112
    }
113
114
    final void resetToDefault() {
115
        setDefaultFont();
116
        setDefaultColors();
117
        setLinkStyle(LinkStyle.UNDERLINE);
118
    }
119
120
    public void loadFrom(Preferences preferences) {
121
        assert !EventQueue.isDispatchThread();
122
        final OutputOptions diskData = new OutputOptions(false);
123
        String fontFamily = preferences.get(PREFIX + PROP_FONT_FAMILY,
124
                getDefaultFont().getFamily());
125
        int fontSize = preferences.getInt(PREFIX + PROP_FONT_SIZE,
126
                getDefaultFont().getSize());
127
        int fontStyle = preferences.getInt(PREFIX + PROP_FONT_STYLE,
128
                getDefaultFont().getStyle());
129
        diskData.setFont(new Font(fontFamily, fontStyle, fontSize));
130
        int rgbStandard = preferences.getInt(PREFIX + PROP_COLOR_STANDARD,
131
                getDefaultColorStandard().getRGB());
132
        diskData.setColorStandard(new Color(rgbStandard));
133
        int rgbError = preferences.getInt(PREFIX + PROP_COLOR_ERROR,
134
                getDefaultColorError().getRGB());
135
        diskData.setColorError(new Color(rgbError));
136
        int rgbBackground = preferences.getInt(PREFIX + PROP_COLOR_BACKGROUND,
137
                getDefaultColorBackground().getRGB());
138
        diskData.setColorBackground(new Color(rgbBackground));
139
        int rgbLink = preferences.getInt(PREFIX + PROP_COLOR_LINK,
140
                getDefaultColorLink().getRGB());
141
        diskData.setColorLink(new Color(rgbLink));
142
        int rgbLinkImportant = preferences.getInt(
143
                PREFIX + PROP_COLOR_LINK_IMPORTANT,
144
                getDefaultColorLinkImportant().getRGB());
145
        String linkStyleStr = preferences.get(PREFIX + PROP_STYLE_LINK,
146
                "UNDERLINE");                                           //NOI18N
147
        try {
148
            diskData.setLinkStyle(LinkStyle.valueOf(linkStyleStr));
149
        } catch (Exception e) {
150
            LOG.log(Level.INFO, "Invalid link style {0}", linkStyleStr);//NOI18N
151
        }
152
        diskData.setColorLinkImportant(new Color(rgbLinkImportant));
153
        EventQueue.invokeLater(new Runnable() {
154
            @Override
155
            public void run() {
156
                assign(diskData);
157
                synchronized (OutputOptions.this) {
158
                    initialized = true;
159
                }
160
                pcs.firePropertyChange(PROP_INITIALIZED, false, true);
161
            }
162
        });
163
    }
164
165
    public void saveTo(Preferences preferences) {
166
        assert !EventQueue.isDispatchThread();
167
        preferences.putInt(PREFIX + PROP_COLOR_STANDARD,
168
                getColorStandard().getRGB());
169
        preferences.putInt(PREFIX + PROP_COLOR_ERROR,
170
                getColorError().getRGB());
171
        preferences.putInt(PREFIX + PROP_COLOR_BACKGROUND,
172
                getColorBackground().getRGB());
173
        preferences.putInt(PREFIX + PROP_COLOR_LINK,
174
                getColorLink().getRGB());
175
        preferences.putInt(PREFIX + PROP_COLOR_LINK_IMPORTANT,
176
                getColorLinkImportant().getRGB());
177
        preferences.putInt(PREFIX + PROP_FONT_SIZE, getFont().getSize());
178
        preferences.putInt(PREFIX + PROP_FONT_STYLE, getFont().getStyle());
179
        preferences.put(PREFIX + PROP_FONT_FAMILY, getFont().getFamily());
180
        preferences.put(PREFIX + PROP_STYLE_LINK, getLinkStyle().name());
181
        try {
182
            preferences.flush();
183
        } catch (BackingStoreException ex) {
184
            LOG.log(Level.INFO, null, ex);
185
        }
186
    }
187
188
    private void setDefaultColors() {
189
        setColorStandard(getDefaultColorStandard());
190
        setColorError(getDefaultColorError());
191
        setColorLink(getDefaultColorLink());
192
        setColorLinkImportant(getDefaultColorLinkImportant());
193
        setColorBackground(getDefaultColorBackground());
194
    }
195
196
    private void setDefaultFont() {
197
        setFont(getDefaultFont());
198
    }
199
200
    public static Font getDefaultFont() {
201
        if (defaultFont == null) {
202
            int size = UIManager.getInt("uiFontSize");                  //NOI18N
203
            if (size < MIN_FONT_SIZE) {
204
                size = UIManager.getInt("customFontSize");              //NOI18N
205
            }
206
            if (size < MIN_FONT_SIZE) {
207
                Font f = (Font) UIManager.get("controlFont");           //NOI18N
208
                if (f != null) {
209
                    size = f.getSize();
210
                }
211
            }
212
            if (size < MIN_FONT_SIZE) {
213
                size = 11;
214
            }
215
            defaultFont = new Font("Monospaced", Font.PLAIN, size);     //NOI18N
216
        }
217
        return defaultFont;
218
    }
219
220
    public Font getFont() {
221
        return font;
222
    }
223
224
    public Color getColorStandard() {
225
        return colorStandard;
226
    }
227
228
    public Color getColorError() {
229
        return colorError;
230
    }
231
232
    public Color getColorLink() {
233
        return colorLink;
234
    }
235
236
    public Color getColorLinkImportant() {
237
        return colorLinkImportant;
238
    }
239
240
    public Color getColorBackground() {
241
        return colorBackground;
242
    }
243
244
    public LinkStyle getLinkStyle() {
245
        return linkStyle;
246
    }
247
248
    public void setFont(Font font) {
249
        Font fontToSet = font == null ? getDefaultFont() : font;
250
        if (!fontToSet.equals(this.font)) {
251
            Font oldFont = this.font;
252
            this.font = fontToSet;
253
            pcs.firePropertyChange(PROP_FONT, oldFont, fontToSet);
254
        }
255
    }
256
257
    public void setColorStandard(Color colorStandard) {
258
        Parameters.notNull("colorStandard", colorStandard);             //NOI18N
259
        if (!colorStandard.equals(this.colorStandard)) {
260
            Color oldColorStandard = this.colorStandard;
261
            this.colorStandard = colorStandard;
262
            pcs.firePropertyChange(PROP_COLOR_STANDARD, oldColorStandard,
263
                    colorStandard);
264
        }
265
    }
266
267
    public void setColorError(Color colorError) {
268
        Parameters.notNull("colorError", colorError);                   //NOI18N
269
        if (!colorError.equals(this.colorError)) {
270
            Color oldColorError = this.colorError;
271
            this.colorError = colorError;
272
            pcs.firePropertyChange(PROP_COLOR_ERROR, oldColorError, colorError);
273
        }
274
    }
275
276
    public void setColorLink(Color colorLink) {
277
        Parameters.notNull("colorLink", colorLink);                     //NOI18N
278
        if (!colorLink.equals(this.colorLink)) {
279
            Color oldColorLink = this.colorLink;
280
            this.colorLink = colorLink;
281
            pcs.firePropertyChange(PROP_COLOR_LINK, oldColorLink, colorLink);
282
        }
283
    }
284
285
    public void setColorLinkImportant(Color colorLinkImportant) {
286
        Parameters.notNull("colorLinkImportant", colorLinkImportant);   //NOI18N
287
        if (!colorLinkImportant.equals(this.colorLinkImportant)) {
288
            Color oldColorLinkImportant = this.colorLinkImportant;
289
            this.colorLinkImportant = colorLinkImportant;
290
            pcs.firePropertyChange(PROP_COLOR_LINK_IMPORTANT,
291
                    oldColorLinkImportant, colorLinkImportant);
292
        }
293
    }
294
295
    public void setColorBackground(Color colorBackground) {
296
        Parameters.notNull("colorBackground", colorBackground);         //NOI18N
297
        if (!colorBackground.equals(this.colorBackground)) {
298
            Color oldColorBackground = this.colorBackground;
299
            this.colorBackground = colorBackground;
300
            pcs.firePropertyChange(PROP_COLOR_BACKGROUND, oldColorBackground,
301
                    colorBackground);
302
        }
303
    }
304
305
    public void setLinkStyle(LinkStyle linkStyle) {
306
        Parameters.notNull("linkStyle", linkStyle);                     //NOI18N
307
        if (!linkStyle.equals(this.linkStyle)) {
308
            LinkStyle oldLinkStyle = this.linkStyle;
309
            this.linkStyle = linkStyle;
310
            pcs.firePropertyChange(PROP_STYLE_LINK, oldLinkStyle, linkStyle);
311
        }
312
    }
313
314
    public static synchronized OutputOptions getDefault() {
315
        if (DEFAULT == null) {
316
            DEFAULT = new OutputOptions(true);
317
        }
318
        return DEFAULT;
319
    }
320
321
    public void addPropertyChangeListener(
322
            PropertyChangeListener listener) {
323
        pcs.addPropertyChangeListener(listener);
324
    }
325
326
    public void removePropertyChangeListener(
327
            PropertyChangeListener listener) {
328
        pcs.removePropertyChangeListener(listener);
329
    }
330
331
    /**
332
     * Create a copy of this object, with the same options values, but with
333
     * separate set of listeners.
334
     */
335
    public OutputOptions makeCopy() {
336
        final OutputOptions copy = new OutputOptions(false);
337
        copy.font = font;
338
        copy.colorStandard = this.colorStandard;
339
        copy.colorError = this.colorError;
340
        copy.colorBackground = this.colorBackground;
341
        copy.colorLink = this.colorLink;
342
        copy.colorLinkImportant = this.colorLinkImportant;
343
        copy.initialized = initialized;
344
        copy.linkStyle = linkStyle;
345
        if (!initialized) {
346
            PropertyChangeListener l = new PropertyChangeListener() {
347
                @Override
348
                public void propertyChange(PropertyChangeEvent evt) {
349
                    if (evt.getPropertyName().equals(PROP_INITIALIZED)) {
350
                        copy.assign(OutputOptions.this);
351
                        copy.initialized = true;
352
                        copy.pcs.firePropertyChange(PROP_INITIALIZED,
353
                                false, true);
354
                        OutputOptions.this.removePropertyChangeListener(this);
355
                    }
356
                }
357
            };
358
            OutputOptions.this.addPropertyChangeListener(l);
359
        }
360
        return copy;
361
    }
362
363
    /**
364
     * Assign values from another object.
365
     */
366
    public void assign(OutputOptions outputOptions) {
367
        this.setFont(outputOptions.getFont());
368
        this.setColorStandard(outputOptions.getColorStandard());
369
        this.setColorError(outputOptions.getColorError());
370
        this.setColorLink(outputOptions.getColorLink());
371
        this.setColorLinkImportant(outputOptions.getColorLinkImportant());
372
        this.setColorBackground(outputOptions.getColorBackground());
373
        this.setLinkStyle(outputOptions.getLinkStyle());
374
    }
375
376
    static Color getDefaultColorStandard() {
377
        Color out = UIManager.getColor("nb.output.foreground");         //NOI18N
378
        if (out == null) {
379
            out = UIManager.getColor("textText");                       //NOI18N
380
            if (out == null) {
381
                out = Color.BLACK;
382
            }
383
        }
384
        return out;
385
    }
386
387
    static Color getDefaultColorBackground() {
388
        Color back = UIManager.getColor("nb.output.backgorund");        //NOI18N
389
        if (back == null) {
390
            back = UIManager.getColor("text");                          //NOI18N
391
            if (back == null) {
392
                back = Color.WHITE;
393
            }
394
        }
395
        return back;
396
    }
397
398
    static Color getDefaultColorError() {
399
        Color err = UIManager.getColor("nb.output.err.foreground");     //NOI18N
400
        if (err == null) {
401
            err = LFCustoms.shiftColor(Color.red);
402
        }
403
        return err;
404
    }
405
406
    static Color getDefaultColorLink() {
407
        Color hyperlink = UIManager.getColor(
408
                "nb.output.link.foreground");                           //NOI18N
409
        if (hyperlink == null) {
410
            hyperlink = LFCustoms.shiftColor(Color.blue);
411
        }
412
        return hyperlink;
413
    }
414
415
    static Color getDefaultColorLinkImportant() {
416
        Color hyperlinkImp = UIManager.getColor(
417
                "nb.output.link.foreground.important");                 //NOI18N
418
        if (hyperlinkImp == null) {
419
            return getDefaultColorLink();
420
        } else {
421
            return hyperlinkImp;
422
        }
423
    }
424
425
    public Color getColorForType(IOColors.OutputType type) {
426
        switch (type) {
427
            case OUTPUT:
428
                return getColorStandard();
429
            case ERROR:
430
                return getColorError();
431
            case HYPERLINK:
432
                return getColorLink();
433
            case HYPERLINK_IMPORTANT:
434
                return getColorLinkImportant();
435
            default:
436
                return getColorStandard();
437
        }
438
    }
439
}
(-)a/core.output2/src/org/netbeans/core/output2/options/OutputSettingsOptionsPanelController.java (+127 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.output2.options;
43
44
import java.beans.PropertyChangeListener;
45
import java.beans.PropertyChangeSupport;
46
import javax.swing.JComponent;
47
import org.netbeans.spi.options.OptionsPanelController;
48
import org.openide.util.HelpCtx;
49
import org.openide.util.Lookup;
50
51
@OptionsPanelController.SubRegistration(
52
    location = "Advanced",
53
displayName = "#AdvancedOption_DisplayName_OutputSettings",
54
keywords = "#AdvancedOption_Keywords_OutputSettings",
55
keywordsCategory = "Advanced/OutputSettings",
56
id="OutputSettings")
57
@org.openide.util.NbBundle.Messages({
58
    "AdvancedOption_DisplayName_OutputSettings=Output",
59
    "AdvancedOption_Keywords_OutputSettings=Output Window Font Color"})
60
public final class OutputSettingsOptionsPanelController extends OptionsPanelController {
61
62
    private OutputSettingsPanel panel;
63
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
64
    private boolean changed;
65
66
    @Override
67
    public void update() {
68
        getPanel().load();
69
        changed = false;
70
    }
71
72
    @Override
73
    public void applyChanges() {
74
        getPanel().store();
75
        changed = false;
76
    }
77
78
    @Override
79
    public void cancel() {
80
        // need not do anything special, if no changes have been persisted yet
81
    }
82
83
    @Override
84
    public boolean isValid() {
85
        return getPanel().valid();
86
    }
87
88
    @Override
89
    public boolean isChanged() {
90
        return changed;
91
    }
92
93
    @Override
94
    public HelpCtx getHelpCtx() {
95
        return null; // new HelpCtx("...ID") if you have a help set
96
    }
97
98
    @Override
99
    public JComponent getComponent(Lookup masterLookup) {
100
        return getPanel();
101
    }
102
103
    @Override
104
    public void addPropertyChangeListener(PropertyChangeListener l) {
105
        pcs.addPropertyChangeListener(l);
106
    }
107
108
    @Override
109
    public void removePropertyChangeListener(PropertyChangeListener l) {
110
        pcs.removePropertyChangeListener(l);
111
    }
112
113
    private OutputSettingsPanel getPanel() {
114
        if (panel == null) {
115
            panel = new OutputSettingsPanel(this);
116
        }
117
        return panel;
118
    }
119
120
    void changed() {
121
        if (!changed) {
122
            changed = true;
123
            pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
124
        }
125
        pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
126
    }
127
}
(-)a/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.form (+393 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" alignment="1" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Group type="103" groupAlignment="1" attributes="0">
22
                  <Component id="previewPanel" max="32767" attributes="0"/>
23
                  <Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
24
                  <Group type="102" alignment="0" attributes="0">
25
                      <Component id="lblTitle" min="-2" max="-2" attributes="0"/>
26
                      <EmptySpace max="32767" attributes="0"/>
27
                      <Component id="btnRestore" min="-2" max="-2" attributes="0"/>
28
                  </Group>
29
              </Group>
30
              <EmptySpace max="-2" attributes="0"/>
31
          </Group>
32
      </Group>
33
    </DimensionLayout>
34
    <DimensionLayout dim="1">
35
      <Group type="103" groupAlignment="0" attributes="0">
36
          <Group type="102" alignment="0" attributes="0">
37
              <EmptySpace max="-2" attributes="0"/>
38
              <Group type="103" groupAlignment="3" attributes="0">
39
                  <Component id="lblTitle" alignment="3" min="-2" max="-2" attributes="0"/>
40
                  <Component id="btnRestore" alignment="3" min="-2" max="-2" attributes="0"/>
41
              </Group>
42
              <EmptySpace max="-2" attributes="0"/>
43
              <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
44
              <EmptySpace max="-2" attributes="0"/>
45
              <Component id="previewPanel" pref="101" max="32767" attributes="0"/>
46
              <EmptySpace max="-2" attributes="0"/>
47
          </Group>
48
      </Group>
49
    </DimensionLayout>
50
  </Layout>
51
  <SubComponents>
52
    <Component class="javax.swing.JLabel" name="lblTitle">
53
      <Properties>
54
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
55
          <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblTitle.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
56
        </Property>
57
      </Properties>
58
    </Component>
59
    <Container class="javax.swing.JPanel" name="jPanel2">
60
61
      <Layout>
62
        <DimensionLayout dim="0">
63
          <Group type="103" groupAlignment="0" attributes="0">
64
              <Group type="102" attributes="0">
65
                  <EmptySpace max="-2" attributes="0"/>
66
                  <Group type="103" groupAlignment="0" attributes="0">
67
                      <Group type="102" attributes="0">
68
                          <Group type="103" groupAlignment="0" attributes="0">
69
                              <Component id="lblLinkColor" alignment="0" min="-2" max="-2" attributes="0"/>
70
                              <Component id="lblFontFamily" alignment="0" min="-2" max="-2" attributes="0"/>
71
                              <Component id="lblBackgroundColor" alignment="0" min="-2" max="-2" attributes="0"/>
72
                              <Component id="lblFontSize" alignment="0" min="-2" max="-2" attributes="0"/>
73
                              <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
74
                              <Component id="lblLinkStyle" alignment="0" min="-2" max="-2" attributes="0"/>
75
                          </Group>
76
                          <EmptySpace min="79" pref="79" max="-2" attributes="0"/>
77
                          <Group type="103" groupAlignment="0" attributes="0">
78
                              <Component id="cmbLinkStyle" max="32767" attributes="0"/>
79
                              <Component id="cmbLinkColor" max="32767" attributes="0"/>
80
                              <Group type="102" alignment="1" attributes="0">
81
                                  <Component id="fldFontFamily" max="32767" attributes="0"/>
82
                                  <EmptySpace max="-2" attributes="0"/>
83
                                  <Component id="btnSelectFont" min="-2" max="-2" attributes="0"/>
84
                              </Group>
85
                              <Group type="102" attributes="0">
86
                                  <Component id="spnFontSize" min="-2" pref="71" max="-2" attributes="0"/>
87
                                  <EmptySpace min="0" pref="46" max="32767" attributes="0"/>
88
                              </Group>
89
                              <Component id="cmbImportantLinkColor" max="32767" attributes="0"/>
90
                              <Component id="cmbBackgroundColor" alignment="0" max="32767" attributes="0"/>
91
                          </Group>
92
                      </Group>
93
                      <Group type="102" alignment="0" attributes="0">
94
                          <Group type="103" groupAlignment="0" attributes="0">
95
                              <Component id="lblErrorColor" alignment="0" min="-2" max="-2" attributes="0"/>
96
                              <Component id="lblStandardColor" alignment="0" min="-2" max="-2" attributes="0"/>
97
                          </Group>
98
                          <EmptySpace min="-2" pref="104" max="-2" attributes="0"/>
99
                          <Group type="103" groupAlignment="0" attributes="0">
100
                              <Component id="cmbErrorColor" max="32767" attributes="0"/>
101
                              <Component id="cmbStandardColor" max="32767" attributes="0"/>
102
                          </Group>
103
                      </Group>
104
                  </Group>
105
                  <EmptySpace max="-2" attributes="0"/>
106
              </Group>
107
          </Group>
108
        </DimensionLayout>
109
        <DimensionLayout dim="1">
110
          <Group type="103" groupAlignment="0" attributes="0">
111
              <Group type="102" alignment="0" attributes="0">
112
                  <EmptySpace max="-2" attributes="0"/>
113
                  <Group type="103" groupAlignment="3" attributes="0">
114
                      <Component id="lblFontFamily" alignment="3" min="-2" max="-2" attributes="0"/>
115
                      <Component id="btnSelectFont" alignment="3" min="-2" max="-2" attributes="0"/>
116
                      <Component id="fldFontFamily" alignment="3" min="-2" max="-2" attributes="0"/>
117
                  </Group>
118
                  <EmptySpace max="-2" attributes="0"/>
119
                  <Group type="103" groupAlignment="3" attributes="0">
120
                      <Component id="lblFontSize" alignment="3" min="-2" max="-2" attributes="0"/>
121
                      <Component id="spnFontSize" alignment="3" min="-2" max="-2" attributes="0"/>
122
                  </Group>
123
                  <EmptySpace type="separate" max="-2" attributes="0"/>
124
                  <Group type="103" groupAlignment="3" attributes="0">
125
                      <Component id="lblBackgroundColor" alignment="3" min="-2" max="-2" attributes="0"/>
126
                      <Component id="cmbBackgroundColor" alignment="3" min="-2" max="-2" attributes="0"/>
127
                  </Group>
128
                  <EmptySpace max="-2" attributes="0"/>
129
                  <Group type="103" groupAlignment="3" attributes="0">
130
                      <Component id="cmbStandardColor" alignment="3" min="-2" max="-2" attributes="0"/>
131
                      <Component id="lblStandardColor" alignment="3" min="-2" max="-2" attributes="0"/>
132
                  </Group>
133
                  <EmptySpace max="-2" attributes="0"/>
134
                  <Group type="103" groupAlignment="3" attributes="0">
135
                      <Component id="cmbErrorColor" alignment="3" min="-2" max="-2" attributes="0"/>
136
                      <Component id="lblErrorColor" alignment="3" min="-2" max="-2" attributes="0"/>
137
                  </Group>
138
                  <EmptySpace max="-2" attributes="0"/>
139
                  <Group type="103" groupAlignment="3" attributes="0">
140
                      <Component id="lblLinkColor" alignment="3" min="-2" max="-2" attributes="0"/>
141
                      <Component id="cmbLinkColor" alignment="3" min="-2" max="-2" attributes="0"/>
142
                  </Group>
143
                  <EmptySpace max="-2" attributes="0"/>
144
                  <Group type="103" groupAlignment="3" attributes="0">
145
                      <Component id="cmbImportantLinkColor" alignment="3" min="-2" max="-2" attributes="0"/>
146
                      <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
147
                  </Group>
148
                  <EmptySpace max="-2" attributes="0"/>
149
                  <Group type="103" groupAlignment="3" attributes="0">
150
                      <Component id="cmbLinkStyle" alignment="3" min="-2" max="-2" attributes="0"/>
151
                      <Component id="lblLinkStyle" alignment="3" min="-2" max="-2" attributes="0"/>
152
                  </Group>
153
                  <EmptySpace max="32767" attributes="0"/>
154
              </Group>
155
          </Group>
156
        </DimensionLayout>
157
      </Layout>
158
      <SubComponents>
159
        <Component class="javax.swing.JLabel" name="lblFontFamily">
160
          <Properties>
161
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
162
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblFontFamily.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
163
            </Property>
164
          </Properties>
165
          <BindingProperties>
166
            <BindingProperty name="labelFor" source="btnSelectFont" target="lblFontFamily" targetPath="labelFor" updateStrategy="0" immediately="false"/>
167
          </BindingProperties>
168
        </Component>
169
        <Component class="javax.swing.JLabel" name="lblStandardColor">
170
          <Properties>
171
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
172
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblStandardColor.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
173
            </Property>
174
          </Properties>
175
          <BindingProperties>
176
            <BindingProperty name="labelFor" source="cmbStandardColor" target="lblStandardColor" targetPath="labelFor" updateStrategy="0" immediately="false"/>
177
          </BindingProperties>
178
        </Component>
179
        <Component class="javax.swing.JLabel" name="lblErrorColor">
180
          <Properties>
181
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
182
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblErrorColor.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
183
            </Property>
184
          </Properties>
185
          <BindingProperties>
186
            <BindingProperty name="labelFor" source="cmbErrorColor" target="lblErrorColor" targetPath="labelFor" updateStrategy="0" immediately="false"/>
187
          </BindingProperties>
188
        </Component>
189
        <Component class="javax.swing.JLabel" name="lblBackgroundColor">
190
          <Properties>
191
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
192
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblBackgroundColor.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
193
            </Property>
194
          </Properties>
195
          <BindingProperties>
196
            <BindingProperty name="labelFor" source="cmbBackgroundColor" target="lblBackgroundColor" targetPath="labelFor" updateStrategy="0" immediately="false"/>
197
          </BindingProperties>
198
        </Component>
199
        <Component class="javax.swing.JLabel" name="lblLinkColor">
200
          <Properties>
201
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
202
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblLinkColor.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
203
            </Property>
204
          </Properties>
205
          <BindingProperties>
206
            <BindingProperty name="labelFor" source="cmbLinkColor" target="lblLinkColor" targetPath="labelFor" updateStrategy="0" immediately="false"/>
207
          </BindingProperties>
208
        </Component>
209
        <Component class="javax.swing.JComboBox" name="cmbLinkColor">
210
          <Properties>
211
            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
212
              <StringArray count="0"/>
213
            </Property>
214
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
215
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.cmbLinkColor.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
216
            </Property>
217
          </Properties>
218
          <Events>
219
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmbLinkColorActionPerformed"/>
220
          </Events>
221
          <AuxValues>
222
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ColorComboBox()"/>
223
          </AuxValues>
224
        </Component>
225
        <Component class="javax.swing.JComboBox" name="cmbBackgroundColor">
226
          <Properties>
227
            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
228
              <StringArray count="0"/>
229
            </Property>
230
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
231
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.cmbBackgroundColor.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
232
            </Property>
233
          </Properties>
234
          <Events>
235
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmbBackgroundColorActionPerformed"/>
236
          </Events>
237
          <AuxValues>
238
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ColorComboBox()"/>
239
          </AuxValues>
240
        </Component>
241
        <Component class="javax.swing.JComboBox" name="cmbErrorColor">
242
          <Properties>
243
            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
244
              <StringArray count="0"/>
245
            </Property>
246
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
247
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.cmbErrorColor.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
248
            </Property>
249
          </Properties>
250
          <Events>
251
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmbErrorColorActionPerformed"/>
252
          </Events>
253
          <AuxValues>
254
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ColorComboBox()"/>
255
          </AuxValues>
256
        </Component>
257
        <Component class="javax.swing.JComboBox" name="cmbStandardColor">
258
          <Properties>
259
            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
260
              <StringArray count="0"/>
261
            </Property>
262
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
263
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.cmbStandardColor.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
264
            </Property>
265
          </Properties>
266
          <Events>
267
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmbStandardColorActionPerformed"/>
268
          </Events>
269
          <AuxValues>
270
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ColorComboBox()"/>
271
          </AuxValues>
272
        </Component>
273
        <Component class="javax.swing.JLabel" name="lblFontSize">
274
          <Properties>
275
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
276
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblFontSize.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
277
            </Property>
278
          </Properties>
279
          <BindingProperties>
280
            <BindingProperty name="labelFor" source="spnFontSize" target="lblFontSize" targetPath="labelFor" updateStrategy="0" immediately="false"/>
281
          </BindingProperties>
282
        </Component>
283
        <Component class="javax.swing.JSpinner" name="spnFontSize">
284
          <Properties>
285
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
286
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.spnFontSize.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
287
            </Property>
288
          </Properties>
289
          <Events>
290
            <EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spnFontSizeStateChanged"/>
291
          </Events>
292
        </Component>
293
        <Component class="javax.swing.JButton" name="btnSelectFont">
294
          <Properties>
295
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
296
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.btnSelectFont.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
297
            </Property>
298
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
299
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.btnSelectFont.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
300
            </Property>
301
          </Properties>
302
          <Events>
303
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSelectFontActionPerformed"/>
304
          </Events>
305
        </Component>
306
        <Component class="javax.swing.JComboBox" name="cmbLinkStyle">
307
          <Properties>
308
            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
309
              <Connection code="linkStyleModel" type="code"/>
310
            </Property>
311
            <Property name="selectedIndex" type="int" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
312
              <Connection code="0" type="code"/>
313
            </Property>
314
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
315
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.cmbLinkStyle.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
316
            </Property>
317
          </Properties>
318
          <Events>
319
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmbLinkStyleActionPerformed"/>
320
          </Events>
321
        </Component>
322
        <Component class="javax.swing.JLabel" name="lblLinkStyle">
323
          <Properties>
324
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
325
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.lblLinkStyle.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
326
            </Property>
327
          </Properties>
328
          <BindingProperties>
329
            <BindingProperty name="labelFor" source="cmbLinkStyle" target="lblLinkStyle" targetPath="labelFor" updateStrategy="0" immediately="false"/>
330
          </BindingProperties>
331
        </Component>
332
        <Component class="javax.swing.JTextField" name="fldFontFamily">
333
          <Properties>
334
            <Property name="editable" type="boolean" value="false"/>
335
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
336
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.fldFontFamily.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
337
            </Property>
338
          </Properties>
339
        </Component>
340
        <Component class="javax.swing.JComboBox" name="cmbImportantLinkColor">
341
          <Properties>
342
            <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
343
              <StringArray count="0"/>
344
            </Property>
345
            <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
346
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.cmbImportantLinkColor.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
347
            </Property>
348
          </Properties>
349
          <Events>
350
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmbImportantLinkColorActionPerformed"/>
351
          </Events>
352
          <AuxValues>
353
            <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ColorComboBox()"/>
354
          </AuxValues>
355
        </Component>
356
        <Component class="javax.swing.JLabel" name="jLabel1">
357
          <Properties>
358
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
359
              <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
360
            </Property>
361
          </Properties>
362
          <BindingProperties>
363
            <BindingProperty name="labelFor" source="cmbImportantLinkColor" target="jLabel1" targetPath="labelFor" updateStrategy="0" immediately="false"/>
364
          </BindingProperties>
365
        </Component>
366
      </SubComponents>
367
    </Container>
368
    <Container class="javax.swing.JPanel" name="previewPanel">
369
      <Properties>
370
        <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
371
          <Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
372
            <BevelBorder bevelType="1"/>
373
          </Border>
374
        </Property>
375
      </Properties>
376
377
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
378
    </Container>
379
    <Component class="javax.swing.JButton" name="btnRestore">
380
      <Properties>
381
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
382
          <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.btnRestore.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
383
        </Property>
384
        <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
385
          <ResourceString bundle="org/netbeans/core/output2/options/Bundle.properties" key="OutputSettingsPanel.btnRestore.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
386
        </Property>
387
      </Properties>
388
      <Events>
389
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRestoreActionPerformed"/>
390
      </Events>
391
    </Component>
392
  </SubComponents>
393
</Form>
(-)a/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.java (+542 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.output2.options;
43
44
import java.awt.Color;
45
import java.awt.Font;
46
import java.beans.PropertyChangeEvent;
47
import java.beans.PropertyChangeListener;
48
import java.beans.PropertyEditor;
49
import java.beans.PropertyEditorManager;
50
import java.io.IOException;
51
import javax.swing.Action;
52
import javax.swing.JComboBox;
53
import org.netbeans.core.output2.Controller;
54
import org.netbeans.core.output2.NbIOProvider;
55
import org.openide.DialogDescriptor;
56
import org.openide.DialogDisplayer;
57
import org.openide.awt.ColorComboBox;
58
import org.openide.util.Lookup;
59
import org.openide.util.NbBundle;
60
import org.openide.util.NbPreferences;
61
import org.openide.util.RequestProcessor;
62
import org.openide.windows.IOColorPrint;
63
import org.openide.windows.IOContainer;
64
import org.openide.windows.InputOutput;
65
import org.openide.windows.OutputEvent;
66
import org.openide.windows.OutputListener;
67
68
@NbBundle.Messages({
69
    "LBL_Description=Output Window Settings"
70
})
71
public final class OutputSettingsPanel extends javax.swing.JPanel {
72
73
    private OutputOptions outputOptions;
74
    private InputOutput previewInputOutput = null;
75
    private final OutputSettingsOptionsPanelController controller;
76
    private LinkStyleModel linkStyleModel = new LinkStyleModel();
77
78
    OutputSettingsPanel(OutputSettingsOptionsPanelController controller) {
79
        this.controller = controller;
80
        initComponents();
81
    }
82
83
    /**
84
     * This method is called from within the constructor to initialize the form.
85
     * WARNING: Do NOT modify this code. The content of this method is always
86
     * regenerated by the Form Editor.
87
     */
88
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
89
    private void initComponents() {
90
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
91
92
        lblTitle = new javax.swing.JLabel();
93
        jPanel2 = new javax.swing.JPanel();
94
        lblFontFamily = new javax.swing.JLabel();
95
        lblStandardColor = new javax.swing.JLabel();
96
        lblErrorColor = new javax.swing.JLabel();
97
        lblBackgroundColor = new javax.swing.JLabel();
98
        lblLinkColor = new javax.swing.JLabel();
99
        cmbLinkColor = new ColorComboBox();
100
        cmbBackgroundColor = new ColorComboBox();
101
        cmbErrorColor = new ColorComboBox();
102
        cmbStandardColor = new ColorComboBox();
103
        lblFontSize = new javax.swing.JLabel();
104
        spnFontSize = new javax.swing.JSpinner();
105
        btnSelectFont = new javax.swing.JButton();
106
        cmbLinkStyle = new javax.swing.JComboBox();
107
        lblLinkStyle = new javax.swing.JLabel();
108
        fldFontFamily = new javax.swing.JTextField();
109
        cmbImportantLinkColor = new ColorComboBox();
110
        jLabel1 = new javax.swing.JLabel();
111
        previewPanel = new javax.swing.JPanel();
112
        btnRestore = new javax.swing.JButton();
113
114
        org.openide.awt.Mnemonics.setLocalizedText(lblTitle, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblTitle.text")); // NOI18N
115
116
        org.openide.awt.Mnemonics.setLocalizedText(lblFontFamily, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblFontFamily.text")); // NOI18N
117
118
        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, btnSelectFont, org.jdesktop.beansbinding.ObjectProperty.create(), lblFontFamily, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
119
        bindingGroup.addBinding(binding);
120
121
        org.openide.awt.Mnemonics.setLocalizedText(lblStandardColor, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblStandardColor.text")); // NOI18N
122
123
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cmbStandardColor, org.jdesktop.beansbinding.ObjectProperty.create(), lblStandardColor, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
124
        bindingGroup.addBinding(binding);
125
126
        org.openide.awt.Mnemonics.setLocalizedText(lblErrorColor, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblErrorColor.text")); // NOI18N
127
128
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cmbErrorColor, org.jdesktop.beansbinding.ObjectProperty.create(), lblErrorColor, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
129
        bindingGroup.addBinding(binding);
130
131
        org.openide.awt.Mnemonics.setLocalizedText(lblBackgroundColor, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblBackgroundColor.text")); // NOI18N
132
133
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cmbBackgroundColor, org.jdesktop.beansbinding.ObjectProperty.create(), lblBackgroundColor, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
134
        bindingGroup.addBinding(binding);
135
136
        org.openide.awt.Mnemonics.setLocalizedText(lblLinkColor, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblLinkColor.text")); // NOI18N
137
138
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cmbLinkColor, org.jdesktop.beansbinding.ObjectProperty.create(), lblLinkColor, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
139
        bindingGroup.addBinding(binding);
140
141
        cmbLinkColor.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.cmbLinkColor.toolTipText")); // NOI18N
142
        cmbLinkColor.addActionListener(new java.awt.event.ActionListener() {
143
            public void actionPerformed(java.awt.event.ActionEvent evt) {
144
                cmbLinkColorActionPerformed(evt);
145
            }
146
        });
147
148
        cmbBackgroundColor.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.cmbBackgroundColor.toolTipText")); // NOI18N
149
        cmbBackgroundColor.addActionListener(new java.awt.event.ActionListener() {
150
            public void actionPerformed(java.awt.event.ActionEvent evt) {
151
                cmbBackgroundColorActionPerformed(evt);
152
            }
153
        });
154
155
        cmbErrorColor.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.cmbErrorColor.toolTipText")); // NOI18N
156
        cmbErrorColor.addActionListener(new java.awt.event.ActionListener() {
157
            public void actionPerformed(java.awt.event.ActionEvent evt) {
158
                cmbErrorColorActionPerformed(evt);
159
            }
160
        });
161
162
        cmbStandardColor.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.cmbStandardColor.toolTipText")); // NOI18N
163
        cmbStandardColor.addActionListener(new java.awt.event.ActionListener() {
164
            public void actionPerformed(java.awt.event.ActionEvent evt) {
165
                cmbStandardColorActionPerformed(evt);
166
            }
167
        });
168
169
        org.openide.awt.Mnemonics.setLocalizedText(lblFontSize, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblFontSize.text")); // NOI18N
170
171
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, spnFontSize, org.jdesktop.beansbinding.ObjectProperty.create(), lblFontSize, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
172
        bindingGroup.addBinding(binding);
173
174
        spnFontSize.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.spnFontSize.toolTipText")); // NOI18N
175
        spnFontSize.addChangeListener(new javax.swing.event.ChangeListener() {
176
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
177
                spnFontSizeStateChanged(evt);
178
            }
179
        });
180
181
        org.openide.awt.Mnemonics.setLocalizedText(btnSelectFont, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.btnSelectFont.text")); // NOI18N
182
        btnSelectFont.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.btnSelectFont.toolTipText")); // NOI18N
183
        btnSelectFont.addActionListener(new java.awt.event.ActionListener() {
184
            public void actionPerformed(java.awt.event.ActionEvent evt) {
185
                btnSelectFontActionPerformed(evt);
186
            }
187
        });
188
189
        cmbLinkStyle.setModel(linkStyleModel);
190
        cmbLinkStyle.setSelectedIndex(0);
191
        cmbLinkStyle.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.cmbLinkStyle.toolTipText")); // NOI18N
192
        cmbLinkStyle.addActionListener(new java.awt.event.ActionListener() {
193
            public void actionPerformed(java.awt.event.ActionEvent evt) {
194
                cmbLinkStyleActionPerformed(evt);
195
            }
196
        });
197
198
        org.openide.awt.Mnemonics.setLocalizedText(lblLinkStyle, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblLinkStyle.text")); // NOI18N
199
200
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cmbLinkStyle, org.jdesktop.beansbinding.ObjectProperty.create(), lblLinkStyle, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
201
        bindingGroup.addBinding(binding);
202
203
        fldFontFamily.setEditable(false);
204
        fldFontFamily.setText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.fldFontFamily.text")); // NOI18N
205
206
        cmbImportantLinkColor.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.cmbImportantLinkColor.toolTipText")); // NOI18N
207
        cmbImportantLinkColor.addActionListener(new java.awt.event.ActionListener() {
208
            public void actionPerformed(java.awt.event.ActionEvent evt) {
209
                cmbImportantLinkColorActionPerformed(evt);
210
            }
211
        });
212
213
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.jLabel1.text")); // NOI18N
214
215
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, cmbImportantLinkColor, org.jdesktop.beansbinding.ObjectProperty.create(), jLabel1, org.jdesktop.beansbinding.BeanProperty.create("labelFor"));
216
        bindingGroup.addBinding(binding);
217
218
        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
219
        jPanel2.setLayout(jPanel2Layout);
220
        jPanel2Layout.setHorizontalGroup(
221
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
222
            .addGroup(jPanel2Layout.createSequentialGroup()
223
                .addContainerGap()
224
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
225
                    .addGroup(jPanel2Layout.createSequentialGroup()
226
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
227
                            .addComponent(lblLinkColor)
228
                            .addComponent(lblFontFamily)
229
                            .addComponent(lblBackgroundColor)
230
                            .addComponent(lblFontSize)
231
                            .addComponent(jLabel1)
232
                            .addComponent(lblLinkStyle))
233
                        .addGap(79, 79, 79)
234
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
235
                            .addComponent(cmbLinkStyle, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
236
                            .addComponent(cmbLinkColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
237
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
238
                                .addComponent(fldFontFamily)
239
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
240
                                .addComponent(btnSelectFont))
241
                            .addGroup(jPanel2Layout.createSequentialGroup()
242
                                .addComponent(spnFontSize, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
243
                                .addGap(0, 46, Short.MAX_VALUE))
244
                            .addComponent(cmbImportantLinkColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
245
                            .addComponent(cmbBackgroundColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
246
                    .addGroup(jPanel2Layout.createSequentialGroup()
247
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
248
                            .addComponent(lblErrorColor)
249
                            .addComponent(lblStandardColor))
250
                        .addGap(104, 104, 104)
251
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
252
                            .addComponent(cmbErrorColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
253
                            .addComponent(cmbStandardColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
254
                .addContainerGap())
255
        );
256
        jPanel2Layout.setVerticalGroup(
257
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
258
            .addGroup(jPanel2Layout.createSequentialGroup()
259
                .addContainerGap()
260
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
261
                    .addComponent(lblFontFamily)
262
                    .addComponent(btnSelectFont)
263
                    .addComponent(fldFontFamily, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
264
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
265
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
266
                    .addComponent(lblFontSize)
267
                    .addComponent(spnFontSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
268
                .addGap(18, 18, 18)
269
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
270
                    .addComponent(lblBackgroundColor)
271
                    .addComponent(cmbBackgroundColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
272
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
273
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
274
                    .addComponent(cmbStandardColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
275
                    .addComponent(lblStandardColor))
276
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
277
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
278
                    .addComponent(cmbErrorColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
279
                    .addComponent(lblErrorColor))
280
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
281
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
282
                    .addComponent(lblLinkColor)
283
                    .addComponent(cmbLinkColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
284
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
285
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
286
                    .addComponent(cmbImportantLinkColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
287
                    .addComponent(jLabel1))
288
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
289
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
290
                    .addComponent(cmbLinkStyle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
291
                    .addComponent(lblLinkStyle))
292
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
293
        );
294
295
        previewPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
296
        previewPanel.setLayout(new javax.swing.BoxLayout(previewPanel, javax.swing.BoxLayout.LINE_AXIS));
297
298
        org.openide.awt.Mnemonics.setLocalizedText(btnRestore, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.btnRestore.text")); // NOI18N
299
        btnRestore.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.btnRestore.toolTipText")); // NOI18N
300
        btnRestore.addActionListener(new java.awt.event.ActionListener() {
301
            public void actionPerformed(java.awt.event.ActionEvent evt) {
302
                btnRestoreActionPerformed(evt);
303
            }
304
        });
305
306
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
307
        this.setLayout(layout);
308
        layout.setHorizontalGroup(
309
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
310
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
311
                .addContainerGap()
312
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
313
                    .addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
314
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
315
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
316
                        .addComponent(lblTitle)
317
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
318
                        .addComponent(btnRestore)))
319
                .addContainerGap())
320
        );
321
        layout.setVerticalGroup(
322
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
323
            .addGroup(layout.createSequentialGroup()
324
                .addContainerGap()
325
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
326
                    .addComponent(lblTitle)
327
                    .addComponent(btnRestore))
328
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
329
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
330
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
331
                .addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
332
                .addContainerGap())
333
        );
334
335
        bindingGroup.bind();
336
    }// </editor-fold>//GEN-END:initComponents
337
338
    private void btnSelectFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFontActionPerformed
339
        PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
340
        if (pe != null) {
341
            pe.setValue(outputOptions.getFont());
342
            DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(),
343
                    NbBundle.getMessage(Controller.class,
344
                    "LBL_Font_Chooser_Title"));                         //NOI18N
345
            String defaultFont = NbBundle.getMessage(Controller.class,
346
                    "BTN_Defaul_Font");                                 //NOI18N
347
            dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
348
                        defaultFont, DialogDescriptor.CANCEL_OPTION});  //NOI18N
349
            DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
350
            if (dd.getValue() == DialogDescriptor.OK_OPTION) {
351
                Font f = (Font) pe.getValue();
352
                outputOptions.setFont(f);
353
            } else if (dd.getValue() == defaultFont) {
354
                outputOptions.setFont(null);
355
            }
356
            updateFontField();
357
        }
358
    }//GEN-LAST:event_btnSelectFontActionPerformed
359
360
    private void cmbStandardColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbStandardColorActionPerformed
361
        Color std = ((ColorComboBox) cmbStandardColor).getSelectedColor();
362
        if (std != null) {
363
            outputOptions.setColorStandard(std);
364
        }
365
    }//GEN-LAST:event_cmbStandardColorActionPerformed
366
367
    private void spnFontSizeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnFontSizeStateChanged
368
        int fontSize = (Integer) spnFontSize.getValue();
369
        outputOptions.setFont(outputOptions.getFont().deriveFont(
370
                (float) fontSize));
371
        updateFontField();
372
    }//GEN-LAST:event_spnFontSizeStateChanged
373
374
    private void cmbBackgroundColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbBackgroundColorActionPerformed
375
        Color bg = ((ColorComboBox) cmbBackgroundColor).getSelectedColor();
376
        if (bg != null) {
377
            outputOptions.setColorBackground(bg);
378
        }
379
    }//GEN-LAST:event_cmbBackgroundColorActionPerformed
380
381
    private void cmbErrorColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbErrorColorActionPerformed
382
        Color err = ((ColorComboBox) cmbErrorColor).getSelectedColor();
383
        if (err != null) {
384
            outputOptions.setColorError(err);
385
        }
386
    }//GEN-LAST:event_cmbErrorColorActionPerformed
387
388
    private void cmbLinkColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbLinkColorActionPerformed
389
        Color link = ((ColorComboBox) cmbLinkColor).getSelectedColor();
390
        if (link != null) {
391
            outputOptions.setColorLink(link);
392
        }
393
    }//GEN-LAST:event_cmbLinkColorActionPerformed
394
395
    private void cmbImportantLinkColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbImportantLinkColorActionPerformed
396
        Color iLink = ((ColorComboBox) cmbImportantLinkColor).
397
                getSelectedColor();
398
        if (iLink != null) {
399
            outputOptions.setColorLinkImportant(iLink);
400
        }
401
    }//GEN-LAST:event_cmbImportantLinkColorActionPerformed
402
403
    private void btnRestoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRestoreActionPerformed
404
        outputOptions.resetToDefault();
405
        updateControlsByModel();
406
    }//GEN-LAST:event_btnRestoreActionPerformed
407
408
    private void cmbLinkStyleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbLinkStyleActionPerformed
409
        outputOptions.setLinkStyle(linkStyleModel.getLinkStyle());
410
    }//GEN-LAST:event_cmbLinkStyleActionPerformed
411
412
    void load() {
413
        if (previewInputOutput == null) {
414
            initPreview();
415
        }
416
        updateControlsByModel();
417
    }
418
419
    private void selectColor(JComboBox combo, Color color) {
420
        ((ColorComboBox) combo).setSelectedColor(color);
421
    }
422
423
    private void updateFontField() {
424
        Font f = outputOptions.getFont();
425
        fldFontFamily.setText(f.getFamily() + " " + f.getSize());       //NOI18N
426
    }
427
428
    void store() {
429
        Controller.getDefault().updateOptions(outputOptions);
430
        OutputOptions.getDefault().assign(outputOptions);
431
        RequestProcessor.getDefault().post(new Runnable() {
432
            @Override
433
            public void run() {
434
                 OutputOptions.getDefault().saveTo(
435
                        NbPreferences.forModule(Controller.class));
436
            }
437
        });
438
    }
439
440
    void cancel() {
441
        if (previewInputOutput != null) {
442
            previewInputOutput.closeInputOutput();
443
        }
444
    }
445
446
    boolean valid() {
447
        // TODO check whether form is consistent and complete
448
        return true;
449
    }
450
    // Variables declaration - do not modify//GEN-BEGIN:variables
451
    private javax.swing.JButton btnRestore;
452
    private javax.swing.JButton btnSelectFont;
453
    private javax.swing.JComboBox cmbBackgroundColor;
454
    private javax.swing.JComboBox cmbErrorColor;
455
    private javax.swing.JComboBox cmbImportantLinkColor;
456
    private javax.swing.JComboBox cmbLinkColor;
457
    private javax.swing.JComboBox cmbLinkStyle;
458
    private javax.swing.JComboBox cmbStandardColor;
459
    private javax.swing.JTextField fldFontFamily;
460
    private javax.swing.JLabel jLabel1;
461
    private javax.swing.JPanel jPanel2;
462
    private javax.swing.JLabel lblBackgroundColor;
463
    private javax.swing.JLabel lblErrorColor;
464
    private javax.swing.JLabel lblFontFamily;
465
    private javax.swing.JLabel lblFontSize;
466
    private javax.swing.JLabel lblLinkColor;
467
    private javax.swing.JLabel lblLinkStyle;
468
    private javax.swing.JLabel lblStandardColor;
469
    private javax.swing.JLabel lblTitle;
470
    private javax.swing.JPanel previewPanel;
471
    private javax.swing.JSpinner spnFontSize;
472
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
473
    // End of variables declaration//GEN-END:variables
474
475
    private void initPreview() {
476
        previewInputOutput = initPreviewInputOutput();
477
        outputOptions = ((Lookup.Provider) previewInputOutput).
478
                getLookup().lookup(OutputOptions.class);
479
        previewInputOutput.getOut().println("Standard Output");         //NOI18N
480
        previewInputOutput.getErr().println("Error Output");            //NOI18N
481
        OutputListener ol = new OutputListenerImpl();
482
        try {
483
            IOColorPrint.print(previewInputOutput, "Standard Link", //NOI18N
484
                    ol, false, null);
485
            previewInputOutput.getOut().println();
486
            IOColorPrint.print(previewInputOutput, "Important Link", //NOI18N
487
                    ol, true, null);
488
            previewInputOutput.getOut().print(" ");                     //NOI18N
489
        } catch (IOException ex) {
490
            ex.printStackTrace(previewInputOutput.getErr());
491
        }
492
        previewInputOutput.getOut().close();
493
        previewInputOutput.getErr().close();
494
        outputOptions.addPropertyChangeListener(new PropertyChangeListener() {
495
            @Override
496
            public void propertyChange(PropertyChangeEvent evt) {
497
                controller.changed();
498
                updateControlsByModel();
499
            }
500
        });
501
    }
502
503
    private InputOutput initPreviewInputOutput() throws NullPointerException {
504
        IOContainer ioContainer = IOContainer.create(
505
                new PreviewIOProvider(previewPanel));
506
        InputOutput io = NbIOProvider.getDefault().getIO(
507
                "Preview", false, new Action[0], ioContainer);          //NOI18N
508
        return io;
509
    }
510
511
    private void updateControlsByModel() {
512
        updateFontField();
513
        spnFontSize.setValue(outputOptions.getFont().getSize());
514
        selectColor(cmbStandardColor, outputOptions.getColorStandard());
515
        selectColor(cmbErrorColor, outputOptions.getColorError());
516
        selectColor(cmbBackgroundColor, outputOptions.getColorBackground());
517
        selectColor(cmbLinkColor, outputOptions.getColorLink());
518
        selectColor(cmbImportantLinkColor,
519
                outputOptions.getColorLinkImportant());
520
        cmbLinkStyle.setSelectedItem(
521
                linkStyleModel.itemFor(outputOptions.getLinkStyle()));
522
        cmbLinkStyle.repaint();
523
    }
524
525
    private static class OutputListenerImpl implements OutputListener {
526
527
        public OutputListenerImpl() {
528
        }
529
530
        @Override
531
        public void outputLineSelected(OutputEvent ev) {
532
        }
533
534
        @Override
535
        public void outputLineAction(OutputEvent ev) {
536
        }
537
538
        @Override
539
        public void outputLineCleared(OutputEvent ev) {
540
        }
541
    }
542
}
(-)a/core.output2/src/org/netbeans/core/output2/options/PreviewIOProvider.java (+121 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.core.output2.options;
43
44
import javax.swing.Action;
45
import javax.swing.Icon;
46
import javax.swing.JComponent;
47
import javax.swing.JPanel;
48
import org.openide.windows.IOContainer;
49
import org.openide.windows.IOContainer.CallBacks;
50
51
/**
52
 *
53
 * @author jhavlin
54
 */
55
public class PreviewIOProvider implements IOContainer.Provider {
56
57
    JPanel panel;
58
59
    public PreviewIOProvider(JPanel panel) {
60
        this.panel = panel;
61
    }
62
63
    @Override
64
    public void open() {
65
    }
66
67
    @Override
68
    public void requestActive() {
69
        panel.requestFocusInWindow();
70
    }
71
72
    @Override
73
    public void requestVisible() {
74
        panel.requestFocusInWindow();
75
    }
76
77
    @Override
78
    public boolean isActivated() {
79
        return panel.hasFocus();
80
    }
81
82
    @Override
83
    public void add(JComponent comp, CallBacks cb) {
84
        panel.add(comp);
85
    }
86
87
    @Override
88
    public void remove(JComponent comp) {
89
        panel.remove(comp);
90
    }
91
92
    @Override
93
    public void select(JComponent comp) {
94
    }
95
96
    @Override
97
    public JComponent getSelected() {
98
        return (JComponent) panel.getComponent(0);
99
    }
100
101
    @Override
102
    public void setTitle(JComponent comp, String name) {
103
    }
104
105
    @Override
106
    public void setToolTipText(JComponent comp, String text) {
107
    }
108
109
    @Override
110
    public void setIcon(JComponent comp, Icon icon) {
111
    }
112
113
    @Override
114
    public void setToolbarActions(JComponent comp, Action[] toolbarActions) {
115
    }
116
117
    @Override
118
    public boolean isCloseable(JComponent comp) {
119
        return false;
120
    }
121
}
(-)a/core.output2/src/org/netbeans/core/output2/ui/AbstractOutputPane.java (-1 / +8 lines)
Lines 55-60 Link Here
55
import java.awt.event.*;
55
import java.awt.event.*;
56
import org.netbeans.core.output2.Controller;
56
import org.netbeans.core.output2.Controller;
57
import org.netbeans.core.output2.OutputDocument;
57
import org.netbeans.core.output2.OutputDocument;
58
import org.netbeans.core.output2.options.OutputOptions;
58
import org.openide.util.Exceptions;
59
import org.openide.util.Exceptions;
59
60
60
/**
61
/**
Lines 596-601 Link Here
596
    }
597
    }
597
598
598
    public void mouseClicked(MouseEvent e) {
599
    public void mouseClicked(MouseEvent e) {
600
        if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown()
601
                && SwingUtilities.isMiddleMouseButton(e)) {
602
            int currentSize = getViewFont().getSize();
603
            int defaultSize = OutputOptions.getDefault().getFont().getSize();
604
            changeFontSizeBy(defaultSize - currentSize);
605
        }
599
    }
606
    }
600
607
601
    public void mouseEntered(MouseEvent e) {
608
    public void mouseEntered(MouseEvent e) {
Lines 735-741 Link Here
735
    protected abstract void changeFontSizeBy(int change);
742
    protected abstract void changeFontSizeBy(int change);
736
743
737
    public final void mouseWheelMoved(MouseWheelEvent e) {
744
    public final void mouseWheelMoved(MouseWheelEvent e) {
738
        if (e.isControlDown()) {
745
        if (e.isAltDown() || e.isAltGraphDown() || e.isControlDown()) {
739
            int change = -e.getWheelRotation();
746
            int change = -e.getWheelRotation();
740
            changeFontSizeBy(change);
747
            changeFontSizeBy(change);
741
            e.consume();
748
            e.consume();
(-)a/core.output2/src/org/netbeans/core/output2/ui/AbstractOutputTab.java (+1 lines)
Lines 53-58 Link Here
53
import javax.swing.text.Document;
53
import javax.swing.text.Document;
54
import java.awt.*;
54
import java.awt.*;
55
import org.netbeans.core.output2.OutputDocument;
55
import org.netbeans.core.output2.OutputDocument;
56
import org.netbeans.core.output2.options.OutputOptions;
56
57
57
/**
58
/**
58
 * A basic output pane.  This class implements the non-output window specific
59
 * A basic output pane.  This class implements the non-output window specific

Return to bug 184908