Bug 575716 - SingleReference control only shows link text after resize
on Windows
Avoid zero-sized hyperlink by triggering an async re-layout of its
composite. It runs after the value of the hyperlink was updated and,
thus, fixes the issue.
Change-Id: I81e5a8e85c11a3b3391ccae4740f5c363d93e67b
Signed-off-by: Lucas Koehler <lkoehler@eclipsesource.com>
diff --git a/bundles/org.eclipse.emf.ecp.view.core.swt/src/org/eclipse/emf/ecp/view/internal/core/swt/renderer/LinkControlSWTRenderer.java b/bundles/org.eclipse.emf.ecp.view.core.swt/src/org/eclipse/emf/ecp/view/internal/core/swt/renderer/LinkControlSWTRenderer.java
index b672e98..db56026 100644
--- a/bundles/org.eclipse.emf.ecp.view.core.swt/src/org/eclipse/emf/ecp/view/internal/core/swt/renderer/LinkControlSWTRenderer.java
+++ b/bundles/org.eclipse.emf.ecp.view.core.swt/src/org/eclipse/emf/ecp/view/internal/core/swt/renderer/LinkControlSWTRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011-2019 EclipseSource Muenchen GmbH and others.
+ * Copyright (c) 2011-2021 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -574,6 +574,10 @@
if (stackLayout.topControl != linkComposite) {
stackLayout.topControl = linkComposite;
mainComposite.layout();
+ // At least on Windows, the hyperlink size needs to be recalculated asynchronously after its value has
+ // updated. Otherwise, the hyperlink has a size of 0 when the control is initially rendered without a
+ // value.
+ Display.getDefault().asyncExec(() -> linkComposite.layout());
}
modelElementChangeListener = new ECPModelElementChangeListener(value) {