communicating with IDEA from a remote process?

Is there any easy way to communicate with IDEA from a separate process? e.g. from another process tell IDEA to open a class at a specific line or something?

As some background, when working on Scala and continuous testing, sbt is really handy...
http://macstrac.blogspot.com/2010/01/using-sbt-on-your-scala-maven-project.html

the main issue is rendering working/failing tests - then on failures navigating to the source code in IDEA.

I raised http://youtrack.jetbrains.net/issue/SCL-1724 to track this idea.

I was wondering about writing a little web page renderer of the output of the sbt test results; where clicking on a line in a stack trace on a failed test case could then tell IDEA to open a class at a specific line.

0
9 comments

Atlassian IDE Connector does just that for integration with the web - you click on a link in Fisheye and the file is opened in IDEA.

It's open source - have a look

0

Awesome, thanks! Taking a look at the code now...

0

Look for IdeHttpServerHandler and startHttpServer() in ThePluginApplicationComponent

0

Am a bit confused; having a quick look at the Atlassian IDE connector for IDEA, its got code for talking to Fisheye URLs etc. I'm not sure how to find the fisheye code that renders a web page that creates links which open a file in IDEA? Or is it that the Atlassian IDE connector providers URLs which the fisheye code renders? i.e. the Atlassian IDE connector itself responds to HTTP requests and then opens files in IDEA?

Any chance of a pointer in the right direction please?

0

Awesome thanks! So I guess IDEA itself has no remote API - you have to write your own plugin which has an embedded HTTP server that does this part for you right? Thanks again!

0

One sample usage:
http://fisheye6.atlassian.com/browse/activemq/activecluster/trunk/src/main/java/org/apache/activecluster/Cluster.java#r502060

If you have an open IDEA with the connector you should see a nice icon.

If not, open the html source and look for this:

<img class="ide-icon tb_right_mid"
         id
="ide-icon651875381"
         title
="Open file activecluster/trunk/src/main/java/org/apache/activecluster/Cluster.java in IDEA"
         onclick
="this.src='http://localhost:51235/file?file=activecluster/trunk/src/main/java/org/apache/activecluster/Cluster.java&amp;id=' + Math.floor(Math.random()*1000);"
         alt
="Open in IDE"
         src="
http://localhost:51235/icon">
0

fantastic stuff! I was just looking at the code trying to figure out what a URL would look like. Great stuff!

0

Fisheye (by itself ) forges an URL in the format as in my comment above, esp see the <img> and onClick parts.

Connector responds to http requests on localhost and serves an image, as a side effect opens files specified in URL params or does other nice stuff.
It needs to be <img> because it is the only simple solution we know that would not cause Cross-Site Scripting problem.

There is a (very early stage) plugin for JIRA that does something similar, see: https://studio.plugins.atlassian.com/source/browse/OCSTAJ/trunk/src/main/java/com/atlassian/ocstaj/jira/StackTraceWikiRenderer.java?r=143793
It's very early stage, so don't tell anyone ;-)

It renders HTML page with links that when clicked would send a <img> request to IDE Connector on localhost to display a stack trace.

Regards,
Sławek

0

On the second thought, if you want to render a html page with a stack trace with clickable links, the project I pointed you to does exactly that :-)
The accompanying functionality of the Atlassian IDE Connector is already commited to the plugin sources, it will be included in the version about to be released next week.

You might extract the code as a separate plugin for IDEA or advise users to install the IDE Connector (of course I advise the latter ;-) )

The code I pointed you to scans a html page for something that looks like a stacktrace and adds the links when it finds one.
I dare to say just copy-paste the methodt and you are done ;-)

It's work in progress, so stay tuned for changes.

Regards,
Slawomir Ginter

0

Please sign in to leave a comment.