From 860ce7f41303e102ba4715af02ea709a3d426145 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Tue, 5 May 2026 18:24:04 +0200 Subject: [PATCH] Avoid reconciler livelock if design page is shown on startup When the Java editor is activated for the first time, the reconciler is notified. Until this operation has finished, the editor will explicitly lock for several seconds. The GEF editor is initialized within this phase, which causes the editor to block over and over again. Run the initialization asynchronously to make sure that the reconciler has finished by then. See https://bugs.eclipse.org/366048 --- .../wb/internal/core/editor/multi/DesignerEditor.java | 8 ++++++-- .../eclipse/wb/internal/core/editor/multi/MultiMode.java | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/DesignerEditor.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/DesignerEditor.java index 297af0b563..651bcd2ea2 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/DesignerEditor.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/DesignerEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2024 Google, Inc. + * Copyright (c) 2011, 2026 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -138,7 +138,11 @@ private boolean canDesignInput() { void activated() { if (m_firstActivation) { m_firstActivation = false; - m_multiMode.editorActivatedFirstTime(); + getRootControl().getDisplay().asyncExec(() -> { + if (!m_multiMode.isDisposed()) { + m_multiMode.editorActivatedFirstTime(); + } + }); } } diff --git a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/MultiMode.java b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/MultiMode.java index 5c5c092156..13add79c7d 100644 --- a/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/MultiMode.java +++ b/org.eclipse.wb.core.java/src/org/eclipse/wb/internal/core/editor/multi/MultiMode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Google, Inc. + * Copyright (c) 2011, 2026 Google, Inc. and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -35,6 +35,7 @@ public abstract class MultiMode implements IMultiMode { protected final SourcePage m_sourcePage; protected final DesignPage m_designPage; protected final List m_additionalPages = new ArrayList<>(); + private boolean m_disposed; //////////////////////////////////////////////////////////////////////////// // @@ -136,6 +137,7 @@ void create(Composite parent) { * Disposes this {@link MultiMode}. */ void dispose() { + m_disposed = true; m_sourcePage.dispose(); m_designPage.dispose(); for (IEditorPage page : m_additionalPages) { @@ -143,6 +145,10 @@ void dispose() { } } + boolean isDisposed() { + return m_disposed; + } + /** * Notifies that {@link DesignerEditor} has now new input, so new {@link ICompilationUnit} to * parse.