mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-12-23 04:54:52 +01:00
feat: added empty buffer creation and submenu section
This commit is contained in:
parent
d75fb75b3c
commit
1228f786b7
4 changed files with 47 additions and 11 deletions
|
@ -10,14 +10,14 @@ import org.jetbrains.annotations.NotNull;
|
|||
import java.io.IOException;
|
||||
|
||||
public class ConnectAction extends AnAction {
|
||||
|
||||
static {
|
||||
/*try {
|
||||
NativeUtils.loadLibraryFromJar("/resources/libHelloJNI.so");
|
||||
} catch(IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
System.load("O:/dev/IRL/Rust/codemp/client/intellij/target/debug/codemp_intellij.dll");
|
||||
System.load("/home/zaaarf/dev/irl/rust/codemp/client/intellij/target/debug/libcodemp_intellij.so");
|
||||
//System.load("O:/dev/IRL/Rust/codemp/client/intellij/target/debug/codemp_intellij.dll");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,7 @@ public class ConnectAction extends AnAction {
|
|||
try {
|
||||
CodeMPHandler.connect(url);
|
||||
//Messages.showInfoMessage(String.format("Connected to %s!", url), "CodeMP");
|
||||
System.out.printf("Connected to %s!%n", url);
|
||||
System.out.printf("Connected to %s!\n", url);
|
||||
} catch(Exception ex) {
|
||||
Messages.showErrorDialog(String.format("Failed to connect to %s: %s!", url, ex.getMessage()), "CodeMP");
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.intellij.ui.JBColor;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
@ -70,7 +69,7 @@ public class JoinAction extends AnAction {
|
|||
h.dispose();
|
||||
|
||||
System.out.printf(
|
||||
"Cursor moved by user %s! Start pos: x%d y%d; end pos: x%d y%d with buffer %s%n\n",
|
||||
"Cursor moved by user %s! Start pos: x%d y%d; end pos: x%d y%d with buffer %s!\n",
|
||||
event.getUser(),
|
||||
event.getStartCol(), event.getStartCol(),
|
||||
event.getEndRow(), event.getEndCol(),
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.codemp.intellij.actions.buffer;
|
||||
|
||||
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 BufferCreateAction extends AnAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
String buffer = Messages.showInputDialog(
|
||||
"Buffer name:",
|
||||
"Create CodeMP Buffer",
|
||||
Messages.getQuestionIcon());
|
||||
|
||||
try {
|
||||
CodeMPHandler.create(buffer);
|
||||
//Messages.showInfoMessage(String.format("Created buffer %s!", url), "Create CodeMP Buffer" );
|
||||
System.out.printf("Created buffer %s!\n", buffer);
|
||||
} catch(Exception ex) {
|
||||
Messages.showErrorDialog(String.format(
|
||||
"Failed to create buffer with name %s: %s!",
|
||||
buffer, ex.getMessage()), "Create CodeMP Buffer");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,12 +23,21 @@
|
|||
<depends>com.intellij.modules.platform</depends>
|
||||
|
||||
<actions>
|
||||
<action id="codemp-connect" class="com.codemp.intellij.actions.ConnectAction" text="CodeMP Connect">
|
||||
<add-to-group group-id="ToolsMenu" anchor="first"></add-to-group>
|
||||
</action>
|
||||
<action id="codemp-join" class="com.codemp.intellij.actions.JoinAction" text="CodeMP Join">
|
||||
<add-to-group group-id="ToolsMenu" anchor="first"></add-to-group>
|
||||
</action>
|
||||
<group id="codemp" text="CodeMP" popup="true">
|
||||
<add-to-group group-id="ToolsMenu" anchor="first"/>
|
||||
<action id="codemp.connect" class="com.codemp.intellij.actions.ConnectAction" text="Connect...">
|
||||
<add-to-group group-id="ToolsMenu" anchor="first"/>
|
||||
</action>
|
||||
<action id="codemp.join" class="com.codemp.intellij.actions.JoinAction" text="Join...">
|
||||
<add-to-group group-id="ToolsMenu" anchor="first"/>
|
||||
</action>
|
||||
<group id="codemp.buffer" text="Buffer" popup="true">
|
||||
<action id="codemp.buffer.create" class="com.codemp.intellij.actions.buffer.BufferCreateAction"
|
||||
text="Create Buffer">
|
||||
<add-to-group group-id="ToolsMenu" anchor="first"/>
|
||||
</action>
|
||||
</group>
|
||||
</group>
|
||||
</actions>
|
||||
|
||||
<!-- Extension points defined by the plugin.
|
||||
|
|
Loading…
Reference in a new issue