mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
CPP-7669, CPP-14121 move the 'show only my processes' action to platform (IJ-CR-101234)
GitOrigin-RevId: 4db71e5b7da053597c8aa344d61efa7ec2dcf766
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f63e2cc084
commit
026d1b62f0
@@ -44,6 +44,7 @@ xdebugger.attach.view.message=Show as:
|
||||
xdebugger.attach.pid=pid {0,number,#}
|
||||
xdebugger.attach.reattach=Reattach to PID {0,number,#}
|
||||
xdebugger.attach.local.host=Local Host
|
||||
xdebugger.attach.show.only.my.processes=Show Only My Processes
|
||||
|
||||
xdebugger.attach.action.items.error.title=Failed to get processes
|
||||
xdebugger.attach.action.items.error.message=Failed to get the list of processes running on the host. Check the IDE log for additional details.
|
||||
|
||||
@@ -157,5 +157,10 @@
|
||||
<action id="XDebugger.Show.Breakpoints.Over.Line.Numbers" class="com.intellij.xdebugger.impl.settings.ShowBreakpointsOverLineNumbersAction">
|
||||
<add-to-group group-id="EditorGutterPopupMenu.Appearance" anchor="after" relative-to-action="EditorGutterToggleGlobalLineNumbers"/>
|
||||
</action>
|
||||
|
||||
<action id="XDebugger.Attach.Dialog.ShowOnlyMyProcessesToggleAction"
|
||||
class="com.intellij.xdebugger.impl.ui.attach.dialog.AttachShowOnlyMyProcessesToggleAction">
|
||||
<add-to-group group-id="XDebugger.Attach.Dialog.Settings"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xdebugger.impl.ui.attach.dialog
|
||||
|
||||
import com.intellij.execution.process.ProcessInfo
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.ToggleAction
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.util.ThreeState
|
||||
import com.intellij.xdebugger.XDebuggerBundle
|
||||
import java.util.function.Predicate
|
||||
|
||||
class AttachShowOnlyMyProcessesToggleAction :
|
||||
DumbAware, ProcessPredicate, ToggleAction(XDebuggerBundle.message("xdebugger.attach.show.only.my.processes")) {
|
||||
|
||||
companion object {
|
||||
const val DEFAULT = false
|
||||
const val SETTINGS_KEY = "ATTACH_DIALOG_SHOW_ONLY_MY_PROCESSES"
|
||||
}
|
||||
|
||||
override fun isSelected(e: AnActionEvent): Boolean {
|
||||
return isSelected()
|
||||
}
|
||||
|
||||
override fun setSelected(e: AnActionEvent, state: Boolean) {
|
||||
PropertiesComponent.getInstance().setValue(SETTINGS_KEY, state, DEFAULT)
|
||||
updateProcesses(e)
|
||||
}
|
||||
|
||||
override fun get(): Predicate<ProcessInfo> {
|
||||
val showAllProcesses = !isSelected()
|
||||
return Predicate { showAllProcesses || it.isOwnedByCurrentUser() == ThreeState.YES }
|
||||
}
|
||||
|
||||
private fun isSelected(): Boolean {
|
||||
return PropertiesComponent.getInstance().getBoolean(SETTINGS_KEY, DEFAULT)
|
||||
}
|
||||
|
||||
private fun updateProcesses(e: AnActionEvent) {
|
||||
e.project?.getService(AttachToProcessDialogFactory::class.java)?.getOpenDialog()?.updateProcesses()
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread(): ActionUpdateThread {
|
||||
return ActionUpdateThread.BGT
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user