Search in sources :

Example 1 with XLightBreakpointPropertiesPanel

use of com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel in project intellij-community by JetBrains.

the class XBreakpointItem method doUpdateDetailView.

@Override
public void doUpdateDetailView(DetailView panel, boolean editorOnly) {
    XBreakpointBase breakpoint = (XBreakpointBase) myBreakpoint;
    Project project = breakpoint.getProject();
    //saveState();
    if (myPropertiesPanel != null) {
        myPropertiesPanel.dispose();
        myPropertiesPanel = null;
    }
    if (!editorOnly) {
        myPropertiesPanel = new XLightBreakpointPropertiesPanel(project, getManager(), breakpoint, true);
        panel.setPropertiesPanel(myPropertiesPanel.getMainPanel());
    }
    XSourcePosition sourcePosition = myBreakpoint.getSourcePosition();
    if (sourcePosition != null && sourcePosition.getFile().isValid()) {
        showInEditor(panel, sourcePosition.getFile(), sourcePosition.getLine());
    } else {
        panel.clearEditor();
    }
    if (myPropertiesPanel != null) {
        myPropertiesPanel.setDetailView(panel);
        myPropertiesPanel.loadProperties();
        myPropertiesPanel.getMainPanel().revalidate();
    }
}
Also used : Project(com.intellij.openapi.project.Project) XLightBreakpointPropertiesPanel(com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel) XSourcePosition(com.intellij.xdebugger.XSourcePosition)

Example 2 with XLightBreakpointPropertiesPanel

use of com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel in project intellij-community by JetBrains.

the class DebuggerUIUtil method showXBreakpointEditorBalloon.

public static void showXBreakpointEditorBalloon(final Project project, @Nullable final Point point, final JComponent component, final boolean showAllOptions, final XBreakpoint breakpoint) {
    final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
    final XLightBreakpointPropertiesPanel propertiesPanel = new XLightBreakpointPropertiesPanel(project, breakpointManager, (XBreakpointBase) breakpoint, showAllOptions);
    final Ref<Balloon> balloonRef = Ref.create(null);
    final Ref<Boolean> isLoading = Ref.create(Boolean.FALSE);
    final Ref<Boolean> moreOptionsRequested = Ref.create(Boolean.FALSE);
    propertiesPanel.setDelegate(() -> {
        if (!isLoading.get()) {
            propertiesPanel.saveProperties();
        }
        if (!balloonRef.isNull()) {
            balloonRef.get().hide();
        }
        showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
        moreOptionsRequested.set(true);
    });
    isLoading.set(Boolean.TRUE);
    propertiesPanel.loadProperties();
    isLoading.set(Boolean.FALSE);
    if (moreOptionsRequested.get()) {
        return;
    }
    Runnable showMoreOptions = () -> {
        propertiesPanel.saveProperties();
        propertiesPanel.dispose();
        BreakpointsDialogFactory.getInstance(project).showDialog(breakpoint);
    };
    final JComponent mainPanel = propertiesPanel.getMainPanel();
    final Balloon balloon = showBreakpointEditor(project, mainPanel, point, component, showMoreOptions, breakpoint);
    balloonRef.set(balloon);
    final XBreakpointListener<XBreakpoint<?>> breakpointListener = new XBreakpointAdapter<XBreakpoint<?>>() {

        @Override
        public void breakpointRemoved(@NotNull XBreakpoint<?> removedBreakpoint) {
            if (removedBreakpoint.equals(breakpoint)) {
                balloon.hide();
            }
        }
    };
    balloon.addListener(new JBPopupListener.Adapter() {

        @Override
        public void onClosed(LightweightWindowEvent event) {
            propertiesPanel.saveProperties();
            propertiesPanel.dispose();
            breakpointManager.removeBreakpointListener(breakpointListener);
        }
    });
    breakpointManager.addBreakpointListener(breakpointListener);
    ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.findInstance().requestFocus(mainPanel, true));
}
Also used : XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) XLightBreakpointPropertiesPanel(com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel) NotNull(org.jetbrains.annotations.NotNull) XBreakpointManager(com.intellij.xdebugger.breakpoints.XBreakpointManager) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) XBreakpointAdapter(com.intellij.xdebugger.breakpoints.XBreakpointAdapter)

Aggregations

XLightBreakpointPropertiesPanel (com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel)2 Project (com.intellij.openapi.project.Project)1 XSourcePosition (com.intellij.xdebugger.XSourcePosition)1 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)1 XBreakpointAdapter (com.intellij.xdebugger.breakpoints.XBreakpointAdapter)1 XBreakpointManager (com.intellij.xdebugger.breakpoints.XBreakpointManager)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 NotNull (org.jetbrains.annotations.NotNull)1