Does Checkstyle provide quickfix possibilities? - eclipse

I implemented an extension plugin for checkstyle.
Now I have the task to add quickfixes for some checkstyle errors in eclipse.
Example: Add a final modifier if a class is public.
After several hours of research, I decided to ask this question in several forums because I won't be the only one with this wish/problem.
According to the documentation of checkstyle http://checkstyle.sourceforge.net/, the plugin does not provide quickfixes for own implemented checks.
I did some research but I found nothing about how to add quickfixes for own checks.
Now the question: Is there a way to implement own quickfixes for eclipse?
I'm using version 5.6 of the checkstyle API and Eclipse 4.2.

Refer to Extending the eclipse-cs plugin page.
From there you can download a sample Check.
The file is here under the name net.sf.eclipsecs.sample
In src\net\sf\eclipsecs\sample\checks there is one QuickFix Java code and in base directory, in plugin.xml the following line is present, which enables the quickfix.
<!-- This plugin provides custom quickfixes for Checkstyle problems. -->
<extension
point="net.sf.eclipsecs.ui.checkstyleQuickfixProvider">
</extension>
You can download and refer that sample for your query. Extending Check is described nicely there.

Related

Integrate GWT with maven-spring without the Google Plugin for Eclipse

I am facing this weird requirement where I am supposed to create a web page using GWT widgets in an existing spring-maven web project but the corp security doesn't allow me to install any Eclipse plugins. I have the latest SDK but thats about it.
Is there any way to achieve this?
The Google Plugin for Eclipse (GPE), just like so many other Eclipse plugins, is not mandatory; it's just an aid.
But first, if “the corp security doesn't allow me to install any plugin” only means you're not allowed to use the Eclipse marketplace or contact update sites, it's worth mentionning that you can download the update site as a ZIP to be used locally: https://developers.google.com/eclipse/docs/install-from-zip
If that isn't allowed either, then let's look at the features provided by the GPE and how you can possibly do the same without the plugin:
Wizard for creating new projects: you're in a Maven project, so you're not concerned.
Running and debugging: you can do the same with a Java Application launcher. Choose com.google.gwt.dev.DevMode as the Main Class, add the com.google.gwt:gwt-dev JAR to the classpath (you can also add it as a dependency with scope provided, and ignore the warning printed by the gwt-maven-plugin) if needed, add your source folders to the classpath and pass the appropriate arguments.
Wizards: let's be honest, they won't boost your productivity that much.
GWT Compilation: you can do the same with a Java Application launcher. Choose the com.google.gwt.dev.Compiler as the Main Class, add gwt-dev and your source folders to the classpath and pass the appropriate arguments.
Editors: you'll lose the formatting and highlighting of JSNI methods, as well as reference checking of your JSNI references, the auto-complete in UiBinder, and validation of UiBinder and ClientBundle references. All those will be done only when you GWT-compile your project.
RPC: you'll lose the validation of your RPC interfaces and quick-fix to keep your sync and async interfaces in sync. Validation will be done only when you GWT-compile your project.
JUnit: you can do the same with a JUnit launcher: just make sure you add gwt-dev and your source folders to the classpath, and pass the appropriate options as a gwt.args system property (see “Passing Arguments to the Test Infrastructure” in the docs).
Nothing insurmountable.

Checkstyle: Custom Rules - Eclipse Plugin

I have written few custom checkstyle rules using checkstyle API. They run fine using Maven (after I add the new project as a dependency to the checkstyle plugin).
Now I want these rules to be used by the Eclipse Checkstyle plugin. And this is where I am stuggling.
I've downloaded the sample plugin project (as suggested here and here).
I do not understand what to do next after reading these links.
Do I need to export my project as a JAR?
How do I plug it into my existing Checkstyle plugin?
Thanks
You can do it like following :
Create plugin project and add your custom checks there.
Make appropriate changes to plugin.xml, checkstyle_packages.xml.
Export the project as Deployable Plug-ins and fragments (Export > Plug-in Developement)
Copy the jar file to Eclipse Plugin folde, so no need to install your custom check .
You can refer this tutorial
You already have the correct links that will eventually get you there. As for your questions:
All your custom checks can go into one JAR file. That JAR file must be an Eclipse plugin JAR. I simply install it by copying it to the Eclipse dropins folder, but there may be more elegant ways to do that.
So you end up with two plugins: The original, unmodified Eclipse-CS, and your own plugin which contains the custom checks. When both are independently installed in Eclipse, the Eclipse-CS configuration dialog will offer your custom checks for use in Checkstyle configurations.

Are there any Eclipse IDE+GUI plugins for Openlaszlo?

I intend to customize Openmeetings and am wondering if there is a GUI editor available for Openlaszlo.
There was apparently a plugin called IDE4Lazlo, mentioned both at IBM and Eclipse.org, but both links are dead. If the plugin has been definitely pulled, then is there a way to at least preview layouts?
The IDE4Laszlo is on old IBM project, which has not been maintained for a long time (since 2005/2006). Laszlo had been working on an Eclipse based plugin in 2008, which was unfortunately never released.
Spket works, but compared to IDEs like Flash Builder the functionality is relatively limited, since the IDE is not capable of scanning your application files to recognize new classes and methods.
An option is to use an XML editor with XSD support. Sebastian Wagner of OpenMeetings has created a build script which generates an XSD schema file from the OpenLaszlo classes and the custom classes in your application. The source code can be found here:
http://code.google.com/p/openlaszlo-schemagenerator/
There are two Eclipse IDE plugins that support OpenLaszlo, IDE4Laszlo and the more recent Spket.

Netbeans + Checkstyle

Does anyone have experience using checkstyle in netbeans 7? I have the plugin installed, and I have selected my configuration file but I'm not seeing any errors or the promised "annotation". Any suggestions? Is there something I need to do to get it to start working? I have the plugin activated in the plugins menu.
Follow the directions in this article. You might need to restart Netbeans after installing the plugins. Code violations should appear as annotations on the line number gutter.
You can then go to the tools/options/quality/checkstyle tab to set your custom checkstyle configuration files.
Not sure if this is important but make sure that your custom checkstyle.xml uses the Check Configuration 1.3 version.
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

Can I Configure m2eclipse through pom.xml?

With the maven-eclipse-plugin, using mvn eclipse:eclipse, you can specifiy eclipse project natures and builders that will automatically be added to the eclipse project.
Earlier versions of m2eclipse used the configuration block of the maven-eclipse-plugin and also let you activate natures and builders using the same mechanisms. This seems to no longer be the case because a) I can't find any reference to maven-eclipse-plugin in the m2eclipse sources and b) it just doesn't work :-)
So this is my question: is there any way to configure the eclipse project generated by m2eclipse from the pom.xml? Specifically: project builders and natures, but I'd be interested in other options as well.
The following thread summarizes almost everything. First, it explains that m2eclipse doesn't and won't support anything from the Maven Eclipse Plugin anymore because:
Sonatype doesn't maintain it.
It causes them too much troubles.
Second, it states that the m2eclipse way to handle additional project natures and builders is to write project configurators:
(...) we encourage writing configurators to add the natures and builders you want based on what it available in the POM.
See this link for a guide and this project for some existing configurators for checkstyle, findbugs, pmd.
I have now implemented this as a maven plugin I call maven-eclipseconf-plugin.
Unfortunately it's proprietary work for a client, so I can't share it. But let me describe what I do:
Tied to the lifecycle verify, I check for the existence of an eclipse .project file. If it's there, I check it for the presence of the builders and natures I want to automatically add (and you can deactivate this behavior by using a maven property or a stop file with a configurable name). You can also define configuration files that will be written (like .pmd, which is related to this other question of mine). The contents of the Configuration files can be specified inline, it can come from an external file, or from a URL. I also tried to introduce variable substitution in the config files where a special placeholder would be replaced with a multi-moduke-project's root folder, but I had to give up on that approach.
Anyway, the plugin gives me pretty much all the functionality of the maven-eclipse-plugin I ever used (of course there is a lot more though) and I'm happy with that. Perhaps I will build something similar once more in open source when this contract is finished.
Project configurators are the proposed approach. But the latest version of m2e-extensions is from early 2010 and developed against m2eclipse 0.10.x. There is a successor project called m2e-code-quality which is more recent and active and developed against m2eclipse 0.12.x.
But neither m2e-extensions nor m2e-code-quality do support FindBugs at the moment. And there are some other limitations with header files, exclusions and modified JARs.
I have successfully used a universal approach with AntRun, Ant and XMLTask to automatically add project natures, builders and configuration files for Eclipse plugins from pom.xml.