Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Help Creating Custom Console
Help Creating Custom Console [message #301679] Tue, 04 April 2006 10:33 Go to next message
Eclipse UserFriend
Originally posted by: alex.noreply.com

Hi,

I am trying to create a custom console and have got stuck.

My program is run over an SSH connection so I need to create a console that
I can pass the input and output streams too. I also created a terminal
emulator for displaying the output.

The closest I have got is by extending java.lang.Process with my own class
(RemoteProcess) which encapsulates an SSH session and returns the relevant
input/outputstreams.

I then use the following code at the end of my launch method

IConsoleManager cm = ConsolePlugin.getDefault().getConsoleManager();
cm.removeConsoles(cm.getConsoles());
cm.addConsoles(new IConsole[]{new TerminalConsole(file, null, process)});
IProcess p = DebugPlugin.newProcess(launch, process, file);

Where TerminalConsole is my extension of AbstractConsole. I was hoping the
above code would remove the standard console and connect mine with the
launch but this doesn't work, the standard console still appears and mine is
not correctly associated with it.

I think my extension of AbstractConsole/process is working alright but what
code should I put in the launch method to remove the standard console and
associate mine? what I have done above does not seem to be right.

I would really appreciate any input anyone can give me at all. I have been
strugling with this for a while and am getting very close to my deadline.

Thanks a lot,
Alex
Re: Help Creating Custom Console [message #301707 is a reply to message #301679] Tue, 04 April 2006 14:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex.noreply.com

> Where TerminalConsole is my extension of AbstractConsole. I was hoping
the
> above code would remove the standard console and connect mine with the
> launch but this doesn't work, the standard console still appears and mine
is
> not correctly associated with it.

This probably wasn't very clear. Both terminals appear and you can move
between them but it keeps flicking back to the standard console every time
some output is generated. I need to get rid of the standard console. Also
how do I add a terminate button (I presume there is a standard
implementation of this I can extend).

Thanks again,
Alex
Re: Help Creating Custom Console [message #301709 is a reply to message #301707] Tue, 04 April 2006 14:12 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can get rid of that annoying flick back to the main console in the
Window>Preferences>Run/Debug>Console preferences.

Also, I believe it's possible to open a second Console view (it's a
multi-instance view). If you could open a second console view and put
your views in it, then the stdout/stderr wouldn't make it flip back to
the program console.

Later,
PW


Re: Help Creating Custom Console [message #301800 is a reply to message #301709] Wed, 05 April 2006 20:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alex.noreply.com

> You can get rid of that annoying flick back to the main console in the
> Window>Preferences>Run/Debug>Console preferences.
Cheers for that Paul. What I am looking for though is a way to do this
programatically. I don't want to have to tell every user of this plugin to
change their preferences. Anyone got any info on this?

> Also, I believe it's possible to open a second Console view (it's a
> multi-instance view). If you could open a second console view and put
> your views in it, then the stdout/stderr wouldn't make it flip back to
> the program console.
I guess I could do this, but there must be a proper way to replace the
console. If no one can suggest anything else I will do this, but it is a
bit hackier than I would ideally like.

Thanks again,
Alex
Re: Help Creating Custom Console [message #301817 is a reply to message #301800] Thu, 06 April 2006 11:21 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Alex wrote:
>>You can get rid of that annoying flick back to the main console in the
>>Window>Preferences>Run/Debug>Console preferences.
>
> Cheers for that Paul. What I am looking for though is a way to do this
> programatically. I don't want to have to tell every user of this plugin to
> change their preferences. Anyone got any info on this?
>

You could programmatically change the preferences when you start up.
There are a number of articles and newsgroup posts about changing
preferences, and the API should be easy to use. But ...

This would change the user console preferences for the entire workspace.
That means that it wouldn't work properly for Java Run or anything
else. In RCP you can control the environment, but in Eclipse your
plugin needs to play nice with everybody else. That means not silently
change a preference that effects other guys (like Java Run and Debug).

I'd create the second Console view, specifically for use with your
plugin. That way you control what's going on in it, and the *correct*
operation of the original Console view won't cause you grief.

Later,
PW


Re: Help Creating Custom Console [message #301822 is a reply to message #301817] Thu, 06 April 2006 12:03 Go to previous message
Kevin Barnes is currently offline Kevin BarnesFriend
Messages: 174
Registered: July 2009
Senior Member
There is no way to replace the platform's process console with one of
your own right now. There is an outstanding bug requesting this feature
I believe, but I can't find it at the moment.
There is also another bug report requesting that the platform's process
console be improved to be more like a terminal
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=36669).
Unfortunately, neither of these bugs will be fixed for 3.2.
Have you considered contributing your code?
Kevin




Paul Webster wrote:
> Alex wrote:
>>> You can get rid of that annoying flick back to the main console in the
>>> Window>Preferences>Run/Debug>Console preferences.
>>
>> Cheers for that Paul. What I am looking for though is a way to do this
>> programatically. I don't want to have to tell every user of this
>> plugin to
>> change their preferences. Anyone got any info on this?
>>
>
> You could programmatically change the preferences when you start up.
> There are a number of articles and newsgroup posts about changing
> preferences, and the API should be easy to use. But ...
>
> This would change the user console preferences for the entire workspace.
> That means that it wouldn't work properly for Java Run or anything
> else. In RCP you can control the environment, but in Eclipse your
> plugin needs to play nice with everybody else. That means not silently
> change a preference that effects other guys (like Java Run and Debug).
>
> I'd create the second Console view, specifically for use with your
> plugin. That way you control what's going on in it, and the *correct*
> operation of the original Console view won't cause you grief.
>
> Later,
> PW
Previous Topic:peculiar problem with plugin.xml updating
Next Topic:error launching text editor
Goto Forum:
  


Current Time: Fri Dec 19 10:51:57 GMT 2014

Powered by FUDForum. Page generated in 0.12310 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software