mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixe for IDEA-229234 Window header is displayed in "Find in Path" dialog
GitOrigin-RevId: e48211b86996679b9229755314359bc1ea73c328
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a1c8e561a7
commit
54142b6c5e
@@ -154,7 +154,7 @@ public class FrameWrapper implements Disposable, DataProvider {
|
||||
if (myCloseOnEsc) addCloseOnEsc((RootPaneContainer)frame);
|
||||
|
||||
if (IdeFrameDecorator.isCustomDecorationActive()) {
|
||||
myComponent = CustomFrameDialogContent.getContent(frame, myComponent);
|
||||
myComponent = CustomFrameDialogContent.getCustomContentHolder(frame, myComponent);
|
||||
}
|
||||
|
||||
((RootPaneContainer)frame).getContentPane().add(myComponent, BorderLayout.CENTER);
|
||||
|
||||
@@ -387,6 +387,11 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer {
|
||||
UIUtil.setCustomTitleBar(window, rootPane, runnable -> Disposer.register(myWrapper.getDisposable(), () -> runnable.run()));
|
||||
}
|
||||
|
||||
Container contentPane = getContentPane();
|
||||
if(contentPane instanceof CustomFrameDialogContent) {
|
||||
((CustomFrameDialogContent)contentPane).updateLayout();
|
||||
}
|
||||
|
||||
anCancelAction.registerCustomShortcutSet(CommonShortcuts.ESCAPE, rootPane);
|
||||
myDisposeActions.add(() -> anCancelAction.unregisterCustomShortcutSet(rootPane));
|
||||
|
||||
@@ -987,7 +992,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer {
|
||||
public void setContentPane(JComponent content) {
|
||||
JComponent wrappedContent =
|
||||
IdeFrameDecorator.isCustomDecorationActive() && !isHeadlessEnv()
|
||||
? CustomFrameDialogContent.getContent(getWindow(), content)
|
||||
? CustomFrameDialogContent.getCustomContentHolder(getWindow(), content)
|
||||
: content;
|
||||
|
||||
myDialog.setContentPane(wrappedContent);
|
||||
|
||||
+13
-29
@@ -7,21 +7,16 @@ import java.awt.Container
|
||||
import java.awt.Window
|
||||
import javax.swing.*
|
||||
|
||||
class CustomFrameDialogContent private constructor(window: Window, content: Container, titleBackgroundColor: Color? = null): CustomFrameViewHolder {
|
||||
class CustomFrameDialogContent private constructor(val window: Window, content: Container, titleBackgroundColor: Color? = null): JPanel() {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getContent(window: Window, content: JComponent) = getContent(window, content, null)
|
||||
fun getCustomContentHolder(window: Window, content: JComponent) = getCustomContentHolder(window, content, null)
|
||||
|
||||
@JvmStatic
|
||||
fun getContent(window: Window, content: JComponent, titleBackgroundColor: Color? = null): JComponent {
|
||||
return getCustomContentHolder(window, content, titleBackgroundColor).content
|
||||
}
|
||||
fun getCustomContentHolder(window: Window, content: JComponent, titleBackgroundColor: Color? = null): JComponent {
|
||||
if (content is CustomFrameDialogContent) return content
|
||||
|
||||
@JvmStatic
|
||||
fun getCustomContentHolder(window: Window, content: JComponent, titleBackgroundColor: Color? = null): CustomFrameViewHolder {
|
||||
if(content is CustomFrameViewHolder) return content
|
||||
|
||||
val rootPane: JRootPane? = when (window) {
|
||||
when (window) {
|
||||
is JWindow -> window.rootPane
|
||||
is JDialog -> {
|
||||
if (window.isUndecorated) null
|
||||
@@ -29,39 +24,28 @@ class CustomFrameDialogContent private constructor(window: Window, content: Cont
|
||||
}
|
||||
is JFrame -> window.rootPane
|
||||
else -> null
|
||||
}
|
||||
|
||||
rootPane ?: return object : CustomFrameViewHolder {
|
||||
override val content: JComponent
|
||||
get() = content
|
||||
override val headerHeight: Int
|
||||
get() = 0
|
||||
}
|
||||
} ?: return content
|
||||
|
||||
return CustomFrameDialogContent(window, content, titleBackgroundColor)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private val panel = JPanel(MigLayout("novisualpadding, ins 0, gap 0, fill, flowy", "", "[min!][]"))
|
||||
private val header: CustomHeader = CustomHeader.create(window)
|
||||
|
||||
init {
|
||||
layout = MigLayout("novisualpadding, ins 0, gap 0, fill, flowy, hidemode 2", "", "[min!][]")
|
||||
titleBackgroundColor?.let {
|
||||
header.background = it
|
||||
}
|
||||
|
||||
panel.add(header, "growx, wmin 100")
|
||||
panel.add(content, "grow")
|
||||
add(header, "growx, wmin 100")
|
||||
add(content, "grow")
|
||||
}
|
||||
|
||||
override val content: JComponent
|
||||
get() = panel
|
||||
override val headerHeight: Int
|
||||
get() = header.preferredSize.height
|
||||
}
|
||||
fun updateLayout() {
|
||||
if(window is JDialog && window.isUndecorated) header.isVisible = false
|
||||
}
|
||||
|
||||
interface CustomFrameViewHolder {
|
||||
val content: JComponent
|
||||
val headerHeight: Int
|
||||
get() = if(header.isVisible) header.preferredSize.height else 0
|
||||
}
|
||||
|
||||
+4
-4
@@ -37,7 +37,6 @@ import com.intellij.openapi.wm.impl.IdeFrameDecorator;
|
||||
import com.intellij.openapi.wm.impl.IdeGlassPaneImpl;
|
||||
import com.intellij.openapi.wm.impl.ProjectFrameHelper;
|
||||
import com.intellij.openapi.wm.impl.customFrameDecorations.header.CustomFrameDialogContent;
|
||||
import com.intellij.openapi.wm.impl.customFrameDecorations.header.CustomFrameViewHolder;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.border.CustomLineBorder;
|
||||
import com.intellij.ui.components.JBList;
|
||||
@@ -109,11 +108,12 @@ public class FlatWelcomeFrame extends JFrame implements IdeFrame, Disposable, Ac
|
||||
|
||||
int defaultHeight = DEFAULT_HEIGHT;
|
||||
if (IdeFrameDecorator.isCustomDecorationActive()) {
|
||||
CustomFrameViewHolder holder =
|
||||
JComponent holder =
|
||||
CustomFrameDialogContent.getCustomContentHolder(this, myScreen.getWelcomePanel(), UIManager.getColor("WelcomeScreen.background"));
|
||||
setContentPane(holder.getContent());
|
||||
setContentPane(holder);
|
||||
|
||||
defaultHeight+=holder.getHeaderHeight();
|
||||
if(holder instanceof CustomFrameDialogContent)
|
||||
defaultHeight+= ((CustomFrameDialogContent)holder).getHeaderHeight();
|
||||
}
|
||||
else {
|
||||
setContentPane(myScreen.getWelcomePanel());
|
||||
|
||||
Reference in New Issue
Block a user