| Summary: | [console] Multiple actions writing to console leaves a lot of empty lines | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Dennis Hendriks <dh_tue> |
| Component: | Debug | Assignee: | Platform-Debug-Inbox <platform-debug-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | andrew.rse+eclipse, dh_tue, paul-eclipse, pawel.1.piech, remy.suen |
| Version: | 3.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Issues with the 'Console' view goes to Debug. *** Bug 332429 has been marked as a duplicate of this bug. *** 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. If the bug is still relevant, please remove the "stalebug" whiteboard tag. *** This bug has been marked as a duplicate of bug 32816 *** *** This bug has been marked as a duplicate of bug 323816 *** |
Build Identifier: Build id: 20100617-1415 (Helios) I have a plug-in that contributes an action. Executing the action prints some output to a console. The console is created the first time, and reused each next command execution. Each time a new message stream is created, and the console is cleared. 20 lines of output are printed to the console. The first time there is one empty lines after the printed lines, the next time, there are two, the next time three, etc... Reproducible: Always Steps to Reproduce: Steps To Reproduce: 1. Create a Hello World Command plugin project. Call the handler "TestHandler" and set the package to "testplugin.handlers". 2. Replace the handler code with the code below. 3. Run the plugin. 4. Select the "Sample Command" from the "Sample Menu" (or use ctrl+6 shortcut). Do this a bunch of times. 5. Observe how each time, the console gets more empty lines after the output. Code: package testplugin.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.ui.console.ConsolePlugin; import org.eclipse.ui.console.IConsole; import org.eclipse.ui.console.IConsoleManager; import org.eclipse.ui.console.MessageConsole; import org.eclipse.ui.console.MessageConsoleStream; public class TestHandler extends AbstractHandler { private static final String PLUGIN_CONSOLE_NAME = "Test"; public Object execute(ExecutionEvent event) throws ExecutionException { MessageConsoleStream console = getConsole(true); for (int i = 0;i<20;i++){ console.println("Plugin command output..."); } return null; } public static MessageConsole findConsole(String name) { ConsolePlugin plugin = ConsolePlugin.getDefault(); IConsoleManager conMan = plugin.getConsoleManager(); IConsole[] existing = conMan.getConsoles(); for (int i = 0; i < existing.length; i++) if (name.equals(existing[i].getName())) return (MessageConsole) existing[i]; // no console found, so create a new one MessageConsole myConsole = new MessageConsole(name, null); conMan.addConsoles(new IConsole[] { myConsole }); return myConsole; } public static MessageConsoleStream getConsole(boolean clearConsole) { MessageConsole myConsole = findConsole(PLUGIN_CONSOLE_NAME); myConsole.activate(); MessageConsoleStream out = myConsole.newMessageStream(); if (clearConsole) { myConsole.clearConsole(); } return out; } }