"Open declaration" (F3) doesn't work in Facelets files of some projects - eclipse

I have installed JBoss tools plugin in my Eclipse. When pressing F3 ("Open Declaration") in an EL expression of a Facelets file like
<h:inputText value="#{sectionSearchController.sectionCode}" />
then Eclipse will navigate to the corresponding class/method. This works fine in some projects, but in other projects it doesn't work at all. I don't understand why. How do I configure the project to get it to work? I'm using Maven to manage my projects.

The project's JSF facet has to be enabled in order to enable JBoss JSF tools.

Related

JSF editor autocomplete (xhtml) for STS 4

I'm working on a PrimeFaces (6.2) project.
I wanted to start using Spring Tool Suite (STS) 4, but I realized very early that it is not working as it used to in STS 3. Specifically support for JSF seems to be missing and so autocomplete doesn't work with xhtml source files.
This answer was an inspiration and I found, that same project facets in STS 3 looks like:
while the same for STS 4 is
which seems like root cause for missing autocomplete.
I have no idea how to fix that.
What I used to do
downloaded STS
download the project (from SVN, Git, ...)
run mvn clean install
run mvn eclipse:eclipse (to prepare Eclipse project)
import project to Eclipse (STS)
and that was it. It was ready, but the same is not working for STS 4.
As an easy-to-start-with project (PrimeFaces + Spring Boot) I like JSF PrimeFaces HelloWorld
Additional info
I installed JST Tools via Eclipse Marketplace searching for WST (select the one for Java EE as there is JSF and JSP support).
On Confirm Selected Features I selected JSF Tools - Web Page Editor as proposed...
At the end the project facets are not the same as in STS 3 (I deleted .setting/, .classpath, .project and executed mvn eclipse:eclipse again)
but code completion is working, so I'm fine.
In Eclipse JSF is supported not via STS, but via the Eclipse WTP JavaServer Faces (JSF) Tools.
For Spring and JSF support install STS 4 into the Eclipse IDE for Enterprise Java Developers (which contains Eclipse JSF Tools) or install the Eclipse Java EE Developer Tools into an Eclipse IDE with STS 4 but without JSF support.

Facelets formatting/autoindent in Eclipse

How can I get formatting/autoindent working for Facelets pages? I have added JSF to my project facet in the project properties and that brings up the autocomplete for JSF tags, etc but I can't find the option to format/autoindent the code.
Just the same shortcut as you'd use on Java source files Ctrl+Shift+F works fine for me on Facelets files on Eclipse Indigo SR2. They'll be formatted according the XML syntax rules which you can configure in Window > Preferences > XML > XML Files > Editor. An alternative way to trigger this is rightclick the Facelets file and then choose Source > Format.
I'm also using the JBoss Tools plugin, but this feature isn't specific to the JBoss Tools plugin.

F3 source code navigation stopped working for .xhtml files in Eclipse Indigo when using JSF 2.x

I have just switched from Java Server Faces JSF 1.x to JSF 2.x. Files are now .xhtml instead of .jsp.
Suddenly, F3 source code navigation stopped working for xhtml files. Talking about something like this:
h:commandLink action="#{Preset.add}"...
When I navigate to Preset.add and press F3, Eclipse used to take me to Preset.java class, but now this doesn't work any more.
Any idea?
Thanks.
Install JBoss tools plugin. Go to Help > Install New Software and enter the following URL:
http://download.jboss.org/jbosstools/updates/development/indigo/
In the list, just pick "JBoss Web and Java EE Development" option (others are not required). This offers among others Ctrl+Click and F3 navigation.

Eclipse:Run on server option not visible for maven project

I'm running through the jboss as7 getting started guide here http://hudson.jboss.org/jenkins/job/JBoss-AS7-Docs/lastSuccessfulBuild/artifact/guides/developer-getting-started-guide/target/docbook/publish/en-US/html/helloworld.html . The tutorial has us setting up an example helloworld quickstart maven project.
I'm able to deploy this project from the command line successfully
mvn package jboss-as:deploy
but when I attempt to deploy the helloworld example from Eclipse - the 'run on server' option is missing from the run menu. I have Eclipse 3.7 and maven wtp installed.
Not sure how to fix, any advice appreciated.
The run on server related options only appears if your project has the Dynamic Web Moudle project facets.
You can try to configure it using the Project Facets options in your project properties
To help any other developer with this problem.
I was dealing with this issue recently. Maven projects are structured differently than Dynamic Web Projects. So when you manually add the Dynamic Web Module using Project Facets, eclipse may not register it properly as a Maven project.
To solve this, you have to install the m2e plugin and M2E Eclipse WTP plugin (this tells Eclipse how to run your maven projects).
Go to Help -> Eclipse Marketplace to search for the plugins.
After installing, you will need to restart Eclipse then you will be able to use "run on server" for your Maven projects.
Note: You may need to remove/delete the previous project then import/create it again after the restart.
You have to add maven eclipse pluginin your pom.xml file..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</plugin>
According to Red Hat's site, The M2E Eclipse WTP plugin (m2eclipse-wtp) has been deprecated in favor of the newer m2e-wtp plugin. If you don't want to go through the marketplace, the URL for the new plugin is http://download.eclipse.org/technology/m2e/releases.
After copying the project and refreshing it, closing and reopening it, removing and re-adding it (right-click on server) and updating Maven... the option reappeared.
I think it occurs when you up the version of the Java compiler in your .pom file, when you up the compiler in project properties or it has to do with using the newer Jersey (2) version or when you both include local libraries and maven dependencies, it may also be a consequence of a combination of these. It's pretty unclear.
Note though, that you can still add/remove projects by right-clicking on the server in the servers tab.

GWT designer doesn't work with Maven-GWT project

I just started a GWT project with environment:
Eclipse Helios
google plugin for Eclipse 3.6
maven2 plugin for eclipse
Gwt designer for eclipse 3.6
The project is created by gwt-maven-plugin. The project can run in dev mode. But GWT Designer doesn't work for client GUI class. I removed Maven dependencies for GWT and directly import Eclipse GWT SDK, GWT Designer starts working for client GUI class. But it still doesn't work for UiBuilder template file.
The error message is :
UIBinder template should be in client package.
You are attempting to use UiBinder for /hsp-web/src/main/java/com/hs/hspweb/client/ui/UserListViewImpl.ui.xml, however it is not in GWT client package.
Go to "Java build path" in project properties, click on
"YourProjectName/src/main/resources" -> "Excluded: **"
entry and press "Remove" button. It should change to "Excluded: (None)"
Then, you will be able to open GWT designer.
I found the solution here.
http://mojo.codehaus.org/gwt-maven-plugin/eclipse/google_plugin.html
A restriction of this plugin is that it will search for gwt modules and host pages only in the first classpath source folder. Using a Maven / Eclipse integration like m2eclipse, this one will be your sourceDirectory (src/main/java). You'll have to move your gwt.xml files in this folder, instead of the standard Maven resource directory. See Google Eclipse Plugin issue #1597.