Search in sources :

Example 11 with IOutlineNode

use of org.eclipse.xtext.ui.editor.outline.IOutlineNode in project xtext-xtend by eclipse.

the class AbstractMultiModeOutlineTreeProvider method buildXtendNode.

@Override
public IXtendOutlineContext buildXtendNode(EObject modelElement, IXtendOutlineContext context) {
    EclipseXtendOutlineContext eclipseXtendOutlineContext = (EclipseXtendOutlineContext) context;
    IOutlineNode parentNode = eclipseXtendOutlineContext.getParentNode();
    int inheritanceDepth = eclipseXtendOutlineContext.getInheritanceDepth();
    EObjectNode xtendNode = createXtendNode(parentNode, modelElement, inheritanceDepth);
    return eclipseXtendOutlineContext.withParentNode(xtendNode);
}
Also used : EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) IOutlineNode(org.eclipse.xtext.ui.editor.outline.IOutlineNode)

Example 12 with IOutlineNode

use of org.eclipse.xtext.ui.editor.outline.IOutlineNode in project xtext-xtend by eclipse.

the class AbstractMultiModeOutlineTreeProvider method buildEObjectNode.

@Override
public IXtendOutlineContext buildEObjectNode(EObject modelElement, IXtendOutlineContext context) {
    EclipseXtendOutlineContext eclipseXtendOutlineContext = (EclipseXtendOutlineContext) context;
    IOutlineNode parentNode = eclipseXtendOutlineContext.getParentNode();
    EObjectNode node = createNode(parentNode, modelElement);
    return eclipseXtendOutlineContext.withParentNode(node);
}
Also used : EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) IOutlineNode(org.eclipse.xtext.ui.editor.outline.IOutlineNode)

Example 13 with IOutlineNode

use of org.eclipse.xtext.ui.editor.outline.IOutlineNode in project xtext-xtend by eclipse.

the class XtendOutlineJvmTreeProvider method buildXtendNode.

@Override
public IXtendOutlineContext buildXtendNode(EObject modelElement, IXtendOutlineContext context) {
    IXtendOutlineContext resultedContext = super.buildXtendNode(modelElement, context);
    if (!context.isShowInherited()) {
        EclipseXtendOutlineContext eclipseXtendOutlineContext = (EclipseXtendOutlineContext) context;
        IOutlineNode parentNode = eclipseXtendOutlineContext.getParentNode();
        if (parentNode instanceof DocumentRootNode) {
            if (modelElement instanceof JvmDeclaredType) {
                JvmDeclaredType jvmDeclaredType = (JvmDeclaredType) modelElement;
                String packageName = jvmDeclaredType.getPackageName();
                if (packageName != null) {
                    EObject rootElement = modelElement.eResource().getContents().get(0);
                    if (rootElement instanceof XtendFile) {
                        XtendFile xtendFile = (XtendFile) rootElement;
                        String primaryPackage = xtendFile.getPackage();
                        if (!packageName.equals(primaryPackage)) {
                            EObjectNode typeNode = (EObjectNode) ((EclipseXtendOutlineContext) resultedContext).getParentNode();
                            if (typeNode.getText() instanceof StyledString) {
                                typeNode.setText(((StyledString) typeNode.getText()).append(new StyledString(" - " + packageName, StyledString.QUALIFIER_STYLER)));
                            }
                        }
                    }
                }
            }
        }
    }
    return resultedContext;
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) DocumentRootNode(org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode) IXtendOutlineContext(org.eclipse.xtend.ide.common.outline.IXtendOutlineContext) EObject(org.eclipse.emf.ecore.EObject) JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) EObjectNode(org.eclipse.xtext.ui.editor.outline.impl.EObjectNode) IOutlineNode(org.eclipse.xtext.ui.editor.outline.IOutlineNode)

Aggregations

IOutlineNode (org.eclipse.xtext.ui.editor.outline.IOutlineNode)13 EObjectNode (org.eclipse.xtext.ui.editor.outline.impl.EObjectNode)4 StyledString (org.eclipse.jface.viewers.StyledString)2 EStructuralFeatureNode (org.eclipse.xtext.ui.editor.outline.impl.EStructuralFeatureNode)2 ITextRegion (org.eclipse.xtext.util.ITextRegion)2 EObject (org.eclipse.emf.ecore.EObject)1 ITextSelection (org.eclipse.jface.text.ITextSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)1 IXtendOutlineContext (org.eclipse.xtend.ide.common.outline.IXtendOutlineContext)1 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)1 XtextEditor (org.eclipse.xtext.ui.editor.XtextEditor)1 XtextDocument (org.eclipse.xtext.ui.editor.model.XtextDocument)1 IOutlineTreeProvider (org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider)1 DocumentRootNode (org.eclipse.xtext.ui.editor.outline.impl.DocumentRootNode)1 TextRegion (org.eclipse.xtext.util.TextRegion)1 Test (org.junit.Test)1