Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse RCP: Custom console

I am trying to create a console that would work as a shell for a custom programming language. It would be very similar to the pydev interactive console.

Currently, my RCP uses the basic TextConsole and is connected to the shell via pipes so it just displays whatever the shell displays and if the user enters anything in the RCP console, the same is written in the shell.

I want to be able to do a bit more such as move the caret position, add events for up and down arrow keys etc. I believe to do that I need to add a StyledText widget to the console which is done via the ConsoleViewer.

So my question is, that is there any way for me to either override the TextConsole's ConsoleViewer or if I were to extend TextConsole and create my own, then how do I link it with the launch configuration (the one that connects the shell via pipes)?

Also, to get the current default console I use DebugUITools.getConsole(process).

I'm sorry if I haven't put all the information needed; it is a bit difficult to explain. I am happy to add more information.

An idea... From what I understand I can create a TextConsolePage from the TextConsole using createPage(ConsoleView). Once I have the page I can set the viewer via setViewer(viewer). Here I thought if I create my own viewer (which will have the appropriate stylewidget) then that could be a lead. The only problem is that the viewer needs a Composite and I can't seem to figure out where to get that from.

like image 493
nbz Avatar asked Oct 07 '22 21:10

nbz


1 Answers

Why don't you just follow what PyDev does (if you're able to cope with the EPL license)?

The relevant code may be found at:

https://github.com/aptana/Pydev/tree/ad4fd3512c899b73264e4ee981be0c4b69ed5b27/plugins/org.python.pydev/src_dltk_console

https://github.com/aptana/Pydev/tree/ad4fd3512c899b73264e4ee981be0c4b69ed5b27/plugins/org.python.pydev.debug/src_console

like image 180
Fabio Zadrozny Avatar answered Oct 18 '22 07:10

Fabio Zadrozny