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();
}
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());
}
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;
}
use of org.eclipse.xtext.ui.editor.outline.impl.EObjectNode in project n4js by eclipse.
the class MetaTypeAwareComparator method getCategory.
private int getCategory(IOutlineNode node) {
if (node instanceof EObjectNode) {
EClass eclass = ((EObjectNode) node).getEClass();
int id = eclass.getClassifierID();
int key = 10000 + id;
Integer sortKey = METATYPESORTORDER.get(id);
if (sortKey != null) {
key = sortKey * 1000;
}
if (node instanceof N4JSEObjectNode) {
N4JSEObjectNode n4node = (N4JSEObjectNode) node;
if (!n4node.isStatic) {
key += 100;
}
if (n4node.isConstructor) {
key -= 50;
}
}
return key;
}
return -1;
}
use of org.eclipse.xtext.ui.editor.outline.impl.EObjectNode in project dsl-devkit by dsldevkit.
the class XtextElementSelectionListener method getSelectedElementType.
/**
* Gets the EClass of the semantic element currently selected.
*
* @return EClass or null
*/
public EClass getSelectedElementType() {
if (selection instanceof IStructuredSelection) {
if (((IStructuredSelection) selection).getFirstElement() instanceof EObject) {
// structured selection, e.g. GMFEditor
EObject eObject = (EObject) ((IStructuredSelection) selection).getFirstElement();
if (eObject.eResource() != null) {
return eObject.eClass();
}
} else if (((IStructuredSelection) selection).getFirstElement() instanceof EObjectNode) {
// selection in outline
return ((EObjectNode) ((IStructuredSelection) selection).getFirstElement()).getEClass();
}
} else {
ILeafNode node = nodeAtTextSelection();
EObject semanticObject = NodeModelUtils.findActualSemanticObjectFor(node);
if (semanticObject != null) {
return semanticObject.eClass();
}
}
return null;
}
Aggregations