breakpoints-ui. breakpoints popup should not disappear on cmd-tab.

This commit is contained in:
andrey.zaytsev
2012-06-29 05:12:49 +04:00
parent ec7eb3265d
commit f271247cf0
8 changed files with 56 additions and 6 deletions
@@ -58,6 +58,18 @@ public class MasterDetailPopupBuilder {
private ActionToolbar myActionToolbar;
private boolean myAddDetailViewToEast = true;
private Dimension myMinSize;
private boolean myCancelOnWindowDeactivation = true;
public String getDimensionServiceKey() {
return myDimensionServiceKey;
}
public void setDimensionServiceKey(String dimensionServiceKey) {
myDimensionServiceKey = dimensionServiceKey;
}
private String myDimensionServiceKey;
public MasterDetailPopupBuilder setDetailView(DetailView detailView) {
@@ -176,7 +188,9 @@ public class MasterDetailPopupBuilder {
setResizable(true).
setAutoselectOnMouseMove(false).
setSettingButton(toolBar).
setSouthComponent(footerPanel);
setSouthComponent(footerPanel).
setCancelOnWindowDeactivation(myCancelOnWindowDeactivation);
if (myAddDetailViewToEast) {
builder.
@@ -193,6 +207,7 @@ public class MasterDetailPopupBuilder {
setItemChoosenCallback(runnable).
setCloseOnEnter(myCloseOnEnter).
setMayBeParent(true).
setDimensionServiceKey(myDimensionServiceKey).
setFilteringEnabled(new Function<Object, String>() {
public String fun(Object o) {
return ((ItemWrapper)o).speedSearchText();
@@ -271,6 +286,11 @@ public class MasterDetailPopupBuilder {
return this;
}
public MasterDetailPopupBuilder setCancelOnWindowDeactivation(boolean cancelOnWindowDeactivation) {
myCancelOnWindowDeactivation = cancelOnWindowDeactivation;
return this;
}
public static boolean allowedToRemoveItems(Object[] values) {
for (Object value : values) {
ItemWrapper item = (ItemWrapper)value;
@@ -138,4 +138,6 @@ public interface ComponentPopupBuilder {
@NotNull
ComponentPopupBuilder setMayBeParent(boolean mayBeParent);
ComponentPopupBuilder setCancelOnWindowDeactivation(boolean cancelOnWindowDeactivation);
}
@@ -82,6 +82,8 @@ public class PopupChooserBuilder {
private int myAdAlignment = SwingUtilities.LEFT;
private boolean myModalContext;
private boolean myCloseOnEnter = true;
private boolean myCancelOnWindowDeactivation = true;
public JScrollPane getScrollPane() {
return myScrollPane;
@@ -289,7 +291,8 @@ public class PopupChooserBuilder {
.setMayBeParent(myMayBeParent)
.setLocateWithinScreenBounds(true)
.setCancelOnOtherWindowOpen(true)
.setModalContext(myModalContext);
.setModalContext(myModalContext)
.setCancelOnWindowDeactivation(myCancelOnWindowDeactivation);
if (myCommandButton != null) {
builder.setCommandButton(myCommandButton);
@@ -550,4 +553,8 @@ public class PopupChooserBuilder {
return this;
}
public PopupChooserBuilder setCancelOnWindowDeactivation(boolean cancelOnWindowDeactivation) {
myCancelOnWindowDeactivation = cancelOnWindowDeactivation;
return this;
}
}
@@ -86,6 +86,7 @@ public class AbstractPopup implements JBPopup {
private MouseChecker myCancelOnMouseOutCallback;
private Canceller myMouseOutCanceller;
private boolean myCancelOnWindow;
private boolean myCancelOnWindowDeactivation = true;
private Dimension myForcedSize;
private Point myForcedLocation;
private ChildFocusWatcher myFocusWatcher;
@@ -194,7 +195,8 @@ public class AbstractPopup implements JBPopup {
Component settingsButtons,
@Nullable final Processor<JBPopup> pinCallback,
boolean mayBeParent,
boolean showShadow) {
boolean showShadow,
boolean cancelOnWindowDeactivation) {
if (requestFocus && !focusable) {
assert false : "Incorrect argument combination: requestFocus=" + requestFocus + " focusable=" + focusable;
}
@@ -207,6 +209,7 @@ public class AbstractPopup implements JBPopup {
myPaintShadow = showShadow && !SystemInfo.isMac && !movable && !resizable && Registry.is("ide.popup.dropShadow");
myContent = createContentPanel(resizable, myPopupBorder, isToDrawMacCorner() && resizable);
myMayBeParent = mayBeParent;
myCancelOnWindowDeactivation = cancelOnWindowDeactivation;
myContent.add(component, BorderLayout.CENTER);
if (adText != null) {
@@ -1246,6 +1249,14 @@ public class AbstractPopup implements JBPopup {
return myCancelOnClickOutside;
}
public boolean isCancelOnWindowDeactivation() {
return myCancelOnWindowDeactivation;
}
public void setCancelOnWindowDeactivation(boolean cancelOnWindowDeactivation) {
myCancelOnWindowDeactivation = cancelOnWindowDeactivation;
}
private class Canceller implements AWTEventListener {
private boolean myEverEntered = false;
@@ -51,6 +51,7 @@ public class ComponentPopupBuilderImpl implements ComponentPopupBuilder {
private Computable<Boolean> myCallback = null;
private Project myProject;
private boolean myCancelOnClickOutside = true;
private boolean myCancelOnWindowDeactivation = true;
private final Set<JBPopupListener> myListeners = new LinkedHashSet<JBPopupListener>();
private boolean myUseDimServiceForXYLocation;
@@ -196,6 +197,12 @@ public class ComponentPopupBuilderImpl implements ComponentPopupBuilder {
return this;
}
@Override
public ComponentPopupBuilder setCancelOnWindowDeactivation(boolean cancelOnWindowDeactivation) {
myCancelOnWindowDeactivation = cancelOnWindowDeactivation;
return this;
}
@NotNull
public ComponentPopupBuilder setProject(Project project) {
myProject = project;
@@ -211,7 +218,7 @@ public class ComponentPopupBuilderImpl implements ComponentPopupBuilder {
myCancelOnMouseOutCallback, myCancelOnWindow, myTitleIcon, myCancelKeyEnabled, myLocateByContent,
myPlacewithinScreen, myMinSize, myAlpha, myMaskProvider, myInStack, myModalContext, myFocusOwners, myAd, myAdAlignment,
myHeaderAlwaysFocusable, myKeyboardActions, mySettingsButtons, myPinCallback, myMayBeParent,
myShowShadow);
myShowShadow, myCancelOnWindowDeactivation);
if (myUserData != null) {
popup.setUserData(myUserData);
}
@@ -210,7 +210,7 @@ public class StackingPopupDispatcherImpl extends StackingPopupDispatcher impleme
if (myStack.isEmpty()) return false;
final AbstractPopup popup = (AbstractPopup)myStack.pop();
if (popup != null && popup.isVisible()){
if (popup != null && popup.isVisible() && popup.isCancelOnWindowDeactivation()) {
popup.cancel();
return true;
}
@@ -90,7 +90,8 @@ public abstract class WizardPopup extends AbstractPopup implements ActionListene
final Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
init(project, scrollPane, getPreferredFocusableComponent(), true, true, true, true, null,
false, aStep.getTitle(), null, true, null, false, null, null, null, false, null, true, false, true, null, 0f,
null, true, false, new Component[0], null, SwingUtilities.LEFT, true, Collections.<Pair<ActionListener, KeyStroke>>emptyList(), null, null, false, true);
null, true, false, new Component[0], null, SwingUtilities.LEFT, true, Collections.<Pair<ActionListener, KeyStroke>>emptyList(), null, null, false, true,
true);
registerAction("disposeAll", KeyEvent.VK_ESCAPE, InputEvent.SHIFT_MASK, new AbstractAction() {
public void actionPerformed(ActionEvent e) {
@@ -114,6 +114,8 @@ public class BreakpointMasterDetailPopupBuilder {
public JBPopup createPopup() {
myPopupBuilder = new MasterDetailPopupBuilder(myProject);
myPopupBuilder.setDimensionServiceKey(getClass().getName());
myPopupBuilder.setCancelOnWindowDeactivation(false);
if (myDetailView != null) {
myPopupBuilder.setDetailView(myDetailView);