mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-11-21 22:54:48 +01:00
feat: menu action for connecting
This commit is contained in:
parent
4ed7704ff0
commit
c6e3d00dbf
3 changed files with 33 additions and 3 deletions
|
@ -1,4 +1,3 @@
|
|||
package com.codemp.intellij;
|
||||
|
||||
public class CodeMP {
|
||||
}
|
||||
public class CodeMP {}
|
||||
|
|
25
src/main/java/com/codemp/intellij/actions/ConnectAction.java
Normal file
25
src/main/java/com/codemp/intellij/actions/ConnectAction.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package com.codemp.intellij.actions;
|
||||
|
||||
import com.codemp.intellij.jni.CodeMPHandler;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ConnectAction extends AnAction {
|
||||
|
||||
static {
|
||||
System.load("O:/dev/IRL/Rust/codemp/client/intellij/target/debug/codemp_intellij.dll");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
String url = Messages.showInputDialog("URL to CodeMP instance:", "CodeMP", Messages.getQuestionIcon());
|
||||
try {
|
||||
CodeMPHandler.connect(url);
|
||||
Messages.showInfoMessage(String.format("Connected to %s!", url), "CodeMP");
|
||||
} catch(Exception ex) {
|
||||
Messages.showErrorDialog(String.format("Failed to connect to %s: %s!", url, ex.getMessage()), "CodeMP");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
|
||||
<idea-plugin>
|
||||
<!-- Unique identifier of the plugin. It should be FQN. It cannot be changed between the plugin versions. -->
|
||||
<id>com.codemp.codemp-intellij</id>
|
||||
<id>com.codemp.intellij</id>
|
||||
|
||||
<!-- Public plugin name should be written in Title Case.
|
||||
Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-name -->
|
||||
|
@ -22,6 +22,12 @@
|
|||
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
|
||||
<actions>
|
||||
<action id="connect" class="com.codemp.intellij.actions.ConnectAction" text="Connect">
|
||||
<add-to-group group-id="ToolsMenu" anchor="first"></add-to-group>
|
||||
</action>
|
||||
</actions>
|
||||
|
||||
<!-- Extension points defined by the plugin.
|
||||
Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
|
|
Loading…
Reference in a new issue