Skip to main content

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

Posted by tusharvjoshi on October 22, 2011 at 1:16 AM PDT

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 Java.net 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 http://java.net/downloads/nbtaskfocus/nb70/updates.xml, 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.

 

Comments

Hey. It's been over a year and a half since the last ...

Hey. It's been over a year and a half since the last (alpha) release.

No updates. No bug fixes. No new features.

Is this ever going to be a viable tool?

I use this and I like what it does so far, but there are some bugs that need to be fixed and some features that are missing.

Files often get jumbled between tasks, and when I try to clean things up, removing files from tasks that don't belong, the files get removed from the task to which is DOES belong. And that makes it difficult to keep track!

Is anyone actively managing or even working on this project ...

Is anyone actively managing or even working on this project anymore?

For months, all I can seem to find is bug reports.

This plugin has a serious problem! Yet again, all my tasks have become all scrambled! Files from some tasks are all mixed into others. When I remove a file from one task, it gets removed from all of them.

At this point, things are worse than not having Task Focus at all.

Great work! So glad you've added this to NetBeans. It was ...

Great work! So glad you've added this to NetBeans. It was the one thing I really missed from Eclipse.

Thanks for the comment and appreciation. This project was ...

Thanks for the comment and appreciation. This project was created as a tutorial of how to develop plugin and use API from NetBeans platform for the IDE.

Main NetBeans project will be coming up with native task focused features very soon as mentioned in the TaskFocusedNetBeans wiki page.

with regards
Tushar

I'd say it's about time somebody came up with CubeOn ...

I'd say it's about time somebody came up with CubeOn successor ! :-)

And I really hope this is just the beginning. Because if Netbeans missing something, it's the possibility to work task-based. Create tasks and link them to the various parts of the IDE. Something very well done in IntelliJ.

I've installed it and give it a spin. Just two - details - already: Do word-wrap in the task description. I can enter endelessly long sentences in there. And when activating a task, set a checkbox next to it. Otherwise it's not clear whether it was activated.

Well done !!!!!!

Thanks for giving the project a try and suggesting useful ...

Thanks for giving the project a try and suggesting useful changes.  I will add your suggestions as issues in the issue tracker so the next release will have them added to the project.

Just installed it, and I must say the first impression is ...

Just installed it, and I must say the first impression is great! We'll see how it behaves in longer run :)

Thanks for the comment.  There are many new features ...

Thanks for the comment.  There are many new features and fixes added to the project after this article was written.  A new release will soon be made available with those updates.  Please file any suggestions or issues you find, and also enhancements in the project issue tracker, so the project can be made better.

Nice plugin. BTW have you looked at Cubeon? It has a nice ...

Nice plugin. BTW have you looked at Cubeon? It has a nice some SPI for integration. Maybe you your project can integrate with Cubeon.

Hi Chuk, Thanks for you comment. I am aware of the ...

Hi Chuk,

Thanks for you comment.

I am aware of the Cubeon project and I have used it in the NetBeans IDE version 6.9.1

Some points regarding Cubeon project

1) Cubeon supports only Java Projects according to my knowledge, NBTaskFocus supports all project types which are and will be supported by NetBeans IDE

2) On the issues reported in Cubeon project where Mylyn like functionality is asked the developers have commented that the project is not under ative development due to lack of Funds.
http://code.google.com/p/cubeon/issues/detail?id=135 This gives us an impression that the Cubeon project is waiting for Funds from someone, and hence adding the new approach in that project is time consuming, as it will need time from the current developers to understand their thought process and to convince them about my approach.

3) There are mailing list threads related to Cubeon which mentions an issue of similar type of issue connectors created by core NetBeans developers instead of using the code which was already developed in Cubeon code base which was a project started with the Grant from Sun. The very SPI you have mentioned in your comment is in shadow due to this issue. The Cubeon developers are demotivated by the decision of creating parallel bugzilla and JIRA connectors by core NetBeans developers keeping the Cubeon code aside.

4) The NBTaskFocus project is mainly focusing on the automatic context maintenance and focused visualization of IDE and hence the connectors and integration with different third party issue trackers is a secondary goal for NBTaskFocus, where as those SPI and connectors seem like the primary goal of Cubeon, knowing this difference merging these two projects may result in something which will be best of both worlds, but it will take time.

4) The approach taken by NBTaskFocus is different than taken by Cubeon, hence explaining the new approach to the existing developers of Cubeon and getting those functionality added to Cubeon was seen as a time consuming process and also a process which may need compromises on the approach as the Cubeon project is already having lot of code and will not be easy to adapt for new approach.

5) I have used Mylyn in many of my projects which are developed in Eclipse. I observed that the Cubeon developers have not used the Mylyn plugin actively of in depth, hence the Cubeon project has developed its own concept of Task based development. NBTaskFocus project has added those features which are supported by Mylyn as the primary goal related to automatic task context and focused visualiation of existing NetBeans Projects panel.

6) The automatic task context and focused visualization features developed in NBTaskFocus may already be in the backlog list of Cubeon developers and using the experience and possibilities seen in the NBTaskFocus project they may get added to Cubeon, by them very soon. In that case there will not be a need for these projects to merge.

Given the above points the merging of these two project may happen in the future and if it happens it will be good for community. For this to happen the Cubeon project should be shifted into active development.

with regards
Tushar