Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-11-14 21:15:22 -0500
committermkersten2005-11-14 21:15:22 -0500
commite1b51c7b224a2344dcb83507d2ee4a927bbc2f3a (patch)
tree43f6e0f1b730e9c3784746191cdd28b90d7e5e1e
parent02217d088e70dd121e7cb10e7c1a0584ea373c0d (diff)
downloadorg.eclipse.mylyn.tasks-e1b51c7b224a2344dcb83507d2ee4a927bbc2f3a.tar.gz
org.eclipse.mylyn.tasks-e1b51c7b224a2344dcb83507d2ee4a927bbc2f3a.tar.xz
org.eclipse.mylyn.tasks-e1b51c7b224a2344dcb83507d2ee4a927bbc2f3a.zip
Progress on Bug 115709: Allow to specify custom template for commit comments
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java673
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/MylarTaskEditor.java76
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java2
3 files changed, 397 insertions, 354 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
index 26fbff500..89b54306a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
@@ -50,244 +50,282 @@ import org.osgi.framework.BundleContext;
* TODO: this class is in serious need of refactoring
*/
public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
-
- private static MylarTasklistPlugin plugin;
- private static TaskListManager taskListManager;
- private TaskListExternalizer externalizer;
- private List<ITaskHandler> taskHandlers = new ArrayList<ITaskHandler>(); // TODO: use extension points
- private List<IContextEditorFactory> contextEditors = new ArrayList<IContextEditorFactory>();
-
- /**
- * TODO: move to common color map.
- */
- public static Color ACTIVE_TASK = new Color(Display.getDefault(), 36, 22, 50);
-
- public static final String PLANNING_GAME_WIZARD_ID = "org.eclipse.mylar.tasklist.ui.planner.wizard";
- public static final String PLANNING_GAME_EDITOR_ID = "org.eclipse.mylar.tasklist.ui.planner.editor";
- public static final String REPORT_OPEN_EDITOR = "org.eclipse.mylar.tasklist.report.open.editor";
- public static final String REPORT_OPEN_INTERNAL = "org.eclipse.mylar.tasklist.report.open.internal";
- public static final String REPORT_OPEN_EXTERNAL = "org.eclipse.mylar.tasklist.report.open.external";
- public static final String MULTIPLE_ACTIVE_TASKS = "org.eclipse.mylar.tasklist.active.multipe";
- public static final String COPY_TASK_DATA = "org.eclipse.mylar.tasklist.preferences.copyTaskData";
-
- public static final String PLUGIN_ID = "org.eclipse.mylar.tasklist";
- public static final String FILE_EXTENSION = ".xml";
- public static final String TASK_ID = "org.eclipse.mylar.tasklist.userid";
- public static final String DEFAULT_TASK_LIST_FILE = "tasklist" + FILE_EXTENSION;
- public static final String TASK_EDITOR_ID = "org.eclipse.mylar.tasklist.ui.taskEditor";
- public static final String CATEGORY_EDITOR_ID = "org.eclipse.mylar.tasklist.ui.catEditor";
- public static final String SELECTED_PRIORITY = "org.eclipse.mylar.tasklist.filter.priority";
- public static final String FILTER_COMPLETE_MODE = "org.eclipse.mylar.tasklist.filter.complete";
- public static final String FILTER_INCOMPLETE_MODE = "org.eclipse.mylar.tasklist.filter.incomplete";
- public static final String SAVE_TASKLIST_MODE = "org.eclipse.mylar.tasklist.save.mode";
- public static final String PREVIOUS_SAVE_DATE = "org.eclipse.mylar.tasklist.save.last";
- public static final String DEFAULT_URL_PREFIX = "org.eclipse.mylar.tasklist.defaultUrlPrefix";
-
- public static final String COMMIT_PREFIX_COMPLETED = "org.eclipse.mylar.team.commit.prefix.completed";
- public static final String COMMIT_PREFIX_PROGRESS = "org.eclipse.mylar.team.commit.prefix.progress";
-
-
+
+ private static MylarTasklistPlugin plugin;
+
+ private static TaskListManager taskListManager;
+
+ private TaskListExternalizer externalizer;
+
+ private List<ITaskHandler> taskHandlers = new ArrayList<ITaskHandler>(); // TODO: use extension points
+
+ private List<IContextEditorFactory> contextEditors = new ArrayList<IContextEditorFactory>();
+
+ /**
+ * TODO: move to common color map.
+ */
+ public static Color ACTIVE_TASK = new Color(Display.getDefault(), 36, 22, 50);
+
+ public static final String PLANNING_GAME_WIZARD_ID = "org.eclipse.mylar.tasklist.ui.planner.wizard";
+
+ public static final String PLANNING_GAME_EDITOR_ID = "org.eclipse.mylar.tasklist.ui.planner.editor";
+
+ public static final String REPORT_OPEN_EDITOR = "org.eclipse.mylar.tasklist.report.open.editor";
+
+ public static final String REPORT_OPEN_INTERNAL = "org.eclipse.mylar.tasklist.report.open.internal";
+
+ public static final String REPORT_OPEN_EXTERNAL = "org.eclipse.mylar.tasklist.report.open.external";
+
+ public static final String MULTIPLE_ACTIVE_TASKS = "org.eclipse.mylar.tasklist.active.multipe";
+
+ public static final String COPY_TASK_DATA = "org.eclipse.mylar.tasklist.preferences.copyTaskData";
+
+ public static final String PLUGIN_ID = "org.eclipse.mylar.tasklist";
+
+ public static final String FILE_EXTENSION = ".xml";
+
+ public static final String TASK_ID = "org.eclipse.mylar.tasklist.userid";
+
+ public static final String DEFAULT_TASK_LIST_FILE = "tasklist" + FILE_EXTENSION;
+
+ public static final String TASK_EDITOR_ID = "org.eclipse.mylar.tasklist.ui.taskEditor";
+
+ public static final String CATEGORY_EDITOR_ID = "org.eclipse.mylar.tasklist.ui.catEditor";
+
+ public static final String SELECTED_PRIORITY = "org.eclipse.mylar.tasklist.filter.priority";
+
+ public static final String FILTER_COMPLETE_MODE = "org.eclipse.mylar.tasklist.filter.complete";
+
+ public static final String FILTER_INCOMPLETE_MODE = "org.eclipse.mylar.tasklist.filter.incomplete";
+
+ public static final String SAVE_TASKLIST_MODE = "org.eclipse.mylar.tasklist.save.mode";
+
+ public static final String PREVIOUS_SAVE_DATE = "org.eclipse.mylar.tasklist.save.last";
+
+ public static final String DEFAULT_URL_PREFIX = "org.eclipse.mylar.tasklist.defaultUrlPrefix";
+
+ public static final String COMMIT_PREFIX_COMPLETED = "org.eclipse.mylar.team.commit.prefix.completed";
+
+ public static final String COMMIT_PREFIX_PROGRESS = "org.eclipse.mylar.team.commit.prefix.progress";
+
private ResourceBundle resourceBundle;
- private long AUTOMATIC_BACKUP_SAVE_INTERVAL = 1*3600*1000; // every hour
+
+ private long AUTOMATIC_BACKUP_SAVE_INTERVAL = 1 * 3600 * 1000; // every hour
+
private static Date lastBackup = new Date();
+
private ITaskHighlighter highlighter;
-
+
public enum TaskListSaveMode {
- ONE_HOUR,
- THREE_HOURS,
- DAY;
- @Override
- public String toString() {
- switch(this) {
- case ONE_HOUR: return "1 hour";
- case THREE_HOURS: return "3 hours";
- case DAY: return "1 day";
- default: return "3 hours";
- }
- }
- public static TaskListSaveMode fromString(String string) {
- if (string == null) return null;
- if (string.equals("1 hour")) return ONE_HOUR;
- if (string.equals("3 hours")) return THREE_HOURS;
- if (string.equals("1 day")) return DAY;
- return null;
- }
- public static long fromStringToLong(String string) {
- long hour = 3600*1000;
- switch(fromString(string)) {
- case ONE_HOUR:
- return hour;
- case THREE_HOURS:
- return hour * 3;
- case DAY:
- return hour * 24;
- default:
- return hour * 3;
- }
- }
- }
-
+ ONE_HOUR, THREE_HOURS, DAY;
+ @Override
+ public String toString() {
+ switch (this) {
+ case ONE_HOUR:
+ return "1 hour";
+ case THREE_HOURS:
+ return "3 hours";
+ case DAY:
+ return "1 day";
+ default:
+ return "3 hours";
+ }
+ }
+
+ public static TaskListSaveMode fromString(String string) {
+ if (string == null)
+ return null;
+ if (string.equals("1 hour"))
+ return ONE_HOUR;
+ if (string.equals("3 hours"))
+ return THREE_HOURS;
+ if (string.equals("1 day"))
+ return DAY;
+ return null;
+ }
+
+ public static long fromStringToLong(String string) {
+ long hour = 3600 * 1000;
+ switch (fromString(string)) {
+ case ONE_HOUR:
+ return hour;
+ case THREE_HOURS:
+ return hour * 3;
+ case DAY:
+ return hour * 24;
+ default:
+ return hour * 3;
+ }
+ }
+ }
+
public enum ReportOpenMode {
- EDITOR,
- INTERNAL_BROWSER,
- EXTERNAL_BROWSER;
+ EDITOR, INTERNAL_BROWSER, EXTERNAL_BROWSER;
}
-
+
public enum PriorityLevel {
- P1,
- P2,
- P3,
- P4,
- P5;
-
- @Override
- public String toString() {
- switch(this) {
- case P1: return "P1";
- case P2: return "P2";
- case P3: return "P3";
- case P4: return "P4";
- case P5: return "P5";
- default: return "P5";
- }
- }
- public static PriorityLevel fromString(String string) {
- if (string == null) return null;
- if (string.equals("P1")) return P1;
- if (string.equals("P2")) return P2;
- if (string.equals("P3")) return P3;
- if (string.equals("P4")) return P4;
- if (string.equals("P5")) return P5;
- return null;
- }
- }
-
- private static ITaskActivityListener CONTEXT_MANAGER_TASK_LISTENER = new ITaskActivityListener() {
-
- public void taskActivated(ITask task) {
- MylarPlugin.getContextManager().contextActivated(task.getHandleIdentifier(), task.getPath());
- }
-
- public void tasksActivated(List<ITask> tasks) {
- for (ITask task : tasks) {
- MylarPlugin.getContextManager().contextActivated(task.getHandleIdentifier(), task.getPath());
- }
- }
-
- public void taskDeactivated(ITask task) {
- MylarPlugin.getContextManager().contextDeactivated(task.getHandleIdentifier(), task.getPath());
- }
+ P1, P2, P3, P4, P5;
+
+ @Override
+ public String toString() {
+ switch (this) {
+ case P1:
+ return "P1";
+ case P2:
+ return "P2";
+ case P3:
+ return "P3";
+ case P4:
+ return "P4";
+ case P5:
+ return "P5";
+ default:
+ return "P5";
+ }
+ }
+
+ public static PriorityLevel fromString(String string) {
+ if (string == null)
+ return null;
+ if (string.equals("P1"))
+ return P1;
+ if (string.equals("P2"))
+ return P2;
+ if (string.equals("P3"))
+ return P3;
+ if (string.equals("P4"))
+ return P4;
+ if (string.equals("P5"))
+ return P5;
+ return null;
+ }
+ }
+
+ private static ITaskActivityListener CONTEXT_MANAGER_TASK_LISTENER = new ITaskActivityListener() {
+
+ public void taskActivated(ITask task) {
+ MylarPlugin.getContextManager().contextActivated(task.getHandleIdentifier(), task.getPath());
+ }
+
+ public void tasksActivated(List<ITask> tasks) {
+ for (ITask task : tasks) {
+ MylarPlugin.getContextManager().contextActivated(task.getHandleIdentifier(), task.getPath());
+ }
+ }
+
+ public void taskDeactivated(ITask task) {
+ MylarPlugin.getContextManager().contextDeactivated(task.getHandleIdentifier(), task.getPath());
+ }
public void taskPropertyChanged(ITask updatedTask, String property) {
// don't care about property change
}
-
- };
-
- /**
- * TODO: move into reminder mechanims
- */
- private static ShellListener SHELL_LISTENER = new ShellListener() {
-
- public void shellClosed(ShellEvent arg0) {
- // ignore
- }
-
- /**
- * bug 1002249: too slow to save state here
- */
- public void shellDeactivated(ShellEvent arg0) {
- // ignore
- }
-
- public void shellActivated(ShellEvent arg0) {
- getDefault().checkTaskListBackup();
- getDefault().checkReminders();
- }
-
- public void shellDeiconified(ShellEvent arg0) {
- // ingore
- }
-
- public void shellIconified(ShellEvent arg0) {
- // ignore
- }
- };
-
- private static IPropertyChangeListener PREFERENCE_LISTENER = new IPropertyChangeListener() {
+
+ };
+
+ /**
+ * TODO: move into reminder mechanims
+ */
+ private static ShellListener SHELL_LISTENER = new ShellListener() {
+
+ public void shellClosed(ShellEvent arg0) {
+ // ignore
+ }
+
+ /**
+ * bug 1002249: too slow to save state here
+ */
+ public void shellDeactivated(ShellEvent arg0) {
+ // ignore
+ }
+
+ public void shellActivated(ShellEvent arg0) {
+ getDefault().checkTaskListBackup();
+ getDefault().checkReminders();
+ }
+
+ public void shellDeiconified(ShellEvent arg0) {
+ // ingore
+ }
+
+ public void shellIconified(ShellEvent arg0) {
+ // ignore
+ }
+ };
+
+ private static IPropertyChangeListener PREFERENCE_LISTENER = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
-
+
if (event.getProperty().equals(MULTIPLE_ACTIVE_TASKS)) {
TaskListView.getDefault().togglePreviousAction(!getPrefs().getBoolean(MULTIPLE_ACTIVE_TASKS));
TaskListView.getDefault().toggleNextAction(!getPrefs().getBoolean(MULTIPLE_ACTIVE_TASKS));
TaskListView.getDefault().clearTaskHistory();
- }
- }
- };
-
+ }
+ }
+ };
-
public MylarTasklistPlugin() {
super();
plugin = this;
initializeDefaultPreferences(getPrefs());
- externalizer = new TaskListExternalizer();
-
- String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
- File taskListFile = new File(path);
- taskListManager = new TaskListManager(taskListFile);
- taskListManager.addListener(CONTEXT_MANAGER_TASK_LISTENER);
+ externalizer = new TaskListExternalizer();
+
+ String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
+ File taskListFile = new File(path);
+ taskListManager = new TaskListManager(taskListFile);
+ taskListManager.addListener(CONTEXT_MANAGER_TASK_LISTENER);
}
public void earlyStartup() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
-
- workbench.getDisplay().asyncExec(new Runnable() {
- public void run() {
- Workbench.getInstance().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
- Workbench.getInstance().getActiveWorkbenchWindow().getShell().addDisposeListener(new DisposeListener() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+
+ workbench.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ Workbench.getInstance().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
+ Workbench.getInstance().getActiveWorkbenchWindow().getShell().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
- if (getDefault() != null) getDefault().saveTaskListAndContexts();
- }
- });
- MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
- taskListManager.readTaskList();
- }
- });
- }
-
- @Override
+ if (getDefault() != null)
+ getDefault().saveTaskListAndContexts();
+ }
+ });
+ MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
+ taskListManager.readTaskList();
+ }
+ });
+ }
+
+ @Override
public void start(BundleContext context) throws Exception {
- super.start(context);
+ super.start(context);
}
-
- @Override
+
+ @Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
resourceBundle = null;
}
- @Override
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- store.setDefault(MylarPlugin.TASKLIST_EDITORS_CLOSE, true);
- store.setDefault(SELECTED_PRIORITY, "P5");
- store.setDefault(REPORT_OPEN_EDITOR, true);
- store.setDefault(REPORT_OPEN_INTERNAL, false);
- store.setDefault(REPORT_OPEN_EXTERNAL, false);
- store.setDefault(MULTIPLE_ACTIVE_TASKS, false);
-
- store.setDefault(COMMIT_PREFIX_COMPLETED, "Completed");
- store.setDefault(COMMIT_PREFIX_PROGRESS, "Progress on");
-
- store.setDefault(SAVE_TASKLIST_MODE, TaskListSaveMode.THREE_HOURS.toString());
- }
-
- public static TaskListManager getTaskListManager() {
- return taskListManager;
- }
-
+ @Override
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+ store.setDefault(MylarPlugin.TASKLIST_EDITORS_CLOSE, true);
+ store.setDefault(SELECTED_PRIORITY, "P5");
+ store.setDefault(REPORT_OPEN_EDITOR, true);
+ store.setDefault(REPORT_OPEN_INTERNAL, false);
+ store.setDefault(REPORT_OPEN_EXTERNAL, false);
+ store.setDefault(MULTIPLE_ACTIVE_TASKS, false);
+
+ store.setDefault(COMMIT_PREFIX_COMPLETED, "Completed:");
+ store.setDefault(COMMIT_PREFIX_PROGRESS, "Progress on:");
+
+ store.setDefault(SAVE_TASKLIST_MODE, TaskListSaveMode.THREE_HOURS.toString());
+ }
+
+ public static TaskListManager getTaskListManager() {
+ return taskListManager;
+ }
+
/**
* Returns the shared instance.
*/
@@ -320,86 +358,85 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
}
return resourceBundle;
}
-
+
public static IPreferenceStore getPrefs() {
return MylarPlugin.getDefault().getPreferenceStore();
}
-
-
- /**
- * Sets the directory containing the task list file to use.
- * Switches immediately to use the data at that location.
- */
- public void setDataDirectory(String newDirPath){
- String taskListFilePath = newDirPath + File.separator + DEFAULT_TASK_LIST_FILE;
- getTaskListManager().setTaskListFile(new File(taskListFilePath));
- getTaskListManager().createNewTaskList();
- getTaskListManager().readTaskList();
-
- TaskListView.getDefault().clearTaskHistory();
- }
-
+
+ /**
+ * Sets the directory containing the task list file to use.
+ * Switches immediately to use the data at that location.
+ */
+ public void setDataDirectory(String newDirPath) {
+ String taskListFilePath = newDirPath + File.separator + DEFAULT_TASK_LIST_FILE;
+ getTaskListManager().setTaskListFile(new File(taskListFilePath));
+ getTaskListManager().createNewTaskList();
+ getTaskListManager().readTaskList();
+
+ TaskListView.getDefault().clearTaskHistory();
+ }
+
/**
* TODO: make private
*/
- public void saveTaskListAndContexts() {
- taskListManager.saveTaskList();
- for(ITask task : taskListManager.getTaskList().getActiveTasks()) {
- MylarPlugin.getContextManager().saveContext(task.getHandleIdentifier(), task.getPath());
- }
-// lastSave = new Date();
-// plugin.getPreferenceStore().setValue(PREVIOUS_SAVE_DATE, lastSave.getTime());
- }
-
- private void checkTaskListBackup() {
-// if (getPrefs().contains(PREVIOUS_SAVE_DATE)) {
-// lastSave = new Date(getPrefs().getLong(PREVIOUS_SAVE_DATE));
-// } else {
-// lastSave = new Date();
-// getPrefs().setValue(PREVIOUS_SAVE_DATE, lastSave.getTime());
-// }
- Date currentTime = new Date();
- if (currentTime.getTime() > lastBackup.getTime() + AUTOMATIC_BACKUP_SAVE_INTERVAL ) {//TaskListSaveMode.fromStringToLong(getPrefs().getString(SAVE_TASKLIST_MODE))) {
- MylarTasklistPlugin.getDefault().createTaskListBackupFile();
- lastBackup = new Date();
-// plugin.getPreferenceStore().setValue(PREVIOUS_SAVE_DATE, lastSave.getTime());
- }
- }
-
- private void checkReminders() {
-// if (getPrefs().getBoolean(REMINDER_CHECK)) {
-// getPrefs().setValue(REMINDER_CHECK, false);
- final TaskReportGenerator parser = new TaskReportGenerator(MylarTasklistPlugin.getTaskListManager().getTaskList());
- parser.addCollector(new ReminderRequiredCollector());
- parser.checkTasks();
- if (!parser.getTasks().isEmpty()) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksReminderDialog dialog = new TasksReminderDialog(Workbench.getInstance().getDisplay().getActiveShell(), parser.getTasks());
- dialog.setBlockOnOpen(false);
- dialog.open();
- }
- });
- }
-// }
- }
-
+ public void saveTaskListAndContexts() {
+ taskListManager.saveTaskList();
+ for (ITask task : taskListManager.getTaskList().getActiveTasks()) {
+ MylarPlugin.getContextManager().saveContext(task.getHandleIdentifier(), task.getPath());
+ }
+ // lastSave = new Date();
+ // plugin.getPreferenceStore().setValue(PREVIOUS_SAVE_DATE, lastSave.getTime());
+ }
+
+ private void checkTaskListBackup() {
+ // if (getPrefs().contains(PREVIOUS_SAVE_DATE)) {
+ // lastSave = new Date(getPrefs().getLong(PREVIOUS_SAVE_DATE));
+ // } else {
+ // lastSave = new Date();
+ // getPrefs().setValue(PREVIOUS_SAVE_DATE, lastSave.getTime());
+ // }
+ Date currentTime = new Date();
+ if (currentTime.getTime() > lastBackup.getTime() + AUTOMATIC_BACKUP_SAVE_INTERVAL) {//TaskListSaveMode.fromStringToLong(getPrefs().getString(SAVE_TASKLIST_MODE))) {
+ MylarTasklistPlugin.getDefault().createTaskListBackupFile();
+ lastBackup = new Date();
+ // plugin.getPreferenceStore().setValue(PREVIOUS_SAVE_DATE, lastSave.getTime());
+ }
+ }
+
+ private void checkReminders() {
+ // if (getPrefs().getBoolean(REMINDER_CHECK)) {
+ // getPrefs().setValue(REMINDER_CHECK, false);
+ final TaskReportGenerator parser = new TaskReportGenerator(MylarTasklistPlugin.getTaskListManager().getTaskList());
+ parser.addCollector(new ReminderRequiredCollector());
+ parser.checkTasks();
+ if (!parser.getTasks().isEmpty()) {
+ Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ TasksReminderDialog dialog = new TasksReminderDialog(Workbench.getInstance().getDisplay().getActiveShell(), parser.getTasks());
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ }
+ });
+ }
+ // }
+ }
+
public static void setPriorityLevel(PriorityLevel pl) {
getPrefs().setValue(SELECTED_PRIORITY, pl.toString());
}
-
+
public static String getPriorityLevel() {
- if(getPrefs().contains(SELECTED_PRIORITY)) {
+ if (getPrefs().contains(SELECTED_PRIORITY)) {
return getPrefs().getString(SELECTED_PRIORITY);
- } else {
+ } else {
return PriorityLevel.P5.toString();
- }
+ }
}
-
+
public void setFilterCompleteMode(boolean isFilterOn) {
getPrefs().setValue(FILTER_COMPLETE_MODE, isFilterOn);
}
-
+
public boolean isFilterCompleteMode() {
if (getPrefs().contains(FILTER_COMPLETE_MODE)) {
return getPrefs().getBoolean(FILTER_COMPLETE_MODE);
@@ -407,11 +444,11 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
return false;
}
}
-
+
public void setFilterInCompleteMode(boolean isFilterOn) {
getPrefs().setValue(FILTER_INCOMPLETE_MODE, isFilterOn);
}
-
+
public boolean isFilterInCompleteMode() {
if (getPrefs().contains(FILTER_INCOMPLETE_MODE)) {
return getPrefs().getBoolean(FILTER_INCOMPLETE_MODE);
@@ -419,19 +456,19 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
return false;
}
}
-
+
/**
* TODO: remove
*/
public ReportOpenMode getReportMode() {
return ReportOpenMode.EDITOR;
-// if (getPrefs().getBoolean(REPORT_OPEN_EDITOR)) {
-// return ReportOpenMode.EDITOR;
-// } else if (getPrefs().getBoolean(REPORT_OPEN_INTERNAL)) {
-// return ReportOpenMode.INTERNAL_BROWSER;
-// } else {
-// return ReportOpenMode.EXTERNAL_BROWSER;
-// }
+ // if (getPrefs().getBoolean(REPORT_OPEN_EDITOR)) {
+ // return ReportOpenMode.EDITOR;
+ // } else if (getPrefs().getBoolean(REPORT_OPEN_INTERNAL)) {
+ // return ReportOpenMode.INTERNAL_BROWSER;
+ // } else {
+ // return ReportOpenMode.EXTERNAL_BROWSER;
+ // }
}
public TaskListExternalizer getTaskListExternalizer() {
@@ -442,78 +479,79 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
return taskHandlers;
}
- public ITaskHandler getTaskHandlerForElement(ITaskListElement element){
- for(ITaskHandler taskHandler: taskHandlers){
- if(taskHandler.acceptsItem(element)) return taskHandler;
+ public ITaskHandler getTaskHandlerForElement(ITaskListElement element) {
+ for (ITaskHandler taskHandler : taskHandlers) {
+ if (taskHandler.acceptsItem(element))
+ return taskHandler;
}
return null;
}
-
+
public void addTaskHandler(ITaskHandler taskHandler) {
taskHandlers.add(taskHandler);
}
-
- public void restoreTaskHandlerState(){
- for(ITaskHandler handler: taskHandlers){
+
+ public void restoreTaskHandlerState() {
+ for (ITaskHandler handler : taskHandlers) {
handler.restoreState(TaskListView.getDefault());
}
}
private List<IDynamicSubMenuContributor> menuContributors = new ArrayList<IDynamicSubMenuContributor>();
-
+
public List<IDynamicSubMenuContributor> getDynamicMenuContributers() {
return menuContributors;
}
-
+
public void addDynamicPopupContributor(IDynamicSubMenuContributor contributor) {
menuContributors.add(contributor);
}
-
+
private List<ITaskActivationListener> taskListListeners = new ArrayList<ITaskActivationListener>();
-
+
public List<ITaskActivationListener> getTaskListListeners() {
return taskListListeners;
}
-
+
public void addTaskListListener(ITaskActivationListener taskListListner) {
taskListListeners.add(taskListListner);
}
-
+
public void createTaskListBackupFile() {
- String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
+ String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
File taskListFile = new File(path);
String backup = path.substring(0, path.lastIndexOf('.')) + "-backup.xml";
copy(taskListFile, new File(backup));
}
-
- public String getBackupFilePath(){
- String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
+
+ public String getBackupFilePath() {
+ String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
return path.substring(0, path.lastIndexOf('.')) + "-backup.xml";
}
-
+
public void reverseBackup() {
- String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
+ String path = MylarPlugin.getDefault().getMylarDataDirectory() + File.separator + DEFAULT_TASK_LIST_FILE;
File taskListFile = new File(path);
String backup = path.substring(0, path.lastIndexOf('.')) + "-backup.xml";
copy(new File(backup), taskListFile);
}
-
+
/**
* Copies all files in the current data directory to
* the specified folder. Will overwrite.
*/
- public void copyDataDirContentsTo(String targetFolderPath){
+ public void copyDataDirContentsTo(String targetFolderPath) {
File mainDataDir = new File(MylarPlugin.getDefault().getMylarDataDirectory());
-
- for ( File currFile : mainDataDir.listFiles()) {
- if (currFile.isFile()){
+
+ for (File currFile : mainDataDir.listFiles()) {
+ if (currFile.isFile()) {
File destFile = new File(targetFolderPath + File.separator + currFile.getName());
- copy(currFile, destFile);
+ copy(currFile, destFile);
}
}
}
-
- private boolean copy(File src, File dst) {
+
+ private boolean copy(File src, File dst) {
try {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dst);
@@ -530,18 +568,16 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
} catch (IOException ioe) {
return false;
}
- }
-
- public boolean isMultipleMode() {
- return getPrefs().getBoolean(MULTIPLE_ACTIVE_TASKS);
- }
-
- public String[] getSaveOptions() {
- String[] options = {TaskListSaveMode.ONE_HOUR.toString(),
- TaskListSaveMode.THREE_HOURS.toString(),
- TaskListSaveMode.DAY.toString()};
- return options;
- }
+ }
+
+ public boolean isMultipleMode() {
+ return getPrefs().getBoolean(MULTIPLE_ACTIVE_TASKS);
+ }
+
+ public String[] getSaveOptions() {
+ String[] options = { TaskListSaveMode.ONE_HOUR.toString(), TaskListSaveMode.THREE_HOURS.toString(), TaskListSaveMode.DAY.toString() };
+ return options;
+ }
public ITaskHighlighter getHighlighter() {
return highlighter;
@@ -556,6 +592,7 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
}
public void addContextEditor(IContextEditorFactory contextEditor) {
- if (contextEditor != null) this.contextEditors.add(contextEditor);
+ if (contextEditor != null)
+ this.contextEditors.add(contextEditor);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/MylarTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/MylarTaskEditor.java
index 029b02bfe..193b69eb5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/MylarTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/MylarTaskEditor.java
@@ -43,20 +43,26 @@ import org.eclipse.ui.part.MultiPageSelectionProvider;
public class MylarTaskEditor extends MultiPageEditorPart {
private static final String TASK_INFO_PAGE_LABEL = "Task Info";
+
private static final String ISSUE_WEB_PAGE_LABEL = "Browser";
+
protected ITask task;
+
private TaskSummaryEditor taskSummaryEditor;
+
private Browser webBrowser;
+
private TaskEditorInput taskEditorInput;
+
private List<IEditorPart> editorsToNotifyOnChange = new ArrayList<IEditorPart>();
-
+
private static class TaskEditorSelectionProvider extends MultiPageSelectionProvider {
private ISelection globalSelection;
-
+
public TaskEditorSelectionProvider(MylarTaskEditor taskEditor) {
super(taskEditor);
}
-
+
public ISelection getSelection() {
IEditorPart activeEditor = ((MylarTaskEditor) getMultiPageEditor()).getActiveEditor();
if (activeEditor != null && activeEditor.getSite() != null) {
@@ -71,7 +77,8 @@ public class MylarTaskEditor extends MultiPageEditorPart {
IEditorPart activeEditor = ((MylarTaskEditor) getMultiPageEditor()).getActiveEditor();
if (activeEditor != null && activeEditor.getSite() != null) {
ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
- if (selectionProvider != null) selectionProvider.setSelection(selection);
+ if (selectionProvider != null)
+ selectionProvider.setSelection(selection);
} else {
this.globalSelection = selection;
fireSelectionChanged(new SelectionChangedEvent(this, globalSelection));
@@ -91,9 +98,9 @@ public class MylarTaskEditor extends MultiPageEditorPart {
@Override
protected void createPages() {
- try {
+ try {
int index = createTaskSummaryPage();
- if(task.getIssueReportURL().length() > 9){
+ if (task.getIssueReportURL().length() > 9) {
createTaskIssueWebPage();
}
for (IContextEditorFactory factory : MylarTasklistPlugin.getDefault().getContextEditors()) {
@@ -101,13 +108,13 @@ public class MylarTaskEditor extends MultiPageEditorPart {
IEditorPart editor = factory.createEditor();
editorsToNotifyOnChange.add(editor);
index = addPage(editor, factory.createEditorInput(MylarPlugin.getContextManager().getActiveContext()));
- setPageText(index++, factory.getTitle());
+ setPageText(index++, factory.getTitle());
}
} catch (PartInitException e) {
MylarPlugin.fail(e, "failed to create task editor pages", false);
}
}
-
+
public IEditorPart getActiveEditor() {
return super.getActiveEditor();
}
@@ -117,17 +124,17 @@ public class MylarTaskEditor extends MultiPageEditorPart {
taskSummaryEditor.createPartControl(getContainer());
taskSummaryEditor.setParentEditor(this);
int index = addPage(taskSummaryEditor.getControl());
- setPageText(index, TASK_INFO_PAGE_LABEL);
+ setPageText(index, TASK_INFO_PAGE_LABEL);
return index;
} catch (RuntimeException e) {
MylarPlugin.fail(e, "could not add task editor", false);
- }
+ }
return 0;
}
/**
- * Creates page 2 of the multi-page editor,
- * which displays the task issue web page
+ * Creates page 2 of the multi-page editor, which displays the task issue
+ * web page
*/
private void createTaskIssueWebPage() {
try {
@@ -135,30 +142,29 @@ public class MylarTaskEditor extends MultiPageEditorPart {
int index = addPage(webBrowser);
setPageText(index, ISSUE_WEB_PAGE_LABEL);
webBrowser.setUrl(task.getIssueReportURL());
-
- boolean openWithBrowser = MylarTasklistPlugin.getPrefs().getBoolean(
- MylarTasklistPlugin.REPORT_OPEN_INTERNAL);
- if (task.isLocal() || openWithBrowser) setActivePage(index);
+
+ boolean openWithBrowser = MylarTasklistPlugin.getPrefs().getBoolean(MylarTasklistPlugin.REPORT_OPEN_INTERNAL);
+ if (task.isLocal() || openWithBrowser)
+ setActivePage(index);
} catch (RuntimeException e) {
MylarPlugin.fail(e, "could not open issue report web page", false);
}
- }
+ }
@Override
public void doSave(IProgressMonitor monitor) {
taskSummaryEditor.doSave(monitor);
- if (webBrowser != null){
+ if (webBrowser != null) {
webBrowser.setUrl(task.getIssueReportURL());
- }
- else if(task.getIssueReportURL().length() > 9){
+ } else if (task.getIssueReportURL().length() > 9) {
createTaskIssueWebPage();
}
}
/**
- * Saves the multi-page editor's document as another file.
- * Also updates the text for page 0's tab, and updates this multi-page editor's input
- * to correspond to the nested editor's.
+ * Saves the multi-page editor's document as another file. Also updates the
+ * text for page 0's tab, and updates this multi-page editor's input to
+ * correspond to the nested editor's.
*
* @see org.eclipse.ui.ISaveablePart#doSaveAs()
*/
@@ -173,18 +179,18 @@ public class MylarTaskEditor extends MultiPageEditorPart {
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- taskEditorInput = (TaskEditorInput)input;
+ taskEditorInput = (TaskEditorInput) input;
super.init(site, input);
setSite(site);
site.setSelectionProvider(new TaskEditorSelectionProvider(this));
-
+
/*
- * The task data is saved only once, at the initialization of the editor. This is
- * then passed to each of the child editors. This way, only one instance of
- * the task data is stored for each editor opened.
+ * The task data is saved only once, at the initialization of the
+ * editor. This is then passed to each of the child editors. This way,
+ * only one instance of the task data is stored for each editor opened.
*/
- task = taskEditorInput.getTask();
+ task = taskEditorInput.getTask();
try {
taskSummaryEditor.init(this.getEditorSite(), this.getEditorInput());
taskSummaryEditor.setTask(task);
@@ -194,7 +200,7 @@ public class MylarTaskEditor extends MultiPageEditorPart {
throw new PartInitException(e.getMessage());
}
}
-
+
@Override
public boolean isSaveAsAllowed() {
return false;
@@ -204,11 +210,11 @@ public class MylarTaskEditor extends MultiPageEditorPart {
public boolean isDirty() {
return taskSummaryEditor.isDirty();
}
+
/**
* Class to listen for editor events
*/
- private class TaskEditorListener implements IPartListener
- {
+ private class TaskEditorListener implements IPartListener {
/**
* @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
@@ -245,7 +251,7 @@ public class MylarTaskEditor extends MultiPageEditorPart {
// don't care about this event
}
}
-
+
public void updatePartName() {
firePropertyChange(PROP_DIRTY);
return;
@@ -253,7 +259,7 @@ public class MylarTaskEditor extends MultiPageEditorPart {
@Override
public void setFocus() {
-// taskSummaryEditor.setFocus();
+ // taskSummaryEditor.setFocus();
}
public Browser getWebBrowser() {
@@ -264,7 +270,7 @@ public class MylarTaskEditor extends MultiPageEditorPart {
protected void pageChange(int newPageIndex) {
super.pageChange(newPageIndex);
for (IContextEditorFactory factory : MylarTasklistPlugin.getDefault().getContextEditors()) {
- for (IEditorPart editor: editorsToNotifyOnChange) {
+ for (IEditorPart editor : editorsToNotifyOnChange) {
factory.notifyEditorActivationChange(editor);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java
index 83945423d..ac9fd27e1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java
@@ -43,7 +43,7 @@ public class MylarTasklistPreferencePage extends PreferencePage implements IWork
private Text commitPrefixCompleted = null;
private Text commitPrefixProgress = null;
-
+
private Button browse = null;
private Button copyExistingDataCheckbox = null;

Back to the top