mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
new console api
This commit is contained in:
parent
cde152c3d0
commit
2469b15201
4 changed files with 33 additions and 18 deletions
|
@ -1,3 +1,11 @@
|
|||
2004-03-12 David Inglis
|
||||
|
||||
Improved IConsole API to support multiple streams.
|
||||
|
||||
* src/org/eclipse/cdt/core/CCorePlugin.java
|
||||
* src/org/eclipse/cdt/core/ConsoleOutputStream.java
|
||||
* src/org/eclipse/cdt/core/resources/IConsole.java
|
||||
|
||||
2004-03-09 David Inglis
|
||||
|
||||
Don't error in CDescriptorManager.configure() when project is created twice with the same owner id.
|
||||
|
|
|
@ -5,6 +5,7 @@ package org.eclipse.cdt.core;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -456,13 +457,27 @@ public class CCorePlugin extends Plugin {
|
|||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return new IConsole() {
|
||||
public void clear() {
|
||||
}
|
||||
return new IConsole() { // return a null console
|
||||
private ConsoleOutputStream nullStream = new ConsoleOutputStream() {
|
||||
public void write(byte[] b) throws IOException {
|
||||
}
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
}
|
||||
public void write(int c) throws IOException {
|
||||
}
|
||||
};
|
||||
|
||||
public void start(IProject project) {
|
||||
}
|
||||
// this can be a null console....
|
||||
public ConsoleOutputStream getOutputStream() {
|
||||
return new ConsoleOutputStream();
|
||||
return nullStream;
|
||||
}
|
||||
public ConsoleOutputStream getInfoStream() {
|
||||
return nullStream;
|
||||
}
|
||||
public ConsoleOutputStream getErrorStream() {
|
||||
return nullStream;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -475,7 +490,7 @@ public class CCorePlugin extends Plugin {
|
|||
IBinaryParser parsers[] = null;
|
||||
if (project != null) {
|
||||
try {
|
||||
ICDescriptor cdesc = (ICDescriptor) getCProjectDescription(project);
|
||||
ICDescriptor cdesc = getCProjectDescription(project);
|
||||
ICExtensionReference[] cextensions = cdesc.get(BINARY_PARSER_UNIQ_ID, true);
|
||||
if (cextensions.length > 0) {
|
||||
ArrayList list = new ArrayList(cextensions.length);
|
||||
|
@ -719,7 +734,7 @@ public class CCorePlugin extends Plugin {
|
|||
IScannerInfoProvider provider = null;
|
||||
if (project != null) {
|
||||
try {
|
||||
ICDescriptor desc = (ICDescriptor) getCProjectDescription(project);
|
||||
ICDescriptor desc = getCProjectDescription(project);
|
||||
ICExtensionReference[] extensions = desc.get(BUILD_SCANNER_INFO_UNIQ_ID, true);
|
||||
if (extensions.length > 0)
|
||||
provider = (IScannerInfoProvider) extensions[0].createExtension();
|
||||
|
|
|
@ -20,27 +20,18 @@ public class ConsoleOutputStream extends OutputStream {
|
|||
fBuffer= new StringBuffer();
|
||||
}
|
||||
|
||||
|
||||
public synchronized String readBuffer() {
|
||||
String buf = fBuffer.toString();
|
||||
fBuffer.setLength(0);
|
||||
return buf;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
fBuffer.setLength (0);
|
||||
}
|
||||
|
||||
public synchronized void write(int c) throws IOException {
|
||||
byte ascii[] = new byte[1];
|
||||
ascii[0] = (byte) c;
|
||||
fBuffer.append(new String(ascii));
|
||||
}
|
||||
|
||||
public synchronized void write(byte[] b) throws IOException {
|
||||
fBuffer.append(new String(b));
|
||||
}
|
||||
|
||||
|
||||
public synchronized void write(byte[] b, int off, int len) throws IOException {
|
||||
fBuffer.append(new String(b, off, len));
|
||||
}
|
||||
|
|
|
@ -10,8 +10,9 @@ import org.eclipse.core.resources.IProject;
|
|||
|
||||
|
||||
public interface IConsole {
|
||||
ConsoleOutputStream getOutputStream();
|
||||
void start(IProject project);
|
||||
void clear();
|
||||
ConsoleOutputStream getOutputStream();
|
||||
ConsoleOutputStream getInfoStream();
|
||||
ConsoleOutputStream getErrorStream();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue