If you want to see the active task without having the Task List view open, you can enable the task window trim. Go to Window/Preferences/Mylyn/Tasks and check "Show active task on window trim".
Other than that, Mylyn will fill in the commit message in the Git Staging view if it's empty every time a refresh happens on the repository and a task is active.
Edit: For programmatic access, have a look at the org.eclipe.mylyn.tasks.ui
plug-in. The class TasksUi
serves as an entry point, giving you access to all high-level task API classes. What you are looking for is found in ITaskActivityManager
:
ITaskActivityManager activityManager = TasksUi.getTaskActivityManager();
ITask activeTask = activityManager.getActiveTask();