|
Re: expanding subtree in emf editor [message #734834 is a reply to message #734767] |
Mon, 10 October 2011 06:47 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Jay,
This doesn't really sound like an EMF question... Can't this work
without dropping down to use the underlying tree widget?
On 09/10/2011 10:45 PM, Jay Norwood wrote:
> I'm adding an action to expand a subtree in the emf editor's
> treeViewer, and it took me a while to figure out that the TreeViewer's
> expandToLevel wouldn't work on the TreeItems returned by
> getSelection(), which I figured out when I tested isExpandable(item)
> in the code below.
>
> The isExpandable(item.getData()) returns true, though, so the action
> below works to expand a subtree in my editor.
> protected IAction expandSubtreeAction =
> new Action("Expand SubTree") {
> @Override
> public void run() {
> PfsEditor ip = (PfsEditor)activeEditorPart;
> if (ip != null){
> CheckboxTreeViewer vw = (CheckboxTreeViewer)ip.getViewer();
> vw.getTree().setRedraw(false);
> TreeItem[] treeitems = vw.getTree().getSelection();
> for (TreeItem item:treeitems){
> if (vw.isExpandable(item.getData())){
> vw.expandToLevel(item.getData(),AbstractTreeViewer.ALL_LEVELS);
> }
> }
> vw.getTree().setRedraw(true);
> }
> return;
> }
> };
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03071 seconds