From 8d3bd00d1ced817313a29a164c05064896fc0950 Mon Sep 17 00:00:00 2001 From: David Inglis Date: Wed, 6 Jul 2005 18:36:50 +0000 Subject: [PATCH] 2005-07-06 David Inglis - fixed bug#102546 --- core/org.eclipse.cdt.core/ChangeLog | 7 +++ core/org.eclipse.cdt.core/plugin.xml | 6 ++ .../src/org/eclipse/cdt/core/CCorePlugin.java | 7 ++- .../cdt/internal/core/SystemBuildConsole.java | 56 +++++++++++++++++++ 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index dcf50b4798a..a7a5d7a599d 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,10 @@ +2005-07-06 David Inglis + fixed bug#102546 + + * src/org/eclipse/cdt/core/CCorePlugin.java + * src/org/eclipse/cdt/internal/core/SystemBuildConsole.java + * plugins.xml + 2005-07-05 Alain Magloire Fix for PR 102327: ContentType framework. * model/org/eclipse/cdt/core/model/CoreModel.java diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml index 421d68c91aa..b8a60c3da72 100644 --- a/core/org.eclipse.cdt.core/plugin.xml +++ b/core/org.eclipse.cdt.core/plugin.xml @@ -588,6 +588,12 @@ description="%cdt_pathentry_var.description"> + + + diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index 95d55bb1ab6..2e4206cf56f 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -477,8 +477,8 @@ public class CCorePlugin extends Plugin { for (int i = 0; i < extensions.length; i++) { IConfigurationElement[] configElements = extensions[i].getConfigurationElements(); for (int j = 0; j < configElements.length; j++) { - String builderID = configElements[j].getAttribute("id"); //$NON-NLS-1$ - if ((id == null && builderID == null) || (id != null && id.equals(builderID))) { + String consoleID = configElements[j].getAttribute("id"); //$NON-NLS-1$ + if ((id == null && consoleID == null) || (id != null && id.equals(consoleID))) { return (IConsole) configElements[j].createExecutableExtension("class"); //$NON-NLS-1$ } } @@ -513,7 +513,8 @@ public class CCorePlugin extends Plugin { } public IConsole getConsole() { - return getConsole(null); + String consoleID = System.getProperty("org.eclipse.cdt.core.console"); //$NON-NLS-1$ + return getConsole(consoleID); } public ICExtensionReference[] getBinaryParserExtensions(IProject project) throws CoreException { diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java new file mode 100644 index 00000000000..530be65340f --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/SystemBuildConsole.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Common Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: QNX Software Systems - initial API and implementation + ******************************************************************************/ +package org.eclipse.cdt.internal.core; + +import org.eclipse.cdt.core.ConsoleOutputStream; +import org.eclipse.cdt.core.resources.IConsole; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; + + +public class SystemBuildConsole implements IConsole { + final ConsoleOutputStream out; + final ConsoleOutputStream err; + + public SystemBuildConsole() { + out = new ConsoleOutputStream() { + public synchronized void write(byte[] b, int off, int len) throws java.io.IOException { + System.out.write(b, off, len); + } + + public synchronized void write(int c) throws java.io.IOException { + System.out.write(c); + } + }; + err = new ConsoleOutputStream() { + public synchronized void write(byte[] b, int off, int len) throws java.io.IOException { + System.err.write(b, off, len); + } + + public synchronized void write(int c) throws java.io.IOException { + System.err.write(c); + } + }; + } + + public void start(IProject project) { + } + + public ConsoleOutputStream getOutputStream() throws CoreException { + return out; + } + + public ConsoleOutputStream getInfoStream() throws CoreException { + return out; + } + + public ConsoleOutputStream getErrorStream() throws CoreException { + return err; + } +}