Skip to content

EclipSe

DavidHerreros edited this page Mar 1, 2020 · 3 revisions

Eclipse IDE and CDT Project

The CDT (C/C++ Development Tools) Project provides a fully functional C and C++ Integrated Development Environment (IDE) for the Eclipse platform. The features include: support for project creation and managed build, standard make build, source navigation, various source knowledge tools, such as type hierarchy, call graph, include browser, macro definition browser, code editor with syntax highlighting, folding and hyperlink navigation, source code refactoring and code generation.

How to install

The Eclipse installation process has four main steps:

  1. Install the Java runtime environment (JRE 5.0 recommended)
  2. Install the Eclipse software (It does not includes JRE).
  3. Launch Eclipse.
  4. Install a set of plugins for extend functionality. If you have the Java software installed, you only need to download the Eclipse package from http://www.eclipse.org/downloads/ be sure of select Eclipse IDE for C/C++ Developers and for the platform you want( ej: Windows, Linux, 32 or 64 bits).

After that, you only need to untar the package and launch Eclipse. Is also useful add a shortcut to the Desktop or Panel for launching.

Installing plugins

The process of installing plugins has become simpler in Eclipse 3.5(named Galileo). There is an installation dialog under Help -> Install New Software

There are some Software Sites installed from Galileo by default. You can add your own for installing new plugins, test the connection, disable Sites and using Export… / Import… its easy to share sets of Software Sites between diffferent installations or with others.

After the new site is added some Features will appear and can be checked for install. There are some Options you can check to get only the latest versions, hide already installed software and so on.

If you don’t find what you’re looking for, try to uncheck Group items by category, not all available Plug-ins are categorized. There are some useful tips here on installing plugins in Eclipse Galileo.

Integration with other tools.

Git

With most of Eclipse distributions, a git client will be built-in but, otherwise, you can also install it using eclipse interface. The most used plugin that give git functionalities to eclipse is called EGit (which can be installed from the eclipse marketplace, using the eclipse interface - menu "help" - or downloaded from here).

After downloading EGit, or not, depending on the eclipse distribution you have, it will be necessary to create a project with the xmipp git repository. To do so, use git bash utility (you can download it from: http://git-scm.com/download). Once you have Xmipp repository properly cloned into your computer as explained here you can import the local repository into your eclipse project using the eclipse graphical interface. For that purpose, create an empty C++ project and then, click on File -> Import, then click to show the GIT submenu and select the Projects from Git option. Click on Next and select Local. Again, click on Next and after that, on Add to introduce the path where your xmipp repository has been cloned using the git bash utility (remember to select the .git folder, and not the parent folder).

Once everything explained above has been done, you will be able to work directly with Xmipp code and manage git repository using eclipse menus.

If you have already created the project right click on the project name, choose "Team->Share project->Git" and then choose the .git directory that is inside the Xmipp root directory.

Gdb - Debugging a program

Before debugging Xmipp, it is needed to set the compilation of the software to debugging mode. This can be done by changing the flag Debug from False (default) to True in the corresponding xmipp.conf file. It is importante to note that, depending on the location of the source file to be debugged, a different xmipp.conf file should be modified (e.g. if we want to debug the source files from XmippCore, it will be enough to change the configuration file of XmippCore and recompile).

Once Xmipp debugging mode is ready, it will be needed to setup the debugger in our corresponding IDE. In the case of Eclipse, the first step is to set up a new run configuration. To do so, the following steps can be followed:

  1. In C/C++ Projects view, select a project.
  2. Click Run -> Debug Configurations.
  3. In the Debug Configurations window, click New to create a configuration profile.
  4. In the Name box, type a descriptive name for the debug configuration (i.e. "Xmipp Debug").
  5. In the Project box, type the name of the project containing the application you want to debug or select it clicking on Browse button.
  6. In the C/C++ Application box, type the name of the executable that you want to run, or browse to select it (the executables are usually located in the folder bin inside build folder).
  7. In Arguments tab, specify the execution arguments your application uses and the working directory for a run configuration.
  8. In Debugger tab, select the gdb debugger (gdb/mi also works).
  9. Make sure that Standard Create Process Launcher is selected as preferred launcher. At the bottom of the Debug Configurations window.
  10. Click Apply to save the configuration

To use a debug configuration:

  1. Click Run -> Debug.
  2. In the Debug dialog box, select a debug configuration from the Configurations list.
  3. Click Debug. You can reuse a previously created debug launch configuration to debug your program.

The debug perspective is opened and the application window opens on top. The C/C++ editor window is repositioned in the perspective.

It is also possible to configure other popular IDEs and code editors to work with Xmipp. The following links show the steps to be followed for other popular choices like CLion and VSCode.

AStyle

Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages. The plugin for Eclipse could be installed from here: http://astyleclipse.sourceforge.net/update (go to Eclipse->Help->Install new software). Quick start: In Preference choose Astyle Plugin in C++ Code Formatter, then right click in editor and choose Format to use. see screenshots for what the preference page looks like

Window->Preferences->astyle->Enable astyle option file -> Choose xmipp/astyle.conf Window->Preferences->C/C++->Code Style->Code Formatter->Astyle Plugin

ShellEd

ShellEd A shell script editor for eclipse. Go to install new software, then Add... and from Archive... button select the downloaded zip file.

Adding templates to the editor

windows->preference->C/C++->Editor->Templates and then import xmipp/external/eclipse_templates/xmippEditorTemplates.xml windows->preference->C/C++->Code Style-> Code Templates and then import xmipp/external/eclipse_templates/xmippCodeTemplates.xml

Python

General introduction for python and eclipse. http://www.vogella.de/articles/Python/article

There is a useful plugin for eclipse developmente, PyDev, wich can be installed from http://pydev.org/updates/

  • How to add mi python code to a PYTHONPATH?: project -> properties -> pydevPYTHONPATH

Xmipp documentation

It is also possible to include the Xmipp documentation generated by doxygen into the Help Contents in Eclipse. Once the documentation is generated, a link to the folder XMIPP_HOME/documentation/html must be done in the Eclipse plugins folder with the name com.csic.xmipp. After that, restart Eclipse and then the documentation can be found in Help->Help Contents.

Xmipp Development

To start developing Xmipp with Eclipse we need to create an Eclipse project with the Xmipp source. If we already have a working copy we can import files into a new project or having the eGit plugin we can create the project just checking out directly from the Xmipp's repository.

Creating project from Git working copy

If we have a working copy of Xmipp project in development from Git, we should import it and stablish as C++ project.

Go to File -> Import, in Git section select Projects from Git. Now, as we have already cloned git repository, we have to select Local, then Add and browse to Xmipp folder and click on Ok. Now select the repositoty placed in xmipp folder/.git, and finally select that repository in the Select a Git repository window.

Next step is Select a wizard to use for importing projects window, where we select Use the New Project wizard and click on Finish. Now select C++ Project and click on Next. Type a name for the project, unmark Use default location and select the folder you placed xmipp. In Project type select Empty Project and click on Finish.

Creating project from Git repository

In this case the process is the same as above, but you have to select URi instead of Local, being all this process equivalent to download from HowToInstall#Latest_version_from_Git_reposito. You have to use the URi link according to your permission as seen on HowToInstall#Latest_version_from_Git_reposito, for example type directly http://git.code.sf.net/p/newxmipp/code in the URi field. The different fields should be fulfilled automatically. Click on Next. In Branch Selection window mark the branches you want to download: at this moment there's a tag called 3.0-beta that is the most stable state of the code, while master branch is for developers with latest features. Click on Next. Type the folder where the xmipp code is going to be downloaded, choose the initial branch in case you marked more than one and click on Next. After that, code is being downloaded and it may take a while. The next step is the second step described in above section.

Bugs and fixes

GTK 2.18 Problem

In version GTK 2.18, client side windows are introduced which brings nicer redrawing and resizing, but some applications – like Eclipse – assume that they can just operate on the X windows corresponding to their GDK windows without ever telling GDK, which causes some widgets to exhibit weird behaviour.

Fortunately, the GTK+ people provide a switch to turn off the client side windows. So to work around the bug with Eclipse pre-3.6, just make sure you set environment variable GDK_NATIVE_WINDOWS=1.

export GDK_NATIVE_WINDOWS=1

Problem with search boxes

When running Eclipse under KDE 4.3 with the QtCurve GTK style ( which seems to be the default - even if not initially shown ) Eclipse text boxes with history ( e.g. fields in Find/Replace editor dialog, some of the fields in the search dialog, workspace location in the Workspace launcher ) are greyed out and do not accept input.

If the fields previously had any input - i.e. history is populated - then typing is possible. This does not happen when running under Gnome.

To fix: update the qtcurve related packages.

LD_LIBRARY_PATH in Ubuntu 9.04 or higher

Programs directly launched from the graphical interface, as eclipse even if it is launched from a shell, take the value of LD_LIBRARY_PATH declared as environmental variable when it is set in $HOME/.profile, /etc/profile, or /etc/environment files. Since Ubuntu 9.04 it is not possible anymore. As root, you must create the configuration file xmipp.conf in /etc/ld.so.conf.d/ with the library path in a line (i.e., "/home/user/xmipp/lib"). Then, update the cache by typing sudo ldconfig -v.

Macros

Just copy practiallymacro to your plug-in directory * /PracticallyMacro_0.3.3.jar: PracticallyMacro _0.3.3.jar

-- Main.JoaquinOton - 13 Jan 2011

Clone this wiki locally