-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[555096] Pluggable Validation Traversal
* Tune the DiagnosticianProvider extension point so that multiple providers can be contributed. The current active provider can then be selected via preference. Commandline validation adds an optional parameter to override the provider to use. Two providers are available by default: 1) The standard tree plus part-type validation (default) 2) An extended traversal with the following extra validations: - Allocated functions - Deployed components - Component and Functional Exchanges between validated Components - Interfaces between validated component ports * Cleanup/refactoring of Capella validation code. Signed-off-by: Felix Dorner <[email protected]>
- Loading branch information
Showing
52 changed files
with
1,190 additions
and
1,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../org/polarsys/capella/core/transition/common/handlers/scope/EReferenceScopeRetriever.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 THALES GLOBAL SERVICES. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Thales - initial API and implementation | ||
*******************************************************************************/ | ||
package org.polarsys.capella.core.transition.common.handlers.scope; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
import org.eclipse.emf.ecore.EClass; | ||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.emf.ecore.EReference; | ||
import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; | ||
|
||
public class EReferenceScopeRetriever implements IScopeRetriever { | ||
private final EReference ref; | ||
|
||
public EReferenceScopeRetriever(EReference ref) { | ||
this.ref = ref; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Collection<? extends EObject> retrieveRelatedElements(EObject element, IContext context) { | ||
EClass refClass = ref.getEContainingClass(); | ||
if (refClass.isInstance(element)) { | ||
if (element.eIsSet(ref)) { | ||
Object target = element.eGet(ref); | ||
if (ref.isMany()) { | ||
return (Collection<? extends EObject>) element.eGet(ref); | ||
} else if (target != null) { | ||
return (Collection<? extends EObject>) Collections.singleton(target); | ||
} | ||
} | ||
} | ||
return Collections.emptyList(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...n/src/org/polarsys/capella/core/transition/common/handlers/scope/TypedScopeRetriever.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 THALES GLOBAL SERVICES. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Thales - initial API and implementation | ||
*******************************************************************************/ | ||
package org.polarsys.capella.core.transition.common.handlers.scope; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
import org.eclipse.emf.ecore.EObject; | ||
import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; | ||
|
||
public abstract class TypedScopeRetriever<T> implements IScopeRetriever { | ||
|
||
private final Class<T> clazz; | ||
|
||
public TypedScopeRetriever(Class<T> clazz) { | ||
this.clazz = clazz; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public final Collection<? extends EObject> retrieveRelatedElements(EObject element, IContext context) { | ||
if (clazz.isInstance(element)) { | ||
return doRetrieveRelatedElements((T) element, context); | ||
} | ||
return Collections.emptyList(); | ||
} | ||
|
||
protected Collection<? extends EObject> doRetrieveRelatedElements(T element, IContext context) { | ||
return Collections.emptyList(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.