mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-11-22 07:04:49 +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;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ConnectAction extends AnAction {
|
public class ConnectAction extends AnAction {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
/*try {
|
/*try {
|
||||||
NativeUtils.loadLibraryFromJar("/resources/libHelloJNI.so");
|
NativeUtils.loadLibraryFromJar("/resources/libHelloJNI.so");
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
throw new RuntimeException(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
|
@Override
|
||||||
|
@ -29,7 +29,7 @@ public class ConnectAction extends AnAction {
|
||||||
try {
|
try {
|
||||||
CodeMPHandler.connect(url);
|
CodeMPHandler.connect(url);
|
||||||
//Messages.showInfoMessage(String.format("Connected to %s!", url), "CodeMP");
|
//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) {
|
} catch(Exception ex) {
|
||||||
Messages.showErrorDialog(String.format("Failed to connect to %s: %s!", url, ex.getMessage()), "CodeMP");
|
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 org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -70,7 +69,7 @@ public class JoinAction extends AnAction {
|
||||||
h.dispose();
|
h.dispose();
|
||||||
|
|
||||||
System.out.printf(
|
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.getUser(),
|
||||||
event.getStartCol(), event.getStartCol(),
|
event.getStartCol(), event.getStartCol(),
|
||||||
event.getEndRow(), event.getEndCol(),
|
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>
|
<depends>com.intellij.modules.platform</depends>
|
||||||
|
|
||||||
<actions>
|
<actions>
|
||||||
<action id="codemp-connect" class="com.codemp.intellij.actions.ConnectAction" text="CodeMP Connect">
|
<group id="codemp" text="CodeMP" popup="true">
|
||||||
<add-to-group group-id="ToolsMenu" anchor="first"></add-to-group>
|
<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>
|
||||||
<action id="codemp-join" class="com.codemp.intellij.actions.JoinAction" text="CodeMP Join">
|
<action id="codemp.join" class="com.codemp.intellij.actions.JoinAction" text="Join...">
|
||||||
<add-to-group group-id="ToolsMenu" anchor="first"></add-to-group>
|
<add-to-group group-id="ToolsMenu" anchor="first"/>
|
||||||
</action>
|
</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>
|
</actions>
|
||||||
|
|
||||||
<!-- Extension points defined by the plugin.
|
<!-- Extension points defined by the plugin.
|
||||||
|
|
Loading…
Reference in a new issue