diff -r 0cbde52c1fc3 core.output2/nbproject/project.xml --- a/core.output2/nbproject/project.xml Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/nbproject/project.xml Thu Apr 11 15:11:21 2013 +0200 @@ -111,7 +111,7 @@ - 1.33 + 1.38 diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/AbstractLines.java --- a/core.output2/src/org/netbeans/core/output2/AbstractLines.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/AbstractLines.java Thu Apr 11 15:11:21 2013 +0200 @@ -845,7 +845,8 @@ OutputOptions.getDefault().getColorStandard(), OutputOptions.getDefault().getColorError(), OutputOptions.getDefault().getColorLink(), - OutputOptions.getDefault().getColorLinkImportant() + OutputOptions.getDefault().getColorLinkImportant(), + OutputOptions.getDefault().getColorInput(), }; } @@ -862,11 +863,13 @@ if (info != null) { int lineLength = length(line); if (lineLength > info.getEnd()) { - info.addSegment(lineLength, false, null, null, null, false); + // This is an input + info.addSegment(lineLength, OutputKind.IN, null, null, null, false); } return info; } else { - return new LineInfo(this, length(line)); + // This is an input by default + return new LineInfo(this, length(line), OutputKind.IN, null, null, null, false); } } @@ -1012,7 +1015,7 @@ return lineStartList.toString(); } - private int addSegment(CharSequence s, int offset, int lineIdx, int pos, OutputListener l, boolean important, boolean err, Color c, Color b) { + private int addSegment(CharSequence s, int offset, int lineIdx, int pos, OutputListener l, boolean important, OutputKind outKind, Color c, Color b) { int len = length(lineIdx); if (len > 0) { LineInfo info = (LineInfo) linesToInfos.get(lineIdx); @@ -1022,7 +1025,7 @@ } int curEnd = info.getEnd(); if (pos > 0 && pos != curEnd) { - info.addSegment(pos, false, null, null, null, false); + info.addSegment(pos, OutputKind.OUT, null, null, null, false); curEnd = pos; } if (l != null) { @@ -1045,15 +1048,15 @@ } } if (leadingCnt > 0) { - info.addSegment(curEnd + leadingCnt, false, null, null, null, false); + info.addSegment(curEnd + leadingCnt, OutputKind.OUT, null, null, null, false); } - info.addSegment(endPos - trailingCnt, err, l, c, b, important); + info.addSegment(endPos - trailingCnt, outKind, l, c, b, important); if (trailingCnt > 0) { - info.addSegment(endPos, false, null, null, null, false); + info.addSegment(endPos, OutputKind.OUT, null, null, null, false); } registerLineWithListener(lineIdx, info, important); } else { - info.addSegment(len, err, l, c, b, important); + info.addSegment(len, outKind, l, c, b, important); if (important) { importantLines.add(lineIdx); } @@ -1062,7 +1065,7 @@ return len; } - void updateLinesInfo(CharSequence s, int startLine, int startPos, OutputListener l, boolean important, boolean err, Color c, Color b) { + void updateLinesInfo(CharSequence s, int startLine, int startPos, OutputListener l, boolean important, OutputKind outKind, Color c, Color b) { int offset = 0; /* If it's necessary to translate tabs to spaces, use this. * But it seems that it works fine without the translation. Translation breaks character indexes. @@ -1095,7 +1098,7 @@ */ int startLinePos = startPos - getLineStart(startLine); for (int i = startLine; i < getLineCount(); i++) { - offset += addSegment(s, offset, i, startLinePos, l, important, err, c, b) + 1; + offset += addSegment(s, offset, i, startLinePos, l, important, outKind, c, b) + 1; startLinePos = 0; } } diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/ErrWriter.java --- a/core.output2/src/org/netbeans/core/output2/ErrWriter.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/ErrWriter.java Thu Apr 11 15:11:21 2013 +0200 @@ -78,7 +78,7 @@ @Override public void println(String s, OutputListener l, boolean important) throws java.io.IOException { closed = false; - wrapped.print(s, l, important, null, null, true, true); + wrapped.print(s, l, important, null, null, OutputKind.ERR, true); } public void reset() throws IOException { @@ -208,6 +208,6 @@ private void print(CharSequence s, boolean addLineSep) { closed = false; - wrapped.print(s, null, false, null, null, true, addLineSep); + wrapped.print(s, null, false, null, null, OutputKind.ERR, addLineSep); } } diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/LineInfo.java --- a/core.output2/src/org/netbeans/core/output2/LineInfo.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/LineInfo.java Thu Apr 11 15:11:21 2013 +0200 @@ -63,23 +63,23 @@ } LineInfo(Lines parent, int end) { - this(parent, end, false, null, null, null, false); + this(parent, end, OutputKind.OUT, null, null, null, false); } - LineInfo(Lines parent, int end, boolean err, OutputListener l, Color c, Color b, boolean important) { + LineInfo(Lines parent, int end, OutputKind outKind, OutputListener l, Color c, Color b, boolean important) { this.parent = parent; - addSegment(end, err, l, c, b, important); + addSegment(end, outKind, l, c, b, important); } int getEnd() { return segments.isEmpty() ? 0 : segments.get(segments.size() - 1).getEnd(); } - void addSegment(int end, boolean err, OutputListener l, Color c, Color b, boolean important) { + void addSegment(int end, OutputKind outKind, OutputListener l, Color c, Color b, boolean important) { Segment s = null; if (!segments.isEmpty()) { s = segments.get(segments.size() - 1); - if (s.isErr() == err && s.getListener() == l && hasColors(s, c, b)) { + if (s.getKind() == outKind && s.getListener() == l && hasColors(s, c, b)) { // the same type of segment, prolong last one s.end = end; return; @@ -88,10 +88,8 @@ boolean isColor = c != null || b != null; if (l != null) { s = isColor ? new ColorListenerSegment(end, l, important, c, b) : new ListenerSegment(end, l, important); - } else if (err) { - s = isColor ? new ColorErrSegment(end, c, b) : new ErrSegment(end); } else { - s = isColor ? new ColorSegment(end, c, b) : new Segment(end); + s = isColor ? new ColorSegment(end, outKind, c, b) : new Segment(end, outKind); } segments.add(s); } @@ -191,10 +189,12 @@ public class Segment { - int end; + private int end; + private OutputKind outputKind; - public Segment(int end) { + Segment(int end, OutputKind outputKind) { this.end = end; + this.outputKind = outputKind; } int getEnd() { @@ -205,12 +205,26 @@ return null; } - boolean isErr() { - return false; + OutputKind getKind() { + return outputKind; } Color getColor() { - return parent.getDefColor(IOColors.OutputType.OUTPUT); + IOColors.OutputType type; + switch (outputKind) { + case OUT: + type = IOColors.OutputType.OUTPUT; + break; + case ERR: + type = IOColors.OutputType.ERROR; + break; + case IN: + type = IOColors.OutputType.INPUT; + break; + default: + type = IOColors.OutputType.OUTPUT; + } + return parent.getDefColor(type); } Color getCustomColor() { @@ -227,52 +241,8 @@ final Color color; final Color background; - public ColorSegment(int end, Color color, Color background) { - super(end); - this.color = color == null ? super.getColor() : color; - this.background = background; - } - - @Override - Color getColor() { - return color; - } - - @Override - Color getCustomColor() { - return color; - } - - @Override - Color getCustomBackground() { - return background; - } - } - - private class ErrSegment extends Segment { - - public ErrSegment(int end) { - super(end); - } - - @Override - boolean isErr() { - return true; - } - - @Override - Color getColor() { - return parent.getDefColor(IOColors.OutputType.ERROR); - } - } - - private class ColorErrSegment extends ErrSegment { - - final Color color; - final Color background; - - public ColorErrSegment(int end, Color color, Color background) { - super(end); + public ColorSegment(int end, OutputKind outputKind, Color color, Color background) { + super(end, outputKind); this.color = color == null ? super.getColor() : color; this.background = background; } @@ -299,7 +269,7 @@ final boolean important; public ListenerSegment(int end, OutputListener l, boolean important) { - super(end); + super(end, OutputKind.OUT); this.listener = l; this.important = important; } diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/NbIO.java --- a/core.output2/src/org/netbeans/core/output2/NbIO.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/NbIO.java Thu Apr 11 15:11:21 2013 +0200 @@ -512,7 +512,7 @@ protected void println(CharSequence text, OutputListener listener, boolean important, Color color) throws IOException { OutWriter out = out(); if (out != null) { - out.print(text, listener, important, color, null, false, true); + out.print(text, listener, important, color, null, OutputKind.OUT, true); } } } @@ -523,7 +523,7 @@ protected void print(CharSequence text, OutputListener listener, boolean important, Color color) throws IOException { OutWriter out = out(); if (out != null) { - out.print(text, listener, important, color, null, false, false); + out.print(text, listener, important, color, null, OutputKind.OUT, false); } } } diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/OutWriter.java --- a/core.output2/src/org/netbeans/core/output2/OutWriter.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/OutWriter.java Thu Apr 11 15:11:21 2013 +0200 @@ -340,8 +340,7 @@ @Override public synchronized void println(String s) { - doWrite(s, 0, s.length()); - println(); + print(s, null, false, null, null, OutputKind.OUT, true); } @Override @@ -414,7 +413,7 @@ } // XXX will not pick up ANSI sequences broken across write blocks, but this is likely rare - if (printANSI(s.subSequence(off, off + len), false, false, false)) { + if (printANSI(s.subSequence(off, off + len), false, OutputKind.OUT, false)) { return; } /* XXX causes stack overflow @@ -516,12 +515,12 @@ } public synchronized void println(String s, OutputListener l, boolean important) { - print(s, l, important, null, null, false, true); + print(s, l, important, null, null, OutputKind.OUT, true); } - synchronized void print(CharSequence s, OutputListener l, boolean important, Color c, Color b, boolean err, boolean addLS) { + synchronized void print(CharSequence s, OutputListener l, boolean important, Color c, Color b, OutputKind outKind, boolean addLS) { if (c == null) { - if (l == null && printANSI(s, important, err, addLS)) { + if (l == null && printANSI(s, important, outKind, addLS)) { return; } c = ansiColor; // carry over from previous line @@ -532,7 +531,7 @@ if (addLS) { println(); } - lines.updateLinesInfo(s, lastLine, lastPos, l, important, err, c, b); + lines.updateLinesInfo(s, lastLine, lastPos, l, important, outKind, c, b); } private Color ansiColor; private Color ansiBackground; @@ -560,7 +559,7 @@ new Color(0, 255, 255), new Color(255, 255, 255), }; - private boolean printANSI(CharSequence s, boolean important, boolean err, boolean addLS) { // #192779 + private boolean printANSI(CharSequence s, boolean important, OutputKind outKind, boolean addLS) { // #192779 int len = s.length(); boolean hasEscape = false; // fast initial check for (int i = 0; i < len - 1; i++) { @@ -577,7 +576,7 @@ while (m.find()) { int esc = m.start(); if (esc > text) { - print(s.subSequence(text, esc), null, important, ansiColor, ansiBackground, err, false); + print(s.subSequence(text, esc), null, important, ansiColor, ansiBackground, outKind, false); } text = m.end(); if (!"m".equals(m.group(3))) { //NOI18N @@ -638,7 +637,7 @@ return false; } if (text < len) { // final segment - print(s.subSequence(text, len), null, important, ansiColor, ansiBackground, err, addLS); + print(s.subSequence(text, len), null, important, ansiColor, ansiBackground, outKind, addLS); } else if (addLS) { // line ended w/ control seq println(); } @@ -646,10 +645,12 @@ } synchronized void print(CharSequence s, LineInfo info, boolean important) { - int line = lines.getLineCount() - 1; - doWrite(s, 0, s.length()); if (info != null) { + int line = lines.getLineCount() - 1; + doWrite(s, 0, s.length()); lines.addLineInfo(line, info, important); + } else { + print(s, null, important, null, null, OutputKind.OUT, false); } } diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/OutputKind.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.output2/src/org/netbeans/core/output2/OutputKind.java Thu Apr 11 15:11:21 2013 +0200 @@ -0,0 +1,55 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2013 Sun Microsystems, Inc. + */ +package org.netbeans.core.output2; + +/** + * The kind of output. + * + * @author Martin Entlicher + */ +enum OutputKind { + + OUT, + ERR, + IN + +} diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/OutputTab.java --- a/core.output2/src/org/netbeans/core/output2/OutputTab.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/OutputTab.java Thu Apr 11 15:11:21 2013 +0200 @@ -139,6 +139,8 @@ opts.getColorStandard()); lines.setDefColor(IOColors.OutputType.ERROR, opts.getColorError()); + lines.setDefColor(IOColors.OutputType.INPUT, + opts.getColorInput()); lines.setDefColor(IOColors.OutputType.HYPERLINK, opts.getColorLink()); lines.setDefColor(IOColors.OutputType.HYPERLINK_IMPORTANT, @@ -210,14 +212,14 @@ return new OutputPane(this); } - protected void inputSent(String txt) { + public void inputSent(String txt) { if (Controller.LOG) Controller.log("Input sent on OutputTab: " + txt); getOutputPane().lockScroll(); NbIO.IOReader in = io.in(); if (in != null) { if (Controller.LOG) Controller.log("Sending input to " + in); in.pushText(txt + "\n"); - outWriter.println(txt); + outWriter.print(txt, null, false, null, null, OutputKind.IN, true); } } @@ -771,6 +773,9 @@ } else if (OutputOptions.PROP_COLOR_ERROR.equals(pn)) { lines.setDefColor(IOColors.OutputType.ERROR, opts.getColorError()); + } else if (OutputOptions.PROP_COLOR_INPUT.equals(pn)) { + lines.setDefColor(IOColors.OutputType.INPUT, + opts.getColorInput()); } else if (OutputOptions.PROP_COLOR_LINK.equals(pn)) { lines.setDefColor(IOColors.OutputType.HYPERLINK, opts.getColorLink()); diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/options/Bundle.properties --- a/core.output2/src/org/netbeans/core/output2/options/Bundle.properties Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/options/Bundle.properties Thu Apr 11 15:11:21 2013 +0200 @@ -20,3 +20,5 @@ OutputSettingsPanel.cmbImportantLinkColor.toolTipText=Select important link foreground color OutputSettingsPanel.cmbLinkStyle.toolTipText=Select link style OutputSettingsPanel.lblUnwrappedOnly.text=(Does not apply to wrapped text) +OutputSettingsPanel.lblInputColor.text=&Input Color +OutputSettingsPanel.cmbInputColor.toolTipText=Select input text foreground color diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/options/OutputOptions.java --- a/core.output2/src/org/netbeans/core/output2/options/OutputOptions.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/options/OutputOptions.java Thu Apr 11 15:11:21 2013 +0200 @@ -82,6 +82,7 @@ private static final String PROP_FONT_STYLE = "font.style"; //NOI18N public static final String PROP_COLOR_STANDARD = "color.standard"; //NOI18N public static final String PROP_COLOR_ERROR = "color.error"; //NOI18N + public static final String PROP_COLOR_INPUT = "color.input"; //NOI18N public static final String PROP_COLOR_LINK = "color.link"; //NOI18N public static final String PROP_COLOR_LINK_IMPORTANT = "color.link.important"; //NOI18N @@ -97,6 +98,7 @@ private Font fontWrapped = null; // font for wrapped mode private Color colorStandard; private Color colorError; + private Color colorInput; private Color colorLink; private Color colorLinkImportant; private Color colorBackground; @@ -143,6 +145,9 @@ int rgbError = preferences.getInt(PREFIX + PROP_COLOR_ERROR, getDefaultColorError().getRGB()); diskData.setColorError(new Color(rgbError)); + int rgbInput = preferences.getInt(PREFIX + PROP_COLOR_INPUT, + getDefaultColorInput().getRGB()); + diskData.setColorInput(new Color(rgbInput)); int rgbBackground = preferences.getInt(PREFIX + PROP_COLOR_BACKGROUND, getDefaultColorBackground().getRGB()); diskData.setColorBackground(new Color(rgbBackground)); @@ -178,6 +183,8 @@ getColorStandard().getRGB()); preferences.putInt(PREFIX + PROP_COLOR_ERROR, getColorError().getRGB()); + preferences.putInt(PREFIX + PROP_COLOR_INPUT, + getColorInput().getRGB()); preferences.putInt(PREFIX + PROP_COLOR_BACKGROUND, getColorBackground().getRGB()); preferences.putInt(PREFIX + PROP_COLOR_LINK, @@ -200,6 +207,7 @@ private void setDefaultColors() { setColorStandard(getDefaultColorStandard()); setColorError(getDefaultColorError()); + setColorInput(getDefaultColorInput()); setColorLink(getDefaultColorLink()); setColorLinkImportant(getDefaultColorLinkImportant()); setColorBackground(getDefaultColorBackground()); @@ -250,6 +258,10 @@ return colorError; } + public Color getColorInput() { + return colorInput; + } + public Color getColorLink() { return colorLink; } @@ -358,6 +370,15 @@ } } + public void setColorInput(Color colorInput) { + Parameters.notNull("colorError", colorInput); //NOI18N + if (!colorInput.equals(this.colorInput)) { + Color oldColorInput = this.colorInput; + this.colorInput = colorInput; + pcs.firePropertyChange(PROP_COLOR_INPUT, oldColorInput, colorInput); + } + } + public void setColorLink(Color colorLink) { Parameters.notNull("colorLink", colorLink); //NOI18N if (!colorLink.equals(this.colorLink)) { @@ -423,6 +444,7 @@ copy.fontWrapped = fontWrapped; copy.colorStandard = this.colorStandard; copy.colorError = this.colorError; + copy.colorInput = this.colorInput; copy.colorBackground = this.colorBackground; copy.colorLink = this.colorLink; copy.colorLinkImportant = this.colorLinkImportant; @@ -454,6 +476,7 @@ this.setFontForWrappedMode(outputOptions.getFontForWrappedMode()); this.setColorStandard(outputOptions.getColorStandard()); this.setColorError(outputOptions.getColorError()); + this.setColorInput(outputOptions.getColorInput()); this.setColorLink(outputOptions.getColorLink()); this.setColorLinkImportant(outputOptions.getColorLinkImportant()); this.setColorBackground(outputOptions.getColorBackground()); @@ -493,6 +516,14 @@ return err; } + static Color getDefaultColorInput() { + Color input = UIManager.getColor("nb.output.input"); //NOI18N + if (input == null) { + input = getDefaultColorStandard(); + } + return input; + } + static Color getDefaultColorLink() { Color hyperlink = UIManager.getColor( "nb.output.link.foreground"); //NOI18N @@ -518,6 +549,8 @@ return getColorStandard(); case ERROR: return getColorError(); + case INPUT: + return getColorInput(); case HYPERLINK: return getColorLink(); case HYPERLINK_IMPORTANT: diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.form --- a/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.form Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.form Thu Apr 11 15:11:21 2013 +0200 @@ -25,7 +25,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -76,6 +76,7 @@ + @@ -84,14 +85,18 @@ - - + + + + + + @@ -130,6 +135,11 @@ + + + + + @@ -363,6 +373,26 @@ + + + + + + + + + + + + + + + + + + + + diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.java --- a/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/options/OutputSettingsPanel.java Thu Apr 11 15:11:21 2013 +0200 @@ -49,8 +49,10 @@ import java.beans.PropertyEditor; import java.beans.PropertyEditorManager; import java.io.IOException; +import java.io.Reader; import javax.swing.Action; import javax.swing.JComboBox; +import javax.swing.SwingUtilities; import org.netbeans.api.options.OptionsDisplayer; import org.netbeans.core.output2.Controller; import org.netbeans.core.output2.NbIOProvider; @@ -119,6 +121,8 @@ cmbImportantLinkColor = new ColorComboBox(); jLabel1 = new javax.swing.JLabel(); lblUnwrappedOnly = new javax.swing.JLabel(); + lblInputColor = new javax.swing.JLabel(); + cmbInputColor = new ColorComboBox(); previewPanel = new javax.swing.JPanel(); btnRestore = new javax.swing.JButton(); @@ -212,6 +216,15 @@ org.openide.awt.Mnemonics.setLocalizedText(lblUnwrappedOnly, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblUnwrappedOnly.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(lblInputColor, org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.lblInputColor.text")); // NOI18N + + cmbInputColor.setToolTipText(org.openide.util.NbBundle.getMessage(OutputSettingsPanel.class, "OutputSettingsPanel.cmbInputColor.toolTipText")); // NOI18N + cmbInputColor.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmbInputColorActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( @@ -226,21 +239,25 @@ .addComponent(lblBackgroundColor) .addComponent(lblFontSize) .addComponent(jLabel1) - .addComponent(lblLinkStyle)) + .addComponent(lblLinkStyle) + .addComponent(lblInputColor)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(fldFontFamily) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnSelectFont)) - .addComponent(lblUnwrappedOnly) - .addComponent(spnFontSize, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lblUnwrappedOnly, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(spnFontSize, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) .addComponent(cmbBackgroundColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cmbStandardColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cmbErrorColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cmbLinkColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cmbImportantLinkColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(cmbLinkStyle, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(cmbLinkStyle, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cmbInputColor, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(1, 1, 1)) ); jPanel2Layout.setVerticalGroup( @@ -271,6 +288,10 @@ .addComponent(lblErrorColor)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(lblInputColor) + .addComponent(cmbInputColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblLinkColor) .addComponent(cmbLinkColor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -308,7 +329,7 @@ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(lblTitle) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 103, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnRestore))) .addContainerGap()))) ); @@ -322,7 +343,7 @@ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE) + .addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE) .addContainerGap()) ); }// //GEN-END:initComponents @@ -401,6 +422,13 @@ outputOptions.setLinkStyle(linkStyleModel.getLinkStyle()); }//GEN-LAST:event_cmbLinkStyleActionPerformed + private void cmbInputColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbInputColorActionPerformed + Color input = ((ColorComboBox) cmbInputColor).getSelectedColor(); + if (input != null) { + outputOptions.setColorInput(input); + } + }//GEN-LAST:event_cmbInputColorActionPerformed + void load() { if (previewInputOutput == null) { initPreview(); @@ -439,6 +467,7 @@ private javax.swing.JComboBox cmbBackgroundColor; private javax.swing.JComboBox cmbErrorColor; private javax.swing.JComboBox cmbImportantLinkColor; + private javax.swing.JComboBox cmbInputColor; private javax.swing.JComboBox cmbLinkColor; private javax.swing.JComboBox cmbLinkStyle; private javax.swing.JComboBox cmbStandardColor; @@ -449,6 +478,7 @@ private javax.swing.JLabel lblErrorColor; private javax.swing.JLabel lblFontFamily; private javax.swing.JLabel lblFontSize; + private javax.swing.JLabel lblInputColor; private javax.swing.JLabel lblLinkColor; private javax.swing.JLabel lblLinkStyle; private javax.swing.JLabel lblStandardColor; @@ -462,6 +492,8 @@ previewInputOutput = initPreviewInputOutput(); outputOptions = ((Lookup.Provider) previewInputOutput). getLookup().lookup(OutputOptions.class); + final Reader in = previewInputOutput.getIn(); + previewInputOutput.setInputVisible(true); // Instead of reading from in. previewInputOutput.getOut().println("Standard Output"); //NOI18N previewInputOutput.getErr().println("Error Output"); //NOI18N OutputListener ol = new OutputListenerImpl(); @@ -471,7 +503,7 @@ previewInputOutput.getOut().println(); IOColorPrint.print(previewInputOutput, "Important Link", //NOI18N ol, true, null); - previewInputOutput.getOut().print(" "); //NOI18N + previewInputOutput.getOut().println(); } catch (IOException ex) { ex.printStackTrace(previewInputOutput.getErr()); } @@ -484,6 +516,18 @@ updateControlsByModel(); } }); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + Component component = previewPanel.getComponent(0); + if (component instanceof AbstractOutputTab) { + ((AbstractOutputTab) component).inputSent("Input from keyboard"); + } + try { + in.close(); + } catch (IOException ex) {} + } + }); } private InputOutput initPreviewInputOutput() throws NullPointerException { @@ -503,6 +547,7 @@ spnFontSize.setValue(outputOptions.getFont().getSize()); selectColor(cmbStandardColor, outputOptions.getColorStandard()); selectColor(cmbErrorColor, outputOptions.getColorError()); + selectColor(cmbInputColor, outputOptions.getColorInput()); selectColor(cmbBackgroundColor, outputOptions.getColorBackground()); selectColor(cmbLinkColor, outputOptions.getColorLink()); selectColor(cmbImportantLinkColor, diff -r 0cbde52c1fc3 core.output2/src/org/netbeans/core/output2/ui/AbstractOutputTab.java --- a/core.output2/src/org/netbeans/core/output2/ui/AbstractOutputTab.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/src/org/netbeans/core/output2/ui/AbstractOutputTab.java Thu Apr 11 15:11:21 2013 +0200 @@ -149,7 +149,7 @@ protected abstract AbstractOutputPane createOutputPane(); - protected abstract void inputSent (String txt); + public abstract void inputSent (String txt); /** * Accessed reflectively from org.netbeans.jellytools.OutputTabOperator. diff -r 0cbde52c1fc3 core.output2/test/unit/src/org/netbeans/core/output2/IOExtensionsTest.java --- a/core.output2/test/unit/src/org/netbeans/core/output2/IOExtensionsTest.java Fri Apr 05 16:48:54 2013 +0200 +++ b/core.output2/test/unit/src/org/netbeans/core/output2/IOExtensionsTest.java Thu Apr 11 15:11:21 2013 +0200 @@ -108,6 +108,7 @@ public void testSetDefColors() throws IOException { IOColors.setColor(io, IOColors.OutputType.OUTPUT, Color.GRAY); IOColors.setColor(io, IOColors.OutputType.ERROR, Color.PINK); + IOColors.setColor(io, IOColors.OutputType.INPUT, Color.BLUE); IOColors.setColor(io, IOColors.OutputType.HYPERLINK, Color.MAGENTA); IOColors.setColor(io, IOColors.OutputType.HYPERLINK_IMPORTANT, Color.GREEN); io.getOut().println("Test out"); @@ -116,6 +117,7 @@ io.getOut().println("Test important hyperlink", new L(), true); IOColors.setColor(io, IOColors.OutputType.OUTPUT, Color.BLACK); IOColors.setColor(io, IOColors.OutputType.ERROR, Color.RED); + IOColors.setColor(io, IOColors.OutputType.INPUT, Color.BLACK); IOColors.setColor(io, IOColors.OutputType.HYPERLINK, Color.BLUE); IOColors.setColor(io, IOColors.OutputType.HYPERLINK_IMPORTANT, Color.MAGENTA); } diff -r 0cbde52c1fc3 openide.io/apichanges.xml --- a/openide.io/apichanges.xml Fri Apr 05 16:48:54 2013 +0200 +++ b/openide.io/apichanges.xml Thu Apr 11 15:11:21 2013 +0200 @@ -107,6 +107,23 @@ + + + Added IOColors.OutputType.INPUT to be able to specify a color of input text. + + + + + +

+ Added enum element IOColors.OutputType.INPUT + that can be passed to get/setColor methods to set a color of the + input text. +

+
+ + +
Added IOProvider.getIO variant that takes all 4 possible parameters. diff -r 0cbde52c1fc3 openide.io/manifest.mf --- a/openide.io/manifest.mf Fri Apr 05 16:48:54 2013 +0200 +++ b/openide.io/manifest.mf Thu Apr 11 15:11:21 2013 +0200 @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.io -OpenIDE-Module-Specification-Version: 1.37 +OpenIDE-Module-Specification-Version: 1.38 OpenIDE-Module-Localizing-Bundle: org/openide/io/Bundle.properties OpenIDE-Module-Recommends: org.openide.windows.IOProvider, org.openide.windows.IOContainer$Provider AutoUpdate-Essential-Module: true diff -r 0cbde52c1fc3 openide.io/src/org/openide/windows/IOColors.java --- a/openide.io/src/org/openide/windows/IOColors.java Fri Apr 05 16:48:54 2013 +0200 +++ b/openide.io/src/org/openide/windows/IOColors.java Thu Apr 11 15:11:21 2013 +0200 @@ -88,8 +88,9 @@ HYPERLINK, /** important hyperlink */ HYPERLINK_IMPORTANT, - /** input, could be supported in future */ - // INPUT, + /** input text + * @since 1.38 */ + INPUT, } /**