This Question is Answered

9 Replies Last post: Feb 4, 2010 3:45 PM by Slawomir Ginter  
James Strachan Novice 174 posts since
Apr 29, 2003
Currently Being Moderated

Jan 14, 2010 2:54 PM

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.

Slawomir Ginter Newbie 22 posts since
Jan 25, 2008
Currently Being Moderated
Jan 14, 2010 3:13 PM in response to: James Strachan
Re: communicating with IDEA from a remote process?

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

Slawomir Ginter Newbie 22 posts since
Jan 25, 2008
Currently Being Moderated
Jan 14, 2010 3:37 PM in response to: James Strachan
Re: communicating with IDEA from a remote process?

Look for IdeHttpServerHandler and startHttpServer() in ThePluginApplicationComponent

Slawomir Ginter Newbie 22 posts since
Jan 25, 2008
Currently Being Moderated
Jan 14, 2010 3:50 PM in response to: James Strachan
Re: communicating with IDEA from a remote process?

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">
Slawomir Ginter Newbie 22 posts since
Jan 25, 2008
Currently Being Moderated
Feb 4, 2010 3:07 PM in response to: James Strachan
Re: communicating with IDEA from a remote process?

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

Slawomir Ginter Newbie 22 posts since
Jan 25, 2008
Currently Being Moderated
Feb 4, 2010 3:45 PM in response to: James Strachan
Re: communicating with IDEA from a remote process?

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

More Like This

  • Retrieving data ...