mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RunnerLayout: focus attraction applied for minimized view caused invalid selection state in ContentManager - debugger views stopped to update
This commit is contained in:
@@ -60,6 +60,7 @@ public interface RunnerLayoutUi {
|
||||
Content findContent(@NotNull String contentId);
|
||||
|
||||
ActionCallback selectAndFocus(@Nullable Content content, boolean requestFocus, final boolean forced);
|
||||
ActionCallback selectAndFocus(@Nullable Content content, boolean requestFocus, final boolean forced, final boolean implicit);
|
||||
|
||||
RunnerLayoutUi addListener(@NotNull ContentManagerListener listener, @NotNull Disposable parent);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class LayoutAttractionPolicy {
|
||||
public void attract(final Content content, final RunnerLayoutUi ui) {
|
||||
if (!myWasAttracted) {
|
||||
myWasAttracted = true;
|
||||
ui.selectAndFocus(content, myRequestFocus, true);
|
||||
ui.selectAndFocus(content, myRequestFocus, true, true);
|
||||
} else {
|
||||
ui.setBouncing(content, true);
|
||||
}
|
||||
|
||||
@@ -236,6 +236,10 @@ public class GridCellImpl implements GridCell, Disposable {
|
||||
updatePresentation(myTabs.findInfo(content), content);
|
||||
}
|
||||
|
||||
public boolean isMinimized(Content content) {
|
||||
return myMinimizedContents.contains(content);
|
||||
}
|
||||
|
||||
private static class ProviderWrapper extends NonOpaquePanel implements DataProvider {
|
||||
|
||||
Content myContent;
|
||||
|
||||
@@ -218,6 +218,10 @@ public class GridImpl extends Wrapper implements Grid, Disposable, CellTransform
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMinimized(Content content) {
|
||||
return getCellFor(content).isMinimized(content);
|
||||
}
|
||||
|
||||
static class Placeholder extends Wrapper implements NullableComponent {
|
||||
|
||||
private JComponent myContent;
|
||||
|
||||
@@ -604,6 +604,17 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canChangeSelectionTo(Content content, boolean implicit) {
|
||||
if (implicit) {
|
||||
GridImpl grid = getGridFor(content, false);
|
||||
if (grid != null) {
|
||||
return !grid.isMinimized(content);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
||||
}
|
||||
|
||||
+5
-1
@@ -159,9 +159,13 @@ public class RunnerLayoutUiImpl implements Disposable, RunnerLayoutUi, LayoutSta
|
||||
}
|
||||
|
||||
public ActionCallback selectAndFocus(@Nullable final Content content, boolean requestFocus, final boolean forced) {
|
||||
return selectAndFocus(content, requestFocus, forced, false);
|
||||
}
|
||||
|
||||
public ActionCallback selectAndFocus(@Nullable final Content content, boolean requestFocus, final boolean forced, boolean implicit) {
|
||||
if (content == null) return new ActionCallback.Rejected();
|
||||
|
||||
return getContentManager().setSelectedContentCB(content, requestFocus || shouldRequestFocus(), forced);
|
||||
return getContentManager().setSelectedContent(content, requestFocus || shouldRequestFocus(), forced, implicit);
|
||||
}
|
||||
|
||||
private boolean shouldRequestFocus() {
|
||||
|
||||
@@ -44,6 +44,8 @@ public interface ContentManager extends Disposable {
|
||||
void setSelectedContent(@NotNull Content content, boolean requestFocus, boolean forcedFocus);
|
||||
ActionCallback setSelectedContentCB(@NotNull Content content, boolean requestFocus, boolean forcedFocus);
|
||||
|
||||
ActionCallback setSelectedContent(@NotNull Content content, boolean requestFocus, boolean forcedFocus, boolean implicit);
|
||||
|
||||
void addSelectedContent(@NotNull Content content);
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -28,4 +28,6 @@ public interface ContentUI extends Disposable {
|
||||
boolean canBeEmptySelection();
|
||||
|
||||
void beforeDispose();
|
||||
|
||||
boolean canChangeSelectionTo(Content content, boolean implicit);
|
||||
}
|
||||
|
||||
+4
@@ -217,6 +217,10 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx {
|
||||
return new ActionCallback.Done();
|
||||
}
|
||||
|
||||
public ActionCallback setSelectedContent(@NotNull Content content, boolean requestFocus, boolean forcedFocus, boolean implicit) {
|
||||
return new ActionCallback.Done();
|
||||
}
|
||||
|
||||
public ActionCallback requestFocus(@Nullable final Content content, final boolean forced) {
|
||||
return new ActionCallback.Done();
|
||||
}
|
||||
|
||||
+4
@@ -236,6 +236,10 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
|
||||
public void beforeDispose() {
|
||||
}
|
||||
|
||||
public boolean canChangeSelectionTo(Content content, boolean implicit) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void initMouseListeners(final JComponent c, final ToolWindowContentUi ui) {
|
||||
if (c.getClientProperty(ui) != null) return;
|
||||
|
||||
|
||||
@@ -320,6 +320,10 @@ public class TabbedPaneContentUI implements ContentUI, PropertyChangeListener {
|
||||
public void beforeDispose() {
|
||||
}
|
||||
|
||||
public boolean canChangeSelectionTo(Content content, boolean implicit) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
}
|
||||
|
||||
public void addSelectedContent(@NotNull final Content content) {
|
||||
if (!checkSelectionChangeShouldBeProcessed(content)) return;
|
||||
if (!checkSelectionChangeShouldBeProcessed(content, false)) return;
|
||||
|
||||
if (getIndexOfContent(content) == -1) {
|
||||
throw new IllegalArgumentException("content not found: " + content);
|
||||
@@ -320,9 +320,14 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkSelectionChangeShouldBeProcessed(Content content) {
|
||||
private boolean checkSelectionChangeShouldBeProcessed(Content content, boolean implicit) {
|
||||
if (!myUI.canChangeSelectionTo(content, implicit)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean result = !isSelected(content) || myContentWithChangedComponent.contains(content);
|
||||
myContentWithChangedComponent.remove(content);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -359,11 +364,17 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
}
|
||||
|
||||
public ActionCallback setSelectedContentCB(@NotNull final Content content, final boolean requestFocus, final boolean forcedFocus) {
|
||||
return setSelectedContent(content, requestFocus, forcedFocus, false);
|
||||
}
|
||||
|
||||
public ActionCallback setSelectedContent(@NotNull final Content content, final boolean requestFocus, final boolean forcedFocus, boolean implicit) {
|
||||
if (isSelected(content) && requestFocus) {
|
||||
return requestFocus(content, forcedFocus);
|
||||
}
|
||||
|
||||
if (!checkSelectionChangeShouldBeProcessed(content)) return new ActionCallback.Rejected();
|
||||
if (!checkSelectionChangeShouldBeProcessed(content, implicit)) {
|
||||
return new ActionCallback.Rejected();
|
||||
}
|
||||
if (!myContents.contains(content)) {
|
||||
throw new IllegalArgumentException("Cannot find content:" + content.getDisplayName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user