Concentrating on Task in Hand (similar to Mylyn) in NetBeans IDE

Posted by tusharvjoshi on October 22, 2011 at 4:16 AM EDT

Concentrating on Task in Hand (similar to Mylyn) in NetBeans IDE

Often we work on fixing a bug or developing an enhancement for an open source project maintained over a period of many years and having hundreds of source code files.  usually we need a handful of 5 to 10 source files to fix the bug or to add new enhancement.  The project explorer provided by IDE’s like NetBeans IDE show us all the files at once and we may have to scroll many times to open those files.

Now comes another situation where we have to switch our focus to some other task, may be a trivial bug fix which has to go into this week’s release.  This time we have to close all those files we are working on and work on some other files for this newly arrived trivial issue.  Once this trivial issue is done, we want to go back to our usual bug fix or enhancement addition work, but now the problem is we have to figure out all the files which were open that time.

This switching of context is a part and parcel of a developer’s life.  Task-focused interface concept was introduced for such situations and is now a fairly established concept of working with large projects.  Let us see how to use this task-focused way of working in NetBeans IDE.

For this we will need a module named NBTaskFocus which is available at as an open source project.

Installing the NBTaskFocus modules

This article assumes that you are using latest stable release of NetBeans IDE and that is 7.0.1. 

1. Open the NetBeans IDE and choose the menu Tools > Plugins to open the Plugins dialog box. 
2. Click on the Settings tab and click on the Add button top add update center for NBTaskFocus, this will show an Update Center Customizer dialog box

Adding NBTaskFocus Update Center

3. In the Name field type NBTaskFocus and in the URL field type, click the Ok button which will close this dialog box

NBTaskFocus Modules available

4. Click the Available Plugins tab, four NBTaskFocus modules will be available for installation there.  Click on the checkbox on the left of the available modules to check them for installation.  You should check all the four modules available with name NBTaskFocus, click the Install button which will take you through the process of installation of the modules.  You may have to click Next on the License page and also on the warning page which says that the modules are not signed.

Opening NBTaskFocus panels

1. Make sure you open the panels provided by NBtaskFocus modules

Available Panels in NBTaskFocus

a. Task Explorer – this is a panel where Tasks will be shown as nodes
b. Task Details – this is a panel where individual open files will be shown as part of task context
c. Project Context – this panel is similar to Projects panel but with a difference that it will highlight the currently opened files and also provides two modes to visualize the Projects, viz Grayed mode and Focused mode.

Concentrating on your Task

Coming back to the example task we discussed in the start of this ariticle, we have one enhancement task to work on.  The Task Explorer panel will allow us to add Task which will be our context for working on the enhancement work.

Adding a Task

1. Right click on the Task List node of the Task Explorer panel and choose Add Task option, a Task with name Task1 will be added as a node in the panel.  A dialog box showing the name and description of this task will also be shown in the Task Editor in the editor area of NetBeans IDE.

Adding new Task

2. Let us change the name of this task to “Fix issue #29” by updating the name of the task in the Task Editor.  We can close this Task Editor when the change in name is done.

Changing Task Name

3. We can add many Tasks in the list.  Let us add one more task named “Work on Enhancement #45” by following the same procedure we did in step #1 and #2 above.
4. When we have to work on a task and we want the IDE to remember our task context, that means all the files we open to work on that task, we will activate a task.  Task can be activated by right clicking on the Task and choosing Activate Task option.

Activating Task

What is a Task Context?

When we open source files to work on them they are added to the Task Context automatically.  This can be seen in the Task Details panel as well as the Project Context panel.  In Task Details panel all the open files are shown as a list and in Project Context panel the files which are open are shown in a highlighted way.  When the files are closed by us they are automatically removed from the active Task Context.

The files opened in the editor will be shown in highlighted mode in the Project Context panel.  All other files which are not part of the task context will be shown as grayed in the Grayed Mode of the Project Context panel.  The Project Context panel has two icons at the top toolbar.  Those buttons can be used to change the mode of the Project Context panel.

Grayed Task Context
(Grayed Context shown in Project Context panel)

Focused Mode of Project Context

The Project Context panel provides a focused mode by pressing the second button in the toolbar which will show only those files which are open in a Project hierarchy like in Projects panel.  This makes us concentrate on the files we are concerned with by making all other files hidden.  This was all the destractions are gone and we do not have to scroll many times to see the files we are working on.

Focused Task Context
(Focused Context shown in Project Context panel)

Switching Tasks

When we want to work on some other task we just activate another task and all the opened files which were part of the earlier task will be closed for us and also will be remembered for us.  We can either activate another task or double click on the active task to make it deactive to work in usual way we are used to work in the IDE.

When we want to come back to the earlier task we can activate the task again and all the files which were part of the context will be automatically opened for us again.

This way of working in IDE was first introduced to the worls by Mik Kerksen through the Mylyn plugins for Eclipse IDE.  Using the NBTaskFocus project we can implement task-focused working pattern on NetBeans IDE.


Blog Links >>

Leave a Reply

Your email address will not be published. Required fields are marked *