How to start STF for IntelliJ

10 views
Skip to first unread message

Jannis Fey

unread,
Aug 28, 2018, 8:56:10 AM8/28/18
to Saros Development
Hi all,

I try to start the STF for IntelliJ.

The de.fu_berlin.inf.dpp.stf project is now also a plugin for IntelliJ. I build a plugin.xml like this:

<idea-plugin version="2">
<id>de.fu-berlin.dpp.stf</id>
<name>STF Plugin</name>
<version>0.1.0.DEVEL</version>
<vendor url="http://www.saros-project.org">Saros Project</vendor>

<description><![CDATA[
This plugin provides the STF framework for testing the Saros plugin-
]]></description>

<project-components>
<component>
<implementation-class>de.fu_berlin.inf.dpp.stf.SarosComponentSTF
</implementation-class>
</component>
</project-components>

</idea-plugin>

That seems to work fine so I get this message in the idea.log
INFO - llij.ide.plugins.PluginManager - Loaded custom plugins: STF Plugin (0.1.0.DEVEL), SWT Library Plugin (1.0), Saros (14.1.31.DEVEL)

But to start the STF I need the ContainerContext: STFController.start(port, context)

For Eclipse "@Inject private IContainerContext context;" works fine, but for the IntelliJ Plugin the context is always null.

Does anyone know how to hook into the IntelliJ Plugin Lifecycle from the new STF-Plugin. The STF can only be started after the context is created/loaded.

Thank you
Jannis

Tobias Bouschen

unread,
Aug 28, 2018, 9:42:08 AM8/28/18
to saros...@googlegroups.com
Hi Jannis,

Just in case this is not already set up correctly in your IntelliJ logic:
For @Inject to work, you need to also call
"SarosPluginContext.initComponent(this);" to initialize the tagged
variables with the PicoContainer. The tag itself is just that, a tag. It
does not contain any functionality.

But I don't quite get how you are trying to access the IntelliJ plugin
lifecycle context from another plugin. The PicoContainer that is used in
Saros to inject the variables is set up by the plugin itself.

What does Eclipse do to set up a PicoContainer used to inject the
ContainerContext?

As far as I can tell, the plugin lifecycle context is managed by the
core, meaning it should be independent from Intellij/the Saros/I stuff
and should not be different from Saros/E. But maybe I don't understand
the setup correctly.

Best regards,
Tobias

Zieris, Franz

unread,
Aug 28, 2018, 10:00:44 AM8/28/18
to Tobias Bouschen, Jannis Fey, saros...@googlegroups.com
Hi there,

Tobias wrote:

> What does Eclipse do to set up a PicoContainer used to inject the ContainerContext?

There appears to be some confusion:
"the ContainerContext" __is__ "a PicoContainer".

For all Saros versions, there is class that extends AbstractContextLifecycle [1].
For Saros/E, it's EclipsePluginLifecycle.
When the Eclipse plugin is started by the Eclipse IDE [2], an instance of EclipsePluginLifecycle is started.
EclipsePluginLifecycle's start method is inherited from AbstractContextLifecycle,
and it creates the dependency injection container (aka ContainerContext, aka "a PicoContainer").

The creation of that container is distributed among several classes,
as is explained here [3] (some browsers won't display the SVG's correctly, Chrome works).

Hope this helps to clear up the concepts.

Franz

[1] https://github.com/saros-project/saros/blob/master/de.fu_berlin.inf.dpp.core/src/de/fu_berlin/inf/dpp/context/AbstractContextLifecycle.java
[2] https://github.com/saros-project/saros/blob/master/de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/Saros.java#L115
[3] http://www.saros-project.org/specoverview#internal-dependency-management
--
You received this message because you are subscribed to the Google Groups "Saros Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to saros-devel...@googlegroups.com.
To post to this group, send email to saros...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/saros-devel/97d93956-70ef-61f8-378a-046609b7ac0a%40fu-berlin.de.
For more options, visit https://groups.google.com/d/optout.

Tobias Bouschen

unread,
Aug 28, 2018, 10:16:40 AM8/28/18
to saros...@googlegroups.com
I know that the container context is a PicoContainer. But from Jannis' statement using "@Inject private IContainerContext context;", I assumed that the STF has some other container that can be used to get the needed container since is didn't make much sense to me to use the inject Annotation to get the container itself.

Thanks for clearing up the inheritance structure for AbstractContainerContext. The matching implementation in IntelliJ is IntelliJProjectLifecycle. This lifecycle being project bound and not application bound might be the cause of Jannis' problem. (But this is only speculation on my side.)

Best regards,
Tobias

Jannis Fey

unread,
Aug 30, 2018, 7:14:09 AM8/30/18
to Saros Development

Hi,

I found a simlple solution to get the Context from the IntelliJPlugin for my STF-Plugin.

IContainerContext context = IntellijProjectLifecycle.getInstance(project).getSarosContext();

So the STF will start and export the objects.

Now I have annother issue that something like "context.getComponent(BrowserManager.class)" doesn't work.

The error is: java.lang.IncompatibleClassChangeError: Class de.fu_berlin.inf.dpp.context.ContainerContext does not implement the requested interface de.fu_berlin.inf.dpp.context.IContainerContext

I looked with the debugger at the context and can't find the problem. It is the same context which is created from the Lifecycle.

Any ideas?

Thanks, Jannis

Reply all
Reply to author
Forward
0 new messages