Search in sources :

Example 1 with EObjectNode

use of org.eclipse.xtext.ui.editor.outline.impl.EObjectNode in project xtext-eclipse by eclipse.

the class OutlineFilterAndSorterTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final Injector injector = TestsActivator.getInstance().getInjector("org.eclipse.xtext.ui.tests.editor.outline.OutlineTestLanguage");
    with(new ISetup() {

        @Override
        public Injector createInjectorAndDoEMFRegistration() {
            return injector;
        }
    });
    Model model = OutlineTestFactory.eINSTANCE.createModel();
    nodes = Lists.newArrayList();
    nodes.add(new EObjectNode(model, null, (ImageDescriptor) null, "one", true));
    nodes.add(new EObjectNode(model, null, (ImageDescriptor) null, "two", true));
    nodes.add(new EObjectNode(model, null, (ImageDescriptor) null, "three", true));
    filterAndSorter = new OutlineFilterAndSorter();
}
Also used : Injector(com.google.inject.Injector) ISetup(org.eclipse.xtext.ISetup) Model(org.eclipse.xtext.ui.tests.editor.outline.outlineTest.Model) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) OutlineFilterAndSorter(org.eclipse.xtext.ui.editor.outline.impl.OutlineFilterAndSorter) EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode)

Example 2 with EObjectNode

use of org.eclipse.xtext.ui.editor.outline.impl.EObjectNode in project xtext-eclipse by eclipse.

the class OutlineNodeComparerTest method testNull.

@Test
public void testNull() {
    assertTrue(comparer.equals(null, null));
    EObjectNode node = new EObjectNode(eObject, null, (ImageDescriptor) null, "parent", false);
    assertFalse(comparer.equals(null, node));
    assertFalse(comparer.equals(node, null));
}
Also used : EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) Test(org.junit.Test)

Example 3 with EObjectNode

use of org.eclipse.xtext.ui.editor.outline.impl.EObjectNode in project xtext-eclipse by eclipse.

the class OutlineNodeTest method testCreateChildrenLazily.

@Test
public void testCreateChildrenLazily() {
    DocumentRootNode rootNode = createRootNode();
    EObjectNode parentNode = new EObjectNode(parentElement, rootNode, (ImageDescriptor) null, "parent", false);
    assertFalse(parentNode.getChildren().isEmpty());
}
Also used : DocumentRootNode(org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode) EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) Test(org.junit.Test)

Example 4 with EObjectNode

use of org.eclipse.xtext.ui.editor.outline.impl.EObjectNode in project xtext-eclipse by eclipse.

the class OutlineNodeTest method createRootNode.

protected DocumentRootNode createRootNode() {
    XtextDocument document = get(XtextDocument.class);
    document.setInput(resource);
    IOutlineTreeStructureProvider treeStructureProvider = new IOutlineTreeStructureProvider() {

        @Override
        public void createChildren(IOutlineNode parentNode, EObject modelElement) {
            new EObjectNode(child0Element, parentNode, (ImageDescriptor) null, "child", false);
        }
    };
    DocumentRootNode rootNode = new DocumentRootNode((ImageDescriptor) null, "root", document, treeStructureProvider);
    return rootNode;
}
Also used : IOutlineTreeStructureProvider(org.eclipse.xtext.ui.editor.outline.impl.IOutlineTreeStructureProvider) DocumentRootNode(org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode) EObject(org.eclipse.emf.ecore.EObject) XtextDocument(org.eclipse.xtext.ui.editor.model.XtextDocument) EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) IOutlineNode(org.eclipse.xtext.ui.editor.outline.IOutlineNode)

Example 5 with EObjectNode

use of org.eclipse.xtext.ui.editor.outline.impl.EObjectNode in project dsl-devkit by dsldevkit.

the class CheckOutlineTreeProvider method internalCreateChildren.

@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);
    }
}
Also used : Category(com.avaloq.tools.ddk.check.check.Category) EStructuralFeatureNode(org.eclipse.xtext.ui.editor.outline.impl.EStructuralFeatureNode) Check(com.avaloq.tools.ddk.check.check.Check) CheckCatalog(com.avaloq.tools.ddk.check.check.CheckCatalog) EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode)

Aggregations

EObjectNode (org.eclipse.xtext.ui.editor.outline.impl.EObjectNode)20 Test (org.junit.Test)9 DocumentRootNode (org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode)7 IOutlineNode (org.eclipse.xtext.ui.editor.outline.IOutlineNode)6 EObject (org.eclipse.emf.ecore.EObject)5 EStructuralFeatureNode (org.eclipse.xtext.ui.editor.outline.impl.EStructuralFeatureNode)3 InternalEObject (org.eclipse.emf.ecore.InternalEObject)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StyledString (org.eclipse.jface.viewers.StyledString)2 ILeafNode (org.eclipse.xtext.nodemodel.ILeafNode)2 Category (com.avaloq.tools.ddk.check.check.Category)1 Check (com.avaloq.tools.ddk.check.check.Check)1 CheckCatalog (com.avaloq.tools.ddk.check.check.CheckCatalog)1 Injector (com.google.inject.Injector)1 EClass (org.eclipse.emf.ecore.EClass)1 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)1 IXtendOutlineContext (org.eclipse.xtend.ide.common.outline.IXtendOutlineContext)1 ISetup (org.eclipse.xtext.ISetup)1