mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-6066 add isLibraryFrameFilterSupported — ability to declare capability
This commit is contained in:
@@ -449,4 +449,9 @@ public class JavaDebugProcess extends XDebugProcess {
|
||||
public XValueMarkerProvider<?, ?> createValueMarkerProvider() {
|
||||
return new JavaValueMarker();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLibraryFrameFilterSupported() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,8 @@ abstract class DebugProcessImpl<C : VmConnection<*>>(session: XDebugSession,
|
||||
}
|
||||
|
||||
abstract fun getLocationsForBreakpoint(breakpoint: XLineBreakpoint<*>, onlySourceMappedBreakpoints: Boolean): List<Location>
|
||||
|
||||
override fun isLibraryFrameFilterSupported() = true
|
||||
}
|
||||
|
||||
class LineBreakpointHandler(breakpointTypeClass: Class<out XLineBreakpointType<*>>,
|
||||
|
||||
@@ -240,4 +240,11 @@ public abstract class XDebugProcess {
|
||||
XStackFrame frame = getSession().getCurrentStackFrame();
|
||||
return frame == null ? null : frame.getEvaluator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is "isShowLibraryStackFrames" setting respected. If true, ShowLibraryFramesAction will be shown, for example.
|
||||
*/
|
||||
public boolean isLibraryFrameFilterSupported() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+29
-3
@@ -19,6 +19,7 @@ import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
import com.intellij.xdebugger.impl.settings.XDebuggerSettingManagerImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -27,6 +28,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author egor
|
||||
*/
|
||||
final class ShowLibraryFramesAction extends ToggleAction {
|
||||
// we should remember initial answer "isLibraryFrameFilterSupported" because on stop no debugger process, but UI is still shown
|
||||
// - we should avoid "jumping" (visible (start) - invisible (stop) - visible (start again))
|
||||
private static final String IS_LIBRARY_FRAME_FILTER_SUPPORTED = "isLibraryFrameFilterSupported";
|
||||
|
||||
private volatile boolean myShouldShow;
|
||||
private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
|
||||
private static final String ourTextWhenShowIsOff = "Show All Frames";
|
||||
@@ -39,9 +44,30 @@ final class ShowLibraryFramesAction extends ToggleAction {
|
||||
@Override
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
|
||||
Presentation presentation = e.getPresentation();
|
||||
|
||||
Object isSupported = presentation.getClientProperty(IS_LIBRARY_FRAME_FILTER_SUPPORTED);
|
||||
XDebugSession session = e.getData(XDebugSession.DATA_KEY);
|
||||
if (isSupported == null) {
|
||||
if (session == null) {
|
||||
// if session is null and isSupported is null - just return, it means that action created initially not in the xdebugger tab
|
||||
presentation.setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
isSupported = session.getDebugProcess().isLibraryFrameFilterSupported();
|
||||
presentation.putClientProperty(IS_LIBRARY_FRAME_FILTER_SUPPORTED, isSupported);
|
||||
}
|
||||
|
||||
if (Boolean.TRUE.equals(isSupported)) {
|
||||
presentation.setVisible(true);
|
||||
final boolean shouldShow = !Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY));
|
||||
presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
|
||||
}
|
||||
else {
|
||||
presentation.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user