Category Archives: eclipse

Eclipse or IntelliJ

I started to use intelliJ since the release of Anrdroid Studio, not much however.

Recently I stared to check again this time more detailed and in-depth.

I also wanted to check what others think about this and probably having longer experience than I had.

There is a nice summary(http://developer4life.blogspot.be/2012/01/intellij-vs-eclipse.html):

  • Plugins: Eclipse marketplace offers 1,276 plugins, and the Intellij Plugin Repository offers 727 plugins. This difference is not to be taken lightly, since plugins for new technologies will usually be developed mainly for Eclipse (e.g. Android, Drools, Activiti, etc). Moreover, Eclipse is easier to extend. When working on a specific technology most chances are that if a plugin exists, it will be an Eclipse plugin.
  • Multiple projects: This is an Eclipse winner for sure. It has the ability to open multiple projects in the same window, giving the coder control over dependencies and relations. Intellij has an option to open one project with multiple modules, but we found it to be cumbersome, and in times a little buggy. If you are going to use a lot of projects together and hate to switch windows, Eclipse is your choice.
  • Multiple languages: We have stated that we will only examine the Intellij Community Edition that supports Java, Groovy and Scala. However, if you plan to create a Python server, combined with Ajax & Html, joint with a java web server, or any other exotic language combinations, than Eclipse is your choice.
  • Code completion & inspection: While Eclipse has the ability to add plugins such as checkstyle, this one definitely goes for Intellij. The default code completion and assistance in Intellij is faster and better. If you are a rookie developer, Intellij can improve your code.
  • Usability: Intellij user experience is much easier to grasp. The learning curve in Intellij is by far faster. It seems using Intellij makes developing easier and more natural. Dropdowns, code completion, quick view, project wizards, etc, are all possible both in Eclipse and Intellij, but the experience in Intellij is much more satisfying.
  • Performance: The more plugins are installed on the IDE, the more heavy it is for your computer. However, saying that, Eclipse handles very large projects faster. Moreover, both of the IDE’s seems to be RAM junkies. Projects usually open faster in Eclipse, as Intellij indexes the entire project on startup, but while working on an existing project, Intellij works smoother. For example we have a huge SOAP project, which is impossible to work on with Intellij, so some of us even learn Eclipse just for that.
  • Repository integration: Both of the IDE’s have SVN\GIT\etc plugins. No doubt Intellij’s plugin is more reliable, has better GUI and easier to use.
  • GUI builder: We found that the built in Intellij GUI builder is more comfortable, and as mentioned above, usability wise its easier to learn, and more enjoyable to develop.

Well I have exactly the same opinion:

  • IntelliJ seems cooler and easy to use
  • The user experience overall in IntelliJ is better.
  • Repository integration is more stable on IntelliJ (but who does that from the IDE, shell rullezz 🙂
  • Eclipse can handle big and more projects much more nicely
  • Eclipse quite more plug-ins and more updates also (also if you don’t like smth u can change it yourself)
  • Eclipse if the total winner when talking about integrating many different projects on many different languages
  • Eclipse is the absolute winner when comes to plug-in and RCP development

So finally my decision is I would use Eclipse overall and IntelliJ for single android projects.

Something more for the ones using Gradle (from www.gradle.org):

Eclipse

Gradle Eclipse support is developed by the SpringSource STS team. You can either use it via STS or install it separately. The Gradle Eclipse plugin provides the best IDE integration so far. It allows you to import Gradle projects into Eclipse. The information from the Gradle build script is used to configure your project in Eclipse. The import wizard is pretty smart. You can do partial imports of multi-project builds. You can also choose different naming patterns for sub-projects. You can even define Gradle tasks that should be run before and after an import/refresh. Additionally the Gradle plugin provides a runner for executing Gradle builds. The Gradle plugin also detects Gradle build scripts and automatically enables Groovy editor support for those files. That gives you syntax highlighting, syntax check and auto formatting.

Of course you can also use the Eclipse plugin for Gradle to generate the Eclipse metadata.

IDEA

Jetbrains has added support for Gradle with IDEA 11. You can import a Gradle project like you can import a Maven one. There is much more to come. New versions of the Gradle plugin will be released independently of IDEA.

Of course you can also use the IDEA plugin for Gradle to generate IDEA metadata.

Hope this helps to some of you in situation like me 🙂

Get new spelling engine for Eclipse or Aptana

So first you need a nice spelling engine: http://hunspell.sourceforge.net/

The update link is: http://hunspell4eclipse.googlecode.com/svn/trunk/com.lorands.hunspell4eclipse.updatesite/

Dictionaries can be found at: http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/hunspell_dictionaries/
more info for dictionaries: http://dev.chromium.org/developers/how-tos/editing-the-spell-checking-dictionaries

NOTE: This is only for text editors. If you need spell check on php or other editors use eSpell plugin: http://www.bdaum.de/eclipse/eSpell3/

Get packages from IProject in eclipse using IJavaProject

When working with Eclipse and especially when developing plug-ins you will deal with the org.eclipse.core.resources.IProject interface.

This however does not give you an option to get the packages used in the project. For that you will need org.eclipse.jdt.core.IJavaProject interface which is a completely different interface and cannot just get it from a cast from IProject, however you can:

IProject proj = (IProject)selectionResult;

IJavaProject jProj = JavaCore.create(proj);

then of course you can use jProj.getPackageFragments() to get app the package elements in the project.

You can also check if project is actually java project before creating the IJavaProject:

if(JavaProject.hasJavaNature(proj)) ...

 

 

Android Eclipse @Override error

Have you ever experienced multiple errors when you import a project into a new environment and all the errors are on @Override methods smth like:

The method Xxx(zz) of type AAA.BBB must override a superclass method

Also when you remove “@Override” all goes fine?

Well this might be if you are compiling with Java 5 (or setting the compiler’s -source option to expect Java 5 source) . In Java 5 you could not use the @Override annotation with methods that implemented an interface, only with actual overrides of methods from a super class. This changed in Java 6 so that you can now use it in both contexts.

So a solution is just to compile with java 6+.

To set this in eclipse:

Window->preferences->Java->Compiler

in “JDK Compliance” set “Compiler compliance level” to 1.6.

Install Eclipse Juno/Kepler on Ubuntu

If you use Ubuntu Software Center to install eclipse only 3.8 is available but not 4.X.

Here is how to install it manually by manually downloading the eclipse IDE package.

  •          Download the eclipse tar.gz package from here.
  •          Then righ-click the eclipse tar.gz and choose the extract here option to extract the tar.gz package. You can also use the command line to extract the tar.gz package.
# tar xzf eclipse-cpp-juno-linux-gtk.tar.gz
  •           Move the extracted eclipse in the  /opt/ folder.Before running the below command be sure that you are in the directory which contains extracted eclipse folder.
# mv eclipse /opt/
  •             Use sudo if the above command gives permission denied message.
# sudo mv eclipse /opt/
  •        Create a desktop file and place it into /usr/share/applications
# sudo gedit /usr/share/applications/eclipse.desktop
  • and copy the following to the eclipse.desktop file
[Desktop Entry]
Name=Eclipse 
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=eclipse.desktop
  • Create a symlink in /usr/local/bin using
 # cd /usr/local/bin
 # sudo ln -s /opt/eclipse/eclipse
  •  launch eclipse.

# /opt/eclipse/eclipse  -clean  &

If your eclipse does not start then you need to make sure /opt/eclipse/eclipse is there and executable.

Flash clockworkmod (CWM) recovery image

here is a tutorial how to install/flash CWM. note that this is not rooting your phone.

Prerequisites:

1) CWM Recovery image(we will call this CWM.img). Download the one for your phone from http://www.clockworkmod.com/rommanager

2) fastboot.exe . you gen get this from here http://web.djodjo.org/?a=download:android:tools:win:bootloadertools

Procedure:

Basically we can divide this into 2 main steps – unlock OEM and flash the recovery image.

1) Unlock OEM/Bootloader

for Htc device please follow the instructions from http://htcdev.com/bootloader/

  • boot in bootloader
  • make sure you are in fastboot mode (should be written fastboot mode somewhere)
  • connect the device to the pc via usb
  • check if the device is available by:
    fastboot devices

    (note that if the device is not there and you are pretty sure that the usb is connected. you may have driver problems. in that case i would recommend to install PdaNet from http://junefabrics.com/android/download.php, just complete the first part of its installation. it will be enough to get the drivers working)
  • execute fastboot oem unlock
  • a confirmation message will appear on screen. Select ‘Yes’
  • now you should see the ‘LOCK STATE – UNLOCKED’

2) Flash the recovery image

  • boot in bootloader
  • make sure you are in fastboot mode
  • connect the device to the pc via usb
  • check if the device is available by:
    fastboot devices
  • execute:
    fastboot flash recovery CWM.img (the image you've downloaded)

Enjoy 🙂

Install Aptana Studio on Ubuntu

1) Prerequisites:

sudo apt-get install libjpeg62 libwebkitgtk-1.0-0 git-core

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

2) Download Aptana Studio: http://www.aptana.com/products/studio3/download

3) Extract Aptana Studio

sudo unzip [name of Aptana Studio ZIP file here].zip -d /opt

4) Add shortcut

create file AptanaStudio3.desktop with content:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Aptana Studio 3
GenericName=Integrated Development Environment
Comment=Aptana Strudio 3 Integrated Development Environment
Exec=/opt/Aptana_Studio_3/AptanaStudio3 %F
TryExec=/opt/Aptana_Studio_3/AptanaStudio3
Icon=/opt/Aptana_Studio_3/icon.xpm
StartupNotify=true
StartupWMClass="Aptana Studio 3"
Terminal=false
Type=Application
MimeType=text/xml;application/xhtml+xml;application/x-javascript;application/x-php;application/x-java;text/x-javascript;text/html;text/plain
Categories=GNOME;Development;IDE;

 

sudo mv AptanaStudio3.desktop /usr/share/applications/AptanaStudio3.desktop

Add a link to external dir in the project tree in Eclipse

To do this you can manually edit “.project” file in the project dir and add linked resource smth like this:

<linkedResources>
<link>
<name>some_external_dir</name>
<type>2</type>
<location>C:/myexternalfiles/files4projectX</location>
</link>
</linkedResources>

The whole .project file will look smth like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>projectX</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>some_external_dir</name>
<type>2</type>
<location>C:/myexternalfiles/files4projectX</location>
</link>
</linkedResources>
</projectDescription>