How to create an Intellij and Eclipse compatible code style and code formatting configuration (for java code)? - eclipse

Few weeks ago I tried Intellij and I found it really awesome. Now, at my project there are two programmers (including me) using Intellij and few other programmers who are going to keep using Eclipse. Since this project is already very large and it's going to grow a lot, we need to use compatible Code Style and Code Formatting between Intellij and Eclipse. We do not want to have problems when one user edits some file and reformats it before saving. With Eclipse "alone" we used to have some exported configuration, and before anybody starts to work, the first step is just to import this configuration. We already tried to use External Code Formatter, but it didn't work on Intellij 9.
So, I have a bunch of questions here:
Is there any way to import eclipse formatting configuration on Intellij 9?
Anybody could share their experience managing this kind of situation? Do you guys have any other suggestion to manage this situation?

There is an updated plugin for IDEA, called Eclipse Code Formatter:
http://plugins.intellij.net/plugin/?idea&id=6546

I would recommend someone spends the time to configure their IntelliJ's code style to be the same as Eclipse. This will take a little time and effort but once it is done, you can export it just like in eclipse so that any other IDEA users can import it.
You could also search online to see if anyone has already done this and you can simply download the code style config and use it.
The only alternative I can think of would be to find a standardized code style template that is available for both eclipse and IntelliJ, like the Recommended Sun Java Code Style.

There seems to be a plugin for that (emerged from this discussion).

Related

Netbeans + Codename One - Avoid importing packages or classes not suitable for CN1

I'm using Netbeans IDE. It's quite annoying and it's a cause of errors the import of Java packages and/or classes that are not provided by Codename One. (Codename One use its own implementation of a subset of Java8 and it cannot support the full Java API).
For example, sometimes Netbeans imports automatically wrong packages (such as "java.awt.BorderLayout" instead of "com.codename1.ui.layouts.BorderLayout"), other times it shows me methods and Javadocs that are not available in Codename One.
Is it possible to force Netbeans to show me only packages, classes, methods and javadocs that are supported by Codename One? It could be useful to avoid errors.
We'd love to but unfortunately the only way NetBeans allows you to do that is if you build your own Java language package. That's what some other plugins like NBAndroid did AFAIK but when we implemented the plugin we didn't want to create something too complex.
If NetBeans supported a "bootclasspath" option for the JDK it would have solved everything. It does have support for plugging in an alternative JDK which can be a micro-profile but because we don't comply with the micro-profile spec I'm not sure if that will work.
At times, NetBeans suggests to import more than one package from the drop-down list. When you check carefully before pressing ENTER this might avoid importing the wrong package.
I use NetBeans for quite a while with CN1 and faced the same problem at the beginning.

Getting Bootstrap insight in Eclipse

I use Eclipse for my day-to-day development in ColdFusion, using the CFEclipse plugin. Since a lot of development now starts with Bootstrap, I'd like to use insight (Proposals I think they're called in Eclipse) in the interface so I don't have to type in the same classes all the time. Any idea where to start? I looked into the dictionary XML files for the CFEclipse plugin, but that seems like overkill. I just want to make a list of classnames that the editor can append from when I'm coding.
Thanks.

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.

Can I write Eclipse plugins using Groovy?

Groovy seems to fix a lot of the things I dislike about Java, and I was wondering if it would be possible to actually write an Eclipse plugin in Groovy instead of Java.
Does anyone know if this is possible, and if so how to go about it?
I've just found a blog entry which says it's not officially supported but is actually possible.
Not yet tested to see if it works, but it seems promising:
Writing Eclipse plugins with Groovy, by Jörn Dinkla
#Peter, I do not think that the blog post you linked to is complete or if it will really work. It is pointing to the old version of Groovy-Eclipse, which is no longer supported and is out of date.
Yes. It is possible to create your own plugins in Groovy.
First, install the Groovy-Eclipse plugin from here:
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/
Then you can create a new plugin project and add the Groovy Nature.
Remove the Groovy Libraries classpath container
Instead, add the org.codehause.groovy as a required bundle
Create your Groovy code as normal
Now, the tricky part is exporting the plugin using PDE. See this blog post for how to do that: http://contraptionsforprogramming.blogspot.com/2010/08/groovy-pde-redux.html
One important thing to note is that you will need at least one Java file in your project for PDE to compile anything, It can be a dummy, empty file (this is a bug that has not yet been fixed).
Rejoice!
As an example, here is the codenarc Eclipse plugin that was written completely in Groovy:
http://sourceforge.net/projects/codenarceclipse/
You can also use JRuby, or Javascript ...
JAM Circle is a great example showing how to make great use of a scripting language in an Eclipse plugin, by allowing the end user to write his own actions and load them at runtime.
There's a proxy-like plugin that allows you to implement the plugin virtually in any language that supports JSR223 (javax.scripting)

How do I get support for GPB in Eclipse?

I'm trying to use Google Protocol Buffers in my project and I'd like to have some tooling support from Eclipse. In particular, I want Eclipse to call protoc every time I make changes to the .proto files and then rebuild all code that depends on the generated code.
I tried to set up a Custom Builder but it keeps bugging me with errors I don't understand, most often it complains that the .proto file is not on the path given by --proto-path, which it should be by all I can tell. Also, because I use ${build_files}, Eclipse passes all changed files to the compiler (instead of those that I have configured to trigger the build).
NetBeans seems to have a protobuf-Plugin, but I can't find one for Eclipse. Is there one?
Theres a protoclipse plugin on googlecode, which is in the initial stages:
http://code.google.com/p/protoclipse/
Not sure if there is a builder, but I did find a plugin for syntax highlighting for protocol buffers.
You can define an external builder on the plugin that invokes an ant task. It is an ugly kludge, but until there is a better solution this may serve your purposes.
In practice, syntax highlighting turned out to not be that important, I hardly edit these files, and they tend to be very small. Maven and the m2eclipse plugin handle the building side of things great.
I recommend using Google's "Protocol Buffers Development Tools". It is a plugin for Eclipse that features automagic regeneration and error checking, among other things. It's available here: http://code.google.com/p/protobuf-dt/ .
While this question is close to other Eclipse plugin for working with protobuf, answers here are different.
Well, yes, if you use maven/gradle to invoke protoc (Protobuf compiler), than you may need no Eclipse plugin at all.
Colorizing editor helps for long file or with many comments. Know there are 2 editor plugins for Eclipse.