Enable ctrl-click to jump from EL to java module - eclipse

I'm using Eclipse Java EE IDE (Galileo) with seam framework. I'm interested how to enable ctrl-click to jump from an EL to a java module (in jsf views)?

Eclipse does recognize ctrl-click in JSF EL, such binding is defined in General>Editors>Text Editors>Hyperlinking. You will be able to use it only on variables defined in faces-config, so those are bound to the Classes before runtime. Am i wrong?

Related

Adding JSF 2.2 results in "Found multiple versions of the required class javax.faces.FactoryFinder"

I'm wondering how I can use JSF 2.2 (instead of the 2.0.2) in Eclipse?
It seems like there is no official release (only majorra 2.0 and myfaces 2.0.2 are available)
and when I add jsf 2.2 impl and api manually (Project Facets), it tells me: "Found multiple versions of the required class javax.faces.FactoryFinder.".
When i remove the old (myfaces 2.0.2) tomcat fails...
is there a way to make JSF 2.2 run in eclipse as default?
You can both, add the library to your classpath or configure it in jsf preferences, if you've the facet enabled. In the first way you're not telling Eclipse you're using JSF and second way you tell it and you can choose between configuring the classpath yourself or make Eclipse choose which JSF jars you want to use to let it include them.
First of all you need to download the jars from Mojarra's or MyFaces'es site. MyFaces doesn't have 2.2 version implemented as of today.
To just add the library to your classpath, right click on the project and go to Properties, Java build path. Then click on Add JAR or Add External JARs, depending where you have the jar and add the jsf-api and jsf-impl jars.
Otherwise, if you have the project configured as a JSF project, firstly you have to enable the JSF facet, check Project Facets. Then Eclipse will create a submenu inside Project Facets, letting you configure JSF. You can choose disable library configuration and do it the previous way or select User Library:
Then click on the books icon and you can add a new user library. Once added you only need to add required jars. Keep in mind that you need both jsf-api and jsf-impl jars to have it working, as Tomcat is a plain servlet container and doesn't include any JSF implementation out of the box.
Alternatively, you can also place the jsf-impl directly in your Tomcat shared libraries folder. You should drop it in $CATALINA_HOME/lib and every single application you deploy will use the same implementation. In that way you can just reference the jsf-api from your projects and code against it, having the implementation itself into the server's classpath.

Adding Java EE sources to an Eclipse project

Using Eclipse, I have configured one Java EE project to include in its class path the JBoss 7.1 Runtime.
(I did this with the "Add Library" button in "Project properties" -> "Java build path" -> "Libraries").
I use Maven to build the project and "normally" this works fine.
However, when I debug this application the Java EE source classes are not available. Just in case I took a look in the JBoss runtime but apparently the sources are not there. My main question is: Could someone please tell me what is the best way to add the Java EE sources to my Eclipse project so they will be available when debugging?
Also, if I am working with Maven is fine to add the Java EE libraries as the JBoss Runtime, as I am currently doing in my project? or it is considered a better approach to declare the dependency on Java EE in the project POM instead?
I started to wonder if the JBoss runtime approach was the "correct" way to add the Java EE binary classes, since strangely enough Maven from time to time fails compiling the application since it cannot see anymore the Java EE classes. I solve this deleting the JBoss Runtime from the build path (in the Eclipse project configuration) and adding them again. Fortunately, this compilation does not happen often, so I have been able to work doing this workaround until now.
Thanks for any feedback.

Eclipse plugin for Facelets files

I have checked this question but it seems outdated now. Are there any plugins for Eclipse that supports Facelets/XHTML files and eases the development?
Both the Glassfish Eclipse Plugin and the JBoss Tools Plugin supports Facelets files and autocompletion of JSF tags. The JBoss Tools Plugin also adds EL autocompletion support to this.
The Glassfish Eclipse Plugin only works when your target runtime is set to Glassfish and the JBoss Tools Plugin only works when your target runtime is set to JBoss AS. JBoss AS is deep under the covers the same as Tomcat (which is just a simple Servlet container), but then enriched with a lot of additional Java EE aspects such as JSF, EJB, JAX-WS/RS, JMS, etc.

Eclipse Indigo (EE) + Java EE 6. Where are the classes in "javax.*"?

I've just installed Eclipse Indigo for EE and Java EE 6 SDK/JRE from Sun. I need all those to compile a 3rd party Java project using the "javax.*" classes. What I cannot understand how to reach those classes?
How can I import or otherwise connect to "javax.*" classes inside Eclipse?
They're in the Java EE implementation. In other words, they're in the application server. For example, Glassfish, JBoss AS, Tomcat, etc.
In Eclipse, just integrate the target server in Servers view and associate the dynamic web project with it. You can select it during dynamic web project creation wizard:
or afterwards via Targeted Runtimes in project's properties:
Once associated the project with the application server, Eclipse will do all the necessary magic to make those classes available during compiletime. To verify it, the associated server should be listed as Library in project's Build Path property:
Note once again, you don't need to change/fiddle anything in there! If you did some attempts beforehand while shooting in the dark in order to "fix" this problem, then you should make sure that you've undone it all, or things may still go wrong.
See also:
How do I import the javax.servlet API in my Eclipse project?
Make sure you have all the settings in preferences set. Go to 'Window' -> 'Preferences' and then check the 'Installed JREs', point it to your newest and greatest jre within downloaded jdk. If that doesn't work, download jdk and eclipse Java EE again and start from scratch. Also make sure you have a java and javac added to your PATH (either on Linux or Windows)

EL proposals / autocomplete / code assist in Facelets with Eclipse

I tried to activate EL proposals in a Facelets page, but when I hit Ctrl+Space, it doesn't work. I managed to activate JSF tag proposals thank to other questions, but EL proposals aren't working.
How can I activate this feature in Eclipse? Is it a known issue?
For example:
<h:inputHidden id="id" value="#{Ctrl+Space not working!}"/>
Eclipse doesn't support this out the box. Even the support in JSP is very limited. Only the properties of <jsp:useBean> and managed beans hardcoded as <managed-bean> in faces-config.xml are available by autocomplete. There are however plugins which supports EL autocomplete on #ManagedBean and #Named beans.
For example, the JBoss Tools plugin (specifically the CDI feature) which can be installed as described here: How do I Install JBoss AS / WildFly Server in Eclipse for Java EE.
(which has in its current 3.2.0 version unicode bugs, as you see above in the rightmost window)
You can even use Ctrl+Click on the managed bean name #{bean} in an EL expression in Facelets file to navigate to the concrete backing bean class. You can also use Ctrl+Shift+G on the managed bean method in a backing bean class to find all references to the particular property or action in Facelets files.
The Aptana plugin is told to work fine for EL proposals in JSPs, but I am not sure for Facelets. I didn't had good experiences with installing and configuring the plugin for JSP some years ago.
See also:
Properties of new tags using composite component are not displayed by Eclipse auto complete shortcurt