Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
LANG: Fix outline selection update bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed May 28, 2015
1 parent 14f1529 commit 204b368
Showing 1 changed file with 11 additions and 2 deletions.
Expand Up @@ -86,17 +86,26 @@ protected void updateTreeViewer() {
updateSelectionFromEditor();
}

protected boolean updatingFromEditor = false;

protected void updateSelectionFromEditor() {
StructuredSelection newSelection = editor.getSelectedElementAsStructureSelection();
getTreeViewer().setSelection(newSelection, true);
try {
updatingFromEditor = true;
getTreeViewer().setSelection(newSelection, true);
} finally {
updatingFromEditor = false;
}
}

@Override
protected void treeViewerPostSelectionChanged(SelectionChangedEvent event) {
Object firstElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
if(firstElement instanceof StructureElement) {
StructureElement structureElement = (StructureElement) firstElement;
editor.setElementSelection(structureElement);
if(!updatingFromEditor) {
editor.setElementSelection(structureElement);
}
}

super.treeViewerPostSelectionChanged(event);
Expand Down

0 comments on commit 204b368

Please sign in to comment.