In this post I want to show an experiment I did recently. Using eclipse zest to show the context information of the current task context.
Mylyn is a powerful tool to let the programmers focus on the things they are doing. One's focus interests are organized as tasks in workspace. For each task, there is a list which holds the related files and resources. What I want to do is to get the list and show them as a graph in a view. I by chance read something about eclipse zest toolkit[2], which is easy to use to implement the experiment, so I use zest in this post.
To get the current context in workspace, I use the following code[1]:
ContextCore.getContextManager().getActiveContext();
Context could change. To listen to this change, it's good to create a listener and add it to the context manager.
public class ContextListener extends AbstractContextListener{
@Override
public void contextChanged(ContextChangeEvent event) {
super.contextChanged(event);
switch(event.getEventKind()) {
case PRE_ACTIVATED:
...
break;
case CLEARED:
...
break;
case DEACTIVATED:
...
}
}
}
Each task has a life-cycle, and fires several events to the listeners: PRE_ACTIVATED->ACTIVATED->DEACTIVATED. With these events we can do the modification to the graph view synchronously.
For the view, I simply use GraphNode class to present the java files in the context. Every time when there is a task switch or one task is cleared, I clear the view.
You can download the plug-in from svn:
svn checkout http://svn.codespot.com/a/eclipselabs.org/mylyn-gmf-ui/trunk/ mylyn-gmf-ui-read-only
or download it directly (org.eclipselabs.gsoc.test1.zip)
http://code.google.com/a/eclipselabs.org/p/mylyn-gmf-ui/downloads/list
This is an eclipse plug-in project, with dependencies from both mylyn and zest. You have to install them first to run the plug-in. The screen cast of the plug-in is like the following:
Details can be found in the comments of the code.
Thanks.
--
[1] http://www.vogella.de/blog/2009/10/05/modifying-mylyn-context/
[2] http://www.vogella.de/articles/EclipseZest/article.html

3 comments:
Very cool! And Zest seems ideal for such a thing.
One thing that comes to my mind: have you considered representing the active task as node as well, and add edges to each resource in the context? Together with the RadialLayoutAlgorithm that could provide a nice visualization of the context surrounding the task.
Good Idea~
Interesting!
What is the spatial orientation of the graph? Does it adhere to a global layout with cardinal directions,so that eg A is always left of B which in turn is left of C, independent of which context is shown !?
cheers,
Adrian
Post a Comment