Search in sources :

Example 16 with EObjectNode

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

the class OutlineNodeTest method testAddChildToLeafNode.

@Test
public void testAddChildToLeafNode() {
    EObjectNode parentNode = new EObjectNode(parentElement, null, (ImageDescriptor) null, "parent", true);
    assertFalse(parentNode.hasChildren());
    assertTrue(parentNode.getChildren().isEmpty());
    EObjectNode childNode = new EObjectNode(child0Element, parentNode, (ImageDescriptor) null, "child", false);
    assertTrue(parentNode.hasChildren());
    assertTrue(parentNode.getChildren().contains(childNode));
}
Also used : EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) Test(org.junit.Test)

Example 17 with EObjectNode

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

the class OutlineNodeTest method testStateAccess.

@Test
public void testStateAccess() {
    DocumentRootNode rootNode = createRootNode();
    EObjectNode parentNode = new EObjectNode(parentElement, rootNode, (ImageDescriptor) null, "parent", false);
    EStructuralFeatureNode featureNode = new EStructuralFeatureNode(parentElement, OutlineTestPackage.Literals.ELEMENT__XREFS, parentNode, (ImageDescriptor) null, "eClassifiers", true);
    IUnitOfWork<Boolean, EObject> work = new IUnitOfWork<Boolean, EObject>() {

        @Override
        public Boolean exec(EObject state) throws Exception {
            return state != null;
        }
    };
    assertTrue(rootNode.readOnly(work));
    assertTrue(parentNode.readOnly(work));
    assertTrue(featureNode.readOnly(work));
}
Also used : IUnitOfWork(org.eclipse.xtext.util.concurrent.IUnitOfWork) DocumentRootNode(org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode) EObject(org.eclipse.emf.ecore.EObject) EStructuralFeatureNode(org.eclipse.xtext.ui.editor.outline.impl.EStructuralFeatureNode) EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) Test(org.junit.Test)

Example 18 with EObjectNode

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

the class OutlineNodeTest method testParentChildOpposites.

@Test
public void testParentChildOpposites() {
    EObjectNode parentNode = new EObjectNode(parentElement, null, (ImageDescriptor) null, "parent", false);
    EObjectNode childNode = new EObjectNode(child0Element, parentNode, (ImageDescriptor) null, "child", false);
    assertEquals(childNode.getParent(), parentNode);
    assertTrue(parentNode.getChildren().contains(childNode));
}
Also used : EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) Test(org.junit.Test)

Example 19 with EObjectNode

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

the class OutlineNodeTest method testMethodsDelegateToParent.

@Test
public void testMethodsDelegateToParent() {
    DocumentRootNode rootNode = createRootNode();
    EObjectNode parentNode = new EObjectNode(parentElement, rootNode, (ImageDescriptor) null, "parent", false);
    assertNotNull(parentNode.getDocument());
    assertNotNull(parentNode.getTreeProvider());
    assertEquals(rootNode.getDocument(), parentNode.getDocument());
    assertEquals(rootNode.getTreeProvider(), parentNode.getTreeProvider());
}
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 20 with EObjectNode

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

the class OutlineNodeTest method testEqualsNotImplemented.

@Test
public void testEqualsNotImplemented() throws Exception {
    EObjectNode node0 = new EObjectNode(parentElement, null, (ImageDescriptor) null, "parent", false);
    EObjectNode node1 = new EObjectNode(parentElement, null, (ImageDescriptor) null, "parent", false);
    assertNotSame(node0, node1);
}
Also used : EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) Test(org.junit.Test)

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