Skip to content
Snippets Groups Projects
Commit 05970682 authored by Tiziano Munaro's avatar Tiziano Munaro
Browse files

Merge remote-tracking branch 'origin/master' into 4319

parents 7072990f 9893c900
No related branches found
No related tags found
1 merge request!2054319
Pipeline #39202 failed
Showing
with 327 additions and 176 deletions
ReuseLibraryModelElementFactory.java 4ee3eb7449e212643992a3dec6cfb8f4278efb70 GREEN
ReuseLibraryUtilsBasics.java b651b31f6d94ff98a8f965440d662bfc4655c31b GREEN
ReuseLibraryUtilsBasics.java 1d60936f98bd09e1ba1715192f5263f89b4942fe GREEN
ReuseLibraryUtilsManipulation.java 77a646db5a63ba7c61664dbcaf34a9036003fde5 GREEN
CrossFeatureConstraintPropertySectionBase.java 37e772fb3471f85320170d373cbe2f319c350655 GREEN
FeaturePropertySectionBase.java 598842b12b5bbb6f3cf2461a4d05fc721b637f54 GREEN
FeaturePropertySectionBase.java 9b338ff5ab4c70179d406bc0d76b8c62a1dbc8ae GREEN
HasPresenceConditionPropertySectionBase.java ef300f0d9294d76f5d80e45b8cc0d94c24586a24 GREEN
......@@ -56,6 +56,7 @@ public class FeaturePropertySectionBase extends PropertySectionBase {
if(feature.eContainer() instanceof AbstractAlternativeFeature ||
feature instanceof AbstractFeatureModel) {
optionalCheckbox.setEnabled(false);
optionalCheckbox.setSelection(false);
} else {
optionalCheckbox.setEnabled(true);
optionalCheckbox.setSelection(feature.isOptional());
......
......@@ -3,6 +3,6 @@ ConstraintViolationBase.java ec66973ab2183623f0cd4a85c59c886dddad6cf6 GREEN
DialogMessage.java 8420640e999e4fb15fa644333e5d71e1d16c2559 GREEN
ElementCompositorBase.java 7a445e5adde11878fe0515baca8b915287149b28 GREEN
MultiViolationConstraintCheckerBase.java 30886a94c99cf8948f64401b1db821abe06e1e6c GREEN
PrototypeProviderBase.java 4625d5ed40d3bcadfc6dda3ed4cc1f3873a23307 GREEN
PrototypeProviderBase.java 7418c494275bf75318504de65e82035535b9e9d8 GREEN
TransformationContextChainBase.java 1ef37880ab275778c563928e80ba378fec964cb6 GREEN
TransformationProviderBase.java 9e91100cc1f2c8fbd8d41af55aedfea34e02ff71 GREEN
......@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.OptionalInt;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.kernel.extension.IPrototypeProvider;
......@@ -65,9 +66,13 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider {
/** Registers the given {@link EObject} with the given name and category. */
protected final void registerPrototype(String name, EObject prototype, String categoryName) {
Prototype prototypeObject = new Prototype(name, prototype, false);
prototypes.add(prototypeObject);
registerElementInCategory(prototypeObject, categoryName);
registerPrototype(name, prototype, categoryName, false, OptionalInt.empty());
}
/** Registers the given {@link EObject} with the given name, category, and priority. */
protected final void registerPrototype(String name, EObject prototype, String categoryName,
int priority) {
registerPrototype(name, prototype, categoryName, false, OptionalInt.of(priority));
}
/**
......@@ -76,7 +81,27 @@ public abstract class PrototypeProviderBase implements IPrototypeProvider {
*/
protected final void registerPrimaryPrototype(String name, EObject prototype,
String categoryName) {
Prototype prototypeObject = new Prototype(name, prototype, true);
registerPrototype(name, prototype, categoryName, true, OptionalInt.empty());
}
/**
* Registers the given {@link EObject} with the given name and priority as primary prototype
* with the given category.
*/
protected final void registerPrimaryPrototype(String name, EObject prototype,
String categoryName, int priority) {
registerPrototype(name, prototype, categoryName, true, OptionalInt.of(priority));
}
/** Base method that actually performs the registration of prototypes. */
private final void registerPrototype(String name, EObject prototype, String categoryName,
boolean primary, OptionalInt priority) {
Prototype prototypeObject;
if(priority.isPresent()) {
prototypeObject = new Prototype(name, prototype, primary, priority.getAsInt());
} else {
prototypeObject = new Prototype(name, prototype, primary);
}
prototypes.add(prototypeObject);
registerElementInCategory(prototypeObject, categoryName);
}
......
......@@ -7,7 +7,7 @@ ITransformationContext.java f00a0ab19a410c3ae2fc6256483aeb4207a86395 GREEN
LogMessage.java 14204ed9d51b356f50be52362247cfbbe0cbd5c7 GREEN
ModelElementTransformationContext.java 5a41bd3a75ce434c3174d50d2fdfab28b66f09f2 GREEN
ModelStorageError.java 2aef480044047e960e64811111a7f27310011cc2 GREEN
Prototype.java 5b91ecc45950569a19371470d0e3ae44cca86cf3 GREEN
Prototype.java f4b13f86b7511edacc138053ffb80cecbac70868 GREEN
PrototypeCategory.java ca500b4816ed42b9536488669aeab89561d2f08c GREEN
TransformationProviderChain.java 67ec6d0b4c23d295323572649606d79f3b897437 GREEN
TutorialAtomicStep.java 09c0d6597d542b431b5bbdc790ee9e533d9f77fb GREEN
......
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
| Copyright 2023 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......@@ -35,36 +35,53 @@ public class Prototype {
/** Flag for primary class prototypes. */
private final boolean isPrimary;
/** Stores the priority of the category. Is important for sorting: lower value = lower prio. */
private final int prototypePriority;
/** Constructor. */
public Prototype(String name, EObject prototype, boolean isPrimary) {
this.name = name;
this.prototype = prototype;
this.isPrimary = isPrimary;
this.prototypePriority = 0;
}
/** Constructor with priority. */
public Prototype(String name, EObject prototype, boolean isPrimary, int priority) {
this.name = name;
this.prototype = prototype;
this.isPrimary = isPrimary;
this.prototypePriority = priority;
}
/** Returns the {@link Prototype}'s name. */
public String getName() {
return name;
return this.name;
}
/** Returns the {@link Prototype} instance (NOT a copy!). */
public EObject getPrototype() {
return prototype;
return this.prototype;
}
/** Returns a copy of the {@link Prototype}. This method is potentially expensive. */
public EObject getPrototypeCopy() {
return copy(prototype);
return copy(this.prototype);
}
/** Returns the priority of the prototype. */
public int getPriority() {
return this.prototypePriority;
}
/** {@inheritDoc} */
@Override
public String toString() {
return "Prototype for: " + name;
return "Prototype for: " + this.name;
}
/** Returns whether this {@link Prototype} is a primary one or not. */
public boolean isPrimary() {
return isPrimary;
return this.isPrimary;
}
}
CommandLineInterfaceService.java 6b5c94c52702f773c60b181eff52204ab379b248 GREEN
CommandStackService.java 957bda69b5feb91f002aed4d25ed334e92801e7e GREEN
ConnectionCompositorService.java 5a52f8a3e88c167ae6909c3d9eb3fb4706177e8b GREEN
ConstraintCheckerService.java abd4667ceef11c47235e20a6566d8943f3417cf3 GREEN
ConstraintCheckerService.java df7b4e8c99e8895e14ff45a96cc85ef8403a8658 GREEN
DummyTopLevelElement.java 21807bbdafec2e0ef28f0ee9090218f90bd73aee GREEN
ElementCompositorService.java b1924b5b349118a70149cfac5b48544897d26e9e GREEN
LoggingService.java da784259f7b456b54bf75c41ec268f64919ce78d GREEN
......
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
| Copyright 2023 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......@@ -17,6 +17,7 @@ package org.fortiss.tooling.kernel.internal;
import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableMap;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstParentWithType;
import java.util.ArrayList;
import java.util.Collections;
......@@ -60,6 +61,13 @@ public class ConstraintCheckerService extends EObjectAwareServiceBase<IConstrain
/** The constraint checker handler attribute name. */
private static final String HANDLER_CLASS_ATTRIBUTE_NAME = "checker";
/**
* A list of all the classes whose elements are excluded from constraint checks. This exclusion
* also applies to all of their children, i.e., if an element has a parent whose class is stored
* in this list, it will also be excluded from all constraint checks.
*/
private static List<Class<? extends EObject>> constraintCheckExclusionTypes = new ArrayList<>();
/** {@inheritDoc} */
@Override
public void startService() {
......@@ -73,6 +81,12 @@ public class ConstraintCheckerService extends EObjectAwareServiceBase<IConstrain
addHandler(modelElementClass, checker);
}
/** {@inheritDoc} */
@Override
public void registerTypeAsExcludedParentForConstraintChecks(Class<? extends EObject> clazz) {
constraintCheckExclusionTypes.add(clazz);
}
/** {@inheritDoc} */
@Override
public String getIntrospectionDescription() {
......@@ -109,12 +123,23 @@ public class ConstraintCheckerService extends EObjectAwareServiceBase<IConstrain
}
/**
* Performs all constraint checks on the given model element. Violations are
* added to the given list. Constraint checks on content elements are not
* considered.
* Performs all constraint checks on the given model element if itself or its parents are not
* excluded from such checks. Violations are added to the given list. Constraint checks on
* content elements are not considered.
*/
private void performConstraintCheck(EObject modelElement,
List<IConstraintViolation<? extends EObject>> violationList) {
// Skip constraint checks if the given element itself is excluded from checks or if it
// exists within an excluded element.
for(Class<? extends EObject> excludedClass : constraintCheckExclusionTypes) {
Object foundExcludedParent = getFirstParentWithType(modelElement, excludedClass);
Class<?> givenClass = modelElement.getClass();
if(givenClass.isAssignableFrom(excludedClass) || foundExcludedParent != null) {
return;
}
}
List<IConstraintChecker<EObject>> handlers = getRegisteredHandlers(modelElement.getClass());
if(handlers == null) {
return;
......
ICommandLineInterfaceService.java c3e3ba08b2a1b8125b43abd1c29b7dc0a0be2b80 GREEN
ICommandStackService.java 678dcd1a6ab435ed0870fa2a9ec48ce47f25a187 GREEN
IConnectionCompositorService.java 0cdf4568b2cd3e95ea195df90a84699eff36442b GREEN
IConstraintCheckerService.java 291e53297aaea213e07e78f63350938ee2c7b155 GREEN
IConstraintCheckerService.java dc04965ac0265f77cb846f472d76620fb05a491a GREEN
IEclipseResourceStorageService.java b1155ca15cd9474d4d533d6cb2725e8a22040ec9 GREEN
IElementCompositorService.java acd462ec15f3bcc247b544b46ceebee971fe1408 GREEN
IKernelIntrospectionSystemService.java 7005c3acb4c6f978729d93279c595765e94e38eb GREEN
......
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
| Copyright 2023 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......@@ -63,4 +63,11 @@ public interface IConstraintCheckerService {
/** Registers the given checker with the service. */
void registerConstraintChecker(IConstraintChecker<EObject> checker, Class<?> modelElementClass);
/**
* Registers the given {@link Class} as an exclusion for all constraint checks, i.e., for all
* elements of this {@link Class} and for all children of such elements the existing constraint
* checks will be skipped.
*/
void registerTypeAsExcludedParentForConstraintChecks(Class<? extends EObject> clazz);
}
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