Map between Eclipse Compiler Errors and QuickFix Suggestions - eclipse

I want to create a map between Java compiler errors detected by Eclipse (as key) and the Eclipse Quick fix suggestions (as values).
I found the below page contains available Eclipse Quick Fix suggestions.
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-java-editor-quickfix.htm
However, I could not find a page shows a map between Eclipse compiler errors and their quick fix suggestions. Please let me know where I can find these relationships.

The documentation you reference says Here's a selection of available quick fixes - it is not a complete list and gets bigger with each release.
The list of quick fixes available depends on how many plugins you have installed in Eclipse that provide quick fixes using the org.eclipse.jdt.ui.quickFixProcessors extension point.
The primary quick fix processor for Java is org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor. You can look at the source of that to see the errors that are processed (about 224 in Eclipse Kepler).

Related

Shortcut for reference searching in Scala IDE (cmd+shift+G)

I'd like to find all references to certain methods within my workspace. I used to do this using Eclipse's ⌘+shift+G / ctrl+shift+G hotkeys for all my Java classes, but now nothing shows up when searching in Scala classes using the Eclipse Scala IDE.
I'm currently using Scala IDE for Eclipse v3.0.3.
Is this reference searching functionality already supported in the Scala IDE, and if so, what is the shortcut for it?
Thanks.
I had this problem too and I ended up installing the Eclipse Quick Search plugin from the Spring team that normally ships as part of STS. It has no Spring dependencies and is easy to install separately from the Eclipse Marketplace. Use ⌘+shift+L and start typing and you get incremental search results.
Find references is implemented as feature but it is far away from being as powerful as the Java implementation.
You can find the actual key combination if you do a right click in the editor area and navigate to the "References" entry.
However, if the find references feature doesn't find anything, then it is clearly a bug and it would be nice if you could report your use case in the ticket tracker.
Did you try using Scala-Search? It's available from the same update site as the Scala IDE itself, and it should find Scala references. See Features docs.

Javadoc could not be found in the attached Javadoc - a flaw with Eclipse + Doclava

There are quite a few questions with similar titles, but please read on as this is subtly different and I've not yet been able to find a solution in the many answers given to those other questions.
Scenario:
I have an external JAR file with a separate HTML tree javadoc. I have pointed Eclipse at the javadoc by completing the JAR's "Javadoc Location" in the build path dialogue. The source is not available to Eclipse.
At first it looks like this is working fine. If I hover over a class name (say, Wibble) the corresponding javadoc text pops up.
However, if I hover over a method (say the word create in blah = Wibble.create();), I get the pop-up "...the Javadoc could not be found..." which is confusing as it's just shown me the javadoc for the Wibble class.
Indeed, if I click on the icon within the pop-up to "Open Attached Javadoc in a Browser" it correctly opens the HTML and presents me with the text for the method that it just said it could not find!
Technical notes:
My Eclipse version is Android Developer Tools, Build: v22.2.1, though this was happening on vanilla Eclipse before I updated to the ADT version.
The javadoc is being generated by command line using the Doclava doclet.
Any suggestions about either what might be wrong in the javadoc, or in eclipse settings, or...?
EDIT In the course of subsequent experimentation I've found that this problem only occurs with a combination of Eclipse and javadoc generated by Doclava. My pragmatic solution has been to generate the javadoc twice - once for human readability by using Doclava, and once for Eclipse readability using vanilla Javadoc.
If anyone knows these systems in depth I'd still love to know why.
(In order to not leave this 'unanswered' now that I have a solution)
In the course of subsequent experimentation I've found that this problem only occurs with a combination of Eclipse and javadoc generated by Doclava. My pragmatic solution has been to generate the javadoc twice - once for human readability by using Doclava, and once for Eclipse readability using vanilla Javadoc.
If anyone knows these systems in depth I'd still love to know why.

discover which Eclipse projects are opened

Is there any way to discover programatically (but not in PDE code) which eclipse projects are opened?
I was hoping that would exist a .metadata anywhere telling me that, but couldn't find any non binary data.
The closer I got was something like:
"$WORKSPACE.metadata/.plugins/org.eclipse.core.resources/.projects/%s/org.eclipse.jdt.core/state.dat" where %s refers to the project name
I think m2eclipse uses that guy for some kind of control, because on a m2project this file gets removed as soon as the projects build.
Also, i found some information on .metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml but none of them give me the full info I was hoping to find.
Does anyone knows how to solve it?
I was trying on eclipse 3.7.
On eclipse 4.3 , at least, its possible to parse $WORKSPACE/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml and look up whether the desired project has a factoryID="org.eclipse.jdt.ui.PersistableJavaElementFactory", meaning it is opened.
I Didn't try this on 4.2 tough, maybe it works there as well.
To do it "programmatically", you call the APIs from the org.eclipse.core.resources plug-in. Otherwise, you are doing it wrong.

Scala # IntelliJ 12 - Can't fetch docs / some functions are not shown in dropdown. [BUGS]

I've been searching for a long time now to find a decent IDE for Scala.
Eclipse is not satisfying at all, as auto completion doesn't work, somehow. Also, I can't modify the libraries at all in the build path e.g. set the docs/source.
IntelliJ seems better, however, there are some major bugs:
When the drop down menu appears that lists all the function, some of them are sometimes just not shown! I think it's because of scala-library / scala-compiler, it mixes them up or something...
The docs cannot be fetched, I get this message over and over again (here the functions are listed, strange enough...):
This is the library window:
The dependencies and the compiler are set right, I strongly suppose.
Does anyone know what the problem is? And how to fix it? Or is it a known bug?
Is there an IDE that can handle Scala?
Regards!
Typically, searching for names (values/classes/functions/etc.) for auto-complete can be quite slow compared to Java in IntelliJ simply because the automatically imported namespace can be quite large, and it also searches through all implicit conversions. However, I've never seen it refuse to show functions like your screenshot, what version of IntelliJ and Scala plugin are you using?
I've never gotten the pop-up docs to work via attaching JavaDocs (I haven't tried remote fetching), so I'd recommend just ctrl+click to go through to the source to read the documentation there. (However, the function/type definition does popup correctly when sources are attached). I'd suggest posting an issue at http://youtrack.jetbrains.com/issues/SCL if you have the opportunity.
To your final question, the answer is unfortunately no. The tooling for Scala is nowhere near that of Java, but both Scala IDE for Eclipse and IntelliJ are making great progress in changing that, and both are strong in some areas while weak in others. In the end, you'll get limited support either way, so choose whichever fits you best.
I have found the solution to the problem:
The bug was caused by Java Decompiler Plugin. It tried to decompile the binaries of Scala's class-files, which obviously failed. This led to that error message and further led to the Scala plugin not working as it should, thus not displaying some of the functions.
This took me a long time to figure out, I installed 2 other versions of IntelliJ (which apparently imported the JD plugin), NetBeans and downloaded several builds of the Scala Plugin, only to discover this cause. Deactivating Java Decompiler solved it.
Regards.

Eclipse: Using "Open Declaration" ... in a Scala project

I've been trying to convert from Java to Scala for a few months, and found that the greatest roadblock is that Eclipse plugin for Scala is hardly better then using Vim.
I normally have "Build Automatically" on, so apart from Open and Save, the commands I use most of the time are:
Open Declaration (F3)
References > Workspace (Ctrl-Shift-G)
Open Type Hierarchy (F4)
Open Type (Ctrl-Shift-T)
Content Assist (Ctrl-Space)
and looking at the Outline.
None of this works with the Scala IDE for the libraries. Some stuff works for my own code, like outline. But the rest just returns the following error:
The resource is not on the build path of a Java project.
Is there any way to get any of those things to work in Eclipse? Without them, basically the only thing I get is syntax highlight and compile-on-save, and I can get syntax highlight from vim without needing 1.5 GB of ram...
With implicits, and static function import, finding out from where something comes is really difficult without F3. I ended up using Google to find what class/trait defines what.
[EDIT] I just pulled Eclipse Classic 3.6.2, and update-1.0.0-milestones-2.8.1.final, which wasn't available the last time I checked. They have fixed the Outline, and "Open Type", that's it. The rest still doesn't work.
Which version of the Eclipse plugin are you using? If the version is from a while ago, then you're right, it's a bit buggy.
However, there is a new version, currently in beta (as of 23.04.2011) available from Scala IDE Eclipse download site. This is a lot better.
Also, please make sure that the 'Use JDT content assists' checkboxes are checked in Scala->Setup diagnostics window.
Please try the new version, and see if it fixes your problems. If not, raise a bug, and the team will fix it.