Xtext customized Outline

789 Views Asked by At

I have a customized Outline for an Xtext-based DSL creating new nodes and a different hierarchical structure in the Outline View. Cross-linking with the editor works fine when you click an Outline node. However, the reverse is not happening. I have two requirements: 1. When I click a semantic element in the editor, the Outline Node should be selected if "cross-linked" button is pressed 2. I want to keep the tree structure "expand-all" as I continue to edit the domain model

any pointers are helpful.

thanks in advance

1

There are 1 best solutions below

0
On

regarding the expansion

package org.xtext.example.mydsl.ui;

import org.eclipse.xtext.ui.editor.outline.impl.OutlinePage;

public class MyOutlinePage extends OutlinePage {

    @Override
    protected int getDefaultExpansionLevel() {
        return Integer.MAX_VALUE;
    }

}


public class MyDslUiModule extends org.xtext.example.mydsl.ui.AbstractMyDslUiModule {
    public MyDslUiModule(AbstractUIPlugin plugin) {
        super(plugin);
    }

    public Class<? extends IContentOutlinePage> bindIContentOutlinePage() {
        return MyOutlinePage.class;
    }
}

Regarding the Linking:

Debug org.eclipse.xtext.ui.editor.outline.actions.OutlineWithEditorLinker.selectInTreeView(ISelection)

Maybe you don't create the nodes correct. but you have to find out that yourself as well how to fix it