Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323068

Summary: outline selection moves in linked mode
Product: [Modeling] TMF Reporter: Henrik Lindberg <henrik.lindberg>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jan
Version: 1.0.0Flags: jan: helios+
Target Milestone: SR1   
Hardware: All   
OS: All   
Whiteboard:

Description Henrik Lindberg CLA 2010-08-18 12:51:02 EDT
Currently, if outline nodes are added for attributes the outline does not behave as a user would expect.

If the outline view is linked to the editor, it works to click on entries in the outline and the editor shows what was clicked on. For regular objects it works fine, but when clicking on an attribute node, the correct place is selected in the text, but then focus/selection jumps to the containing node in the outline.

It is understandable that the selection needs to move in linked mode if the selected item does not have any visual representation, but if it has visual representation, the selected node should stay selected IMO.
(This is also somewhat related to bug 323065).

Here is how I create the node for the attribute "version" of a "unit":

public ContentOutlineNode createNode(BuildUnit unit, ContentOutlineNode outlineParentNode) {
    ContentOutlineNode result = super.createNode(unit, outlineParentNode);

    if(unit.getVersion() != null) {
      AbstractNode versionNode = BeeLangNodeUtils.getFirstFeatureNode(unit, "version");
      if(versionNode != null) {
        EObjectHandleImpl<EObject> handle = new EObjectHandleImpl<EObject>(unit, getResourceAccess());
        StyledString label = new StyledString("version");
        label.append(" : " + versionFormatManager.toString(unit.getVersion()), StyledString.DECORATIONS_STYLER);
        ContentOutlineNode n = new ContentOutlineNode(
          label, imageHelper.getImage(BeeLangLabelProvider.FEATURE), new Region(
            versionNode.getOffset(), versionNode.getLength()), handle, B3BuildPackage.Literals.BUILD_UNIT);
        result.getChildren().add(n);
      }
    }
...
return result;
}

It was suggested that I try result.addChildren(n) instead, but this has no effect.
Comment 1 Henrik Lindberg CLA 2010-08-19 10:26:05 EDT
This is related to bug 297473
Comment 2 Jan Koehnlein CLA 2010-08-20 11:25:37 EDT
Should be fixed with bug 322656.
Comment 3 Karsten Thoms CLA 2017-09-19 16:21:43 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.