Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMélanie Bats2017-05-15 15:13:42 +0000
committerMélanie Bats2017-05-15 15:13:42 +0000
commitfa97365035e7beaa4aaa2ff67b3eabeaf9e472ca (patch)
treeda5ca543760d70a5dcc24911d422321f7b79f002
parentd22737f6ef4cf5fc710213099ac1ebda3afede0e (diff)
downloadorg.eclipse.eef-fa97365035e7beaa4aaa2ff67b3eabeaf9e472ca.tar.gz
org.eclipse.eef-fa97365035e7beaa4aaa2ff67b3eabeaf9e472ca.tar.xz
org.eclipse.eef-fa97365035e7beaa4aaa2ff67b3eabeaf9e472ca.zip
[516667] Remove extra space after hyperlink
Bug: 516667 Change-Id: I4098079a4b0fce194e11e7a81014e521d4fee88a Signed-off-by: Mélanie Bats <melanie.bats@obeo.fr>
-rw-r--r--plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFHyperlinkLifecycleManager.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFHyperlinkLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFHyperlinkLifecycleManager.java
index e92305f18..5d80ce133 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFHyperlinkLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFHyperlinkLifecycleManager.java
@@ -12,6 +12,7 @@ package org.eclipse.eef.ide.ui.internal.widgets;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.eef.EEFHyperlinkDescription;
@@ -103,10 +104,17 @@ public class EEFHyperlinkLifecycleManager extends AbstractEEFWidgetLifecycleMana
* @see org.eclipse.eef.ide.ui.api.widgets.AbstractEEFWidgetLifecycleManager#createMainControl(org.eclipse.swt.widgets.Composite,
* org.eclipse.eef.common.ui.api.IEEFFormContainer)
*/
+ @SuppressWarnings("boxing")
@Override
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) {
this.widgetFactory = formContainer.getWidgetFactory();
+ // if there is no actions defined the hyperlink does not need to grab all the horizontal space
+ if (this.description.getActions().size() == 0) {
+ Optional.ofNullable(parent.getLayoutData()).filter(GridData.class::isInstance).map(GridData.class::cast)
+ .map(gridData -> gridData.grabExcessHorizontalSpace = false);
+ }
+
// this is the parent composite
Composite hyperlinkComposite = this.widgetFactory.createFlatFormComposite(parent);
GridLayout layout = new GridLayout(2, false);
@@ -115,8 +123,9 @@ public class EEFHyperlinkLifecycleManager extends AbstractEEFWidgetLifecycleMana
layout.marginRight = 5;
hyperlinkComposite.setLayout(layout);
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
hyperlinkComposite.setLayoutData(gridData);
+ gridData.grabExcessHorizontalSpace = false;
this.createHyperlink(hyperlinkComposite);
this.createWidgetActionButtons(hyperlinkComposite);
@@ -133,7 +142,7 @@ public class EEFHyperlinkLifecycleManager extends AbstractEEFWidgetLifecycleMana
*/
private void createHyperlink(Composite parent) {
this.hyperlink = widgetFactory.createStyledText(parent, SWT.READ_ONLY);
- GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
gridData.horizontalIndent = VALIDATION_MARKER_OFFSET;
this.hyperlink.setLayoutData(gridData);
this.hyperlink.setEditable(false);

Back to the top