mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix memory leak in ToolbarActionTrackingPopup
GitOrigin-RevId: d21718da40facbd663db55f771002b11eab81464
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9a078fac63
commit
7a72ed8020
@@ -836,7 +836,8 @@ public class ComponentPanelTestAction extends DumbAwareAction {
|
||||
toolbarActions.add(new MyAction("Short", AllIcons.Ide.Rating1) {
|
||||
{
|
||||
GotItTooltip actionGotIt = new GotItTooltip("short.action", "Short action text", project).withHeader("Header");
|
||||
actionGotIt.assignTo(getTemplatePresentation(), GotItTooltip.BOTTOM_MIDDLE);
|
||||
actionGotIt.assignTo(getTemplatePresentation(),
|
||||
GotItTooltip.BOTTOM_MIDDLE, ()->{});
|
||||
}
|
||||
}.withShortCut("control K"));
|
||||
toolbarActions.add(new MyAction("Long", AllIcons.Ide.Rating2).withShortCut("control N"));
|
||||
|
||||
@@ -92,7 +92,7 @@ class GotItTooltip(@NonNls val id: String, @Nls val text: String, private val pa
|
||||
Disposer.register(parentDisposable, this)
|
||||
}
|
||||
|
||||
override fun assignTo(presentation: Presentation, pointProvider: (Component) -> Point) {
|
||||
override fun assignTo(presentation: Presentation, pointProvider: (Component) -> Point, disposeAction: Runnable?) {
|
||||
presentation.putClientProperty(PRESENTATION_GOT_IT_KEY, ActionContext(this, pointProvider))
|
||||
Disposer.register(this, Disposable { presentation.putClientProperty(PRESENTATION_GOT_IT_KEY, null) })
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.awt.event.ComponentEvent
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.event.AncestorEvent
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
import java.util.function.Consumer
|
||||
|
||||
|
||||
@Experimental
|
||||
@@ -73,7 +74,7 @@ abstract class ToolbarActionTracker: Disposable {
|
||||
* the tooltip if it can be shown. Term "follow" is used because ActionToolbar updates its content and ActionButton's
|
||||
* showing status / location may change in time.
|
||||
*/
|
||||
abstract fun assignTo(presentation: Presentation, pointProvider: (Component) -> Point)
|
||||
abstract fun assignTo(presentation: Presentation, pointProvider: (Component) -> Point, disposeAction: Runnable? = null)
|
||||
|
||||
abstract fun wasCreated(): Boolean
|
||||
|
||||
|
||||
Reference in New Issue
Block a user