Commit f39195c6 authored by Bonita CI's avatar Bonita CI
Browse files

Merge branch 'master' into 'BS-9326_New_REST_APIs'

parents 491ddd04 ee8ec659
......@@ -237,6 +237,7 @@
eType="ecore:EClass expression.ecore#//Expression" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intialResourceList" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="downloadType" eType="#//FileWidgetDownloadType"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Column">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
......@@ -387,4 +388,9 @@
<eClassifiers xsi:type="ecore:EClass" name="GroupIterator" eSuperTypes="process.ecore#//Element">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="className" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="FileWidgetDownloadType">
<eLiterals name="Both" literal="Both"/>
<eLiterals name="URL" value="1" literal="URL"/>
<eLiterals name="Browse" value="2" literal="Browse"/>
</eClassifiers>
</ecore:EPackage>
......@@ -153,6 +153,11 @@
<genEnumLiterals ecoreEnumLiteral="form.ecore#//FileWidgetInputType/URL"/>
<genEnumLiterals ecoreEnumLiteral="form.ecore#//FileWidgetInputType/Resource"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="form.ecore#//FileWidgetDownloadType">
<genEnumLiterals ecoreEnumLiteral="form.ecore#//FileWidgetDownloadType/Both"/>
<genEnumLiterals ecoreEnumLiteral="form.ecore#//FileWidgetDownloadType/URL"/>
<genEnumLiterals ecoreEnumLiteral="form.ecore#//FileWidgetDownloadType/Browse"/>
</genEnums>
<genClasses ecoreClass="form.ecore#//Form">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference form.ecore#//Form/widgets"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute form.ecore#//Form/nColumn"/>
......@@ -276,6 +281,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute form.ecore#//FileWidget/updateDocument"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference form.ecore#//FileWidget/outputDocumentListExpression"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute form.ecore#//FileWidget/intialResourceList"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute form.ecore#//FileWidget/downloadType"/>
</genClasses>
<genClasses ecoreClass="form.ecore#//Column">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute form.ecore#//Column/width"/>
......
......@@ -8711,5 +8711,40 @@
featureName="defaultValueLiteral" dataValue="NONE" oldDataValue="0"/>
</changes>
</releases>
<releases date="2014-10-28T10:45:10.092+0100" label="6.4.0-004">
<changes xsi:type="history:Create" target="form.ecore#/" referenceName="eClassifiers"
element="form.ecore#//FileWidgetDownloadType"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType"
featureName="name" dataValue="FileWidgetDownloadType"/>
<changes xsi:type="history:Create" target="form.ecore#//FileWidgetDownloadType"
referenceName="eLiterals" element="form.ecore#//FileWidgetDownloadType/Both"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/Both"
featureName="literal" dataValue="Both"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/Both"
featureName="name" dataValue="Both"/>
<changes xsi:type="history:Create" target="form.ecore#//FileWidgetDownloadType"
referenceName="eLiterals" element="form.ecore#//FileWidgetDownloadType/URL"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/URL"
featureName="literal" dataValue="URL"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/URL"
featureName="name" dataValue="URL"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/URL"
featureName="value" dataValue="1" oldDataValue="0"/>
<changes xsi:type="history:Create" target="form.ecore#//FileWidgetDownloadType"
referenceName="eLiterals" element="form.ecore#//FileWidgetDownloadType/Browse"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/Browse"
featureName="literal" dataValue="Browse"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/Browse"
featureName="name" dataValue="Browse"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidgetDownloadType/Browse"
featureName="value" dataValue="2" oldDataValue="0"/>
<changes xsi:type="history:Create" target="form.ecore#//FileWidget" referenceName="eStructuralFeatures"
element="form.ecore#//FileWidget/downloadType"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidget/downloadType"
featureName="name" dataValue="downloadType"/>
<changes xsi:type="history:Set" element="form.ecore#//FileWidget/downloadType"
featureName="eType" referenceValue="form.ecore#//FileWidgetDownloadType"/>
<changes xsi:type="history:MigrationChange" migration="org.bonitasoft.studio.migration.custom.migration.form.FileWidgetResourceMigration"/>
</releases>
<releases/>
</history:History>
......@@ -17,6 +17,7 @@
package org.bonitasoft.studio.actors.ui.section;
import org.bonitasoft.studio.actors.i18n.Messages;
import org.bonitasoft.studio.common.emf.converter.BooleanInverserConverter;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.jface.BonitaStudioFontRegistry;
import org.bonitasoft.studio.model.process.Actor;
......@@ -64,30 +65,17 @@ public class AssignableActorsPropertySection extends AbstractActorsPropertySecti
useLaneActorButton.setEnabled(current instanceof Lane) ;
final IObservableValue value = EMFEditObservables.observeValue(getEditingDomain(), assignable, ProcessPackage.Literals.TASK__OVERRIDE_ACTORS_OF_THE_LANE) ;
emfDatabindingContext.bindValue(SWTObservables.observeSelection(taskActorButton), value) ;
emfDatabindingContext.bindValue(SWTObservables.observeSelection(useLaneActorButton), value,new UpdateValueStrategy(),new UpdateValueStrategy().setConverter(new Converter(Boolean.class,Boolean.class){
@Override
public Object convert(Object from) {
return !(Boolean) from;
}
})) ;
final UpdateValueStrategy updateValueStrategy = new UpdateValueStrategy().setConverter(new Converter(Boolean.class,Boolean.class){
@Override
public Object convert(Object from) {
return !(Boolean) from;
}
});
emfDatabindingContext.bindValue(SWTObservables.observeEnabled(actorComboViewer.getControl()), SWTObservables.observeSelection(useLaneActorButton),new UpdateValueStrategy(),updateValueStrategy);
emfDatabindingContext.bindValue(SWTObservables.observeSelection(useLaneActorButton), value, new UpdateValueStrategy(),
new UpdateValueStrategy().setConverter(new BooleanInverserConverter()));
final UpdateValueStrategy updateValueStrategy = new UpdateValueStrategy().setConverter(new BooleanInverserConverter());
emfDatabindingContext.bindValue(SWTObservables.observeEnabled(actorComboViewer.getControl()), SWTObservables.observeSelection(useLaneActorButton),new UpdateValueStrategy(),updateValueStrategy);
databindactorDefinedInLaneLabel(assignable);
}
}
private void databindactorDefinedInLaneLabel(Assignable assignable) {
private void databindactorDefinedInLaneLabel(final Assignable assignable) {
final Lane parentLane = ModelHelper.getParentLane(assignable);
if(parentLane != null){
......@@ -102,7 +90,7 @@ public class AssignableActorsPropertySection extends AbstractActorsPropertySecti
new UpdateValueStrategy().setConverter(new Converter(Object.class, String.class) {
@Override
public String convert(Object fromObject) {
public String convert(final Object fromObject) {
if(fromObject != null){
return "("+((Actor)fromObject).getName()+")";
} else {
......@@ -115,7 +103,7 @@ public class AssignableActorsPropertySection extends AbstractActorsPropertySecti
}
@Override
protected void createRadioComposite(TabbedPropertySheetWidgetFactory widgetFactory,Composite mainComposite) {
protected void createRadioComposite(final TabbedPropertySheetWidgetFactory widgetFactory,final Composite mainComposite) {
radioComposite = widgetFactory.createComposite(mainComposite, SWT.NONE) ;
radioComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).span(3, 1).create()) ;
radioComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).create()) ;
......
......@@ -65,6 +65,7 @@ Export-Package: org.bonitasoft.studio.common,
org.bonitasoft.studio.common.dialog,
org.bonitasoft.studio.common.editingdomain,
org.bonitasoft.studio.common.editor,
org.bonitasoft.studio.common.emf.converter,
org.bonitasoft.studio.common.emf.tools,
org.bonitasoft.studio.common.exporter,
org.bonitasoft.studio.common.extension,
......
/**
* Copyright (C) 2014 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.common.emf.converter;
import org.assertj.core.api.Assertions;
import org.junit.Test;
public class BooleanInverserConverterTest {
@Test
public void testGetToType() {
Assertions.assertThat(new BooleanInverserConverter().getToType()).isEqualTo(Boolean.class);
}
@Test
public void testGetFromType() {
Assertions.assertThat(new BooleanInverserConverter().getFromType()).isEqualTo(Boolean.class);
}
@Test
public void testConvert() {
Assertions.assertThat(new BooleanInverserConverter().convert(true)).isEqualTo(Boolean.FALSE);
Assertions.assertThat(new BooleanInverserConverter().convert(false)).isEqualTo(Boolean.TRUE);
}
}
......@@ -20,7 +20,7 @@ package org.bonitasoft.studio.common;
public class ModelVersion {
public static final String VERSION_6_0_0_ALPHA = "6.0.0-Alpha";
public static final String CURRENT_VERSION = "6.4.0-003";
public static final String CURRENT_VERSION = "6.4.0-004";
public static boolean sameVersion(final String version) {
return CURRENT_VERSION.equals(version);
......
/**
* Copyright (C) 2014 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.common.emf.converter;
import org.eclipse.core.databinding.conversion.Converter;
public class BooleanInverserConverter extends Converter {
public BooleanInverserConverter() {
super(Boolean.class, Boolean.class);
}
@Override
public Object convert(final Object arg0) {
return !((Boolean) arg0);
}
}
......@@ -5,12 +5,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
......@@ -22,6 +22,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bonitasoft.studio.common.emf.converter.BooleanInverserConverter;
import org.bonitasoft.studio.common.emf.tools.ExpressionHelper;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.jface.BonitaStudioFontRegistry;
......@@ -46,7 +47,6 @@ import org.bonitasoft.studio.model.expression.ExpressionPackage;
import org.bonitasoft.studio.model.parameter.Parameter;
import org.bonitasoft.studio.model.process.Data;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.conversion.Converter;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
......@@ -118,21 +118,21 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
@SuppressWarnings("restriction")
private EmbeddedEditor comparisonEditor;
private EObject context;
private final EObject context;
private ComposedAdapterFactory adapterFactory;
private final ComposedAdapterFactory adapterFactory;
private AdapterFactoryLabelProvider adapterLabelProvider;
private final AdapterFactoryLabelProvider adapterLabelProvider;
private Expression inputExpression;
private XtextResource resource;
private Resource eResource;
private final Resource eResource;
private boolean isPageFlowContext = false;
public ComparisonExpressionEditor(Resource eResource, EObject context) {
public ComparisonExpressionEditor(final Resource eResource, final EObject context) {
this.context = context;
this.eResource = eResource;
adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
......@@ -144,7 +144,7 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
* @see org.bonitasoft.studio.expression.editor.provider.IExpressionEditor#createExpressionEditor(org.eclipse.swt.widgets.Composite)
*/
@Override
public Control createExpressionEditor(Composite parent, EMFDataBindingContext ctx) {
public Control createExpressionEditor(final Composite parent, final EMFDataBindingContext ctx) {
final Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
......@@ -155,8 +155,8 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
return mainComposite;
}
protected void createHeader(Composite parent) {
Composite header = new Composite(parent, SWT.NONE);
protected void createHeader(final Composite parent) {
final Composite header = new Composite(parent, SWT.NONE);
header.setLayout(GridLayoutFactory.fillDefaults().create());
header.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
final Label autocompleteMessage = new Label(header, SWT.WRAP);
......@@ -171,8 +171,8 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
}
@SuppressWarnings("restriction")
protected void createComparisonEditor(Composite parent) {
IEditedResourceProvider resourceProvider = new IEditedResourceProvider() {
protected void createComparisonEditor(final Composite parent) {
final IEditedResourceProvider resourceProvider = new IEditedResourceProvider() {
@Override
public XtextResource createResource() {
......@@ -185,23 +185,23 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
resource.setValidationDisabled(false);
final ConditionModelGlobalScopeProvider globalScopeProvider = injector.getInstance(ConditionModelGlobalScopeProvider.class);
final List<String> accessibleObjects = new ArrayList<String>();
for (Data d : ModelHelper.getAccessibleData(context)) {
for (final Data d : ModelHelper.getAccessibleData(context)) {
accessibleObjects.add(ModelHelper.getEObjectID(d));
}
for (Parameter p : ModelHelper.getParentProcess(context).getParameters()) {
for (final Parameter p : ModelHelper.getParentProcess(context).getParameters()) {
accessibleObjects.add(ModelHelper.getEObjectID(p));
}
globalScopeProvider.setAccessibleEObjects(accessibleObjects);
return (XtextResource) resource;
} catch (Exception e) {
return resource;
} catch (final Exception e) {
BonitaStudioLog.error(e, ExpressionEditorPlugin.PLUGIN_ID);
return null;
}
}
};
ConditionModelActivator activator = ConditionModelActivator.getInstance();
Injector injector = activator.getInjector(ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL);
EmbeddedEditorFactory factory = injector.getInstance(EmbeddedEditorFactory.class);
final ConditionModelActivator activator = ConditionModelActivator.getInstance();
final Injector injector = activator.getInjector(ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL);
final EmbeddedEditorFactory factory = injector.getInstance(EmbeddedEditorFactory.class);
final Builder buildEditor = factory.newEditor(resourceProvider);
comparisonEditor = buildEditor.withParent(parent);
......@@ -210,13 +210,13 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
comparisonEditor.getViewer().addTextListener(new ITextListener() {
@Override
public void textChanged(TextEvent event) {
public void textChanged(final TextEvent event) {
comparisonEditor.getViewer().getControl().notifyListeners(SWT.Modify, new Event());
}
});
}
protected void createDependanciesResolutionComposite(Composite parent) {
protected void createDependanciesResolutionComposite(final Composite parent) {
final Composite dependanciesComposite = new Composite(parent, SWT.NONE);
dependanciesComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).create());
dependanciesComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());
......@@ -227,7 +227,7 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
automaticResolutionButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
public void widgetSelected(final SelectionEvent e) {
if (automaticResolutionButton.getSelection()) {
removeDependencyButton.setEnabled(false);
updateDependencies();
......@@ -240,7 +240,7 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
dependencySection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
dependencySection.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
Composite dependenciesComposite = new Composite(dependencySection, SWT.NONE);
final Composite dependenciesComposite = new Composite(dependencySection, SWT.NONE);
dependenciesComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
dependenciesComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());
......@@ -251,14 +251,14 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
dependenciesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
public void selectionChanged(final SelectionChangedEvent event) {
if (!event.getSelection().isEmpty() && !automaticResolutionButton.getSelection()) {
removeDependencyButton.setEnabled(true);
}
}
});
Composite addRemoveComposite = new Composite(dependenciesComposite, SWT.NONE);
final Composite addRemoveComposite = new Composite(dependenciesComposite, SWT.NONE);
addRemoveComposite.setLayoutData(GridDataFactory.fillDefaults().create());
addRemoveComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 0).create());
......@@ -271,8 +271,8 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
removeDependencyButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Object sel : ((IStructuredSelection) dependenciesViewer.getSelection()).toList()) {
public void widgetSelected(final SelectionEvent e) {
for (final Object sel : ((IStructuredSelection) dependenciesViewer.getSelection()).toList()) {
inputExpression.getReferencedElements().remove(sel);
}
}
......@@ -291,11 +291,11 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
final IResourceValidator xtextResourceChecker = injector.getInstance(IResourceValidator.class);
final List<Issue> issues = xtextResourceChecker.validate(resource, CheckMode.NORMAL_AND_FAST, null);
if (issues.isEmpty()) {// Validation is OK
Operation_Compare compareOp = (Operation_Compare) resource.getContents().get(0);
final Operation_Compare compareOp = (Operation_Compare) resource.getContents().get(0);
if (compareOp != null) {
List<Expression_ProcessRef> references = ModelHelper.getAllItemsOfType(compareOp, ConditionModelPackage.Literals.EXPRESSION_PROCESS_REF);
for (Expression_ProcessRef ref : references) {
EObject dep = getResolvedDependency(ref);
final List<Expression_ProcessRef> references = ModelHelper.getAllItemsOfType(compareOp, ConditionModelPackage.Literals.EXPRESSION_PROCESS_REF);
for (final Expression_ProcessRef ref : references) {
final EObject dep = getResolvedDependency(ref);
inputExpression.getReferencedElements().add(ExpressionHelper.createDependencyFromEObject(dep));
}
}
......@@ -306,10 +306,10 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
* @param ref
* @return
*/
private EObject getResolvedDependency(Expression_ProcessRef ref) {
private EObject getResolvedDependency(final Expression_ProcessRef ref) {
EObject dep = resolveProxy(ref.getValue());
List<EObject> orignalDep = ModelHelper.getAllItemsOfType(ModelHelper.getMainProcess(context), dep.eClass());
for (EObject d : orignalDep) {
final List<EObject> orignalDep = ModelHelper.getAllItemsOfType(ModelHelper.getMainProcess(context), dep.eClass());
for (final EObject d : orignalDep) {
if (EcoreUtil.equals(dep, d)) {
dep = d;
break;
......@@ -318,24 +318,24 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
return dep;
}
private EObject resolveProxy(EObject ref) {
private EObject resolveProxy(final EObject ref) {
ResourceSet rSet = null;
if (ref.eIsProxy()) {
rSet = eResource.getResourceSet();
}
EObject dep = EcoreUtil2.resolve(ref, rSet);
final EObject dep = EcoreUtil2.resolve(ref, rSet);
if (rSet != null) {
rSet.getResources().remove(ref.eResource());
}
return dep;
}
protected void createReturnTypeComposite(Composite parent) {
protected void createReturnTypeComposite(final Composite parent) {
final Composite returnTypeComposite = new Composite(parent, SWT.NONE);
returnTypeComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
returnTypeComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.BOTTOM).create());
Label typeLabel = new Label(returnTypeComposite, SWT.NONE);
final Label typeLabel = new Label(returnTypeComposite, SWT.NONE);
typeLabel.setText(Messages.returnType);
typeCombo = new ComboViewer(returnTypeComposite, SWT.BORDER | SWT.READ_ONLY);
......@@ -351,9 +351,9 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
* org.eclipse.emf.ecore.EObject, org.bonitasoft.studio.model.expression.Expression, org.eclipse.jface.viewers.ViewerFilter[])
*/
@Override
public void bindExpression(EMFDataBindingContext dataBindingContext,
EObject context, Expression inputExpression,
ViewerFilter[] viewerTypeFilters, ExpressionViewer expressionViewer) {
public void bindExpression(final EMFDataBindingContext dataBindingContext,
final EObject context, final Expression inputExpression,
final ViewerFilter[] viewerTypeFilters, final ExpressionViewer expressionViewer) {
this.inputExpression = inputExpression;
final IObservableValue contentModelObservable = EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__CONTENT);
final IObservableValue nameModelObservable = EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__NAME);
......@@ -367,7 +367,7 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
observeText.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
public void handleValueChange(final ValueChangeEvent event) {
if (ComparisonExpressionEditor.this.inputExpression.isAutomaticDependencies()) {
updateDependencies();
}
......@@ -376,14 +376,8 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
dataBindingContext.bindValue(observeText, nameModelObservable);
dataBindingContext.bindValue(ViewersObservables.observeInput(dependenciesViewer), dependenciesModelObservable);
UpdateValueStrategy opposite = new UpdateValueStrategy();
opposite.setConverter(new Converter(Boolean.class, Boolean.class) {
@Override
public Object convert(Object fromObject) {
return !((Boolean) fromObject);
}
});
final UpdateValueStrategy opposite = new UpdateValueStrategy();
opposite.setConverter(new BooleanInverserConverter());
dataBindingContext.bindValue(SWTObservables.observeSelection(automaticResolutionButton), autoDepsModelObservable);
dataBindingContext.bindValue(SWTObservables.observeSelection(automaticResolutionButton), SWTObservables.observeEnabled(addDependencyButton), opposite,
......@@ -399,13 +393,13 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
provider.setContext(context);
final Set<Expression> filteredExpressions = new HashSet<Expression>();
Expression[] expressions = provider.getExpressions();
EObject input = provider.getContext();
final Expression[] expressions = provider.getExpressions();
final EObject input = provider.getContext();
if (expressions != null) {
filteredExpressions.addAll(Arrays.asList(expressions));
if (input != null && viewerTypeFilters != null) {
for (Expression exp : expressions) {
for (ViewerFilter filter : viewerTypeFilters) {
for (final Expression exp : expressions) {
for (final ViewerFilter filter : viewerTypeFilters) {
if (filter != null && !filter.select(comparisonEditor.getViewer(), input, exp)) {
filteredExpressions.remove(exp);
}
......@@ -417,8 +411,8 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
addDependencyButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SelectDependencyDialog dialog = new SelectDependencyDialog(Display.getDefault().getActiveShell(), filteredExpressions,
public void widgetSelected(final SelectionEvent e) {
final SelectDependencyDialog dialog = new SelectDependencyDialog(Display.getDefault().getActiveShell(), filteredExpressions,
ComparisonExpressionEditor.this.inputExpression.getReferencedElements());
dialog.open();
}
......@@ -464,7 +458,7 @@ public class ComparisonExpressionEditor extends SelectionAwareExpressionEditor i
}
@Override
public void setIsPageFlowContext(boolean isPageFlowContext) {
public void setIsPageFlowContext(final boolean isPageFlowContext) {