Creating a "Run" type.


Gang,

I am thinking of creating a "Run" type for OSGi containers. But I have not
been able to figure out how to hook into the Run->Run... system.

Any pointers, overview of what is needed or example code would be greatly
appreciated.


Cheers
Niclas

5 comments

Hello Niclas,

NH> I am thinking of creating a "Run" type for OSGi containers. But I
NH> have not been able to figure out how to hook into the Run->Run...
NH> system.
NH>
NH> Any pointers, overview of what is needed or example code would be
NH> greatly appreciated.

You need to provide an application component which implements the ConfigurationType
interface. The ConfigurationType provides one or more ConfigurationFactory,
and a ConfigurationFactory creates instances of RunConfiguration classes.
You can find sample code for these APIs in the DevKit plugin (org.jetbrains.idea.devkit.run
package) and in the J2ME plugin (com.intellij.j2meplugin.run package). Source
code for both of these plugins is included in the Plugin Development Package.

If you have more specific questions, feel free to ask.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Dmitry Jemerov wrote:

Hello Niclas,

NH> I am thinking of creating a "Run" type for OSGi containers. But I
NH> have not been able to figure out how to hook into the Run->Run...
NH> system.
NH>
NH> Any pointers, overview of what is needed or example code would be
NH> greatly appreciated.

You need to provide an application component which implements the
ConfigurationType interface. The ConfigurationType provides one or more
ConfigurationFactory, and a ConfigurationFactory creates instances of
RunConfiguration classes. You can find sample code for these APIs in the
DevKit plugin (org.jetbrains.idea.devkit.run package) and in the J2ME
plugin (com.intellij.j2meplugin.run package). Source code for both of
these plugins is included in the Plugin Development Package.

If you have more specific questions, feel free to ask.


Ok, thanks. Should get me going at least...

Now,
public class OsgiRunConfiguration extends RunConfigurationBase
implements RunConfiguration

gives me a weird error in the IDEA editor (but not from the compiler)

'clone()' in 'com.intellij.execution.configurations.RunConfigurationBase' clashes with 'clone()' in 'com.intellij.execution.configurations.RunConfiguration'; attempting to use incompatible return type. ]]>

However, the only 'problem' I see is that clone() is a method from
java.lang.Object, and should not be overridden with another return type at
all.

But I suspect I got something in the whole DevKit setup installed wrongly or
something. (btw, using 5.1.2, but have 6.0beta something installed but not
used much as well).


Thanks
Niclas


0

Hello Niclas,

NH> Now,
NH> public class OsgiRunConfiguration extends RunConfigurationBase
NH> implements RunConfiguration
NH> gives me a weird error in the IDEA editor (but not from the
NH> compiler)
NH>
NH> NH> 'clone()' in NH> 'com.intellij.execution.configurations.RunConfigurationBase' NH> clashes with 'clone()' NH> in 'com.intellij.execution.configurations.RunConfiguration'; NH> attempting to NH> use incompatible return type. NH> NH> However, the only 'problem' I see is that clone() is a method from NH> java.lang.Object, and should not be overridden with another return NH> type at all. NH> NH> But I suspect I got something in the whole DevKit setup installed NH> wrongly or something. (btw, using 5.1.2, but have 6.0beta something NH>]]> installed but not used much as well).

No, you have everything installed right. This error is a known issue with
5.1.2 which is fixed in 6.0.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Dmitry Jemerov wrote:

Hello Niclas,

NH> Now,
NH> public class OsgiRunConfiguration extends RunConfigurationBase
NH> implements RunConfiguration
NH> gives me a weird error in the IDEA editor (but not from the
NH> compiler)

No, you have everything installed right. This error is a known issue with
5.1.2 which is fixed in 6.0.


Ok, cool.
FYI, I have managed to proceed to write some useful code and get the panels
in order.

Q;
What is the "RunnerSettings" and "RunnerSettingsEditor" ??

Likewise, would be good to get an explanation (or pointer) of the getState()
method in RunConfiguration, and the associated arguments?


Cheers
Niclas

0

Hello Niclas,

NH> What is the "RunnerSettings" and "RunnerSettingsEditor" ??

Basically, a configuration defines what to run (application, app server etc.),
and a runner defines how to run it. The standard runners available in IDEA
are Run and Debug.

You can treat the RunnerSettings object as opaque - simply pass the instance
you get as a getState() parameter to a CommandLineState object.

NH> Likewise, would be good to get an explanation (or pointer) of the
NH> getState() method in RunConfiguration, and the associated arguments?

A RunProfileState basically represents a single instance of a process started
by your configuration. If what you need to run is a Java process, you can
return from getState() a customized instance of JavaCommandLineState object.
The getState() parameters need to be passed to the JavaCommandLineState constructor.

In your subclass of JavaCommandLineState, you can customize the arguments
passed in the command line, process the output of the started process, and
if necessary, perform some additional actions before or after the run.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.