Commit 9d0aa931 authored by Adrien's avatar Adrien Committed by Romain Bioteau
Browse files

add details for types String & text (bdm). (#284)

* update messages
* minor ui fixes
parent 62a8d67e
......@@ -53,7 +53,8 @@ Require-Bundle: org.bonitasoft.studio.engine;bundle-version="1.0.0",
org.eclipse.core.filesystem,
org.eclipse.debug.core,
org.eclipse.core.externaltools;bundle-version="1.0.300",
org.eclipse.debug.ui
org.eclipse.debug.ui,
org.bonitasoft.studio.ui;bundle-version="7.5.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: org.bonitasoft.engine.api,
......
......@@ -60,6 +60,7 @@ saving=Saving...
constraints=Unique constraints
businessDataModel=Business data model
selectUniqueConstraintFieldsMessage=Select the combination of attributes to which the unique constraint will be applied.
warningTextConstraint=You can't use your attributes with the type TEXT to define the unique constraint.\nSwitch to the type STRING if you need to.
selectUniqueConstraintFieldsTitle=Select attributes
attributes=Attributes
atLeastOneAttributeShouldBelongToConstraint=At least one attribute should be defined for unique constraint {0}
......@@ -125,9 +126,10 @@ indexedAttributes=Indexed attributes
availableAttributes=Available attributes
selectIndexFieldsTitle=Select attributes for {0}
selectIndexFieldsMessages=Select the attributes for this index. The performance of this query filter is significantly improved, depending on the attributes and order chosen.
warningTextIndex=You can't index an attribute with the type TEXT. Switch to the type STRING if you need to.
businessObjectDAO=Business Object DAO
mandatoryColumnTooltip=If you check Multiple and Mandatory, at least one value is mandatory.
stringLengthTooltip=Maximum length allowed for a String value.
stringLengthTooltip=Use STRING if you need a unique constraint and/or indexes. Its maximum length depends on your database.\nFor longer strings, choose the type TEXT.\nDatabase equivalent: varchar
lengthCannotBeEmpty=Length must be a valid positive integer
noDetailsAvailable=No details available
details=Details
......@@ -154,4 +156,8 @@ modelValidationFailedMsg=Business Data Model validation has failed with followin
bdmDeployedTitle=Business Data Model deployed
bdmDeployedMessage=The Business Data Model has been deployed successfully.\n\u26A0 Open sessions have been closed (portal,applications...). You need to log back in.
doNotShowMeAgain=Don't show me this message again.
bdmDeployDetails=Business Data Model deployment steps:\n\t\u23F8 Pause BPM services (\u2192 closes all open sessions)\n\t\uD83D\uDDF2 Generate Java entities and DAO from model\n\t\uD83D\uDDF2 Create/Update database schema\n\t\u25BA Resume BPM services
\ No newline at end of file
bdmDeployDetails=Business Data Model deployment steps:\n\t\u23F8 Pause BPM services (\u2192 closes all open sessions)\n\t\uD83D\uDDF2 Generate Java entities and DAO from model\n\t\uD83D\uDDF2 Create/Update database schema\n\t\u25BA Resume BPM services
modelValidationFailedMsg=Business data model validation has failed with following issues. Fix those issues to be able to save your model.
textDetails=Use TEXT if the possible string length may exceed the STRING max length in your database (e.g. for text areas).\nBeware this will prevent unique constraint or indexes.\nDatabase equivalent: Clob.
lengthIsNotAPositiveNumber=Length must be a positive integer
lengthIsNotANumber=Length must be an integer
/*******************************************************************************
* Copyright (C) 2017 BonitaSoft S.A.
* BonitaSoft is a trademark of BonitaSoft SA.
* This software file is BONITASOFT CONFIDENTIAL. Not For Distribution.
* For commercial licensing information, contact:
* BonitaSoft, 32 rue Gustave Eiffel � 38000 Grenoble
* or BonitaSoft US, 51 Federal Street, Suite 305, San Francisco, CA 94107
*******************************************************************************/
package org.bonitasoft.studio.businessobject.ui.wizard.editingsupport;
import static org.bonitasoft.studio.model.businessObject.BusinessObjectBuilder.aBO;
import static org.bonitasoft.studio.model.businessObject.FieldBuilder.aCompositionField;
import static org.bonitasoft.studio.model.businessObject.FieldBuilder.aRelationField;
import static org.bonitasoft.studio.model.businessObject.FieldBuilder.aSimpleField;
import static org.bonitasoft.studio.model.businessObject.FieldBuilder.aStringField;
import static org.bonitasoft.studio.model.businessObject.FieldBuilder.aTextField;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.function.Predicate;
import org.bonitasoft.engine.bdm.model.BusinessObject;
import org.bonitasoft.engine.bdm.model.field.Field;
import org.bonitasoft.engine.bdm.model.field.FieldType;
import org.bonitasoft.engine.bdm.model.field.RelationField;
import org.bonitasoft.engine.bdm.model.field.SimpleField;
import org.junit.Test;
public class IndexableFieldFilterTest {
@Test
public void should_filter_multiple_attributes() throws Exception {
final BusinessObject businessObject = aBusinessObjectWithFields();
final IndexableFieldFilter filter = new IndexableFieldFilter();
final List<Field> selectedFields = filter.selectIndexableFields(businessObject);
assertTrue(selectedFields.stream().noneMatch(f -> f.isCollection()));
}
@Test
public void should_filter_text_attributes() throws Exception {
final BusinessObject businessObject = aBusinessObjectWithFields();
final IndexableFieldFilter filter = new IndexableFieldFilter();
final List<Field> selectedFields = filter.selectIndexableFields(businessObject);
assertTrue(selectedFields.stream()
.filter(isSimpleField())
.map(SimpleField.class::cast)
.noneMatch(isTextField()));
}
@Test
public void should_filter_relationFields_with_null_reference() throws Exception {
final BusinessObject businessObject = aBusinessObjectWithFields();
final IndexableFieldFilter filter = new IndexableFieldFilter();
final List<Field> selectedFields = filter.selectIndexableFields(businessObject);
assertTrue(selectedFields.stream()
.filter(isRelationFieldField())
.map(RelationField.class::cast)
.noneMatch(hasNullReference()));
}
private Predicate<Field> isRelationFieldField() {
return field -> RelationField.class.isInstance(field);
}
private Predicate<RelationField> hasNullReference() {
return field -> field.getReference() == null;
}
private Predicate<Field> isSimpleField() {
return field -> SimpleField.class.isInstance(field);
}
private Predicate<SimpleField> isTextField() {
return field -> FieldType.TEXT == field.getType();
}
protected BusinessObject aBusinessObjectWithFields() {
return aBO("MyObject")
.withField(aSimpleField().multiple().build())
.withField(aTextField("textField").build())
.withField(aStringField(("stringField")).build())
.withField(aRelationField().build())
.withField(aCompositionField("fieldWithRef", aBO("reference").build()))
.build();
}
}
......@@ -327,6 +327,11 @@ public class Messages extends NLS {
public static String bdmDeployedMessage;
public static String doNotShowMeAgain;
public static String bdmDeployDetails;
public static String textDetails;
public static String warningTextConstraint;
public static String warningTextIndex;
public static String lengthIsNotAPositiveNumber;
public static String lengthIsNotANumber;
private Messages() {
}
......
......@@ -40,7 +40,8 @@ import org.bonitasoft.studio.businessobject.ui.wizard.provider.RelationKindLabel
import org.bonitasoft.studio.common.NamingUtils;
import org.bonitasoft.studio.pics.Pics;
import org.bonitasoft.studio.pics.PicsConstants;
import org.eclipse.core.databinding.Binding;
import org.bonitasoft.studio.ui.databinding.UpdateStrategyFactory;
import org.bonitasoft.studio.ui.widget.ComboWidget;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.beans.PojoObservables;
......@@ -54,9 +55,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
import org.eclipse.core.databinding.observable.value.SelectObservableValue;
import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.internal.databinding.validation.StringToIntegerValidator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.databinding.viewers.IViewerObservableValue;
......@@ -79,7 +78,6 @@ import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
......@@ -92,8 +90,14 @@ import org.eclipse.swt.widgets.TableColumn;
public class AttributesTabItemControl extends AbstractTabItemControl {
private final IObservableList fieldsList;
private IViewerObservableValue attributeSelectionObservable;
private final BusinessObjectModel businessObjectModel;
private Group detailGroup;
private StackLayout stackLayout;
private Composite relationFieldContent;
private Composite stringFieldContent;
private Composite emptyContent;
private Composite textFieldContent;
public AttributesTabItemControl(final TabFolder parent, final DataBindingContext ctx,
final IViewerObservableValue viewerObservableValue,
......@@ -109,114 +113,111 @@ public class AttributesTabItemControl extends AbstractTabItemControl {
setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).create());
setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(5, 5).spacing(5, 0).create());
final IViewerObservableValue attributeSelectionObservable = createAttributeTableControl(ctx, viewerObservableValue);
createAttributeDetailControl(ctx, attributeSelectionObservable, viewerObservableValue);
attributeSelectionObservable = createAttributeTableControl(ctx, viewerObservableValue);
createAttributeDetailControl(ctx, viewerObservableValue);
}
private void createAttributeDetailControl(final DataBindingContext ctx,
final IViewerObservableValue attributeSelectionObservable,
final IViewerObservableValue viewerObservableValue) {
final Group detailGroup = new Group(this, SWT.NONE);
detailGroup = new Group(this, SWT.NONE);
detailGroup.setText(Messages.details);
detailGroup.setLayoutData(
GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 80).indent(0, 10).span(2, 1).create());
final StackLayout stackLayout = new StackLayout();
GridDataFactory.fillDefaults().grab(true, false).indent(0, 10).span(2, 1)
.create());
stackLayout = new StackLayout();
detailGroup.setLayout(stackLayout);
final Composite relationFieldContent = createRelationFieldDetailContent(detailGroup, ctx,
attributeSelectionObservable, viewerObservableValue);
final Composite stringFieldContent = createStringFieldDetailContent(detailGroup, ctx, attributeSelectionObservable);
final Composite emptyContent = createNoDetailsContent(detailGroup);
relationFieldContent = createRelationFieldDetailContent(detailGroup, ctx, viewerObservableValue);
stringFieldContent = createStringFieldDetailContent(detailGroup, ctx);
emptyContent = createNoDetailsContent(detailGroup);
textFieldContent = createTextFieldContent(detailGroup);
stackLayout.topControl = emptyContent;
attributeSelectionObservable.addValueChangeListener(new IValueChangeListener() {
attributeSelectionObservable.addValueChangeListener(this::changeType);
}
@Override
public void handleValueChange(final ValueChangeEvent event) {
final Field selectedField = (Field) event.diff.getNewValue();
if (selectedField != null) {
detailGroup.setText(Messages.bind(Messages.detailsFor, selectedField.getName()));
} else {
detailGroup.setText(Messages.details);
stackLayout.topControl = emptyContent;
}
if (selectedField instanceof RelationField) {
stackLayout.topControl = relationFieldContent;
} else if (selectedField instanceof SimpleField) {
if (((SimpleField) selectedField).getType() == FieldType.STRING) {
stackLayout.topControl = stringFieldContent;
} else {
stackLayout.topControl = emptyContent;
}
}
detailGroup.layout();
}
});
private Composite createTextFieldContent(Group detailGroup) {
final Composite composite = new Composite(detailGroup, SWT.NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
final Label textLabel = new Label(composite, SWT.NONE);
textLabel.setText(Messages.textDetails);
return composite;
}
private void changeType(ValueChangeEvent event) {
final Field selectedField = (Field) event.diff.getNewValue();
if (selectedField != null) {
detailGroup.setText(Messages.bind(Messages.detailsFor, selectedField.getName()));
} else {
detailGroup.setText(Messages.details);
stackLayout.topControl = emptyContent;
}
if (selectedField instanceof RelationField) {
stackLayout.topControl = relationFieldContent;
} else if (selectedField instanceof SimpleField) {
if (((SimpleField) selectedField).getType() == FieldType.STRING) {
stackLayout.topControl = stringFieldContent;
} else if (((SimpleField) selectedField).getType() == FieldType.TEXT) {
stackLayout.topControl = textFieldContent;
} else {
stackLayout.topControl = emptyContent;
}
}
detailGroup.layout();
}
private Composite createNoDetailsContent(final Group detailGroup) {
final Composite composite = new Composite(detailGroup, SWT.NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 10).create());
composite.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
final Label noDetailLabel = new Label(composite, SWT.NONE);
noDetailLabel.setLayoutData(GridDataFactory.fillDefaults().grab(false, false).create());
noDetailLabel.setLayoutData(GridDataFactory.fillDefaults().create());
noDetailLabel.setText(Messages.noDetailsAvailable);
return composite;
}
private Composite createStringFieldDetailContent(final Group detailGroup, final DataBindingContext ctx,
final IViewerObservableValue attributeSelectionObservable) {
private Composite createStringFieldDetailContent(final Group detailGroup, final DataBindingContext ctx) {
final Composite composite = new Composite(detailGroup, SWT.NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).spacing(15, 5).create());
final Label lengthLabel = new Label(composite, SWT.NONE);
lengthLabel.setLayoutData(GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).create());
lengthLabel.setText(Messages.length);
final ControlDecoration controlDecoration = new ControlDecoration(lengthLabel, SWT.RIGHT);
controlDecoration.setDescriptionText(Messages.stringLengthTooltip);
controlDecoration.setImage(Pics.getImage(PicsConstants.hint));
controlDecoration.setMarginWidth(-2);
final Combo lengthCombo = new Combo(composite, SWT.BORDER);
lengthCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
lengthCombo.setItems(getStringLengthValues());
final UpdateValueStrategy targetToModel = new UpdateValueStrategy();
final StringToNumberConverter converter = StringToNumberConverter.toInteger(false);
targetToModel.setConverter(converter);
targetToModel.setAfterGetValidator(new StringToIntegerValidator(converter));
targetToModel.setBeforeSetValidator(new IValidator() {
@Override
public IStatus validate(final Object value) {
if (value == null || value.toString().isEmpty()) {
final Object selectedField = attributeSelectionObservable.getValue();
if (selectedField instanceof SimpleField
&& ((SimpleField) selectedField).getType() == FieldType.STRING) {
return ValidationStatus.error(Messages.lengthCannotBeEmpty);
}
}
return ValidationStatus.ok();
}
});
final UpdateValueStrategy modelToTarget = new UpdateValueStrategy();
modelToTarget.setConverter(NumberToStringConverter.fromInteger(false));
final Binding lengthValueBinding = ctx.bindValue(SWTObservables.observeText(lengthCombo),
PojoObservables.observeDetailValue(attributeSelectionObservable, "length", Integer.class),
targetToModel, modelToTarget);
attributeSelectionObservable.addValueChangeListener(new IValueChangeListener() {
final ComboWidget stringFieldCombo = new ComboWidget.Builder()
.withLabel(Messages.length)
.withItems(getStringLengthValues())
.labelAbove()
.alignMiddle()
.withMessage(Messages.stringLengthTooltip)
.bindTo(PojoObservables.observeDetailValue(attributeSelectionObservable, "length", Integer.class))
.withTargetToModelStrategy(UpdateStrategyFactory.updateValueStrategy()
.withConverter(StringToNumberConverter.toInteger(false))
.withValidator(this::stringLengthValidator)
.create())
.withModelToTargetStrategy(UpdateStrategyFactory.updateValueStrategy()
.withConverter(NumberToStringConverter.fromInteger(false))
.create())
.inContext(ctx)
.createIn(composite);
attributeSelectionObservable.addValueChangeListener(e -> stringFieldCombo.getValueBinding().updateModelToTarget());
return composite;
}
@Override
public void handleValueChange(final ValueChangeEvent event) {
lengthValueBinding.updateModelToTarget();
private IStatus stringLengthValidator(final Object value) {
if (value == null || value.toString().isEmpty()) {
return ValidationStatus.error(Messages.lengthCannotBeEmpty);
}
try {
final int parseInt = Integer.parseInt((String) value);
if (parseInt <= 0) {
return ValidationStatus.error(Messages.lengthIsNotAPositiveNumber);
}
});
return composite;
} catch (final NumberFormatException e) {
return ValidationStatus.error(Messages.lengthIsNotANumber);
}
return ValidationStatus.ok();
}
protected String[] getStringLengthValues() {
final List<String> values = new ArrayList<String>();
final List<String> values = new ArrayList<>();
values.add("64");
values.add("128");
values.add("255");
......@@ -225,7 +226,6 @@ public class AttributesTabItemControl extends AbstractTabItemControl {
}
private Composite createRelationFieldDetailContent(final Group detailGroup, final DataBindingContext ctx,
final IViewerObservableValue attributeSelectionObservable,
final IViewerObservableValue viewerObservableValue) {
final Composite composite = new Composite(detailGroup, SWT.NONE);
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
......@@ -296,7 +296,7 @@ public class AttributesTabItemControl extends AbstractTabItemControl {
final IViewerObservableValue viewerObservableValue) {
final Composite buttonsComposite = new Composite(this, SWT.NONE);
buttonsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).indent(0, 20).create());
buttonsComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 3).create());
buttonsComposite.setLayout(GridLayoutFactory.fillDefaults().spacing(0, 3).create());
final Button addButton = createAddButton(ctx, viewerObservableValue, buttonsComposite);
......@@ -526,7 +526,6 @@ public class AttributesTabItemControl extends AbstractTabItemControl {
field.setLength(255);
field.setCollection(Boolean.FALSE);
field.setNullable(Boolean.TRUE);
fieldsList.add(field);
observeAttributeSelection.setValue(field);
featuresTableViewer.getControl().getDisplay().asyncExec(new Runnable() {
......@@ -570,7 +569,7 @@ public class AttributesTabItemControl extends AbstractTabItemControl {
}
protected String generateAttributeName(final IViewerObservableValue viewerObseravble) {
final Set<String> existingNames = new HashSet<String>();
final Set<String> existingNames = new HashSet<>();
final BusinessObject businessObject = (BusinessObject) viewerObseravble.getValue();
for (final Field feature : businessObject.getFields()) {
existingNames.add(feature.getName());
......
......@@ -50,6 +50,7 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TableColumn;
......@@ -64,7 +65,8 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
private final BusinessObjectModel bom;
public IndexesTabItemControl(final TabFolder parent, final DataBindingContext ctx, final IViewerObservableValue viewerObservableValue,
public IndexesTabItemControl(final TabFolder parent, final DataBindingContext ctx,
final IViewerObservableValue viewerObservableValue,
final IObservableList fieldsList,
final BusinessObjectModel bom) {
super(parent, SWT.NONE);
......@@ -84,8 +86,10 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
final Button addButton = createAddButton(ctx, viewerObservableValue, buttonsComposite);
final Button deleteButton = createDeleteButton(buttonsComposite);
final TableViewer indexesTableViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
indexesTableViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, 300).create());
final TableViewer indexesTableViewer = new TableViewer(this,
SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
indexesTableViewer.getControl()
.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, 300).create());
indexesTableViewer.getTable().setEnabled(viewerObservableValue.getValue() != null);
indexesTableViewer.getTable().setLinesVisible(true);
indexesTableViewer.getTable().setHeaderVisible(true);
......@@ -104,9 +108,11 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
return fromObject != null;
}
});
ctx.bindValue(SWTObservables.observeEnabled(indexesTableViewer.getTable()), viewerObservableValue, null, enableStrategy);
ctx.bindValue(SWTObservables.observeEnabled(indexesTableViewer.getTable()), viewerObservableValue, null,
enableStrategy);
final IViewerObservableValue constaintObserveSingleSelection = ViewersObservables.observeSingleSelection(indexesTableViewer);
final IViewerObservableValue constaintObserveSingleSelection = ViewersObservables
.observeSingleSelection(indexesTableViewer);
ctx.bindValue(SWTObservables.observeEnabled(deleteButton), constaintObserveSingleSelection, null, enableStrategy);
enableStrategy = new UpdateValueStrategy();
......@@ -129,7 +135,8 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
createIndexNameColumn(ctx, indexesTableViewer, viewerObservableValue);
createIndexFieldsColumn(ctx, indexesTableViewer, viewerObservableValue);
final IObservableList indexesObserveDetailList = PojoObservables.observeDetailList(viewerObservableValue, "indexes", Index.class);
final IObservableList indexesObserveDetailList = PojoObservables.observeDetailList(viewerObservableValue, "indexes",
Index.class);
indexesTableViewer.setInput(indexesObserveDetailList);
addButton.addSelectionListener(new SelectionAdapter() {
......@@ -157,7 +164,8 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
});
}
protected void createIndexNameColumn(final DataBindingContext ctx, final TableViewer indexesTableViewer, final IViewerObservableValue viewerObservableValue) {
protected void createIndexNameColumn(final DataBindingContext ctx, final TableViewer indexesTableViewer,
final IViewerObservableValue viewerObservableValue) {
final TableViewerColumn nameColumnViewer = new TableViewerColumn(indexesTableViewer, SWT.LEFT);
final TableColumn column = nameColumnViewer.getColumn();
column.setText(Messages.name + " *");
......@@ -178,7 +186,8 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
nameColumnViewer.setEditingSupport(new IndexNameEditingSupport(nameColumnViewer.getViewer(), ctx, bom));
}
protected void createIndexFieldsColumn(final DataBindingContext ctx, final TableViewer viewer, final IViewerObservableValue viewerObservableValue) {
protected void createIndexFieldsColumn(final DataBindingContext ctx, final TableViewer viewer,
final IViewerObservableValue viewerObservableValue) {
final TableViewerColumn indexesFieldsColumnViewer = new TableViewerColumn(viewer, SWT.LEFT);
final TableColumn column = indexesFieldsColumnViewer.getColumn();
column.setText(Messages.attributes);
......@@ -198,7 +207,8 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
}
});
indexesFieldsColumnViewer
.setEditingSupport(new IndexFieldsEditingSupport(viewerObservableValue, indexesFieldsColumnViewer.getViewer()));
.setEditingSupport(
new IndexFieldsEditingSupport(viewerObservableValue, indexesFieldsColumnViewer.getViewer()));
}
protected void addIndex(final IViewerObservableValue viewerObservableValue, final IObservableList indexesObservableList,
......@@ -206,7 +216,8 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
final Index index = new Index();
index.setName(generateIndexName(viewerObservableValue));
indexesObservableList.add(index);
indexesTableViewer.editElement(index, 0);
Display.getDefault().asyncExec(() -> indexesTableViewer.editElement(index, 0));
}
protected void deleteIndex(final IObservableList indexListObservable, final TableViewer indexesTableViewer) {
......@@ -215,8 +226,8 @@ public class IndexesTabItemControl extends AbstractTabItemControl {
}
protected String generateIndexName(final IViewerObservableValue viewerObservableValue) {
final Set<String> existingNames = new HashSet<String>();
final List<Index> indexes = new ArrayList<Index>();
final Set<String> existingNames = new HashSet<>();
final List<Index> indexes = new ArrayList<>();
for (final BusinessObject businessObject : bom.getBusinessObjects()) {
indexes.addAll(businessObject.getIndexes());