How to know if plugin is opened in a host via gateway?
Answered
If the user hosts intellij on gateway and installs plugin there, I want to display a notification. I won't display it if it's not opened via gateway. How to check this?
Please sign in to leave a comment.
Hi,
I suggest creating a service registered in, e.g., withGateway.xml file that would be registered with optional dependency when
com.jetbrains.gateway
module is loaded:https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html#optional-plugin-dependencies
When you retrieve the service in your code and it is not null, then the plugin is run in the Gateway context.
how to retreive the service in code, what function should i call of the gateway module
How can i define the service in withGateway.xml file
See: https://plugins.jetbrains.com/docs/intellij/plugin-services.html
It should be a non-light service, so registered in XML.
i have defined the pluginid-withGateway.xml file as below and the plugin.xml file as below. still not able to get the response.
```<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<applicationService
serviceInterface="com.example.myservice" serviceImplmentation="com.example.myserviceimpl"/>
</extensions>
</idea-plugin>
```
plugin.xml
```
<depends optional="true" config-file="myPluginId-withGateway.xml">com.jetbrains.gateway</depends>
```
service class retrival
```
MyAppService applicationService = ApplicationManager.getApplication().getService(MyAppService.class);
if (applicationService1=null){
//want some code to execute
}
```
Please help
i am also facing the same issue
Hello, If I open intellij via gateway and go to plugins, there are 2 options - install from Host or install from Client. I am able to get the application service not null when plugin is installed from Host and show the notification. I am not able to get it if installed from Client.
Hi,
Sorry, it seems the solution I mentioned works in regular IDE contexts only.
Could you please explain what is the exact use case? Why do you want to display a notification when the plugin is in the Gateway context?
Because the plugin doesn't work properly in gateway and it has multiple issues but it's still usable. I want to show a notification to the user just to inform them until I resolve multiple issues parallelly.
I got information that there is no open API for this and it is not planned.
Any issues related to remote development should be reported to https://youtrack.jetbrains.com/issues/GTW.