Reply
Contributor
BillS
Posts: 39
Registered: 09-04-2008
0
Accepted Solution

Way to call built-in Tcl interp, but not from a "tool"?

We have a scenario where a menu contribution we're making to iTest may receive some Tcl data (specifically Tcl commands loaded from a text file). We'd like to be able to process that by calling directly to the iTest built-in Tcl interpreter.

 

If it were a tool plugin, or an execution monitor, or any of those kind of plugin additions it'd be straight-forward, but this is from a plugin that's simply a menu contribution and separate code.

 

Any thoughts on whether this is achievable? We have other options, this just struck me as one of the nicer potential choices... so before I spend any time digging further I figured I'd check at a high level if it was feasible.

 

Thanks,

-Bill

 

Expert
KumarS
Posts: 2,233
Registered: 08-30-2008
0

Re: Way to call built-in Tcl interp, but not from a "tool"?

It should be. TclInterpreter service should be accessible through some open platform apis. Let me dig through and find out.

Expert
KumarS
Posts: 2,233
Registered: 08-30-2008

Re: Way to call built-in Tcl interp, but not from a "tool"?

This is not part of SDK - but you can do following:

 

if you add a dependency to this plugin:

com.fnfr.svt.fftcl

 

You can call:

   public ITestTclInterpreter createInterpHandle() throws InterpCreationException;

 

ITestTclInterpreter will allow you to evaluate tcl statements. It will the tcl shell which is set in iTest preferences.

 

Note that this is an internal API and will not work in next release of iTest. It will only work in 3.4. Not only that, it may stop working in a new service pack of 3.4 - but probability of that is really low. We will take a look if we can make ITclInterpreter from the SDK available for purposes other than tools.

 

 

Community Leader
PaulD
Posts: 1,214
Registered: 09-02-2008

Re: Way to call built-in Tcl interp, but not from a "tool"?

I think you might have this wrong, Kumar.

 

I believe you need the com.fnfr.svt.adapter.tcl plugin and then:

 

ITestTclInterpreter interp = InterpHandler.createInstance().createInterpHandle();

 

Right?

Community Leader
AdamB
Posts: 723
Registered: 09-01-2008

Re: Way to call built-in Tcl interp, but not from a "tool"?

Hi Bill,

 

There is a better way to get a tcl interpreter.  If you include the package:

com.fnfr.itest.platform.tcl

 

You will then have access to its activator:

ActivatorTclService

 

If you call:

ActivatorTclService().getDefault().getTclServiceManager()

 

You will get an ITclServiceManager.  It has methods that let you create a tcl interpreter.

 

Wei will be able to answer further questions about this.

 

One caveat, this is not in the officially supported SDK, so it may change from release to release (But given it is in the platform, it is less likely to change than the options above.)  We will look to add a supported API for services like this.

 

-a


Does this post answer your question? Click the "Accept as solution" button.

Was this post helpful? Click the yellow "Kudos!" button.
Fanfare
WeiD
Posts: 150
Registered: 09-18-2008

Re: Way to call built-in Tcl interp, but not from a "tool"?

If you just want to get the iTest built-in tclinterpreter:

ActivatorTclService().getDefault().getTclServiceManager().getInterpreter("com.fnfr.svt.fftcl.local")

Community Leader
AdamB
Posts: 723
Registered: 09-01-2008
0

Re: Way to call built-in Tcl interp, but not from a "tool"?

Doh.  A future version will have this platform support.  I'd recommend using Kumar's mechanism for now and then updating as needed.


Does this post answer your question? Click the "Accept as solution" button.

Was this post helpful? Click the yellow "Kudos!" button.
Contributor
BillS
Posts: 39
Registered: 09-04-2008
0

Re: Way to call built-in Tcl interp, but not from a "tool"?

Heh, heh, looking too far into the future, are we Adam?

 

I'll go with the present-tense, looks like ti should work dandy. Thanks guys!

Community Leader
AdamB
Posts: 723
Registered: 09-01-2008
0

Re: Way to call built-in Tcl interp, but not from a "tool"?

That 'future' version is in beta now :smileyhappy:


Does this post answer your question? Click the "Accept as solution" button.

Was this post helpful? Click the yellow "Kudos!" button.