Search in sources :

Example 36 with Classifier

use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.

the class FeatureInstanceTooltipContributor method addTooltipContents.

@Override
public void addTooltipContents(final TooltipContributorContext ctx) {
    ctx.getBusinessObjectContext().getBusinessObject(FeatureInstance.class).ifPresent(featureInstance -> {
        final Feature feature = featureInstance.getFeature();
        if (feature instanceof Feature || feature instanceof InternalFeature || feature instanceof ProcessorFeature) {
            // Determine the feature classifier
            final Classifier featureClassifier;
            if (feature instanceof EventDataSource) {
                final EventDataSource aadlFeature = (EventDataSource) feature;
                featureClassifier = aadlFeature.getDataClassifier();
            } else if (feature instanceof PortProxy) {
                final PortProxy aadlFeature = (PortProxy) feature;
                featureClassifier = aadlFeature.getDataClassifier();
            } else if (feature instanceof SubprogramProxy) {
                final SubprogramProxy aadlFeature = (SubprogramProxy) feature;
                featureClassifier = aadlFeature.getSubprogramClassifier();
            } else if (feature instanceof Feature) {
                final Feature aadlFeature = (Feature) feature;
                featureClassifier = aadlFeature.getAllClassifier();
            } else {
                featureClassifier = null;
            }
            // Build the text to contribute to the tooltip
            final StringBuffer tooltipContents = new StringBuffer();
            if (featureClassifier instanceof ComponentClassifier) {
                tooltipContents.append(((ComponentClassifier) featureClassifier).getCategory() + " " + featureClassifier.getQualifiedName());
            } else if (featureClassifier instanceof FeatureGroupType) {
                tooltipContents.append("feature group " + featureClassifier.getQualifiedName());
            } else if (featureClassifier == null) {
                tooltipContents.append("No Classifier");
            } else {
                tooltipContents.append(featureClassifier.getQualifiedName());
            }
            // Create the styled text describing the feature
            final Label lbl = new Label(ctx.getTooltip(), SWT.NONE);
            lbl.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
            lbl.setText(tooltipContents.toString());
        }
    });
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) SubprogramProxy(org.osate.aadl2.SubprogramProxy) FeatureInstance(org.osate.aadl2.instance.FeatureInstance) PortProxy(org.osate.aadl2.PortProxy) InternalFeature(org.osate.aadl2.InternalFeature) FeatureGroupType(org.osate.aadl2.FeatureGroupType) Label(org.eclipse.swt.widgets.Label) ProcessorFeature(org.osate.aadl2.ProcessorFeature) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier) ProcessorFeature(org.osate.aadl2.ProcessorFeature) Feature(org.osate.aadl2.Feature) InternalFeature(org.osate.aadl2.InternalFeature) EventDataSource(org.osate.aadl2.EventDataSource)

Example 37 with Classifier

use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.

the class SetExtendedClassifierPropertySection method getExtendedClassifierLabel.

private static String getExtendedClassifierLabel(final List<Classifier> elements) {
    final Iterator<Classifier> it = elements.iterator();
    final Classifier extClassifier = getExtended(it.next());
    while (it.hasNext()) {
        if (extClassifier != getExtended(it.next())) {
            return "<Multiple>";
        }
    }
    return getClassifierName(extClassifier);
}
Also used : Classifier(org.osate.aadl2.Classifier)

Example 38 with Classifier

use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.

the class FeatureReferenceBindingType method setNodeDataClassifier.

/**
 * Sets the classifier field of the node data and creates children.
 * @param node the node for which to set the classifier and create children.
 * @param classifierValue the new value for the classifier field
 */
private final void setNodeDataClassifier(final PrototypeBindingsModelNode node, final NamedElementOrDescription classifierValue) {
    data(node).classifier = classifierValue;
    data(node).children.clear();
    if (classifierValue != null) {
        // Only support children for business objects which support bindings
        final Object bo = data(node).bo;
        if (bo instanceof Classifier || bo instanceof Subcomponent || bo instanceof ComponentPrototype || bo instanceof FeatureGroupPrototype) {
            // We need to get an actual EObject to determine children.
            final EObject eobj = classifierValue.getResolvedValue(resourceSet);
            final EObject prototypeSource = bo instanceof Classifier ? getExtendedOrImplemented(eobj) : eobj;
            // Get all the prototypes for the business object and create a child node for each of them
            AadlPrototypeUtil.getAllPrototypes(prototypeSource).forEachOrdered(c -> {
                final PrototypeBindingsModelNode newChild = new PrototypeBindingsModelNode(node, c);
                data(node).children.add(newChild);
                data(newChild).bo = c;
            });
        }
    }
}
Also used : FeatureGroupPrototype(org.osate.aadl2.FeatureGroupPrototype) Subcomponent(org.osate.aadl2.Subcomponent) EObject(org.eclipse.emf.ecore.EObject) EObject(org.eclipse.emf.ecore.EObject) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) ComponentPrototype(org.osate.aadl2.ComponentPrototype)

Example 39 with Classifier

use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.

the class FeatureReferenceBindingType method getExtendedOrImplemented.

/**
 * Gets the extended classifier or the implemented type.
 * @param bo the classifier for which to get the extended classifier or implemented type.
 * @return the extended classifier or implemented type. Null of neither of those exists or if the business object is not a classifier.
 */
private static Classifier getExtendedOrImplemented(final EObject bo) {
    if (!(bo instanceof Classifier)) {
        return null;
    }
    final Classifier classifier = (Classifier) bo;
    Classifier result = classifier.getExtended();
    if (result == null && bo instanceof ComponentImplementation) {
        result = ((ComponentImplementation) bo).getType();
    }
    return result;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) Classifier(org.osate.aadl2.Classifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier)

Example 40 with Classifier

use of org.geotoolkit.sml.xml.v100.Classifier in project osate2 by osate.

the class ClassifierPrototypeBindingsModel method loadData.

@Override
protected void loadData() {
    final List<Classifier> classifiers = getBusinessObjectSelection().boStream(Classifier.class).collect(Collectors.toList());
    // Don't support displaying or editing bindings when multiple classifiers are selected
    if (classifiers.size() != 1) {
        setMultipleValues(true);
        return;
    }
    final Classifier classifier = classifiers.get(0);
    // Don't populate data if classifier is null.
    if (classifier == null) {
        return;
    }
    PrototypeBindingsModelNode parent = null;
    data(parent).bo = classifier;
    setNodeDataClassifier(parent, classifier);
    loadBindingData(parent, classifier.getOwnedPrototypeBindings());
}
Also used : Classifier(org.osate.aadl2.Classifier)

Aggregations

Classifier (org.osate.aadl2.Classifier)203 ComponentClassifier (org.osate.aadl2.ComponentClassifier)90 ComponentImplementation (org.osate.aadl2.ComponentImplementation)49 NamedElement (org.osate.aadl2.NamedElement)40 AadlPackage (org.osate.aadl2.AadlPackage)38 Subcomponent (org.osate.aadl2.Subcomponent)37 ComponentType (org.osate.aadl2.ComponentType)34 EObject (org.eclipse.emf.ecore.EObject)31 ArrayList (java.util.ArrayList)29 BasicEList (org.eclipse.emf.common.util.BasicEList)28 Feature (org.osate.aadl2.Feature)26 DataClassifier (org.osate.aadl2.DataClassifier)22 FeatureGroupType (org.osate.aadl2.FeatureGroupType)21 ProcessorClassifier (org.osate.aadl2.ProcessorClassifier)21 AnnexSubclause (org.osate.aadl2.AnnexSubclause)17 Element (org.osate.aadl2.Element)17 EList (org.eclipse.emf.common.util.EList)15 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)15 FeatureGroup (org.osate.aadl2.FeatureGroup)14 PropertyExpression (org.osate.aadl2.PropertyExpression)14