Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 78632 Details for
Bug 203727
Colorization of Build Console
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to add different colorization in the build console as implied by the preferences
buildconsole-patch.txt (text/plain), 8.20 KB, created by
Nils Hagge
on 2007-09-18 06:36:20 EDT
(
hide
)
Description:
Patch to add different colorization in the build console as implied by the preferences
Filename:
MIME Type:
Creator:
Nils Hagge
Created:
2007-09-18 06:36:20 EDT
Size:
8.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.core >Index: src/org/eclipse/cdt/core/ErrorParserManager.java >=================================================================== >RCS file: d:\cvsroot/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java,v >retrieving revision 1.1 >diff -u -r1.1 ErrorParserManager.java >--- src/org/eclipse/cdt/core/ErrorParserManager.java 18 Sep 2007 07:41:17 -0000 1.1 >+++ src/org/eclipse/cdt/core/ErrorParserManager.java 18 Sep 2007 07:45:38 -0000 >@@ -6,7 +6,9 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * IBM Corporation - initial API and implementation >+ * IBM Corporation - initial API and implementation >+ * Siemens AG, Nils Hagge - Added using the different output, error, >+ * and info streams > *******************************************************************************/ > package org.eclipse.cdt.core; > >@@ -33,10 +35,12 @@ > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Path; > >-public class ErrorParserManager extends OutputStream { >- >- private int nOpens; >+public class ErrorParserManager //extends OutputStream >+{ > >+// private int nOpens; >+ private int nTotalOpens; // Nils >+ > private final static String OLD_PREF_ERROR_PARSER = "errorOutputParser"; //$NON-NLS-1$ > public final static String PREF_ERROR_PARSER = CCorePlugin.PLUGIN_ID + ".errorOutputParser"; //$NON-NLS-1$ > >@@ -52,7 +56,12 @@ > private IPath fBaseDirectory; > > private String previousLine; >- private OutputStream outputStream; >+ >+ //private OutputStream outputStream; >+ // keep output and error stream separate >+ private ScanOutputStream outputSink = new ScanOutputStream(); //Nils >+ private ScanOutputStream errorSink = new ScanOutputStream(); >+ > private StringBuffer currentLine = new StringBuffer(); > > private StringBuffer scratchBuffer = new StringBuffer(); >@@ -360,7 +369,8 @@ > * @param cos > */ > public void setOutputStream(OutputStream os) { >- outputStream = os; >+ //outputStream = os; >+ outputSink.setTarget(os); > } > > /** >@@ -369,55 +379,93 @@ > * @return OutputStream > */ > public OutputStream getOutputStream() { >- nOpens++; >- return this; >- } >- >- /** >- * @see java.io.OutputStream#close() >- */ >- public void close() throws IOException { >- if (nOpens > 0 && --nOpens == 0) { >- checkLine(true); >- fDirectoryStack.removeAllElements(); >- fBaseDirectory = null; >- if (outputStream != null) >- outputStream.close(); >- } >+ //nOpens++; >+ outputSink.open(); >+ return outputSink; > } >- >- /** >- * @see java.io.OutputStream#flush() >- */ >- public void flush() throws IOException { >- if (outputStream != null) >- outputStream.flush(); >+ >+ public OutputStream getErrorStream() >+ { >+ errorSink.open(); >+ return errorSink; > } >- >- /** >- * @see java.io.OutputStream#write(int) >- */ >- public synchronized void write(int b) throws IOException { >- currentLine.append((char) b); >- checkLine(false); >- if (outputStream != null) >- outputStream.write(b); >+ >+ public void setErrorStream(OutputStream es) >+ { >+ errorSink.setTarget(es); > } >- >- public synchronized void write(byte[] b, int off, int len) throws IOException { >- if (b == null) { >- throw new NullPointerException(); >- } else if (off != 0 || (len < 0) || (len > b.length)) { >- throw new IndexOutOfBoundsException(); >- } else if (len == 0) { >- return; >+ >+ // Nils Hagge >+ private class ScanOutputStream extends OutputStream >+ { >+ private OutputStream target = null; >+ private int nOpens; // number of references to this ScanOutputStream >+ >+ public void open() >+ { >+ nOpens++; >+ nTotalOpens++; >+ } >+ >+ public void setTarget(OutputStream target) >+ { >+ this.target = target; >+ } >+ >+ /** >+ * @see java.io.OutputStream#flush() >+ */ >+ public void flush() throws IOException >+ { >+ if(target != null) >+ target.flush(); >+ } >+ >+ /** >+ * @see java.io.OutputStream#write(int) >+ */ >+ public synchronized void write(int b) throws IOException >+ { >+ currentLine.append((char) b); >+ checkLine(false); >+ if(target != null) >+ target.write(b); >+ } >+ >+ public synchronized void write(byte[] b, int off, int len) >+ throws IOException >+ { >+ if(b == null) >+ throw new NullPointerException(); >+ else if(off != 0 || (len < 0) || (len > b.length)) >+ throw new IndexOutOfBoundsException(); >+ else if(len == 0) >+ return; >+ >+ currentLine.append(new String(b, 0, len)); >+ checkLine(false); >+ if(target != null) >+ target.write(b, off, len); >+ } >+ >+ /** >+ * @see java.io.OutputStream#close() >+ */ >+ public void close() throws IOException { >+ if(nTotalOpens > 0 && --nTotalOpens == 0) >+ { >+ checkLine(true); >+ fDirectoryStack.removeAllElements(); >+ fBaseDirectory = null; >+ } >+ if (nOpens > 0 && --nOpens == 0) >+ { >+ if(target != null) >+ target.close(); >+ } > } >- currentLine.append(new String(b, 0, len)); >- checkLine(false); >- if (outputStream != null) >- outputStream.write(b, off, len); > } >- >+ > private void checkLine(boolean flush) { > String buffer = currentLine.toString(); > int i = 0; >@@ -440,7 +488,7 @@ > > public boolean reportProblems() { > boolean reset = false; >- if (nOpens == 0) { >+ if (nTotalOpens == 0) { > Iterator iter = fErrors.iterator(); > while (iter.hasNext()) { > ProblemMarkerInfo problemMarkerInfo = (ProblemMarkerInfo) iter.next(); >#P org.eclipse.cdt.managedbuilder.core >Index: src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java >=================================================================== >RCS file: d:\cvsroot/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java,v >retrieving revision 1.1 >diff -u -r1.1 CommonBuilder.java >--- src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java 17 Sep 2007 14:51:48 -0000 1.1 >+++ src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java 18 Sep 2007 07:45:39 -0000 >@@ -6,7 +6,9 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * Intel Corporation - Initial API and implementation >+ * Intel Corporation - Initial API and implementation >+ * Siemens AG, Nils Hagge - Added using the different output, error, >+ * and info streams > *******************************************************************************/ > package org.eclipse.cdt.managedbuilder.internal.core; > >@@ -1652,6 +1654,8 @@ > IConsole console = bInfo.getConsole(); > > OutputStream cos = console.getOutputStream(); >+ OutputStream ces = console.getErrorStream(); // Nils >+ OutputStream cis = console.getInfoStream(); // Nils > StringBuffer buf = new StringBuffer(); > > String[] consoleHeader = new String[3]; >@@ -1679,8 +1683,8 @@ > buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ > buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ > } >- cos.write(buf.toString().getBytes()); >- cos.flush(); >+ cis.write(buf.toString().getBytes()); >+ cis.flush(); > > // remove all markers for this project > removeAllMarkers(currProject); >@@ -1725,8 +1729,10 @@ > StreamMonitor streamMon = new StreamMonitor(new SubProgressMonitor(monitor, 100), cos, last.intValue()); > ErrorParserManager epm = new ErrorParserManager(currProject, workingDirectory, this, builder.getErrorParsers()); > epm.setOutputStream(streamMon); >+ epm.setErrorStream(ces); // Nils > OutputStream stdout = epm.getOutputStream(); >- OutputStream stderr = epm.getOutputStream(); >+ //OutputStream stderr = epm.getOutputStream(); >+ OutputStream stderr = epm.getErrorStream(); // Nils > // Sniff console output for scanner info > ICfgScannerConfigBuilderInfo2Set container = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg); > CfgInfoContext context = new CfgInfoContext(cfg); >@@ -1791,6 +1797,8 @@ > consoleErr.close(); > epm.reportProblems(); > cos.close(); >+ ces.close(); // Nils >+ cis.close(); > } > } catch (Exception e) { > CCorePlugin.log(e);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203727
: 78632 |
84321
|
84940