mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[ui] Allow painting any content as background for component
GitOrigin-RevId: 96c9b865ed72b125bb2fef009514da4a44e84290
This commit is contained in:
committed by
intellij-monorepo-bot
parent
794ebfdcb7
commit
c452f718f8
@@ -245,6 +245,8 @@ f:com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl
|
||||
- *s:setOfflineByDefault(com.intellij.openapi.vfs.VirtualFile,Z):V
|
||||
a:com.intellij.openapi.wm.impl.FrameTitleBuilder
|
||||
- *:getFileTitleAsync(com.intellij.openapi.project.Project,com.intellij.openapi.vfs.VirtualFile,kotlin.coroutines.Continuation):java.lang.Object
|
||||
f:com.intellij.openapi.wm.impl.IdeBackgroundUtil
|
||||
- *s:createTemporaryBackgroundTransform(javax.swing.JComponent,com.intellij.openapi.ui.Painter,com.intellij.openapi.Disposable):V
|
||||
f:com.intellij.openapi.wm.impl.content.ToolWindowContentUi
|
||||
- com.intellij.openapi.actionSystem.UiCompatibleDataProvider
|
||||
- com.intellij.ui.content.ContentUI
|
||||
|
||||
@@ -215,9 +215,12 @@ open class StartupManagerImpl(private val project: Project, private val coroutin
|
||||
&& pluginId.idString != "com.intellij.clion.plugin"
|
||||
&& pluginId.idString != "com.jetbrains.codeWithMe"
|
||||
&& pluginId.idString != "intellij.rider.plugins.cwm"
|
||||
&& pluginId.idString != "org.jetbrains.plugins.clion.radler") {
|
||||
LOG.error("Only bundled plugin can define ${extensionPoint.name}: ${adapter.pluginDescriptor}")
|
||||
continue
|
||||
&& pluginId.idString != "org.jetbrains.plugins.clion.radler"
|
||||
) {
|
||||
if (!(pluginId.idString == "com.intellij.ml.llm" && adapter.assignableToClassName.endsWith("XNextRootPaneCustomizer"))) {
|
||||
LOG.error("Only bundled plugin can define ${extensionPoint.name}: ${adapter.pluginDescriptor}")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
val activity = adapter.createInstance<InitProjectActivity>(project) ?: continue
|
||||
|
||||
+2
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.application.impl
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.fileEditor.impl.EditorTabPainterAdapter
|
||||
import com.intellij.openapi.ui.Divider
|
||||
@@ -49,6 +50,7 @@ open class InternalUICustomization {
|
||||
|
||||
open fun createCustomDivider(isVertical: Boolean, splitter: Splittable): Divider? = null
|
||||
|
||||
open fun attachBackgroundGradient(component: JComponent, disposable: Disposable): Unit = Unit
|
||||
|
||||
open fun getToolWindowsPaneThreeSplitterBackground(): Color = JBColor.GRAY
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter;
|
||||
import com.intellij.openapi.fileEditor.impl.EditorsSplitters;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.AbstractPainter;
|
||||
import com.intellij.openapi.ui.Painter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.Strings;
|
||||
@@ -154,6 +155,39 @@ public final class IdeBackgroundUtil {
|
||||
createTemporaryBackgroundTransform(root, paintersHelper, disposable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows painting anything as a background for component and its children
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static void createTemporaryBackgroundTransform(JComponent root,
|
||||
Painter painter,
|
||||
Disposable disposable) {
|
||||
PainterHelper paintersHelper = new PainterHelper(root);
|
||||
// In order not to expose MyGraphics class, we need to have a delegate that unwraps MyGraphics to Graphics2D
|
||||
paintersHelper.addPainter(new Painter() {
|
||||
@Override
|
||||
public boolean needsRepaint() {
|
||||
return painter.needsRepaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Component component, Graphics2D g) {
|
||||
painter.paint(component, MyGraphics.unwrap(g));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(@NotNull Listener listener) {
|
||||
painter.addListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(Listener listener) {
|
||||
painter.removeListener(listener);
|
||||
}
|
||||
}, root);
|
||||
createTemporaryBackgroundTransform(root, paintersHelper, disposable);
|
||||
}
|
||||
|
||||
private static void createTemporaryBackgroundTransform(JComponent root, PainterHelper painterHelper, Disposable disposable) {
|
||||
Disposer.register(disposable, JBSwingUtilities.addGlobalCGTransform((c, g) -> {
|
||||
if (!UIUtil.isAncestor(root, c)) {
|
||||
|
||||
Reference in New Issue
Block a user