Will this project ever get done? – Eclipse Nebula – Gantt Chart

A Gantt Chart is a type of bar chart that illustrates a project schedule.

The Eclipes Nebula project provides a powerful UI for displaying a Gantt chart.

gantt10

To use the Gannt chart you have currently to get the source code from cvs. Unfortunately Nebula does currently not provide binaries for this chart. Check here to see how to get the source code. Check out here the project “org.eclipse.nebula.widgets.ganttchart”.

Create a new Eclipse RCP application “de.vogella.ganttchart.test” using the template “Eclipse application with a view”. Add a dependency to “org.eclipse.nebula.widgets.ganttchart”.

Change the View.java to the following.


package de.vogella.ganttchart.test;

import java.util.Calendar;
import java.util.GregorianCalendar;

import org.eclipse.nebula.widgets.ganttchart.GanttChart;
import org.eclipse.nebula.widgets.ganttchart.GanttEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

public class View extends ViewPart {
	public static final String ID = "de.vogella.ganttchart.test.view";

	public void createPartControl(Composite parent) {
		GanttChart ganttChart = new GanttChart(parent, SWT.MULTI);
		Calendar start = GregorianCalendar.getInstance();
		Calendar end = GregorianCalendar.getInstance();
		end.add(Calendar.DATE, 5);
		new GanttEvent(ganttChart, null, "Event_1", start, end, start, end, 0);
		start = GregorianCalendar.getInstance();
		end = GregorianCalendar.getInstance();
		start.add(Calendar.DATE, 6);
		end.add(Calendar.DATE, 8);
		new GanttEvent(ganttChart, null, "Event_2", start, end, start, end, 0);
	}

	/**
	 * Passing the focus request to the viewer's control.
	 */
	public void setFocus() {
	}
}

This results in the following.
gantt20

For further usage of Gannt Chart have a look at the class GanttTester in the cvs download.

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of vogella.com. With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Eclipse. Bookmark the permalink.

One Response to Will this project ever get done? – Eclipse Nebula – Gantt Chart

  1. akm says:

    Hey, auf der Suche nach einer Gantt-Trac-Mylin Integration bin ich gestern auf das Nebula-Widget gestossen und mich gefragt, wie ich das wohl installieren und testen kann. Und heute finde ich gleich diesen Topic!

    Genau DAS RICHTIGE! Danke, Lars! Ihre Artikel sind wie immer eine immense Hilfe für mich! Weiter so!

Comments are closed.