Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8054235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:06:11+00:00 2026-06-05T08:06:11+00:00

I am trying to create a console that would work as a shell for

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:06:12+00:00Added an answer on June 5, 2026 at 8:06 am

    So I thought I would answer this myself as I was finally able to accomplish the console. It still is a working prototype but I guess as you keep adding things, you can clean up the code more and more. For my current purposes this is how it worked.

    If you want the short version, then I basically mimicked the ProcessConsole provided by Eclipse as that is what I needed: a console in which I can connect a process but since the ProcessConsole is internal, I like to avoid extending those classes.

    Following is an outline of the classes I used to achieve interaction with my console. I am not going to give the pretext as to where MyConsole was created. Basically, instead of using DebugUITools.getConsole(myProcess), I used my own myProcess.getConsole() method. MyProcess extends RuntimeProcess.

    class MyConsole extends IOConsole {
     private IOConsoleInputStream fInput;
     private IOConsoleOutputStream fOutput;
     private IStreamsProxy fStreamsProxy;
     private ConsoleHistory history;
     //This is to remember the caret position after the prompt 
     private int caretAtPrompt;
         /* in the console so when you need to replace the command on up and down 
          * arrow keys you have the position. 
          * I just did a caretAtPrompt += String.Length wherever string was 
          * appended to the console. Mainly in the streamlistener and 
          * InputJob unless you specifically output something to the output 
          * stream.
          */
     //In the constructor you assign all the above fields. Below are some 
     //to point out.
     //fInput = getInputStream();
     // fStreamsProxy = process.getStreamsProxy();
     // fOutput = newOutputStream();
    
     //We must override the following method to get access to the caret
     @Override
     public IPageBookViewPage createPage(IConsoleView view) {
        return new MyConsolePage(this, view);
        }
     //After this I followed the ProcessConsole and added the 
     //InputJob and StreamListener
     //defined in there. 
     }
    
    class MyConsolePage extends TextConsolePage {
     //Not much in this class, just override the createViewer
     // to return MyConsoleViewer
     }
    
    class MyConsoleViewer extends TextConsoleViewer {
     //This is the most important class and most of the work is done here
     //Again I basically copied everything from IOConsoleViewer and then
     //updated whatever I needed
     //I added a VerifyKeyListener for the up and down arrow 
     //keys for the console history
    
     MyConsoleViewer (Composite parent, MyConsole console) {
      //I have omitted a lot of code as it was too much to put up, 
      //just highlighted a few
      getTextWidget().addVerifyKeyListener(new MyKeyChecker());
      }
    
     class MyKeyChecker implements VerifyKeyListener {...}
    
     }
    

    This is the code for ProcessConsole.
    This is the code for IOConsoleViewer.

    The ConsoleHistory class I created just had a doubly linked string list to save all the commands the user entered. Quite a simple class to create.

    Once you look at the Eclipse classes (ProcessConsole and IOConsoleViewer) it is actually all quite self explanatory. I haven’t put in much code here because there is quite a bit. But hopefully this gives some direction as I was completely lost when I started.

    I am happy to answer questions though and add more specific code if anyone asks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a batch script that would connect to a mySQL
I am trying to create a custom dojo widget that prevents the transistion to
I'm currently trying to create a custom binding for my webpage, where I have
I'm trying to write a Delphi console application that creates a TStream for its
I'm trying to create a performance counter that can monitor the performance time of
I'm trying to create an abstract class that defines a property with a getter.
I'm trying to create a trait that, when mixed in, will replace the default
I am trying to create points inside a console window based on a 80x49
I'm currently trying to create a little C/C++ program which emulates a key-press on
I'm currently trying to make cx_freeze to work on a Solaris workstation I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.