org.eclipse.mylar.tasks.ui
Class TasksUiPlugin

java.lang.Object
  extended by org.eclipse.core.runtime.Plugin
      extended by org.eclipse.ui.plugin.AbstractUIPlugin
          extended by org.eclipse.mylar.tasks.ui.TasksUiPlugin
All Implemented Interfaces:
org.eclipse.ui.IStartup, org.osgi.framework.BundleActivator

public class TasksUiPlugin
extends org.eclipse.ui.plugin.AbstractUIPlugin
implements org.eclipse.ui.IStartup

Author:
Mik Kersten TODO: this class is in serious need of refactoring

Nested Class Summary
static class TasksUiPlugin.ReportOpenMode
           
static class TasksUiPlugin.TaskListSaveMode
           
 
Field Summary
private  java.util.Map<java.lang.String,org.eclipse.swt.graphics.Image> brandingIcons
           
private static ITaskActivityListener CONTEXT_TASK_ACTIVITY_LISTENER
           
static java.lang.String DEFAULT_BACKUP_FOLDER_NAME
           
private static char DEFAULT_PATH_SEPARATOR
           
static java.lang.String DEFAULT_TASK_LIST_FILE
           
static java.lang.String FILE_EXTENSION
           
private  ITaskHighlighter highlighter
           
private  java.util.ArrayList<org.eclipse.jface.text.hyperlink.IHyperlinkDetector> hyperlinkDetectors
           
private static ITaskListNotificationProvider INCOMING_NOTIFICATION_PROVIDER
           
private  boolean initialized
           
private static TasksUiPlugin INSTANCE
           
private  java.util.Map<java.lang.String,java.util.List<IDynamicSubMenuContributor>> menuContributors
           
static java.lang.String MESSAGE_RESTORE
           
private static java.lang.String NAME_DATA_DIR
           
private static int NOTIFICATION_DELAY
           
private  TaskDataManager offlineTaskManager
           
static java.lang.String OLD_TASK_LIST_FILE
           
private  java.util.Map<java.lang.String,org.eclipse.jface.resource.ImageDescriptor> overlayIcons
           
static java.lang.String PLUGIN_ID
           
private  org.eclipse.core.runtime.Preferences.IPropertyChangeListener PREFERENCE_LISTENER
           
private static java.lang.String PROJECT_REPOSITORY_KIND
           
private static java.lang.String PROJECT_REPOSITORY_URL
           
private  org.eclipse.jface.util.IPropertyChangeListener PROPERTY_LISTENER
           
private static java.lang.String PROPERTY_PREFIX
           
private static ITaskListNotificationProvider REMINDER_NOTIFICATION_PROVIDER
           
private static java.util.Map<java.lang.String,AbstractRepositoryConnectorUi> repositoryConnectorUis
           
private static boolean shellActive
           
private static RepositorySynchronizationManager synchronizationManager
           
private static TaskListSynchronizationScheduler synchronizationScheduler
           
private  java.util.List<ITaskEditorFactory> taskEditors
           
private  TaskListBackupManager taskListBackupManager
           
private static TaskListManager taskListManager
           
private  TaskListNotificationManager taskListNotificationManager
           
private  TaskListSaveManager taskListSaveManager
           
private  TaskListWriter taskListWriter
           
private static TaskRepositoryManager taskRepositoryManager
           
static java.lang.String TITLE_DIALOG
           
static java.lang.String URL_HOMEPAGE
           
private  org.eclipse.ui.IWindowListener WINDOW_LISTENER
          TODO: move into reminder mechanims
 
Fields inherited from class org.eclipse.core.runtime.Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
 
Constructor Summary
TasksUiPlugin()
           
 
Method Summary
 void addBrandingIcon(java.lang.String repositoryType, org.eclipse.swt.graphics.Image icon)
           
 void addContextEditor(ITaskEditorFactory contextEditor)
           
 void addDynamicPopupContributor(java.lang.String menuPath, IDynamicSubMenuContributor contributor)
           
 void addOverlayIcon(java.lang.String repositoryType, org.eclipse.jface.resource.ImageDescriptor icon)
           
static void addRepositoryConnectorUi(AbstractRepositoryConnectorUi repositoryConnectorUi)
           
 void addTaskHyperlinkDetector(org.eclipse.jface.text.hyperlink.IHyperlinkDetector listener)
           
 void earlyStartup()
           
 java.lang.String getBackupFolderPath()
           
 TaskListBackupManager getBackupManager()
           
 org.eclipse.swt.graphics.Image getBrandingIcon(java.lang.String repositoryType)
           
 java.lang.String getDataDirectory()
           
static TasksUiPlugin getDefault()
          Returns the shared instance.
 java.lang.String getDefaultDataDirectory()
           
 java.util.Map<java.lang.String,java.util.List<IDynamicSubMenuContributor>> getDynamicMenuMap()
           
 ITaskHighlighter getHighlighter()
           
 org.eclipse.core.runtime.IPath getOfflineReportsFilePath()
          Returns the path to the file caching the offline bug reports.
 org.eclipse.jface.resource.ImageDescriptor getOverlayIcon(java.lang.String repositoryType)
           
 java.lang.String getRepositoriesFilePath()
           
 TaskRepository getRepositoryForResource(org.eclipse.core.resources.IResource resource, boolean silent)
          Retrieve the task repository that has been associated with the given project (or resource belonging to a project)
static TaskRepositoryManager getRepositoryManager()
           
static AbstractRepositoryConnectorUi getRepositoryUi(java.lang.String kind)
           
 java.lang.String[] getSaveOptions()
           
static RepositorySynchronizationManager getSynchronizationManager()
           
static TaskListSynchronizationScheduler getSynchronizationScheduler()
           
 TaskDataManager getTaskDataManager()
           
 java.util.List<ITaskEditorFactory> getTaskEditorFactories()
           
 org.eclipse.jface.text.hyperlink.IHyperlinkDetector[] getTaskHyperlinkDetectors()
           
static TaskListManager getTaskListManager()
           
 TaskListNotificationManager getTaskListNotificationManager()
           
 TaskListSaveManager getTaskListSaveManager()
           
protected  void initializeDefaultPreferences(org.eclipse.jface.preference.IPreferenceStore store)
           
 boolean isInitialized()
           
 boolean isMultipleActiveTasksMode()
           
 boolean isShellActive()
           
private  void migrateContextStoreFrom06Format(boolean withProgress)
          Will run with every startup in case somebody copies over an old data directory.
private  void readOfflineReports()
           
 void reloadDataDirectory(boolean withProgress)
           
 void setDataDirectory(java.lang.String newPath)
           
 void setHighlighter(ITaskHighlighter highlighter)
           
 void setRepositoryForResource(org.eclipse.core.resources.IResource resource, TaskRepository repository)
          Associate a Task Repository with a workbench project
 void start(org.osgi.framework.BundleContext context)
           
 void stop(org.osgi.framework.BundleContext context)
           
 
Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
 
Methods inherited from class org.eclipse.core.runtime.Plugin
find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BACKUP_FOLDER_NAME

public static final java.lang.String DEFAULT_BACKUP_FOLDER_NAME
See Also:
Constant Field Values

FILE_EXTENSION

public static final java.lang.String FILE_EXTENSION
See Also:
Constant Field Values

OLD_TASK_LIST_FILE

public static final java.lang.String OLD_TASK_LIST_FILE
See Also:
Constant Field Values

DEFAULT_TASK_LIST_FILE

public static final java.lang.String DEFAULT_TASK_LIST_FILE
See Also:
Constant Field Values

TITLE_DIALOG

public static final java.lang.String TITLE_DIALOG
See Also:
Constant Field Values

PLUGIN_ID

public static final java.lang.String PLUGIN_ID
See Also:
Constant Field Values

URL_HOMEPAGE

public static final java.lang.String URL_HOMEPAGE
See Also:
Constant Field Values

PROPERTY_PREFIX

private static final java.lang.String PROPERTY_PREFIX
See Also:
Constant Field Values

PROJECT_REPOSITORY_KIND

private static final java.lang.String PROJECT_REPOSITORY_KIND
See Also:
Constant Field Values

PROJECT_REPOSITORY_URL

private static final java.lang.String PROJECT_REPOSITORY_URL
See Also:
Constant Field Values

NAME_DATA_DIR

private static final java.lang.String NAME_DATA_DIR
See Also:
Constant Field Values

DEFAULT_PATH_SEPARATOR

private static final char DEFAULT_PATH_SEPARATOR
See Also:
Constant Field Values

NOTIFICATION_DELAY

private static final int NOTIFICATION_DELAY
See Also:
Constant Field Values

MESSAGE_RESTORE

public static final java.lang.String MESSAGE_RESTORE
See Also:
Constant Field Values

INSTANCE

private static TasksUiPlugin INSTANCE

taskListManager

private static TaskListManager taskListManager

taskRepositoryManager

private static TaskRepositoryManager taskRepositoryManager

synchronizationScheduler

private static TaskListSynchronizationScheduler synchronizationScheduler

synchronizationManager

private static RepositorySynchronizationManager synchronizationManager

repositoryConnectorUis

private static java.util.Map<java.lang.String,AbstractRepositoryConnectorUi> repositoryConnectorUis

taskListSaveManager

private TaskListSaveManager taskListSaveManager

taskListNotificationManager

private TaskListNotificationManager taskListNotificationManager

taskListBackupManager

private TaskListBackupManager taskListBackupManager

offlineTaskManager

private TaskDataManager offlineTaskManager

taskEditors

private java.util.List<ITaskEditorFactory> taskEditors

hyperlinkDetectors

private java.util.ArrayList<org.eclipse.jface.text.hyperlink.IHyperlinkDetector> hyperlinkDetectors

taskListWriter

private TaskListWriter taskListWriter

highlighter

private ITaskHighlighter highlighter

shellActive

private static boolean shellActive

initialized

private boolean initialized

brandingIcons

private java.util.Map<java.lang.String,org.eclipse.swt.graphics.Image> brandingIcons

overlayIcons

private java.util.Map<java.lang.String,org.eclipse.jface.resource.ImageDescriptor> overlayIcons

CONTEXT_TASK_ACTIVITY_LISTENER

private static ITaskActivityListener CONTEXT_TASK_ACTIVITY_LISTENER

WINDOW_LISTENER

private org.eclipse.ui.IWindowListener WINDOW_LISTENER
TODO: move into reminder mechanims


REMINDER_NOTIFICATION_PROVIDER

private static ITaskListNotificationProvider REMINDER_NOTIFICATION_PROVIDER

INCOMING_NOTIFICATION_PROVIDER

private static ITaskListNotificationProvider INCOMING_NOTIFICATION_PROVIDER

PREFERENCE_LISTENER

private final org.eclipse.core.runtime.Preferences.IPropertyChangeListener PREFERENCE_LISTENER

PROPERTY_LISTENER

private final org.eclipse.jface.util.IPropertyChangeListener PROPERTY_LISTENER

menuContributors

private java.util.Map<java.lang.String,java.util.List<IDynamicSubMenuContributor>> menuContributors
Constructor Detail

TasksUiPlugin

public TasksUiPlugin()
Method Detail

start

public void start(org.osgi.framework.BundleContext context)
           throws java.lang.Exception
Specified by:
start in interface org.osgi.framework.BundleActivator
Overrides:
start in class org.eclipse.ui.plugin.AbstractUIPlugin
Throws:
java.lang.Exception

migrateContextStoreFrom06Format

private void migrateContextStoreFrom06Format(boolean withProgress)
Will run with every startup in case somebody copies over an old data directory. Called upon import. Called upon change of task data directory (from preference page).


earlyStartup

public void earlyStartup()
Specified by:
earlyStartup in interface org.eclipse.ui.IStartup

stop

public void stop(org.osgi.framework.BundleContext context)
          throws java.lang.Exception
Specified by:
stop in interface org.osgi.framework.BundleActivator
Overrides:
stop in class org.eclipse.ui.plugin.AbstractUIPlugin
Throws:
java.lang.Exception

getDefaultDataDirectory

public java.lang.String getDefaultDataDirectory()

getDataDirectory

public java.lang.String getDataDirectory()

setDataDirectory

public void setDataDirectory(java.lang.String newPath)

reloadDataDirectory

public void reloadDataDirectory(boolean withProgress)
Parameters:
withProgress -

initializeDefaultPreferences

protected void initializeDefaultPreferences(org.eclipse.jface.preference.IPreferenceStore store)
Overrides:
initializeDefaultPreferences in class org.eclipse.ui.plugin.AbstractUIPlugin

getTaskListManager

public static TaskListManager getTaskListManager()

getTaskListNotificationManager

public TaskListNotificationManager getTaskListNotificationManager()

getDefault

public static TasksUiPlugin getDefault()
Returns the shared instance.


getDynamicMenuMap

public java.util.Map<java.lang.String,java.util.List<IDynamicSubMenuContributor>> getDynamicMenuMap()

addDynamicPopupContributor

public void addDynamicPopupContributor(java.lang.String menuPath,
                                       IDynamicSubMenuContributor contributor)

isMultipleActiveTasksMode

public boolean isMultipleActiveTasksMode()

getSaveOptions

public java.lang.String[] getSaveOptions()

getBackupFolderPath

public java.lang.String getBackupFolderPath()

getHighlighter

public ITaskHighlighter getHighlighter()

setHighlighter

public void setHighlighter(ITaskHighlighter highlighter)

getTaskEditorFactories

public java.util.List<ITaskEditorFactory> getTaskEditorFactories()

addContextEditor

public void addContextEditor(ITaskEditorFactory contextEditor)

getTaskListSaveManager

public TaskListSaveManager getTaskListSaveManager()

isShellActive

public boolean isShellActive()

getRepositoryManager

public static TaskRepositoryManager getRepositoryManager()

addBrandingIcon

public void addBrandingIcon(java.lang.String repositoryType,
                            org.eclipse.swt.graphics.Image icon)

getBrandingIcon

public org.eclipse.swt.graphics.Image getBrandingIcon(java.lang.String repositoryType)

addOverlayIcon

public void addOverlayIcon(java.lang.String repositoryType,
                           org.eclipse.jface.resource.ImageDescriptor icon)

getOverlayIcon

public org.eclipse.jface.resource.ImageDescriptor getOverlayIcon(java.lang.String repositoryType)

isInitialized

public boolean isInitialized()

getTaskHyperlinkDetectors

public org.eclipse.jface.text.hyperlink.IHyperlinkDetector[] getTaskHyperlinkDetectors()

addTaskHyperlinkDetector

public void addTaskHyperlinkDetector(org.eclipse.jface.text.hyperlink.IHyperlinkDetector listener)

getBackupManager

public TaskListBackupManager getBackupManager()

readOfflineReports

private void readOfflineReports()

getOfflineReportsFilePath

public org.eclipse.core.runtime.IPath getOfflineReportsFilePath()
Returns the path to the file caching the offline bug reports. PUBLIC FOR TESTING


getTaskDataManager

public TaskDataManager getTaskDataManager()

addRepositoryConnectorUi

public static void addRepositoryConnectorUi(AbstractRepositoryConnectorUi repositoryConnectorUi)

getRepositoryUi

public static AbstractRepositoryConnectorUi getRepositoryUi(java.lang.String kind)

getSynchronizationScheduler

public static TaskListSynchronizationScheduler getSynchronizationScheduler()

getSynchronizationManager

public static RepositorySynchronizationManager getSynchronizationManager()

getRepositoriesFilePath

public java.lang.String getRepositoriesFilePath()

setRepositoryForResource

public void setRepositoryForResource(org.eclipse.core.resources.IResource resource,
                                     TaskRepository repository)
                              throws org.eclipse.core.runtime.CoreException
Associate a Task Repository with a workbench project

Parameters:
resource - project or resource belonging to a project
repository - task repository to associate with given project
Throws:
org.eclipse.core.runtime.CoreException

getRepositoryForResource

public TaskRepository getRepositoryForResource(org.eclipse.core.resources.IResource resource,
                                               boolean silent)
Retrieve the task repository that has been associated with the given project (or resource belonging to a project)