Java 类org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode 实例源码

项目:dsl-devkit    文件:CheckOutlineTreeProvider.java   
@Override
protected void internalCreateChildren(final DocumentRootNode parentNode, final EObject modelElement) {
  CheckCatalog catalog = (CheckCatalog) modelElement;
  if (catalog.getPackageName() != null) {
    getOutlineNodeFactory().createEStructuralFeatureNode(parentNode, catalog, CheckPackage.Literals.CHECK_CATALOG__PACKAGE_NAME, ImageDescriptor.createFromImage(checkImages.forPackage()), catalog.getPackageName(), true);
  }

  if (catalog.getImports() != null && !catalog.getImports().getImportDeclarations().isEmpty()) {
    EStructuralFeatureNode importNode = getOutlineNodeFactory().createEStructuralFeatureNode(parentNode, catalog, CheckPackage.Literals.CHECK_CATALOG__IMPORTS, ImageDescriptor.createFromImage(checkImages.forImportContainer()), "Import declarations", false);
    for (final org.eclipse.xtext.xtype.XImportDeclaration imported : catalog.getImports().getImportDeclarations()) {
      createNode(importNode, imported);
    }
  }

  EObjectNode catalogNode = createNode(parentNode, catalog);

  for (final Category category : catalog.getCategories()) {
    createNode(catalogNode, category);
  }
  for (final Check check : catalog.getChecks()) {
    createNode(catalogNode, check);
  }

}
项目:EASyProducer    文件:IvmlOutlineTreeProvider.java   
/**
 * Create child-nodes for the document. This means creating project-nodes.
 * 
 * @param parentNode The document root node (virtual node, not displayed).
 * @param unit The top-level element of the IVML-gramar (VariabilityUnit).
 */
protected void _createChildren(DocumentRootNode parentNode,
        VariabilityUnit unit) {
    /*
     * if (null != unit.getLevel()) { // the language level is currently not
     * official createNode(parentNode, unit.getLevel()); }
     */

    /*
     * Display all available projects in the outline.
     */
    if (unit != null && !isEmpty(unit.getProjects())) {
        for (Project project: unit.getProjects()) {
            //Leave creation of project node to Xtext! 
            createNode(parentNode, project);
        }
    }
}
项目:jason-eclipse-plugin    文件:AslOutlineTreeProvider.java   
protected void _createChildren(DocumentRootNode parentNode, EObject node) {

    if (node instanceof Agent) {
        for (Belief b : ((Agent) node).getBelief()) {
            _createNode(parentNode, b);
        }

        for (Plan p : ((Agent) node).getPlan()) {
            _createNode(parentNode, p);
        }
    }
}
项目:dsl-devkit    文件:ValidOutlineTreeProvider.java   
/**
 * Do not create Model nodes in the outline. When the valid model is processed it is not
 * added to the outline but its children are.
 * 
 * @param parentNode
 *          the parent node, this should be the tree root
 * @param modelElement
 *          a valid model
 */
// CHECKSTYLE:OFF
protected void _createChildren(final DocumentRootNode parentNode, final ValidModel modelElement) {
  // CHECKSTYLE:ON

  Image importContainerImage = JavaPlugin.getImageDescriptorRegistry().get(JavaPluginImages.DESC_OBJS_IMPCONT);

  if (!modelElement.getImports().isEmpty()) {
    createEStructuralFeatureNode(parentNode, modelElement, ValidPackage.Literals.VALID_MODEL__IMPORTS, importContainerImage, "import declarations", false);
  }
  for (EObject content : modelElement.getCategories()) {
    createNode(parentNode, content);
  }
}
项目:dsl-devkit    文件:ScopeOutlineTreeProvider.java   
/**
 * Create the child nodes for a given native Context. We only show quick fixes.
 * 
 * @param parentNode
 *          the parent node
 * @param modelElement
 *          the scope model
 */
//CHECKSTYLE:OFF
protected void _createChildren(final DocumentRootNode parentNode, final ScopeModel modelElement) {
  //CHECKSTYLE:ON
  Image importContainerImage = JavaPlugin.getImageDescriptorRegistry().get(JavaPluginImages.DESC_OBJS_IMPCONT);

  if (!modelElement.getImports().isEmpty()) {
    createEStructuralFeatureNode(parentNode, modelElement, ScopePackage.Literals.SCOPE_MODEL__IMPORTS, importContainerImage, "import declarations", false);
  }

  for (EObject content : modelElement.getScopes()) {
    createNode(parentNode, content);
  }
}
项目:dsl-devkit    文件:AbstractOutlineTreeProvider.java   
/**
 * Default for createChildrenDispatcher with outline node as a parent node.
 *
 * @param parentNode
 *          the {@link IOutlineNode}
 * @param modelElement
 *          the {@link EObject} model element
 */
// CHECKSTYLE:CHECK-OFF Name (dispatcher enforces names starting with underscore)
public void _createChildren(final IOutlineNode parentNode, final EObject modelElement) {
  // CHECKSTYLE:CHECK-ON
  if (modelElement != null && parentNode.hasChildren()) {
    if (parentNode instanceof DocumentRootNode) {
      internalCreateChildren((DocumentRootNode) parentNode, modelElement);
    } else if (parentNode instanceof EStructuralFeatureNode) {
      internalCreateChildren((EStructuralFeatureNode) parentNode, modelElement);
    } else {
      internalCreateChildren(parentNode, modelElement);
    }
  }
}
项目:dsl-devkit    文件:AbstractOutlineTreeProvider.java   
/**
 * Default for createNodeDispatcher with document root as a parent node.
 *
 * @param parentNode
 *          the {@link DocumentRootNode}
 * @param modelElement
 *          the {@link EObject} model element
 */
// CHECKSTYLE:CHECK-OFF Name (dispatcher enforces names starting with underscore)
protected void _createNode(final DocumentRootNode parentNode, final EObject modelElement) {
  // CHECKSTYLE:CHECK-ON
  Object text = textDispatcher.invoke(modelElement);
  if (text == null) {
    text = modelElement.eResource().getURI().trimFileExtension().lastSegment();
  }
  factory.createEObjectNode(parentNode, modelElement, imageDispatcher.invoke(modelElement), text, isLeafDispatcher.invoke(modelElement));
}
项目:EASyProducer    文件:VilBuildLanguageOutlineTreeProvider.java   
/**
 * Creates the children for the ImplementationUnit.
 * 
 * @param parentNode
 *            parentNode
 * @param unit
 *            Create children for unit-object
 */
protected void _createChildren(DocumentRootNode parentNode, ImplementationUnit unit) {
    if (unit != null && unit.getScripts() != null && !unit.getScripts().isEmpty()) {
        for (LanguageUnit script : unit.getScripts()) {
            // List vilScript
            if (script != null) {
                createScriptNodes(script, parentNode);
            }
        }
    }
}
项目:xsemantics    文件:FJOutlineTreeProvider.java   
protected void _createChildren(DocumentRootNode parentNode,
        Program program) {
    for (Class c : program.getClasses()) {
        createNode(parentNode, c);
    }
    if (program.getMain() != null)
        createNode(parentNode, program.getMain());
}
项目:packtpub-xtext-book-examples    文件:SmallJavaOutlineTreeProvider.java   
public void _createChildren(final DocumentRootNode outlineNode, final SJProgram model) {
  EList<SJClass> _classes = model.getClasses();
  final Procedure1<SJClass> _function = new Procedure1<SJClass>() {
    @Override
    public void apply(final SJClass cl) {
      SmallJavaOutlineTreeProvider.this.createNode(outlineNode, cl);
    }
  };
  IterableExtensions.<SJClass>forEach(_classes, _function);
}
项目:packtpub-xtext-book-examples    文件:EntitiesOutlineTreeProvider.java   
public void _createChildren(final DocumentRootNode outlineNode, final Model model) {
  EList<Entity> _entities = model.getEntities();
  final Procedure1<Entity> _function = new Procedure1<Entity>() {
    @Override
    public void apply(final Entity entity) {
      EntitiesOutlineTreeProvider.this.createNode(outlineNode, entity);
    }
  };
  IterableExtensions.<Entity>forEach(_entities, _function);
}
项目:PHDL    文件:PhdlOutlineTreeProvider.java   
protected void _createChildren(DocumentRootNode parent, PhdlModel p) {
    createPackageNodes(parent, p);
    createImportNodes(parent, p);
    createDeviceNodes(parent, p);
    createDesignNodes(parent, p);
}
项目:EASyProducer    文件:TemplateLangOutlineTreeProvider.java   
/**
 * Creates all nodes for the template.
 * 
 * @param unit
 *            LanguageUnit with Template
 * @param parentNode
 *            the parent node
 */
private void createTemplateNodes(LanguageUnit unit, DocumentRootNode parentNode) {
    // create VirtualNode for Template
    VirtualOutlineNode tempNode = null;
    StyledString displayString = new StyledString();
    if (unit.getExt() != null && !unit.getExt().isEmpty()) {
        if (unit.getName() != null && !unit.getName().isEmpty()) {
            // template Name with extension
            String extName = unit.getExt();
            displayString.append("" + unit.getName());
            displayString.append(" extends " + extName);
            // instantiate virtualNode for template
            tempNode = new VirtualOutlineNode(parentNode, imageHelper.getImage(Images.NAME_VILTEMPLATE),
                    displayString, false);
        }
    } else {
        if (unit.getName() != null && !unit.getName().isEmpty()) {
            // template Name without extension
            displayString.append("" + unit.getName());
            // instantiate virtualNode for template
            tempNode = new VirtualOutlineNode(parentNode, imageHelper.getImage(Images.NAME_VILTEMPLATE),
                    displayString, false);
        }
    }
    if (tempNode != null) {
        // create nodes for advices
        if (!isEmpty(unit.getAdvices())) {
            createAdviceNodes(unit.getAdvices(), tempNode);
        }

        // create nodes for indentation
        if (unit.getIndent() != null && !isEmpty(unit.getIndent().getParts())) {
            createIndentNodes(unit.getIndent().getParts(), tempNode);
        }

        // create nodes for parameters
        if (unit.getParam() != null && !isEmpty(unit.getParam().getParam())) {
            VirtualOutlineNode paramNode = new VirtualOutlineNode(tempNode,
                    imageHelper.getImage(Images.NAME_PARAMETERLIST), "Parameters", false);
            createParameterNodes(unit.getParam().getParam(), paramNode);
        }

        // create nodes for java extensions
        if (!isEmpty(unit.getJavaExts())) {
            createJavaExtNodes(unit.getJavaExts(), tempNode);
        }

        // create nodes for imports
        if (!isEmpty(unit.getImports())) {
            createImportNodes(unit.getImports(), tempNode);
        }

        // create versionNode
        if (unit.getVersion() != null) {
            createVersionNode(unit.getVersion(), tempNode);
        }
        // TemplateContents
        if (hasContents(unit)) {
            // create VirtualNode for TemplateContent
            StyledString templateContentsString = new StyledString();
            templateContentsString.append("Template Contents", StyledString.QUALIFIER_STYLER);
            VirtualOutlineNode templateContentNode = new VirtualOutlineNode(tempNode,
                    imageHelper.getImage(Images.NAME_SCRIPTCONTENT), templateContentsString, false);
            createScriptContentNodes(unit.getElements(), templateContentNode);
        }
    }
}
项目:EASyProducer    文件:VilBuildLanguageOutlineTreeProvider.java   
/**
 * creates a node for the vilScript.
 * 
 * @param script
 *            the vilScript
 * @param parentNode
 *            parentnode
 */
protected void createScriptNodes(LanguageUnit script, DocumentRootNode parentNode) {
    VirtualOutlineNode vilNode = null;
    StyledString displayString = new StyledString();
    if (checkScriptParent(script)) {
        if (script.getName() != null && !script.getName().isEmpty()) {
            String parentName = script.getParent().getName();
            // vilScript Name with parent
            displayString.append("" + script.getName());
            displayString.append(" extends " + parentName);
            // create virtualNode for vilScript
            vilNode = new VirtualOutlineNode(parentNode, imageHelper.getImage(Images.NAME_VILSCRIPT),
                    displayString, false);
        }
    } else {
        if (script.getName() != null && !script.getName().isEmpty()) {
            // vilScript Name without parent
            displayString.append("" + script.getName());
            // create virtualNode for vilScript
            vilNode = new VirtualOutlineNode(parentNode, imageHelper.getImage(Images.NAME_VILSCRIPT),
                    displayString, false);
        }
    }
    if (vilNode != null) {
        // create Nodes for Advices
        if (!isEmpty(script.getAdvices())) {
            createAdviceNodes(script.getAdvices(), vilNode);
        }
        // create VirtualNode for vilParameters
        if (script.getParam() != null && !isEmpty(script.getParam().getParam())) {
            VirtualOutlineNode virtualParamNode = new VirtualOutlineNode(vilNode,
                    imageHelper.getImage(Images.NAME_PARAMLIST), "Parameters", false);
            createParametersNodes(script.getParam().getParam(), virtualParamNode);
        }
        // create versionNode
        if (script.getVersion() != null) {
            createVersionNode(script.getVersion(), vilNode);
        }
        // create ImportNodes
        if (!isEmpty(script.getImports())) {
            createImportNodes(script.getImports(), vilNode);
        }
        // create PropertyNodes
        if (!isEmpty(script.getLoadProperties())) {
            createPropertyNodes(script.getLoadProperties(), vilNode);
        }
        // ScriptContents
        if (hasContents(script)) {
            // create VirtualNode for ScriptContent
            StyledString scriptContentsString = new StyledString();
            scriptContentsString.append("Script Contents", StyledString.QUALIFIER_STYLER);
            VirtualOutlineNode scriptContentNode = new VirtualOutlineNode(vilNode,
                    imageHelper.getImage(Images.NAME_SCRIPTCONTENT), scriptContentsString, false);
            createScriptContentNodes(script, scriptContentNode);
        }
    }
}
项目:dsl-devkit    文件:AbstractOutlineTreeProvider.java   
/**
 * Do not create Model nodes in the outline if the model node itself is not specified as required element.
 * In that case, when the valid model is processed it is not added to the outline but its children are.
 *
 * @param parentNode
 *          the parent {@link IOutlineNode}
 * @param modelElement
 *          a valid {@link EObject}
 */
@Override
protected void internalCreateChildren(final DocumentRootNode parentNode, final EObject modelElement) {
  if (getRelevantElements().contains(modelElement.eClass())) {
    createNode(parentNode, modelElement);
  } else {
    createChildrenDispatcher.invoke(parentNode, modelElement);
  }
}
项目:dsl-devkit    文件:AbstractOutlineTreeProvider.java   
/**
 * Default for createChildrenDispatcher with document root as a parent node.
 *
 * @param parentNode
 *          the {@link DocumentRootNode}
 * @param modelElement
 *          the {@link EObject} model element
 */
// CHECKSTYLE:CHECK-OFF Name (dispatcher enforces names starting with underscore)
public void _createChildren(final DocumentRootNode parentNode, final EObject modelElement) {
  // CHECKSTYLE:CHECK-ON
  internalCreateChildren((IOutlineNode) parentNode, modelElement);
}
项目:EASyProducer    文件:TemplateLangOutlineTreeProvider.java   
/**
 * Creates the Children for LanguageUnit. It's the rootnode in this case.
 * 
 * @param parentNode
 *            the parent node
 * @param unit
 *            the LanguageUnit
 */
protected void _createChildren(DocumentRootNode parentNode, LanguageUnit unit) {
    if (unit != null && parentNode != null) {
        createTemplateNodes(unit, parentNode);
    }
}