diff options
author | Stéphane Bégaudeau | 2017-03-08 14:18:27 +0000 |
---|---|---|
committer | Stéphane Bégaudeau | 2017-03-30 12:32:13 +0000 |
commit | a5a69d327c368ecaad0af06e1c43ce5a87b3cc85 (patch) | |
tree | 9071dac0fdebf759a8a1a9eaf68bae12f389491d | |
parent | 0ada594db0caa8e8dc7bd5cc2b1f419566c87092 (diff) | |
download | org.eclipse.eef-a5a69d327c368ecaad0af06e1c43ce5a87b3cc85.tar.gz org.eclipse.eef-a5a69d327c368ecaad0af06e1c43ce5a87b3cc85.tar.xz org.eclipse.eef-a5a69d327c368ecaad0af06e1c43ce5a87b3cc85.zip |
[refactoring] Replace IConsumer by java.util.function.Consumer
Change-Id: I2a08f80b07d49242d071d7fe41fac26d9457298f
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
32 files changed, 170 insertions, 174 deletions
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java index 5c0b7ab2e..1ea2f3ed1 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,10 +12,10 @@ package org.eclipse.eef.core.api; import java.util.Collection; import java.util.List; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.core.api.LockStatusChangeEvent.LockStatus; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.domain.EditingDomain; @@ -46,7 +46,7 @@ public interface EditingContextAdapter { * @param listener * the listener to invoke when the model is modified. */ - void registerModelChangeListener(IConsumer<List<Notification>> listener); + void registerModelChangeListener(Consumer<List<Notification>> listener); /** * Unregisters the currently set model change listener. Does nothing if none is currently registered. @@ -69,7 +69,7 @@ public interface EditingContextAdapter { * @param listener * the listener to invoke when elements are locked or unlocked. */ - void addLockStatusChangedListener(IConsumer<Collection<LockStatusChangeEvent>> listener); + void addLockStatusChangedListener(Consumer<Collection<LockStatusChangeEvent>> listener); /** * Removes the given lock status changed listener from the list of all lock status changed listeners.. @@ -77,7 +77,7 @@ public interface EditingContextAdapter { * @param listener * The listener to unregister */ - void removeLockStatusChangedListener(IConsumer<Collection<LockStatusChangeEvent>> listener); + void removeLockStatusChangedListener(Consumer<Collection<LockStatusChangeEvent>> listener); /** * Returns the current locking status of an element. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFController.java index c812e6f54..25f6560b0 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFRuleAuditDescription; @@ -56,7 +57,7 @@ public abstract class AbstractEEFController implements IEEFController { /** * The consumer of the validation messages. */ - private IConsumer<List<IValidationRuleResult>> validationConsumer; + private Consumer<List<IValidationRuleResult>> validationConsumer; /** * The constructor. @@ -86,10 +87,10 @@ public abstract class AbstractEEFController implements IEEFController { /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFController#onValidation(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFController#onValidation(java.util.function.Consumer) */ @Override - public void onValidation(IConsumer<List<IValidationRuleResult>> consumer) { + public void onValidation(Consumer<List<IValidationRuleResult>> consumer) { this.validationConsumer = consumer; } @@ -113,7 +114,7 @@ public abstract class AbstractEEFController implements IEEFController { List<IValidationRuleResult> validationRuleResults = this.getValidationRuleResults(this.getValidationRulesContainer(), this.getValidationRulesReference()); if (this.validationConsumer != null) { - this.validationConsumer.apply(validationRuleResults); + this.validationConsumer.accept(validationRuleResults); } } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFWidgetController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFWidgetController.java index 8eabc21df..9b406cfdc 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFWidgetController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/AbstractEEFWidgetController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + import org.eclipse.eef.EEFWidgetDescription; import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EditingContextAdapter; @@ -28,12 +30,12 @@ public abstract class AbstractEEFWidgetController extends AbstractEEFController /** * The consumer of a new value of the label. */ - protected IConsumer<String> newLabelConsumer; + protected Consumer<String> newLabelConsumer; /** * The consumer of the new value of the help. */ - protected IConsumer<String> newHelpConsumer; + protected Consumer<String> newHelpConsumer; /** * The constructor. @@ -79,10 +81,10 @@ public abstract class AbstractEEFWidgetController extends AbstractEEFController /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFWidgetController#onNewLabel(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFWidgetController#onNewLabel(java.util.function.Consumer) */ @Override - public void onNewLabel(IConsumer<String> consumer) { + public void onNewLabel(Consumer<String> consumer) { this.newLabelConsumer = consumer; } @@ -99,10 +101,10 @@ public abstract class AbstractEEFWidgetController extends AbstractEEFController /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFWidgetController#onNewHelp(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFWidgetController#onNewHelp(java.util.function.Consumer) */ @Override - public void onNewHelp(IConsumer<String> consumer) { + public void onNewHelp(Consumer<String> consumer) { this.newHelpConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IConsumer.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IConsumer.java deleted file mode 100644 index bda83b59b..000000000 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IConsumer.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Obeo. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.eef.core.api.controllers; - -/** - * The consumer is a functional type used to receive an Object of a specific type. - * - * @author sbegaudeau - * @param <T> - * The type of the Object that can be received - */ -public interface IConsumer<T> { - /** - * This operation is called in order to give to the consumer an Object. - * - * @param value - * The Object - */ - void apply(T value); -} diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java index 6b71c1c24..0e67a7054 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFButtonController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + import org.eclipse.core.runtime.IStatus; /** @@ -25,7 +27,7 @@ public interface IEEFButtonController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the button's label */ - void onNewButtonLabel(IConsumer<String> consumer); + void onNewButtonLabel(Consumer<String> consumer); /** * Remove the consumer of the new value of the button's label. @@ -34,7 +36,7 @@ public interface IEEFButtonController extends IEEFWidgetController { /** * Invoked when the user pushes the button. - * + * * @return the status of the pushed execution. */ IStatus pushed(); diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFCheckboxController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFCheckboxController.java index 343e9fb2f..f48e122b7 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFCheckboxController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFCheckboxController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + import org.eclipse.core.runtime.IStatus; /** @@ -35,7 +37,7 @@ public interface IEEFCheckboxController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the checkbox */ - void onNewValue(IConsumer<Boolean> consumer); + void onNewValue(Consumer<Boolean> consumer); /** * Remove the consumer of the new value of the checkbox. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFController.java index e68689eb1..19e093a7a 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.eef.core.api.controllers; import java.util.List; +import java.util.function.Consumer; /** * Common interface of all the controllers. @@ -24,7 +25,7 @@ public interface IEEFController { * @param consumer * The consumer of the validation status */ - void onValidation(IConsumer<List<IValidationRuleResult>> consumer); + void onValidation(Consumer<List<IValidationRuleResult>> consumer); /** * Removes the consumer of the validation. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFGroupController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFGroupController.java index 99041e521..cd1c7270a 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFGroupController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFGroupController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + /** * The EEFGroupController is responsible of supporting the refresh of the label of the group. * @@ -22,7 +24,7 @@ public interface IEEFGroupController extends IEEFController { * @param consumer * The consumer of the new value of the label */ - void onNewLabel(IConsumer<String> consumer); + void onNewLabel(Consumer<String> consumer); /** * Remove the consumer of the new value of the label. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFHyperlinkController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFHyperlinkController.java index 13b55c8d8..251acd40c 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFHyperlinkController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFHyperlinkController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFWidgetAction; @@ -36,7 +38,7 @@ public interface IEEFHyperlinkController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the hyperlink */ - void onNewValue(IConsumer<Object> consumer); + void onNewValue(Consumer<Object> consumer); /** * Remove the consumer of the new value of the hyperlink. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFLabelController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFLabelController.java index 4b647f972..b77736fb2 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFLabelController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFLabelController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFWidgetAction; @@ -26,7 +28,7 @@ public interface IEEFLabelController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the label */ - void onNewValue(IConsumer<String> consumer); + void onNewValue(Consumer<String> consumer); /** * Remove the consumer of the new value of the label. 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 34663ce98..659880aff 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.eef.core.api.controllers; import java.util.List; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFWidgetAction; @@ -27,7 +28,7 @@ public interface IEEFListController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the text */ - void onNewValue(IConsumer<Object> consumer); + void onNewValue(Consumer<Object> consumer); /** * Remove the consumer of the new value of the text. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFMultipleReferencesController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFMultipleReferencesController.java index 10c4b1101..1c2bea5a5 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFMultipleReferencesController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFMultipleReferencesController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.eef.core.api.controllers; import java.util.List; +import java.util.function.Consumer; /** * The IEEFMultipleReferencesController is responsible of supporting all the interactions with the widgets created for a @@ -25,7 +26,7 @@ public interface IEEFMultipleReferencesController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the text */ - void onNewValue(IConsumer<List<Object>> consumer); + void onNewValue(Consumer<List<Object>> consumer); /** * Remove the consumer of the new value of the text. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFRadioController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFRadioController.java index 71fb473df..33aa131c6 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFRadioController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFRadioController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.eef.core.api.controllers; import java.util.List; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; @@ -37,7 +38,7 @@ public interface IEEFRadioController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the text */ - void onNewValue(IConsumer<Object> consumer); + void onNewValue(Consumer<Object> consumer); /** * Register a consumer which will be called with the new value of the candidates when it will change. @@ -45,7 +46,7 @@ public interface IEEFRadioController extends IEEFWidgetController { * @param consumer * The consumer of the new candidates of the combo */ - void onNewCandidates(IConsumer<List<Object>> consumer); + void onNewCandidates(Consumer<List<Object>> consumer); /** * Remove the consumer of the new value of the text. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFSelectController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFSelectController.java index 010af3275..621f1dc28 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFSelectController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFSelectController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.eef.core.api.controllers; import java.util.List; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; @@ -37,7 +38,7 @@ public interface IEEFSelectController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the text */ - void onNewValue(IConsumer<Object> consumer); + void onNewValue(Consumer<Object> consumer); /** * Register a consumer which will be called with the new value of the candidates when it will change. @@ -45,7 +46,7 @@ public interface IEEFSelectController extends IEEFWidgetController { * @param consumer * The consumer of the new candidates of the combo */ - void onNewCandidates(IConsumer<List<Object>> consumer); + void onNewCandidates(Consumer<List<Object>> consumer); /** * Remove the consumer of the new value of the text. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFTextController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFTextController.java index a61b33ca2..5035f3ac9 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFTextController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFTextController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + import org.eclipse.core.runtime.IStatus; /** @@ -37,7 +39,7 @@ public interface IEEFTextController extends IEEFWidgetController { * @param consumer * The consumer of the new value of the text */ - void onNewValue(IConsumer<Object> consumer); + void onNewValue(Consumer<Object> consumer); /** * Remove the consumer of the new value of the text. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFWidgetController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFWidgetController.java index c48c415f4..e776227e0 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFWidgetController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/controllers/IEEFWidgetController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.eef.core.api.controllers; +import java.util.function.Consumer; + /** * The Widget controller is responsible for the refresh of the label of a widget. * @@ -22,7 +24,7 @@ public interface IEEFWidgetController extends IEEFController { * @param consumer * The consumer of the new value of the label */ - void onNewLabel(IConsumer<String> consumer); + void onNewLabel(Consumer<String> consumer); /** * Remove the consumer of the new value of the label. @@ -35,7 +37,7 @@ public interface IEEFWidgetController extends IEEFController { * @param consumer * The consumer of the new value of the help */ - void onNewHelp(IConsumer<String> consumer); + void onNewHelp(Consumer<String> consumer); /** * Removes the consumer of the new value of the help. diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/EvalFactory.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/EvalFactory.java index c7e197670..f899694b2 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/EvalFactory.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/utils/EvalFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,9 +13,9 @@ package org.eclipse.eef.core.api.utils; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.eef.common.api.utils.Util; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.internal.EEFCorePlugin; import org.eclipse.eef.core.internal.Messages; import org.eclipse.emf.ecore.EAttribute; @@ -189,14 +189,14 @@ public final class EvalFactory { * @param consumer * The consumer */ - public void call(String expression, IConsumer<TYPE> consumer) { + public void call(String expression, Consumer<TYPE> consumer) { if (Util.isBlank(expression)) { if (this.eAttribute != null && EEFCorePlugin.getPlugin() != null) { EEFCorePlugin.getPlugin().blank(this.eAttribute); } if (this.defaultValue != null && consumer != null) { - consumer.apply(this.defaultValue); + consumer.accept(this.defaultValue); } return; } @@ -213,7 +213,7 @@ public final class EvalFactory { this.type.getName(), value); EEFCorePlugin.getPlugin().error(message); } - consumer.apply(returnValue); + consumer.accept(returnValue); } } else if (EEFCorePlugin.getPlugin() != null) { EEFCorePlugin.getPlugin().diagnostic(expression, evaluationResult.getDiagnostic()); diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java index 3786f5d22..88df54891 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFPageImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,7 @@ import com.google.common.collect.Iterables; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; import org.eclipse.eef.EEFGroupDescription; import org.eclipse.eef.EEFPageDescription; @@ -23,7 +24,6 @@ import org.eclipse.eef.core.api.EEFGroup; import org.eclipse.eef.core.api.EEFPage; import org.eclipse.eef.core.api.EEFView; import org.eclipse.eef.core.api.IEEFDomainClassTester; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.sirius.common.interpreter.api.IInterpreter; import org.eclipse.sirius.common.interpreter.api.IVariableManager; @@ -105,7 +105,7 @@ public class EEFPageImpl implements EEFPage { Boolean preconditionValid = EvalFactory.of(this.interpreter, this.variableManager).logIfInvalidType(Boolean.class) .evaluate(preconditionExpression); if (preconditionValid == null || preconditionValid.booleanValue()) { - IConsumer<Object> consumer = (value) -> { + Consumer<Object> consumer = (value) -> { DomainClassPredicate domainClassPredicate = new DomainClassPredicate(eefGroupDescription.getDomainClass(), domainClassTester); Iterable<Object> iterable = Util.asIterable(value, Object.class); Iterable<Object> objects = Iterables.filter(iterable, domainClassPredicate); diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java index 86ea39fcf..0cbd6b985 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/EEFViewImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,6 +15,7 @@ import com.google.common.collect.Iterables; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.function.Consumer; import org.eclipse.eef.EEFPageDescription; import org.eclipse.eef.EEFViewDescription; @@ -26,7 +27,6 @@ import org.eclipse.eef.core.api.EEFView; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.IEEFDomainClassTester; import org.eclipse.eef.core.api.InputDescriptor; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.common.interpreter.api.IInterpreter; @@ -104,7 +104,7 @@ public class EEFViewImpl implements EEFView { Boolean preconditionValid = EvalFactory.of(this.interpreter, this.variableManager).logIfInvalidType(Boolean.class) .evaluate(preconditionExpression); if (preconditionValid == null || preconditionValid.booleanValue()) { - IConsumer<Object> consumer = (value) -> { + Consumer<Object> consumer = (value) -> { DomainClassPredicate domainClassPredicate = new DomainClassPredicate(eefPageDescription.getDomainClass(), domainClassTester); Iterable<Object> iterable = Util.asIterable(value, Object.class); Iterable<Object> objects = Iterables.filter(iterable, domainClassPredicate); @@ -186,7 +186,7 @@ public class EEFViewImpl implements EEFView { // All your update process for EEFPages need to be updated. It's not simple in any way or shape, I know. for (final EEFPage eefPage : this.eefPages) { - IConsumer<Object> pageConsumer = (value) -> Util.asIterable(value, Object.class).forEach(pageSemanticCandidate -> { + Consumer<Object> pageConsumer = (value) -> Util.asIterable(value, Object.class).forEach(pageSemanticCandidate -> { eefPage.getVariableManager().put(EEFExpressionUtils.SELF, pageSemanticCandidate); }); @@ -199,7 +199,7 @@ public class EEFViewImpl implements EEFView { for (final EEFGroup eefGroup : groups) { // FIXME We need only one semantic candidate, so we just take the last one available as self // as we did for the pages just before - IConsumer<Object> groupConsumer = (value) -> Util.asIterable(value, Object.class).forEach(groupSemanticCandidate -> { + Consumer<Object> groupConsumer = (value) -> Util.asIterable(value, Object.class).forEach(groupSemanticCandidate -> { eefGroup.getVariableManager().put(EEFExpressionUtils.SELF, groupSemanticCandidate); }); diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java index 8a5a40ab2..87796ddd4 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFButtonController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,13 +10,14 @@ *******************************************************************************/ package org.eclipse.eef.core.internal.controllers; +import java.util.function.Consumer; + import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFButtonDescription; import org.eclipse.eef.EEFWidgetDescription; import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFButtonController; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.sirius.common.interpreter.api.IInterpreter; @@ -36,7 +37,7 @@ public class EEFButtonController extends AbstractEEFWidgetController implements /** * The consumer of a new value of the button's label. */ - private IConsumer<String> newButtonLabelConsumer; + private Consumer<String> newButtonLabelConsumer; /** * The constructor. @@ -57,7 +58,7 @@ public class EEFButtonController extends AbstractEEFWidgetController implements } @Override - public void onNewButtonLabel(IConsumer<String> consumer) { + public void onNewButtonLabel(Consumer<String> consumer) { this.newButtonLabelConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFCheckboxController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFCheckboxController.java index 3a50029b9..c049dabb9 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFCheckboxController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFCheckboxController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ package org.eclipse.eef.core.internal.controllers; import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFCheckboxDescription; @@ -20,7 +21,6 @@ import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFCheckboxController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EAttribute; @@ -41,7 +41,7 @@ public class EEFCheckboxController extends AbstractEEFWidgetController implement /** * The consumer of a new value of the checkbox. */ - private IConsumer<Boolean> newValueConsumer; + private Consumer<Boolean> newValueConsumer; /** * The constructor. @@ -91,10 +91,10 @@ public class EEFCheckboxController extends AbstractEEFWidgetController implement /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(java.util.function.Consumer) */ @Override - public void onNewValue(IConsumer<Boolean> consumer) { + public void onNewValue(Consumer<Boolean> consumer) { this.newValueConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFGroupController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFGroupController.java index 74e1f28a6..1f7d90b82 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFGroupController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFGroupController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,11 +10,12 @@ *******************************************************************************/ package org.eclipse.eef.core.internal.controllers; +import java.util.function.Consumer; + import org.eclipse.eef.EEFGroupDescription; import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFGroupController; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; @@ -36,7 +37,7 @@ public class EEFGroupController extends AbstractEEFController implements IEEFGro /** * The label consumer. */ - private IConsumer<String> newLabelConsumer; + private Consumer<String> newLabelConsumer; /** * The constructor. @@ -59,10 +60,10 @@ public class EEFGroupController extends AbstractEEFController implements IEEFGro /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFGroupController#onNewLabel(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFGroupController#onNewLabel(java.util.function.Consumer) */ @Override - public void onNewLabel(IConsumer<String> consumer) { + public void onNewLabel(Consumer<String> consumer) { this.newLabelConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFHyperlinkController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFHyperlinkController.java index acb3de57c..3456862c0 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFHyperlinkController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFHyperlinkController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,6 +13,7 @@ package org.eclipse.eef.core.internal.controllers; import java.util.HashMap; import java.util.Map; import java.util.Optional; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFHyperlinkDescription; @@ -23,7 +24,6 @@ import org.eclipse.eef.common.api.utils.Util; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFHyperlinkController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EAttribute; @@ -44,7 +44,7 @@ public class EEFHyperlinkController extends AbstractEEFWidgetController implemen /** * The consumer of a new value of the text. */ - private IConsumer<Object> newValueConsumer; + private Consumer<Object> newValueConsumer; /** * The constructor. @@ -75,7 +75,7 @@ public class EEFHyperlinkController extends AbstractEEFWidgetController implemen String valueExpression = this.description.getValueExpression(); Object valueExpressionResult = this.newEval().evaluate(valueExpression); - this.newValueConsumer.apply(valueExpressionResult); + this.newValueConsumer.accept(valueExpressionResult); } /** @@ -118,10 +118,10 @@ public class EEFHyperlinkController extends AbstractEEFWidgetController implemen /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(java.util.function.Consumer) */ @Override - public void onNewValue(IConsumer<Object> consumer) { + public void onNewValue(Consumer<Object> consumer) { this.newValueConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFLabelController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFLabelController.java index 8f6b92a92..b89398869 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFLabelController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFLabelController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ package org.eclipse.eef.core.internal.controllers; import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFLabelDescription; @@ -22,7 +23,6 @@ import org.eclipse.eef.common.api.utils.Util; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFLabelController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EAttribute; @@ -43,7 +43,7 @@ public class EEFLabelController extends AbstractEEFWidgetController implements I /** * The consumer of the new body. */ - private IConsumer<String> newValueConsumer; + private Consumer<String> newValueConsumer; /** * The constructor. @@ -83,7 +83,7 @@ public class EEFLabelController extends AbstractEEFWidgetController implements I variables.put(EEFExpressionUtils.EEFReference.VALUE, valueExpressionResult); EvalFactory.of(this.interpreter, variables).logIfInvalidType(String.class).call(displayExpression, this.newValueConsumer); } else if (valueExpressionResult != null) { - this.newValueConsumer.apply(valueExpressionResult.toString()); + this.newValueConsumer.accept(valueExpressionResult.toString()); } } @@ -103,7 +103,7 @@ public class EEFLabelController extends AbstractEEFWidgetController implements I * @see org.eclipse.eef.core.api.controllers.IEEFLabelController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) */ @Override - public void onNewValue(IConsumer<String> consumer) { + public void onNewValue(Consumer<String> consumer) { this.newValueConsumer = consumer; } 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 21aa00ed2..3841501a5 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,6 +13,7 @@ package org.eclipse.eef.core.internal.controllers; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFListDescription; @@ -22,7 +23,6 @@ import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFListController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EAttribute; @@ -43,7 +43,7 @@ public class EEFListController extends AbstractEEFWidgetController implements IE /** * The consumer of a new value of the list. */ - private IConsumer<Object> newValueConsumer; + private Consumer<Object> newValueConsumer; /** * The constructor. @@ -82,7 +82,7 @@ public class EEFListController extends AbstractEEFWidgetController implements IE * @see org.eclipse.eef.core.api.controllers.IEEFListController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) */ @Override - public void onNewValue(IConsumer<Object> consumer) { + public void onNewValue(Consumer<Object> consumer) { this.newValueConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFRadioController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFRadioController.java index a9c524c3f..d63debba4 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFRadioController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFRadioController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFRadioDescription; @@ -22,7 +23,6 @@ import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFRadioController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EAttribute; @@ -43,12 +43,12 @@ public class EEFRadioController extends AbstractEEFWidgetController implements I /** * The consumer of a new value of the combo. */ - private IConsumer<Object> newValueConsumer; + private Consumer<Object> newValueConsumer; /** * The consumer of a new candidates of the combo. */ - private IConsumer<List<Object>> newCandidatesConsumer; + private Consumer<List<Object>> newCandidatesConsumer; /** * The constructor. @@ -99,7 +99,7 @@ public class EEFRadioController extends AbstractEEFWidgetController implements I ((Iterable<?>) value).forEach(object -> candidates.add(object)); - this.newCandidatesConsumer.apply(candidates); + this.newCandidatesConsumer.accept(candidates); } }); @@ -110,20 +110,20 @@ public class EEFRadioController extends AbstractEEFWidgetController implements I /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.EEFTextController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.EEFTextController#onNewValue(java.util.function.Consumer) */ @Override - public void onNewValue(IConsumer<Object> consumer) { + public void onNewValue(Consumer<Object> consumer) { this.newValueConsumer = consumer; } /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.EEFTextController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.EEFTextController#onNewValue(java.util.function.Consumer) */ @Override - public void onNewCandidates(IConsumer<List<Object>> consumer) { + public void onNewCandidates(Consumer<List<Object>> consumer) { this.newCandidatesConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFSelectController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFSelectController.java index 018b2ab3d..c140fffcc 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFSelectController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFSelectController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFSelectDescription; @@ -24,7 +25,6 @@ import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFSelectController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EAttribute; @@ -45,12 +45,12 @@ public class EEFSelectController extends AbstractEEFWidgetController implements /** * The consumer of a new value of the combo. */ - private IConsumer<Object> newValueConsumer; + private Consumer<Object> newValueConsumer; /** * The consumer of a new candidates of the combo. */ - private IConsumer<List<Object>> newCandidatesConsumer; + private Consumer<List<Object>> newCandidatesConsumer; /** * The constructor. @@ -102,7 +102,7 @@ public class EEFSelectController extends AbstractEEFWidgetController implements Iterators.addAll(candidates, ((Iterable<?>) value).iterator()); - this.newCandidatesConsumer.apply(candidates); + this.newCandidatesConsumer.accept(candidates); } }); @@ -113,20 +113,20 @@ public class EEFSelectController extends AbstractEEFWidgetController implements /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(java.util.function.Consumer) */ @Override - public void onNewValue(IConsumer<Object> consumer) { + public void onNewValue(Consumer<Object> consumer) { this.newValueConsumer = consumer; } /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(java.util.function.Consumer) */ @Override - public void onNewCandidates(IConsumer<List<Object>> consumer) { + public void onNewCandidates(Consumer<List<Object>> consumer) { this.newCandidatesConsumer = consumer; } diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextController.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextController.java index ecfd50de1..f9654ef39 100644 --- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextController.java +++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/internal/controllers/EEFTextController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ package org.eclipse.eef.core.internal.controllers; import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.core.runtime.IStatus; import org.eclipse.eef.EEFTextDescription; @@ -20,7 +21,6 @@ import org.eclipse.eef.EefPackage; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFTextController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.emf.ecore.EAttribute; @@ -41,7 +41,7 @@ public class EEFTextController extends AbstractEEFWidgetController implements IE /** * The consumer of a new value of the text. */ - private IConsumer<Object> newValueConsumer; + private Consumer<Object> newValueConsumer; /** * The constructor. @@ -91,10 +91,10 @@ public class EEFTextController extends AbstractEEFWidgetController implements IE /** * {@inheritDoc} * - * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(org.eclipse.eef.core.api.controllers.IConsumer) + * @see org.eclipse.eef.core.api.controllers.IEEFTextController#onNewValue(java.util.function.Consumer) */ @Override - public void onNewValue(IConsumer<Object> consumer) { + public void onNewValue(Consumer<Object> consumer) { this.newValueConsumer = consumer; } 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 64ac4e3b3..7414fdffe 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ package org.eclipse.eef.ide.ui.api.widgets; import java.util.Collection; import java.util.Optional; +import java.util.function.Consumer; import org.eclipse.eef.EEFDynamicMappingFor; import org.eclipse.eef.EEFDynamicMappingIf; @@ -25,7 +26,6 @@ import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.LockStatusChangeEvent; import org.eclipse.eef.core.api.LockStatusChangeEvent.LockStatus; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.controllers.IEEFWidgetController; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.eef.ide.ui.api.widgets.EEFStyleHelper.IEEFTextStyleCallback; @@ -98,7 +98,7 @@ public abstract class AbstractEEFWidgetLifecycleManager extends AbstractEEFLifec /** * The listener used to react to changes in the lock status of a semantic element. */ - private IConsumer<Collection<LockStatusChangeEvent>> lockStatusChangedListener; + private Consumer<Collection<LockStatusChangeEvent>> lockStatusChangedListener; /** * The decorator used to indicate the permission on the validation widget. @@ -317,7 +317,7 @@ public abstract class AbstractEEFWidgetLifecycleManager extends AbstractEEFLifec this.lockStatusChangedListener = (events) -> { Display.getDefault().asyncExec(() -> { events.stream().filter(event -> this.getWidgetSemanticElement().equals(event.getElement())) - .forEach(event -> this.handleLockStatus(event.getStatus())); + .forEach(event -> this.handleLockStatus(event.getStatus())); }); }; this.editingContextAdapter.addLockStatusChangedListener(this.lockStatusChangedListener); diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/Updater.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/Updater.java index 423c32d5d..6997e197f 100644 --- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/Updater.java +++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/Updater.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,9 +11,9 @@ package org.eclipse.eef.ide.ui.internal; import java.util.List; +import java.util.function.Consumer; import org.eclipse.eef.common.ui.api.IEEFFormContainer; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.ide.ui.api.EEFTab; import org.eclipse.emf.common.notify.Notification; @@ -23,7 +23,7 @@ import org.eclipse.emf.common.notify.Notification; * * @author pcdavid */ -public class Updater implements IConsumer<List<Notification>> { +public class Updater implements Consumer<List<Notification>> { /** * The top-level page the section is part of. @@ -64,7 +64,7 @@ public class Updater implements IConsumer<List<Notification>> { } @Override - public void apply(List<Notification> value) { + public void accept(List<Notification> value) { formContainer.refreshPage(); } }
\ No newline at end of file diff --git a/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/ColorPickerController.java b/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/ColorPickerController.java index 7c16e7f39..a71a5b3a0 100644 --- a/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/ColorPickerController.java +++ b/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/ColorPickerController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,12 +12,12 @@ package org.eclipse.eef.sample.custom.widget.colorpicker; import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; import org.eclipse.eef.EEFCustomWidgetDescription; import org.eclipse.eef.core.api.EEFExpressionUtils; import org.eclipse.eef.core.api.EditingContextAdapter; import org.eclipse.eef.core.api.controllers.AbstractEEFCustomWidgetController; -import org.eclipse.eef.core.api.controllers.IConsumer; import org.eclipse.eef.core.api.utils.EvalFactory; import org.eclipse.sirius.common.interpreter.api.IInterpreter; import org.eclipse.sirius.common.interpreter.api.IVariableManager; @@ -54,7 +54,7 @@ public class ColorPickerController extends AbstractEEFCustomWidgetController imp /** * The consumer of a new value of the color. */ - private IConsumer<Color> newValueConsumer; + private Consumer<Color> newValueConsumer; /** * The constructor. @@ -95,7 +95,7 @@ public class ColorPickerController extends AbstractEEFCustomWidgetController imp green = Integer.parseInt(rgb[1]); blue = Integer.parseInt(rgb[2]); Color color = ColorHelper.getColor(red, green, blue); - ColorPickerController.this.newValueConsumer.apply(color); + ColorPickerController.this.newValueConsumer.accept(color); } catch (NumberFormatException e) { // TODO Log warning about unexpected result format from the expression. } @@ -105,7 +105,7 @@ public class ColorPickerController extends AbstractEEFCustomWidgetController imp } @Override - public void onNewValue(IConsumer<Color> consumer) { + public void onNewValue(Consumer<Color> consumer) { this.newValueConsumer = consumer; } diff --git a/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/IColorPickerController.java b/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/IColorPickerController.java index e21c49a30..3e4ccb986 100644 --- a/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/IColorPickerController.java +++ b/samples/org.eclipse.eef.sample.custom.widget.colorpicker/src/org/eclipse/eef/sample/custom/widget/colorpicker/IColorPickerController.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 Obeo. + * Copyright (c) 2016, 2017 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,38 +10,38 @@ *******************************************************************************/ package org.eclipse.eef.sample.custom.widget.colorpicker; -import org.eclipse.eef.core.api.controllers.IConsumer; +import java.util.function.Consumer; + import org.eclipse.eef.core.api.controllers.IEEFWidgetController; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; /** - * The IColorPickerController is responsible of supporting all the interactions - * with the widgets created for a color picker. + * The IColorPickerController is responsible of supporting all the interactions with the widgets created for a color + * picker. * * @author mbats */ public interface IColorPickerController extends IEEFWidgetController { - /** - * Register a consumer which will be called with the new value of the text - * when it will change. - * - * @param consumer - * The consumer of the new value of the text - */ - void onNewValue(IConsumer<Color> consumer); + /** + * Register a consumer which will be called with the new value of the text when it will change. + * + * @param consumer + * The consumer of the new value of the text + */ + void onNewValue(Consumer<Color> consumer); - /** - * Remove the consumer of the new value of the text. - */ - void removeNewValueConsumer(); + /** + * Remove the consumer of the new value of the text. + */ + void removeNewValueConsumer(); - /** - * Update the value of the text. - * - * @param selected - * The new value of the color - */ - void updateValue(RGB selected); + /** + * Update the value of the text. + * + * @param selected + * The new value of the color + */ + void updateValue(RGB selected); } |