How to include Eclipse themes in an Eclipse RCP application - eclipse-rcp

I have an Eclipse based codebase, that both work as a plugin, and as an Eclipse RCP (standalone application).
When the plugin is inside Eclipse, the plugin UI benefits from Eclipse bundled themes. However when the RCP application is launched, there is no them bundled.
The rcp plugin.xml file contains a reference to the default css theme, but this doesn't seem to help.
<?eclipse version="3.0"?>
<plugin>
...
<extension
point="org.eclipse.core.runtime.products"
id="product">
...
<product
application="org.openjdk.jmc.rcp.application.app"
name="%APPLICATION_NAME">
<property
name="cssTheme"
value="org.eclipse.e4.ui.css.theme.e4_default">
</property>
So what I'd like is to include the default theme, like in the regular Eclipse, like this:
I am a total rookie to Eclipse. So I miss a lot of concepts and reflexes. Thanks in advance.

Related

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

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.

Error when importing Maven-GWT project ("No marketplace entries found to handle gwt-maven-plugin")

I'm using Eclipse Indigo on Win XP, Maven 3.0.3 and GWT 2.4. I created a Maven-GWT project using the Mavne gwt archetype. Then I opened Eclipse, went to File -> Import, selected Existing Maven Projects, chose the pom for my GWT-Maven project, and then got this dialog:
The errors are
No marketplace entries found to handle gwt-maven-plugin:2.4.0:generateAsync in Eclipse. Please see Help for more information.
No marketplace entries found to handle gwt-maven-plugin:2.4.0:i18n in Eclipse. Please see Help for more information.
No marketplace entries found to handle maven-war-plugin:2.1.1:exploded in Eclipse. Please see Help for more information.
Anyone know how to resolve these errors? It is wreaking havoc when I actually import my project and try and work with it. - Dave
Make sure you are not using the embedded Maven of Eclipse.
Go to Window->Preference ->Maven -> Installation->choose your own maven installation folder there.
EDIT
If your company pays for IDE, you should ask for IntelliJ the IDE for Java, which I would say is better than Eclipse in many ways, not saying Eclipse is not good, that's just a good alternative. And you won't have this issue to start with
If your pom is not specific as to the version of the maven-resources-plugin, that version will come from the superpom. By default, m2e uses an embedded copy of Maven 3.0.x. If the superpom there points to 2.4.3 and your 'outside-of-Eclipse' version asks for something else, then the Maven inside of Eclipse will go looking for 2.4.3 and fail due to the 'offline'.
Fix by configuring m2e to use the Maven installation you are using outside, or turning off 'offline' for one build.
If you want to use maven from your local installation instead of the embedded version that comes with m2e, You have to do this
Windows ==> Preferences ==> Maven ==> Installations ==> Click Add (select your local maven installation directory)
Installation Directory is not where local repository. It is where maven is installed.
After changing try right click on project then,
Maven ----> Update Project
See How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds
You can basically just copy the snippet from http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven#POM_changes_needed_for_Eclipse_Indigo and adapt to your plugins and goals.
I am using a different approach with maven, gwt and eclipse.
I am using the maven eclipse plugin to generate a .classpath and .project file and import the project manually into eclipse (not as a maven project).
My configuration for the maven eclipse plugin looks like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<buildOutputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</buildOutputDirectory>
<projectnatures>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>com.google.gdt.eclipse.core.webAppNature</projectnature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</projectnatures>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>com.google.gdt.eclipse.core.webAppProjectValidator</buildcommand>
<buildcommand>com.google.appengine.eclipse.core.projectValidator</buildcommand>
<buildcommand>com.google.gwt.eclipse.core.gwtProjectValidator</buildcommand>
</buildcommands>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.gwt.eclipse.core.GWT_CONTAINER</classpathContainer>
</classpathContainers>
<excludes>
<exclude>com.google.gwt:gwt-servlet</exclude>
<exclude>com.google.gwt:gwt-user</exclude>
<exclude>com.google.gwt:gwt-dev</exclude>
<exclude>javax.validation:validation-api</exclude>
</excludes>
<linkedResources>
<linkedResource>
<name>war</name>
<type>2</type>
<location>${basedir}/target/${project.artifactId}-${project.version}</location>
</linkedResource>
</linkedResources>
</configuration>
</plugin>
Hope that helps
This helped me:
Delete the project from eclipse (but don't delete from disk)
Close eclipse
In your user folder there is .m folder.
Delete repository folder underneath it (.m/repository).
Open eclipse Import project as existing maven project (from disk).

How to build an Eclipse plugin with maven?

How do you build an Eclipse plugin with Maven? What dependencies or plugins do I need? I am looking to develop for Eclipse 3.7.
You can use Maven 3.3 (at least) and Maven Tycho 0.24.0. Add this to your project's .mvn/extensions.xml:
<extensions>
<extension>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-pomless</artifactId>
<version>0.26.0</version>
</extension>
</extensions>
Then you must define your pom.xml according to the structure of your project.
I recommend this article: Eclipse Tycho for building Eclipse Plug-ins, OSGi bundles and RCP applications - Tutorial
You can follow the example on this page to have a general idea of using maven plugin Tycho.

How do I make the Eclipse Checkstyle plugin and the Maven Checkstyle plugin use the same rules?

I'd like the Checkstyle rules in Eclipse match the rules when my Maven build runs on Jenkins.
How do I go about that?
Thanks.
[edit]
So I exported the checkstyle settings in eclipse to a new XML file in the project folder and pointed the maven checkstyle plugin at that with
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.6</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
You will have to export your eclipse checkstyle settings into a file and configure your Jenkin (/Hudson) checkstyle plugin to use the same configuration file.
I did it as followed: I have a separate maven build project that contains checkstyle/pmd and others stuff (rule sets) on the classpath.
Add this project as dependency in the checkstyle/pmd plugin configuration in your pom, and it will work in maven and in jenkins/hudson if you simple call the maven checkstyle/pmd goal.
Works like a charm.

Can I use or import an Eclipse formatter in NetBeans?

We have been using Eclipse for a long time. We have formatter for each of our projects. Now, some of us are moving to NetBeans. Is it possible to migrate / sync / import our Eclipse formatter to NetBeans? I tried importing an Eclipse project into NetBeans. It does not import the formatter we used.
The answer is YES. You can use eclipse code formatter in Netbeans, and enjoy using Netbeans. You need to download eclipse code formatter plugin from below location suitable to your Netbeans version, import your existing eclipse code formatter and ready to go
http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java
AFAIK There is no way to import the Eclipse formatting preferences into NetBeans.
But if you use Maven you can use the Maven2 Java Formatter Plugin which uses the Eclipse JDT features to format source files and integrates nicely with Maven projects. For a usage of current version 0.3.1 see here.
This is a simple pom.xml using the formatter. Just put in any Java source file and run mvn java-formatter:format, your source should be formatted using the given Eclipse configuration file (where you have to provide the path to your own one).
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.mackaz</groupId>
<artifactId>maven.java.formatter.plugin.example</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
<version>0.3.1</version>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
<configuration>
<configFile>./example-eclipse-code-format-config.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
EDIT:
A different approach is to invoke the Eclipse Code Formatter from commandline, (but takes a bit longer and is not nicely integrated into the Maven lifecycle), as described here.
You can format a sourcefile with it like this:
/opt/eclipse/eclipse -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -nosplash -config example-eclipse-code-format-config.xml src/main/java/de/mackaz/FormatMe.java
(Also take a look at this page where the author put that into a little script)
It should be easy to integrate one of those approaches into NetBeans. Either wrap those inside an Ant file and add that to your NetBeans commands, or write a little NetBeans plugin to add the action e.g. to the contextmenu (which is pretty easy, especially compared to writing Eclipse Plugins).
I like NetBeans very much, but have the same problem with formatting.
I've found this maven plugin http://mvneclipsefmt.sourceforge.net/usage.html
Seems it can run eclipse formatter as maven goal. But I didn't try it yet.
There is a post on JBoss community which seems to address formating issues, it might be of some help; http://community.jboss.org/wiki/ImportFormattingRules
You can use "Eclipse Code Formatter for Java" NetBeans plugin it works with NetBeans 7.3 and .7.4 (but with a little problem!).
It would appear that, as of Netbeans 7.3.1, a very clever fellow developed a Netbeans plugin that accepts Eclipse Formatter XML files. I have not tested this yet TBH, but I will be doing so in the very near future (as I am the only one at the office that prefers Netbeans over Eclipse, and I think my co-workers are conspiring to kill me due to git merge conflicts).
https://blogs.oracle.com/geertjan/entry/eclipse_formatter_for_netbeans_ide
It should be easy to use Eclipse's formatter as a plugin in Netbeas, like it was done for IntelliJ
The following link may be of assistance http://netbeans.dzone.com/articles/importexport-code-formatting it talks about sharing sharing settings.