Search in sources :

Example 1 with BackgroundOutlineTreeProvider

use of org.eclipse.xtext.ui.editor.outline.impl.BackgroundOutlineTreeProvider in project osate2 by osate.

the class Aadl2OutlineTreeProvider method internalCreateChildren.

@Override
protected void internalCreateChildren(final IOutlineNode parentNode, final EObject modelElement) {
    if (modelElement instanceof Element) {
        final Element element = (Element) modelElement;
        final EObject annexRoot = AnnexUtil.getAnnexRoot(element);
        if (annexRoot != null) {
            // delegate to annex specific outline tree provider
            IParseResult annexParseResult = ParseResultHolder.Factory.INSTANCE.adapt(annexRoot).getParseResult();
            if (annexParseResult != null) {
                Injector injector = AnnexUtil.getInjector(annexParseResult);
                if (injector != null) {
                    try {
                        final IOutlineTreeStructureProvider outlineTree = injector.getInstance(IOutlineTreeStructureProvider.class);
                        if (outlineTree instanceof BackgroundOutlineTreeProvider) {
                            outlineTree.createChildren(parentNode, element);
                        } else {
                            Aadl2Activator.getInstance().getLog().log(new Status(IStatus.ERROR, Aadl2Activator.PLUGIN_ID, IStatus.OK, "Annex outline tree structure provider '" + outlineTree.getClass().getCanonicalName() + "' does not implement BackgroundOutlineTreeProvider", null));
                        }
                    } catch (ConfigurationException e) {
                    // ignore: no outline provider for this annex
                    }
                }
            }
        } else {
            for (EObject childElement : element.getChildren()) {
                if (childElement instanceof Realization || childElement instanceof TypeExtension || childElement instanceof ImplementationExtension || childElement instanceof ContainmentPathElement || childElement instanceof PropertyAssociation) {
                    continue;
                }
                if (element instanceof Connection && childElement instanceof ConnectedElement) {
                    continue;
                }
                createNode(parentNode, childElement);
            }
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IOutlineTreeStructureProvider(org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider) BackgroundOutlineTreeProvider(org.eclipse.xtext.ui.editor.outline.impl.BackgroundOutlineTreeProvider) PropertyAssociation(org.osate.aadl2.PropertyAssociation) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) Element(org.osate.aadl2.Element) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) ConnectedElement(org.osate.aadl2.ConnectedElement) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) Connection(org.osate.aadl2.Connection) TypeExtension(org.osate.aadl2.TypeExtension) ImplementationExtension(org.osate.aadl2.ImplementationExtension) Realization(org.osate.aadl2.Realization) ConfigurationException(com.google.inject.ConfigurationException) Injector(com.google.inject.Injector) EObject(org.eclipse.emf.ecore.EObject) ConnectedElement(org.osate.aadl2.ConnectedElement) IParseResult(org.eclipse.xtext.parser.IParseResult)

Aggregations

ConfigurationException (com.google.inject.ConfigurationException)1 Injector (com.google.inject.Injector)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 EObject (org.eclipse.emf.ecore.EObject)1 IParseResult (org.eclipse.xtext.parser.IParseResult)1 BackgroundOutlineTreeProvider (org.eclipse.xtext.ui.editor.outline.impl.BackgroundOutlineTreeProvider)1 IOutlineTreeStructureProvider (org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider)1 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)1 ConnectedElement (org.osate.aadl2.ConnectedElement)1 Connection (org.osate.aadl2.Connection)1 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)1 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)1 Element (org.osate.aadl2.Element)1 ImplementationExtension (org.osate.aadl2.ImplementationExtension)1 PropertyAssociation (org.osate.aadl2.PropertyAssociation)1 Realization (org.osate.aadl2.Realization)1 TypeExtension (org.osate.aadl2.TypeExtension)1