diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java index c1c93fc4d669..9d1f69a01e1e 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java @@ -449,4 +449,9 @@ public class JavaDebugProcess extends XDebugProcess { public XValueMarkerProvider createValueMarkerProvider() { return new JavaValueMarker(); } + + @Override + public boolean isLibraryFrameFilterSupported() { + return true; + } } diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt index a41e84c164dc..c457fa2ed17d 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt @@ -231,6 +231,8 @@ abstract class DebugProcessImpl>(session: XDebugSession, } abstract fun getLocationsForBreakpoint(breakpoint: XLineBreakpoint<*>, onlySourceMappedBreakpoints: Boolean): List + + override fun isLibraryFrameFilterSupported() = true } class LineBreakpointHandler(breakpointTypeClass: Class>, diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java index 6116d15b2ceb..e1aa69cc08cc 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java @@ -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; + } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ShowLibraryFramesAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ShowLibraryFramesAction.java index 3517aa2daf88..cc4b0b06d0bc 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ShowLibraryFramesAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ShowLibraryFramesAction.java @@ -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