mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use a separate group for read only attach
This commit is contained in:
+32
-6
@@ -58,7 +58,7 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDebuggerDisplayName() {
|
||||
return "Java Debugger";
|
||||
return myInfo.getDebuggerName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,16 +69,26 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
|
||||
|
||||
private static final Key<Map<String, LocalAttachInfo>> ADDRESS_MAP_KEY = Key.create("ADDRESS_MAP");
|
||||
|
||||
private static final XLocalAttachGroup ourAttachGroup = new XDefaultLocalAttachGroup() {
|
||||
private static final XLocalAttachGroup ourAttachGroup = new JavaDebuggerAttachGroup("Java", -20);
|
||||
|
||||
static class JavaDebuggerAttachGroup extends XDefaultLocalAttachGroup {
|
||||
private final String myName;
|
||||
private final int myOrder;
|
||||
|
||||
JavaDebuggerAttachGroup(String name, int order) {
|
||||
myName = name;
|
||||
myOrder = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 1;
|
||||
return myOrder;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getGroupName() {
|
||||
return "Java";
|
||||
return myName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -130,7 +140,14 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
|
||||
}
|
||||
|
||||
LocalAttachInfo info = getAttachInfo(project, processInfo, addressMap);
|
||||
return info != null ? Collections.singletonList(new JavaLocalAttachDebugger(project, info)) : Collections.emptyList();
|
||||
if (info != null && isDebuggerAttach(info)) {
|
||||
return Collections.singletonList(new JavaLocalAttachDebugger(project, info));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
boolean isDebuggerAttach(LocalAttachInfo info) {
|
||||
return info instanceof DebuggerLocalAttachInfo;
|
||||
}
|
||||
|
||||
private static Set<String> getAttachedPids(@NotNull Project project) {
|
||||
@@ -300,6 +317,11 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
|
||||
return myAutoAddress ? super.getSessionName() : "localhost:" + myAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
String getDebuggerName() {
|
||||
return "Java Debugger";
|
||||
}
|
||||
|
||||
@Override
|
||||
String getProcessDisplayText(String text) {
|
||||
return text + " (" + myAddress + ")";
|
||||
@@ -337,8 +359,12 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
|
||||
return "pid " + myPid;
|
||||
}
|
||||
|
||||
String getDebuggerName() {
|
||||
return "Read Only Java Debugger";
|
||||
}
|
||||
|
||||
String getProcessDisplayText(String text) {
|
||||
return text + " (read only)";
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.debugger.impl.attach;
|
||||
|
||||
import com.intellij.xdebugger.attach.XLocalAttachGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class JavaSAAttachDebuggerProvider extends JavaAttachDebuggerProvider {
|
||||
private static final XLocalAttachGroup ourAttachGroup = new JavaDebuggerAttachGroup("Java Read Only", -19);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XLocalAttachGroup getAttachGroup() {
|
||||
return ourAttachGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isDebuggerAttach(LocalAttachInfo info) {
|
||||
return !super.isDebuggerAttach(info);
|
||||
}
|
||||
}
|
||||
@@ -285,6 +285,7 @@
|
||||
<projectConfigurable parentId="project.propDebugger" instance="com.intellij.debugger.settings.CaptureConfigurable"/>
|
||||
|
||||
<xdebugger.localAttachDebuggerProvider implementation="com.intellij.debugger.impl.attach.JavaAttachDebuggerProvider"/>
|
||||
<xdebugger.localAttachDebuggerProvider implementation="com.intellij.debugger.impl.attach.JavaSAAttachDebuggerProvider"/>
|
||||
|
||||
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaMethodBreakpointType"/>
|
||||
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaWildcardMethodBreakpointType"/>
|
||||
|
||||
Reference in New Issue
Block a user