Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-dev] accessing the Control associated with an IOConsole?


I've been playing with the console plugin (org.eclipse.ui.console.IOConsole), in the process of trying to create a script console (ie. a read-eval-print console for ObjectScript). It was quite easy to get the basics working. Now I'm trying to go a step further, and implement history (ie. up/down arrows cycle thru prev/last command) and tab completion. And this is where I quickly run into a wall.

The best way I can think of to intercept the UP/DOWN/TAB key events would be a KeyListener on the Control associated with the console. But the IOConsole seems to be a step removed from the Control, as there can be multiple IConsole's per view. So, from what I can tell, I should extend IOConsole and override createPage() to return a subclass of IOConsolePage, which in turn overrides createViewer(). This would let me create my own viewer, to which I should be able attach my own KeyListener (or at least that is the theory).

But the problem is that IOConsolePage and IOConsoleViewer are in the org.eclipse.ui.internal.console package, and if I try to use it I get a warning about "discouraged access"... so I guess this is not intended to be part of the public interface of the console plugin, and is possibly subject to change? It seems I can ignore this warning, but I expect that this would be inviting troubles when a new version of eclipse comes out.

So what would you recommend? Am I on the right track trying to create my own viewer, or is there a better way? What happens when you combine multiple types of IConsole in the same view... does the viewer get switched as you switch to different consoles?

PS, please bear with me if I ask some dumb questions... I'm new to eclipse and SWT, and just trying to figure out what I can from the javadoc API docs.

-- Rob

Back to the top