| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.dsl.entity.xtext.ui.outline; |
| |
| import org.eclipse.xtext.ui.editor.model.IXtextDocument; |
| import org.eclipse.xtext.ui.editor.outline.IOutlineNode; |
| import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; |
| import org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode; |
| import org.eclipse.xtext.util.TextRegion; |
| import org.eclipse.osbp.dsl.semantic.common.types.LAnnotationDef; |
| import org.eclipse.osbp.dsl.semantic.common.types.LType; |
| import org.eclipse.osbp.dsl.semantic.common.types.LTypedPackage; |
| import org.eclipse.osbp.dsl.semantic.entity.LBean; |
| import org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute; |
| import org.eclipse.osbp.dsl.semantic.entity.LBeanReference; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntity; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityReference; |
| import org.eclipse.osbp.dsl.semantic.entity.LIndex; |
| import org.eclipse.osbp.dsl.semantic.entity.LOperation; |
| import org.eclipse.osbp.dsl.xtext.lazyresolver.ui.FastDocumentRootNode; |
| |
| public class EntityGrammarOutlineTreeProvider extends |
| DefaultOutlineTreeProvider { |
| |
| public IOutlineNode createRoot(IXtextDocument document) { |
| DocumentRootNode documentNode = new FastDocumentRootNode( |
| labelProvider.getImage(document), |
| labelProvider.getText(document), document, this); |
| documentNode.setTextRegion(new TextRegion(0, document.getLength())); |
| return documentNode; |
| } |
| |
| protected void _createChildren(IOutlineNode parentNode, LTypedPackage modelElement) { |
| for (LType childElement : modelElement.getTypes()) { |
| createNode(parentNode, childElement); |
| } |
| } |
| |
| protected void _createChildren(IOutlineNode parentNode, LEntity modelElement) { |
| for (LAnnotationDef childElement : modelElement.getAnnotations()) { |
| createNode(parentNode, childElement); |
| } |
| |
| for (LEntityAttribute childElement : modelElement.getAttributes()) { |
| createNode(parentNode, childElement); |
| } |
| |
| for (LEntityReference childElement : modelElement.getReferences()) { |
| createNode(parentNode, childElement); |
| } |
| |
| for (LOperation childElement : modelElement.getOperations()) { |
| createNode(parentNode, childElement); |
| } |
| |
| for (LIndex childElement : modelElement.getIndexes()) { |
| createNode(parentNode, childElement); |
| } |
| } |
| |
| protected void _createChildren(IOutlineNode parentNode, LBean modelElement) { |
| for (LAnnotationDef childElement : modelElement.getAnnotations()) { |
| createNode(parentNode, childElement); |
| } |
| |
| for (LBeanAttribute childElement : modelElement.getAttributes()) { |
| createNode(parentNode, childElement); |
| } |
| |
| for (LBeanReference childElement : modelElement.getReferences()) { |
| createNode(parentNode, childElement); |
| } |
| |
| for (LOperation childElement : modelElement.getOperations()) { |
| createNode(parentNode, childElement); |
| } |
| } |
| } |