Help Creating Custom Console [message #301679] |
Tue, 04 April 2006 10:33 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #301800 is a reply to message #301709] |
Wed, 05 April 2006 20:47 |
Eclipse User |
|
|
|
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 |
|
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
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
|
Powered by
FUDForum. Page generated in 0.03179 seconds