[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [tm-dev] Example for programmatic use of Terminal View
|
Hi Gunnar,
I do not have an explicit example on how to launch a local command in a Terminal. And probably I haven't got entirely your use case. What I have is an example on how to a terminal programmatically.
----
To open a terminal programmatically, use the ITerminalService.openConsole(...) method. The terminal to open is defined by the passed in properties. The following example opens a new local terminal.
// Define the terminal properties
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(ITerminalsConnectorConstants.PROP_TITLE, "My Local Terminal");
properties.put(ITerminalsConnectorConstants.PROP_ENCODING, "UTF-8");
properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, "/tmp");
// Create the done callback object
ITerminalService.Done done = new ITerminalService.Done() {
public void done(IStatus done) {
// Place any post processing here
}
};
// Open the terminal
ITerminalService terminal = TerminalServiceFactory.getService();
if (terminal != null) terminal.openConsole(properties, done);
To learn what properties are available an can be set for a specific terminal type, please look into the ITerminalConnectorConstants interface.
----
The ITerminalConnectorConstants.PROP_PROCESS_PATH and ITerminalConnectorConstants.PROP_PROCESS_ARGS defines the command to be executed. See o.e.tm.terminal.connector.local.launcher.LocalLauncherDelegate, line 291 and following. You should be able to utilize this properties to run something else than a shell in the local terminal.
Best regards, Uwe :)
> -----Original Message-----
> From: tm-dev-bounces@xxxxxxxxxxx [mailto:tm-dev-bounces@xxxxxxxxxxx] On
> Behalf Of Gunnar Wagenknecht
> Sent: Donnerstag, 23. Juni 2016 16:05
> To: tm-dev@xxxxxxxxxxx
> Subject: [tm-dev] Example for programmatic use of Terminal View
>
> Greetings,
>
> Are there examples available for how to launch a local command and have it
> open on in the Terminal View?
>
> -Gunnar
> _______________________________________________
> tm-dev mailing list
> tm-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit https://dev.eclipse.org/mailman/listinfo/tm-dev