Skip to content
Snippets Groups Projects
Commit 5d913ead authored by Andreas Bayha's avatar Andreas Bayha
Browse files

PrototypeService: Sub-categories made unique

The sub-categories for prototypes were not forced to be unique. Hence,
every update of the prototypes created redundant copies which polluted
the model element view and ultimately slowed down the UI.

Issue-ref: 4349
Issue-URL: af3#4349



Signed-off-by: default avatarAndreas Bayha <bayha@fortiss.org>
parent 8ea4980a
No related branches found
No related tags found
1 merge request!2214349
Pipeline #39696 passed
Pipeline: maven-releng

#39697

    ......@@ -8,7 +8,7 @@ LogMessage.java 14204ed9d51b356f50be52362247cfbbe0cbd5c7 GREEN
    ModelElementTransformationContext.java 5a41bd3a75ce434c3174d50d2fdfab28b66f09f2 GREEN
    ModelStorageError.java 2aef480044047e960e64811111a7f27310011cc2 GREEN
    Prototype.java f4b13f86b7511edacc138053ffb80cecbac70868 GREEN
    PrototypeCategory.java ca500b4816ed42b9536488669aeab89561d2f08c GREEN
    PrototypeCategory.java 46dd77d2481862c622e463a89cd3aae6bd3f2971 YELLOW
    TransformationProviderChain.java 67ec6d0b4c23d295323572649606d79f3b897437 GREEN
    TutorialAtomicStep.java 09c0d6597d542b431b5bbdc790ee9e533d9f77fb GREEN
    TutorialCompositeStep.java cc61c2e86eff310762acac4d023fd709507355c8 GREEN
    ......
    ......@@ -16,7 +16,9 @@
    package org.fortiss.tooling.kernel.extension.data;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    /**
    * Container object for prototypes of a certain category.
    ......@@ -37,8 +39,8 @@ public class PrototypeCategory {
    /** Stores the prototypes affiliated with this category. */
    private List<Prototype> children = new ArrayList<Prototype>();
    /** Stores the sub-categories of this category. */
    private List<PrototypeCategory> subCategories = new ArrayList<PrototypeCategory>();
    /** Stores the mapping of sub-category names to sub-categories for this category. */
    private Map<String, PrototypeCategory> subCategories = new HashMap<String, PrototypeCategory>();
    /** Constructor. */
    public PrototypeCategory(String category) {
    ......@@ -61,9 +63,15 @@ public class PrototypeCategory {
    children.add(prototype);
    }
    /** Adds sub-category. */
    /**
    * Adds the given sub-category to this category. In case a sub-category of the same name already
    * exists, it will be replaced.
    *
    * @param subCat
    * The sub-{@link PrototypeCategory} to be added.
    */
    public void add(PrototypeCategory subCat) {
    subCategories.add(subCat);
    subCategories.put(subCat.getName(), subCat);
    }
    /** Replaces an existing prototype with a new one. */
    ......@@ -78,7 +86,7 @@ public class PrototypeCategory {
    public Object[] getChildren() {
    List<Object> result = new ArrayList<Object>();
    result.addAll(children);
    result.addAll(subCategories);
    result.addAll(subCategories.values());
    return result.toArray();
    }
    ......
    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