473,387 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Insert item on TreeViewer

I need to add an element on a tree object in an Eclipse plug-in into a specified position.

I use org.eclipse.jface.viewers.TreeViewer for the viewer.
I want to insert an item before the current selected one, for having the selected item I use the viewer.getTree().getSelection()[0] instruction, but I can't find the right position. if I use the viewer.getTree().getItems() I only receive the root elements and not all items (also under the roots elements).
so when I pass the selected item on viewer.getTree.indexOf( elem ) instruction, I receive -1

Any suggestions?

Thanks
Oct 24 '08 #1
1 2235
Now I've solved the problem: after getting selected item using the getTree().getSelection()[0];
I get the list of child items with selected.getItems(); and after that I scan the array finding the position of the previous item, so I can insert the new item on the position searched
Oct 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: PT | last post by:
I got a problem. And thats..... First of all, I got these three tables. ------------------- ------------------ ---------------------- tblPerson tblPersonSoftware ...
0
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too...
2
by: maltchev | last post by:
i need to insert data from an xml file into sql server table. the xml file contains only one record. how to insert the data? how to map the names of the fields in the xml file and the table?...
2
by: Jeff | last post by:
I need to insert into a table multiple item of a listbox. (item.text and item.value Right now, I'm using an OleDBConnection with Access, a Command(Insert string) and parameters. I don't see how an...
1
by: Dazz | last post by:
Hello I have made a small app to query a database which works fine. I am now adding a logging function which writes back to the database in a separate table. When I update the OleDataAdapter,...
9
by: David Eades | last post by:
Hi all Complete newbie here, so apologies if this is the wrong forum. I've been asked to use mysql and asp to make a simple bidding system (rather like a simple ebay), whereby users can use a...
1
by: javedna | last post by:
Can PHP help with the following as I have tried in the MYSQL Forums and cant get any help Thanks Nabz ---------------------------------------- Hi I am developing a PHP MYSQL questionnaire...
2
by: joel | last post by:
Hi Guys ... I need some help on this... i know i've followed the right declarations on this.. or if not i may be close on hitting it. And i know there's something wrong with this code. This is...
0
by: Seesharp2008 | last post by:
Hi every body I am writing a code, which should show the treeviewer of an xml file. I've used recursive function for finding the children of each node in the tree. My problem is, I can't fix the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.