See Javadocs for basic classes in Intellij - java

Is there a way to see/attach the Javadocs and/or source code for basic classes (like String) in IntelliJ?
I'm using IntelliJ Community Edition 11.1

When you add new JSDK, sources are configured automatically:
If your JDK installation is missing sources, you will need to download and configure them manually. Mac users should refer to this answer.
When you have sources attached to the JSDK configuration, navigating to the class will open source code instead of decompiled stub and you can also use View | Quick Documentation based on the javadoc in the source files.

Have a look at productivity tips:
http://www.jetbrains.com/idea/documentation/tips/index.html

Related

Eclipse RCP - Shere javadocs and attached sources of dependencies among projects in workspace

I'm working on a set of plugins for a commercial Eclipse RCP Application "FOO_APPLICATION",
which comes with html javadocs for api plugins and without sources.
I'm using Eclipse 4.5.2 and the target "FOO_APPLICATION" is based on an older version of Eclipse, 3.6
Everything seems fine but I'm experiencing this annoying issue:
If I attach javadocs or sources to plugin dependecies (for eclipse standard plugins I can also attach sources, because I have also the original 3.6 sdk sources jar)
Eclipse does not remember this setup and I have to do this again at every startup. :(
What I'm missing here?
But consider also this point: I'd really like to solve this problem from a wider point of view: since I have many projects (in the same workspace) that share the same dependencies of "FOO_APPLICATION",
is there a way to setup sources or javadocs once and made them available throughout the whole workspace?
If the sources are present in the target platform as individual Source Bundles, the source is automatically displayed.
As far as I know, there's nothing comparable for Javadoc.

Browse JDK Source Code in Eclipse Like GrepCode

I like the way you can browse the source code of a library in GrepCode. Is there any way I can do the same in Eclipse?
I know that I can open the declaration of a class and look through it, but there seems to be no way I can search for something (a method, for example) in the Declaration window.
What I am really looking for is a way to browse the source code of the standard library just like I browse the source code of a class I am writing. It doesn't necessarily have to be the source that ships along with my JDK; I am happy to look at some other version as well.
What would be the best way to achieve this? Will I have to download OpenJDK and add it as a project in Eclipse?
You can install Java Decompiler plugin for Eclipse, such as JD-Eclipse
You could also use the src.zip file that ships alongside Oracle's JDK (located for example at something similar to C:\Program Files\Java\jdk{version} in Windows) and load it on Eclipse build path as a library (src.zip contains sources files for the java., javax. and some org.* packages, but not for com.sun.* packages)
Or you could download the whole bundle of source code for JDK at http://download.java.net/openjdk/jdk6/ (for JDK 1.6) and do the same
I think one of the good alternative for what you are looking for is zGrepCode. It allows you to browse Java Open Source projects as you are doing it in Eclipse by providing interlinking.
http://zgrepcode.com
Here is the place I found about this wonderful free tool.
https://dzone.com/articles/grepcode-is-down-whats-next?fromrel=true
Actually I just went with the Search feature in Eclipse. Since I wanted to look at the source code for classes in the JRE libraries, I just do Search --> Java and select the appropriate options (see the attached screenshot).
I would think that this Search feature could also be used to search in the libraries included in your build path too.
Pretty sure that m2eclipse allows source browsing, see: Get source jar files attached to Eclipse for Maven-managed dependencies
Intellij also has a maven plugin available that allows browsing.

How to make JEE6 javadoc work for a regular JavaSE project in NetBeans 7.0.1?

All I want is for JavaEE6 documentation to show in my JavaSE project. Maybe it's not possible.
The problem is that I created a plain old JavaSE project (i.e. New Project -> Java -> 'Java Application') in NetBeans but I have Java Enterprise Edition elements in it.
One of these elements is the javax.persistence #Basic(fetch/optional) annotation.
- When I press ctrl+space on this annotation, NetBeans says 'Javadoc not found.'. When I use Alt+F1 (Right-Click->'Show Javadoc'), the status bar says: 'Cannot perform Show Javadoc here.'.
Extra info:
1) netbeans_installation_dir\NetBeans 7.0.1\enterprise\docs contains the right API documentation zip file (javaee6-doc-api.zip).
2) I looked around on stackoverflow for similar solutions but they did not work for me - adding the .jar/.zip/folder to the library or via the 'Tools -> Java Platforms -> Javadoc tab' doesn't work neither.
Very strangely enough when I add the javaEE6.jar to the Javadoc tab of the JDK6 platform and in the Project structure window I right click on the 'JDK1.6' library with 'Show Javadoc', a browser window opens and I get to see JEE6 documentation like I wanted.
I'm guessing the problem is that I have a regular JavaSE project and NetBeans can't pick up the JavaEE6 javadoc because it doesn't know my app is partially using EE elements. It's probably also because that documentation is meant for JavaEE6 applications (that's why it's under the /enterprise folder).
So I don't know how to fix this. Is it a bug? (I read on a NetBeans bug report that this could be a possible bug).
This looks like to be a issue with how you are attaching the library to you project. The easiest way to do this, is using the libraries available at Tools > Libraries. You just need to make sure the library you are attaching to your project has the correct Javadoc attached too. If the Javadoc is not attached, you can try the following steps to do this:
In the NetBeans IDE, go to "Tools > Libraries".
Select the correct library and choose the Javadoc tab.
Click "Add ZIP/Folder" and browse to where your project Javadoc is located.
Specify the Javadoc ZIP or folder and click "Add ZIP/Folder".
Click "OK" to close the Library Manager.
More details can be found at [this NetBeans Wiki page][1].

How to compare two eclipse installations for missing features?

I have two coexisting installations of eclipse on my machine. One is the plain eclipse and one is STS (Spring Source Tool Suite). For some strange reason (which would be too tedious to explain here) I have to use the plain eclipse. However, I want to import, use some of the plugins that already exist in STS.
Is there a way I can go about achieving this?
If you don't want to scan the filesystem for the plugins, the easier solution is to go to Help -> About Eclipse -> Click on "Installation Details". That should provide you all the installed plugins in Eclipse.
It is possible to install the STS-specific bundles into vanilla Eclipse. You need to follow the instructions outlined here:
http://dist.springsource.com/release/STS/doc/STS-installation_instructions.pdf
Look at the section called "Update site installation".

Can I import codestyles into Netbeans?

I have tried NetBeans for some time, but have not made my final move yet. I need to be able to import codestyle settings from Idea or Eclipse. Anyone know it that is possible? Or if some plugins allow that?
No, there's not such thing. You'll have to edit font and color settings in a hidden folder or create a plugin. Can IDEA import NetBeans color schemes, can Eclipse do the same?
I am not sure whether this covers all codestyle settings in your existing IDE (Eclipse) and future IDE (Netbeans) but you can define .editorconfig file to maintain consistent coding styles between different IDEs. It has plugins for all major IDEs. http://editorconfig.org/
Besides, it really helps you if you have other project members using various IDEs.
For NetBeans 8.0 and 7.4 there is a experimental plugin to help on this matter. You can install it directly from the IDE searching for 'Eclipse Code Formatter for Java' or go to the webpage http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java and download the nbm file as needed. Be aware it is an experimental plugin, so use it carefully.

Categories