Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tm-dev] Terminal plug-in integration

Hi Michal,

 

>start process in terminal programmatically (something like "/path/to/php {options}")

 

I wrote this up once for the purpose of having a little terminal development guide, but it ended up in the repository:

 

 

1. How to Open a terminal programmatically (and where to find Property Constants that can be used)

--------------------------------------------------------------------------------------------------

 

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.

 

 

 

>add additional environment variables before process will be started

 

Yes, this is supported. The property to be added to the properties map is ‘ITerminalConnectorConstants.PROP_PROCESS_ENVIRONMENT’.

 

>ideally: Can Terminal be embedded inside other view?

 

Well, in fact you can do this. The terminal is provided as embeddable control via the o.e.tm.terminal.control plugin. You will have to write some clue code to instantiate the control, but this use case is a supported one.

 

Best regards, Uwe J

 

 

 

From: tm-dev-bounces@xxxxxxxxxxx [mailto:tm-dev-bounces@xxxxxxxxxxx] On Behalf Of Michal Niewrzal
Sent: Mittwoch, 16. Dezember 2015 17:19
To: tm-dev@xxxxxxxxxxx
Subject: [tm-dev] Terminal plug-in integration

 

Hi All,

 

In our product (Zend Studio) we are thinking about using Terminal as a part of our tool for command line app called Composer (from PHP world). I was looking into Terminal source code for some knowledge but I decided that it would be easier to ask here for guidance:) 

 

What we need in general:

* start process in terminal programmatically (something like "/path/to/php {options}")

* add additional environment variables before process will be started

* ideally: Can Terminal be embedded inside other view?

 

What I'm looking for is a small example with starting point or link to some documentation that can help:)

 

I will be glad for any help. Thanks in advance.

Michal


Back to the top