ensure breakpoints dialog is visible on shortcut - IDEA-189504

This commit is contained in:
Egor Ushakov
2018-05-29 18:31:28 +03:00
parent 22b39e2557
commit 5ecb84823e
3 changed files with 24 additions and 35 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -38,7 +38,9 @@ public abstract class EditBreakpointActionHandler extends DebuggerActionHandler
}
public void editBreakpoint(@NotNull Project project, @NotNull Editor editor, @NotNull Object breakpoint, @NotNull GutterIconRenderer breakpointGutterRenderer) {
if (BreakpointsDialogFactory.getInstance(project).isBreakpointPopupShowing()) return;
if (BreakpointsDialogFactory.getInstance(project).popupRequested(breakpoint)) {
return;
}
EditorGutterComponentEx gutterComponent = ((EditorEx)editor).getGutterComponentEx();
Point point = gutterComponent.getCenterPoint(breakpointGutterRenderer);
if (point == null) { // disabled gutter icons for example
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.breakpoints.ui;
import com.intellij.icons.AllIcons;
@@ -451,7 +437,13 @@ public class BreakpointsDialog extends DialogWrapper {
}
}
private boolean selectBreakpoint(Object breakpoint) {
@Override
public void toFront() {
getWindow().setBounds(getWindow().getBounds()); // will fo fit to screen
super.toFront();
}
public boolean selectBreakpoint(Object breakpoint) {
if (breakpoint != null) {
for (BreakpointItem item : myBreakpointItems) {
if (item.getBreakpoint() == breakpoint) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.breakpoints.ui;
import com.intellij.openapi.Disposable;
@@ -53,12 +39,21 @@ public class BreakpointsDialogFactory {
return ServiceManager.getService(project, BreakpointsDialogFactory.class);
}
public boolean isBreakpointPopupShowing() {
return (myBalloonToHide != null && !myBalloonToHide.isDisposed()) || myDialogShowing != null;
public boolean popupRequested(Object breakpoint) {
if (myBalloonToHide != null && !myBalloonToHide.isDisposed()) {
return true;
}
if (myDialogShowing != null) {
myDialogShowing.selectBreakpoint(breakpoint);
myDialogShowing.toFront();
return true;
}
return false;
}
public void showDialog(@Nullable Object initialBreakpoint) {
if (myDialogShowing != null) {
myDialogShowing.toFront();
return;
}