Unfortunately, I do most of my programming in Java (sorry Java-lovers, but I hate Java). But the JDT really makes it a breeze to write code for the CDT plug-ins. My favorite feature is F3, or Open Declaration. Whenever I'm investigating code, I like to go visit the implementation of some unknown method to see what it does. F3 lets me jump from class to class and get a quick overview of the system I'm trying to program against.
Well, I'm trying to do the same thing with the CDT. Before CDT 4, Open Declaration tended to be slow since it did a complete parse of the file you're viewing and all the files that it includes. With CDT 4, we're now only parsing the file and using the CDT index to get all the other declarations needed for that file.
As well, F3 tended to be hit and miss on whether it actually found anything. A lot of that had to do with the indexer's need for build information that is often hard to provide. Also a lot had to do with information that we hadn't collected yet, C++ template information for example.
With CDT 4, F3 promises to be a whole lot better. I'll be spending a bunch of my time as we start to wrap up CDT 4 development on making sure it finds as many definitions as it can so that it can be as useful to CDT users as it is for JDT users. The one I just added that made me think of blogging about it is #include statements. Wonder what's in that include file you #include'ing? Well move the cursor to the statement and hit F3. Bingo, there's the include file (at least as long as the index knows where it is). I look forward to adding more cool features like that.
What is wrong with Java? Other that the fact that you cannot allocate memory on the stack and therefore don't have destructors.
ReplyDeleteBingo!
ReplyDeleteSince I took over the Equinox launcher, I've been writing both C and Java. Java seems so much more luxurious, like taking a car instead of walking (up-hill, both ways, through the snow just like your father did).
ReplyDeleteDoug:
ReplyDeleteSorry to bother you, but this new Eclipse "feature" is killing me and I just don't know where to go for help on disabling it!
Like yourself, I used to be very fond of "F3 Open Declaration" (Java, not CDT --BTW, you're totally correct on the lack of destructors in Java, it is THE singular feature frow which most of its other ailments stem). Now the unfathomably bright minds at Eclipse have decided it was not enough with taking you to the definition, they also had to restrict you to view ONLY the declaration ... The tab still has the name of the FILE, everything in the view tells you you should be looking at a FILE, but you can only see the METHOD whose declaration you asked for, can't page up/down to see the FILE ... why, oh why, why did they break such a basic navigation convention? Who thought it was a good idea to restrict me to view MY OWN CODE one method at a time? D*mnt them to hell!!
In the meanwhile, if you know what I'm talking about and know how to restore some sanity to my Eclipse by disabling that behavior, I will very much appreciate a tip ... Many thanks in advance!
Looks like a pretty old post but if anyone cares, here is how you cause Eclipse to show the entire file and not just the selected element:
ReplyDeleteOn a mac: eclipse->preferences->java->editor->
uncheck: "only show the selected java element"
On windows I think that preferences option is in tools or something, should be easy to find.
i need to know how f3 works in cdt. What is the flow when user pressed f3 in cdt. Hope you can enlighten me on this. My email ad is apenamante@ftsp.ten.fujitsu.com. tnx
ReplyDelete