diff --git a/doc/org.eclipse.eef.documentation/pages/releasenotes.html b/doc/org.eclipse.eef.documentation/pages/releasenotes.html
index 754590daf..04d8b264e 100644
--- a/doc/org.eclipse.eef.documentation/pages/releasenotes.html
+++ b/doc/org.eclipse.eef.documentation/pages/releasenotes.html
@@ -2,8 +2,6 @@
- releasenotes
-
Release Notes for Eclipse EEF
@@ -11,6 +9,9 @@ Release Notes for Eclipse EEF
Release Notes for Eclipse EEF
+
+ Changes in EEF 2.1.7
+
Changes in EEF 2.1.1
@@ -60,6 +61,10 @@ Release Notes for Eclipse EEF
This document contains the release notes for recent major releases of EEF.
+ Changes in EEF 2.1.7
+
+ Modified When disabled, content of lists, text areas and field are still readable. Widgets are scrollable and selectable even if they cannot be edited and actions are disabled.
+
Changes in EEF 2.1.1
Modified Add the workbench part and the selection to the tab descriptor filter extension point.
@@ -157,7 +162,7 @@ Developer-Visible Changes
Changes in EEF 1.7.2
Specifier-Visible Changes
- Modified The dynamic mappings will take into account all the «if» blocks with a valid predicate expression and not only the first one.
+ Modified The dynamic mappings will take into account all the «if» blocks with a valid predicate expression and not only the first one.
Modified Fixed an issue with the enablement of the widget actions of the reference widget.
Changes in EEF 1.7.1
diff --git a/doc/org.eclipse.eef.documentation/pages/releasenotes.textile b/doc/org.eclipse.eef.documentation/pages/releasenotes.textile
index 1f1120bb0..991edc216 100644
--- a/doc/org.eclipse.eef.documentation/pages/releasenotes.textile
+++ b/doc/org.eclipse.eef.documentation/pages/releasenotes.textile
@@ -4,6 +4,10 @@ h2. Release Notes for Eclipse EEF
This document contains the release notes for recent major releases of EEF.
+h3(#eef2.1.7). Changes in EEF 2.1.7
+
+* Modified When disabled, content of lists, text areas and field are still readable. Widgets are scrollable and selectable even if they cannot be edited and actions are disabled.
+
h3(#eef2.1.1). Changes in EEF 2.1.1
* Modified Add the workbench part and the selection to the tab descriptor filter extension point.
@@ -89,7 +93,7 @@ h3(#eef1.7.2). Changes in EEF 1.7.2
h4. Specifier-Visible Changes
-* Modified The dynamic mappings will take into account all the "if" blocks with a valid predicate expression and not only the first one.
+* Modified The dynamic mappings will take into account all the «if» blocks with a valid predicate expression and not only the first one.
* Modified Fixed an issue with the enablement of the widget actions of the reference widget.
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFListController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFListController.java
index b5575ab51..754df7bd7 100644
--- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFListController.java
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFListController.java
@@ -23,6 +23,16 @@
* @author mbats
*/
public interface IEEFListController extends IEEFOnClickController {
+
+ /**
+ * Sets the enablement of action on selection.
+ *
+ * @param isEnabled
+ * true when the widget should have its default behavior, false when the widget
+ * should be in a read only mode.
+ */
+ void setEnabled(boolean isEnabled);
+
/**
* Register a consumer which will be called with the new value of the text when it will change.
*
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFListController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFListController.java
index f90a482c2..0673a3802 100644
--- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFListController.java
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFListController.java
@@ -47,6 +47,11 @@ public class EEFListController extends AbstractEEFOnClickController implements I
*/
private Consumer newValueConsumer;
+ /**
+ * Enable flag to drive on-click.
+ */
+ private boolean enabled = true;
+
/**
* The constructor.
*
@@ -130,6 +135,29 @@ public IStatus action(final EEFWidgetAction action, final List elements)
});
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.eef.core.api.controllers.IEEFListController#setEnabled(boolean)
+ */
+ @Override
+ public void setEnabled(boolean isEnabled) {
+ this.enabled = isEnabled;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.eef.core.api.controllers.AbstractEEFOnClickController#onClick(java.lang.Object,
+ * java.lang.String)
+ */
+ @Override
+ public void onClick(Object element, String onClickEventKind) {
+ if (enabled) {
+ super.onClick(element, onClickEventKind);
+ }
+ }
+
/**
* {@inheritDoc}
*
diff --git a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java
index 2498e1b91..051d7c97c 100644
--- a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java
@@ -43,6 +43,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
@@ -60,9 +61,9 @@
public class EEFExtMultipleReferenceLifecycleManager extends AbstractEEFExtReferenceLifecycleManager {
/**
- * Minimal height of the table widget.
+ * Minimal height of the table widget. 5 Action buttons and almost 7 lines.
*/
- private static final int TABLE_MINIMAL_HEIGHT = 150;
+ private static final int TABLE_MINIMAL_HEIGHT = 140; // same as AbstractEEFWidgetLifecycleManager
/**
* The table viewer.
@@ -94,6 +95,11 @@ public class EEFExtMultipleReferenceLifecycleManager extends AbstractEEFExtRefer
*/
protected ButtonSelectionListener downButtonListener;
+ /**
+ * The default background color of the text field.
+ */
+ private Color defaultBackgroundColor;
+
/**
* The constructor.
*
@@ -124,9 +130,14 @@ public EEFExtMultipleReferenceLifecycleManager(EEFExtReferenceDescription descri
@Override
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) {
this.widgetFactory = formContainer.getWidgetFactory();
+ defaultBackgroundColor = parent.getBackground();
Composite referenceComposite = this.widgetFactory.createFlatFormComposite(parent);
GridLayout referenceGridLayout = new GridLayout(2, false);
+ referenceGridLayout.marginHeight = 0;
+ referenceGridLayout.marginWidth = 0;
+ // Table border need an extra pixel.
+ referenceGridLayout.marginBottom = 1;
referenceComposite.setLayout(referenceGridLayout);
GridData referenceCompositeGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
@@ -141,6 +152,8 @@ protected void createMainControl(Composite parent, IEEFFormContainer formContain
GridLayout buttonCompositeGridLayout = new GridLayout(1, false);
buttonCompositeGridLayout.marginHeight = 0;
+ buttonCompositeGridLayout.marginWidth = 0;
+
buttonsComposite.setLayout(buttonCompositeGridLayout);
this.createButtons(buttonsComposite);
@@ -193,6 +206,7 @@ protected void createTable(Composite parent) {
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.BEGINNING;
+ gridData.horizontalIndent = VALIDATION_MARKER_OFFSET;
scrolledComposite.setLayoutData(gridData);
// CHECKSTYLE:OFF
@@ -203,7 +217,6 @@ protected void createTable(Composite parent) {
this.tableViewer = new TableViewer(table);
GridData tableGridData = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
- tableGridData.horizontalIndent = VALIDATION_MARKER_OFFSET;
this.tableViewer.getTable().setLayoutData(tableGridData);
this.composedAdapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
@@ -394,6 +407,10 @@ public void refresh() {
protected void setEnabled(boolean isEnabled) {
super.setEnabled(isEnabled);
+ if (this.tableViewer != null && this.tableViewer.getTable() != null && !this.tableViewer.getTable().isDisposed()) {
+ // Background color is handled like List widget
+ this.tableViewer.getTable().setBackground(this.getBackgroundColor(isEnabled));
+ }
if (this.upButton != null && !this.upButton.isDisposed()) {
this.upButton.setEnabled(isEnabled);
}
@@ -402,6 +419,22 @@ protected void setEnabled(boolean isEnabled) {
}
}
+ /**
+ * Get the background color according to the current valid style.
+ *
+ * @param isEnabled
+ * true if the widget is enabled, false otherwise
+ *
+ * @return The background color to use in the text field.
+ */
+ private Color getBackgroundColor(boolean isEnabled) {
+ Color color = defaultBackgroundColor;
+ if (!isEnabled) {
+ color = widgetFactory.getColors().getInactiveBackground();
+ }
+ return color;
+ }
+
/**
* {@inheritDoc}
*
diff --git a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java
index e6702c587..176fda1e3 100644
--- a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java
@@ -101,6 +101,10 @@ protected void createMainControl(Composite parent, IEEFFormContainer formContain
GridLayout gridLayout = new GridLayout(3, false);
gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = 0;
+ // Keep left margin to align icon to other widgets (Lists, text fields and areas mainly).
+ gridLayout.marginLeft = gridLayout.marginWidth;
+ gridLayout.marginWidth = 0;
+
referenceComposite.setLayout(gridLayout);
GridData referenceCompositeGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
@@ -130,7 +134,11 @@ protected void createMainControl(Composite parent, IEEFFormContainer formContain
*/
@Override
protected void createButtons(Composite parent) {
- parent.setLayout(new GridLayout(getButtonsNumber(), true));
+ GridLayout layout = new GridLayout(getButtonsNumber(), true);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+
+ parent.setLayout(layout);
if (!this.eReference.isContainment()) {
Image browseImage = ExtendedImageRegistry.INSTANCE
.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.BROWSE_ICON_PATH));
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
index 736ca2d6e..16675fd8d 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/api/widgets/AbstractEEFWidgetLifecycleManager.java
@@ -148,6 +148,7 @@ public void createControl(Composite parent, IEEFFormContainer formContainer) {
this.help.setLayoutData(new GridData(this.getLabelVerticalAlignment()));
this.help.setToolTipText(""); //$NON-NLS-1$
}
+ this.help.setBackground((Color) null);
// The main control (delegated to the concrete Lifecycle Manager)
this.createMainControl(parent, formContainer);
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java
index 7966cac02..275a691f6 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFContainerLifecycleManager.java
@@ -126,7 +126,11 @@ public void createControl(Composite parent, IEEFFormContainer formContainer) {
}
GridLayout compositeLayout = new GridLayout(numColumns, makeColumnsEqualWidth);
- compositeLayout.marginWidth = 1;
+ compositeLayout.marginWidth = 0;
+ compositeLayout.marginHeight = 0;
+ compositeLayout.horizontalSpacing = 5 // Default margin
+ * 2 // section border + widget border
+ * 2; // left + right
composite.setLayout(compositeLayout);
@@ -140,6 +144,12 @@ public void createControl(Composite parent, IEEFFormContainer formContainer) {
// Three columns: label, help, widget
GridLayout columnLayout = new GridLayout(3, false);
+ columnLayout.marginWidth = 0;
+ columnLayout.marginHeight = 0;
+ // Text fields and areas need a special pixel.
+ // Their border is drawn out of bounds.
+ columnLayout.marginRight = 1;
+
column.setLayout(columnLayout);
// Pick the right controls for the given column index in the controls flat list
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 4b96ad323..63ab6d4a9 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
@@ -161,6 +161,8 @@ private void createWidgetActionButtons(Composite parent) {
GridLayout layout = new GridLayout(this.description.getActions().size(), true);
// hyperlinkComposite already provide vertical and horizontal spacing.
layout.marginHeight = 0;
+ layout.marginWidth = 0;
+
buttons.setLayout(layout);
// Buttons are visible only if an action is defined
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFLabelLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFLabelLifecycleManager.java
index 7ba3e394d..1af7e9725 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFLabelLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFLabelLifecycleManager.java
@@ -103,7 +103,7 @@ public EEFLabelLifecycleManager(EEFLabelDescription description, IVariableManage
* {@inheritDoc}
*
* @see org.eclipse.eef.ide.ui.api.widgets.AbstractEEFWidgetLifecycleManager#createMainControl(org.eclipse.swt.widgets.Composite,
- * org.eclipse.eef.common.ui.api.IEEFFormContainer)
+ * org.eclipse.eef.common.ui.api.IEEFFormContainer)
*/
@Override
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) {
@@ -164,6 +164,7 @@ private void createWidgetActionButtons(Composite parent) {
GridLayout layout = new GridLayout(this.description.getActions().size(), true);
// labelComposite already provide vertical spacing.
layout.marginHeight = 0;
+ layout.marginWidth = 0;
buttons.setLayout(layout);
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFListLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFListLifecycleManager.java
index 154a332de..70f31d185 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFListLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFListLifecycleManager.java
@@ -56,9 +56,9 @@ public class EEFListLifecycleManager extends AbstractEEFWidgetLifecycleManager {
private static final int DEFAULT_HEIGHT = 34;
/**
- * Minimal height of the table widget.
+ * Minimal height of the table widget. 5 Action buttons and almost 7 lines.
*/
- private static final int TABLE_MINIMAL_HEIGHT = 100;
+ private static final int TABLE_MINIMAL_HEIGHT = 140; // same as EEFExtMultipleReferenceLifecycleManager
/**
* The description.
@@ -93,7 +93,7 @@ public class EEFListLifecycleManager extends AbstractEEFWidgetLifecycleManager {
/**
* The listener used to run the onClick expression when the user will click on the table.
*/
- private SelectionListener tableSelectionListener;
+ private EEFTableSelectionListener tableSelectionListener;
/**
* The constructor.
@@ -127,6 +127,9 @@ protected void createMainControl(Composite parent, IEEFFormContainer formContain
// this is the parent composite
Composite list = widgetFactory.createFlatFormComposite(parent);
GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+
list.setLayout(layout);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
@@ -152,6 +155,7 @@ private void createListWidget(Composite parent) {
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
+ gridData.horizontalIndent = VALIDATION_MARKER_OFFSET;
scrolledComposite.setLayoutData(gridData);
// CHECKSTYLE:OFF
@@ -178,6 +182,7 @@ private void createListWidget(Composite parent) {
final int clientWidth = scrolledComposite.getClientArea().width;
this.tableViewer.getTable().setSize(clientWidth, Math.max(TABLE_MINIMAL_HEIGHT, widgetHeight));
+ tableViewer.getTable().setBackground(defaultBackgroundColor);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setAlwaysShowScrollBars(true);
@@ -196,7 +201,11 @@ private void createWidgetActionButtons(Composite parent) {
gridData.verticalAlignment = SWT.BEGINNING;
buttons.setLayoutData(gridData);
- buttons.setLayout(new GridLayout(1, false));
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+
+ buttons.setLayout(layout);
// Buttons are visible only if an action is defined
for (EEFWidgetAction action : this.description.getActions()) {
@@ -278,7 +287,8 @@ private void setListValue(Object value) {
protected void setEnabled(boolean isEnabled) {
if (this.tableViewer != null && this.tableViewer.getTable() != null && !this.tableViewer.getTable().isDisposed()) {
this.tableViewer.getTable().setBackground(this.getBackgroundColor(isEnabled));
- this.tableViewer.getTable().setEnabled(isEnabled);
+ // tableViewer is not disabled so user can scroll.
+ controller.setEnabled(isEnabled);
}
this.actionButtons.stream().filter(actionButton -> !actionButton.getButton().isDisposed())
.forEach(actionButton -> actionButton.setEnabled(isEnabled));
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java
index c7e8bb1f4..439ec7e0d 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java
@@ -200,6 +200,12 @@ protected void createMainControl(Composite parent, IEEFFormContainer formContain
gridData.heightHint = lineCount * text.getLineHeight();
gridData.widthHint = TEXT_AREA_WIDTH_HINT;
gridData.horizontalIndent = VALIDATION_MARKER_OFFSET;
+
+ // Styled Text use 2 pixels outside of its bounds to drawn borders and scrollbar.
+ // The space with previous widget disappear.
+ // verticalIndent only mitigates this issue.
+ // Using space with another composite introduces other alignment issues.
+ gridData.verticalIndent = 4;
this.text.setLayoutData(gridData);
} else {
this.text = widgetFactory.createStyledText(parent, SWT.SINGLE);
@@ -207,7 +213,7 @@ protected void createMainControl(Composite parent, IEEFFormContainer formContain
gridData.horizontalIndent = VALIDATION_MARKER_OFFSET;
this.text.setLayoutData(gridData);
}
-
+ this.text.setMargins(5, 0, 5, 0); // These margins match the margins of lists.
this.text.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
widgetFactory.paintBordersFor(parent);
@@ -570,7 +576,8 @@ private String computeTextFromModel() {
protected void setEnabled(boolean isEnabled) {
if (!this.text.isDisposed()) {
this.text.setEditable(isEnabled);
- this.text.setEnabled(isEnabled);
+ // text must not be disabled.
+ // User need to scroll for text area or copy content.
this.text.setBackground(this.getBackgroundColor(isEnabled));
this.text.setForeground(this.getForegroundColor(isEnabled));
}