fix: make folders in action menu work

This commit is contained in:
zaaarf 2024-10-09 23:03:14 +02:00
parent c155773753
commit 1e8306f6e4
No known key found for this signature in database
GPG key ID: C91CFF9E2262BBA1
2 changed files with 35 additions and 37 deletions

View file

@ -11,6 +11,8 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task; import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentContainer;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.ToolWindowManager;
import mp.code.BufferController; import mp.code.BufferController;
import mp.code.Client; import mp.code.Client;
@ -260,12 +262,10 @@ public class InteractionUtil {
} }
public static void refreshToolWindow(Project project) { public static void refreshToolWindow(Project project) {
CodeMPToolPanel w = (CodeMPToolPanel) ToolWindowManager.getInstance(project) Optional.ofNullable(ToolWindowManager.getInstance(project).getToolWindow("CodeMP"))
.getToolWindow("CodeMPToolWindow") .map(ToolWindow::getContentManager)
.getContentManager() .map(cm -> cm.getContent(0))
.getContent(0) .map(ComponentContainer::getComponent)
.getComponent(); .ifPresent(w -> ((CodeMPToolPanel) w).redraw(project));
if(w == null) return;
w.redraw(project);
} }
} }

View file

@ -10,11 +10,9 @@
<actions> <actions>
<group id="codemp" text="CodeMP" popup="true"> <group id="codemp" text="CodeMP" popup="true">
<add-to-group group-id="ToolsMenu" anchor="first"/> <add-to-group group-id="ToolsMenu" anchor="first"/>
<action id="codemp.connect" class="mp.code.intellij.actions.ConnectAction" text="Connect"/> <action id="codemp.connect" class="mp.code.intellij.actions.ConnectAction" text="Connect..."/>
<action id="codemp.disconnect" class="mp.code.intellij.actions.DisconnectAction" text="Disconnect"/> <action id="codemp.disconnect" class="mp.code.intellij.actions.DisconnectAction" text="Disconnect..."/>
</group> <group id="codemp.workspace" text="Workspace" popup="true">
<group id="codemp.workspace" text="Workspace">
<add-to-group group-id="codemp" anchor="first"/>
<action id="codemp.workspace.create" class="mp.code.intellij.actions.workspace.WorkspaceCreateAction" <action id="codemp.workspace.create" class="mp.code.intellij.actions.workspace.WorkspaceCreateAction"
text="Create Workspace"/> text="Create Workspace"/>
<action id="codemp.workspace.join" class="mp.code.intellij.actions.workspace.WorkspaceJoinAction" <action id="codemp.workspace.join" class="mp.code.intellij.actions.workspace.WorkspaceJoinAction"
@ -26,8 +24,7 @@
<action id="codemp.workspace.leave" class="mp.code.intellij.actions.workspace.WorkspaceLeaveAction" <action id="codemp.workspace.leave" class="mp.code.intellij.actions.workspace.WorkspaceLeaveAction"
text="Leave Workspace"/> text="Leave Workspace"/>
</group> </group>
<group id="codemp.buffer" text="Buffer"> <group id="codemp.buffer" text="Buffer" popup="true">
<add-to-group group-id="codemp" anchor="first"/>
<action id="codemp.buffer.share" class="mp.code.intellij.actions.buffer.BufferShareAction" <action id="codemp.buffer.share" class="mp.code.intellij.actions.buffer.BufferShareAction"
text="Share Current Buffer"/> text="Share Current Buffer"/>
<action id="codemp.buffer.attach" class="mp.code.intellij.actions.buffer.BufferAttachAction" <action id="codemp.buffer.attach" class="mp.code.intellij.actions.buffer.BufferAttachAction"
@ -41,6 +38,7 @@
<action id="codemp.buffer.sync" class="mp.code.intellij.actions.buffer.BufferSyncAction" <action id="codemp.buffer.sync" class="mp.code.intellij.actions.buffer.BufferSyncAction"
text="Sync Content of a Managed Buffer"/> text="Sync Content of a Managed Buffer"/>
</group> </group>
</group>
</actions> </actions>
<extensions defaultExtensionNs="com.intellij"> <extensions defaultExtensionNs="com.intellij">