Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » How to programatically select a node from the outline?
How to programatically select a node from the outline? [message #1099231] Sun, 01 September 2013 10:40 Go to next message
Eclipse UserFriend
Hello Again Smile

I have a button in the upper right corner of my XML Editor that compares the opened XML file with another one based on a specific set of criteria.

The action then displays a Dialog with the items that have problems or needs to be revised. These items are displayed in a ListViewer.

Now I want user to double click an item in the list, and the tool highlights or selects the appropriate Node for him. Is there a way to highlight or select a Node from the Outline on the left programatically?

Thnx
Re: How to programatically select a node from the outline? [message #1100829 is a reply to message #1099231] Tue, 03 September 2013 16:56 Go to previous messageGo to next message
Eclipse UserFriend
In your action, you have access to the context Sapphire Part. From there...

MasterDetailsEditorPagePart page = part.nearest( MasterDetailsEditorPagePart.class );
page.outline().setSelectedNode( ... );
Re: How to programatically select a node from the outline? [message #1101207 is a reply to message #1100829] Wed, 04 September 2013 06:23 Go to previous messageGo to next message
Eclipse UserFriend
page.outline().setSelectedNode( ... );


This method needs a "MasterDetailsContentNode" object. How to get that from an "IModelElement" object?

UPDATE:

I found it Smile using:

page.outline().getRoot().findNodeByModelElement(element);


ANOTHER UPDATE:

Method "findNodeByModelElement" doesn't search the entire tree. It searches only among children nodes of the caller node.

[Updated on: Wed, 04 September 2013 07:02] by Moderator

Report message to a moderator

Re: How to programatically select a node from the outline? [message #1101530 is a reply to message #1101207] Wed, 04 September 2013 15:23 Go to previous messageGo to next message
Eclipse UserFriend
It sounds like you found the API that you needed. If you call findNodeByModelElement on the root node, you will search the entire tree.
Re: How to programatically select a node from the outline? [message #1102188 is a reply to message #1101530] Thu, 05 September 2013 13:36 Go to previous messageGo to next message
Eclipse UserFriend
Konstantin Komissarchik wrote on Wed, 04 September 2013 11:23
If you call findNodeByModelElement on the root node, you will search the entire tree.


Well .. in my case it didn't!
It only searched among the first level children!
Re: How to programatically select a node from the outline? [message #1102628 is a reply to message #1102188] Fri, 06 September 2013 00:14 Go to previous messageGo to next message
Eclipse UserFriend
Are you certain? You may want to step through the invocation in your scenario. The method in question is definitely recursive...
Re: How to programatically select a node from the outline? [message #1105123 is a reply to message #1102628] Mon, 09 September 2013 11:53 Go to previous message
Eclipse UserFriend
Sorry, my fault Smile You're correct
Previous Topic:SapphireEditor never dirty without SourceEditor
Next Topic:Enable/disable individual FormEditorPage (or page contents) based on model properties?
Goto Forum:
  


Current Time: Wed Feb 19 13:21:16 GMT 2025

Powered by FUDForum. Page generated in 0.04425 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top