is there any way to have Java Swing help/docs appear in Eclipse when floating over a Swing item. It would save a lot of time bringing up a Google search.
First download the corresponding docs for your jre, I have 7 so I would get this one. (You can alternatively use the online method but this way is faster and you can use it offline)
Open Eclipse and go to Window > Preferences > Java > Installed JREs. You can then select the jre you are using and click edit.
Select all the .jar items from JRE system libraries then click Javadoc Location..., Tick Javadoc in archive and then locate the .zip you downloaded, set it to Archive path and set the Path within archive textbox to docs/api.
You can then check to see if this is set up properly by clicking Validate. It should print a similar message like the one above. (Location is likely valid..)
Hover over a keyword and it should popup the docs, you can press F2 to 'focus' on the information. You can also use Shift + F2 to open it in a new tab.
Related
I found no easy way to show a file opened in Eclipse (or listed in the project navigator) in Windows explore, while it is easy to be achieved in Visual Studio, see below image, you can right click on the file and choose Open Containing Folder which will open the containing folder.
Do you know there is an easy way? which is better than navigating to that file directly (cumbersome).
Here it goes, am using Eclipse Juno Service Release 1
'Show in' is only available in the 'Package Explorer' view which comes with the Java perspective. For the more generic 'Project Explorer' or 'Navigator' views (former recommended) you should use StartExplorer plugin instead.
With this plugin (as opposed to built in 'Shown in') you can also define a keyboard shortcut through Window --> Preferences --> General --> Keys. The default shortcut for StartExplorer's "Show in File Manager" feature is Ctrl + Alt + E.
I have recently got a new computer and I have put Eclipse Helios on there. Before, on my old computer, when I used the control-assist (Ctrl + Space) and highlighted the suggested methods, the Javadoc for that method used to appear at the side of the control assist pop up window with the method description and parameters etc...
However, on my new computer this Javadoc doesn't appear and only the method suggestions appear - but even the arguments for the methods aren't named (they're just called arg0, arg1 and so on). The only thing I can think of that is different on the new install is ZoneAlarm but as far as I can see I have allowed eclipse through the firewall; unless it's something to do with Java itself.
This feature is really useful to me so any advice on how to resolve this issue would be greatly appreciated. Thanks in advance.
Eclipse is using a JRE instead of a JDK as the default Java.
Download and install a JDK.
In Eclipse Preferences, Java -> Installed JRE's. Use "Add" or "Search" to locate and add the JDK just installed.
Move the check mark indicating the default Java to the newly found JDK.
Allow the workspace to rebuild.
You need to press F3 on the Class or Method name you want to see javadoc for. Then in the editor it's source will open or if you don't have source attached, you'll have screen with bytecode saying that no sources attached. Then you need to open package view, by default it's on the left side. On the top of it there is an icon with two arrows, if it's not pressed, press it. It will show source you've opened in the package view, then you need to find jar file containing your source by scrolling up if you already don't stand on it.
Now press right mouse button on that jar, you'll see properties window. Select javadoc, then you need to select location of the javadoc. You can provide a URL to an online javadoc. The URL you will be pointing to must provide a page named 'index.html' or similar or Eclipse won't allow you to use that URL. Also you can download javadoc locally and then select the location of that javadoc archive. If you need the javadoc for java SE libraries, you can find it in your jdk installation directory in src.zip folder. Hope it'll help.
Did you specify the javadoc location of your library?
Window -> Preferences -> Java -> Installed JREs -> Select your JRE -> Edit -> Select .jar file(s) (rt.jar) -> Javadoc Location
Just curious if there's a setting somewhere in Eclipse to keep blocks of code collapsed when the class is opened? It's just I'll collapse methods then when the class is re-opened, everything is expanded.
Thanks
In Windows > preferences:
Java > editor > folding: check all, click apply & then OK.
Maybe this helps: Ctrl + Shift+ NUM_KEYPAD_DIVIDE collapse all methods in a java class.
Source
Yes . From the eclipse official documentation :
You can specify which regions are folded by default when an editor is
opened. Have a look at the Opens the folding preference page Java >Editor > Folding
preference page to customize this.
Just click all the checkboxs .Then whenever a .java file is open in the java editor , everything will be collapsed.
Not sure if this options is the new feature for eclipse indigo version (3.7) , so you may have to update your eclipse to indigo if you use older version but cannot find this option.
I'm not aware of a solution, but let me tell you how I work - maybe this is a solution for you as well:
Enable "Only show the selected Java element". The editor will only show the element (method) you selected (see screenshot).
While editing a file use either the Outline view or CTRL + O to navigate through the class file.
Btw: I disabled all folding options as the above approach just works best for me. Sadly, I'm not aware of a shortcut to enable/disable the "Only show the selected Java element".
Yes, you can set the options what to fold on file open.
You can find it at Settings->Editor->Folding
It features a resonable selection of folding options.
How can I add JavaDoc or other document to netbeans ?
I try with this way :
Tools >> Java Platform >> JavaDoc Tab >> JavaDoc.zip (in my desktop)
but in editor when I press Ctrl+Space in tooltiptext this message shown :
Javadoc not found. Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager.
I tried restarting NetBeans but this was the result:
try this in NetBeans IDE
Choose Tools > Java Platform Manager from the main window.
Select the platform to which you want to add Javadoc in the left panel of the dialog box.
In the Javadoc tab, click Add ZIP/Folder and specify the location of the Javadoc files.
Click Close.
Hope this helps.
If you are using maven in your project then follow below steps to attach Java docs for your attached libraries.
Right click on "Dependencies" folder of your project.
Then choose "Download javadoc" option
It will download javadoc of your libraries and attached it.
Now when you will press ctl + space then you will see docs for that library.
and If you want to add javadoc for particular library then follow the options as suggested by Himanshu Soni.
You can't usually just add the javadoc zip as a separate library (at least this hasn't worked for me in the past.) In the libraries section you need to select the library you want to add the Javadoc for and then add the Javadoc jar for that specific library.
Restart Netbeans then that should work. Though of course if there really is no Javadoc for that method you still won't get any (I've fallen into that trap a couple of times before!)
You followed the very right procedure, I've been threw this right before I write this answer, and as for this is the first result that shows up when you Google the problem, I think that many people will find it handy and save their time, the solutions is:
UNZIP the JavaDoc.zip file that you are referring to ( which is supposed to be jdk-7u4-apidocs.zip for JavaSE 7 docs) and repeat the same procedure, which is Tools --> Java Platforms --> Javadoc ( tab ) then press " Add Zip/Folder, and point to the unzipped folder instead of the zipped one, restart NetBeans, and it will work smooth and direct.
You should download the docs file from the following link:
http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html
After completing the described operation, you will have your javadocs available offline, and you don't need to be connected to the internet to know about APIs.
Best regards brother.
"Tools >> Java Platform >> JavaDoc Tab >> JavaDoc.zip"
The problem with above step can be solved easily by moving down following two path already added in content panel as shown below.
Step 1-
Goto: Tools >> Java Platform >> JavaDoc Tab
and Add ZIP/Folder you want to add.
Step 2-
Step 3-
That's all and if zip file doesn't works the extract first and then add it.
I had the same problem, and I solved it by removing all URLs and adding only the apidocs.zip downloaded from oracle. After that restart your NetBeans.
Before test whether it works be sure the method you are looking for actually exists within the apidocs. Open index.html and make a search for that particular package.class.method you need.
If it doesn't work, try to manually copy the apidoc.zip to the docs directory of netBeans:
C:\Program Files\NetBeans 7.1.2\java\docs and then retry.
this help me:
http://wiki.netbeans.org/FaqJavaDoc#Adding_the_JDK_Javadoc_to_the_NetBeans_IDE
try it, maybe help
Using a Maven project inside of Netbeans v8.02.
First, view your project via the Projects window;
Expand your project's Dependencies folder
Right-click the desired *.jar file
Click download javadoc
Done!
This worked for me, I manually copy the apidoc.zip to the docs directory of netBeans: C:\Program Files\NetBeans 7.1.2\java\docs and then restart my netbeans.
I'm using this technique to create a target platform for my Eclipse RCP projects: http://www.modumind.com/2009/09/01/creating-an-eclipse-rcp-target-platform/
The RCP SDK is downloaded directly using the software site. As for the delta pack, I manually downloaded it from website, and added the directory in the target definition file, which in my opinion is tedious when I want to upgrade the delta pack version next time.
Is it possible to download the delta pack using the software site too? Or at least do it in less manual and more maintainable approach?
Thanks.
Add a main eclipse update site to the target. Take care of the version.
Then from this site choose the RCP target and Equinox target features. Make sure to check "Include all environments".
Example of update site: http://download.eclipse.org/eclipse/updates/4.2
Addition
Here is the full answer to this question.
Preferred way of using the "DeltaPack"
The DeltaPack is used to get platform specific artifacts so that you can export your RCP product for multiple platforms. See the next section for more information on the DeltaPack
Adding platform specific artifacts
The preferred way of getting the platform specific artifacts is to just add them to the target platform. There is no need to look-up and download the "DeltaPack" if you follow these instructions.
Open Window/Preferences.
Find PDE/Target Platform
Select your (active) target platform
Click Edit
Click Add
Select "Software Site"
Click Next
In "Work With" type: http://download.eclipse.org/eclipse/updates/4.3 (replace 4.3 with your current version)
Check "Eclipse RCP Target Components"
Check "Equinox Target Components"
Uncheck "Include required software"
Check "Include all environments"
Press Finish
Press Finish
Press OK
Open your product file and select the "Export" option. You will see that the "Export for multiple platforms" checkbox is available.
Old way of using the "DeltaPack"
What is the DeltaPack
The DeltaPack is a distribution from Eclipse that contains platform specific files for all supported platforms and widget sets. It contains:
SWT Platform Layers
Various plugins to handle connection to the native OS widgets.
Various launchers (exe, cmd, etc..)
Files to launch Eclipse from the command line
Other platform specific plugins
Hooks into secure storage, native networking and native Eclipse filesystem hooks
In total there are some 70 plugins to support the complete range of supported operating systems (around a dozen).
When do you need it
You need it if you want to export your RCP application to multiple targets (a combination of OS/ARCH/WIDGETSET: e.g. linux/ppc64/gtk ). This is typically done from the product configuration file.
How to get it
You can get it from: http://download.eclipse.org/eclipse/downloads/
Click on any of the builds and look for DeltaPack. Please note that there are discussions on removing the DeltaPack and getting it the preferred way.
How to add it to your target platform
Download the DeltaPack as described above
Unzip it to a location .e.g. "C:\eclipse-4.4M7-delta-pack"
Open Window/Preferences.
Select PDE/Target Platform
Select your (active) target platform
Click Edit
Click Add
Select "Directory"
Click Next
In "Location" type: "C:\eclipse-4.4M7-delta-pack\eclipse"
Press Next
Press Finish
Press Finish
Press OK
Open your product file and select the "Export" option. You will see that the "Export for multiple platforms" checkbox is available.
During setting up a software site for your target, you can select 'Include all environments' (after unselecting 'Include required software'), which should make maintaining a delta pack unnecessary.
My solution for sharing delta-pack:
Download the official delta-pack
Convert it to update-site (or software-site as you call it)
Place the update-site to my own server (e.g. http://example.com/my-delta-pack)
Add the update-site to my target definition
ad 2)
I use a command-line tool called Publisher. It's a part of Eclipse IDE.
Example usage:
${eclipse.home}/eclipse.exe
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
-metadataRepository file:/${basedir}/${target.delta}
-artifactRepository file:/${basedir}/${target.delta}" />
-source ${source.delta}
-publishArtifacts
-compress