mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
breakpoints ui. View Breakpoints action invoked instead of expanding balloon with more controls
This commit is contained in:
+12
-7
@@ -32,8 +32,10 @@ import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.impl.actions.EditBreakpointActionHandler;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsMasterDetailPopupFactory;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -49,7 +51,7 @@ import java.awt.*;
|
||||
*/
|
||||
public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler {
|
||||
@Override
|
||||
protected void doShowPopup(Project project, final EditorGutterComponentEx gutterComponent, final Point whereToShow, Object breakpoint) {
|
||||
protected void doShowPopup(final Project project, final EditorGutterComponentEx gutterComponent, final Point whereToShow, Object breakpoint) {
|
||||
if (!(breakpoint instanceof BreakpointWithHighlighter)) return;
|
||||
|
||||
final BreakpointWithHighlighter javaBreakpoint = (BreakpointWithHighlighter)breakpoint;
|
||||
@@ -88,13 +90,16 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler
|
||||
final Runnable showMoreOptions = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
propertiesPanel.setMoreOptionsVisible(true);
|
||||
final Balloon newBalloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, null);
|
||||
newBalloon.addListener(saveOnClose);
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BreakpointsMasterDetailPopupFactory.
|
||||
getInstance(project).createPopup(javaBreakpoint).showCenteredInCurrentWindow(project);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent,
|
||||
propertiesPanel.isMoreOptionsVisible() ? null : showMoreOptions);
|
||||
final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(project, mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
|
||||
balloon.addListener(saveOnClose);
|
||||
|
||||
propertiesPanel.setDelegate(new BreakpointPropertiesPanel.Delegate() {
|
||||
@@ -103,7 +108,7 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler
|
||||
propertiesPanel.setActionsPanelVisible(true);
|
||||
balloon.hide();
|
||||
final Balloon newBalloon =
|
||||
DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
|
||||
DebuggerUIUtil.showBreakpointEditor(project, mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
|
||||
newBalloon.addListener(saveOnClose);
|
||||
}
|
||||
});
|
||||
|
||||
+14
-12
@@ -87,8 +87,8 @@ public class BreakpointItemsTree extends CheckboxTree {
|
||||
}
|
||||
//TreeUtil.sort(myRoot, myComparator);
|
||||
((DefaultTreeModel)getModel()).nodeStructureChanged(myRoot);
|
||||
expandPath(new TreePath(myRoot));
|
||||
state.applyTo(this, myRoot);
|
||||
TreeUtil.expandAll(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,23 +114,25 @@ public class BreakpointItemsTree extends CheckboxTree {
|
||||
groups = Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
Collection<XBreakpointGroup> filtered = new ArrayList<XBreakpointGroup>();
|
||||
for (XBreakpointGroup group : groups) {
|
||||
TreeNode parent = myGroupNodes.get(group).getParent();
|
||||
if ((parentGroup == null && parent == myRoot) || ((BreakpointsGroupNode)parent).getGroup() == parentGroup) {
|
||||
filtered.add(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XBreakpointGroup group = groupingRule.getGroup(breakpoint.getBreakpoint(), filtered);
|
||||
XBreakpointGroup group = groupingRule.getGroup(breakpoint.getBreakpoint(), filterByParent(parentGroup, groups));
|
||||
if (group != null) {
|
||||
myGroups.put(groupingRule, group);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
private Collection<XBreakpointGroup> filterByParent(XBreakpointGroup parentGroup, Collection<XBreakpointGroup> groups) {
|
||||
Collection<XBreakpointGroup> filtered = new ArrayList<XBreakpointGroup>();
|
||||
for (XBreakpointGroup group : groups) {
|
||||
TreeNode parentNode = myGroupNodes.get(group).getParent();
|
||||
BreakpointsGroupNode parent = parentNode instanceof BreakpointsGroupNode ? (BreakpointsGroupNode)parentNode : null;
|
||||
if ((parentGroup == null && parentNode == myRoot) || (parent != null && parent.getGroup() == parentGroup)) {
|
||||
filtered.add(group);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
private <G extends XBreakpointGroup> BreakpointsGroupNode<G> getOrCreateGroupNode(CheckedTreeNode parent, final G group,
|
||||
final int level) {
|
||||
//noinspection unchecked
|
||||
|
||||
+24
-6
@@ -15,23 +15,25 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.ui.popup.util.MasterDetailPopupBuilder;
|
||||
import com.intellij.xdebugger.breakpoints.ui.BreakpointItem;
|
||||
import com.intellij.openapi.ui.popup.JBPopupListener;
|
||||
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.xdebugger.impl.DebuggerSupport;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class BreakpointsMasterDetailPopupFactory {
|
||||
|
||||
private final List<BreakpointPanelProvider> myBreakpointPanelProviders;
|
||||
private Project myProject;
|
||||
private Balloon myBalloonToHide;
|
||||
|
||||
public BreakpointsMasterDetailPopupFactory(Project project) {
|
||||
myProject = project;
|
||||
@@ -47,6 +49,10 @@ public class BreakpointsMasterDetailPopupFactory {
|
||||
});
|
||||
}
|
||||
|
||||
public void setBalloonToHide(Balloon balloonToHide) {
|
||||
myBalloonToHide = balloonToHide;
|
||||
}
|
||||
|
||||
public static BreakpointsMasterDetailPopupFactory getInstance(Project project) {
|
||||
return ServiceManager.getService(project, BreakpointsMasterDetailPopupFactory.class);
|
||||
}
|
||||
@@ -55,6 +61,18 @@ public class BreakpointsMasterDetailPopupFactory {
|
||||
BreakpointMasterDetailPopupBuilder builder = new BreakpointMasterDetailPopupBuilder(myProject);
|
||||
builder.setInitialBreakpoint(initialBreakpoint);
|
||||
builder.setBreakpointsPanelProviders(myBreakpointPanelProviders);
|
||||
return builder.createPopup();
|
||||
final JBPopup popup = builder.createPopup();
|
||||
popup.addListener(new JBPopupListener() {
|
||||
@Override
|
||||
public void beforeShown(LightweightWindowEvent event) {
|
||||
myBalloonToHide.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed(LightweightWindowEvent event) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
});
|
||||
return popup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BreakpointEditor {
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
myShowMoreOptionsLink = new LinkLabel("More Options", null, new LinkListener() {
|
||||
myShowMoreOptionsLink = new LinkLabel("View Breakpoints...", null, new LinkListener() {
|
||||
@Override
|
||||
public void linkSelected(LinkLabel aSource, Object aLinkData) {
|
||||
if (myDelegate != null) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.ui.popup.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.DimensionService;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
@@ -33,6 +34,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointListener;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsMasterDetailPopupFactory;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -168,17 +170,44 @@ public class DebuggerUIUtil {
|
||||
final XLightBreakpointPropertiesPanel propertiesPanel =
|
||||
new XLightBreakpointPropertiesPanel(project, breakpointManager,
|
||||
breakpoint, showAllOptions);
|
||||
|
||||
final Ref<Balloon> balloonRef = Ref.create(null);
|
||||
final Ref<Boolean> isLoading = Ref.create(Boolean.FALSE);
|
||||
|
||||
propertiesPanel.setDelegate(new XLightBreakpointPropertiesPanel.Delegate() {
|
||||
@Override
|
||||
public void showMoreOptions() {
|
||||
if (!isLoading.get()) {
|
||||
propertiesPanel.saveProperties();
|
||||
}
|
||||
if (!balloonRef.isNull()) {
|
||||
balloonRef.get().hide();
|
||||
}
|
||||
showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
isLoading.set(Boolean.TRUE);
|
||||
propertiesPanel.loadProperties();
|
||||
isLoading.set(Boolean.FALSE);
|
||||
|
||||
final JComponent mainPanel = propertiesPanel.getMainPanel();
|
||||
|
||||
final Runnable showMoreOptions = new Runnable() {
|
||||
final Runnable viewBreakpoints = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
propertiesPanel.saveProperties();
|
||||
showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
//showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
BreakpointsMasterDetailPopupFactory.
|
||||
getInstance(project).createPopup(breakpoint).showCenteredInCurrentWindow(project);
|
||||
}
|
||||
};
|
||||
final Balloon balloon = showBreakpointEditor(mainPanel, breakpoint.getType().getDisplayText(breakpoint), point, component, propertiesPanel.showMoreOptions() ? showMoreOptions : null);
|
||||
|
||||
final Balloon balloon = showBreakpointEditor(project, mainPanel, breakpoint.getType().getDisplayText(breakpoint), point, component, viewBreakpoints);
|
||||
balloonRef.set(balloon);
|
||||
|
||||
|
||||
final XBreakpointListener<XBreakpoint<?>> breakpointListener = new XBreakpointListener<XBreakpoint<?>>() {
|
||||
@Override
|
||||
public void breakpointAdded(@NotNull XBreakpoint<?> breakpoint1) {
|
||||
@@ -208,14 +237,7 @@ public class DebuggerUIUtil {
|
||||
}
|
||||
});
|
||||
|
||||
propertiesPanel.setDelegate(new XLightBreakpointPropertiesPanel.Delegate() {
|
||||
@Override
|
||||
public void showMoreOptions() {
|
||||
propertiesPanel.saveProperties();
|
||||
balloon.hide();
|
||||
showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (point == null) {
|
||||
@@ -233,14 +255,14 @@ public class DebuggerUIUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static Balloon showBreakpointEditor(final JComponent mainPanel,
|
||||
public static Balloon showBreakpointEditor(Project project, final JComponent mainPanel,
|
||||
final String displayName,
|
||||
final Point whereToShow,
|
||||
final JComponent component,
|
||||
@Nullable final Runnable showMoreOptions) {
|
||||
final BreakpointEditor editor = new BreakpointEditor();
|
||||
editor.setPropertiesPanel(mainPanel);
|
||||
editor.setShowMoreOptionsLink(showMoreOptions != null);
|
||||
editor.setShowMoreOptionsLink(true);
|
||||
|
||||
final Balloon balloon = JBPopupFactory.getInstance()
|
||||
.createDialogBalloonBuilder(editor.getMainPanel(), null)
|
||||
@@ -250,6 +272,7 @@ public class DebuggerUIUtil {
|
||||
.setBlockClicksThroughBalloon(true)
|
||||
.createBalloon();
|
||||
|
||||
|
||||
editor.setDelegate(new BreakpointEditor.Delegate() {
|
||||
@Override
|
||||
public void done() {
|
||||
@@ -271,6 +294,8 @@ public class DebuggerUIUtil {
|
||||
balloon.show(new RelativePoint(component, whereToShow), Balloon.Position.below);
|
||||
}
|
||||
|
||||
BreakpointsMasterDetailPopupFactory.getInstance(project).setBalloonToHide(balloon);
|
||||
|
||||
return balloon;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user