Eclipse CDT eclox reference autocompletion - eclipse

I just started working with doxygen and eclox (eclipse CDT, C++) and love the whole package. There's only one thing I'm really missing: whenever I try to add a \ref to a function, class or variable, I have to manually remember the (fully namespace qualified) name of what I want to refer to.
It would be AWESOME if it was possible to use the (already existing) code completion feature from eclipse to suggest the right function, class, etc.
Like so:
/**
text yadayada bla \ref std::str<ctrl + space here> -> complete to std::string so that doxygen understands the link
*/
Is that possible? I'm actually surprised that I couldn't find anything about this elsewhere. Is everybody really inserting all references manually all the time?
It becomes quite cumbersome when referring to e.g. imed::helmbus::io::subclasses::CAN_Reader
Adding a reference to this should work the same way as when I'm actually coding:
/**
\ref ime<ctrl+space> -> show list of namespaces beginning with 'ime' -> complete to 'imed::'<ctrl+space> -> show list of subnamespaces -> ... -> imed::helmbus::io::subclasses::CAN_<ctrl+space> -> complete to CAN_Reader
*/
Or is there maybe a place somehwere where I can find out how to do this? Or why it's impossible?
Thanks!

Related

creating a define only used by eclipse

I have project that was created in another IDE that is build for a specific microcontroler. In the code faris used quite often and it is comprehended by the IDE and compiler.
I would like to use eclipse to edit the code, because it is more convinient to use. But it generates a lot of warnings and errors in the editor because he can not resolve the far.
I could create a macro #define far, but I would have to remove it when I want to compile the code. I don't compile with eclipse, because getting the compiler to work there is cumbersome and might introduce problems.
So is there a possibility that eclipse itself can handle the far for its syntax check?
Another approach that involves modifying your code rather than the project settings would be:
#ifdef __CDT_PARSER__
#define far
#endif
__CDT_PARSER__ is a macro that is automatically defined by CDT's parser when it processes your code, but not by any compiler.
After I searched a bit more I found an answer here:
https://www.eclipse.org/forums/index.php/t/72375/
Go to the menu:
Project -> Properties -> C/C++ General -> Path and Symbols ->
Symbols
and add a Symbol called far with the value /* */.
I just left the value empty and it worked.

Newbie IDE (IntelliJ IDEA) issue: .class files not all usable

I'm working on a school project right now, and every time I have in the past, I always make a new Project in IntelliJ IDEA. However, this time she gave us some .class files that have methods in them that we can't see (she described what they do so we know how to use them) but need to use, so they have to be in the same folder, obviously.
SIDENOTE: I'm also new to using Macs, which is what I'm on at the moment.
Anyways, I put the .class files in my src folder that I found in the Project8 folder. I just made an array of the Book objects, which was one of the .class files I moved, and now I need to use a method from the other .class file, named BookInventory.class. I put that file in the src folder just like the other, but it won't let me use the only method in that class, which is LoadBooks.
Here is the LoadBooks signature:
public static void LoadBooks(Book[] b)
And here's the description of it that she gave to us:
"For each element in the array, accepts user input for the book, creates the Book object, and stores the object into the array."
So, when I made the array of Book objects, IDEA made an import statement up top all by itself, I didn't type it:
import java.awt.print.Book;
So why does IDEA recognize the Book.class file and allow me to use it in this .java file for my project, but it doesn't seem to notice the BookInventory.class file?
Any help appreciated, thanks ahead of time.
What is happening is when you first typed the line with LoadBooks(Book[] b), IntelliJ could not "see" your class files (you have subsequently loaded them in "class files" and added that as a project library, I presume).
IntelliJ however searched for and found a Book class in the internal java libraries, java.awt.print.Book. Note that this is a different class to the one your teacher gave you, which might have been e.g. edu.myschool.homework.Book.
Firstly, try to delete the line including the import statement, or manually change it to the correct package (your teacher can inform you what it is).
If the same import comes back automatically, you can go into Settings -> Editor -> General -> Auto Import and untick Add unambiguous imports on the fly - this will cause intellij to prompt you before adding imports.
Also, I would ask your teacher to give you the class files in a jar file, since that's the usual approach.
Good luck.

What do these Eclipse PyDev template variables do? ('next_class_or_method', 'prev_class_or_method')

I'm customizing some code templates for PyDev (Eclipse). Inside the Edit Template dialog, which can be found at:
Preferences => PyDev => Editor => Templates => {select_a_template} => Edit => Insert Variable
..there are a number of built-in variables. Most of them make sense, but there are 2 that don't, namely: ${next_class_or_method} and ${prev_class_or_method}
What does that even mean in (either of) the context(s) of Eclipse Templates??
How would one go about using such a thing in a code template?
What would be even better, would be if there were some file in PyDev that could be altered to allow me to make my own "built-ins".
Does anyone out there know of these things?
Those give you the next declared class or the next declared method.
For an example that uses the ${next_class_or_method}, take a look at: http://pydev.blogspot.com.br/2011/06/overrideimplements-templates-on-pydev.html
For the previous one, I don't have an example (it's a mix of the ${current_class} and ${current_method} -- which is used on the 'super' templates, but it won't distinguish if you have a class or a method before it).

Eclipse caret jumps to constructor while typing

While typing in Eclipse (Java) I often have the problem that when I begin to type accessors, the caret jumps down to the beginning of the constructor definition. So in a document like this:
private int mSomeInt;
public
in|public MyClass(){
}
I would like to manually type out the accessor (getter/setter) for mSomeInt, but when I press space after 'public' above, the caret jumps to the beginning of 'public MyClass'.
I often type complete lines to look up and find my methods jumbled with the constructor (like above).
Any help would be appreciated.
Note - this isn't only with accessors but rather any access modifiers that I define before the constructor or another method.
Edit
After unsuccessfully trying Deco's solution below, I've managed to narrow it down a little further.
The problem only happens if I have all the blocks in the file in a collapsed state (ctrl+shift+numPadDivide). I can see the problem is now that the new access modifier I type is then (quickly) collapsed into the below method. i.e. Eclipse is actually taking the first accessor modifier and collapsing everything from there, even though my intention is actually to write a new method.
The only solution I've been able to find is to only edit the source with all the 'fold' elements unfolded.
Under Window -> Preferences -> <Language> (e.g. Java) -> Editor there is a Content Assist menu item where you can configure auto completion and caret placement as well as auto-activation of it and the delay it uses.
Edit:
After your update to the original question I was able to successfully replicate this in Eclipse Indigo. When you have all of the code blocks collapsed it looks like Eclipse assumes that the code you are writing needs to be in that block (rather than as a variable declaration). I'm not sure if this is expected behaviour or not - but the only way around it I've found is to edit the code with the main block open, and then close it after the fact - or turn folding off altogether.
From what I can tell there are various folding plugins/addons that you can get for Eclipse which override the default behaviour and might function better? A quick Google search will be able to get you a list of them quickly.
I'd probably also suggest posting this as an issue on the Eclipse support site for their official answer.
Unfortunately this issue still exists for me in the latest Elcipse version (Kepler).
As the issue only occurs when the document is 'folded', the work around this is to either disable folding in the editor - or disable folding on 'Members' from the :
Preferences -> Java -> Editor -> Folding

Why eclipse is generating argument names as arg0,arg1,arg2.... for methods?

When I try to access some class's method; eclipse gets that method but arguments inside that method are replaced by arg0, arg1, arg2...
Example:-
Suppose I have this method in some class named ReadFile.java
#Override
public int readXXX(int start, int end, String xxx) throws IOException {
return 0;
}
When I try to access that method from an instance of class it shows me as follows:
readFile.readXXX(arg0, arg1, arg2);
It becomes hard to identify what I should pass in argument. The same thing also happens for java methods. i.e. when I implement interface all method under that will be generated but arguments in that methods are arg0, arg1.....
Is there any setting I can do prevent this?
I'm using Eclipse Galelio.
Eclipse can't work out the arguments because it can't find the source or javadoc attachments.
Make sure your source is attached.
To check, click on the method call readXXX and press F3 which should open the method declaration. If the source is not attached, Eclipse will say "Source not found" and will allow you to "Attach Source...".
Anyone having the same issue, try performing a Project > Clean, this will delete the old class files, and Eclipse will recompile them in debug mode this time. Worked for me in Indigo 3.7.2
The problem is that your class files lacks debug information embedded in them. JDT doesn't reparse the source files or the javadoc for dependencies, when building the AST for your project, so it doesn't have idea what the name of the parameter is, even when you are able to open the class and clearly see what are the method names.
In order to correct this, you need to recompile your class files with debug information enabled, which makes the class file considerably larger, but unless you are developing for memory-constraint devices, you should be fine.
for those like me who tried to apply one of our colleagues suggestions and unfortunately hasn't worked, please, give a try to check the option "Add variable attributes to generated class files (used by the debugger)" within Window -> Preferences -> Java + Compiler.
Once you've done that, try to build the project again.
Cheers.
I solved this by going to preferences
Java / Content Assist
On this page under "Sorting and Filtering" I unchecked "Hide proposals not visible in the invocation context" now instead of seeing (arg0, arg1, arg2) etc in autocomplete I see (catalog, schemaPattern, tableNamePattern...)
I am using Spring Tools Suite 3.7.2 which runs on the Eclipse Mars 4.5.1 platform.
This link helped me to solve this problem.
1) Right click on your android.jar and select Properties.
2) Select Java Source Attachment. Enter the source directory location (you can also use External Folder… to browse to the directory) and click on “Apply“.
The code names match the following version numbers, along with API levels and NDK releases provided for convenience: