Skip to content
Snippets Groups Projects
Commit d8098950 authored by Simon Barner's avatar Simon Barner
Browse files

Avoid concurrent access to list of targets

Issue-Ref: 4141
Issue-Url: af3#4141



Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent fd9b3539
No related branches found
No related tags found
1 merge request!1454141: Avoid concurrent access to list of targets
Pipeline #30915 passed
Pipeline: maven-releng

#30916

    This commit is part of merge request !145. Comments created here will be created in the context of that merge request.
    ContextMenuSubMenuContributorBase.java 6275d96fe8690d9d4744bcbaef3c7d14ba8e30ff GREEN
    DialogMessageHandler.java 8714da09a777c8557de0a5c48ff68c340f9fa91d GREEN
    EObjectActionBase.java 4ef9f8be59e64d4838acc9e268d418ba5d94fa1a GREEN
    EObjectActionBase.java dba517c7527d71637239483dbe15b447fd1e6b19 YELLOW
    EReferenceListPropertySectionBase.java 7390dd7bfdc979e8ff0c5c30c67ab7b6c9d70c92 GREEN
    EReferencePropertySectionBase.java 0548da6778516003257f59d0b4c2b60d458be3b6 GREEN
    EditorBase.java 9c09fff92945256bb8680992ae7bb2c78f47b150 GREEN
    ......
    ......@@ -16,6 +16,7 @@
    package org.fortiss.tooling.kernel.ui.extension.base;
    import static java.util.Arrays.asList;
    import static org.eclipse.emf.common.util.ECollections.unmodifiableEList;
    import java.util.List;
    ......@@ -66,7 +67,7 @@ public abstract class EObjectActionBase<T extends EObject> extends Action {
    }
    /** Sets the target object. */
    public void setTargets(List<T> newTargets) {
    public synchronized void setTargets(List<T> newTargets) {
    if(targets == null) {
    targets = new BasicEList<T>(newTargets);
    } else {
    ......@@ -82,14 +83,16 @@ public abstract class EObjectActionBase<T extends EObject> extends Action {
    /** Returns the current target. */
    public T getTarget() {
    List<T> targets = getTargets();
    // For actions that cannot deal with multiple selections, only the first
    // item is picked, hence the get(0)
    return(targets.isEmpty() ? null : targets.get(0));
    }
    /** Returns the current targets. */
    public EList<T> getTargets() {
    return targets;
    public synchronized EList<T> getTargets() {
    return unmodifiableEList(targets);
    }
    /** Refreshes the enabled state for the current action target. */
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment