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 84321 Details for
Bug 203727
Colorization of Build Console
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
This patch enables colorization of the build console in CDT 4.0.2
buildconsole-patch-4.0.2.txt (text/plain), 9.33 KB, created by
Nils Hagge
on 2007-12-03 10:03:29 EST
(
hide
)
Description:
This patch enables colorization of the build console in CDT 4.0.2
Filename:
MIME Type:
Creator:
Nils Hagge
Created:
2007-12-03 10:03:29 EST
Size:
9.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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 3 Dec 2007 14:04:12 -0000 1.1 >+++ src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java 3 Dec 2007 14:32:55 -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; > >@@ -1829,6 +1831,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]; >@@ -1856,8 +1860,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()); // Nils >+ cis.flush(); // Nils > > // remove all markers for this project > removeAllMarkers(currProject); >@@ -1902,8 +1906,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); >@@ -1969,6 +1975,8 @@ > consoleErr.close(); > epm.reportProblems(); > cos.close(); >+ ces.close(); // Nils >+ cis.close(); > } > } catch (Exception e) { > CCorePlugin.log(e); >#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 3 Dec 2007 14:02:17 -0000 1.1 >+++ src/org/eclipse/cdt/core/ErrorParserManager.java 3 Dec 2007 14:32:58 -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(); >Index: .settings/org.eclipse.jdt.core.prefs >=================================================================== >RCS file: d:\cvsroot/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs,v >retrieving revision 1.1 >diff -u -r1.1 org.eclipse.jdt.core.prefs >--- .settings/org.eclipse.jdt.core.prefs 3 Dec 2007 14:03:08 -0000 1.1 >+++ .settings/org.eclipse.jdt.core.prefs 3 Dec 2007 14:32:58 -0000 >@@ -1,7 +1,8 @@ >-#Mon Dec 03 14:56:53 CET 2007 >+#Mon Dec 03 15:25:06 CET 2007 > eclipse.preferences.version=1 >-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 >-org.eclipse.jdt.core.compiler.compliance=1.4 >-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning >-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning >-org.eclipse.jdt.core.compiler.source=1.3 >+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true >+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 >+org.eclipse.jdt.core.compiler.compliance=1.5 >+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error >+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error >+org.eclipse.jdt.core.compiler.source=1.5
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