Community
Participate
Working Groups
Since 3.1 the preferred way to implement console is to extend IOConsole directly. The javadoc of MessageConsole states: "Clients may instantiate this class; not intended to be subclassed.". Attached is a patch to update CVSOutputConsole to extend IOConsole instead of MessageConsole. No functionality is lost. Index: CVSOutputConsole.java =================================================================== RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java,v retrieving revision 1.21 diff -u -r1.21 CVSOutputConsole.java --- CVSOutputConsole.java 4 Aug 2005 20:24:51 -0000 1.21 +++ CVSOutputConsole.java 11 Sep 2005 01:07:23 -0000 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.console; +import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -41,7 +42,7 @@ * * @since 3.0 */ -public class CVSOutputConsole extends MessageConsole implements IConsoleListener, IPropertyChangeListener { +public class CVSOutputConsole extends IOConsole implements IConsoleListener, IPropertyChangeListener { // created colors for each line type - must be disposed at shutdown private Color commandColor; @@ -52,9 +53,9 @@ private long commandStarted = 0; // streams for each command type - each stream has its own color - private MessageConsoleStream commandStream; - private MessageConsoleStream messageStream; - private MessageConsoleStream errorStream; + private IOConsoleOutputStream commandStream; + private IOConsoleOutputStream messageStream; + private IOConsoleOutputStream errorStream; // preferences for showing the cvs console when cvs output is provided private boolean showOnMessage; @@ -169,9 +170,9 @@ private void initializeStreams() { synchronized(document) { if (!initialized) { - commandStream = newMessageStream(); - errorStream = newMessageStream(); - messageStream = newMessageStream(); + commandStream = newOutputStream(); + errorStream = newOutputStream(); + messageStream = newOutputStream(); // install colors commandColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR); commandStream.setColor(commandColor); @@ -203,16 +204,20 @@ showConsole(); synchronized(document) { if(visible) { - switch(type) { - case ConsoleDocument.COMMAND: - commandStream.println(line); - break; - case ConsoleDocument.MESSAGE: - messageStream.println(" " + line); //$NON-NLS-1$ - break; - case ConsoleDocument.ERROR: - errorStream.println(" " + line); //$NON-NLS-1$ - break; + try { + switch(type) { + case ConsoleDocument.COMMAND: + commandStream.write(line + '\n'); + break; + case ConsoleDocument.MESSAGE: + messageStream.write(" " + line + '\n'); //$NON-NLS-1$ + break; + case ConsoleDocument.ERROR: + errorStream.write(" " + line + '\n'); //$NON-NLS-1$ + break; + } + } catch (IOException e) { + CVSUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } } else { document.appendConsoleLine(type, line);
Chris, can you test the given patch to verify that everything works as expected when the patch is applied? I seem to recall trying it in 3.2 and encountering problems. Let me know what you find.
Created attachment 64452 [details] Patch Michael, the patch worked pretty well, except that the console was writtable. I have made it read-only, but it is not clean solution - I used internal ui.console IOConsolePage - it is the only way I see to disable input.
I've logged bug 183414 to request the required API. This bug will have to wait until the required API is provided.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.