How to know if plugin is opened in a host via gateway?

已回答

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?

0

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.

0

how to retreive the service in code, what function should i call of the gateway module 

 

0

How can i define the service in withGateway.xml file

0

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
 

0

i am also facing the same issue 

0

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. 

0

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?

0

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. 

0

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.

0

请先登录再写评论。