Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/AbstractRepositoryQueryPage2.java269
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/Messages.java41
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/messages.properties7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AbstractTaskListFilter.java89
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ActivityExternalizationParticipant.java114
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AddExistingTaskJob.java127
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CategorizedPresentation.java35
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ChangeActivityHandleOperation.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ComboSelectionDialog.java109
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DialogErrorReporter.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/IDynamicSubMenuContributor.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskCommandIds.java31
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskHighlighter.java23
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotificationProvider.java25
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java85
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryConnectorUi.java62
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java150
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java122
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/OpenRepositoryTaskJob.java118
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonContentProposal.java82
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalLabelProvider.java37
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java200
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java69
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java157
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleDatePicker.java187
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java272
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduledPresentation.java35
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskActivityMonitor.java141
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskArchiveFilter.java37
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java45
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskEditorBloatMonitor.java84
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryDropDown.java209
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryHandler.java92
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHyperlink.java60
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskJobFactory.java183
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java107
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListBackupManager.java278
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListModifyOperation.java78
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationManager.java194
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java89
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java53
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryAdapterFactory.java63
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryComparator.java34
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java159
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryUtil.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java624
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java369
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskWorkingSetFilter.java129
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksAdapterFactory.java52
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksReminderDialog.java265
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiFactory.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiMessages.java21
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java1253
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractChangeCompletionAction.java60
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskAction.java61
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskEditorAction.java56
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskRepositoryAction.java84
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java58
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskHistoryDropDownAction.java103
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AddRepositoryAction.java112
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java96
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CloneTaskAction.java113
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CollapseAllAction.java42
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CommentActionGroup.java69
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CompareAttachmentsAction.java178
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java56
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java84
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeactivateAllTasksAction.java34
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java195
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskEditorAction.java37
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskRepositoryAction.java156
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DisconnectRepositoryAction.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/EditRepositoryPropertiesAction.java61
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExpandAllAction.java41
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExportAction.java83
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterCompletedTasksAction.java50
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoIntoAction.java55
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoUpAction.java39
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GroupSubTasksAction.java57
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ImportAction.java137
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/LinkWithEditorAction.java37
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java257
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java93
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java124
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java199
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java239
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskFromSelectionAction.java147
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTaskAction.java119
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java65
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskSearchAction.java53
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTasksUiPreferencesAction.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java64
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java147
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/QueryCloneAction.java107
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RefreshRepositoryTasksAction.java74
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RemoveFromCategoryAction.java57
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RenameAction.java61
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java76
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SearchForRepositoryTask.java46
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowInTaskListAction.java42
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTaskRepositoriesViewAction.java36
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTasksUiLegendAction.java63
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAllAction.java38
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAutomaticallyAction.java38
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction.java92
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java159
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskActivateAction.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskDeactivateAction.java52
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorCopyAction.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorScheduleAction.java74
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskListSortAction.java43
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java728
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java362
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleAllWorkingSetsAction.java60
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java86
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleWorkingSetAction.java90
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties156
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskHandler.java63
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskListViewHandler.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AddTaskRepositoryHandler.java53
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/GoToUnreadTaskHandler.java113
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MarkTaskHandler.java102
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MaximizePartHandler.java52
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/Messages.java51
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewLocalTaskHandler.java52
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewSubTaskHandler.java47
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenRepositoryTaskHandler.java29
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenSelectedTaskHandler.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInBrowserHandler.java43
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInDefaultEditorHandler.java78
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskListElementPropertiesHandler.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskRepositoryPropertiesHandler.java39
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java340
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/SubmitTaskHandler.java44
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskListToolTipHandler.java42
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskRepositoryParameterValues.java38
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java102
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/messages.properties15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/AbstractWorkingSetDialogCOPY.java410
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java129
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskCompareDialog.java248
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java42
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java298
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java573
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java105
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties54
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractHyperlinkTextPresentationManager.java170
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractReplyToCommentAction.java58
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentSizeFormatter.java101
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java195
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java80
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BrowserPreviewViewer.java177
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditor.java131
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java74
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CommentGroupStrategy.java171
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java164
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorBusyIndicator.java129
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java413
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/FillWidthLayout.java244
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/HighlightingHyperlinkTextPresentationManager.java30
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/IBusyEditor.java25
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java80
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java281
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java113
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java43
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPageFactory.java48
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PreviewAttributeEditor.java275
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryCompletionProcessor.java326
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewer.java85
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java231
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java533
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/SingleSelectionAttributeEditor.java147
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java106
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentEditorInput.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentStorage.java122
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java335
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java382
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java248
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttributePart.java283
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java750
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorDescriptionPart.java191
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionReader.java86
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionSettingsContribution.java135
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensions.java184
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorInputFactory.java60
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNewCommentPart.java35
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNotesPart.java135
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java186
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlinePage.java156
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPeoplePart.java66
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java353
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorRichTextPart.java318
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorSummaryPart.java188
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkDetector.java68
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkTextPresentationManager.java52
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskListChangeAdapter.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java961
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskRelationHyperlinkDetector.java128
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlink.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java170
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java74
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TraverseOnTabKeyListener.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties150
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties86
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/Messages.java41
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskAttributeDiff.java127
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDataDiff.java161
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDiffUtil.java187
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotification.java181
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationPopup.java160
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationQueryIncoming.java47
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationReminder.java50
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java116
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/messages.properties10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java87
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java772
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties30
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/Messages.java29
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectPropertiesLinkProvider.java92
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectTaskRepositoryPage.java183
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/messages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/CreateQueryFromSearchAction.java91
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/Messages.java75
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java64
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResult.java97
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java471
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchHitCollector.java138
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultContentProvider.java63
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSortAction.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorter.java77
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java73
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java65
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java144
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultsLabelProvider.java66
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchScoreComputerAdapterFactory.java55
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/StackTraceDuplicateDetector.java111
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/messages.properties27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AbstractRetrieveTitleFromUrlJob.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java275
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ClipboardCopier.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/CopyAttachmentToClipboardJob.java67
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java68
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ImportExportUtil.java60
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java83
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java109
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/SelectionProviderAdapter.java58
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskAttachmentPropertyTester.java45
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskComparator.java223
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskContainerComparator.java34
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataExportOperation.java118
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataSnapshotOperation.java34
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDragSourceListener.java116
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java73
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskRepositoryPropertyTester.java49
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiExtensionReader.java436
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java943
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiMenus.java144
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TreeWalker.java198
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/WebBrowserDialog.java65
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListContentProvider.java28
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListPresentation.java82
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java305
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java103
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/PriorityDropDownAction.java194
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskDetailLabelProvider.java61
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskInputDialog.java290
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskKeyComparator.java123
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java134
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java209
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java245
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java563
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java190
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestSorter.java178
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java127
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java644
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java1920
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesSorter.java57
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesView.java307
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoryLabelProvider.java94
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java219
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java92
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java94
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java173
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties46
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage.java295
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentSourcePage.java640
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java116
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/LocalRepositorySettingsPage.java66
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java265
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java55
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizardDialog.java51
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalCategoryWizard.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalTaskWizard.java71
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewQueryWizard.java43
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizard.java126
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskPage.java41
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskWizard.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewWebTaskPage.java48
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryConnectorPage.java110
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryPage.java283
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java423
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizard.java105
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizardPage.java173
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizard.java224
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizardPage.java248
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties138
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/Messages.java47
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetAdapterFactory.java64
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementAdapter.java54
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementFactory.java76
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetPage.java579
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java312
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/WorkingSetLabelComparator.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/messages.properties10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java253
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskHyperlinkDetector.java171
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskRepositoryLinkProvider.java74
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/IHighlightingHyperlink.java24
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiConstants.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiFactory.java52
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/LegendElement.java61
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskElementLabelProvider.java327
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlink.java76
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java168
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskRepositoryLocationUiFactory.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUi.java79
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java225
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java527
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java231
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRenderingEngine.java32
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorExtension.java64
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java1435
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPageFactory.java58
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java164
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java146
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java224
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java118
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/LayoutHint.java105
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java677
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java218
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorPartDescriptor.java86
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java35
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage.java169
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java1687
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPage.java414
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPageContribution.java224
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskRepositoryPage.java29
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPage.java28
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPageContainer.java26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java140
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewWebTaskWizard.java94
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java92
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java311
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java173
358 files changed, 0 insertions, 55327 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/AbstractRepositoryQueryPage2.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/AbstractRepositoryQueryPage2.java
deleted file mode 100644
index 8cbcc4fb9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/AbstractRepositoryQueryPage2.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.internal.provisional.tasks.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Steffen Pingel
- * @since 3.1
- */
-public abstract class AbstractRepositoryQueryPage2 extends AbstractRepositoryQueryPage {
-
- private Text titleText;
-
- private Button updateButton;
-
- private boolean firstTime = true;
-
- private final AbstractRepositoryConnector connector;
-
- private boolean needsRepositoryConfiguration = true;
-
- public AbstractRepositoryQueryPage2(String pageName, TaskRepository repository, IRepositoryQuery query) {
- super(pageName, repository, query);
- this.connector = TasksUi.getRepositoryConnector(getTaskRepository().getConnectorKind());
- setTitle(Messages.AbstractRepositoryQueryPage2_Enter_query_parameters);
- setDescription(Messages.AbstractRepositoryQueryPage2_If_attributes_are_blank_or_stale_press_the_Update_button);
- }
-
- public void setNeedsRepositoryConfiguration(boolean needsRepositoryConfiguration) {
- this.needsRepositoryConfiguration = needsRepositoryConfiguration;
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(composite);
- GridLayout layout = new GridLayout(2, false);
- if (inSearchContainer()) {
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- }
- composite.setLayout(layout);
-
- createTitleGroup(composite);
-
- Composite innerComposite = new Composite(composite, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).span(2, 1).applyTo(innerComposite);
- innerComposite.setLayout(new FillLayout());
- createPageContent(innerComposite);
-
- if (needsRepositoryConfiguration) {
- createUpdateButton(composite);
- }
-
- if (getQuery() != null) {
- titleText.setText(getQuery().getSummary());
- restoreState(getQuery());
- }
-
- Dialog.applyDialogFont(composite);
- setControl(composite);
- }
-
- protected abstract void createPageContent(Composite parent);
-
- private void createTitleGroup(Composite control) {
- if (inSearchContainer()) {
- return;
- }
-
- Label titleLabel = new Label(control, SWT.NONE);
- titleLabel.setText(Messages.AbstractRepositoryQueryPage2__Title_);
-
- titleText = new Text(control, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(titleText);
- titleText.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- // ignore
- }
-
- public void keyReleased(KeyEvent e) {
- getContainer().updateButtons();
- }
- });
- }
-
- private Control createUpdateButton(final Composite control) {
- Composite composite = new Composite(control, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- composite.setLayout(layout);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).span(2, 1).applyTo(composite);
-
- updateButton = new Button(composite, SWT.PUSH);
- updateButton.setText(Messages.AbstractRepositoryQueryPage2__Refresh_From_Repository);
- updateButton.setLayoutData(new GridData());
- updateButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (getTaskRepository() != null) {
- updateAttributesFromRepository(true);
- } else {
- MessageDialog.openInformation(
- Display.getCurrent().getActiveShell(),
- Messages.AbstractRepositoryQueryPage2_Update_Attributes_Failed,
- Messages.AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view);
- }
- }
- });
-
- return composite;
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- if (getSearchContainer() != null) {
- getSearchContainer().setPerformActionEnabled(true);
- }
-
- if (visible && firstTime) {
- firstTime = false;
- if (!hasRepositoryConfiguration() && needsRepositoryConfiguration) {
- // delay the execution so the dialog's progress bar is visible
- // when the attributes are updated
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl() != null && !getControl().isDisposed()) {
- initializePage();
- }
- }
-
- });
- } else {
- // no remote connection is needed to get attributes therefore do
- // not use delayed execution to avoid flickering
- initializePage();
- }
- }
- }
-
- private void initializePage() {
- if (needsRepositoryConfiguration) {
- updateAttributesFromRepository(false);
- }
- boolean restored = (getQuery() != null);
- if (inSearchContainer()) {
- restored |= restoreState(null);
- }
- if (!restored) {
- // initialize with default values
- }
- }
-
- protected abstract boolean hasRepositoryConfiguration();
-
- protected AbstractRepositoryConnector getConnector() {
- return connector;
- }
-
- private void updateAttributesFromRepository(final boolean force) {
- if (!hasRepositoryConfiguration() || force) {
- setErrorMessage(null);
- try {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- connector.updateRepositoryConfiguration(getTaskRepository(), monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException();
- }
- }
- };
-
- if (getContainer() != null) {
- getContainer().run(true, true, runnable);
- } else if (getSearchContainer() != null) {
- getSearchContainer().getRunnableContext().run(true, true, runnable);
- } else {
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- service.busyCursorWhile(runnable);
- }
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- setErrorMessage(((CoreException) e.getCause()).getStatus().getMessage());
- } else {
- setErrorMessage(e.getCause().getMessage());
- }
- return;
- } catch (InterruptedException e) {
- return;
- }
- }
-
- doRefresh();
- }
-
- protected abstract void doRefresh();
-
- @Override
- public boolean isPageComplete() {
- if (titleText != null && titleText.getText().length() > 0) {
- return true;
- }
- setMessage(Messages.AbstractRepositoryQueryPage2_Enter_a_title);
- return false;
- }
-
- @Override
- public boolean performSearch() {
- if (inSearchContainer()) {
- saveState();
- }
- return super.performSearch();
- }
-
- protected abstract boolean restoreState(IRepositoryQuery query);
-
- @Override
- public String getQueryTitle() {
- return (titleText != null) ? titleText.getText() : null;
- }
-
- public void setQueryTitle(String text) {
- if (titleText != null) {
- titleText.setText(text);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/Messages.java
deleted file mode 100644
index daba1feea..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/Messages.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.provisional.tasks.ui.wizards;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.provisional.tasks.ui.wizards.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String AbstractRepositoryQueryPage2__Refresh_From_Repository;
-
- public static String AbstractRepositoryQueryPage2__Title_;
-
- public static String AbstractRepositoryQueryPage2_Enter_a_title;
-
- public static String AbstractRepositoryQueryPage2_Enter_query_parameters;
-
- public static String AbstractRepositoryQueryPage2_If_attributes_are_blank_or_stale_press_the_Update_button;
-
- public static String AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view;
-
- public static String AbstractRepositoryQueryPage2_Update_Attributes_Failed;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/messages.properties
deleted file mode 100644
index b896314c3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/provisional/tasks/ui/wizards/messages.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-AbstractRepositoryQueryPage2__Refresh_From_Repository=&Refresh From Repository
-AbstractRepositoryQueryPage2__Title_=&Title:
-AbstractRepositoryQueryPage2_Enter_a_title=Enter a title
-AbstractRepositoryQueryPage2_Enter_query_parameters=Enter query parameters
-AbstractRepositoryQueryPage2_If_attributes_are_blank_or_stale_press_the_Update_button=If attributes are blank or stale press the Update button.
-AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view=No repository available, please add one using the Task Repositories view.
-AbstractRepositoryQueryPage2_Update_Attributes_Failed=Update Attributes Failed
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AbstractTaskListFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AbstractTaskListFilter.java
deleted file mode 100644
index d84c53219..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AbstractTaskListFilter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Collection;
-
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * Custom filters are used so that the "Find:" filter can 'see through' any filters that may have been applied.
- *
- * @author Mik Kersten
- */
-// XXX duplicate implementation in hasDescendantIncoming/hasIncompleteDescendant: consider replacing this by a visitor
-public abstract class AbstractTaskListFilter {
-
- public abstract boolean select(Object parent, Object element);
-
- /**
- * @return true if this filter should be applied even with filter text is present
- */
- public boolean applyToFilteredText() {
- return false;
- }
-
- /**
- * NOTE: performance implication of looking down children
- *
- * TODO: Move to an internal utility class
- */
- public static boolean hasDescendantIncoming(ITaskContainer container) {
- return hasDescendantIncoming(container, ITasksCoreConstants.MAX_SUBTASK_DEPTH);
- }
-
- public static boolean hasIncompleteDescendant(ITaskContainer container) {
- return hasIncompleteDescendant(container, ITasksCoreConstants.MAX_SUBTASK_DEPTH);
- }
-
- private static boolean hasDescendantIncoming(ITaskContainer container, int depth) {
- Collection<ITask> children = container.getChildren();
- if (children == null || depth <= 0) {
- return false;
- }
-
- for (ITask task : children) {
- if (task != null) {
- ITask containedRepositoryTask = task;
- if (containedRepositoryTask.getSynchronizationState().isIncoming()) {
- return true;
- } else if (TasksUiPlugin.getDefault().groupSubtasks(container) && task instanceof ITaskContainer
- && hasDescendantIncoming((ITaskContainer) task, depth - 1)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private static boolean hasIncompleteDescendant(ITaskContainer container, int depth) {
- Collection<ITask> children = container.getChildren();
- if (children == null || depth <= 0) {
- return false;
- }
-
- for (ITask task : children) {
- if (task != null) {
- ITask containedRepositoryTask = task;
- if (!containedRepositoryTask.isCompleted()) {
- return true;
- } else if (task instanceof ITaskContainer && hasIncompleteDescendant((ITaskContainer) task, depth - 1)) {
- return true;
- }
- }
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ActivityExternalizationParticipant.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ActivityExternalizationParticipant.java
deleted file mode 100644
index f424ca7a1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ActivityExternalizationParticipant.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.externalization.AbstractExternalizationParticipant;
-import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
-import org.eclipse.mylyn.internal.tasks.core.externalization.IExternalizationContext;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
-
-/**
- * @author Rob Elves
- */
-@SuppressWarnings("restriction")
-public class ActivityExternalizationParticipant extends AbstractExternalizationParticipant implements
- ITaskActivityListener {
-
- private boolean isDirty = false;
-
- private final ExternalizationManager manager;
-
- private long lastUpdate;
-
- public ActivityExternalizationParticipant(ExternalizationManager manager) {
- this.manager = manager;
- }
-
- @Override
- public void execute(IExternalizationContext context, IProgressMonitor monitor) throws CoreException {
- Assert.isNotNull(context);
- switch (context.getKind()) {
- case SAVE:
- if (ContextCorePlugin.getDefault() != null && ContextCorePlugin.getContextManager() != null) {
- setDirty(false);
- ContextCorePlugin.getContextManager().saveActivityMetaContext();
- }
- break;
- case LOAD:
- ContextCorePlugin.getContextManager().loadActivityMetaContext();
- break;
- case SNAPSHOT:
- break;
- }
- }
-
- @Override
- public String getDescription() {
- return Messages.ActivityExternalizationParticipant_Activity_Context;
- }
-
- @Override
- public ISchedulingRule getSchedulingRule() {
- return ITasksCoreConstants.ACTIVITY_SCHEDULING_RULE;
- }
-
- @Override
- public boolean isDirty() {
- synchronized (this) {
- return isDirty;
- }
- }
-
- public void setDirty(boolean dirty) {
- synchronized (this) {
- isDirty = dirty;
- }
- }
-
- @Override
- public String getFileName() {
- // ignore
- return null;
- }
-
- @Override
- public void load(File sourceFile, IProgressMonitor monitor) throws CoreException {
- // ignore see execute method
- }
-
- @Override
- public void save(File targetFile, IProgressMonitor monitor) throws CoreException {
- // ignore see execute method
- }
-
- public void activityReset() {
- // ignore see execute method
- }
-
- public void elapsedTimeUpdated(ITask task, long newElapsedTime) {
- if (System.currentTimeMillis() - lastUpdate > 1000 * 60) {
- setDirty(true);
- manager.requestSave();
- lastUpdate = System.currentTimeMillis();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AddExistingTaskJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AddExistingTaskJob.java
deleted file mode 100644
index 4786048f4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/AddExistingTaskJob.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Retrieves an existing repository task and adds it to the tasklist
- *
- * @author Willian Mitsuda
- */
-// TODO 3.1 merge with OpenRepositoryTaskJob
-public class AddExistingTaskJob extends Job {
-
- /**
- * Task repository whose task will be added
- */
- private final TaskRepository repository;
-
- /**
- * Identifies a existing task on the repository
- */
- private final String taskId;
-
- /**
- * Optional; informs the task container the task initialy belongs to; if null, it will be added to the current
- * selected task's category in task list
- */
- private final AbstractTaskCategory taskContainer;
-
- public AddExistingTaskJob(TaskRepository repository, String taskId) {
- this(repository, taskId, null);
- }
-
- public AddExistingTaskJob(TaskRepository repository, String taskId, AbstractTaskCategory taskContainer) {
- super(MessageFormat.format(Messages.AddExistingTaskJob_Adding_task_X_, taskId));
- this.repository = repository;
- this.taskId = taskId;
- this.taskContainer = taskContainer;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- OpenRepositoryTaskJob job = new OpenRepositoryTaskJob(repository.getConnectorKind(),
- repository.getRepositoryUrl(), taskId, null, null);
- IStatus result = job.run(monitor);
- final ITask newTask = job.getTask();
- if (newTask != null) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- AbstractTaskCategory category = taskContainer;
- TaskListView taskListView = TaskListView.getFromActivePerspective();
- if (category == null) {
- Object selectedObject = ((IStructuredSelection) taskListView.getViewer().getSelection()).getFirstElement();
- if (selectedObject instanceof TaskCategory) {
- category = (TaskCategory) selectedObject;
- }
- }
- TasksUiInternal.getTaskList().addTask(newTask, category);
- taskListView.getViewer().setSelection(new StructuredSelection(newTask));
- }
- });
- }
- return result;
-// try {
-// TasksUiUtil.openTask(repository, taskId);
-// final AbstractTask newTask = (AbstractTask) TasksUiInternal.createTask(repository, taskId, monitor);
-// if (newTask != null) {
-// TasksUiPlugin.getTaskActivityManager().setScheduledFor(newTask, TaskActivityUtil.getCurrentWeek());
-//
-// TasksUiInternal.refreshAndOpenTaskListElement(newTask);
-// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-//
-// public void run() {
-// AbstractTaskCategory category = taskContainer;
-// TaskListView taskListView = TaskListView.getFromActivePerspective();
-// if (category == null) {
-// Object selectedObject = ((IStructuredSelection) taskListView.getViewer().getSelection()).getFirstElement();
-// if (selectedObject instanceof TaskCategory) {
-// category = (TaskCategory) selectedObject;
-// }
-// }
-// TasksUiInternal.getTaskList().addTask(newTask, category);
-// taskListView.getViewer().setSelection(new StructuredSelection(newTask));
-// }
-// });
-// } else {
-// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-// if (window != null) {
-// MessageDialog.openWarning(window.getShell(), "Add Existing Task Failed",
-// MessageFormat.format("Unable to retrieve task \"{0}\" from repository.", taskId));
-// }
-// }
-// });
-// }
-// } catch (final CoreException e) {
-// TasksUiInternal.asyncDisplayStatus("Unable to open task", e.getStatus());
-// } finally {
-// monitor.done();
-// }
-// return Status.OK_STATUS;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CategorizedPresentation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CategorizedPresentation.java
deleted file mode 100644
index 78e153b0f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CategorizedPresentation.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTaskListContentProvider;
-import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTaskListPresentation;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListContentProvider;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-
-/**
- * @author Mik Kersten
- */
-public class CategorizedPresentation extends AbstractTaskListPresentation {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.categorized"; //$NON-NLS-1$
-
- public CategorizedPresentation() {
- super(ID);
- }
-
- @Override
- protected AbstractTaskListContentProvider createContentProvider(TaskListView taskListView) {
- return new TaskListContentProvider(taskListView);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ChangeActivityHandleOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ChangeActivityHandleOperation.java
deleted file mode 100644
index 35a8785b1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ChangeActivityHandleOperation.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.context.core.InteractionContext;
-import org.eclipse.mylyn.monitor.core.InteractionEvent;
-
-/**
- * Changes handle from oldHandle to newHandle in Activity Meta Context
- *
- * @author Rob Elves
- */
-public class ChangeActivityHandleOperation extends TaskListModifyOperation {
-
- private final String oldHandle;
-
- private final String newHandle;
-
- public ChangeActivityHandleOperation(String oldHandle, String newHandle) {
- this.oldHandle = oldHandle;
- this.newHandle = newHandle;
- }
-
- @Override
- protected void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException,
- InterruptedException {
- if (oldHandle == null || newHandle == null || oldHandle.equals(newHandle)) {
- return;
- }
- try {
- monitor.beginTask(Messages.ChangeActivityHandleOperation_Activity_migration, IProgressMonitor.UNKNOWN);
- refactorMetaContextHandles(oldHandle, newHandle);
- TasksUiPlugin.getTaskActivityMonitor().reloadActivityTime();
- } finally {
- monitor.done();
- }
- }
-
- @SuppressWarnings("restriction")
- private void refactorMetaContextHandles(String oldHandle, String newHandle) {
- ContextCorePlugin.getContextManager().saveActivityMetaContext();
- InteractionContext metaContext = ContextCorePlugin.getContextManager().getActivityMetaContext();
- ContextCorePlugin.getContextManager().resetActivityMetaContext();
- InteractionContext newMetaContext = ContextCorePlugin.getContextManager().getActivityMetaContext();
- for (InteractionEvent event : metaContext.getInteractionHistory()) {
- if (event.getStructureHandle() != null) {
- if (event.getStructureHandle().equals(oldHandle)) {
- event = new InteractionEvent(event.getKind(), event.getStructureKind(), newHandle,
- event.getOriginId(), event.getNavigation(), event.getDelta(),
- event.getInterestContribution(), event.getDate(), event.getEndDate());
- }
- }
- newMetaContext.parseEvent(event);
- }
- ContextCorePlugin.getContextManager().saveActivityMetaContext();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ComboSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ComboSelectionDialog.java
deleted file mode 100644
index 39075b230..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ComboSelectionDialog.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * General purpose dialog for selecting an item from a combo box.
- *
- * @author This was (essentially) copied from Eclipse's internal implementation by Wesley Coelho
- */
-public class ComboSelectionDialog extends Dialog {
-
- private String fSelection = null;
-
- private final String fShellTitle;
-
- private final String fLabelText;
-
- private final String[] fAllowedStrings;
-
- private final int fInitialSelectionIndex;
-
- private int fSelectedIndex = -1;
-
- public ComboSelectionDialog(Shell parentShell, String shellTitle, String labelText, String[] comboStrings,
- int initialSelectionIndex) {
- super(parentShell);
- fShellTitle = shellTitle;
- fLabelText = labelText;
- fAllowedStrings = comboStrings;
- fInitialSelectionIndex = initialSelectionIndex;
- }
-
- public String getSelectedString() {
- return fSelection;
- }
-
- /*
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText(fShellTitle);
-
- Composite composite = (Composite) super.createDialogArea(parent);
- Composite innerComposite = new Composite(composite, SWT.NONE);
- innerComposite.setLayoutData(new GridData());
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- innerComposite.setLayout(gl);
-
- Label label = new Label(innerComposite, SWT.NONE);
- label.setText(fLabelText);
- label.setLayoutData(new GridData());
-
- final Combo combo = new Combo(innerComposite, SWT.READ_ONLY);
- for (String allowedString : fAllowedStrings) {
- combo.add(allowedString);
- }
- combo.select(fInitialSelectionIndex);
- fSelection = combo.getItem(combo.getSelectionIndex());
- GridData gd = new GridData();
- gd.widthHint = convertWidthInCharsToPixels(getMaxStringLength());
- combo.setLayoutData(gd);
- combo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- fSelection = combo.getItem(combo.getSelectionIndex());
- fSelectedIndex = combo.getSelectionIndex();
- }
- });
- applyDialogFont(composite);
- return composite;
- }
-
- /**
- * Returns the array index of the selected string or -1 if no string was selected.
- */
- public int getSelectedIndex() {
- return fSelectedIndex;
- }
-
- private int getMaxStringLength() {
- int max = 0;
- for (String allowedString : fAllowedStrings) {
- max = Math.max(max, allowedString.length());
- }
- return max;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DialogErrorReporter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DialogErrorReporter.java
deleted file mode 100644
index 5678368be..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/DialogErrorReporter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.mylyn.commons.core.AbstractErrorReporter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Steffen Pingel
- */
-public class DialogErrorReporter extends AbstractErrorReporter {
-
- private boolean errorDialogOpen;
-
- @Override
- public int getPriority(IStatus status) {
- return AbstractErrorReporter.PRIORITY_LOW;
- }
-
- @Override
- public void handle(final IStatus status) {
- if (Platform.isRunning()) {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null) {
- Display display = workbench.getDisplay();
- if (display != null && !display.isDisposed()) {
- display.asyncExec(new Runnable() {
- public void run() {
- try {
- if (!errorDialogOpen) {
- errorDialogOpen = true;
- Shell shell = Display.getDefault().getActiveShell();
- ErrorDialog.openError(shell, Messages.DialogErrorReporter_Mylyn_Error, Messages.DialogErrorReporter_Please_report_the_following_error_at, status);
- }
- } finally {
- errorDialogOpen = false;
- }
- }
- });
- }
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/IDynamicSubMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/IDynamicSubMenuContributor.java
deleted file mode 100644
index 530495ec7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/IDynamicSubMenuContributor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.List;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-
-/**
- * @author Mik Kersten
- */
-// TODO 4.0 replace by platform contribution mechanism
-public interface IDynamicSubMenuContributor {
-
- public abstract MenuManager getSubMenuManager(List<IRepositoryElement> selectedElements);
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskCommandIds.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskCommandIds.java
deleted file mode 100644
index 9f525f635..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskCommandIds.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-/**
- * @author Willian Mitsuda
- * @author Mik Kersten
- */
-public interface ITaskCommandIds {
-
- public static final String OPEN_TASK = "org.eclipse.mylyn.tasks.ui.command.openTask"; //$NON-NLS-1$
-
- public static final String OPEN_TASK_REMOTE = "org.eclipse.mylyn.tasks.ui.command.openRemoteTask"; //$NON-NLS-1$
-
- public static final String ACTIVATE_TASK = "org.eclipse.mylyn.tasks.ui.command.activateTask"; //$NON-NLS-1$
-
- public static final String DEACTIVATE_TASK = "org.eclipse.mylyn.tasks.ui.command.deactivateAllTasks"; //$NON-NLS-1$
-
- public static final String ADD_TASK_REPOSITORY = "org.eclipse.mylyn.tasks.ui.command.addTaskRepository"; //$NON-NLS-1$
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskHighlighter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskHighlighter.java
deleted file mode 100644
index a0c72da90..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskHighlighter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @author Mik Kersten
- */
-public interface ITaskHighlighter {
-
- public Color getHighlightColor(ITask task);
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotificationProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotificationProvider.java
deleted file mode 100644
index 78e7b42a8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotificationProvider.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-
-/**
- * @author Rob Elves
- */
-public interface ITaskListNotificationProvider {
-
- public Set<AbstractNotification> getNotifications();
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
deleted file mode 100644
index dc0c40cc7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-/**
- * @author Mik Kersten
- */
-public interface ITasksUiPreferenceConstants {
-
- public static final String ACTIVATE_MULTIPLE = "org.eclipse.mylyn.tasks.ui.activation.multipe"; //$NON-NLS-1$
-
- public static final String ACTIVATE_WHEN_OPENED = "org.eclipse.mylyn.tasks.ui.activate.when.opened"; //$NON-NLS-1$
-
- public static final String SHOW_TRIM = "org.eclipse.mylyn.tasks.ui.show.trim"; //$NON-NLS-1$
-
- /**
- * @deprecated not used anymore, see {@link TaskListBackupManager}
- */
- @Deprecated
- public static final String BACKUP_LAST = "org.eclipse.mylyn.tasks.ui.backup.last"; //$NON-NLS-1$
-
- /**
- * @deprecated not used anymore, see {@link TaskListBackupManager}
- */
- @Deprecated
- public static final String BACKUP_MAXFILES = "org.eclipse.mylyn.tasks.ui.backup.maxfiles"; //$NON-NLS-1$
-
- /**
- * @deprecated not used anymore, see {@link TaskListBackupManager}
- */
- @Deprecated
- public static final String BACKUP_SCHEDULE = "org.eclipse.mylyn.tasks.ui.backup.schedule"; //$NON-NLS-1$
-
- public static final String FILTER_ARCHIVE_MODE = "org.eclipse.mylyn.tasks.ui.filters.archive"; //$NON-NLS-1$
-
- public static final String FILTER_COMPLETE_MODE = "org.eclipse.mylyn.tasks.ui.filters.complete"; //$NON-NLS-1$
-
- public static final String FILTER_PRIORITY = "org.eclipse.mylyn.tasks.ui.filters.priority"; //$NON-NLS-1$
-
- public static final String GROUP_SUBTASKS = "org.eclipse.mylyn.tasks.ui.group.subtasks"; //$NON-NLS-1$
-
- public static final String OVERLAYS_INCOMING_TIGHT = "org.eclipse.mylyn.tasks.ui.overlays.incoming.tight"; //$NON-NLS-1$
-
- public static final String NOTIFICATIONS_ENABLED = "org.eclipse.mylyn.tasks.ui.notifications.enabled"; //$NON-NLS-1$
-
- public static final String WEEK_START_DAY = "org.eclipse.mylyn.tasks.ui.planning.week.start.day"; //$NON-NLS-1$
-
- public static final String PLANNING_ENDHOUR = "org.eclipse.mylyn.tasks.ui.planning.end.hour"; //$NON-NLS-1$
-
- public static final String EDITOR_TASKS_RICH = "org.eclipse.mylyn.tasks.ui.reporting.open.editor"; //$NON-NLS-1$
-
- public static final String USE_STRIKETHROUGH_FOR_COMPLETED = "org.eclipse.mylyn.tasks.ui.strikethrough.for.completed"; //$NON-NLS-1$
-
- public static final String REPOSITORY_SYNCH_SCHEDULE_ENABLED = "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule"; //$NON-NLS-1$
-
- public static final String REPOSITORY_SYNCH_SCHEDULE_MILISECONDS = "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule.miliseconds"; //$NON-NLS-1$
-
- public static final String TEMPLATES_DELETED = "org.eclipse.mylyn.tasks.ui.templates.deleted"; //$NON-NLS-1$
-
- public static final String TEMPLATES_DELETED_DELIM = "|"; //$NON-NLS-1$
-
- public static final String AUTO_EXPAND_TASK_LIST = "org.eclipse.mylyn.tasks.ui.auto.expand"; //$NON-NLS-1$
-
- /**
- * Local subtasks are now enabled by default.
- *
- * @deprecated not used anymore
- */
- // TODO 4.0 remove
- @Deprecated
- public static final String LOCAL_SUB_TASKS_ENABLED = "org.eclipse.mylyn.tasks.ui.subtasks.local"; //$NON-NLS-1$
-
- // NOTE: legacy name, do not change
- public static final String PREF_DATA_DIR = "org.eclipse.mylyn.data.dir"; //$NON-NLS-1$
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryConnectorUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryConnectorUi.java
deleted file mode 100644
index 126a58dae..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryConnectorUi.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.LocalRepositorySettingsPage;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewLocalTaskWizard;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- */
-public class LocalRepositoryConnectorUi extends AbstractRepositoryConnectorUi {
-
- @Override
- public ImageDescriptor getTaskKindOverlay(ITask task) {
- return super.getTaskKindOverlay(task);
- }
-
- @Override
- public IWizard getNewTaskWizard(TaskRepository taskRepository, ITaskMapping selection) {
- return new NewLocalTaskWizard(selection);
- }
-
- @Override
- public IWizard getQueryWizard(TaskRepository repository, IRepositoryQuery queryToEdit) {
- return null;
- }
-
- @Override
- public String getConnectorKind() {
- return LocalRepositoryConnector.CONNECTOR_KIND;
- }
-
- @Override
- public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository) {
- return new LocalRepositorySettingsPage(taskRepository);
- }
-
- @Override
- public boolean hasSearchPage() {
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
deleted file mode 100644
index 1a703982b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String ActivityExternalizationParticipant_Activity_Context;
-
- public static String AddExistingTaskJob_Adding_task_X_;
-
- public static String ChangeActivityHandleOperation_Activity_migration;
-
- public static String DialogErrorReporter_Mylyn_Error;
-
- public static String DialogErrorReporter_Please_report_the_following_error_at;
-
- public static String MoveToCategoryMenuContributor_Move_to;
-
- public static String OpenRepositoryTaskJob_Could_not_find_repository_configuration_for_X;
-
- public static String OpenRepositoryTaskJob_Opening_Remote_Task;
-
- public static String OpenRepositoryTaskJob_Opening_repository_task_X;
-
- public static String OpenRepositoryTaskJob_Please_set_up_repository_via_X;
-
- public static String OpenRepositoryTaskJob_Repository_Not_Found;
-
- public static String OpenRepositoryTaskJob_Unable_to_open_task;
-
- public static String RefactorRepositoryUrlOperation_Repository_URL_update;
-
- public static String ScheduleTaskMenuContributor_Cannot_schedule_completed_tasks;
-
- public static String ScheduleTaskMenuContributor_Choose_Date_;
-
- public static String ScheduleTaskMenuContributor_Future;
-
- public static String ScheduleTaskMenuContributor_Not_Scheduled;
-
- public static String ScheduleTaskMenuContributor_Schedule_for;
-
- public static String TaskHistoryDropDown_Activate_Task_;
-
- public static String TaskHistoryDropDown_Deactivate_Task;
-
- public static String TaskJobFactory_Receiving_configuration;
-
- public static String TaskJobFactory_Refreshing_repository_configuration;
-
- public static String TaskLabelDecorator____unknown_host___;
-
- public static String TaskListBackupManager_Could_not_backup_task_data;
-
- public static String TaskListBackupManager_Error_occured_during_scheduled_tasklist_backup;
-
- public static String TaskListBackupManager_Scheduled_task_data_backup;
-
- public static String TaskListBackupManager_Tasklist_Backup;
-
- public static String TaskListNotificationManager_Open_Notification_Job;
-
- public static String TaskRepositoryLocationUi_Enter_HTTP_password;
-
- public static String TaskRepositoryLocationUi_Enter_proxy_password;
-
- public static String TaskRepositoryLocationUi_Enter_repository_password;
-
- public static String TaskSearchPage_ERROR_Unable_to_present_query_page;
-
- public static String TaskSearchPage_No_task_found_matching_key_;
-
- public static String TaskSearchPage_Repository_Search;
-
- public static String TaskSearchPage_Select_Repository_;
-
- public static String TaskSearchPage_Task_Key_ID;
-
- public static String TaskSearchPage_Task_Search;
-
- public static String TasksReminderDialog_Description;
-
- public static String TasksReminderDialog_Dismiss_All;
-
- public static String TasksReminderDialog_Dismiss_Selected;
-
- public static String TasksReminderDialog_Priority;
-
- public static String TasksReminderDialog_Remind_tommorrow;
-
- public static String TasksReminderDialog_Reminder_Day;
-
- public static String TasksReminderDialog_Reminders;
-
- public static String TasksUiMessages_Task_Editor;
-
- public static String TasksUiPlugin_Initializing_Task_List;
-
- public static String TasksUiPlugin_Task_Repositories;
-
- public static String TasksUiPlugin_Load_Data_Directory;
-
- public static String TaskTrimWidget__no_active_task_;
-
- public static String TaskTrimWidget__no_task_active_;
-
- public static String AbstractRepositoryConnectorUi_Task;
-
- public static String TaskElementLabelProvider__no_summary_available_;
-
- public static String TaskHyperlink_Could_not_determine_repository_for_report;
-
- public static String TaskHyperlink_Open_Task_X_in_X;
-
- public static String TasksUiUtil_Browser_could_not_be_initiated;
-
- public static String TasksUiUtil_Browser_init_error;
-
- public static String TasksUiUtil_Could_not_open_URL_;
-
- public static String TasksUiUtil_create_task;
-
- public static String TasksUiUtil_failed_to_create_new_task;
-
- public static String TasksUiUtil_No_URL_to_open;
-
- public static String AbstractRetrieveTitleFromUrlJob_Retrieving_summary_from_URL;
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java
deleted file mode 100644
index 5c3395654..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/MoveToCategoryMenuContributor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Raphael Ackermann - bug 160315
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewCategoryAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskContainerComparator;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-
-/**
- * @author Mik Kersten
- */
-public class MoveToCategoryMenuContributor implements IDynamicSubMenuContributor {
-
- public MenuManager getSubMenuManager(final List<IRepositoryElement> selectedElements) {
- final MenuManager subMenuManager = new MenuManager(Messages.MoveToCategoryMenuContributor_Move_to);
-
- // Compute selected tasks
- List<AbstractTask> selectedTasks = new ArrayList<AbstractTask>(selectedElements.size());
- for (IRepositoryElement element : selectedElements) {
- if (element instanceof ITask) {
- selectedTasks.add((AbstractTask) element);
- }
- }
- subMenuManager.setVisible(!selectedTasks.isEmpty());
-
- List<AbstractTaskCategory> categories = new ArrayList<AbstractTaskCategory>(TasksUiInternal.getTaskList()
- .getCategories());
- Collections.sort(categories, new TaskContainerComparator());
- for (final AbstractTaskCategory category : categories) {
- if (!(category instanceof UnmatchedTaskContainer)) {
- String text = handleAcceleratorKeys(category.getSummary());
- Action action = new Action(text, IAction.AS_RADIO_BUTTON) {
- @Override
- public void run() {
- moveToCategory(selectedElements, category);
- }
- };
- action.setImageDescriptor(TasksUiImages.CATEGORY);
- if (selectedTasks.size() == 1) {
- if (category.contains(selectedTasks.get(0).getHandleIdentifier())) {
- action.setChecked(true);
- }
- }
- subMenuManager.add(action);
- }
- }
- // add New Category action at the end of the Move to Category Submenu
- // and move selected actions to this newly created category
- Action action = new NewCategoryAction() {
- @Override
- public void run() {
- TaskCategory category = createCategory();
- if (category != null) {
- moveToCategory(selectedElements, category);
- }
- }
- };
- subMenuManager.add(new Separator());
- subMenuManager.add(action);
- return subMenuManager;
- }
-
- /**
- * public for testing
- *
- * Deals with text where user has entered a '@' or tab character but which are not meant to be accelerators. from:
- * Action#setText: Note that if you want to insert a '@' character into the text (but no accelerator, you can simply
- * insert a '@' or a tab at the end of the text. see Action#setText
- */
- public String handleAcceleratorKeys(String text) {
- if (text == null) {
- return null;
- }
-
- int index = text.lastIndexOf('\t');
- if (index == -1) {
- index = text.lastIndexOf('@');
- }
- if (index >= 0) {
- return text.concat("@"); //$NON-NLS-1$
- }
- return text;
- }
-
- /**
- * @param selectedElements
- * @param category
- */
- private void moveToCategory(final List<IRepositoryElement> selectedElements, AbstractTaskCategory category) {
- for (IRepositoryElement element : selectedElements) {
- if (element instanceof ITask) {
- TasksUiInternal.getTaskList().addTask((AbstractTask) element, category);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/OpenRepositoryTaskJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/OpenRepositoryTaskJob.java
deleted file mode 100644
index 76265b2a7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/OpenRepositoryTaskJob.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class OpenRepositoryTaskJob extends Job {
-
- private final String repositoryUrl;
-
- private final String repositoryKind;
-
- private final String taskId;
-
- private final String taskUrl;
-
- private ITask task;
-
- public OpenRepositoryTaskJob(String repositoryKind, String repositoryUrl, String taskId, String taskUrl,
- IWorkbenchPage page) {
- super(MessageFormat.format(Messages.OpenRepositoryTaskJob_Opening_repository_task_X, taskId));
-
- this.repositoryKind = repositoryKind;
- this.taskId = taskId;
- this.repositoryUrl = repositoryUrl;
- this.taskUrl = taskUrl;
- }
-
- /**
- * Returns the task if it was created when openeing
- *
- * @return
- */
- public ITask getTask() {
- return task;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(Messages.OpenRepositoryTaskJob_Opening_Remote_Task, 10);
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(repositoryKind, repositoryUrl);
- if (repository == null) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(null, Messages.OpenRepositoryTaskJob_Repository_Not_Found,
- MessageFormat.format(
- Messages.OpenRepositoryTaskJob_Could_not_find_repository_configuration_for_X,
- repositoryUrl)
- + "\n" + //$NON-NLS-1$
- MessageFormat.format(Messages.OpenRepositoryTaskJob_Please_set_up_repository_via_X,
- Messages.TasksUiPlugin_Task_Repositories));
- TasksUiUtil.openUrl(taskUrl);
- }
-
- });
- return Status.OK_STATUS;
- }
-
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(repositoryKind);
- try {
- TaskData taskData = connector.getTaskData(repository, taskId, monitor);
- if (taskData != null) {
- task = TasksUi.getRepositoryModel().createTask(repository, taskData.getTaskId());
- TasksUiPlugin.getTaskDataManager().putUpdatedTaskData(task, taskData, true);
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiUtil.openTask(task);
- }
- });
- } else {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiUtil.openUrl(taskUrl);
- }
- });
- }
- } catch (final CoreException e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.displayStatus(Messages.OpenRepositoryTaskJob_Unable_to_open_task, e.getStatus());
- }
- });
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonContentProposal.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonContentProposal.java
deleted file mode 100644
index d8fc3050a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonContentProposal.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Mik Kersten
- */
-public class PersonContentProposal implements IContentProposal, Comparable<PersonContentProposal> {
-
- private final String address;
-
- private final boolean isCurrentUser;
-
- private final String replacementText;
-
- private final int cursorPosition;
-
- public PersonContentProposal(String address, boolean isCurrentUser, String replacementText, int cursorPosition) {
- Assert.isNotNull(address);
- Assert.isNotNull(replacementText);
- this.address = address;
- this.isCurrentUser = isCurrentUser;
- this.replacementText = replacementText;
- this.cursorPosition = cursorPosition;
- }
-
- public PersonContentProposal(String address, boolean isCurrentUser) {
- this(address, isCurrentUser, address, address.length());
- }
-
- public String getLabel() {
- return address;
- }
-
- public String getDescription() {
- return null;
- }
-
- public int getCursorPosition() {
- return cursorPosition;
- }
-
- public String getContent() {
- return replacementText;
- }
-
- public Image getImage() {
- if (isCurrentUser) {
- return CommonImages.getImage(CommonImages.PERSON_ME);
- } else {
- return CommonImages.getImage(CommonImages.PERSON);
- }
- }
-
- public int compareTo(PersonContentProposal otherContentProposal) {
- if (isCurrentUser) {
- return -1;
- } else if (otherContentProposal.isCurrentUser) {
- return 1;
- }
- return address.compareToIgnoreCase(otherContentProposal.address);
- }
-
- public boolean isCurrentUser() {
- return isCurrentUser;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalLabelProvider.java
deleted file mode 100644
index 16bcdcac2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalLabelProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Shawn Minto
- */
-public class PersonProposalLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof PersonContentProposal) {
- return ((PersonContentProposal) element).getImage();
- }
- return null;
- }
-
- @Override
- public String getText(Object element) {
- if (element instanceof PersonContentProposal) {
- return ((PersonContentProposal) element).getLabel();
- }
- return super.getText(element);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
deleted file mode 100644
index 52a0b0e60..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
-import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Shawn Minto
- * @author Eugene Kuleshov
- * @author Steffen Pingel
- */
-public class PersonProposalProvider implements IContentProposalProvider {
-
- private final AbstractTask currentTask;
-
- private String currentUser;
-
- private SortedSet<String> addressSet = null;
-
- private String repositoryUrl;
-
- private String connectorKind;
-
- private TaskData currentTaskData;
-
- public PersonProposalProvider(AbstractTask task, TaskData taskData) {
- this.currentTask = task;
- this.currentTaskData = taskData;
- if (task != null) {
- repositoryUrl = task.getRepositoryUrl();
- connectorKind = task.getConnectorKind();
- } else if (taskData != null) {
- repositoryUrl = taskData.getRepositoryUrl();
- connectorKind = taskData.getConnectorKind();
- }
- }
-
- public PersonProposalProvider(String repositoryUrl, String repositoryKind) {
- this.currentTask = null;
- this.repositoryUrl = repositoryUrl;
- this.connectorKind = repositoryKind;
- }
-
- public IContentProposal[] getProposals(String contents, int position) {
- if (contents == null) {
- throw new IllegalArgumentException();
- }
-
- int leftSeparator = getIndexOfLeftSeparator(contents, position);
- int rightSeparator = getIndexOfRightSeparator(contents, position);
-
- assert leftSeparator <= position;
- assert position <= rightSeparator;
-
- String searchText = contents.substring(leftSeparator + 1, position);
- String resultPrefix = contents.substring(0, leftSeparator + 1);
- String resultPostfix = contents.substring(rightSeparator);
-
- // retrieve subset of the tree set using key range
- SortedSet<String> addressSet = getAddressSet();
- if (!searchText.equals("")) { //$NON-NLS-1$
- searchText = searchText.toLowerCase();
- char[] nextWord = searchText.toCharArray();
- nextWord[searchText.length() - 1]++;
- addressSet = addressSet.subSet(searchText, new String(nextWord));
- }
-
- IContentProposal[] result = new IContentProposal[addressSet.size()];
- int i = 0;
- for (final String address : addressSet) {
- result[i++] = new PersonContentProposal(address, address.equalsIgnoreCase(currentUser), resultPrefix
- + address + resultPostfix, resultPrefix.length() + address.length());
- }
- Arrays.sort(result);
- return result;
- }
-
- private int getIndexOfLeftSeparator(String contents, int position) {
- int i = contents.lastIndexOf(' ', position - 1);
- i = Math.max(contents.lastIndexOf(',', position - 1), i);
- return i;
- }
-
- private int getIndexOfRightSeparator(String contents, int position) {
- int index = contents.length();
- int i = contents.indexOf(' ', position);
- if (i != -1) {
- index = Math.min(i, index);
- }
- i = contents.indexOf(',', position);
- if (i != -1) {
- index = Math.min(i, index);
- }
- return index;
- }
-
- private SortedSet<String> getAddressSet() {
- if (addressSet != null) {
- return addressSet;
- }
-
- addressSet = new TreeSet<String>(new Comparator<String>() {
- public int compare(String s1, String s2) {
- return s1.compareToIgnoreCase(s2);
- }
- });
-
- if (currentTask != null) {
- addAddress(currentTask.getOwner(), addressSet);
- }
-
- if (currentTaskData != null) {
- addAddresses(currentTaskData, addressSet);
- }
-
- if (repositoryUrl != null && connectorKind != null) {
- Set<AbstractTask> tasks = new HashSet<AbstractTask>();
- if (currentTask != null) {
- tasks.add(currentTask);
- }
-
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
-
- if (repository != null) {
- AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
- if (credentials != null && credentials.getUserName().length() > 0) {
- currentUser = credentials.getUserName();
- addressSet.add(currentUser);
- }
- }
-
- Collection<AbstractTask> allTasks = TasksUiPlugin.getTaskList().getAllTasks();
- for (AbstractTask task : allTasks) {
- if (repositoryUrl.equals(task.getRepositoryUrl())) {
- tasks.add(task);
- }
- }
-
- for (ITask task : tasks) {
- addAddresses(task, addressSet);
- }
- }
-
- return addressSet;
- }
-
- private void addAddresses(ITask task, Set<String> addressSet) {
- // TODO: Creator, and CC should be stored on AbstractTask
-
- addAddress(task.getOwner(), addressSet);
- }
-
- private void addAddresses(TaskData data, Set<String> addressSet) {
- // addressSet.add(data.getAssignedTo()); // owner
- // TODO 3.1 reimplement
- // addAddress(data.getReporter(), addressSet); // ??
-// for (String address : data.getCc()) {
-// addAddress(address, addressSet);
-// }
-// for (TaskComment comment : currentTaskData.getComments()) {
-// addAddress(comment.getAuthor(), addressSet);
-// }
-// for (RepositoryAttachment attachment : currentTaskData.getAttachments()) {
-// addAddress(attachment.getCreator(), addressSet);
-// }
- }
-
- private void addAddress(String address, Set<String> addressSet) {
- if (address != null && address.trim().length() > 0) {
- addressSet.add(address.trim());
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java
deleted file mode 100644
index 15499a75b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PlanningPerspectiveFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-import org.eclipse.ui.internal.PageLayout;
-
-/**
- * @author Mik Kersten
- */
-public class PlanningPerspectiveFactory implements IPerspectiveFactory {
-
- public void createInitialLayout(IPageLayout layout) {
- defineActions(layout);
- defineLayout(layout);
- }
-
- public void defineActions(IPageLayout layout) {
- layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
- layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
- layout.addShowViewShortcut(TaskListView.ID);
- // layout.addShowViewShortcut(TaskActivityView.ID);
-
- layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
- removeUninterestingActionSets(layout);
- }
-
- public void defineLayout(IPageLayout layout) {
- String editorArea = layout.getEditorArea();
-
- IFolderLayout topRight = layout.createFolder("topRight", IPageLayout.RIGHT, (float) 0.6, editorArea);//$NON-NLS-1$
- topRight.addView(TaskListView.ID);
-
- // IFolderLayout bottomLeft = layout.createFolder(
- // "bottomLeft", IPageLayout.BOTTOM, (float) 0.50,//$NON-NLS-1$
- // "topLeft");//$NON-NLS-1$
- // bottomLeft.addView(TaskActivityView.ID);
- topRight.addPlaceholder(IPageLayout.ID_RES_NAV);
-
- // IFolderLayout bottomRight = layout.createFolder(
- // "bottomRight", IPageLayout.BOTTOM, (float) 0.66,//$NON-NLS-1$
- // editorArea);
- //
- // bottomRight.addView(IPageLayout.ID_TASK_LIST);
-
- }
-
- @SuppressWarnings("unchecked")
- public static void removeUninterestingActionSets(IPageLayout layout) {
- ArrayList actionSets = ((PageLayout) layout).getActionSets();
- actionSets.remove("org.eclipse.ui.edit.text.actionSet.annotationNavigation"); //$NON-NLS-1$
- actionSets.remove("org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo"); //$NON-NLS-1$
- actionSets.remove("org.eclipse.ui.externaltools.ExternalToolsSet"); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java
deleted file mode 100644
index 58b1a29dd..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RefactorRepositoryUrlOperation.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URLDecoder;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.context.core.InteractionContext;
-import org.eclipse.mylyn.internal.context.core.InteractionContextManager;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.monitor.core.InteractionEvent;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Rob Elves
- */
-public class RefactorRepositoryUrlOperation extends TaskListModifyOperation {
-
- private final String oldUrl;
-
- private final String newUrl;
-
- public RefactorRepositoryUrlOperation(String oldUrl, String newUrl) {
- super(ITasksCoreConstants.ROOT_SCHEDULING_RULE);
- Assert.isNotNull(oldUrl);
- Assert.isNotNull(newUrl);
- Assert.isTrue(!oldUrl.equals(newUrl));
- this.oldUrl = oldUrl;
- this.newUrl = newUrl;
- }
-
- @Override
- protected void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException,
- InterruptedException {
- try {
- //TasksUiPlugin.getTaskListManager().deactivateAllTasks();
- monitor.beginTask(Messages.RefactorRepositoryUrlOperation_Repository_URL_update, IProgressMonitor.UNKNOWN);
- refactorOfflineHandles(oldUrl, newUrl);
- getTaskList().refactorRepositoryUrl(oldUrl, newUrl);
- refactorMetaContextHandles(oldUrl, newUrl);
- refactorContextFileNames();
- TasksUiPlugin.getTaskActivityMonitor().reloadActivityTime();
- } finally {
- monitor.done();
- }
- }
-
- @SuppressWarnings("restriction")
- public void refactorContextFileNames() {
-
- File dataDir = new File(TasksUiPlugin.getDefault().getDataDirectory(), ITasksCoreConstants.CONTEXTS_DIRECTORY);
- if (dataDir.exists() && dataDir.isDirectory()) {
- File[] files = dataDir.listFiles();
- if (files != null) {
- for (File file : dataDir.listFiles()) {
- int dotIndex = file.getName().lastIndexOf(".xml"); //$NON-NLS-1$
- if (dotIndex != -1) {
- String storedHandle;
- try {
- storedHandle = URLDecoder.decode(file.getName().substring(0, dotIndex),
- InteractionContextManager.CONTEXT_FILENAME_ENCODING);
- int delimIndex = storedHandle.lastIndexOf(RepositoryTaskHandleUtil.HANDLE_DELIM);
- if (delimIndex != -1) {
- String storedUrl = storedHandle.substring(0, delimIndex);
- if (oldUrl.equals(storedUrl)) {
- String id = RepositoryTaskHandleUtil.getTaskId(storedHandle);
- String newHandle = RepositoryTaskHandleUtil.getHandle(newUrl, id);
- File newFile = ContextCorePlugin.getContextStore().getFileForContext(newHandle);
- file.renameTo(newFile);
- }
- }
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not move context file: " + file.getName(), e)); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
-
- private void refactorOfflineHandles(String oldRepositoryUrl, String newRepositoryUrl) throws CoreException {
- TaskDataManager taskDataManager = TasksUiPlugin.getTaskDataManager();
- for (ITask task : getTaskList().getAllTasks()) {
- if (oldRepositoryUrl.equals(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_REPOSITORY_URL))) {
- taskDataManager.refactorRepositoryUrl(task, task.getRepositoryUrl(), newRepositoryUrl);
- }
- if (task.getRepositoryUrl().equals(oldRepositoryUrl)) {
- taskDataManager.refactorRepositoryUrl(task, newRepositoryUrl, newRepositoryUrl);
-// RepositoryTaskData newTaskData = taskDataManager.getNewTaskData(repositoryTask.getRepositoryUrl(),
-// repositoryTask.getTaskId());
-// RepositoryTaskData oldTaskData = taskDataManager.getOldTaskData(repositoryTask.getRepositoryUrl(),
-// repositoryTask.getTaskId());
-// Set<RepositoryTaskAttribute> edits = taskDataManager.getEdits(repositoryTask.getRepositoryUrl(),
-// repositoryTask.getTaskId());
-// taskDataManager.remove(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId());
-//
-// if (newTaskData != null) {
-// newTaskData.setRepositoryURL(newRepositoryUrl);
-// taskDataManager.setNewTaskData(newTaskData);
-// }
-// if (oldTaskData != null) {
-// oldTaskData.setRepositoryURL(newRepositoryUrl);
-// taskDataManager.setOldTaskData(oldTaskData);
-// }
-// if (!edits.isEmpty()) {
-// taskDataManager.saveEdits(newRepositoryUrl, repositoryTask.getTaskId(), edits);
-// }
- }
- }
-// TasksUiPlugin.getTaskDataStorageManager().saveNow();
- }
-
- @SuppressWarnings("restriction")
- private void refactorMetaContextHandles(String oldRepositoryUrl, String newRepositoryUrl) {
- InteractionContext metaContext = ContextCorePlugin.getContextManager().getActivityMetaContext();
- ContextCorePlugin.getContextManager().resetActivityMetaContext();
- InteractionContext newMetaContext = ContextCorePlugin.getContextManager().getActivityMetaContext();
- for (InteractionEvent event : metaContext.getInteractionHistory()) {
- if (event.getStructureHandle() != null) {
- String storedUrl = RepositoryTaskHandleUtil.getRepositoryUrl(event.getStructureHandle());
- if (storedUrl != null) {
- if (oldRepositoryUrl.equals(storedUrl)) {
- String taskId = RepositoryTaskHandleUtil.getTaskId(event.getStructureHandle());
- if (taskId != null) {
- String newHandle = RepositoryTaskHandleUtil.getHandle(newRepositoryUrl, taskId);
- event = new InteractionEvent(event.getKind(), event.getStructureKind(), newHandle,
- event.getOriginId(), event.getNavigation(), event.getDelta(),
- event.getInterestContribution(), event.getDate(), event.getEndDate());
- }
- }
- }
- }
- newMetaContext.parseEvent(event);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleDatePicker.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleDatePicker.java
deleted file mode 100644
index 68fc1085e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleDatePicker.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.DateRange;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Rob Elves
- */
-public class ScheduleDatePicker extends Composite {
-
- private Text scheduledDateText = null;
-
- private Button pickButton = null;
-
- private final List<SelectionListener> pickerListeners = new LinkedList<SelectionListener>();
-
- private final SimpleDateFormat simpleDateFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.MEDIUM);
-
- private final String initialText = DatePicker.LABEL_CHOOSE;
-
- private final List<IRepositoryElement> tasks;
-
- private final ScheduleTaskMenuContributor contributor;
-
- private DateRange scheduledDate;
-
- private final boolean isFloating = false;
-
- public ScheduleDatePicker(Composite parent, AbstractTask task, int style) {
- super(parent, style);
- if (task != null) {
- if (task.getScheduledForDate() != null) {
- this.scheduledDate = task.getScheduledForDate();
- }
- }
-
- initialize((style & SWT.FLAT) > 0 ? SWT.FLAT : 0);
- contributor = new ScheduleTaskMenuContributor() {
-
- @Override
- protected DateRange getScheduledForDate(AbstractTask singleTaskSelection) {
- return ScheduleDatePicker.this.scheduledDate;
- }
-
- @Override
- protected void setScheduledDate(DateRange dateRange) {
- if (dateRange != null) {
- scheduledDate = dateRange;
- } else {
- scheduledDate = null;
- }
- updateDateText();
- notifyPickerListeners();
- }
- };
- tasks = new ArrayList<IRepositoryElement>();
- tasks.add(task);
- }
-
- public void setDatePattern(String pattern) {
- simpleDateFormat.applyPattern(pattern);
- }
-
- private void initialize(int style) {
-
- GridLayout gridLayout = new GridLayout(2, false);
- gridLayout.horizontalSpacing = 0;
- gridLayout.verticalSpacing = 0;
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- this.setLayout(gridLayout);
-
- scheduledDateText = new Text(this, style);
- scheduledDateText.setEditable(false);
- GridData dateTextGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
- dateTextGridData.grabExcessHorizontalSpace = true;
- dateTextGridData.widthHint = SWT.FILL;
- dateTextGridData.verticalIndent = 0;
-
- scheduledDateText.setLayoutData(dateTextGridData);
- scheduledDateText.setText(initialText);
-
- pickButton = new Button(this, style | SWT.ARROW | SWT.DOWN);
- GridData pickButtonGridData = new GridData(SWT.RIGHT, SWT.FILL, false, true);
- pickButtonGridData.verticalIndent = 0;
- pickButton.setLayoutData(pickButtonGridData);
- pickButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent arg0) {
-
- MenuManager menuManager = contributor.getSubMenuManager(tasks);
- Menu menu = menuManager.createContextMenu(pickButton);
- pickButton.setMenu(menu);
- menu.setVisible(true);
- }
- });
-
- updateDateText();
- pack();
- }
-
- public void addPickerSelectionListener(SelectionListener listener) {
- pickerListeners.add(listener);
- }
-
- @Override
- public void setForeground(Color color) {
- pickButton.setForeground(color);
- scheduledDateText.setForeground(color);
- super.setForeground(color);
- }
-
- @Override
- public void setBackground(Color backgroundColor) {
- pickButton.setBackground(backgroundColor);
- scheduledDateText.setBackground(backgroundColor);
- super.setBackground(backgroundColor);
- }
-
- private void notifyPickerListeners() {
- for (SelectionListener listener : pickerListeners) {
- listener.widgetSelected(null);
- }
- }
-
- private void updateDateText() {
- if (scheduledDate != null) {
- scheduledDateText.setText(scheduledDate.toString());
- } else {
- scheduledDateText.setEnabled(false);
- scheduledDateText.setText(DatePicker.LABEL_CHOOSE);
- scheduledDateText.setEnabled(true);
- }
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- scheduledDateText.setEnabled(enabled);
- pickButton.setEnabled(enabled);
- super.setEnabled(enabled);
- }
-
- public DateRange getScheduledDate() {
- return scheduledDate;
- }
-
- public void setScheduledDate(DateRange date) {
- scheduledDate = date;
- updateDateText();
- }
-
- public boolean isFloatingDate() {
- return isFloating;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
deleted file mode 100644
index 1533ed233..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduleTaskMenuContributor.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DateSelectionDialog;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.DateRange;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.core.WeekDateRange;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- */
-public class ScheduleTaskMenuContributor implements IDynamicSubMenuContributor {
-
- private AbstractTask singleTaskSelection;
-
- private final List<IRepositoryElement> taskListElementsToSchedule = new ArrayList<IRepositoryElement>();
-
- public MenuManager getSubMenuManager(final List<IRepositoryElement> selectedElements) {
- singleTaskSelection = null;
- taskListElementsToSchedule.clear();
-
- final MenuManager subMenuManager = new MenuManager(Messages.ScheduleTaskMenuContributor_Schedule_for);
-
- if (selectedElements.size() == 1) {
- IRepositoryElement selectedElement = selectedElements.get(0);
- if (selectedElement instanceof ITask) {
- singleTaskSelection = (AbstractTask) selectedElement;
- }
- }
-
- for (IRepositoryElement selectedElement : selectedElements) {
- if (selectedElement instanceof ITask) {
- taskListElementsToSchedule.add(selectedElement);
- }
- }
-
- if (selectionIncludesCompletedTasks()) {
- Action action = new Action() {
- @Override
- public void run() {
- // ignore
- }
- };
- action.setText(Messages.ScheduleTaskMenuContributor_Cannot_schedule_completed_tasks);
- action.setEnabled(false);
- subMenuManager.add(action);
- return subMenuManager;
- }
-
- WeekDateRange week = TaskActivityUtil.getCurrentWeek();
- int days = 0;
- for (DateRange day : week.getDaysOfWeek()) {
- if (day.includes(TaskActivityUtil.getCalendar())) {
- days++;
- // Today
- Action action = createDateSelectionAction(day, CommonImages.SCHEDULE_DAY);
- subMenuManager.add(action);
- // Special case: Over scheduled tasks always 'scheduled' for today
- if (singleTaskSelection != null && isPastReminder(singleTaskSelection)) {
- action.setChecked(true);
- }
- } else if (day.after(TaskActivityUtil.getCalendar())) {
- days++;
- // Week Days
- Action action = createDateSelectionAction(day, null);
- subMenuManager.add(action);
- }
- }
-
- // Next week days
- int toAdd = 7 - days;
- WeekDateRange nextWeek = TaskActivityUtil.getNextWeek();
- for (int x = 0; x < toAdd; x++) {
- int next = TasksUiPlugin.getTaskActivityManager().getWeekStartDay() + x;
- if (next > Calendar.SATURDAY) {
- next = x;
- }
- DateRange day = nextWeek.getDayOfWeek(next);
- Action action = createDateSelectionAction(day, null);
- subMenuManager.add(action);
- }
-
- subMenuManager.add(new Separator());
-
- // This Week
- Action action = createDateSelectionAction(week, CommonImages.SCHEDULE_WEEK);
- subMenuManager.add(action);
- // Special case: This Week holds previous weeks' scheduled tasks
- if (singleTaskSelection != null && singleTaskSelection.getScheduledForDate() != null
- && singleTaskSelection.getScheduledForDate() instanceof WeekDateRange
- && singleTaskSelection.getScheduledForDate().isBefore(week)) {
- // Tasks scheduled for 'someday' float into this week
- action.setChecked(true);
- }
-
- // Next Week
- action = createDateSelectionAction(week.next(), null);
- subMenuManager.add(action);
-
- // Two Weeks
- action = createDateSelectionAction(week.next().next(), null);
- subMenuManager.add(action);
-
- if (singleTaskSelection != null && getScheduledForDate(singleTaskSelection) != null) {
- // Update Two Weeks
- DateRange range = getScheduledForDate(singleTaskSelection);
- if (range.equals(TaskActivityUtil.getNextWeek().next())
- || TaskActivityUtil.getNextWeek().next().includes(range)) {
- action.setChecked(true);
- }
-
- // Future
- if (getScheduledForDate(singleTaskSelection).after(week.next().next().getEndDate())
- && !(getScheduledForDate(singleTaskSelection) instanceof WeekDateRange)) {
- action = new Action() {
- @Override
- public void run() {
- // ignore
- }
- };
- action.setChecked(true);
- action.setText(Messages.ScheduleTaskMenuContributor_Future);
- subMenuManager.add(action);
- }
- }
-
- subMenuManager.add(new Separator());
-
- // Date Selection Dialog
- action = new Action() {
- @Override
- public void run() {
- Calendar theCalendar = TaskActivityUtil.getCalendar();
- if (getScheduledForDate(singleTaskSelection) != null) {
- theCalendar.setTime(getScheduledForDate(singleTaskSelection).getStartDate().getTime());
- }
- DateSelectionDialog reminderDialog = new DateSelectionDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(), theCalendar, DatePicker.TITLE_DIALOG, false, TasksUiPlugin.getDefault()
- .getPreferenceStore()
- .getInt(ITasksUiPreferenceConstants.PLANNING_ENDHOUR));
- int result = reminderDialog.open();
- if (result == Window.OK) {
- DateRange range = null;
- if (reminderDialog.getDate() != null) {
- range = TaskActivityUtil.getDayOf(reminderDialog.getDate());
- }
-
- setScheduledDate(range);
- }
- }
- };
- action.setText(Messages.ScheduleTaskMenuContributor_Choose_Date_);
- action.setEnabled(canSchedule());
- subMenuManager.add(action);
-
- action = new Action() {
- @Override
- public void run() {
- setScheduledDate(null);
- }
- };
- action.setText(Messages.ScheduleTaskMenuContributor_Not_Scheduled);
- action.setChecked(false);
- if (singleTaskSelection != null) {
- if (getScheduledForDate(singleTaskSelection) == null) {
- action.setChecked(true);
- }
- }
- subMenuManager.add(action);
- return subMenuManager;
- }
-
- private boolean selectionIncludesCompletedTasks() {
- if (singleTaskSelection instanceof AbstractTask) {
- if ((singleTaskSelection).isCompleted()) {
- return true;
- }
- }
-
- if (taskListElementsToSchedule.size() > 0) {
- for (IRepositoryElement task : taskListElementsToSchedule) {
- if (task instanceof AbstractTask) {
- if (((AbstractTask) task).isCompleted()) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- private Action createDateSelectionAction(final DateRange dateContainer, ImageDescriptor imageDescriptor) {
- Action action = new Action() {
- @Override
- public void run() {
- setScheduledDate(dateContainer);
- }
- };
- action.setText(dateContainer.toString());
- action.setImageDescriptor(imageDescriptor);
- action.setEnabled(canSchedule());
-
- DateRange scheduledDate = getScheduledForDate(singleTaskSelection);
- if (scheduledDate != null) {
- action.setChecked(dateContainer.equals(scheduledDate));
- }
- return action;
- }
-
- private boolean canSchedule() {
- if (taskListElementsToSchedule.size() == 0) {
- return true;
- } else if (singleTaskSelection instanceof ITask) {
- return ((!(singleTaskSelection).isCompleted()) || taskListElementsToSchedule.size() > 0);
- } else {
- return taskListElementsToSchedule.size() > 0;
- }
- }
-
- protected void setScheduledDate(DateRange dateContainer) {
- for (IRepositoryElement element : taskListElementsToSchedule) {
- if (element instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) element;
- if (dateContainer != null) {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, dateContainer);
- } else {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, null);
- }
- }
- }
- }
-
- protected DateRange getScheduledForDate(final AbstractTask selectedTask) {
- if (selectedTask != null) {
- return selectedTask.getScheduledForDate();
- }
- return null;
- }
-
- private boolean isPastReminder(AbstractTask task) {
- return TasksUiPlugin.getTaskActivityManager().isPastReminder(task);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduledPresentation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduledPresentation.java
deleted file mode 100644
index fafdfaf9e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ScheduledPresentation.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTaskListContentProvider;
-import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTaskListPresentation;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider;
-
-/**
- * @author Mik Kersten
- */
-public class ScheduledPresentation extends AbstractTaskListPresentation {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.scheduled"; //$NON-NLS-1$
-
- public ScheduledPresentation() {
- super(ID);
- }
-
- @Override
- public AbstractTaskListContentProvider createContentProvider(TaskListView taskListView) {
- return new TaskScheduleContentProvider(taskListView);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskActivityMonitor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskActivityMonitor.java
deleted file mode 100644
index d55bc654e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskActivityMonitor.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.context.core.AbstractContextListener;
-import org.eclipse.mylyn.context.core.IInteractionElement;
-import org.eclipse.mylyn.internal.context.core.InteractionContextManager;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.monitor.core.InteractionEvent;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * Monitors task activity and maintains task activation history
- *
- * @author Robert Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-@SuppressWarnings("restriction")
-public class TaskActivityMonitor {
-
- private final InteractionContextManager contextManager;
-
- private final TaskActivityManager taskActivityManager;
-
- private final TaskList taskList;
-
- private final AbstractContextListener CONTEXT_LISTENER = new AbstractContextListener() {
-
- @Override
- public void interestChanged(List<IInteractionElement> elements) {
- List<InteractionEvent> events = contextManager.getActivityMetaContext().getInteractionHistory();
- if (events.size() > 0) {
- InteractionEvent event = events.get(events.size() - 1);
- parseInteractionEvent(event, false);
- }
- }
- };
-
- private ActivityExternalizationParticipant externalizationParticipant;
-
- public TaskActivityMonitor(TaskActivityManager taskActivityManager, InteractionContextManager contextManager) {
- this.taskActivityManager = taskActivityManager;
- this.contextManager = contextManager;
- this.taskList = TasksUiPlugin.getTaskList();
- }
-
- public void start() {
- contextManager.addActivityMetaContextListener(CONTEXT_LISTENER);
- }
-
- /** public for testing */
- public boolean parseInteractionEvent(InteractionEvent event, boolean isReloading) {
- try {
- if (event.getKind().equals(InteractionEvent.Kind.COMMAND)) {
- if ((event.getDelta().equals(InteractionContextManager.ACTIVITY_DELTA_ACTIVATED))) {
- AbstractTask activatedTask = taskList.getTask(event.getStructureHandle());
- if (activatedTask != null) {
- taskActivityManager.getTaskActivationHistory().addTask(activatedTask);
- return true;
- }
- }
- } else if (event.getKind().equals(InteractionEvent.Kind.ATTENTION)) {
- if ((event.getDelta().equals("added") || event.getDelta().equals("add"))) { //$NON-NLS-1$ //$NON-NLS-2$
- if (event.getDate().getTime() > 0 && event.getEndDate().getTime() > 0) {
- if (event.getStructureKind()
- .equals(InteractionContextManager.ACTIVITY_STRUCTUREKIND_WORKINGSET)) {
- taskActivityManager.addWorkingSetElapsedTime(event.getStructureHandle(), event.getDate(),
- event.getEndDate());
- if (!isReloading) {
- externalizationParticipant.setDirty(true);
- // save not requested for working set time updates so...
- externalizationParticipant.elapsedTimeUpdated(null, 0);
- }
- } else {
- AbstractTask activatedTask = taskList.getTask(event.getStructureHandle());
- if (activatedTask != null) {
- taskActivityManager.addElapsedTime(activatedTask, event.getDate(), event.getEndDate());
- }
- }
- }
- } else if (event.getDelta().equals("removed")) { //$NON-NLS-1$
- ITask task = taskList.getTask(event.getStructureHandle());
- if (task != null) {
- taskActivityManager.removeElapsedTime(task, event.getDate(), event.getEndDate());
- }
- }
- }
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Error parsing interaction event", t)); //$NON-NLS-1$
- }
- return false;
- }
-
- public void stop() {
- contextManager.removeActivityMetaContextListener(CONTEXT_LISTENER);
- }
-
- public void reloadActivityTime() {
- taskActivityManager.clearActivity();
- List<InteractionEvent> events = contextManager.getActivityMetaContext().getInteractionHistory();
- for (InteractionEvent event : events) {
- parseInteractionEvent(event, true);
- }
- }
-
- /**
- * Returns the task corresponding to the interaction event history item at the specified position
- */
- protected ITask getHistoryTaskAt(int pos) {
- InteractionEvent event = contextManager.getActivityMetaContext().getInteractionHistory().get(pos);
- if (event.getDelta().equals(InteractionContextManager.ACTIVITY_DELTA_ACTIVATED)) {
- return TasksUiPlugin.getTaskList().getTask(event.getStructureHandle());
- } else {
- return null;
- }
- }
-
- public void setExternalizationParticipant(ActivityExternalizationParticipant participant) {
- this.externalizationParticipant = participant;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskArchiveFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskArchiveFilter.java
deleted file mode 100644
index 7660c84fa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskArchiveFilter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
-
-/**
- * @author Mik Kersten
- */
-public class TaskArchiveFilter extends AbstractTaskListFilter {
-
- @Override
- public boolean select(Object parent, Object element) {
-
- if (element instanceof UnmatchedTaskContainer) {
- if (((UnmatchedTaskContainer) element).isEmpty()) {
- return false;
- }
- }
- if (element instanceof UnsubmittedTaskContainer) {
- if (((UnsubmittedTaskContainer) element).isEmpty()) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java
deleted file mode 100644
index 7a1a91dfa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskCompletionFilter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Collection;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Mik Kersten
- * @author Shawn Minto
- */
-public class TaskCompletionFilter extends AbstractTaskListFilter {
-
- @Override
- public boolean select(Object parent, Object element) {
- if (element instanceof ITask) {
- ITask task = (ITask) element;
- boolean isComplete = task.isCompleted();
- if (!isComplete) {
- return true;
- } else if (element instanceof AbstractTask) {
- AbstractTask abstractTask = (AbstractTask) element;
- Collection<ITask> children = abstractTask.getChildren();
- for (ITask child : children) {
- if (select(abstractTask, child)) {
- return true;
- }
- }
- return false;
- }
-
- }
- return true;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskEditorBloatMonitor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskEditorBloatMonitor.java
deleted file mode 100644
index a94e963d2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskEditorBloatMonitor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.mylyn.monitor.ui.AbstractEditorTracker;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-/**
- * @author Mik Kersten
- */
-public class TaskEditorBloatMonitor extends AbstractEditorTracker {
-
- private final int MAX_EDITORS = 12;
-
- @Override
- protected void editorBroughtToTop(IEditorPart part) {
- // ignore
- }
-
- @Override
- public void editorOpened(IEditorPart editorPartOpened) {
- IWorkbenchPage page = editorPartOpened.getSite().getPage();
- List<IEditorReference> toClose = new ArrayList<IEditorReference>();
- int totalTaskEditors = 0;
- for (IEditorReference editorReference : page.getEditorReferences()) {
- try {
- if (editorReference.getEditorInput() instanceof TaskEditorInput) {
- totalTaskEditors++;
- }
- } catch (PartInitException e) {
- // ignore
- }
- }
-
- if (totalTaskEditors > MAX_EDITORS) {
- for (IEditorReference editorReference : page.getEditorReferences()) {
- try {
- if (editorReference.getEditorInput() instanceof TaskEditorInput) {
- TaskEditorInput taskEditorInput = (TaskEditorInput) editorReference.getEditorInput();
- TaskEditor taskEditor = (TaskEditor) editorReference.getEditor(false);
- if (taskEditor == null) {
- toClose.add(editorReference);
- } else if (!taskEditor.equals(editorPartOpened) && !taskEditor.isDirty()
- && taskEditorInput.getTask() != null
- && taskEditorInput.getTask().getSynchronizationState().isSynchronized()) {
- toClose.add(editorReference);
- }
- }
- if ((totalTaskEditors - toClose.size()) < MAX_EDITORS) {
- break;
- }
- } catch (PartInitException e) {
- // ignore
- }
- }
- }
-
- if (toClose.size() > 0) {
- page.closeEditors(toClose.toArray(new IEditorReference[toClose.size()]), true);
- }
- }
-
- @Override
- public void editorClosed(IEditorPart editorPart) {
- // ignore
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryDropDown.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryDropDown.java
deleted file mode 100644
index 8ef3271d3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryDropDown.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-
-/**
- * @author Wesley Coelho
- * @author Mik Kersten
- * @author Leo Dos Santos
- * @author Steffen Pingel
- */
-public class TaskHistoryDropDown extends CompoundContributionItem {
-
- private final static int MAX_ITEMS_TO_DISPLAY = 16;
-
- private class ActivateDialogAction extends Action {
-
- private final ActivateTaskDialogAction dialogAction;
-
- public ActivateDialogAction(ActivateTaskDialogAction action) {
- dialogAction = action;
- dialogAction.init(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
-
- setText(Messages.TaskHistoryDropDown_Activate_Task_);
- setToolTipText(Messages.TaskHistoryDropDown_Activate_Task_);
- setEnabled(true);
- setChecked(false);
- setImageDescriptor(null);
- //TasksUiImages.TASK_ACTIVE);
- }
-
- @Override
- public void run() {
- dialogAction.run(null);
- }
- }
-
- private class DeactivateTaskAction extends Action {
-
- public DeactivateTaskAction() {
- setText(Messages.TaskHistoryDropDown_Deactivate_Task);
- setToolTipText(Messages.TaskHistoryDropDown_Deactivate_Task);
- setEnabled(true);
- setChecked(false);
- setImageDescriptor(null);
- //TasksUiImages.TASK_INACTIVE);
- }
-
- @Override
- public void run() {
- ITask active = TasksUi.getTaskActivityManager().getActiveTask();
- if (active != null) {
- TasksUi.getTaskActivityManager().deactivateTask(active);
- }
- }
-
- }
-
- /**
- * Action for navigating to a specified task. This class should be protected but has been made public for testing
- * only
- */
- private class ActivateTaskAction extends Action {
-
- private static final int MAX_LABEL_LENGTH = 40;
-
- private final AbstractTask targetTask;
-
- public ActivateTaskAction(AbstractTask task) {
- targetTask = task;
- String taskDescription = task.getSummary();
- if (taskDescription.length() > MAX_LABEL_LENGTH) {
- taskDescription = taskDescription.subSequence(0, MAX_LABEL_LENGTH - 3) + "..."; //$NON-NLS-1$
- }
- setText(taskDescription);
- setEnabled(true);
- setToolTipText(task.getSummary());
- Image image = labelProvider.getImage(task);
- setImageDescriptor(ImageDescriptor.createFromImage(image));
- }
-
- @Override
- public void run() {
- if (targetTask.isActive()) {
- return;
- }
- new TaskActivateAction().run(targetTask);
- }
- }
-
- private final TaskElementLabelProvider labelProvider = new TaskElementLabelProvider(false);
-
- private boolean scopedToWorkingSet;
-
- private final TaskActivationHistory taskHistory;
-
- public TaskHistoryDropDown() {
- this(null);
- }
-
- public TaskHistoryDropDown(String id) {
- this(id, TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory());
- }
-
- public TaskHistoryDropDown(String id, TaskActivationHistory taskHistory) {
- super(id);
- this.taskHistory = taskHistory;
- }
-
- @Override
- protected IContributionItem[] getContributionItems() {
- List<AbstractTask> tasks = new ArrayList<AbstractTask>(taskHistory.getPreviousTasks());
- Set<IWorkingSet> sets = TaskListView.getActiveWorkingSets();
- if (scopedToWorkingSet && !sets.isEmpty()) {
- Set<ITask> allWorkingSetTasks = new HashSet<ITask>();
- for (IWorkingSet workingSet : sets) {
- IAdaptable[] elements = workingSet.getElements();
- for (IAdaptable adaptable : elements) {
- if (adaptable instanceof ITaskContainer) {
- allWorkingSetTasks.addAll(((ITaskContainer) adaptable).getChildren());
- }
- }
- }
- List<AbstractTask> allScopedTasks = new ArrayList<AbstractTask>(tasks);
- for (ITask task : tasks) {
- if (!allWorkingSetTasks.contains(task)) {
- allScopedTasks.remove(task);
- }
- }
- tasks = allScopedTasks;
- }
-
- if (tasks.size() > MAX_ITEMS_TO_DISPLAY) {
- tasks = tasks.subList(tasks.size() - MAX_ITEMS_TO_DISPLAY, tasks.size());
- }
-
- List<IContributionItem> items = new ArrayList<IContributionItem>();
- for (int i = tasks.size() - 1; i >= 0; i--) {
- AbstractTask currTask = tasks.get(i);
- Action taskNavAction = new ActivateTaskAction(currTask);
- ActionContributionItem item = new ActionContributionItem(taskNavAction);
- if (currTask.isActive()) {
- taskNavAction.setChecked(true);
- }
- items.add(item);
- }
-
- Separator separator = new Separator();
- items.add(separator);
-
- ITask active = TasksUi.getTaskActivityManager().getActiveTask();
- if (active != null) {
- Action deactivateAction = new DeactivateTaskAction();
- ActionContributionItem item = new ActionContributionItem(deactivateAction);
- items.add(item);
- } else {
- Action activateDialogAction = new ActivateDialogAction(new ActivateTaskDialogAction());
- ActionContributionItem item = new ActionContributionItem(activateDialogAction);
- items.add(item);
- }
-
- return items.toArray(new IContributionItem[items.size()]);
- }
-
- public boolean isScopedToWorkingSet() {
- return scopedToWorkingSet;
- }
-
- /**
- * If <code>scopedToWorkingSet</code> is set to true only tasks from the current working set are contributed.
- */
- public void setScopedToWorkingSet(boolean scopedToWorkingSet) {
- this.scopedToWorkingSet = scopedToWorkingSet;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryHandler.java
deleted file mode 100644
index c735b3515..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHistoryHandler.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Map;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-
-/**
- * @author Eugene Kuleshov
- * @author Steffen Pingel
- */
-public class TaskHistoryHandler extends AbstractHandler implements IElementUpdater {
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- if (TasksUi.getTaskActivityManager().getActiveTask() != null) {
- if (ContextCore.getContextManager().isContextCapturePaused()) {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
- if (window != null) {
- ICommandService commandService = (ICommandService) window.getService(ICommandService.class);
- if (commandService != null) {
- final Command command = commandService.getCommand("org.eclipse.mylyn.ui.context.capture.pause.command"); //$NON-NLS-1$
- if (command != null) {
- SafeRunner.run(new SafeRunnable() {
- public void run() throws Exception {
- command.executeWithChecks(event);
- }
- });
- }
- }
- }
- } else {
- TasksUi.getTaskActivityManager().deactivateActiveTask();
- }
- } else {
- TaskActivationHistory taskHistory = TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory();
- if (taskHistory.hasPrevious()) {
- AbstractTask previousTask = taskHistory.getPreviousTask();
- new TaskActivateAction().run(previousTask);
- } else {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
- if (window != null) {
- ActivateTaskDialogAction action = new ActivateTaskDialogAction();
- action.init(window);
- action.run(null);
- }
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public void updateElement(UIElement element, Map parameters) {
- if (TasksUi.getTaskActivityManager().getActiveTask() == null) {
- element.setIcon(TasksUiImages.CONTEXT_HISTORY_PREVIOUS);
- } else {
- if (ContextCore.getContextManager().isContextCapturePaused()) {
- element.setIcon(TasksUiImages.CONTEXT_HISTORY_PREVIOUS_PAUSE);
- } else {
- element.setIcon(TasksUiImages.CONTEXT_HISTORY_PREVIOUS_ACTIVE);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHyperlink.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHyperlink.java
deleted file mode 100644
index 67dba6323..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskHyperlink.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
-import org.eclipse.mylyn.internal.provisional.commons.ui.ScalingHyperlink;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- * @author Frank Becker
- */
-public class TaskHyperlink extends ScalingHyperlink {
-
- private ITask task;
-
- public TaskHyperlink(Composite parent, int style) {
- super(parent, style);
- setForeground(CommonColors.HYPERLINK_WIDGET);
- addMouseTrackListener(MOUSE_TRACK_LISTENER);
- }
-
- public ITask getTask() {
- return task;
- }
-
- public void setTask(ITask task) {
- this.task = task;
- if (task != null) {
- if ((getStyle() & SWT.SHORT) != 0) {
- setText(task.getTaskKey());
- setToolTipText(task.getTaskKey() + ": " + task.getSummary()); //$NON-NLS-1$
- setStrikeThrough(task.isCompleted());
- } else {
- setText(task.getSummary());
- setToolTipText(""); //$NON-NLS-1$
- setStrikeThrough(false);
- }
- } else {
- setText(""); //$NON-NLS-1$
- setToolTipText(""); //$NON-NLS-1$
- setStrikeThrough(false);
- }
- setUnderlined(false);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskJobFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskJobFactory.java
deleted file mode 100644
index 771c37b39..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskJobFactory.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITaskJobFactory;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.internal.tasks.core.sync.SubmitTaskAttachmentJob;
-import org.eclipse.mylyn.internal.tasks.core.sync.SubmitTaskJob;
-import org.eclipse.mylyn.internal.tasks.core.sync.SynchronizeQueriesJob;
-import org.eclipse.mylyn.internal.tasks.core.sync.SynchronizeRepositoriesJob;
-import org.eclipse.mylyn.internal.tasks.core.sync.SynchronizeTasksJob;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.IRepositoryModel;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
-import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
-import org.eclipse.mylyn.tasks.core.sync.TaskJob;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.ui.progress.IProgressConstants;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskJobFactory implements ITaskJobFactory {
-
- private final TaskList taskList;
-
- private final TaskDataManager taskDataManager;
-
- private final IRepositoryManager repositoryManager;
-
- private final IRepositoryModel tasksModel;
-
- public TaskJobFactory(TaskList taskList, TaskDataManager taskDataManager, IRepositoryManager repositoryManager,
- IRepositoryModel tasksModel) {
- this.taskList = taskList;
- this.taskDataManager = taskDataManager;
- this.repositoryManager = repositoryManager;
- this.tasksModel = tasksModel;
- }
-
- public SynchronizationJob createSynchronizeTasksJob(AbstractRepositoryConnector connector, Set<ITask> tasks) {
- SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
- repositoryManager, tasks);
- job.setProperty(IProgressConstants.ICON_PROPERTY, TasksUiImages.REPOSITORY_SYNCHRONIZE);
- job.setPriority(Job.LONG);
- return job;
- }
-
- public SynchronizationJob createSynchronizeTasksJob(AbstractRepositoryConnector connector,
- TaskRepository taskRepository, Set<ITask> tasks) {
- SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
- taskRepository, tasks);
- job.setProperty(IProgressConstants.ICON_PROPERTY, TasksUiImages.REPOSITORY_SYNCHRONIZE);
- job.setPriority(Job.LONG);
- return job;
- }
-
- public SynchronizationJob createSynchronizeQueriesJob(AbstractRepositoryConnector connector,
- TaskRepository repository, Set<RepositoryQuery> queries) {
- SynchronizationJob job = new SynchronizeQueriesJob(taskList, taskDataManager, tasksModel, connector,
- repository, queries);
- job.setProperty(IProgressConstants.ICON_PROPERTY, TasksUiImages.REPOSITORY_SYNCHRONIZE);
- job.setPriority(Job.DECORATE);
- return job;
- }
-
- public SynchronizationJob createSynchronizeRepositoriesJob(Set<TaskRepository> repositories) {
- SynchronizeRepositoriesJob job = new SynchronizeRepositoriesJob(taskList, taskDataManager, tasksModel,
- repositoryManager);
- job.setRepositories(repositories);
- job.setProperty(IProgressConstants.ICON_PROPERTY, TasksUiImages.REPOSITORY_SYNCHRONIZE);
- job.setPriority(Job.DECORATE);
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- // XXX: since the Task List does not properly refresh parent
- // containers, force the refresh of it's root
- taskList.notifyElementsChanged(null);
- }
- });
- return job;
- }
-
- public SubmitJob createSubmitTaskJob(AbstractRepositoryConnector connector, TaskRepository taskRepository,
- final ITask task, TaskData taskData, Set<TaskAttribute> oldAttributes) {
- SubmitJob job = new SubmitTaskJob(taskDataManager, connector, taskRepository, task, taskData, oldAttributes);
- job.setPriority(Job.INTERACTIVE);
- try {
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- ((AbstractTask) task).setSynchronizing(true);
- }
- });
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unexpected error", e)); //$NON-NLS-1$
- }
- taskList.notifySynchronizationStateChanged(task);
- return job;
- }
-
- public TaskJob createUpdateRepositoryConfigurationJob(final AbstractRepositoryConnector connector,
- final TaskRepository taskRepository) {
- TaskJob updateJob = new TaskJob(Messages.TaskJobFactory_Refreshing_repository_configuration) {
- private IStatus error;
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(Messages.TaskJobFactory_Receiving_configuration, IProgressMonitor.UNKNOWN);
- try {
- try {
- connector.updateRepositoryConfiguration(taskRepository, monitor);
- } catch (CoreException e) {
- error = e.getStatus();
- }
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public boolean belongsTo(Object family) {
- return family == taskRepository;
- }
-
- @Override
- public IStatus getStatus() {
- return error;
- }
- };
- updateJob.setPriority(Job.INTERACTIVE);
- return updateJob;
- }
-
- public SubmitJob createSubmitTaskAttachmentJob(AbstractRepositoryConnector connector,
- TaskRepository taskRepository, final ITask task, AbstractTaskAttachmentSource source, String comment,
- TaskAttribute attachmentAttribute) {
- SubmitJob job = new SubmitTaskAttachmentJob(taskDataManager, connector, taskRepository, task, source, comment,
- attachmentAttribute);
- job.setPriority(Job.INTERACTIVE);
- try {
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- ((AbstractTask) task).setSynchronizing(true);
- }
- });
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unexpected error", e)); //$NON-NLS-1$
- }
- taskList.notifySynchronizationStateChanged(task);
- job.setUser(true);
- return job;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java
deleted file mode 100644
index 424c60451..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskLabelDecorator.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ILightweightLabelDecorator;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Mik Kersten
- */
-public class TaskLabelDecorator implements ILightweightLabelDecorator {
-
- public void decorate(Object element, IDecoration decoration) {
-
- ImageDescriptor priorityOverlay = getPriorityImageDescriptor(element);
- if (priorityOverlay != null) {
- decoration.addOverlay(priorityOverlay, IDecoration.BOTTOM_LEFT);
- }
-
- if (element instanceof IRepositoryQuery) {
- IRepositoryQuery query = (IRepositoryQuery) element;
- String repositoryUrl = query.getRepositoryUrl();
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(),
- repositoryUrl);
- if (repositoryUrl != null && taskRepository != null) {
- if (taskRepository.getRepositoryUrl().equals(taskRepository.getRepositoryLabel())) {
- try {
- URL url = new URL(repositoryUrl);
- decoration.addSuffix(" [" + url.getHost() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (MalformedURLException e) {
- decoration.addSuffix(Messages.TaskLabelDecorator____unknown_host___);
- }
- } else {
- decoration.addSuffix(" [" + taskRepository.getRepositoryLabel() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- } else if (element instanceof ITask) {
- ITask task = (ITask) element;
- if (!task.isCompleted()
- && (TasksUiPlugin.getTaskActivityManager().isDueToday(task) || TasksUiPlugin.getTaskActivityManager()
- .isOverdue(task))) {
- decoration.addOverlay(CommonImages.OVERLAY_DATE_OVERDUE, IDecoration.TOP_RIGHT);
- } else if (!task.isCompleted() && task.getDueDate() != null) {
- decoration.addOverlay(CommonImages.OVERLAY_DATE_DUE, IDecoration.TOP_RIGHT);
- }
- } else if (element instanceof TaskRepository) {
- ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(
- ((TaskRepository) element).getConnectorKind());
- if (overlay != null) {
- decoration.addOverlay(overlay, IDecoration.BOTTOM_RIGHT);
- }
- }
- }
-
- public void addListener(ILabelProviderListener listener) {
- // ignore
- }
-
- public void dispose() {
- // ignore
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // ignore
- }
-
- private ImageDescriptor getPriorityImageDescriptor(Object element) {
- AbstractRepositoryConnectorUi connectorUi;
- if (element instanceof ITask) {
- ITask repositoryTask = (ITask) element;
- connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind());
- if (connectorUi != null) {
- return connectorUi.getTaskPriorityOverlay(repositoryTask);
- }
- }
- if (element instanceof ITask) {
- return TasksUiInternal.getPriorityImage((ITask) element);
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListBackupManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListBackupManager.java
deleted file mode 100644
index add98c4b1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListBackupManager.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskDataExportOperation;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskDataSnapshotOperation;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Rob Elves
- */
-public class TaskListBackupManager implements IPropertyChangeListener {
-
- private static final String OLD_MYLYN_2_BACKUP_FILE_PREFIX = "mylyndata-"; //$NON-NLS-1$
-
- // Mylyn 3.0 Backup file name
- private static final String BACKUP_FILE_PREFIX = "mylyn-v3-data-"; //$NON-NLS-1$
-
- private static final Pattern MYLYN_BACKUP_REGEXP = Pattern.compile("^(" + BACKUP_FILE_PREFIX + ")?(" //$NON-NLS-1$ //$NON-NLS-2$
- + OLD_MYLYN_2_BACKUP_FILE_PREFIX + ")?"); //$NON-NLS-1$
-
- private static final Pattern DATE_FORMAT_OLD = Pattern.compile("\\d{4}-\\d{2}-\\d{2}"); //$NON-NLS-1$
-
- private static final Pattern DATE_FORMAT = Pattern.compile("\\d{4}-\\d{2}-\\d{2}-\\d{6}"); //$NON-NLS-1$
-
- private static final long SECOND = 1000;
-
- private static final long MINUTE = 60 * SECOND;
-
- private static final long STANDARD_DELAY = 30 * MINUTE;
-
- private String backupFolderPath;
-
- private Job runBackup;
-
- private static boolean errorDisplayed = false;
-
- public TaskListBackupManager(String backupFolderPath) {
- this.backupFolderPath = backupFolderPath;
- start(STANDARD_DELAY);
- }
-
- public void start(long delay) {
-
- if (runBackup != null) {
- stop();
- }
-
- runBackup = new Job("Task Data Snapshot") { //$NON-NLS-1$
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if (TasksUiPlugin.getTaskList().getAllTasks().size() > 0) {
- backupNow(false, monitor);
- }
- return Status.OK_STATUS;
- } finally {
- schedule(STANDARD_DELAY);
- }
- }
- };
- runBackup.setPriority(Job.BUILD);
- runBackup.setSystem(true);
- runBackup.schedule(delay);
- }
-
- public void stop() {
- if (runBackup != null) {
- if (!runBackup.cancel()) {
- try {
- runBackup.join();
- } catch (InterruptedException e) {
- // ignore
- }
- }
- runBackup = null;
- }
- }
-
- public static String getBackupFileName() {
- SimpleDateFormat format = new SimpleDateFormat(ITasksCoreConstants.FILENAME_TIMESTAMP_FORMAT, Locale.ENGLISH);
- String date = format.format(new Date());
- String backupFileName = BACKUP_FILE_PREFIX + date + ".zip"; //$NON-NLS-1$
- return backupFileName;
- }
-
- public void backupNow(boolean synchronous) {
- backupNow(synchronous, null);
- }
-
- public synchronized void backupNow(boolean synchronous, IProgressMonitor monitor) {
-
- monitor = Policy.monitorFor(monitor);
-
- File backupFolder = new File(backupFolderPath);
- if (!backupFolder.exists()) {
- backupFolder.mkdir();
- }
-
- final TaskDataExportOperation backupJob = new TaskDataSnapshotOperation(backupFolderPath, getBackupFileName());
- try {
- if (!synchronous) {
- backupJob.run(monitor);
- removeOldBackups();
- } else {
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- service.run(false, true, backupJob);
- }
- } catch (InvocationTargetException e) {
- if (!errorDisplayed) {
- final Status status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.TaskListBackupManager_Error_occured_during_scheduled_tasklist_backup, e);
- errorDisplayed = true;
- if (Display.getCurrent() != null) {
- TasksUiInternal.logAndDisplayStatus(Messages.TaskListBackupManager_Scheduled_task_data_backup,
- status);
- } else {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.logAndDisplayStatus(
- Messages.TaskListBackupManager_Scheduled_task_data_backup, status);
-
- }
- });
- }
- }
- } catch (InterruptedException e) {
- return;
- }
- }
-
- public SortedMap<Long, File> getBackupFiles() {
-
- SortedMap<Long, File> filesMap = new TreeMap<Long, File>();
- String destination = backupFolderPath;
-
- File backupFolder = new File(destination);
- if (!backupFolder.exists()) {
- return filesMap;
- }
-
- File[] files = backupFolder.listFiles();
- if (files == null) {
- return filesMap;
- }
-
- for (File file : files) {
- Matcher matcher = MYLYN_BACKUP_REGEXP.matcher(file.getName());
- if (matcher.find()) {
- Date date = null;
- try {
- SimpleDateFormat format = null;
- String dateText = null;
- Matcher dateFormatMatcher = DATE_FORMAT.matcher(file.getName());
- if (dateFormatMatcher.find()) {
- format = new SimpleDateFormat(ITasksCoreConstants.FILENAME_TIMESTAMP_FORMAT, Locale.ENGLISH);
- dateText = dateFormatMatcher.group();
- } else {
- dateFormatMatcher = DATE_FORMAT_OLD.matcher(file.getName());
- if (dateFormatMatcher.find()) {
- format = new SimpleDateFormat(ITasksCoreConstants.OLD_FILENAME_TIMESTAMP_FORMAT,
- Locale.ENGLISH);
- dateText = dateFormatMatcher.group();
- }
- }
- if (format != null && dateText != null && dateText.length() > 0) {
- date = format.parse(dateText);
- } else {
- continue;
- }
- } catch (IndexOutOfBoundsException e) {
- continue;
- } catch (ParseException e) {
- continue;
- }
- if (date != null && date.getTime() > 0) {
- filesMap.put(new Long(date.getTime()), file);
- }
- }
- }
-
- return filesMap;
- }
-
- /** public for testing purposes */
- public synchronized void removeOldBackups() {
-
- SortedMap<Long, File> filesMap = getBackupFiles();
-
- if (filesMap.size() > 0) {
-
- Calendar rangeStart = TaskActivityUtil.getCalendar();
- rangeStart.setTimeInMillis(filesMap.lastKey());
- TaskActivityUtil.snapStartOfHour(rangeStart);
- int startHour = rangeStart.get(Calendar.HOUR_OF_DAY);
- Calendar rangeEnd = TaskActivityUtil.getCalendar();
- rangeEnd.setTimeInMillis(rangeStart.getTimeInMillis());
- rangeEnd.add(Calendar.HOUR_OF_DAY, 1);
- // Keep one backup for last 8 hours of today
- for (int x = 0; x <= startHour && x < 9; x++) {
- SortedMap<Long, File> subMap = filesMap.subMap(rangeStart.getTimeInMillis(), rangeEnd.getTimeInMillis());
- if (subMap.size() > 1) {
- while (subMap.size() > 1) {
- File toDelete = subMap.remove(subMap.firstKey());
- toDelete.delete();
- }
- }
- rangeStart.add(Calendar.HOUR_OF_DAY, -1);
- rangeEnd.add(Calendar.HOUR_OF_DAY, -1);
- }
-
- // Keep one backup a day for the past 12 days
- TaskActivityUtil.snapStartOfDay(rangeEnd);
- rangeStart.add(Calendar.DAY_OF_YEAR, -1);
- for (int x = 1; x <= 12; x++) {
- SortedMap<Long, File> subMap = filesMap.subMap(rangeStart.getTimeInMillis(), rangeEnd.getTimeInMillis());
- if (subMap.size() > 1) {
- while (subMap.size() > 1) {
- File toDelete = subMap.remove(subMap.firstKey());
- toDelete.delete();
- }
- }
- rangeStart.add(Calendar.DAY_OF_YEAR, -1);
- rangeEnd.add(Calendar.DAY_OF_YEAR, -1);
- }
-
- // Remove all older backups
- SortedMap<Long, File> subMap = filesMap.subMap(0l, rangeStart.getTimeInMillis());
- if (subMap.size() > 0) {
- while (subMap.size() > 0) {
- File toDelete = subMap.remove(subMap.firstKey());
- toDelete.delete();
- }
- }
- }
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ITasksUiPreferenceConstants.PREF_DATA_DIR)) {
- backupFolderPath = TasksUiPlugin.getDefault().getBackupFolderPath();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListModifyOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListModifyOperation.java
deleted file mode 100644
index 95359f02f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListModifyOperation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-
-/**
- * Use to perform atomic operations on the task list i.e. open/restore
- *
- * @author Rob Elves
- * @since 3.0
- */
-public abstract class TaskListModifyOperation implements IRunnableWithProgress {
-
- ISchedulingRule rule;
-
- public TaskListModifyOperation() {
- this(null);
- }
-
- public TaskListModifyOperation(ISchedulingRule rule) {
- this.rule = rule;
- }
-
- protected abstract void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException,
- InterruptedException;
-
- final public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final InvocationTargetException[] ite = new InvocationTargetException[1];
- try {
- ITaskListRunnable runnable = new ITaskListRunnable() {
-
- public void execute(IProgressMonitor monitor) throws CoreException {
- try {
- Job.getJobManager().beginRule(rule, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
- operations(monitor);
- } catch (InvocationTargetException e) {
- ite[0] = e;
- } catch (InterruptedException e) {
- throw new OperationCanceledException(e.getMessage());
- } finally {
- Job.getJobManager().endRule(rule);
- }
- }
- };
- getTaskList().run(runnable, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
-
- if (ite[0] != null) {
- throw ite[0];
- }
- }
-
- protected TaskList getTaskList() {
- return TasksUiPlugin.getTaskList();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationManager.java
deleted file mode 100644
index 7a5440be8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationManager.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.WeakHashMap;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotificationPopup;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Rob Elves
- */
-public class TaskListNotificationManager implements IPropertyChangeListener {
-
- private static final long DELAY_OPEN = 5 * 1000;
-
- private static final boolean runSystem = true;
-
- private TaskListNotificationPopup popup;
-
- private final Set<AbstractNotification> notifications = new HashSet<AbstractNotification>();
-
- private final Set<AbstractNotification> currentlyNotifying = Collections.synchronizedSet(notifications);
-
- private final List<ITaskListNotificationProvider> notificationProviders = new ArrayList<ITaskListNotificationProvider>();
-
- private final WeakHashMap<Object, Object> cancelledTokens = new WeakHashMap<Object, Object>();
-
- private final Job openJob = new Job(Messages.TaskListNotificationManager_Open_Notification_Job) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
-
- if (Platform.isRunning() && PlatformUI.getWorkbench() != null
- && PlatformUI.getWorkbench().getDisplay() != null
- && !PlatformUI.getWorkbench().getDisplay().isDisposed()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- collectNotifications();
-
- if (popup != null && popup.getReturnCode() == Window.CANCEL) {
- List<AbstractNotification> notifications = popup.getNotifications();
- for (AbstractNotification notification : notifications) {
- if (notification.getToken() != null) {
- cancelledTokens.put(notification.getToken(), null);
- }
- }
- }
-
- for (Iterator<AbstractNotification> it = currentlyNotifying.iterator(); it.hasNext();) {
- AbstractNotification notification = it.next();
- if (notification.getToken() != null
- && cancelledTokens.containsKey(notification.getToken())) {
- it.remove();
- }
- }
-
- synchronized (TaskListNotificationManager.class) {
- if (currentlyNotifying.size() > 0) {
-// popup.close();
- showPopup();
- }
- }
- }
- });
- }
- } finally {
- if (popup != null) {
- schedule(popup.getDelayClose() / 2);
- } else {
- schedule(DELAY_OPEN);
- }
- }
-
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
-
- return Status.OK_STATUS;
- }
-
- };
-
- public TaskListNotificationManager() {
- }
-
- public void showPopup() {
- if (popup != null) {
- popup.close();
- }
-
- Shell shell = new Shell(PlatformUI.getWorkbench().getDisplay());
- popup = new TaskListNotificationPopup(shell);
- popup.setFadingEnabled(TasksUiInternal.isAnimationsEnabled());
- List<AbstractNotification> toDisplay = new ArrayList<AbstractNotification>(currentlyNotifying);
- Collections.sort(toDisplay);
- popup.setContents(toDisplay);
- cleanNotified();
- popup.setBlockOnOpen(false);
- popup.open();
- }
-
- private void cleanNotified() {
- currentlyNotifying.clear();
- }
-
- /** public for testing */
- public void collectNotifications() {
- for (ITaskListNotificationProvider provider : notificationProviders) {
- currentlyNotifying.addAll(provider.getNotifications());
- }
- }
-
- public void startNotification(long initialStartupTime) {
- if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED)) {
- if (!openJob.cancel()) {
- try {
- openJob.join();
- } catch (InterruptedException e) {
- // ignore
- }
- }
- openJob.setSystem(runSystem);
- openJob.schedule(initialStartupTime);
- }
- }
-
- public void stopNotification() {
- openJob.cancel();
-// closeJob.cancel();
-// if (popup != null) {
-// popup.close();
-// }
- }
-
- public void addNotificationProvider(ITaskListNotificationProvider notification_provider) {
- notificationProviders.add(notification_provider);
- }
-
- public void removeNotificationProvider(ITaskListNotificationProvider notification_provider) {
- notificationProviders.remove(notification_provider);
- }
-
- /**
- * public for testing purposes
- */
- public Set<AbstractNotification> getNotifications() {
- synchronized (TaskListNotificationManager.class) {
- return currentlyNotifying;
- }
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED)) {
- Object newValue = event.getNewValue();
- if (!(newValue instanceof Boolean)) {
- // default if no preference value
- startNotification(0);
- } else if ((Boolean) newValue == true) {
- startNotification(0);
- } else {
- stopNotification();
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java
deleted file mode 100644
index 197ccdc4f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListSynchronizationScheduler.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Collections;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.mylyn.internal.tasks.core.ITaskJobFactory;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskListSynchronizationScheduler {
-
- private long interval;
-
- private final ITaskJobFactory jobFactory;
-
- private SynchronizationJob refreshJob;
-
- public TaskListSynchronizationScheduler(ITaskJobFactory jobFactory) {
- this.jobFactory = jobFactory;
- }
-
- private SynchronizationJob createRefreshJob() {
- SynchronizationJob job = jobFactory.createSynchronizeRepositoriesJob(null);
- job.setUser(false);
- job.setFullSynchronization(true);
- return job;
- }
-
- public synchronized SynchronizationJob getRefreshJob() {
- return refreshJob;
- }
-
- private synchronized void reschedule() {
- if (this.interval != 0) {
- refreshJob.schedule(interval);
- }
- }
-
- public synchronized void setInterval(long interval) {
- setInterval(interval, interval);
- }
-
- public synchronized void setInterval(long delay, long interval) {
- if (this.interval != interval) {
- this.interval = interval;
- if (refreshJob != null) {
- refreshJob.cancel();
- refreshJob = null;
- }
-
- if (interval > 0) {
- refreshJob = createRefreshJob();
- refreshJob.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- reschedule();
- }
-
- });
- refreshJob.schedule(delay);
- }
- }
- }
-
- public SynchronizationJob synchronize(TaskRepository repository) {
- // TODO check if a synchronization for repository is already running
- SynchronizationJob job = jobFactory.createSynchronizeRepositoriesJob(Collections.singleton(repository));
- job.setUser(false);
- job.setFullSynchronization(false);
- job.schedule();
- return job;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java
deleted file mode 100644
index a9ecca2b5..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskPriorityFilter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Ken Sueda - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-
-/**
- * @author Mik Kersten
- * @author Ken Sueda
- */
-public class TaskPriorityFilter extends AbstractTaskListFilter {
-
- private static final String PRIORITY_PREFIX = "P"; //$NON-NLS-1$
-
- private String priorityLevel = PriorityLevel.P5.toString();
-
- public TaskPriorityFilter() {
- displayPrioritiesAbove(TaskListView.getCurrentPriorityLevel());
- }
-
- public void displayPrioritiesAbove(String level) {
- priorityLevel = level;
- }
-
- @Override
- public boolean select(Object parent, Object element) {
- if (element instanceof IRepositoryElement) {
- String priority = ((AbstractTaskContainer) element).getPriority();
- if (priority == null || !(priority.startsWith(PRIORITY_PREFIX))) {
- return true;
- }
- if (priorityLevel.compareTo(((AbstractTaskContainer) element).getPriority()) >= 0) {
- return true;
- }
- return false;
- }
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryAdapterFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryAdapterFactory.java
deleted file mode 100644
index c68014f36..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryAdapterFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.IActionFilter;
-
-/**
- * Adapter factory for adapting TaskRepository to org.eclipse.ui.IActionFilter
- *
- * @author Eugene Kuleshov
- */
-public class TaskRepositoryAdapterFactory implements IAdapterFactory {
-
- @SuppressWarnings("unchecked")
- private static final Class[] ADAPTER_TYPES = new Class[] { IActionFilter.class };
-
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList() {
- return ADAPTER_TYPES;
- }
-
- public Object getAdapter(final Object adaptable, @SuppressWarnings("unchecked") Class adapterType) {
- if (adaptable instanceof TaskRepository) {
- return new IActionFilter() {
- public boolean testAttribute(Object target, String name, String value) {
- TaskRepository repository = (TaskRepository) target;
- if ("offline".equals(name)) { //$NON-NLS-1$
- return Boolean.valueOf(value).booleanValue() == repository.isOffline();
- } else if ("supportQuery".equals(name)) { //$NON-NLS-1$
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
- .getRepositoryConnector(repository.getConnectorKind());
- return null != connectorUi.getQueryWizard(repository, null) && connector.canQuery(repository);
- } else if ("supportNewTask".equals(name)) { //$NON-NLS-1$
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- return connector.canCreateNewTask(repository);
- } else if ("hasRepository".equals(name)) { //$NON-NLS-1$
- return !repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND);
- }
- return false;
- }
- };
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryComparator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryComparator.java
deleted file mode 100644
index 9e7b04b29..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryComparator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Comparator;
-
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Mik Kersten
- */
-public class TaskRepositoryComparator implements Comparator<TaskRepository> {
- public int compare(TaskRepository t1, TaskRepository t2) {
- if (t1.getRepositoryLabel() != null && t2.getRepositoryLabel() != null) {
- return t1.getRepositoryLabel().compareTo(t2.getRepositoryLabel());
- } else if (t1.getRepositoryLabel() == null && t2.getRepositoryLabel() == null) {
- return t1.getRepositoryUrl().compareTo(t2.getRepositoryUrl());
- } else if (t1.getRepositoryLabel() == null) {
- return -1;
- } else if (t2.getRepositoryLabel() == null) {
- return 1;
- }
- return 1;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java
deleted file mode 100644
index 39f7ced8b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.commons.core.CoreUtil;
-import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
-import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.commons.net.UnsupportedRequestException;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
-import org.eclipse.mylyn.internal.tasks.ui.dialogs.TaskRepositoryCredentialsDialog;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskRepositoryLocationUi extends TaskRepositoryLocation {
-
- private static Object lock = new Object();
-
- public TaskRepositoryLocationUi(TaskRepository taskRepository) {
- super(taskRepository);
- }
-
- @Override
- public void requestCredentials(AuthenticationType authType, String message, IProgressMonitor monitor)
- throws UnsupportedRequestException {
- if (CoreUtil.TEST_MODE) {
- throw new UnsupportedRequestException();
- }
-
- AuthenticationCredentials oldCredentials = taskRepository.getCredentials(authType);
- // synchronize on a static lock to ensure that only one password dialog is displayed at a time
- synchronized (lock) {
- // check if the credentials changed while the thread was waiting for the lock
- if (!areEqual(oldCredentials, taskRepository.getCredentials(authType))) {
- return;
- }
-
- if (Policy.isBackgroundMonitor(monitor)) {
- throw new UnsupportedRequestException();
- }
-
- PasswordRunner runner = new PasswordRunner(authType, message);
- if (!PlatformUI.getWorkbench().getDisplay().isDisposed()) {
- PlatformUI.getWorkbench().getDisplay().syncExec(runner);
- if (runner.isCanceled()) {
- throw new OperationCanceledException();
- }
- if (!runner.isChanged()) {
- throw new UnsupportedRequestException();
- }
- } else {
- throw new UnsupportedRequestException();
- }
- }
- }
-
- private boolean areEqual(AuthenticationCredentials oldCredentials, AuthenticationCredentials credentials) {
- if (oldCredentials == null) {
- return (credentials == null);
- } else {
- return oldCredentials.equals(credentials);
- }
- }
-
- private class PasswordRunner implements Runnable {
-
- private final AuthenticationType authType;
-
- private boolean changed;
-
- private final String message;
-
- private boolean canceled;
-
- public PasswordRunner(AuthenticationType credentialType, String message) {
- this.authType = credentialType;
- this.message = message;
- }
-
- public boolean isChanged() {
- return changed;
- }
-
- public boolean isCanceled() {
- return canceled;
- }
-
- public void run() {
- //Shell shell = Display.getCurrent().getActiveShell();
- Shell shell = TasksUiInternal.getShell();
- if (shell != null && !shell.isDisposed()) {
- TaskRepositoryCredentialsDialog dialog = TaskRepositoryCredentialsDialog.createDialog(shell);
- initializeDialog(dialog);
- int resultCode = dialog.open();
- if (resultCode == Window.OK) {
- apply(dialog);
- changed = true;
- } else if (resultCode == TaskRepositoryCredentialsDialog.TASK_REPOSITORY_CHANGED) {
- changed = true;
- } else {
- canceled = true;
- }
- }
- }
-
- private void initializeDialog(TaskRepositoryCredentialsDialog dialog) {
- dialog.setTaskRepository(taskRepository);
-
- AuthenticationCredentials credentials = taskRepository.getCredentials(authType);
- if (credentials != null) {
- dialog.setUsername(credentials.getUserName());
- dialog.setPassword(credentials.getPassword());
- }
-
- // caller provided message takes precedence
- if (message != null) {
- dialog.setMessage(message);
- } else {
- dialog.setMessage(getDefaultMessage());
- }
- }
-
- private String getDefaultMessage() {
- if (AuthenticationType.REPOSITORY.equals(authType)) {
- return Messages.TaskRepositoryLocationUi_Enter_repository_password;
- } else if (AuthenticationType.HTTP.equals(authType)) {
- return Messages.TaskRepositoryLocationUi_Enter_HTTP_password;
- } else if (AuthenticationType.PROXY.equals(authType)) {
- return Messages.TaskRepositoryLocationUi_Enter_proxy_password;
- }
- return null;
- }
-
- private void apply(TaskRepositoryCredentialsDialog dialog) {
- AuthenticationCredentials credentials = new AuthenticationCredentials(dialog.getUserName(),
- dialog.getPassword());
- taskRepository.setCredentials(authType, credentials, dialog.getSavePassword());
- TasksUiPlugin.getRepositoryManager().notifyRepositorySettingsChanged(taskRepository);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryUtil.java
deleted file mode 100644
index 37fe79554..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryUtil.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Rob Elves
- */
-public class TaskRepositoryUtil {
-
- /**
- * Is auto add of template repository disabled for repositoryUrl
- *
- * @since 2.1
- */
- public static boolean isAddAutomaticallyDisabled(String repositoryUrl) {
- String deletedTemplates = TasksUiPlugin.getDefault().getPreferenceStore().getString(
- ITasksUiPreferenceConstants.TEMPLATES_DELETED);
- String[] templateUrls = deletedTemplates.split("\\" + ITasksUiPreferenceConstants.TEMPLATES_DELETED_DELIM); //$NON-NLS-1$
- for (String deletedUrl : templateUrls) {
- if (deletedUrl.equalsIgnoreCase(repositoryUrl)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Disable template repository from being automatically added
- *
- * @since 2.1
- */
- public static void disableAddAutomatically(String repositoryUrl) {
- if (!isAddAutomaticallyDisabled(repositoryUrl) && isAddAutomatically(repositoryUrl)) {
- String deletedTemplates = TasksUiPlugin.getDefault().getPreferenceStore().getString(
- ITasksUiPreferenceConstants.TEMPLATES_DELETED);
- deletedTemplates += ITasksUiPreferenceConstants.TEMPLATES_DELETED_DELIM + repositoryUrl;
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.TEMPLATES_DELETED,
- deletedTemplates);
- TasksUiPlugin.getDefault().savePluginPreferences();
- }
- }
-
- /**
- * Template exists and is auto add enabled
- */
- private static boolean isAddAutomatically(String repositoryUrl) {
- for (AbstractRepositoryConnector connector : TasksUi.getRepositoryManager().getRepositoryConnectors()) {
- for (RepositoryTemplate template : TasksUiPlugin.getRepositoryTemplateManager().getTemplates(
- connector.getConnectorKind())) {
- if (template.repositoryUrl != null && template.repositoryUrl.equalsIgnoreCase(repositoryUrl)
- && template.addAutomatically) {
- return true;
- }
- }
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java
deleted file mode 100644
index 933c18f49..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java
+++ /dev/null
@@ -1,624 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.internal.tasks.ui.search.SearchHitCollector;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPage;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPageContainer;
-import org.eclipse.search.internal.ui.SearchPlugin;
-import org.eclipse.search.ui.ISearchPage;
-import org.eclipse.search.ui.ISearchPageContainer;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResultViewPart;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class TaskSearchPage extends DialogPage implements ISearchPage {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.search.page"; //$NON-NLS-1$
-
- private static final String PAGE_KEY = "page"; //$NON-NLS-1$
-
- private static final String PAGE_NAME = "TaskSearchPage"; //$NON-NLS-1$
-
- private static final String STORE_REPO_ID = PAGE_NAME + ".REPO"; //$NON-NLS-1$
-
- private Combo repositoryCombo;
-
- private Text keyText;
-
- private TaskRepository repository;
-
- private Composite fParentComposite;
-
- private IDialogSettings fDialogSettings;
-
- private int currentPageIndex = -1;
-
- private boolean firstView = true;
-
- private Control[] queryPages;
-
- private ISearchPageContainer pageContainer;
-
- private ITaskSearchPageContainer taskSearchPageContainer;
-
- public boolean performAction() {
- saveDialogSettings();
- String key = keyText.getText();
- if (key != null && key.trim().length() > 0) {
- key = key.trim();
- boolean openSuccessful = TasksUiUtil.openTask(repository, key);
- if (!openSuccessful) {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.TaskSearchPage_Task_Search, Messages.TaskSearchPage_No_task_found_matching_key_ + key);
- }
- return openSuccessful;
- } else {
- ITaskSearchPage page = (ITaskSearchPage) queryPages[currentPageIndex].getData(PAGE_KEY);
- return page.performSearch();
- }
- }
-
- public void setContainer(ISearchPageContainer container) {
- this.pageContainer = container;
- this.taskSearchPageContainer = new ITaskSearchPageContainer() {
- public IRunnableContext getRunnableContext() {
- return pageContainer.getRunnableContext();
- }
-
- public void setPerformActionEnabled(boolean enabled) {
- pageContainer.setPerformActionEnabled(enabled);
- }
- };
- }
-
- public void createControl(Composite parent) {
- fParentComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(1, false);
- // layout.marginHeight = 0;
- // layout.marginWidth = 0;
- fParentComposite.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_BOTH);
- fParentComposite.setLayoutData(gd);
-
- createRepositoryGroup(fParentComposite);
- createSeparator(fParentComposite);
- this.setControl(fParentComposite);
-
- Dialog.applyDialogFont(fParentComposite);
- }
-
- private void createSeparator(Composite parent) {
- Label separator = new Label(parent, SWT.NONE);
- separator.setVisible(false);
- GridData data = new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1);
- data.heightHint = convertHeightInCharsToPixels(1) / 3;
- separator.setLayoutData(data);
- }
-
- private void createRepositoryGroup(Composite control) {
- Composite group = new Composite(control, SWT.NONE);
- GridLayout layout = new GridLayout(6, false);
- group.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayoutData(gd);
-
- Label label = new Label(group, SWT.NONE);
- label.setText(Messages.TaskSearchPage_Select_Repository_);
-
- repositoryCombo = new Combo(group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- repositoryCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- displayQueryPage(repositoryCombo.getSelectionIndex());
- }
- });
- label = new Label(group, SWT.NONE);
- label.setText(" "); //$NON-NLS-1$
-
- Label labelKey = new Label(group, SWT.NONE);
- labelKey.setText(Messages.TaskSearchPage_Task_Key_ID);
- keyText = new Text(group, SWT.BORDER);
- keyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- String findText = null;
- TaskListView taskListView = TaskListView.getFromActivePerspective();
- if (taskListView != null) {
- findText = taskListView.getFilteredTree().getFilterControl().getText();
- if (findText != null && findText.trim().length() > 0 && isTaskKeyCandidate(findText.trim())) {
- pageContainer.setPerformActionEnabled(true);
- keyText.setText(findText.trim());
- keyText.setFocus();
- }
- }
-
- keyText.addKeyListener(new KeyListener() {
-
- public void keyPressed(KeyEvent e) {
- // ignore
- }
-
- public void keyReleased(KeyEvent e) {
- updatePageEnablement();
- }
- });
-
- ImageHyperlink clearKey = new ImageHyperlink(group, SWT.NONE);
- clearKey.setImage(CommonImages.getImage(CommonImages.REMOVE));
- clearKey.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent e) {
- keyText.setText(""); //$NON-NLS-1$
- updatePageEnablement();
- }
- });
- }
-
- private void updatePageEnablement() {
- if (keyText.getText() != null && keyText.getText().trim().length() > 0) {
- //setControlsEnabled(queryPages[currentPageIndex], false);
- if (queryPages != null && queryPages[currentPageIndex] != null
- && queryPages[currentPageIndex].getData(PAGE_KEY) instanceof AbstractRepositoryQueryPage) {
- ((AbstractRepositoryQueryPage) queryPages[currentPageIndex].getData(PAGE_KEY)).setControlsEnabled(false);
- }
- if (repositoryCombo.getSelectionIndex() > -1) {
- pageContainer.setPerformActionEnabled(true);
- }
- } else {
- //setControlsEnabled(queryPages[currentPageIndex], true);
- if (queryPages != null && queryPages[currentPageIndex] != null
- && queryPages[currentPageIndex].getData(PAGE_KEY) instanceof AbstractRepositoryQueryPage) {
- ((AbstractRepositoryQueryPage) queryPages[currentPageIndex].getData(PAGE_KEY)).setControlsEnabled(true);
- }
- //setControlsEnabled(queryPages[currentPageIndex], true);
- //pageContainer.setPerformActionEnabled(false);
- }
- }
-
- private Control createPage(TaskRepository repository, ITaskSearchPage searchPage) {
- // Page wrapper
- final Composite pageWrapper = new Composite(fParentComposite, SWT.NONE);
- pageWrapper.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- pageWrapper.setLayout(layout);
-
- searchPage.setContainer(taskSearchPageContainer);
- try {
- searchPage.createControl(pageWrapper);
- } catch (Exception e) {
- pageWrapper.dispose();
- searchPage.dispose();
-
- searchPage = new DeadSearchPage(repository);
- searchPage.setContainer(taskSearchPageContainer);
- searchPage.createControl(fParentComposite);
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Error occurred while constructing search page for " + repository.getRepositoryUrl() + " [" //$NON-NLS-1$ //$NON-NLS-2$
- + repository.getConnectorKind() + "]", e)); //$NON-NLS-1$
- searchPage.getControl().setData(PAGE_KEY, searchPage);
- return searchPage.getControl();
- }
-
- // XXX: work around for initial search page size issue bug#198493
- IDialogSettings searchDialogSettings = SearchPlugin.getDefault().getDialogSettingsSection(
- "DialogBounds_SearchDialog"); //$NON-NLS-1$
- if (searchDialogSettings.get("DIALOG_WIDTH") == null) { //$NON-NLS-1$
- fParentComposite.getParent().getShell().pack();
- }
- pageWrapper.setData(PAGE_KEY, searchPage);
- return pageWrapper;
- }
-
- private void displayQueryPage(int pageIndex) {
- if (currentPageIndex == pageIndex || pageIndex < 0) {
- return;
- }
-
- // TODO: if repository == null display invalid page?
- if (currentPageIndex != -1 && queryPages[currentPageIndex] != null) {
- queryPages[currentPageIndex].setVisible(false);
- ITaskSearchPage page = (ITaskSearchPage) queryPages[currentPageIndex].getData(PAGE_KEY);
- page.setVisible(false);
- GridData data = (GridData) queryPages[currentPageIndex].getLayoutData();
- data.exclude = true;
- queryPages[currentPageIndex].setLayoutData(data);
- }
-
- String repositoryLabel = repositoryCombo.getItem(pageIndex);
- repository = (TaskRepository) repositoryCombo.getData(repositoryLabel);
-
- if (queryPages[pageIndex] == null) {
- if (repository != null) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
- if (connectorUi != null) {
- ITaskSearchPage searchPage = getSearchPage(connectorUi);
- if (searchPage != null) {
- queryPages[pageIndex] = createPage(repository, searchPage);
- } else {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- if (connector.canCreateTaskFromKey(repository)) {
- queryPages[pageIndex] = createPage(repository, new NoSearchPage(repository));
- }
- }
- }
-
- }
- }
-
- // update enablement of the task id field
- if (repository != null) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- if (connector.canCreateTaskFromKey(repository)) {
- keyText.setEnabled(true);
- } else {
- keyText.setEnabled(false);
- }
- }
-
- if (queryPages[pageIndex] != null) {
- GridData data = (GridData) queryPages[pageIndex].getLayoutData();
- if (data == null) {
- data = new GridData();
- }
- data.exclude = false;
- queryPages[pageIndex].setLayoutData(data);
- queryPages[pageIndex].setVisible(true);
- ITaskSearchPage page = (ITaskSearchPage) queryPages[pageIndex].getData(PAGE_KEY);
- page.setVisible(true);
- }
-
- currentPageIndex = pageIndex;
- fParentComposite.getParent().layout(true, true);
- updatePageEnablement();
-
- }
-
- private ITaskSearchPage getSearchPage(AbstractRepositoryConnectorUi connectorUi) {
- if (connectorUi.hasSearchPage()) {
- return connectorUi.getSearchPage(repository, null);
- }
- return null;
- }
-
- @Override
- public void setVisible(boolean visible) {
- if (firstView) {
- getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-
- List<TaskRepository> repositories = TasksUi.getRepositoryManager().getAllRepositories();
- List<TaskRepository> searchableRepositories = new ArrayList<TaskRepository>();
- for (TaskRepository repository : repositories) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- if ((connectorUi != null && connectorUi.hasSearchPage() && !repository.isOffline())
- || connector.canCreateTaskFromKey(repository)) {
- searchableRepositories.add(repository);
- }
- }
-
- Collections.sort(searchableRepositories, new TaskRepositoryComparator());
-
- String[] repositoryUrls = new String[searchableRepositories.size()];
- int i = 0;
- int indexToSelect = 0;
- for (TaskRepository currRepsitory : searchableRepositories) {
- if (repository != null && repository.equals(currRepsitory)) {
- indexToSelect = i;
- }
- repositoryUrls[i] = currRepsitory.getRepositoryUrl();
- i++;
- }
-
- IDialogSettings settings = getDialogSettings();
- if (repositoryCombo != null) {
- for (int x = 0; x < searchableRepositories.size(); x++) {
- repositoryCombo.add(searchableRepositories.get(x).getRepositoryLabel());
- repositoryCombo.setData(searchableRepositories.get(x).getRepositoryLabel(),
- searchableRepositories.get(x));
- }
- if (repositoryUrls.length == 0) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
- Messages.TaskSearchPage_Repository_Search, TaskRepositoryManager.MESSAGE_NO_REPOSITORY);
- } else {
- String selectRepo = settings.get(STORE_REPO_ID);
- if (selectRepo != null && repositoryCombo.indexOf(selectRepo) > -1) {
- repositoryCombo.select(repositoryCombo.indexOf(selectRepo));
- repository = (TaskRepository) repositoryCombo.getData(selectRepo);
- if (repository == null) {
- // TODO: Display no repository error
- }
- } else {
- repositoryCombo.select(indexToSelect);
- }
-
- // TODO: Create one page per connector and repopulate based on repository
- queryPages = new Control[repositoryUrls.length];
- displayQueryPage(repositoryCombo.getSelectionIndex());
- // updateAttributesFromRepository(repositoryCombo.getText(),
- // null, false);
- }
- }
- firstView = false;
- }
-
- if (queryPages == null) {
- pageContainer.setPerformActionEnabled(false);
- }
-
- super.setVisible(visible);
-
- setDefaultValuesAndFocus();
- }
-
- private void setDefaultValuesAndFocus() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- String repositoryUrl = null;
- IWorkbenchPart part = page.getActivePart();
- if (part instanceof ISearchResultViewPart) {
- ISearchQuery[] queries = NewSearchUI.getQueries();
- if (queries.length > 0) {
- if (queries[0] instanceof SearchHitCollector) {
- repositoryUrl = ((SearchHitCollector) queries[0]).getRepositoryQuery().getRepositoryUrl();
- }
- }
- }
-// if (repositoryUrl == null) {
-// IEditorPart editor = page.getActiveEditor();
-// if (editor instanceof TaskEditor) {
-// repositoryUrl = ((TaskEditor) editor).getTaskEditorInput().getTask().getRepositoryUrl();
-// }
-// }
-// if (repositoryUrl == null) {
-// TaskListView taskListView = TaskListView.getFromActivePerspective();
-// if (taskListView != null) {
-// AbstractTask selectedTask = taskListView.getSelectedTask();
-// if (selectedTask != null) {
-// repositoryUrl = selectedTask.getRepositoryUrl();
-// }
-// }
-// }
- if (repositoryUrl != null) {
- TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(repositoryUrl);
- if (repository != null) {
- int index = 0;
- for (String repositoryLabel : repositoryCombo.getItems()) {
- if (repositoryLabel.equals(repository.getRepositoryLabel())) {
- repositoryCombo.select(index);
- }
- index++;
- }
- displayQueryPage(repositoryCombo.getSelectionIndex());
- }
- }
- }
- }
-
- if (keyText.getText() != null && keyText.getText().trim().length() > 0) {
- keyText.setFocus();
- keyText.setSelection(0, keyText.getText().length());
- } else {
- Clipboard clipboard = new Clipboard(Display.getDefault());
- TextTransfer transfer = TextTransfer.getInstance();
- String contents = (String) clipboard.getContents(transfer);
- if (contents != null) {
- if (isTaskKeyCandidate(contents.trim())) {
- keyText.setText(contents.trim());
- keyText.setFocus();
- keyText.setSelection(0, keyText.getText().length());
- }
- }
- }
- updatePageEnablement();
- }
-
- private boolean isTaskKeyCandidate(String contents) {
- boolean looksLikeKey = false;
- try {
- Integer.parseInt(contents);
- looksLikeKey = true;
- } catch (NumberFormatException nfe) {
- }
- if (!looksLikeKey) {
- try {
- Integer.parseInt(contents.substring(contents.lastIndexOf('-')));
- looksLikeKey = true;
- } catch (Exception e) {
- }
- }
- return looksLikeKey;
- }
-
- public IDialogSettings getDialogSettings() {
- IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
- fDialogSettings = settings.getSection(PAGE_NAME);
- if (fDialogSettings == null) {
- fDialogSettings = settings.addNewSection(PAGE_NAME);
- }
- return fDialogSettings;
- }
-
- private void saveDialogSettings() {
- IDialogSettings settings = getDialogSettings();
- settings.put(STORE_REPO_ID, repositoryCombo.getText());
- }
-
- @Override
- public void dispose() {
- if (queryPages != null) {
- for (Control control : queryPages) {
- if (control != null) {
- ITaskSearchPage page = (ITaskSearchPage) control.getData(PAGE_KEY);
- page.dispose();
- }
- }
- }
- super.dispose();
- }
-
- private class DeadSearchPage extends AbstractRepositoryQueryPage {
-
- public DeadSearchPage(TaskRepository rep) {
- super("Search page error", rep); //$NON-NLS-1$
- }
-
- public void createControl(Composite parent) {
- Hyperlink hyperlink = new Hyperlink(parent, SWT.NONE);
- hyperlink.setText(Messages.TaskSearchPage_ERROR_Unable_to_present_query_page);
- hyperlink.setUnderlined(true);
- hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TaskSearchPage.this.getControl().getShell().close();
- TasksUiUtil.openEditRepositoryWizard(getTaskRepository());
- // TODO: Re-construct this page with new
- // repository data
- }
-
- });
-
- GridDataFactory.fillDefaults().applyTo(hyperlink);
- setControl(hyperlink);
- }
-
- @Override
- public IRepositoryQuery getQuery() {
- return null;
- }
-
- @Override
- public boolean isPageComplete() {
- return false;
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- getSearchContainer().setPerformActionEnabled(false);
- }
- }
-
- @Override
- public String getQueryTitle() {
- return null;
- }
-
- @Override
- public void applyTo(IRepositoryQuery query) {
- // ignore
- }
-
- }
-
- private class NoSearchPage extends AbstractRepositoryQueryPage {
-
- public NoSearchPage(TaskRepository rep) {
- super("No search page", rep); //$NON-NLS-1$
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- Dialog.applyDialogFont(composite);
- setControl(composite);
- }
-
- @Override
- public IRepositoryQuery getQuery() {
- return null;
- }
-
- @Override
- public boolean isPageComplete() {
- return false;
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- getSearchContainer().setPerformActionEnabled(false);
- }
- }
-
- @Override
- public String getQueryTitle() {
- return null;
- }
-
- @Override
- public void applyTo(IRepositoryQuery query) {
- // ignore
- }
-
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java
deleted file mode 100644
index 05d6d2e29..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskTrimWidget.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenTaskListElementAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenWithBrowserAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskDeactivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
-import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.internal.ObjectActionContributorManager;
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.eclipse.ui.internal.layout.IWindowTrim;
-import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
-
-/**
- * @author Mik Kersten
- * @author Leo Dos Santos
- */
-public class TaskTrimWidget extends WorkbenchWindowControlContribution {
-
- public static String ID_CONTAINER = "org.eclipse.mylyn.tasks.ui.trim.container"; //$NON-NLS-1$
-
- public static String ID_CONTROL = "org.eclipse.mylyn.tasks.ui.trim.control"; //$NON-NLS-1$
-
- private Composite composite = null;
-
- private ITask activeTask = null;
-
- private MenuManager menuManager = null;
-
- private Menu menu = null;
-
- private TaskHyperlink activeTaskLabel;
-
- private final OpenWithBrowserAction openWithBrowserAction = new OpenWithBrowserAction();
-
- private final CopyTaskDetailsAction copyTaskDetailsAction = new CopyTaskDetailsAction();
-
- private Point p;
-
- private final ITaskActivationListener TASK_ACTIVATION_LISTENER = new TaskActivationAdapter() {
-
- @Override
- public void taskActivated(ITask task) {
- activeTask = task;
- indicateActiveTask();
- }
-
- @Override
- public void taskDeactivated(ITask task) {
- activeTask = null;
- indicateNoActiveTask();
- }
-
- };
-
- private final IPropertyChangeListener SHOW_TRIM_LISTENER = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(ITasksUiPreferenceConstants.SHOW_TRIM)) {
- setTrimVisible((Boolean) event.getNewValue());
- }
- }
- };
-
- public TaskTrimWidget() {
- TasksUi.getTaskActivityManager().addActivationListener(TASK_ACTIVATION_LISTENER);
- TasksUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(SHOW_TRIM_LISTENER);
- hookContextMenu();
- }
-
- private void setTrimVisible(boolean visible) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window instanceof WorkbenchWindow) {
- IWindowTrim trim = ((WorkbenchWindow) window).getTrimManager().getTrim(ID_CONTAINER);
- if (trim != null) {
- ((WorkbenchWindow) window).getTrimManager().setTrimVisible(trim, visible);
- }
- }
- }
-
- @Override
- public void dispose() {
- if (composite != null && !composite.isDisposed()) {
- composite.dispose();
- }
- composite = null;
-
- if (menuManager != null) {
- menuManager.removeAll();
- menuManager.dispose();
- }
- menuManager = null;
-
- if (menu != null && !menu.isDisposed()) {
- menu.dispose();
- }
- menu = null;
-
- TasksUi.getTaskActivityManager().removeActivationListener(TASK_ACTIVATION_LISTENER);
- TasksUiPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(SHOW_TRIM_LISTENER);
- }
-
- @Override
- protected Control createControl(Composite parent) {
- composite = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.horizontalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginLeft = 0;
- layout.marginRight = 0;
- composite.setLayout(layout);
-
- composite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
-
- createStatusComposite(composite);
-
- parent.getDisplay().asyncExec(new Runnable() {
- public void run() {
- IPreferenceStore uiPreferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
- setTrimVisible(uiPreferenceStore.getBoolean(ITasksUiPreferenceConstants.SHOW_TRIM));
- }
- });
-
- return composite;
- }
-
- private Composite createStatusComposite(final Composite container) {
- GC gc = new GC(container);
- p = gc.textExtent("WWWWWWWWWWWWWWW"); //$NON-NLS-1$
- gc.dispose();
-
- activeTaskLabel = new TaskHyperlink(container, SWT.RIGHT);
- // activeTaskLabel.setLayoutData(new GridData(p.x, SWT.DEFAULT));
- GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, true);
- gridData.widthHint = p.x;
- gridData.minimumWidth = p.x;
- gridData.horizontalIndent = 0;
- activeTaskLabel.setLayoutData(gridData);
- activeTaskLabel.setText(Messages.TaskTrimWidget__no_task_active_);
-
- activeTask = TasksUi.getTaskActivityManager().getActiveTask();
- if (activeTask != null) {
- indicateActiveTask();
- }
-
- activeTaskLabel.addMenuDetectListener(new MenuDetectListener() {
- public void menuDetected(MenuDetectEvent e) {
- if (menu != null) {
- menu.dispose();
- }
- menu = menuManager.createContextMenu(container);
- menu.setVisible(true);
- }
- });
-
- activeTaskLabel.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TaskListView taskListView = TaskListView.getFromActivePerspective();
- if (taskListView != null && taskListView.getDrilledIntoCategory() != null) {
- taskListView.goUpToRoot();
- }
- TasksUiInternal.refreshAndOpenTaskListElement((TasksUi.getTaskActivityManager().getActiveTask()));
- }
- });
-
- activeTaskLabel.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseDown(MouseEvent e) {
- if (activeTask == null) {
- return;
- }
-
- TaskListView taskListView = TaskListView.getFromActivePerspective();
- if (taskListView != null && taskListView.getDrilledIntoCategory() != null) {
- taskListView.goUpToRoot();
- }
-
- TasksUiInternal.refreshAndOpenTaskListElement(activeTask);
- }
- });
-
- return activeTaskLabel;
- }
-
- private void hookContextMenu() {
- menuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- }
- });
- }
-
- // Inspired by TaskListView, TaskEditorActionContributor.
- private void fillContextMenu(IMenuManager manager) {
- if (activeTask != null) {
- IStructuredSelection selection = new StructuredSelection(activeTask);
- openWithBrowserAction.selectionChanged(selection);
- copyTaskDetailsAction.selectionChanged(selection);
-
- manager.add(new OpenTaskListElementAction(null) {
- @Override
- public void run() {
- TasksUiInternal.refreshAndOpenTaskListElement(activeTask);
- }
- });
-
- manager.add(openWithBrowserAction);
- if (TasksUiInternal.isValidUrl(activeTask.getUrl())) {
- openWithBrowserAction.setEnabled(true);
- } else {
- openWithBrowserAction.setEnabled(false);
- }
-
- if (activeTask.isActive()) {
- manager.add(new TaskDeactivateAction() {
- @Override
- public void run() {
- super.run(activeTask);
- }
- });
- } else {
- manager.add(new TaskActivateAction() {
- @Override
- public void run() {
-// TasksUiPlugin.getTaskListManager().getTaskActivationHistory().addTask(activeTask);
- super.run(activeTask);
- }
- });
- }
-
- manager.add(new Separator());
-
- for (String menuPath : TasksUiPlugin.getDefault().getDynamicMenuMap().keySet()) {
- for (IDynamicSubMenuContributor contributor : TasksUiPlugin.getDefault().getDynamicMenuMap().get(
- menuPath)) {
- List<IRepositoryElement> selectedElements = new ArrayList<IRepositoryElement>();
- selectedElements.add(activeTask);
- MenuManager subMenuManager = contributor.getSubMenuManager(selectedElements);
- if (subMenuManager != null) {
- manager.add(subMenuManager);
- }
- }
- }
-
- manager.add(new Separator());
- manager.add(copyTaskDetailsAction);
- manager.add(new Separator());
-
- ObjectActionContributorManager.getManager().contributeObjectActions(null, manager,
- new ISelectionProvider() {
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- // ignore
- }
-
- public ISelection getSelection() {
- return new StructuredSelection(activeTask);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- // ignore
- }
-
- public void setSelection(ISelection selection) {
- // ignore
- }
- });
- }
- }
-
- public void indicateActiveTask() {
- if (activeTaskLabel != null && activeTaskLabel.isDisposed()) {
- return;
- }
-
- //activeTaskLabel.setText(shortenText(activeTask.getSummary()));
- activeTaskLabel.setText(activeTask.getSummary());
- activeTaskLabel.setUnderlined(true);
- activeTaskLabel.setToolTipText(activeTask.getSummary());
- }
-
- public void indicateNoActiveTask() {
- if (activeTaskLabel != null && activeTaskLabel.isDisposed()) {
- return;
- }
-
- activeTaskLabel.setText(Messages.TaskTrimWidget__no_active_task_);
- activeTaskLabel.setUnderlined(false);
- activeTaskLabel.setToolTipText(""); //$NON-NLS-1$
- }
-
-// // From PerspectiveBarContributionItem
-// private String shortenText(String taskLabel) {
-// if (taskLabel == null || composite == null || composite.isDisposed()) {
-// return null;
-// }
-//
-// String returnText = taskLabel;
-// GC gc = new GC(composite);
-// int maxWidth = p.x;
-//
-// if (gc.textExtent(taskLabel).x > maxWidth) {
-// for (int i = taskLabel.length(); i > 0; i--) {
-// String test = taskLabel.substring(0, i);
-// test = test + "...";
-// if (gc.textExtent(test).x < maxWidth) {
-// returnText = test;
-// break;
-// }
-// }
-// }
-//
-// gc.dispose();
-// return returnText;
-// }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskWorkingSetFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskWorkingSetFilter.java
deleted file mode 100644
index 425b1ae12..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskWorkingSetFilter.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * AbstractTaskListFilter for task working sets
- *
- * @author Eugene Kuleshov
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class TaskWorkingSetFilter extends AbstractTaskListFilter {
-
- private IAdaptable[] elements;
-
- @Override
- public boolean select(Object parent, Object element) {
- if (parent instanceof ITask) {
- return true;
- }
-
- if (parent == null && element instanceof ScheduledTaskContainer) {
- return true;
- }
-
- if (parent == null && element instanceof IRepositoryElement) {
- return isContainedInWorkingSet((IRepositoryElement) element);
- }
- if (parent instanceof ITaskContainer && !(parent instanceof ScheduledTaskContainer)) {
- return isContainedInWorkingSet((IRepositoryElement) parent);
- }
- if (element instanceof LocalTask) {
- for (IRepositoryElement container : ((LocalTask) element).getParentContainers()) {
- return isContainedInWorkingSet(container);
- }
- }
- if (parent instanceof ScheduledTaskContainer && element instanceof ITask) {
- for (IRepositoryElement query : ((AbstractTask) element).getParentContainers()) {
- if (isContainedInWorkingSet(query)) {
- return true;
- }
- }
- return false;
- }
- return true;
- }
-
- @Override
- public boolean applyToFilteredText() {
- return true;
- }
-
- private boolean isContainedInWorkingSet(IRepositoryElement element) {
- return isContainedInWorkingSet(element, new HashSet<IRepositoryElement>());
- }
-
- private boolean isContainedInWorkingSet(IRepositoryElement container, Set<IRepositoryElement> visited) {
- if (elements == null) {
- return true;
- }
-
- if (visited.contains(container)) {
- return false;
- }
-
- visited.add(container);
-
- boolean seenTaskWorkingSets = false;
- String handleIdentifier = container.getHandleIdentifier();
- for (IAdaptable adaptable : elements) {
- if (adaptable instanceof IRepositoryElement) {
- seenTaskWorkingSets = true;
- if (handleIdentifier.equals(((IRepositoryElement) adaptable).getHandleIdentifier())) {
- return true;
- }
-
- // handle case of sub tasks (not directly under a category/query)
- if (container instanceof AbstractTask) {
- for (AbstractTaskContainer parent : ((AbstractTask) container).getParentContainers()) {
- if (visited.contains(parent)) {
- continue;
- }
- if (isContainedInWorkingSet(parent, visited)) {
- return true;
- }
- }
- }
- }
- }
- return !seenTaskWorkingSets;
- }
-
- public boolean updateWorkingSet(IWorkingSet currentWorkingSet) {
- IAdaptable[] newElements = currentWorkingSet.getElements();
- if (!Arrays.equals(this.elements, newElements)) {
- this.elements = newElements;
- return true;
- }
- return false;
- }
-
- public IAdaptable[] getElements() {
- return elements;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksAdapterFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksAdapterFactory.java
deleted file mode 100644
index 0ea14366b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksAdapterFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-
-/**
- * Factory for adapting objects to task elements.
- *
- * @author Steffen Pingel
- */
-public class TasksAdapterFactory implements IAdapterFactory {
-
- private static final Class<?>[] ADAPTER_LIST = new Class[] { ITask.class, TaskRepository.class };
-
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- public Object getAdapter(final Object adaptable, @SuppressWarnings("unchecked") Class adapterType) {
- if (adapterType == ITask.class) {
- if (adaptable instanceof TaskEditorInput) {
- return ((TaskEditorInput) adaptable).getTask();
- } else if (adaptable instanceof ITaskAttachment) {
- return ((ITaskAttachment) adaptable).getTask();
- }
- }
- if (adapterType == TaskRepository.class) {
- if (adaptable instanceof TaskEditorInput) {
- return ((TaskEditorInput) adaptable).getTaskRepository();
- } else if (adaptable instanceof ITaskAttachment) {
- return ((ITaskAttachment) adaptable).getTaskRepository();
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksReminderDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksReminderDialog.java
deleted file mode 100644
index d57b516c7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksReminderDialog.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ken Sueda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-/**
- * @author Ken Sueda
- */
-public class TasksReminderDialog extends Dialog {
- private List<AbstractTask> tasks = null;
-
- private Table table = null;
-
- private TableViewer tableViewer = null;
-
- private final String[] columnNames = new String[] { Messages.TasksReminderDialog_Description, Messages.TasksReminderDialog_Priority, Messages.TasksReminderDialog_Reminder_Day };
-
- private static final int DISMISS_ALL_ID = 200;
-
- private static final int DISMISS_ID = 201;
-
- private static final int SNOOZE_ID = 202;
-
- private static long DAY = 24 * 3600 * 1000;
-
- public TasksReminderDialog(Shell parentShell, List<AbstractTask> remTasks) {
- super(parentShell);
- tasks = remTasks;
- setShellStyle(SWT.CLOSE | SWT.MIN | SWT.MODELESS | SWT.BORDER | SWT.TITLE);
- }
-
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(Messages.TasksReminderDialog_Reminders);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- setBlockOnOpen(false);
- GridLayout gl = new GridLayout(1, false);
- composite.setLayout(gl);
- GridData data = new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(data);
-
- Composite container = new Composite(composite, SWT.NONE);
- gl = new GridLayout(1, false);
- container.setLayout(gl);
- createTable(container);
- createTableViewer();
-
- return composite;
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, DISMISS_ALL_ID, Messages.TasksReminderDialog_Dismiss_All, false);
- createButton(parent, DISMISS_ID, Messages.TasksReminderDialog_Dismiss_Selected, false);
- createButton(parent, SNOOZE_ID, Messages.TasksReminderDialog_Remind_tommorrow, true);
- }
-
- private void createTable(Composite parent) {
- int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
- table = new Table(parent, style);
- GridLayout tlayout = new GridLayout();
- table.setLayout(tlayout);
- GridData wd = new GridData(GridData.FILL_BOTH);
- wd.heightHint = 300;
- table.setLayoutData(wd);
-
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
-
- TableColumn column = new TableColumn(table, SWT.LEFT, 0);
- column.setText(columnNames[0]);
- column.setWidth(180);
- column.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new ReminderTaskSorter(ReminderTaskSorter.DESCRIPTION));
-
- }
- });
-
- column = new TableColumn(table, SWT.LEFT, 1);
- column.setText(columnNames[1]);
- column.setWidth(50);
- column.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new ReminderTaskSorter(ReminderTaskSorter.PRIORITY));
- }
- });
-
- column = new TableColumn(table, SWT.LEFT, 2);
- column.setText(columnNames[2]);
- column.setWidth(100);
- column.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new ReminderTaskSorter(ReminderTaskSorter.DATE));
- }
- });
- }
-
- private void createTableViewer() {
- tableViewer = new TableViewer(table);
- tableViewer.setUseHashlookup(true);
- tableViewer.setContentProvider(new ReminderTasksContentProvider());
- tableViewer.setLabelProvider(new ReminderTasksLabelProvider());
- tableViewer.setInput(tasks);
- }
-
- @Override
- protected void buttonPressed(int buttonId) {
- if (buttonId == DISMISS_ALL_ID) {
- for (ITask t : tasks) {
- ((AbstractTask) t).setReminded(true);
- }
- okPressed();
- } else if (buttonId == DISMISS_ID) {
- Object sel = ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
- if (sel != null && sel instanceof ITask) {
- ITask t = (ITask) sel;
- ((AbstractTask) t).setReminded(true);
- tasks.remove(t);
- if (tasks.isEmpty()) {
- okPressed();
- } else {
- tableViewer.refresh();
- }
- }
- } else if (buttonId == SNOOZE_ID) {
- Object sel = ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
- if (sel != null && sel instanceof ITask) {
- ITask t = (ITask) sel;
- ((AbstractTask) t).setReminded(false);
- ((AbstractTask) t).setScheduledForDate(TaskActivityUtil.getDayOf(new Date(new Date().getTime() + DAY)));
- tasks.remove(t);
- if (tasks.isEmpty()) {
- okPressed();
- } else {
- tableViewer.refresh();
- }
- }
- }
- super.buttonPressed(buttonId);
- }
-
- private class ReminderTasksContentProvider implements IStructuredContentProvider {
-
- public Object[] getElements(Object inputElement) {
- return tasks.toArray();
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- private static class ReminderTasksLabelProvider extends LabelProvider implements ITableLabelProvider {
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof ITask) {
- AbstractTask task = (AbstractTask) element;
- switch (columnIndex) {
- case 0:
- return task.getSummary();
- case 1:
- return task.getPriority();
- case 2:
- return DateFormat.getDateInstance(DateFormat.MEDIUM).format(task.getScheduledForDate());
- }
- }
- return null;
- }
-
- }
-
- private static class ReminderTaskSorter extends ViewerSorter {
-
- public final static int DESCRIPTION = 1;
-
- public final static int PRIORITY = 2;
-
- public final static int DATE = 3;
-
- private final int criteria;
-
- public ReminderTaskSorter(int criteria) {
- super();
- this.criteria = criteria;
- }
-
- @Override
- public int compare(Viewer viewer, Object obj1, Object obj2) {
- ITask t1 = (ITask) obj1;
- ITask t2 = (ITask) obj2;
-
- switch (criteria) {
- case DESCRIPTION:
- return compareDescription(t1, t2);
- case PRIORITY:
- return comparePriority(t1, t2);
- case DATE:
- return compareDate((AbstractTask) t1, (AbstractTask) t2);
- default:
- return 0;
- }
- }
-
- private int compareDescription(ITask task1, ITask task2) {
- return task1.getSummary().compareToIgnoreCase(task2.getSummary());
- }
-
- private int comparePriority(ITask task1, ITask task2) {
- return task1.getPriority().compareTo(task2.getPriority());
- }
-
- private int compareDate(AbstractTask task1, AbstractTask task2) {
- return task2.getScheduledForDate().compareTo(task1.getScheduledForDate());
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiFactory.java
deleted file mode 100644
index aaaf5f65b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2009 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * David Green - fix for bug 263418
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryCompletionProcessor;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.ITasksUiFactory;
-
-/**
- * @author Steffen Pingel
- * @author David Green
- */
-public class TasksUiFactory implements ITasksUiFactory {
-
- public IContentProposalProvider createPersonContentProposalProvider(TaskRepository repository) {
- return new PersonProposalProvider(repository.getRepositoryUrl(), repository.getConnectorKind());
- }
-
- public ILabelProvider createPersonContentProposalLabelProvider(TaskRepository repository) {
- return new PersonProposalLabelProvider();
- }
-
- public IContentAssistProcessor createTaskContentAssistProcessor(TaskRepository repository) {
- return new RepositoryCompletionProcessor(repository);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiMessages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiMessages.java
deleted file mode 100644
index 6ec17d018..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiMessages.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-/**
- * @author Mik Kersten
- */
-public class TasksUiMessages {
-
- public static final String DIALOG_EDITOR = Messages.TasksUiMessages_Task_Editor;
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
deleted file mode 100644
index a52c7694e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
+++ /dev/null
@@ -1,1253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.core.net.proxy.IProxyChangeEvent;
-import org.eclipse.core.net.proxy.IProxyChangeListener;
-import org.eclipse.core.net.proxy.IProxyService;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ISaveContext;
-import org.eclipse.core.resources.ISaveParticipant;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.commons.net.WebUtil;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFonts;
-import org.eclipse.mylyn.internal.tasks.core.AbstractSearchHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryModelListener;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryExternalizationParticipant;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore;
-import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
-import org.eclipse.mylyn.internal.tasks.core.externalization.IExternalizationParticipant;
-import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizationParticipant;
-import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
-import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotificationReminder;
-import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotifier;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiExtensionReader;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
-import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
-import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IStartup;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.progress.IProgressService;
-import org.eclipse.ui.progress.UIJob;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Main entry point for the Tasks UI.
- *
- * @author Mik Kersten
- * @since 3.0
- */
-public class TasksUiPlugin extends AbstractUIPlugin {
-
- private static final int DELAY_QUERY_REFRESH_ON_STARTUP = 20 * 1000;
-
- private static final int DEFAULT_LINK_PROVIDER_TIMEOUT = 5 * 1000;
-
- public static final String ID_PLUGIN = "org.eclipse.mylyn.tasks.ui"; //$NON-NLS-1$
-
- private static final String DIRECTORY_METADATA = ".metadata"; //$NON-NLS-1$
-
- private static final String NAME_DATA_DIR = ".mylyn"; //$NON-NLS-1$
-
- private static final char DEFAULT_PATH_SEPARATOR = '/';
-
- private static final int NOTIFICATION_DELAY = 5000;
-
- private static TasksUiPlugin INSTANCE;
-
- private static ExternalizationManager externalizationManager;
-
- private static TaskActivityManager taskActivityManager;
-
- private static TaskRepositoryManager repositoryManager;
-
- private static TaskListSynchronizationScheduler synchronizationScheduler;
-
- private static TaskDataManager taskDataManager;
-
- private static Map<String, AbstractRepositoryConnectorUi> repositoryConnectorUiMap = new HashMap<String, AbstractRepositoryConnectorUi>();
-
- private TaskListNotificationManager taskListNotificationManager;
-
- private TaskListBackupManager taskListBackupManager;
-
- private RepositoryTemplateManager repositoryTemplateManager;
-
- private final Set<AbstractTaskEditorPageFactory> taskEditorPageFactories = new HashSet<AbstractTaskEditorPageFactory>();
-
- private final TreeSet<AbstractTaskRepositoryLinkProvider> repositoryLinkProviders = new TreeSet<AbstractTaskRepositoryLinkProvider>(
- new OrderComparator());
-
- private TaskListExternalizer taskListExternalizer;
-
- private ITaskHighlighter highlighter;
-
- private final Map<String, Image> brandingIcons = new HashMap<String, Image>();
-
- private final Map<String, ImageDescriptor> overlayIcons = new HashMap<String, ImageDescriptor>();
-
- private final Set<AbstractDuplicateDetector> duplicateDetectors = new HashSet<AbstractDuplicateDetector>();
-
- private ISaveParticipant saveParticipant;
-
- private TaskEditorBloatMonitor taskEditorBloatManager;
-
- private TaskJobFactory taskJobFactory;
-
- // shared colors for all forms
- private FormColors formColors;
-
- private final List<AbstractSearchHandler> searchHandlers = new ArrayList<AbstractSearchHandler>();
-
- private static final boolean DEBUG_HTTPCLIENT = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.mylyn.tasks.ui/debug/httpclient")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // XXX reconsider if this is necessary
- public static class TasksUiStartup implements IStartup {
-
- public void earlyStartup() {
- // ignore
- }
- }
-
- private static final class OrderComparator implements Comparator<AbstractTaskRepositoryLinkProvider> {
- public int compare(AbstractTaskRepositoryLinkProvider p1, AbstractTaskRepositoryLinkProvider p2) {
- return p1.getOrder() - p2.getOrder();
- }
- }
-
- public enum TaskListSaveMode {
- ONE_HOUR, THREE_HOURS, DAY;
- @Override
- public String toString() {
- switch (this) {
- case ONE_HOUR:
- return "1 hour"; //$NON-NLS-1$
- case THREE_HOURS:
- return "3 hours"; //$NON-NLS-1$
- case DAY:
- return "1 day"; //$NON-NLS-1$
- default:
- return "3 hours"; //$NON-NLS-1$
- }
- }
-
- public static TaskListSaveMode fromString(String string) {
- if (string == null) {
- return null;
- }
- if (string.equals("1 hour")) { //$NON-NLS-1$
- return ONE_HOUR;
- }
- if (string.equals("3 hours")) { //$NON-NLS-1$
- return THREE_HOURS;
- }
- if (string.equals("1 day")) { //$NON-NLS-1$
- 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;
- }
-
- private static ITaskActivationListener CONTEXT_TASK_ACTIVATION_LISTENER = new TaskActivationAdapter() {
-
- @Override
- public void taskActivated(final ITask task) {
- ContextCore.getContextManager().activateContext(task.getHandleIdentifier());
- }
-
- @Override
- public void taskDeactivated(final ITask task) {
- ContextCore.getContextManager().deactivateContext(task.getHandleIdentifier());
- }
-
- };
-
- private static ITaskListNotificationProvider REMINDER_NOTIFICATION_PROVIDER = new ITaskListNotificationProvider() {
-
- public Set<AbstractNotification> getNotifications() {
- Collection<AbstractTask> allTasks = TasksUiPlugin.getTaskList().getAllTasks();
- Set<AbstractNotification> reminders = new HashSet<AbstractNotification>();
- for (AbstractTask task : allTasks) {
- if (TasksUiPlugin.getTaskActivityManager().isPastReminder(task) && !task.isReminded()) {
- reminders.add(new TaskListNotificationReminder(task));
- task.setReminded(true);
- }
- }
- return reminders;
- }
- };
-
-// private static ITaskListNotificationProvider INCOMING_NOTIFICATION_PROVIDER = new ITaskListNotificationProvider() {
-//
-// @SuppressWarnings( { "deprecation", "restriction" })
-// public Set<AbstractNotification> getNotifications() {
-// Set<AbstractNotification> notifications = new HashSet<AbstractNotification>();
-// // Incoming Changes
-// for (TaskRepository repository : getRepositoryManager().getAllRepositories()) {
-// AbstractRepositoryConnector connector = getRepositoryManager().getRepositoryConnector(
-// repository.getConnectorKind());
-// if (connector instanceof AbstractLegacyRepositoryConnector) {
-// AbstractRepositoryConnectorUi connectorUi = getConnectorUi(repository.getConnectorKind());
-// if (connectorUi != null && !connectorUi.hasCustomNotifications()) {
-// for (ITask itask : TasksUiPlugin.getTaskList().getTasks(repository.getRepositoryUrl())) {
-// if (itask instanceof AbstractTask) {
-// AbstractTask task = (AbstractTask) itask;
-// if ((task.getLastReadTimeStamp() == null || task.getSynchronizationState() == SynchronizationState.INCOMING)
-// && task.isNotified() == false) {
-// TaskListNotification notification = LegacyChangeManager.getIncommingNotification(
-// connector, task);
-// notifications.add(notification);
-// task.setNotified(true);
-// }
-// }
-// }
-// }
-// }
-// }
-// // New query hits
-// for (RepositoryQuery query : TasksUiPlugin.getTaskList().getQueries()) {
-// TaskRepository repository = getRepositoryManager().getRepository(query.getRepositoryUrl());
-// if (repository != null) {
-// AbstractRepositoryConnector connector = getRepositoryManager().getRepositoryConnector(
-// repository.getConnectorKind());
-// if (connector instanceof AbstractLegacyRepositoryConnector) {
-// AbstractRepositoryConnectorUi connectorUi = getConnectorUi(repository.getConnectorKind());
-// if (!connectorUi.hasCustomNotifications()) {
-// for (ITask hit : query.getChildren()) {
-// if (((AbstractTask) hit).isNotified() == false) {
-// notifications.add(new TaskListNotificationQueryIncoming(hit));
-// ((AbstractTask) hit).setNotified(true);
-// }
-// }
-// }
-// }
-// }
-// }
-// return notifications;
-// }
-// };
-
-// private final IPropertyChangeListener PREFERENCE_LISTENER = new IPropertyChangeListener() {
-//
-// public void propertyChange(PropertyChangeEvent event) {
-// // TODO: do we ever get here?
-//// if (event.getProperty().equals(ContextPreferenceContstants.PREF_DATA_DIR)) {
-//// if (event.getOldValue() instanceof String) {
-//// reloadDataDirectory();
-//// }
-//// }
-// }
-// };
-
- private final org.eclipse.jface.util.IPropertyChangeListener PROPERTY_LISTENER = new org.eclipse.jface.util.IPropertyChangeListener() {
-
- public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
- if (event.getProperty().equals(ITasksUiPreferenceConstants.PLANNING_ENDHOUR)
- || event.getProperty().equals(ITasksUiPreferenceConstants.WEEK_START_DAY)) {
- updateTaskActivityManager();
- }
-
- if (event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED)
- || event.getProperty().equals(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS)) {
- updateSynchronizationScheduler(false);
- }
- }
- };
-
- private TaskActivityMonitor taskActivityMonitor;
-
- private ServiceReference proxyServiceReference;
-
- private IProxyChangeListener proxyChangeListener;
-
- private static TaskListExternalizationParticipant taskListExternalizationParticipant;
-
- private final Set<IRepositoryModelListener> listeners = new HashSet<IRepositoryModelListener>();
-
- private static TaskList taskList;
-
- private static RepositoryModel repositoryModel;
-
- private static TasksUiFactory uiFactory;
-
- @Deprecated
- public static String LABEL_VIEW_REPOSITORIES = Messages.TasksUiPlugin_Task_Repositories;
-
- private class TasksUiInitializationJob extends UIJob {
-
- public TasksUiInitializationJob() {
- super(Messages.TasksUiPlugin_Initializing_Task_List);
- setSystem(true);
- }
-
- @SuppressWarnings("restriction")
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- // NOTE: failure in one part of the initialization should
- // not prevent others
- monitor.beginTask("Initializing Task List", 5); //$NON-NLS-1$
- try {
- // Needs to run after workbench is loaded because it
- // relies on images.
- TasksUiExtensionReader.initWorkbenchUiExtensions();
-
- if (externalizationManager.getLoadStatus() != null) {
- // XXX: recovery from task list load failure (Rendered in task list)
- }
-
- List<String> commandLineArgs = Arrays.asList(Platform.getCommandLineArgs());
- boolean activateTask = !commandLineArgs.contains(ITasksCoreConstants.COMMAND_LINE_NO_ACTIVATE_TASK);
- if (activateTask) {
- try {
- Field field = org.eclipse.core.internal.resources.Workspace.class.getDeclaredField("crashed"); //$NON-NLS-1$
- field.setAccessible(true);
- Object value = field.get(ResourcesPlugin.getWorkspace());
- if (value instanceof Boolean) {
- activateTask = !(Boolean) value;
- }
- } catch (Throwable t) {
- t.printStackTrace();
- // ignore
- }
- }
- // Needs to happen asynchronously to avoid bug 159706
- for (AbstractTask task : taskList.getAllTasks()) {
- if (task.isActive()) {
- // the externalizer might set multiple tasks active
- task.setActive(false);
- if (activateTask) {
- // make sure only one task is activated
- taskActivityManager.activateTask(task);
- activateTask = false;
- }
- }
- }
- //taskActivityMonitor.reloadActivityTime();
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not initialize task activity", t)); //$NON-NLS-1$
- }
- monitor.worked(1);
-
- try {
- taskListNotificationManager.addNotificationProvider(REMINDER_NOTIFICATION_PROVIDER);
-// taskListNotificationManager.addNotificationProvider(INCOMING_NOTIFICATION_PROVIDER);
- taskListNotificationManager.addNotificationProvider(new TaskListNotifier(getRepositoryModel(),
- getTaskDataManager()));
- taskListNotificationManager.startNotification(NOTIFICATION_DELAY);
- getPreferenceStore().addPropertyChangeListener(taskListNotificationManager);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not initialize notifications", t)); //$NON-NLS-1$
- }
- monitor.worked(1);
-
- try {
- taskListBackupManager = new TaskListBackupManager(getBackupFolderPath());
- getPreferenceStore().addPropertyChangeListener(taskListBackupManager);
-
- synchronizationScheduler = new TaskListSynchronizationScheduler(taskJobFactory);
- updateSynchronizationScheduler(true);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not initialize task list backup and synchronization", t)); //$NON-NLS-1$
- }
- monitor.worked(1);
-
- try {
-
- getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER);
-
- // TODO: get rid of this, hack to make decorators show
- // up on startup
- TaskRepositoriesView repositoriesView = TaskRepositoriesView.getFromActivePerspective();
- if (repositoriesView != null) {
- repositoriesView.getViewer().refresh();
- }
-
- taskEditorBloatManager = new TaskEditorBloatMonitor();
- taskEditorBloatManager.install(PlatformUI.getWorkbench());
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not finish Tasks UI initialization", t)); //$NON-NLS-1$
- } finally {
- monitor.done();
- }
- return new Status(IStatus.OK, TasksUiPlugin.ID_PLUGIN, IStatus.OK, "", null); //$NON-NLS-1$
- }
- }
-
- public TasksUiPlugin() {
- super();
- INSTANCE = this;
- }
-
- private void updateSynchronizationScheduler(boolean initial) {
- boolean enabled = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED);
- if (enabled) {
- long interval = TasksUiPlugin.getDefault().getPreferenceStore().getLong(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
- if (initial) {
- synchronizationScheduler.setInterval(DELAY_QUERY_REFRESH_ON_STARTUP, interval);
- } else {
- synchronizationScheduler.setInterval(interval);
- }
- } else {
- synchronizationScheduler.setInterval(0);
- }
- }
-
- @SuppressWarnings( { "deprecation", "restriction" })
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- // NOTE: startup order is very sensitive
- try {
- // initialize framework and settings
- if (DEBUG_HTTPCLIENT) {
- // do this before anything else, once commons logging is initialized and an instance
- // of Log has been created it's too late
- initHttpLogging();
- }
- WebUtil.init();
- initializePreferences(getPreferenceStore());
-
- // initialize CommonFonts from UI thread: bug 240076
- if (CommonFonts.BOLD == null) {
- // ignore
- }
-
- File dataDir = new File(getDataDirectory());
- dataDir.mkdirs();
-
- // create data model
- externalizationManager = new ExternalizationManager(getDataDirectory());
-
- repositoryManager = new TaskRepositoryManager();
- IExternalizationParticipant repositoryParticipant = new RepositoryExternalizationParticipant(
- externalizationManager, repositoryManager);
- externalizationManager.addParticipant(repositoryParticipant);
-
- taskList = new TaskList();
- repositoryModel = new RepositoryModel(taskList, repositoryManager);
- taskListExternalizer = new TaskListExternalizer(repositoryModel, repositoryManager);
-
- taskListExternalizationParticipant = new TaskListExternalizationParticipant(repositoryModel, taskList,
- taskListExternalizer, externalizationManager, repositoryManager);
- //externalizationManager.load(taskListSaveParticipant);
- externalizationManager.addParticipant(taskListExternalizationParticipant);
- taskList.addChangeListener(taskListExternalizationParticipant);
-
- taskActivityManager = new TaskActivityManager(repositoryManager, taskList);
- taskActivityManager.addActivationListener(taskListExternalizationParticipant);
-
- // initialize
- updateTaskActivityManager();
-
- proxyServiceReference = context.getServiceReference(IProxyService.class.getName());
- if (proxyServiceReference != null) {
- IProxyService proxyService = (IProxyService) context.getService(proxyServiceReference);
- if (proxyService != null) {
- proxyChangeListener = new IProxyChangeListener() {
- public void proxyInfoChanged(IProxyChangeEvent event) {
- List<TaskRepository> repos = repositoryManager.getAllRepositories();
- for (TaskRepository repo : repos) {
- if (repo.isDefaultProxyEnabled()) {
- repositoryManager.notifyRepositorySettingsChanged(repo);
- }
- }
- }
- };
- proxyService.addProxyChangeListener(proxyChangeListener);
- }
- }
-
- repositoryTemplateManager = new RepositoryTemplateManager();
-
- // NOTE: initializing extensions in start(..) has caused race
- // conditions previously
- TasksUiExtensionReader.initStartupExtensions(taskListExternalizer);
-
- // instantiate taskDataManager
- TaskDataStore taskDataStore = new TaskDataStore(repositoryManager);
- taskDataManager = new TaskDataManager(taskDataStore, repositoryManager, taskList, taskActivityManager);
-
- taskJobFactory = new TaskJobFactory(taskList, taskDataManager, repositoryManager, repositoryModel);
-
- taskActivityManager.addActivationListener(CONTEXT_TASK_ACTIVATION_LISTENER);
-
- taskActivityMonitor = new TaskActivityMonitor(taskActivityManager, ContextCorePlugin.getContextManager());
- taskActivityMonitor.start();
-
- saveParticipant = new ISaveParticipant() {
-
- public void doneSaving(ISaveContext context) {
- }
-
- public void prepareToSave(ISaveContext context) throws CoreException {
- }
-
- public void rollback(ISaveContext context) {
- }
-
- public void saving(ISaveContext context) throws CoreException {
- if (context.getKind() == ISaveContext.FULL_SAVE) {
- externalizationManager.stop();
- }
- }
- };
- ResourcesPlugin.getWorkspace().addSaveParticipant(this, saveParticipant);
-
- ActivityExternalizationParticipant ACTIVITY_EXTERNALIZTAION_PARTICIPANT = new ActivityExternalizationParticipant(
- externalizationManager);
- externalizationManager.addParticipant(ACTIVITY_EXTERNALIZTAION_PARTICIPANT);
- taskActivityManager.addActivityListener(ACTIVITY_EXTERNALIZTAION_PARTICIPANT);
- taskActivityMonitor.setExternalizationParticipant(ACTIVITY_EXTERNALIZTAION_PARTICIPANT);
-
- // initialize managers
- initializeDataSources();
-
- // make this available early for clients that are not initialized through tasks ui but need access
- taskListNotificationManager = new TaskListNotificationManager();
-
- // trigger lazy initialization
- new TasksUiInitializationJob().schedule();
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Task list initialization failed", e)); //$NON-NLS-1$
- }
- }
-
- private void initHttpLogging() {
- System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); //$NON-NLS-1$ //$NON-NLS-2$
- System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug"); //$NON-NLS-1$ //$NON-NLS-2$
- System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire.header", "debug"); //$NON-NLS-1$ //$NON-NLS-2$
- System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug"); //$NON-NLS-1$ //$NON-NLS-2$
- System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient.HttpConnection", //$NON-NLS-1$
- "trace"); //$NON-NLS-1$
- System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.axis.message", "debug"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private void updateTaskActivityManager() {
- int endHour = getPreferenceStore().getInt(ITasksUiPreferenceConstants.PLANNING_ENDHOUR);
-// if (taskActivityManager.getEndHour() != endHour) {
-// taskActivityManager.setEndHour(endHour);
- TaskActivityUtil.setEndHour(endHour);
-// }
-
- int newWeekStartDay = getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY);
- int oldWeekStartDay = taskActivityManager.getWeekStartDay();
- if (oldWeekStartDay != newWeekStartDay) {
- taskActivityManager.setWeekStartDay(newWeekStartDay);
-// taskActivityManager.setStartTime(new Date());
- }
-
- // event.getProperty().equals(TaskListPreferenceConstants.PLANNING_STARTDAY)
- // scheduledStartHour =
- // TasksUiPlugin.getDefault().getPreferenceStore().getInt(
- // TaskListPreferenceConstants.PLANNING_STARTHOUR);
- }
-
- private void loadTemplateRepositories() {
- // Add standard local task repository
- getLocalTaskRepository();
-
- // Add the automatically created templates
- for (AbstractRepositoryConnector connector : repositoryManager.getRepositoryConnectors()) {
- for (RepositoryTemplate template : repositoryTemplateManager.getTemplates(connector.getConnectorKind())) {
- if (template.addAutomatically && !TaskRepositoryUtil.isAddAutomaticallyDisabled(template.repositoryUrl)) {
- try {
- String repositoryUrl = TaskRepositoryManager.stripSlashes(template.repositoryUrl);
- TaskRepository taskRepository = repositoryManager.getRepository(connector.getConnectorKind(),
- repositoryUrl);
- if (taskRepository == null) {
- taskRepository = new TaskRepository(connector.getConnectorKind(), repositoryUrl);
- taskRepository.setVersion(template.version);
- taskRepository.setRepositoryLabel(template.label);
- taskRepository.setCharacterEncoding(template.characterEncoding);
- if (template.anonymous) {
- taskRepository.setCredentials(AuthenticationType.REPOSITORY, null, true);
- }
- repositoryManager.addRepository(taskRepository);
- }
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load repository template", t)); //$NON-NLS-1$
- }
- }
- }
- }
- }
-
- /**
- * Returns the local task repository. If the repository does not exist it is created and added to the task
- * repository manager.
- *
- * @return the local task repository; never <code>null</code>
- * @since 3.0
- */
- public TaskRepository getLocalTaskRepository() {
- TaskRepository localRepository = repositoryManager.getRepository(LocalRepositoryConnector.CONNECTOR_KIND,
- LocalRepositoryConnector.REPOSITORY_URL);
- if (localRepository == null) {
- localRepository = new TaskRepository(LocalRepositoryConnector.CONNECTOR_KIND,
- LocalRepositoryConnector.REPOSITORY_URL);
- localRepository.setVersion(LocalRepositoryConnector.REPOSITORY_VERSION);
- localRepository.setRepositoryLabel(LocalRepositoryConnector.REPOSITORY_LABEL);
- repositoryManager.addRepository(localRepository);
- }
- return localRepository;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- try {
- if (formColors != null) {
- formColors.dispose();
- formColors = null;
- }
- if (taskActivityMonitor != null) {
- taskActivityMonitor.stop();
- }
-
- if (ResourcesPlugin.getWorkspace() != null) {
- ResourcesPlugin.getWorkspace().removeSaveParticipant(this);
- }
-
- if (proxyServiceReference != null) {
- IProxyService proxyService = (IProxyService) context.getService(proxyServiceReference);
- if (proxyService != null) {
- proxyService.removeProxyChangeListener(proxyChangeListener);
- }
- context.ungetService(proxyServiceReference);
- }
-
- if (PlatformUI.isWorkbenchRunning()) {
- getPreferenceStore().removePropertyChangeListener(taskListNotificationManager);
- getPreferenceStore().removePropertyChangeListener(taskListBackupManager);
- getPreferenceStore().removePropertyChangeListener(PROPERTY_LISTENER);
- //taskListManager.getTaskList().removeChangeListener(taskListSaveManager);
- CommonColors.dispose();
-// if (ContextCorePlugin.getDefault() != null) {
-// ContextCorePlugin.getDefault().getPluginPreferences().removePropertyChangeListener(
-// PREFERENCE_LISTENER);
-// }
- taskEditorBloatManager.dispose(PlatformUI.getWorkbench());
- INSTANCE = null;
- }
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Task list stop terminated abnormally", e)); //$NON-NLS-1$
- } finally {
- super.stop(context);
- }
- }
-
- public String getDefaultDataDirectory() {
- return ResourcesPlugin.getWorkspace().getRoot().getLocation().toString() + '/' + DIRECTORY_METADATA + '/'
- + NAME_DATA_DIR;
- }
-
- public String getDataDirectory() {
- return getPreferenceStore().getString(ITasksUiPreferenceConstants.PREF_DATA_DIR);
- }
-
- /**
- * Persist <code>path</code> as data directory and loads data from <code>path</code>. This method may block if other
- * jobs are running that modify tasks data. This method will only execute after all conflicting jobs have been
- * completed.
- *
- * @throws CoreException
- * in case setting of the data directory did not complete normally
- * @throws OperationCanceledException
- * if the operation is cancelled by the user
- */
- public void setDataDirectory(final String path) throws CoreException {
- Assert.isNotNull(path);
- IRunnableWithProgress runner = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(Messages.TasksUiPlugin_Load_Data_Directory, IProgressMonitor.UNKNOWN);
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
-
- TasksUi.getTaskActivityManager().deactivateActiveTask();
-
- // set new preference in case of a change
- if (!path.equals(getDataDirectory())) {
- getPreferenceStore().setValue(ITasksUiPreferenceConstants.PREF_DATA_DIR, path);
- }
-
- // reload data from new directory
- initializeDataSources();
- } finally {
- // FIXME roll back preferences change in case of an error?
- monitor.done();
- }
- }
- };
-
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- try {
- service.runInUI(service, runner, ITasksCoreConstants.ROOT_SCHEDULING_RULE);
- } catch (InvocationTargetException e) {
- throw new CoreException(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to set data directory", //$NON-NLS-1$
- e.getCause()));
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- public void reloadDataDirectory() throws CoreException {
- // no save just load what is there
- setDataDirectory(getDataDirectory());
- }
-
- /**
- * Invoked on startup and when data is loaded from disk or when the data directory changes.
- *
- * <p>
- * Public for testing.
- */
- @SuppressWarnings("restriction")
- public void initializeDataSources() {
- taskDataManager.setDataPath(getDataDirectory());
- externalizationManager.setRootFolderPath(getDataDirectory());
- ContextCorePlugin.getContextStore().setContextDirectory(getContextStoreDir());
-
- externalizationManager.load();
- // TODO: Move management of template repositories to TaskRepositoryManager
- loadTemplateRepositories();
-
- taskActivityManager.clear();
- ContextCorePlugin.getContextManager().loadActivityMetaContext();
- taskActivityMonitor.reloadActivityTime();
- taskActivityManager.reloadPlanningData();
-
- // inform listeners that initialization is complete
- for (final IRepositoryModelListener listener : listeners) {
- SafeRunner.run(new ISafeRunnable() {
-
- public void handleException(Throwable exception) {
- StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, "Listener failed: " //$NON-NLS-1$
- + listener.getClass(), exception));
- }
-
- public void run() throws Exception {
- listener.loaded();
- }
- });
- }
- }
-
- private File getContextStoreDir() {
- File storeFile = new File(getDataDirectory(), ITasksCoreConstants.CONTEXTS_DIRECTORY);
- if (!storeFile.exists()) {
- storeFile.mkdirs();
- }
- return storeFile;
- }
-
- private void initializePreferences(IPreferenceStore store) {
- store.setDefault(ITasksUiPreferenceConstants.PREF_DATA_DIR, getDefaultDataDirectory());
- store.setDefault(ITasksUiPreferenceConstants.GROUP_SUBTASKS, true);
- store.setDefault(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED, true);
- store.setDefault(ITasksUiPreferenceConstants.FILTER_PRIORITY, PriorityLevel.P5.toString());
- store.setDefault(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH, true);
- store.setDefault(ITasksUiPreferenceConstants.ACTIVATE_WHEN_OPENED, false);
- store.setDefault(ITasksUiPreferenceConstants.SHOW_TRIM, false);
- // remove preference
- store.setToDefault(ITasksUiPreferenceConstants.LOCAL_SUB_TASKS_ENABLED);
- store.setDefault(ITasksUiPreferenceConstants.USE_STRIKETHROUGH_FOR_COMPLETED, true);
-
- store.setDefault(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, true);
- store.setDefault(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, "" + (20 * 60 * 1000)); //$NON-NLS-1$
-
- //store.setDefault(TasksUiPreferenceConstants.BACKUP_SCHEDULE, 1);
- store.setDefault(ITasksUiPreferenceConstants.BACKUP_MAXFILES, 20);
- store.setDefault(ITasksUiPreferenceConstants.BACKUP_LAST, 0f);
-
- store.setDefault(ITasksUiPreferenceConstants.FILTER_ARCHIVE_MODE, true);
- store.setDefault(ITasksUiPreferenceConstants.ACTIVATE_MULTIPLE, false);
- store.setValue(ITasksUiPreferenceConstants.ACTIVATE_MULTIPLE, false);
-
- store.setDefault(ITasksUiPreferenceConstants.WEEK_START_DAY, Calendar.getInstance().getFirstDayOfWeek());
- //store.setDefault(TasksUiPreferenceConstants.PLANNING_STARTHOUR, 9);
- store.setDefault(ITasksUiPreferenceConstants.PLANNING_ENDHOUR, 18);
-
- store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true);
- }
-
- public static TaskActivityManager getTaskActivityManager() {
- return taskActivityManager;
- }
-
- public static TaskListNotificationManager getTaskListNotificationManager() {
- return INSTANCE.taskListNotificationManager;
- }
-
- /**
- * Returns the shared instance.
- */
- public static TasksUiPlugin getDefault() {
- return INSTANCE;
- }
-
- public boolean groupSubtasks(ITaskContainer element) {
- boolean groupSubtasks = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.GROUP_SUBTASKS);
-
- if (element instanceof ITask) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind());
- if (connectorUi != null) {
- if (connectorUi.hasStrictSubtaskHierarchy()) {
- groupSubtasks = true;
- }
- }
- }
-
- if (element instanceof IRepositoryQuery) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((IRepositoryQuery) element).getConnectorKind());
- if (connectorUi != null) {
- if (connectorUi.hasStrictSubtaskHierarchy()) {
- groupSubtasks = true;
- }
- }
- }
-
- return groupSubtasks;
- }
-
- private final Map<String, List<IDynamicSubMenuContributor>> menuContributors = new HashMap<String, List<IDynamicSubMenuContributor>>();
-
- public Map<String, List<IDynamicSubMenuContributor>> getDynamicMenuMap() {
- return menuContributors;
- }
-
- public void addDynamicPopupContributor(String menuPath, IDynamicSubMenuContributor contributor) {
- List<IDynamicSubMenuContributor> contributors = menuContributors.get(menuPath);
- if (contributors == null) {
- contributors = new ArrayList<IDynamicSubMenuContributor>();
- menuContributors.put(menuPath, contributors);
- }
- contributors.add(contributor);
- }
-
- public String[] getSaveOptions() {
- String[] options = { TaskListSaveMode.ONE_HOUR.toString(), TaskListSaveMode.THREE_HOURS.toString(),
- TaskListSaveMode.DAY.toString() };
- return options;
- }
-
- public String getBackupFolderPath() {
- return getDataDirectory() + DEFAULT_PATH_SEPARATOR + ITasksCoreConstants.DEFAULT_BACKUP_FOLDER_NAME;
- }
-
- public ITaskHighlighter getHighlighter() {
- return highlighter;
- }
-
- public void setHighlighter(ITaskHighlighter highlighter) {
- this.highlighter = highlighter;
- }
-
- /**
- * @since 3.0
- */
- public AbstractTaskEditorPageFactory[] getTaskEditorPageFactories() {
- return taskEditorPageFactories.toArray(new AbstractTaskEditorPageFactory[0]);
- }
-
- /**
- * @since 3.0
- */
- public void addTaskEditorPageFactory(AbstractTaskEditorPageFactory factory) {
- Assert.isNotNull(factory);
- taskEditorPageFactories.add(factory);
- }
-
- /**
- * @since 3.0
- */
- public void removeTaskEditorPageFactory(AbstractTaskEditorPageFactory factory) {
- Assert.isNotNull(factory);
- taskEditorPageFactories.remove(factory);
- }
-
- public static TaskRepositoryManager getRepositoryManager() {
- return repositoryManager;
- }
-
- /**
- * @since 3.0
- */
- public static RepositoryTemplateManager getRepositoryTemplateManager() {
- return INSTANCE.repositoryTemplateManager;
- }
-
- public void addBrandingIcon(String repositoryType, Image icon) {
- brandingIcons.put(repositoryType, icon);
- }
-
- public Image getBrandingIcon(String repositoryType) {
- return brandingIcons.get(repositoryType);
- }
-
- public void addOverlayIcon(String repositoryType, ImageDescriptor icon) {
- overlayIcons.put(repositoryType, icon);
- }
-
- public ImageDescriptor getOverlayIcon(String repositoryType) {
- return overlayIcons.get(repositoryType);
- }
-
- public void addRepositoryLinkProvider(AbstractTaskRepositoryLinkProvider repositoryLinkProvider) {
- if (repositoryLinkProvider != null) {
- this.repositoryLinkProviders.add(repositoryLinkProvider);
- }
- }
-
- public static TaskListBackupManager getBackupManager() {
- return INSTANCE.taskListBackupManager;
- }
-
- public void addRepositoryConnectorUi(AbstractRepositoryConnectorUi repositoryConnectorUi) {
- if (!repositoryConnectorUiMap.values().contains(repositoryConnectorUi)) {
- repositoryConnectorUiMap.put(repositoryConnectorUi.getConnectorKind(), repositoryConnectorUi);
- }
- }
-
- /**
- * @since 3.0
- */
- public static AbstractRepositoryConnector getConnector(String kind) {
- return getRepositoryManager().getRepositoryConnector(kind);
- }
-
- public static AbstractRepositoryConnectorUi getConnectorUi(String kind) {
- return repositoryConnectorUiMap.get(kind);
- }
-
- public static TaskListSynchronizationScheduler getSynchronizationScheduler() {
- return synchronizationScheduler;
- }
-
- /**
- * @since 3.0
- */
- public static TaskDataManager getTaskDataManager() {
- return taskDataManager;
- }
-
- /**
- * @since 3.0
- */
- public static TaskJobFactory getTaskJobFactory() {
- return INSTANCE.taskJobFactory;
- }
-
- public void addDuplicateDetector(AbstractDuplicateDetector duplicateDetector) {
- Assert.isNotNull(duplicateDetector);
- duplicateDetectors.add(duplicateDetector);
- }
-
- public Set<AbstractDuplicateDetector> getDuplicateSearchCollectorsList() {
- return duplicateDetectors;
- }
-
- public String getRepositoriesFilePath() {
- return getDataDirectory() + File.separator + TaskRepositoryManager.DEFAULT_REPOSITORIES_FILE;
- }
-
- public void addModelListener(IRepositoryModelListener listener) {
- listeners.add(listener);
- }
-
- public void removeModelListener(IRepositoryModelListener listener) {
- listeners.remove(listener);
- }
-
- public boolean canSetRepositoryForResource(final IResource resource) {
- if (resource == null) {
- return false;
- }
-
- // if a repository has already been linked only that provider should be queried to ensure that it is the same
- // provider that is used by getRepositoryForResource()
- final boolean result[] = new boolean[1];
- final boolean found[] = new boolean[1];
- for (final AbstractTaskRepositoryLinkProvider linkProvider : repositoryLinkProviders) {
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Task repository link provider failed: \"" + linkProvider.getId() + "\"", e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void run() throws Exception {
- if (linkProvider.getTaskRepository(resource, getRepositoryManager()) != null) {
- found[0] = true;
- result[0] = linkProvider.canSetTaskRepository(resource);
- }
- }
- });
- if (found[0]) {
- return result[0];
- }
- }
-
- // find a provider that can set new repository
- for (final AbstractTaskRepositoryLinkProvider linkProvider : repositoryLinkProviders) {
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Task repository link provider failed: \"" + linkProvider.getId() + "\"", e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void run() throws Exception {
- if (linkProvider.canSetTaskRepository(resource)) {
- result[0] = true;
- }
- }
- });
- if (result[0]) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Associate a Task Repository with a workbench project
- *
- * @param resource
- * project or resource belonging to a project
- * @param repository
- * task repository to associate with given project
- * @throws CoreException
- */
- public void setRepositoryForResource(final IResource resource, final TaskRepository repository) {
- Assert.isNotNull(resource);
- for (final AbstractTaskRepositoryLinkProvider linkProvider : repositoryLinkProviders) {
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Task repository link provider failed: \"" + linkProvider.getId() + "\"", e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void run() throws Exception {
- boolean canSetRepository = linkProvider.canSetTaskRepository(resource);
- if (canSetRepository) {
- linkProvider.setTaskRepository(resource, repository);
- }
- }
- });
- }
- }
-
- /**
- * Retrieve the task repository that has been associated with the given project (or resource belonging to a project)
- *
- * NOTE: if call does not return in LINK_PROVIDER_TIMEOUT_SECONDS, the provide will be disabled until the next time
- * that the Workbench starts.
- */
- public TaskRepository getRepositoryForResource(final IResource resource) {
- Assert.isNotNull(resource);
- long timeout;
- try {
- timeout = Long.parseLong(System.getProperty(ITasksCoreConstants.PROPERTY_LINK_PROVIDER_TIMEOUT,
- DEFAULT_LINK_PROVIDER_TIMEOUT + "")); //$NON-NLS-1$
- } catch (NumberFormatException e) {
- timeout = DEFAULT_LINK_PROVIDER_TIMEOUT;
- }
- Set<AbstractTaskRepositoryLinkProvider> defectiveLinkProviders = new HashSet<AbstractTaskRepositoryLinkProvider>();
- for (final AbstractTaskRepositoryLinkProvider linkProvider : repositoryLinkProviders) {
- long startTime = System.currentTimeMillis();
- final TaskRepository[] repository = new TaskRepository[1];
- SafeRunnable.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, ID_PLUGIN, "Task repository link provider failed: \"" //$NON-NLS-1$
- + linkProvider.getId() + "\"", e)); //$NON-NLS-1$
- }
-
- public void run() throws Exception {
- repository[0] = linkProvider.getTaskRepository(resource, getRepositoryManager());
- }
- });
- long elapsed = System.currentTimeMillis() - startTime;
- if (timeout >= 0 && elapsed > timeout) {
- defectiveLinkProviders.add(linkProvider);
- }
- if (repository[0] != null) {
- return repository[0];
- }
- }
- if (!defectiveLinkProviders.isEmpty()) {
- repositoryLinkProviders.removeAll(defectiveLinkProviders);
- StatusHandler.log(new Status(IStatus.WARNING, ID_PLUGIN, "Repository link provider took over " + timeout //$NON-NLS-1$
- + " ms to execute and was timed out: \"" + defectiveLinkProviders + "\"")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return null;
- }
-
- public static ExternalizationManager getExternalizationManager() {
- return externalizationManager;
- }
-
- public static TaskActivityMonitor getTaskActivityMonitor() {
- return INSTANCE.taskActivityMonitor;
- }
-
- public static TaskList getTaskList() {
- return taskList;
- }
-
- public static RepositoryModel getRepositoryModel() {
- return repositoryModel;
- }
-
- /**
- * Note: This is provisional API that is used by connectors.
- * <p>
- * DO NOT CHANGE.
- */
- public void addSearchHandler(AbstractSearchHandler searchHandler) {
- searchHandlers.add(searchHandler);
- }
-
- /**
- * Note: This is provisional API that is used by connectors.
- * <p>
- * DO NOT CHANGE.
- */
- public void removeSearchHandler(AbstractSearchHandler searchHandler) {
- searchHandlers.remove(searchHandler);
- }
-
- public AbstractSearchHandler getSearchHandler(String connectorKind) {
- Assert.isNotNull(connectorKind);
- for (AbstractSearchHandler searchHandler : searchHandlers) {
- if (searchHandler.getConnectorKind().equals(connectorKind)) {
- return searchHandler;
- }
- }
- return null;
- }
-
- public FormColors getFormColors(Display display) {
- if (formColors == null) {
- formColors = new FormColors(display);
- formColors.markShared();
- }
- return formColors;
- }
-
- public void removeRepositoryLinkProvider(AbstractTaskRepositoryLinkProvider provider) {
- repositoryLinkProviders.remove(provider);
- }
-
- public TaskListExternalizer createTaskListExternalizer() {
- return new TaskListExternalizer(repositoryModel, repositoryManager);
- }
-
- public static TaskListExternalizationParticipant getTaskListExternalizationParticipant() {
- return taskListExternalizationParticipant;
- }
-
- public static TasksUiFactory getUiFactory() {
- if (uiFactory == null) {
- uiFactory = new TasksUiFactory();
- }
- return uiFactory;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractChangeCompletionAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractChangeCompletionAction.java
deleted file mode 100644
index a0e6c9319..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractChangeCompletionAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Mik Kersten
- */
-public class AbstractChangeCompletionAction extends Action {
-
- protected boolean shouldEnable(List<IRepositoryElement> selectedElements) {
- boolean allLocalTasks = true;
- for (IRepositoryElement abstractTaskContainer : selectedElements) {
- if (!(abstractTaskContainer instanceof ITask)) {
- allLocalTasks = false;
- break;
- } else if (!((AbstractTask) abstractTaskContainer).isLocal()) {
- allLocalTasks = false;
- break;
- }
- }
- return allLocalTasks;
- }
-
- protected String generateMessage(List<AbstractTask> toComplete, String status) {
- String message = MessageFormat.format(Messages.AbstractChangeCompletionAction_Mark_selected_local_tasks_X, status)
- + "\n\n"; //$NON-NLS-1$
- int i = 0;
- for (ITask task : toComplete) {
- i++;
- if (i < 20) {
- message += " "; //$NON-NLS-1$
- if (task.getTaskKey() != null) {
- message += task.getTaskKey() + ": "; //$NON-NLS-1$
- }
- message += task.getSummary() + "\n"; //$NON-NLS-1$
- } else {
- message += "..."; //$NON-NLS-1$
- break;
- }
- }
- return message;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskAction.java
deleted file mode 100644
index d8a6c4a3a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * @author Rob Elves
- */
-public abstract class AbstractTaskAction extends Action {
-
- protected List<IRepositoryElement> selectedElements;
-
- @Override
- public void run() {
- for (IRepositoryElement element : selectedElements) {
- if (element instanceof ITask) {
- AbstractTask repositoryTask = (AbstractTask) element;
- performActionOnTask(repositoryTask);
- } else if (element instanceof IRepositoryQuery) {
- RepositoryQuery repositoryQuery = (RepositoryQuery) element;
- for (ITask queryHit : repositoryQuery.getChildren()) {
- performActionOnTask(queryHit);
- }
- } else if (element instanceof ITaskContainer) {
- ITaskContainer container = (ITaskContainer) element;
- for (ITask task : container.getChildren()) {
- if (task != null) {
- ITask repositoryTask = task;
- performActionOnTask(repositoryTask);
- }
- }
- }
- }
- }
-
- protected abstract void performActionOnTask(ITask repositoryTask);
-
- protected boolean containsArchiveContainer(List<AbstractTaskContainer> selectedElements) {
- return false;//selectedElements.contains(TasksUiPlugin.getTaskList().getArchiveContainer());
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskEditorAction.java
deleted file mode 100644
index 2c1e11508..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskEditorAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Rob Elves
- */
-public abstract class AbstractTaskEditorAction extends BaseSelectionListenerAction {
-
- protected TaskEditor editor;
-
- public AbstractTaskEditorAction(String text) {
- super(text);
- }
-
- public void setEditor(TaskEditor taskEditor) {
- this.editor = taskEditor;
- }
-
- protected boolean taskDirty(ITask task) {
- return (((editor != null && editor.isDirty())
- || task.getSynchronizationState().equals(SynchronizationState.OUTGOING) || task.getSynchronizationState()
- .equals(SynchronizationState.CONFLICT)));
-
- }
-
- protected void openInformationDialog(String label, String text) {
-
- Shell shell = null;
- if (editor != null) {
- shell = editor.getSite().getShell();
- }
- MessageDialog.openInformation(shell, label, text);
- if (editor != null) {
- editor.showBusy(false);
- }
- return;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskRepositoryAction.java
deleted file mode 100644
index 438618d30..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AbstractTaskRepositoryAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Shawn Minto
- * @author Steffen Pingel
- */
-public abstract class AbstractTaskRepositoryAction extends BaseSelectionListenerAction {
-
- private boolean singleSelect;
-
- public AbstractTaskRepositoryAction(String text) {
- super(text);
- }
-
- @Override
- protected boolean updateSelection(IStructuredSelection selection) {
- if (selection != null && !selection.isEmpty()) {
- if (singleSelect) {
- Object[] array = selection.toArray();
- if (array.length != 1) {
- return false;
- }
- }
- return getTaskRepository(selection.getFirstElement()) != null;
- }
- return false;
- }
-
- protected TaskRepository getTaskRepository(IStructuredSelection selection) {
- if (selection != null && !selection.isEmpty()) {
- return getTaskRepository(selection.getFirstElement());
- }
- return null;
- }
-
- protected TaskRepository getTaskRepository(Object selectedObject) {
- TaskRepository taskRepository = null;
- if (selectedObject instanceof TaskRepository) {
- taskRepository = (TaskRepository) selectedObject;
- } else if (selectedObject instanceof IRepositoryQuery) {
- IRepositoryQuery query = (IRepositoryQuery) selectedObject;
- taskRepository = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(),
- query.getRepositoryUrl());
- }
-
- if (taskRepository != null && isUserManaged(taskRepository)) {
- return taskRepository;
- }
- return null;
- }
-
- protected boolean isUserManaged(TaskRepository taskRepository) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskRepository.getConnectorKind());
- return connector != null && connector.isUserManaged();
- }
-
- protected boolean isSingleSelect() {
- return singleSelect;
- }
-
- protected void setSingleSelect(boolean singleSelect) {
- this.singleSelect = singleSelect;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java
deleted file mode 100644
index 28f3f340c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskDialogAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * @author Willian Mitsuda
- * @author Mik Kersten
- */
-public class ActivateTaskDialogAction extends ActionDelegate implements IWorkbenchWindowActionDelegate {
-
- private IWorkbenchWindow window;
-
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- @Override
- public void run(IAction action) {
- TaskSelectionDialog dlg = new TaskSelectionDialog(window.getShell());
- dlg.setTitle(Messages.ActivateTaskDialogAction_Activate_Task);
- dlg.setMessage(Messages.ActivateTaskDialogAction_Select_a_task_to_activate__);
-
- if (dlg.open() != Window.OK) {
- return;
- }
-
- Object result = dlg.getFirstResult();
- if (result instanceof ITask) {
- AbstractTask task = (AbstractTask) result;
- TasksUi.getTaskActivityManager().activateTask(task);
-// manager.getTaskActivationHistory().addTask(task);
- }
- if (TaskListView.getFromActivePerspective() != null) {
- TaskListView.getFromActivePerspective().refresh();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskHistoryDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskHistoryDropDownAction.java
deleted file mode 100644
index 95afd166b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ActivateTaskHistoryDropDownAction.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
-import org.eclipse.mylyn.internal.tasks.ui.TaskHistoryDropDown;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;
-
-/**
- * @author Wesley Coelho
- * @author Mik Kersten
- * @author Leo Dos Santos
- * @author Steffen Pingel
- */
-public class ActivateTaskHistoryDropDownAction extends Action implements IWorkbenchWindowPulldownDelegate, IMenuCreator {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.navigate.previous"; //$NON-NLS-1$
-
- private Menu dropDownMenu;
-
- private final TaskActivationHistory taskHistory;
-
- private final TaskHistoryDropDown taskHistoryDropDown;
-
- public ActivateTaskHistoryDropDownAction() {
- this.taskHistory = TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory();
- this.taskHistoryDropDown = new TaskHistoryDropDown(null, taskHistory);
- setText(Messages.ActivateTaskHistoryDropDownAction_Activate_Previous_Task);
- setToolTipText(Messages.ActivateTaskHistoryDropDownAction_Activate_Previous_Task);
- setId(ID);
- setEnabled(true);
- setImageDescriptor(TasksUiImages.CONTEXT_HISTORY_PREVIOUS);
- }
-
- public void dispose() {
- // ignore
- }
-
- public Menu getMenu(Control parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- taskHistoryDropDown.fill(dropDownMenu, -1);
- return dropDownMenu;
- }
-
- public Menu getMenu(Menu parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- taskHistoryDropDown.fill(dropDownMenu, -1);
- return dropDownMenu;
- }
-
- public void init(IWorkbenchWindow window) {
- // ignore
- }
-
- @Override
- public void run() {
- if (taskHistory.hasPrevious()) {
- AbstractTask previousTask = taskHistory.getPreviousTask();
- if (previousTask != null && !previousTask.isActive()) {
- TasksUiPlugin.getTaskActivityManager().activateTask(previousTask);
- if (TaskListView.getFromActivePerspective() != null) {
- TaskListView.getFromActivePerspective().refresh();
- }
- }
- setEnabled(taskHistory.getPreviousTasks() != null && taskHistory.getPreviousTasks().size() > 0);
- }
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AddRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AddRepositoryAction.java
deleted file mode 100644
index 9c239d923..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/AddRepositoryAction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Balazs Brinkus - bug 174473
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.ITaskCommandIds;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class AddRepositoryAction extends Action {
-
- private static final String PREF_ADD_QUERY = "org.eclipse.mylyn.internal.tasks.add.query"; //$NON-NLS-1$
-
- private static final String ID = "org.eclipse.mylyn.tasklist.repositories.add"; //$NON-NLS-1$
-
- public static final String TITLE = Messages.AddRepositoryAction_Add_Task_Repository;
-
- private boolean promptToAddQuery = true;
-
- public AddRepositoryAction() {
- setImageDescriptor(TasksUiImages.REPOSITORY_NEW);
- setText(TITLE);
- setId(ID);
- setEnabled(TasksUiPlugin.getRepositoryManager().hasUserManagedRepositoryConnectors());
- }
-
- public boolean getPromptToAddQuery() {
- return promptToAddQuery;
- }
-
- public void setPromptToAddQuery(boolean promptToAddQuery) {
- this.promptToAddQuery = promptToAddQuery;
- }
-
- @Override
- public void run() {
- showWizard();
- }
-
- public TaskRepository showWizard() {
- IHandlerService handlerSvc = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
- try {
- Object result = handlerSvc.executeCommand(ITaskCommandIds.ADD_TASK_REPOSITORY, null);
- if (result instanceof TaskRepository) {
- if (getPromptToAddQuery()) {
- TaskRepository repository = (TaskRepository) result;
- AbstractRepositoryConnector connector = TasksUiPlugin.getConnector(repository.getConnectorKind());
- if (connector != null && connector.canQuery(repository)) {
- promptToAddQuery(repository);
- }
- }
- return (TaskRepository) result;
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- return null;
- }
-
- public void promptToAddQuery(TaskRepository taskRepository) {
- IPreferenceStore preferenceStore = TasksUiPlugin.getDefault().getPreferenceStore();
- if (!preferenceStore.getBoolean(PREF_ADD_QUERY)) {
- Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
- MessageDialogWithToggle messageDialog = MessageDialogWithToggle.openYesNoQuestion(shell,
- Messages.AddRepositoryAction_Add_new_query,
- Messages.AddRepositoryAction_Add_a_query_to_the_Task_List,
- Messages.AddRepositoryAction_Do_not_show_again, false, preferenceStore, PREF_ADD_QUERY);
- preferenceStore.setValue(PREF_ADD_QUERY, messageDialog.getToggleState());
- if (messageDialog.getReturnCode() == IDialogConstants.YES_ID) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
- IWizard queryWizard = connectorUi.getQueryWizard(taskRepository, null);
- ((Wizard) queryWizard).setForcePreviousAndNextButtons(true);
-
- WizardDialog queryDialog = new WizardDialog(shell, queryWizard);
- queryDialog.create();
- queryDialog.setBlockOnOpen(true);
- queryDialog.open();
- }
- }
-
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java
deleted file mode 100644
index e43a91689..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ClearOutgoingAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-
-/**
- * Discard outgoing changes on selected task TODO: Enable multi task discard?
- *
- * @author Rob Elves
- */
-public class ClearOutgoingAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.mark.discard"; //$NON-NLS-1$
-
- private final List<IRepositoryElement> selectedElements;
-
- private AbstractTaskEditorPage taskEditorPage;
-
- public ClearOutgoingAction(List<IRepositoryElement> selectedElements) {
- this.selectedElements = selectedElements;
- setText(Messages.ClearOutgoingAction_Clear_outgoing);
- setToolTipText(Messages.ClearOutgoingAction_Clear_outgoing);
- setImageDescriptor(CommonImages.CLEAR);
- setId(ID);
- if (selectedElements.size() == 1 && (selectedElements.get(0) instanceof ITask)) {
- ITask task = (ITask) selectedElements.get(0);
- setEnabled(hasOutgoingChanges(task));
- } else {
- setEnabled(false);
- }
- }
-
- public AbstractTaskEditorPage getTaskEditorPage() {
- return taskEditorPage;
- }
-
- public void setTaskEditorPage(AbstractTaskEditorPage taskEditorPage) {
- this.taskEditorPage = taskEditorPage;
- }
-
- public static boolean hasOutgoingChanges(ITask task) {
- return task.getSynchronizationState().equals(SynchronizationState.OUTGOING)
- || task.getSynchronizationState().equals(SynchronizationState.CONFLICT);
- }
-
- @Override
- public void run() {
- ArrayList<AbstractTask> toClear = new ArrayList<AbstractTask>();
- for (Object selectedObject : selectedElements) {
- if (selectedObject instanceof ITask && hasOutgoingChanges((ITask) selectedObject)) {
- toClear.add(((AbstractTask) selectedObject));
- }
- }
- if (toClear.size() > 0) {
- AbstractTask task = toClear.get(0);
- boolean confirm = MessageDialog.openConfirm(
- null,
- Messages.ClearOutgoingAction_Confirm_discard, Messages.ClearOutgoingAction_Discard_all_outgoing_changes_ + "\n\n" //$NON-NLS-1$
- + task.getSummary());
- if (confirm) {
- if (taskEditorPage != null) {
- taskEditorPage.doSave(null);
- }
- try {
- TasksUi.getTaskDataManager().discardEdits(task);
- } catch (CoreException e) {
- TasksUiInternal.displayStatus(
- Messages.ClearOutgoingAction_Clear_outgoing_failed, e.getStatus());
- }
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CloneTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CloneTaskAction.java
deleted file mode 100644
index 0f560bdba..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CloneTaskAction.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Maarten Meijer - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.DefaultTaskMapping;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Maarten Meijer
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class CloneTaskAction extends BaseSelectionListenerAction implements IViewActionDelegate {
-
- private static final String ID = "org.eclipse.mylyn.tasklist.actions.clone"; //$NON-NLS-1$
-
- protected ISelection selection;
-
- public CloneTaskAction() {
- super(Messages.CloneTaskAction_Clone_This_Task);
- setId(ID);
- setImageDescriptor(TasksUiImages.TASK_NEW);
- setAccelerator(SWT.MOD1 + 'd');
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- super.selectionChanged((IStructuredSelection) selection);
- }
- }
-
- public void run(IAction action) {
- run();
- }
-
- @Override
- public void run() {
- for (Object selectedObject : getStructuredSelection().toList()) {
- if (selectedObject instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) selectedObject;
-
- String description = Messages.CloneTaskAction_Cloned_from_ + CopyTaskDetailsAction.getTextForTask(task);
- if (task instanceof LocalTask) {
- String notes = task.getNotes();
- if (!"".equals(notes)) { //$NON-NLS-1$
- description += "\n\n" + notes; //$NON-NLS-1$
- }
- }
-
- ITaskMapping taskSelection = new DefaultTaskMapping();
- ((DefaultTaskMapping) taskSelection).setDescription(description);
-
- TaskData taskData;
- try {
- taskData = TasksUi.getTaskDataManager().getTaskData(task);
- } catch (CoreException e) {
- TasksUiInternal.displayStatus(Messages.CloneTaskAction_Clone_Task_Failed, e.getStatus());
- continue;
- }
-
- if (taskData != null) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(taskData.getConnectorKind());
- ITaskMapping mapping = connector.getTaskMapping(taskData);
- if (mapping.getDescription() != null) {
- ((DefaultTaskMapping) taskSelection).setDescription(description + "\n\n" //$NON-NLS-1$
- + mapping.getDescription());
- }
- mapping.merge(taskSelection);
- taskSelection = mapping;
- }
-
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (!TasksUiUtil.openNewTaskEditor(shell, taskSelection, null)) {
- // do not process other tasks if canceled
- return;
- }
- }
- }
- }
-
- public void init(IViewPart view) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CollapseAllAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CollapseAllAction.java
deleted file mode 100644
index 7da5d31d4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CollapseAllAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-
-/**
- * @author Mik Kersten
- */
-public class CollapseAllAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.collapse.all"; //$NON-NLS-1$
-
- private final TaskListView taskListView;
-
- public CollapseAllAction(TaskListView taskListView) {
- super(Messages.CollapseAllAction_Collapse_All);
- this.taskListView = taskListView;
- setId(ID);
- setText(Messages.CollapseAllAction_Collapse_All);
- setToolTipText(Messages.CollapseAllAction_Collapse_All);
- setImageDescriptor(CommonImages.COLLAPSE_ALL);
- }
-
- @Override
- public void run() {
- if (taskListView.getViewer() != null) {
- taskListView.getViewer().collapseAll();
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CommentActionGroup.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CommentActionGroup.java
deleted file mode 100644
index 0b7835552..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CommentActionGroup.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.ActionGroup;
-
-/**
- * @author Steffen Pingel
- */
-public class CommentActionGroup extends ActionGroup {
-
- private CopyCommentDetailsAction copyDetailsAction;
-
- private boolean initialized;
-
- private void initialize() {
- if (initialized) {
- return;
- }
- initialized = true;
- copyDetailsAction = new CopyCommentDetailsAction();
- }
-
- @Override
- public void fillContextMenu(IMenuManager manager) {
- updateActions();
- manager.add(copyDetailsAction);
- }
-
- private void updateActions() {
- initialize();
- IStructuredSelection selection = getStructuredSelection();
- copyDetailsAction.selectionChanged(selection);
- }
-
- public IStructuredSelection getStructuredSelection() {
- ActionContext context = getContext();
- if (context != null) {
- ISelection selection = context.getSelection();
- if (selection instanceof IStructuredSelection) {
- return (IStructuredSelection) selection;
- }
- }
- return StructuredSelection.EMPTY;
- }
-
- @Override
- public void dispose() {
- super.dispose();
- if (copyDetailsAction != null) {
- copyDetailsAction.dispose();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CompareAttachmentsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CompareAttachmentsAction.java
deleted file mode 100644
index fa60a2717..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CompareAttachmentsAction.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.IStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-import org.eclipse.ui.internal.WorkbenchImages;
-
-/**
- * @author Eugene Kuleshov
- */
-public class CompareAttachmentsAction extends BaseSelectionListenerAction implements IViewActionDelegate {
-
- private ISelection currentSelection;
-
- public CompareAttachmentsAction() {
- super(Messages.CompareAttachmentsAction_Compare_Attachments);
- }
-
- protected CompareAttachmentsAction(String text) {
- super(text);
- }
-
- public void init(IViewPart view) {
- // ignore
- }
-
- public void run(IAction action) {
- if (currentSelection instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) currentSelection;
- Object[] elements = selection.toArray();
- if (elements.length >= 2) {
- final ITaskAttachment attachment1 = (ITaskAttachment) elements[0];
- final ITaskAttachment attachment2 = (ITaskAttachment) elements[1];
-
- CompareConfiguration cc = new CompareConfiguration();
-
- cc.setLeftEditable(false);
- cc.setLeftLabel(attachment1.getFileName());
- cc.setLeftImage(getImage(attachment1));
-
- cc.setRightEditable(false);
- cc.setRightLabel(attachment2.getFileName());
- cc.setRightImage(getImage(attachment2));
-
- CompareEditorInput editorInput = new CompareEditorInput(cc) {
-
- @Override
- public String getTitle() {
- return Messages.CompareAttachmentsAction_Compare__ + attachment1.getFileName() + " - " + attachment2.getFileName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected Object prepareInput(IProgressMonitor pm) throws InvocationTargetException {
- CompareItem left = new CompareItem(attachment1);
- CompareItem right = new CompareItem(attachment2);
- return new DiffNode(left, right);
- }
-
- };
-
- CompareUI.openCompareEditor(editorInput);
- }
- }
- }
-
- private static final String[] IMAGE_EXTENSIONS = { ".jpg", ".gif", ".png", ".tiff", ".tif", ".bmp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-
- private Image getImage(ITaskAttachment attachment) {
- if (AttachmentUtil.isContext(attachment)) {
- return CommonImages.getImage(TasksUiImages.CONTEXT_TRANSFER);
- } else if (attachment.isPatch()) {
- return CommonImages.getImage(TasksUiImages.TASK_ATTACHMENT_PATCH);
- } else {
- String filename = attachment.getFileName();
- if (filename != null) {
- filename = filename.toLowerCase();
- for (String extension : IMAGE_EXTENSIONS) {
- if (filename.endsWith(extension)) {
- return CommonImages.getImage(CommonImages.IMAGE_FILE);
- }
- }
- }
- return WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FILE);
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- this.currentSelection = selection;
- }
-
- private class CompareItem implements IStreamContentAccessor, ITypedElement {
-
- private final ITaskAttachment attachment;
-
- public CompareItem(ITaskAttachment attachment) {
- this.attachment = attachment;
- }
-
- public InputStream getContents() throws CoreException {
- TaskAttribute attachmentAttribute = attachment.getTaskAttribute();
- if (attachmentAttribute == null) {
- throw new CoreException(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.CompareAttachmentsAction_Failed_to_find_attachment + attachment.getUrl()));
- }
- TaskRepository taskRepository = attachment.getTaskRepository();
- ITask task = attachment.getTask();
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskRepository.getConnectorKind());
- AbstractTaskAttachmentHandler handler = connector.getTaskAttachmentHandler();
- return handler.getContent(taskRepository, task, attachmentAttribute, new NullProgressMonitor());
- }
-
- public Image getImage() {
- return null;
- }
-
- public String getName() {
- return attachment.getFileName();
- }
-
- public String getType() {
- // ImageMergeViewerCreator - gif,jpg,jpeg,png,bmp,ico,tif,tiff
- // BinaryCompareViewerCreator - class,exe,dll,binary,zip,jar
- // TextMergeViewerCreator - txt
- // PropertiesFileMergeViewerCreator - properties,properties2
- // JavaContentViewerCreator - java,java2"
- // RefactoringDescriptorCompareViewerCreator - refactoring_descriptor
- //
- String filename = attachment.getFileName();
- int n = filename.lastIndexOf('.');
- if (n > -1) {
- return filename.substring(n + 1);
- }
- return ITypedElement.TEXT_TYPE;
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java
deleted file mode 100644
index 0cea6397f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.util.ClipboardCopier;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Steffen Pingel
- */
-public class CopyCommentDetailsAction extends BaseSelectionListenerAction {
-
- private final ClipboardCopier copier;
-
- public CopyCommentDetailsAction() {
- super(Messages.CopyCommentDetailsAction_Copy_User_ID);
- setToolTipText(Messages.CopyCommentDetailsAction_Copy_User_ID_Tooltip);
- setImageDescriptor(CommonImages.COPY);
- copier = new ClipboardCopier() {
- @Override
- protected String getTextForElement(Object element) {
- if (element instanceof ITaskComment) {
- ITaskComment comment = (ITaskComment) element;
- IRepositoryPerson author = comment.getAuthor();
- if (author != null) {
- return author.getPersonId();
- }
- }
- return null;
- }
- };
- }
-
- @Override
- public void run() {
- copier.copy(getStructuredSelection());
- }
-
- public void dispose() {
- copier.dispose();
-
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
deleted file mode 100644
index afa336899..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.ui.util.ClipboardCopier;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Mik Kersten
- */
-public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.copy"; //$NON-NLS-1$
-
- private final ClipboardCopier copier;
-
- public CopyTaskDetailsAction() {
- super(Messages.CopyTaskDetailsAction_Copy_Details);
- setToolTipText(Messages.CopyTaskDetailsAction_Copy_Details);
- setId(ID);
- setImageDescriptor(CommonImages.COPY);
- this.copier = new ClipboardCopier() {
- @Override
- protected String getTextForElement(Object element) {
- return getTextForTask(element);
- }
- };
- }
-
- @Override
- public void run() {
- copier.copy(getStructuredSelection());
- }
-
- public void dispose() {
- copier.dispose();
- }
-
- // TODO move to TasksUiUtil / into core
- public static String getTextForTask(Object object) {
- StringBuffer sb = new StringBuffer();
- if (object instanceof ITask) {
- AbstractTask task = (AbstractTask) object;
- if (task.getTaskKey() != null) {
- sb.append(task.getTaskKey());
- sb.append(": "); //$NON-NLS-1$
- }
-
- sb.append(task.getSummary());
- if (TasksUiInternal.isValidUrl(task.getUrl())) {
- sb.append(ClipboardCopier.LINE_SEPARATOR);
- sb.append(task.getUrl());
- }
- } else if (object instanceof IRepositoryQuery) {
- RepositoryQuery query = (RepositoryQuery) object;
- sb.append(query.getSummary());
- if (TasksUiInternal.isValidUrl(query.getUrl())) {
- sb.append(ClipboardCopier.LINE_SEPARATOR);
- sb.append(query.getUrl());
- }
- } else if (object instanceof IRepositoryElement) {
- IRepositoryElement element = (IRepositoryElement) object;
- sb.append(element.getSummary());
- }
- return sb.toString();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeactivateAllTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeactivateAllTasksAction.java
deleted file mode 100644
index 548403c06..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeactivateAllTasksAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * @author Willian Mitsuda
- */
-public class DeactivateAllTasksAction extends ActionDelegate implements IWorkbenchWindowActionDelegate {
-
- public void init(IWorkbenchWindow window) {
- // ignore
- }
-
- @Override
- public void run(IAction action) {
- TasksUi.getTaskActivityManager().deactivateActiveTask();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
deleted file mode 100644
index b04a9bd75..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonsUiUtil;
-import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AutomaticRepositoryTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * @author Mik Kersten
- */
-public class DeleteAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.delete"; //$NON-NLS-1$
-
- public DeleteAction() {
- setText(Messages.DeleteAction_Delete);
- setId(ID);
- setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
- }
-
- @Override
- public void run() {
- ISelection selection = TaskListView.getFromActivePerspective().getViewer().getSelection();
- doDelete(((IStructuredSelection) selection).toList());
- }
-
- protected void doDelete(final List<?> toDelete) {
- String elements = ""; //$NON-NLS-1$
- int i = 0;
- for (Object object : toDelete) {
- if (object instanceof UnmatchedTaskContainer) {
- continue;
- }
-
- i++;
- if (i < 20) {
- // TODO this action should be based on the action enablement and check if the container is user managed or not
- if (object instanceof IRepositoryElement) {
- elements += " " + ((IRepositoryElement) object).getSummary() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- elements += "..."; //$NON-NLS-1$
- break;
- }
- }
-
- String message;
-
- if (toDelete.size() == 1) {
- Object object = toDelete.get(0);
- if (object instanceof ITask) {
- if (((AbstractTask) object).isLocal()) {
- message = Messages.DeleteAction_Permanently_delete_the_task_listed_below;
- } else {
- message = Messages.DeleteAction_Delete_the_planning_information_and_context_for_the_repository_task;
- }
- } else if (object instanceof TaskCategory) {
- message = Messages.DeleteAction_Permanently_delete_the_category;
- } else if (object instanceof IRepositoryQuery) {
- message = Messages.DeleteAction_Permanently_delete_the_query;
- } else if (object instanceof UnmatchedTaskContainer) {
- message = Messages.DeleteAction_Delete_the_planning_information_and_context_of_all_unmatched_tasks;
- } else if (object instanceof UnsubmittedTaskContainer) {
- message = Messages.DeleteAction_Delete_all_of_the_unsubmitted_tasks;
- } else {
- message = Messages.DeleteAction_Permanently_delete_the_element_listed_below;
- }
- } else {
- message = Messages.DeleteAction_Delete_the_elements_listed_below;
- }
-
- message += "\n\n" + elements; //$NON-NLS-1$
-
- if (toDelete.isEmpty()) {
- MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.DeleteAction_Delete_failed, Messages.DeleteAction_Nothing_selected);
- } else {
- boolean deleteConfirmed = MessageDialog.openQuestion(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(), Messages.DeleteAction_Confirm_Delete, message);
- if (deleteConfirmed) {
- ICoreRunnable op = new ICoreRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(Messages.DeleteAction_Delete_in_progress, IProgressMonitor.UNKNOWN);
- prepareDeletion(toDelete);
- TasksUiPlugin.getTaskList().run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- performDeletion(toDelete);
- }
- }, monitor);
- } finally {
- monitor.done();
- }
- }
- };
- try {
- CommonsUiUtil.runInUi(op, null);
- } catch (CoreException e) {
- Status status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Problems encountered deleting task list elements: {0}", e.getMessage()), e); //$NON-NLS-1$
- TasksUiInternal.logAndDisplayStatus(
- Messages.DeleteTaskRepositoryAction_Delete_Task_Repository_Failed, status);
- } catch (OperationCanceledException e) {
- // canceled
- }
- }
- }
- }
-
- public static void prepareDeletion(Collection<?> toDelete) {
- for (Object selectedObject : toDelete) {
- if (selectedObject instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) selectedObject;
- TasksUi.getTaskActivityManager().deactivateTask(task);
- TasksUiInternal.closeTaskEditorInAllPages(task, false);
- } else if (selectedObject instanceof AutomaticRepositoryTaskContainer) {
- // support both the unmatched and the unsubmitted
- if (toDelete.size() == 1) {
- prepareDeletion(((AutomaticRepositoryTaskContainer) selectedObject).getChildren());
- }
- }
- }
- }
-
- public static void performDeletion(Collection<?> toDelete) {
- for (Object selectedObject : toDelete) {
- if (selectedObject instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) selectedObject;
- TasksUiInternal.getTaskList().deleteTask(task);
- try {
- TasksUiPlugin.getTaskDataManager().deleteTaskData(task);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to delete task data", //$NON-NLS-1$
- e));
- }
- ContextCore.getContextManager().deleteContext(task.getHandleIdentifier());
- } else if (selectedObject instanceof IRepositoryQuery) {
- TasksUiInternal.getTaskList().deleteQuery((RepositoryQuery) selectedObject);
- } else if (selectedObject instanceof TaskCategory) {
- TasksUiInternal.getTaskList().deleteCategory((TaskCategory) selectedObject);
- } else if (selectedObject instanceof AutomaticRepositoryTaskContainer) {
- // support both the unmatched and the unsubmitted
- if (toDelete.size() == 1) {
- // loop to ensure that all subtasks are deleted as well
- performDeletion(((AutomaticRepositoryTaskContainer) selectedObject).getChildren());
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskEditorAction.java
deleted file mode 100644
index 01277ff59..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskEditorAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Collections;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Mik Kersten
- */
-public class DeleteTaskEditorAction extends DeleteAction {
-
- private final ITask task;
-
- public DeleteTaskEditorAction(ITask task) {
- this.task = task;
- //setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- setImageDescriptor(CommonImages.REMOVE);
- }
-
- @Override
- public void run() {
- doDelete(Collections.singletonList(task));
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskRepositoryAction.java
deleted file mode 100644
index db5a93140..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteTaskRepositoryAction.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonsUiUtil;
-import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TaskRepositoryUtil;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * @author Mik Kersten
- * @author David Shepherd
- * @author Steffen Pingel
- */
-public class DeleteTaskRepositoryAction extends AbstractTaskRepositoryAction {
-
- private static final String ID = "org.eclipse.mylyn.tasklist.repositories.delete"; //$NON-NLS-1$
-
- public DeleteTaskRepositoryAction() {
- super(Messages.DeleteTaskRepositoryAction_Delete_Repository);
- setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- setId(ID);
- setEnabled(false);
- setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
- setSingleSelect(true);
- }
-
- public void init(IViewPart view) {
- // ignore
- }
-
- @Override
- public void run() {
- final TaskRepository repositoryToDelete = getTaskRepository(getStructuredSelection());
- if (repositoryToDelete == null) {
- return;
- }
- final List<IRepositoryQuery> queriesToDelete = new ArrayList<IRepositoryQuery>();
- final List<AbstractTask> tasksToDelete = new ArrayList<AbstractTask>();
-
- // check for queries over this repository
- Set<RepositoryQuery> queries = TasksUiInternal.getTaskList().getQueries();
- for (IRepositoryQuery query : queries) {
- if (repositoryToDelete.getRepositoryUrl().equals(query.getRepositoryUrl())
- && repositoryToDelete.getConnectorKind().equals(query.getConnectorKind())) {
- queriesToDelete.add(query);
- }
- }
-
- // check for tasks from this repository
- final Set<ITask> tasks = TasksUiPlugin.getTaskList().getTasks(repositoryToDelete.getRepositoryUrl());
- for (ITask task : tasks) {
- if (repositoryToDelete.getRepositoryUrl().equals(task.getRepositoryUrl())
- && repositoryToDelete.getConnectorKind().equals(task.getConnectorKind())) {
- tasksToDelete.add((AbstractTask) task);
- }
- }
-
- // add unsubmitted tasks
- UnsubmittedTaskContainer unsubmitted = TasksUiPlugin.getTaskList().getUnsubmittedContainer(
- repositoryToDelete.getRepositoryUrl());
- if (unsubmitted != null) {
- Collection<ITask> children = unsubmitted.getChildren();
- if (children != null) {
- for (ITask task : children) {
- tasksToDelete.add((AbstractTask) task);
- }
- }
- }
-
- // confirm that the user wants to delete all tasks and queries that are associated
- boolean deleteConfirmed;
- if (queriesToDelete.size() > 0 || tasksToDelete.size() > 0) {
- deleteConfirmed = MessageDialog.openQuestion(TasksUiInternal.getShell(),
- Messages.DeleteTaskRepositoryAction_Confirm_Delete, NLS.bind(
- Messages.DeleteTaskRepositoryAction_Delete_the_selected_task_repositories, new Integer[] {
- tasksToDelete.size(), queriesToDelete.size() }));
- } else {
- deleteConfirmed = MessageDialog.openQuestion(TasksUiInternal.getShell(),
- Messages.DeleteTaskRepositoryAction_Confirm_Delete, NLS.bind(
- Messages.DeleteTaskRepositoryAction_Delete_Specific_Task_Repository,
- new String[] { repositoryToDelete.getRepositoryLabel() }));
-
- }
- if (deleteConfirmed) {
- ICoreRunnable op = new ICoreRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(Messages.DeleteTaskRepositoryAction_Delete_Repository_In_Progress,
- IProgressMonitor.UNKNOWN);
- DeleteAction.prepareDeletion(tasksToDelete);
- DeleteAction.prepareDeletion(queriesToDelete);
- TasksUiPlugin.getTaskList().run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- // delete tasks
- DeleteAction.performDeletion(tasksToDelete);
- // delete queries
- DeleteAction.performDeletion(queriesToDelete);
- // delete repository
- TasksUiPlugin.getRepositoryManager().removeRepository(repositoryToDelete,
- TasksUiPlugin.getDefault().getRepositoriesFilePath());
- // if repository is contributed via template, ensure it isn't added again
- TaskRepositoryUtil.disableAddAutomatically(repositoryToDelete.getRepositoryUrl());
- }
- }, monitor);
- } finally {
- monitor.done();
- }
- }
- };
- try {
- CommonsUiUtil.runInUi(op, null);
- } catch (CoreException e) {
- Status status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Problems encountered deleting task repository: {0}", e.getMessage()), e); //$NON-NLS-1$
- TasksUiInternal.logAndDisplayStatus(Messages.DeleteTaskRepositoryAction_Delete_Task_Repository_Failed,
- status);
- } catch (OperationCanceledException e) {
- // canceled
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DisconnectRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DisconnectRepositoryAction.java
deleted file mode 100644
index c4708784f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DisconnectRepositoryAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.Messages;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Steffen Pingel
- */
-public class DisconnectRepositoryAction extends Action implements ISelectionChangedListener {
-
- public static final String LABEL = Messages.DisconnectRepositoryAction_Disconnected;
-
- private static final String ID = "org.eclipse.mylyn.tasklist.repositories.offline"; //$NON-NLS-1$
-
- private TaskRepository repository;
-
- public DisconnectRepositoryAction() {
- super(LABEL, IAction.AS_CHECK_BOX);
- setId(ID);
- setEnabled(false);
- }
-
- @Override
- public void run() {
- repository.setOffline(isChecked());
- TasksUiPlugin.getRepositoryManager().notifyRepositorySettingsChanged(repository);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- Object selectedObject = ((IStructuredSelection) selection).getFirstElement();
- if (selectedObject instanceof TaskRepository) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- ((TaskRepository) selectedObject).getConnectorKind());
- if (connector.isUserManaged()) {
- this.repository = (TaskRepository) selectedObject;
- setChecked(this.repository.isOffline());
- setEnabled(true);
- return;
- }
- }
- }
- this.repository = null;
- setChecked(false);
- setEnabled(false);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/EditRepositoryPropertiesAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/EditRepositoryPropertiesAction.java
deleted file mode 100644
index 4d0e63c75..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/EditRepositoryPropertiesAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class EditRepositoryPropertiesAction extends AbstractTaskRepositoryAction implements IViewActionDelegate {
-
- private static final String ID = "org.eclipse.mylyn.tasklist.repositories.properties"; //$NON-NLS-1$
-
- public EditRepositoryPropertiesAction() {
- super(Messages.EditRepositoryPropertiesAction_Properties);
- setId(ID);
- setEnabled(false);
- }
-
- @Override
- public void run() {
- TaskRepository taskRepository = getTaskRepository(getStructuredSelection());
- if (taskRepository != null) {
- TasksUiUtil.openEditRepositoryWizard(taskRepository);
- }
- }
-
- public void init(IViewPart view) {
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- selectionChanged((IStructuredSelection) selection);
- action.setEnabled(this.isEnabled());
- } else {
- clearCache();
- action.setEnabled(false);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExpandAllAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExpandAllAction.java
deleted file mode 100644
index 601872225..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExpandAllAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-
-/**
- * @author Mik Kersten
- */
-public class ExpandAllAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.expand.all"; //$NON-NLS-1$
-
- private final TaskListView taskListView;
-
- public ExpandAllAction(TaskListView taskListView) {
- this.taskListView = taskListView;
- setId(ID);
- setText(Messages.ExpandAllAction_Expand_All);
- setToolTipText(Messages.ExpandAllAction_Expand_All);
- setImageDescriptor(CommonImages.EXPAND_ALL);
- }
-
- @Override
- public void run() {
- if (taskListView.getViewer() != null) {
- taskListView.getViewer().expandAll();
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExportAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExportAction.java
deleted file mode 100644
index 5bfcacb37..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ExportAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.ImportExportUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Steffen Pingel
- */
-public class ExportAction implements IViewActionDelegate {
-
- private ISelection selection;
-
- public void init(IViewPart view) {
- // ignore
- }
-
- public void run(IAction action) {
- if (selection.isEmpty() || !(selection instanceof StructuredSelection)) {
- MessageDialog.openError(TasksUiInternal.getShell(), Messages.ExportAction_Dialog_Title, Messages.ExportAction_Nothing_selected);
- return;
- }
-
- FileDialog dialog = new FileDialog(TasksUiInternal.getShell(), SWT.PRIMARY_MODAL | SWT.SAVE);
- dialog.setText(Messages.ExportAction_Dialog_Title);
- ImportExportUtil.configureFilter(dialog);
- dialog.setFileName(ITasksCoreConstants.EXPORT_FILE_NAME + ITasksCoreConstants.FILE_EXTENSION);
- String path = dialog.open();
- if (path != null) {
- File file = new File(path);
- // Prompt the user to confirm if save operation will cause an overwrite
- if (file.exists()) {
- if (!MessageDialog.openConfirm(TasksUiInternal.getShell(), Messages.ExportAction_Dialog_Title, NLS.bind(
- Messages.ExportAction_X_exists_Do_you_wish_to_overwrite, file.getPath()))) {
- return;
- }
- }
- try {
- ImportExportUtil.export(file, (IStructuredSelection) selection);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Problems encountered during export", e)); //$NON-NLS-1$
- TasksUiInternal.displayStatus(Messages.ExportAction_Dialog_Title, new MultiStatus(ITasksCoreConstants.ID_PLUGIN, 0,
- new IStatus[] { e.getStatus() },
- Messages.ExportAction_Problems_encountered, e));
- }
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- this.selection = selection;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterCompletedTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterCompletedTasksAction.java
deleted file mode 100644
index 4824f09d9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/FilterCompletedTasksAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-
-/**
- * @author Mik Kersten
- */
-public class FilterCompletedTasksAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.filter.completed"; //$NON-NLS-1$
-
- private final TaskListView view;
-
- public FilterCompletedTasksAction(TaskListView view) {
- this.view = view;
- setText(Messages.FilterCompletedTasksAction_Filter_Completed_Tasks);
- setToolTipText(Messages.FilterCompletedTasksAction_Filter_Completed_Tasks);
- setId(ID);
- setImageDescriptor(CommonImages.FILTER_COMPLETE);
- setChecked(TasksUiPlugin.getDefault().getPreferenceStore().contains(
- ITasksUiPreferenceConstants.FILTER_COMPLETE_MODE));
- }
-
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_COMPLETE_MODE,
- isChecked());
- if (isChecked()) {
- view.addFilter(view.getCompleteFilter());
- } else {
- view.removeFilter(view.getCompleteFilter());
- }
- this.view.refresh();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoIntoAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoIntoAction.java
deleted file mode 100644
index 4ae2e11bb..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoIntoAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Mik Kersten
- */
-public class GoIntoAction extends Action implements IViewActionDelegate {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.view.go.into"; //$NON-NLS-1$
-
- public GoIntoAction() {
- setId(ID);
- setText(Messages.GoIntoAction_Go_Into);
- setToolTipText(Messages.GoIntoAction_Go_Into);
- setImageDescriptor(CommonImages.GO_INTO);
- }
-
- public void init(IViewPart view) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public void run() {
- if (TaskListView.getFromActivePerspective() != null) {
- TaskListView.getFromActivePerspective().getFilteredTree().setFilterText(""); //$NON-NLS-1$
- TaskListView.getFromActivePerspective().goIntoCategory();
- }
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoUpAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoUpAction.java
deleted file mode 100644
index 122c44fe7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GoUpAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.ui.part.DrillDownAdapter;
-
-/**
- * @author Mik Kersten
- */
-public class GoUpAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.view.go.up"; //$NON-NLS-1$
-
- public GoUpAction(DrillDownAdapter drillDownAdapter) {
- setText(Messages.GoUpAction_Go_Up_To_Root);
- setToolTipText(Messages.GoUpAction_Go_Up_To_Root);
- setId(ID);
- setImageDescriptor(CommonImages.GO_UP);
- }
-
- @Override
- public void run() {
- if (TaskListView.getFromActivePerspective() != null) {
- TaskListView.getFromActivePerspective().goUpToRoot();
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GroupSubTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GroupSubTasksAction.java
deleted file mode 100644
index 6086dc93b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/GroupSubTasksAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- */
-public class GroupSubTasksAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.filter.subtasks"; //$NON-NLS-1$
-
- private final TaskListView view;
-
- public GroupSubTasksAction(TaskListView view) {
- this.view = view;
- setText(Messages.GroupSubTasksAction_Group_Subtasks);
- setToolTipText(Messages.GroupSubTasksAction_Group_Subtasks);
- setId(ID);
- // setImageDescriptor(TasksUiImages.FILTER_COMPLETE);
- setChecked(TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.GROUP_SUBTASKS));
- }
-
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.GROUP_SUBTASKS,
- isChecked());
- // TODO: refresh not getting rid of subtasks
-
- view.refresh(true);
-// try {
-// view.getViewer().getControl().setRedraw(false);
-// view.getViewer().collapseAll();
-// if (view.isFocusedMode()) {
-// view.getViewer().expandAll();
-// }
-// view.getViewer().refresh();
-// } finally {
-// view.getViewer().getControl().setRedraw(true);
-// }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ImportAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ImportAction.java
deleted file mode 100644
index eefe01197..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ImportAction.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.TransferList;
-import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.ImportExportUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Steffen Pingel
- */
-public class ImportAction implements IViewActionDelegate {
-
- public void init(IViewPart view) {
- // ignore
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
- }
-
- public void run(IAction action) {
- FileDialog dialog = new FileDialog(TasksUiInternal.getShell());
- dialog.setText(Messages.ImportAction_Dialog_Title);
- ImportExportUtil.configureFilter(dialog);
- String path = dialog.open();
- if (path != null) {
- File file = new File(path);
- if (file.isFile()) {
- IStatus result = importElements(file);
- if (!result.isOK()) {
- StatusHandler.log(result);
- TasksUiInternal.displayStatus(Messages.ImportAction_Dialog_Title, new MultiStatus(ITasksCoreConstants.ID_PLUGIN, 0,
- new IStatus[] { result },
- Messages.ImportAction_Problems_encountered, null));
- }
- }
- }
- }
-
- private IStatus importElements(File file) {
- MultiStatus result = new MultiStatus(ITasksCoreConstants.ID_PLUGIN, 0,
- "Problems encounted during importing", null); //$NON-NLS-1$
-
- TransferList list = new TransferList();
- TaskListExternalizer externalizer = TasksUiPlugin.getDefault().createTaskListExternalizer();
- try {
- externalizer.readTaskList(list, file);
- } catch (CoreException e) {
- result.add(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Problems encountered reading import file", e)); //$NON-NLS-1$
- }
-
- TaskList taskList = TasksUiPlugin.getTaskList();
- for (AbstractTask task : list.getAllTasks()) {
- if (!validateRepository(task.getConnectorKind(), task.getRepositoryUrl())) {
- result.add(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Task {0} ignored, unknown connector", task.getSummary()))); //$NON-NLS-1$
- continue;
- }
-
- if (taskList.getTask(task.getHandleIdentifier()) != null) {
- result.add(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Task {0} ignored, already exists in Task List", task.getSummary()))); //$NON-NLS-1$
- } else {
- // need to deactivate since activation is managed centrally
- task.setActive(false);
- taskList.addTask(task);
- // TODO support importing of contexts
- //ContextCore.getContextStore().importContext(task.getHandleIdentifier(), zipFile);
- }
- }
-
- for (RepositoryQuery query : list.getQueries()) {
- if (!validateRepository(query.getConnectorKind(), query.getRepositoryUrl())) {
- result.add(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Query {0} ignored, unknown connector", query.getSummary()))); //$NON-NLS-1$
- continue;
- }
-
- if (taskList.getQueries().contains(query)) {
- query.setHandleIdentifier(taskList.getUniqueHandleIdentifier());
- }
- taskList.addQuery(query);
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- query.getConnectorKind());
- if (connector != null) {
- TasksUiInternal.synchronizeQuery(connector, query, null, true);
- }
- }
-
- return result;
- }
-
- private boolean validateRepository(String connectorKind, String repositoryUrl) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
- if (repository == null) {
- if (TasksUi.getRepositoryConnector(connectorKind) == null) {
- return false;
- }
- repository = new TaskRepository(connectorKind, repositoryUrl);
- TasksUi.getRepositoryManager().addRepository(repository);
- }
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/LinkWithEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/LinkWithEditorAction.java
deleted file mode 100644
index b3fa99ca6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/LinkWithEditorAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-
-/**
- * @author Willian Mitsuda
- */
-public class LinkWithEditorAction extends Action {
-
- private final TaskListView taskListView;
-
- public LinkWithEditorAction(TaskListView taskListView) {
- super(Messages.LinkWithEditorAction_Link_with_Editor, IAction.AS_CHECK_BOX);
- this.taskListView = taskListView;
- setImageDescriptor(CommonImages.LINK_EDITOR);
- }
-
- @Override
- public void run() {
- taskListView.setLinkWithEditor(isChecked());
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
deleted file mode 100644
index 9cb9cc250..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/Messages.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.actions.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String AbstractChangeCompletionAction_Mark_selected_local_tasks_X;
-
- public static String ActivateTaskDialogAction_Activate_Task;
-
- public static String ActivateTaskDialogAction_Select_a_task_to_activate__;
-
- public static String ActivateTaskHistoryDropDownAction_Activate_Previous_Task;
-
- public static String AddRepositoryAction_Add_new_query;
-
- public static String AddRepositoryAction_Add_a_query_to_the_Task_List;
-
- public static String AddRepositoryAction_Add_Task_Repository;
-
- public static String AddRepositoryAction_Do_not_show_again;
-
- public static String ClearOutgoingAction_Clear_outgoing;
-
- public static String ClearOutgoingAction_Clear_outgoing_failed;
-
- public static String ClearOutgoingAction_Confirm_discard;
-
- public static String ClearOutgoingAction_Discard_all_outgoing_changes_;
-
- public static String CloneTaskAction_Clone_Task_Failed;
-
- public static String CloneTaskAction_Clone_This_Task;
-
- public static String CloneTaskAction_Cloned_from_;
-
- public static String CollapseAllAction_Collapse_All;
-
- public static String CompareAttachmentsAction_Compare__;
-
- public static String CompareAttachmentsAction_Compare_Attachments;
-
- public static String CompareAttachmentsAction_Failed_to_find_attachment;
-
- public static String CopyCommentDetailsAction_Copy_User_ID;
-
- public static String CopyCommentDetailsAction_Copy_User_ID_Tooltip;
-
- public static String CopyTaskDetailsAction_Copy_Details;
-
- public static String DeleteAction_Confirm_Delete;
-
- public static String DeleteAction_Delete;
-
- public static String DeleteAction_Delete_all_of_the_unsubmitted_tasks;
-
- public static String DeleteAction_Delete_the_elements_listed_below;
-
- public static String DeleteAction_Delete_failed;
-
- public static String DeleteAction_Delete_in_progress;
-
- public static String DeleteAction_Delete_the_planning_information_and_context_for_the_repository_task;
-
- public static String DeleteAction_Delete_the_planning_information_and_context_of_all_unmatched_tasks;
-
- public static String DeleteAction_Nothing_selected;
-
- public static String DeleteAction_Permanently_delete_the_category;
-
- public static String DeleteAction_Permanently_delete_the_element_listed_below;
-
- public static String DeleteAction_Permanently_delete_the_query;
-
- public static String DeleteAction_Permanently_delete_the_task_listed_below;
-
- public static String DeleteTaskRepositoryAction_Confirm_Delete;
-
- public static String DeleteTaskRepositoryAction_Delete_Specific_Task_Repository;
-
- public static String DeleteTaskRepositoryAction_Delete_Repository;
-
- public static String DeleteTaskRepositoryAction_Delete_the_selected_task_repositories;
-
- public static String DeleteTaskRepositoryAction_Delete_Repository_In_Progress;
-
- public static String DeleteTaskRepositoryAction_Delete_Task_Repository_Failed;
-
- public static String EditRepositoryPropertiesAction_Properties;
-
- public static String ExpandAllAction_Expand_All;
-
- public static String ExportAction_Dialog_Title;
-
- public static String ExportAction_Nothing_selected;
-
- public static String ExportAction_Problems_encountered;
-
- public static String ExportAction_X_exists_Do_you_wish_to_overwrite;
-
- public static String FilterCompletedTasksAction_Filter_Completed_Tasks;
-
- public static String GoIntoAction_Go_Into;
-
- public static String GoUpAction_Go_Up_To_Root;
-
- public static String GroupSubTasksAction_Group_Subtasks;
-
- public static String ImportAction_Dialog_Title;
-
- public static String ImportAction_Problems_encountered;
-
- public static String LinkWithEditorAction_Link_with_Editor;
-
- public static String NewCategoryAction_A_category_with_this_name_already_exists;
-
- public static String NewCategoryAction_Enter_name;
-
- public static String NewCategoryAction_Enter_a_name_for_the_Category;
-
- public static String NewCategoryAction_New_Category;
-
- public static String NewCategoryAction_New_Category_;
-
- public static String NewCategoryAction_A_query_with_this_name_already_exists;
-
- public static String NewQueryAction_new_query_;
-
- public static String NewSubTaskAction_The_connector_does_not_support_creating_subtasks_for_this_task;
-
- public static String NewSubTaskAction_Could_not_initialize_sub_task_data_for_task_;
-
- public static String NewSubTaskAction_Could_not_retrieve_task_data_for_task_;
-
- public static String NewSubTaskAction_Create_a_new_subtask;
-
- public static String NewSubTaskAction_Failed_to_create_new_sub_task_;
-
- public static String NewSubTaskAction_Subtask;
-
- public static String NewSubTaskAction_Unable_to_create_subtask;
-
- public static String NewTaskAction_new_task;
-
- public static String NewTaskFromSelectionAction_Comment_;
-
- public static String NewTaskFromSelectionAction____Created_from_Comment___;
-
- public static String NewTaskFromSelectionAction_New_Task_from_Selection;
-
- public static String NewTaskFromSelectionAction_Nothing_selected_to_create_task_from;
-
- public static String NewTaskFromSelectionAction_URL_;
-
- public static String OpenRepositoryTask_Could_not_find_matching_repository_task;
-
- public static String OpenRepositoryTask_Open_Repository_Task;
-
- public static String OpenRepositoryTask_Open_Task;
-
- public static String OpenTaskAction_Open_Task;
-
- public static String OpenTaskAction_Select_a_task_to_open__;
-
- public static String OpenTaskListElementAction_Open;
-
- public static String OpenTaskListElementAction_Open_Task_List_Element;
-
- public static String OpenTasksUiPreferencesAction_Preferences_;
-
- public static String OpenWithBrowserAction_Open_with_Browser;
-
- public static String PresentationDropDownSelectionAction_Task_Presentation;
-
- public static String QueryCloneAction_Clone_Query;
-
- public static String QueryCloneAction_Copy_of_X;
-
- public static String QueryCloneAction_No_query_selected;
-
- public static String RefreshRepositoryTasksAction_Refresh_All_Tasks;
-
- public static String RemoveFromCategoryAction_Remove_From_Category;
-
- public static String RenameAction_Rename;
-
- public static String ShowInTaskListAction_Show_In_Task_List;
-
- public static String SynchronizeAutomaticallyAction_Synchronize_Automatically;
-
- public static String SynchronizeEditorAction_Synchronize;
-
- public static String SynchronizeEditorAction_Synchronize_Incoming_Changes;
-
- public static String TaskActivateAction_Activate;
-
- public static String TaskDeactivateAction_Deactivate;
-
- public static String TaskListSortAction_Sort_;
-
- public static String TaskSelectionDialog__matches;
-
- public static String TaskSelectionDialog_Deselect_Working_Set;
-
- public static String TaskSelectionDialog_Edit_Active_Working_Set_;
-
- public static String TaskSelectionDialog_New_Task_;
-
- public static String TaskSelectionDialog_Open_with_Browser;
-
- public static String TaskSelectionDialog_Scanning_tasks;
-
- public static String TaskSelectionDialog_Search_for_tasks;
-
- public static String TaskSelectionDialog_Select_Working_Set_;
-
- public static String TaskSelectionDialog_Selected_item_is_not_a_task;
-
- public static String TaskSelectionDialog_Show_Completed_Tasks;
-
- public static String TaskWorkingSetAction_All;
-
- public static String TaskWorkingSetAction_Deselect_All;
-
- public static String TaskWorkingSetAction_Edit_Label;
-
- public static String TaskWorkingSetAction_Select_and_Edit_Working_Sets;
-
- public static String TaskWorkingSetAction_Sets;
-
- public static String ToggleAllWorkingSetsAction_Show_All;
-
- public static String ToggleTaskActivationAction_Activate_Task;
-
- public static String ToggleTaskActivationAction_Deactivate_Task;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java
deleted file mode 100644
index 3242693b3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewCategoryAction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Set;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- */
-public class NewCategoryAction extends Action implements IViewActionDelegate {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.create.category"; //$NON-NLS-1$
-
- public NewCategoryAction() {
- setText(Messages.NewCategoryAction_New_Category_);
- setToolTipText(Messages.NewCategoryAction_New_Category_);
- setId(ID);
- setImageDescriptor(TasksUiImages.CATEGORY_NEW);
- }
-
- public void init(IViewPart view) {
- }
-
- public void run(IAction action) {
- run();
- }
-
- @Override
- public void run() {
- createCategory();
- }
-
- public TaskCategory createCategory() {
- InputDialog dialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.NewCategoryAction_Enter_name, Messages.NewCategoryAction_Enter_a_name_for_the_Category, "", null); //$NON-NLS-1$
- int dialogResult = dialog.open();
- if (dialogResult == Window.OK) {
- String name = dialog.getValue();
- Set<RepositoryQuery> queries = TasksUiInternal.getTaskList().getQueries();
- Set<AbstractTaskCategory> categories = TasksUiInternal.getTaskList().getCategories();
-
- for (AbstractTaskCategory category : categories) {
- if (name != null && name.equals(category.getSummary())) {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.NewCategoryAction_New_Category,
- Messages.NewCategoryAction_A_category_with_this_name_already_exists);
- return null;
- }
- }
- for (RepositoryQuery query : queries) {
- if (name != null && name.equals(query.getSummary())) {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.NewCategoryAction_New_Category,
- Messages.NewCategoryAction_A_query_with_this_name_already_exists);
- return null;
- }
- }
-
- TaskCategory category = new TaskCategory(TasksUiPlugin.getTaskList().getUniqueHandleIdentifier(), name);
- TasksUiPlugin.getTaskList().addCategory(category);
- return category;
- }
- return null;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java
deleted file mode 100644
index a66ecee3d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.LocalRepositoryConnectorUi;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewQueryWizard;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- * @author Eugene Kuleshov
- */
-public class NewQueryAction extends Action implements IViewActionDelegate, IExecutableExtension {
-
- private final String ID = "org.eclipse.mylyn.tasks.ui.new.query"; //$NON-NLS-1$
-
- private final String LABEL_NEW_QUERY = Messages.NewQueryAction_new_query_;
-
- private boolean skipRepositoryPage;
-
- public NewQueryAction() {
- setText(LABEL_NEW_QUERY);
- setToolTipText(LABEL_NEW_QUERY);
- setId(ID);
- setImageDescriptor(TasksUiImages.QUERY_NEW);
- }
-
- public void run(IAction action) {
- run();
- }
-
- @Override
- public void run() {
- IWizard wizard = null;
- List<TaskRepository> repositories = TasksUi.getRepositoryManager().getAllRepositories();
- if (repositories.size() == 2) {
- // NOTE: this click-saving should be generalized
- for (TaskRepository taskRepository : repositories) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
- if (!(connectorUi instanceof LocalRepositoryConnectorUi)) {
- wizard = connectorUi.getQueryWizard(taskRepository, null);
- if (wizard == null) {
- continue;
- }
- ((Wizard) wizard).setForcePreviousAndNextButtons(true);
- }
- }
- } else if (skipRepositoryPage) {
- TaskRepository taskRepository = TasksUiUtil.getSelectedRepository();
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
- wizard = connectorUi.getQueryWizard(taskRepository, null);
- ((Wizard) wizard).setForcePreviousAndNextButtons(true);
- if (connectorUi instanceof LocalRepositoryConnectorUi) {
- wizard.performFinish();
- return;
- }
- } else {
- wizard = new NewQueryWizard();
- }
-
- try {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null && !shell.isDisposed()) {
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.CANCEL) {
- dialog.close();
- return;
- }
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- }
-
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
- throws CoreException {
- if ("skipFirstPage".equals(data)) { //$NON-NLS-1$
- this.skipRepositoryPage = true;
- }
- }
-
- public void init(IViewPart view) {
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
deleted file mode 100644
index 8c8fae1fa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Steffen Pingel
- */
-public class NewSubTaskAction extends Action implements IViewActionDelegate, IExecutableExtension {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.new.subtask"; //$NON-NLS-1$
-
- private AbstractTask selectedTask;
-
- public NewSubTaskAction() {
- super(Messages.NewSubTaskAction_Subtask);
- setToolTipText(Messages.NewSubTaskAction_Create_a_new_subtask);
- setId(ID);
- setImageDescriptor(TasksUiImages.TASK_NEW_SUB);
- }
-
- @Override
- public void run() {
- if (selectedTask == null) {
- return;
- }
-
- if (selectedTask instanceof LocalTask) {
- // XXX code copied from NewLocalTaskWizard.performFinish() and TaskListManager.createNewLocalTask()
- TaskList taskList = TasksUiPlugin.getTaskList();
- LocalTask newTask = new LocalTask("" + taskList.getNextLocalTaskId(), //$NON-NLS-1$
- LocalRepositoryConnector.DEFAULT_SUMMARY);
- newTask.setPriority(PriorityLevel.P3.toString());
- TasksUiPlugin.getTaskActivityManager().scheduleNewTask(newTask);
- taskList.addTask(newTask, selectedTask);
- TasksUiUtil.openTask(newTask);
- return;
- }
-
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- selectedTask.getConnectorKind());
- TaskData taskData = createTaskData(connector);
- if (taskData != null) {
- try {
- TasksUiInternal.createAndOpenNewTask(taskData);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to open new sub task", e)); //$NON-NLS-1$
- TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask, new Status(
- IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.NewSubTaskAction_Failed_to_create_new_sub_task_ + e.getMessage()));
- }
- }
- }
-
- private TaskData createTaskData(AbstractRepositoryConnector connector) {
- final AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- if (taskDataHandler == null) {
- return null;
- }
-
- String repositoryUrl = selectedTask.getRepositoryUrl();
- TaskData parentTaskData = null;
- try {
- parentTaskData = TasksUi.getTaskDataManager().getTaskData(selectedTask);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not retrieve task data for task:" + selectedTask.getUrl(), e)); //$NON-NLS-1$
- }
- if (parentTaskData == null) {
- TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask, new Status(
- IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- Messages.NewSubTaskAction_Could_not_retrieve_task_data_for_task_ + selectedTask.getUrl()));
- return null;
- }
-
- final TaskRepository taskRepository = TasksUiPlugin.getRepositoryManager().getRepository(repositoryUrl);
- if (!taskDataHandler.canInitializeSubTaskData(taskRepository, selectedTask)) {
- return null;
- }
-
- final TaskData selectedTaskData = parentTaskData;
- final TaskAttributeMapper attributeMapper = taskDataHandler.getAttributeMapper(taskRepository);
- final TaskData taskData = new TaskData(attributeMapper, taskRepository.getConnectorKind(),
- taskRepository.getRepositoryUrl(), ""); //$NON-NLS-1$
- final boolean[] result = new boolean[1];
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- try {
- service.busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- result[0] = taskDataHandler.initializeSubTaskData(taskRepository, taskData, selectedTaskData,
- new NullProgressMonitor());
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask,
- ((CoreException) e.getCause()).getStatus());
- } else {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.NewSubTaskAction_Could_not_initialize_sub_task_data_for_task_ + selectedTask.getUrl(),
- e));
- }
- return null;
- } catch (InterruptedException e) {
- // canceled
- return null;
- }
-
- if (result[0]) {
- // open editor
- return taskData;
- } else {
- TasksUiInternal.displayStatus(Messages.NewSubTaskAction_Unable_to_create_subtask, new Status(IStatus.INFO,
- TasksUiPlugin.ID_PLUGIN,
- Messages.NewSubTaskAction_The_connector_does_not_support_creating_subtasks_for_this_task));
- }
- return null;
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void init(IViewPart view) {
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- selectedTask = null;
- if (selection instanceof StructuredSelection) {
- Object selectedObject = ((StructuredSelection) selection).getFirstElement();
- if (selectedObject instanceof LocalTask) {
- selectedTask = (AbstractTask) selectedObject;
- } else if (selectedObject instanceof ITask) {
- selectedTask = (AbstractTask) selectedObject;
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- selectedTask.getConnectorKind());
- AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- if (taskDataHandler == null || !taskDataHandler.canInitializeSubTaskData(null, selectedTask)) {
- selectedTask = null;
- }
- }
- }
-
- action.setEnabled(selectedTask != null);
- }
-
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
- throws CoreException {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
deleted file mode 100644
index 663f96765..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.commons.ui.TaskListImageDescriptor;
-import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesSorter;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Mik Kersten
- * @author Eugene Kuleshov
- * @author Steffen Pingel
- * @author Rob Elves
- */
-@SuppressWarnings("restriction")
-public class NewTaskAction extends BaseSelectionListenerAction implements IMenuCreator, IViewActionDelegate,
- IExecutableExtension {
-
- private static final String LABEL_NEW_TASK = Messages.NewTaskAction_new_task;
-
- public static final String ID = "org.eclipse.mylyn.tasklist.ui.repositories.actions.create"; //$NON-NLS-1$
-
- private boolean skipRepositoryPage = false;
-
- private boolean localTask = false;
-
- private Menu dropDownMenu;
-
- public NewTaskAction() {
- super(LABEL_NEW_TASK);
- setMenuCreator(this);
- setText(LABEL_NEW_TASK);
- setToolTipText(LABEL_NEW_TASK);
- setId(ID);
- setEnabled(true);
- setImageDescriptor(TasksUiImages.TASK_NEW);
- }
-
- @Override
- public void run() {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null && !shell.isDisposed()) {
- if (localTask) {
- TasksUiUtil.openNewLocalTaskEditor(shell, null);
- } else {
- if (skipRepositoryPage) {
- TasksUiUtil.openNewTaskEditor(shell, null, TasksUiUtil.getSelectedRepository());
- } else {
- TasksUiUtil.openNewTaskEditor(shell, null, null);
- }
- }
- }
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void init(IViewPart view) {
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
- throws CoreException {
- if ("skipFirstPage".equals(data)) { //$NON-NLS-1$
- this.skipRepositoryPage = true;
- }
- if ("local".equals(data)) { //$NON-NLS-1$
- this.localTask = true;
- }
- }
-
- public void dispose() {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- dropDownMenu = null;
- }
- }
-
- public Menu getMenu(Control parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- public Menu getMenu(Menu parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- private void addActionsToMenu() {
- Set<TaskRepository> includedRepositories = new HashSet<TaskRepository>();
- TaskRepository localRepository = TasksUi.getRepositoryManager().getRepository(
- LocalRepositoryConnector.CONNECTOR_KIND, LocalRepositoryConnector.REPOSITORY_URL);
-
- addRepositoryAction(localRepository);
-
- IWorkingSet workingSet = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getActivePage()
- .getAggregateWorkingSet();
- if (workingSet != null && !workingSet.isEmpty()) {
- // only add repositories in working set
- for (IAdaptable iterable_element : workingSet.getElements()) {
- if (iterable_element instanceof RepositoryQuery) {
- String repositoryUrl = ((RepositoryQuery) iterable_element).getRepositoryUrl();
- String connectorKind = ((RepositoryQuery) iterable_element).getConnectorKind();
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind,
- repositoryUrl);
- markForInclusion(includedRepositories, repository);
-
- }
- }
- }
-
- if (includedRepositories.isEmpty()) {
- // No repositories were added from working sets so show all
- for (TaskRepository repository : TasksUi.getRepositoryManager().getAllRepositories()) {
- markForInclusion(includedRepositories, repository);
- }
- }
-
- if (!includedRepositories.isEmpty()) {
- new Separator().fill(dropDownMenu, -1);
- ArrayList<TaskRepository> listOfRepositories = new ArrayList<TaskRepository>(includedRepositories);
- final TaskRepositoriesSorter comparator = new TaskRepositoriesSorter();
- Collections.sort(listOfRepositories, new Comparator<TaskRepository>() {
-
- public int compare(TaskRepository arg0, TaskRepository arg1) {
- return comparator.compare(null, arg0, arg1);
- }
- });
- for (TaskRepository taskRepository : listOfRepositories) {
- addRepositoryAction(taskRepository);
- }
- }
- new Separator().fill(dropDownMenu, -1);
- new ActionContributionItem(new NewQueryAction()).fill(dropDownMenu, -1);
- new ActionContributionItem(new NewCategoryAction()).fill(dropDownMenu, -1);
- new Separator().fill(dropDownMenu, -1);
- new ActionContributionItem(new AddRepositoryAction()).fill(dropDownMenu, -1);
- new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
- }
-
- private void markForInclusion(Set<TaskRepository> includedRepositories, TaskRepository repository) {
- if (repository != null && !repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND)) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(repository.getConnectorKind());
- if (connector != null) {
- if (ITaskRepositoryFilter.CAN_CREATE_NEW_TASK.accept(repository, connector)) {
- includedRepositories.add(repository);
- }
- }
- }
- }
-
- private RepositorySelectionAction addRepositoryAction(TaskRepository repository) {
- if (repository == null) {
- return null;
- }
- RepositorySelectionAction action = new RepositorySelectionAction(repository);
- ActionContributionItem item = new ActionContributionItem(action);
- action.setText(repository.getRepositoryLabel());
- ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(repository.getConnectorKind());
- ImageDescriptor compositeDescriptor = new TaskListImageDescriptor(TasksUiImages.TASK_NEW, overlay, false, false);
- action.setImageDescriptor(compositeDescriptor);
- item.fill(dropDownMenu, -1);
- return action;
- }
-
- private class RepositorySelectionAction extends Action {
-
- private final TaskRepository repository;
-
- public RepositorySelectionAction(TaskRepository repository) {
- this.repository = repository;
- setText(repository.getRepositoryLabel());
- }
-
- @Override
- public void run() {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (repository.getConnectorKind().equalsIgnoreCase(LocalRepositoryConnector.CONNECTOR_KIND)) {
- TasksUiUtil.openNewLocalTaskEditor(shell, null);
- } else {
- TasksUiUtil.openNewTaskEditor(shell, null, repository);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskFromSelectionAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskFromSelectionAction.java
deleted file mode 100644
index 0d8aaab82..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskFromSelectionAction.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskMapping;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class NewTaskFromSelectionAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.newTaskFromSelection"; //$NON-NLS-1$
-
- private ITaskMapping taskMapping;
-
- public NewTaskFromSelectionAction() {
- super(Messages.NewTaskFromSelectionAction_New_Task_from_Selection);
- setId(ID);
- setImageDescriptor(TasksUiImages.TASK_NEW);
- }
-
- public ITaskMapping getTaskMapping() {
- return taskMapping;
- }
-
- public void run(IAction action) {
- run();
- }
-
- @Override
- public void run() {
- if (taskMapping == null) {
- MessageDialog.openError(null, Messages.NewTaskFromSelectionAction_New_Task_from_Selection, Messages.NewTaskFromSelectionAction_Nothing_selected_to_create_task_from);
- return;
- }
-
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- TasksUiUtil.openNewTaskEditor(shell, taskMapping, null);
- }
-
- public void selectionChanged(ISelection selection) {
- if (selection instanceof TextSelection) {
- TextSelection textSelection = (TextSelection) selection;
- final String text = textSelection.getText();
- if (text != null && text.length() > 0) {
- taskMapping = new TaskMapping() {
- @Override
- public String getDescription() {
- return text;
- }
- };
- } else {
- taskMapping = null;
- }
-// } else if (selection instanceof RepositoryTaskSelection) {
-// RepositoryTaskSelection repositoryTaskSelection = (RepositoryTaskSelection) selection;
-// IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
-// AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(repositoryTaskSelection.getRepositoryKind());
-//
-// TaskComment comment = repositoryTaskSelection.getComment();
-// if (comment != null) {
-// StringBuilder sb = new StringBuilder();
-// sb.append("\n-- Created from Comment --");
-// if (connector != null) {
-// sb.append("\nURL: ");
-// sb.append(connector.getTaskUrl(repositoryTaskSelection.getRepositoryUrl(),
-// repositoryTaskSelection.getId()));
-// }
-// sb.append("\nComment: ");
-// sb.append(comment.getNumber());
-//
-// sb.append("\n\n");
-// if (taskSelection != null) {
-// // if text was selected, prefer that
-// sb.append(taskSelection.getLegacyTaskData().getDescription());
-// } else {
-// sb.append(comment.getText());
-// }
-//
-// taskSelection = new TaskSelection("", sb.toString());
-// } else if (taskSelection != null) {
-// StringBuilder sb = new StringBuilder();
-// if (connector != null) {
-// sb.append("\n-- Created from Task --");
-// sb.append("\nURL: ");
-// sb.append(connector.getTaskUrl(repositoryTaskSelection.getRepositoryUrl(),
-// repositoryTaskSelection.getId()));
-// }
-//
-// sb.append("\n\n");
-// sb.append(taskSelection.getLegacyTaskData().getDescription());
-//
-// taskSelection = new TaskSelection("", sb.toString());
-// }
- } else if (selection instanceof StructuredSelection) {
- Object element = ((StructuredSelection) selection).getFirstElement();
- if (element instanceof ITaskComment) {
- ITaskComment comment = (ITaskComment) element;
- final StringBuilder sb = new StringBuilder();
- sb.append("\n" + Messages.NewTaskFromSelectionAction____Created_from_Comment___); //$NON-NLS-1$
- if (comment.getUrl() == null) {
- sb.append("\n" + Messages.NewTaskFromSelectionAction_URL_); //$NON-NLS-1$
- sb.append(comment.getTask().getUrl());
- sb.append("\n" + Messages.NewTaskFromSelectionAction_Comment_); //$NON-NLS-1$
- sb.append(comment.getNumber());
- } else {
- sb.append("\n" + Messages.NewTaskFromSelectionAction_URL_); //$NON-NLS-1$
- sb.append(comment.getUrl());
- }
-
- sb.append("\n\n"); //$NON-NLS-1$
- sb.append(comment.getText());
- taskMapping = new TaskMapping() {
- @Override
- public String getDescription() {
- return sb.toString();
- }
- };
- }
- }
- setEnabled(taskMapping != null);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTaskAction.java
deleted file mode 100644
index 070db876b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenRepositoryTaskAction.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.tasks.ui.AddExistingTaskJob;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.commands.RemoteTaskSelectionDialog;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Mik Kersten
- */
-public class OpenRepositoryTaskAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate {
-
- private static final String OPEN_REMOTE_TASK_DIALOG_DIALOG_SETTINGS = "org.eclipse.mylyn.tasks.ui.open.remote"; //$NON-NLS-1$
-
- public void run(IAction action) {
- RemoteTaskSelectionDialog dlg = new RemoteTaskSelectionDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell());
- dlg.setTitle(Messages.OpenRepositoryTask_Open_Repository_Task);
-
- IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
- IDialogSettings dlgSettings = settings.getSection(OPEN_REMOTE_TASK_DIALOG_DIALOG_SETTINGS);
- if (dlgSettings == null) {
- dlgSettings = settings.addNewSection(OPEN_REMOTE_TASK_DIALOG_DIALOG_SETTINGS);
- }
- dlg.setDialogBoundsSettings(dlgSettings, Dialog.DIALOG_PERSISTLOCATION | Dialog.DIALOG_PERSISTSIZE);
-
- if (dlg.open() == Window.OK) {
- if (dlg.getSelectedTask() != null) {
- openExistingTask(dlg);
- } else {
- openRemoteTask(dlg);
- }
- }
- }
-
- /**
- * Selected a existing task; handle category move, if needed
- */
- private void openExistingTask(RemoteTaskSelectionDialog dlg) {
- if (dlg.shouldAddToTaskList()) {
- TasksUiInternal.getTaskList().addTask(dlg.getSelectedTask(), dlg.getSelectedCategory());
- }
- TasksUiInternal.refreshAndOpenTaskListElement(dlg.getSelectedTask());
- }
-
- /**
- * Selected a repository, so try to obtain the task using taskId
- */
- private void openRemoteTask(RemoteTaskSelectionDialog dlg) {
- String[] selectedIds = dlg.getSelectedIds();
- if (dlg.shouldAddToTaskList()) {
- for (String id : selectedIds) {
- final IProgressService svc = PlatformUI.getWorkbench().getProgressService();
- final AddExistingTaskJob job = new AddExistingTaskJob(dlg.getSelectedTaskRepository(), id,
- dlg.getSelectedCategory());
- job.schedule();
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- svc.showInDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), job);
- }
-
- });
- }
- } else {
- boolean openSuccessful = false;
- for (String id : selectedIds) {
- boolean opened = TasksUiUtil.openTask(dlg.getSelectedTaskRepository(), id);
- if (opened) {
- openSuccessful = true;
- }
- }
- if (!openSuccessful) {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.OpenRepositoryTask_Open_Task,
- Messages.OpenRepositoryTask_Could_not_find_matching_repository_task);
- }
- }
- }
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void init(IViewPart view) {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java
deleted file mode 100644
index 8b8975326..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * @author Willian Mitsuda
- */
-public class OpenTaskAction extends ActionDelegate implements IWorkbenchWindowActionDelegate {
-
- private IWorkbenchWindow window;
-
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- @Override
- public void run(IAction action) {
- TaskSelectionDialog dlg = new TaskSelectionDialog(window.getShell());
- dlg.setTitle(Messages.OpenTaskAction_Open_Task);
- dlg.setMessage(Messages.OpenTaskAction_Select_a_task_to_open__);
- dlg.setShowExtendedOpeningOptions(true);
-
- if (dlg.open() != Window.OK) {
- return;
- }
-
- Object result = dlg.getFirstResult();
- if (result instanceof ITask) {
- AbstractTask task = (AbstractTask) result;
- if (dlg.getOpenInBrowser()) {
- if (TasksUiInternal.isValidUrl(task.getUrl())) {
- TasksUiUtil.openUrl(task.getUrl());
- }
- } else {
- TasksUiInternal.refreshAndOpenTaskListElement(task);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java
deleted file mode 100644
index 314426077..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskListElementAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Event;
-
-/**
- * @author Mik Kersten
- */
-public class OpenTaskListElementAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.open"; //$NON-NLS-1$
-
- private final TreeViewer viewer;
-
- public OpenTaskListElementAction(TreeViewer view) {
- this.viewer = view;
- setText(Messages.OpenTaskListElementAction_Open);
- setToolTipText(Messages.OpenTaskListElementAction_Open_Task_List_Element);
- setId(ID);
- }
-
- @Override
- public void run() {
- runWithEvent(null);
- }
-
- @Override
- public void runWithEvent(Event event) {
- ISelection selection = viewer.getSelection();
- List<?> list = ((IStructuredSelection) selection).toList();
- for (Object element : list) {
- if (element instanceof ITask && event != null && (event.keyCode & SWT.MOD1) != 0) {
- TasksUiInternal.openTaskInBackground((AbstractTask) element, true);
- } else if (element instanceof ITask) {
- TasksUiInternal.refreshAndOpenTaskListElement((ITask) element);
- } else {
- if (viewer.getExpandedState(element)) {
- viewer.collapseToLevel(element, 1);
- } else {
- viewer.expandToLevel(element, 1);
- }
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskSearchAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskSearchAction.java
deleted file mode 100644
index 0c6f858b6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTaskSearchAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.ui.TaskSearchPage;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class OpenTaskSearchAction extends Action implements IViewActionDelegate {
-
- public OpenTaskSearchAction() {
- }
-
- public void init(IViewPart view) {
- // ignore
- }
-
- @Override
- public void run() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- NewSearchUI.openSearchDialog(window, TaskSearchPage.ID);
- }
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTasksUiPreferencesAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTasksUiPreferencesAction.java
deleted file mode 100644
index 013f3b434..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenTasksUiPreferencesAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.mylyn.internal.tasks.ui.preferences.TasksUiPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-
-/**
- * @author Mik Kersten
- */
-public class OpenTasksUiPreferencesAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.preferences.open"; //$NON-NLS-1$
-
- public OpenTasksUiPreferencesAction() {
- setText(Messages.OpenTasksUiPreferencesAction_Preferences_);
- setToolTipText(Messages.OpenTasksUiPreferencesAction_Preferences_);
- setId(ID);
- }
-
- @Override
- public void run() {
- PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(), TasksUiPreferencePage.ID, new String[] { TasksUiPreferencePage.ID }, null);
- dlg.open();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java
deleted file mode 100644
index 262123e19..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/OpenWithBrowserAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class OpenWithBrowserAction extends BaseSelectionListenerAction {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.open.browser"; //$NON-NLS-1$
-
- public OpenWithBrowserAction() {
- super(Messages.OpenWithBrowserAction_Open_with_Browser);
- setToolTipText(Messages.OpenWithBrowserAction_Open_with_Browser);
- setId(ID);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- if (super.getStructuredSelection() != null) {
- for (Iterator iter = super.getStructuredSelection().iterator(); iter.hasNext();) {
- runWithSelection(iter.next());
- }
- }
- }
-
- private void runWithSelection(Object selectedObject) {
- String urlString = null;
- if (selectedObject instanceof ITask) {
- AbstractTask task = (AbstractTask) selectedObject;
- if (TasksUiInternal.isValidUrl(task.getUrl())) {
- urlString = task.getUrl();
- }
- } else if (selectedObject instanceof IRepositoryElement) {
- IRepositoryElement query = (IRepositoryElement) selectedObject;
- urlString = query.getUrl();
- }
-
- if (urlString != null) {
- TasksUiUtil.openUrl(urlString);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java
deleted file mode 100644
index 0b12e8f71..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/PresentationDropDownSelectionAction.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTaskListPresentation;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class PresentationDropDownSelectionAction extends Action implements IMenuCreator {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.presentationselection"; //$NON-NLS-1$
-
- private final TaskListView view;
-
- private Menu dropDownMenu;
-
- public PresentationDropDownSelectionAction(TaskListView view) {
- this.view = view;
- setMenuCreator(this);
- setText(Messages.PresentationDropDownSelectionAction_Task_Presentation);
- setToolTipText(Messages.PresentationDropDownSelectionAction_Task_Presentation);
- setId(ID);
- setEnabled(true);
- setImageDescriptor(CommonImages.PRESENTATION);
- }
-
- private void addActionsToMenu() {
- for (AbstractTaskListPresentation presentation : TaskListView.getPresentations()) {
- if (presentation.isPrimary()) {
- PresentationSelectionAction action = new PresentationSelectionAction(presentation);
- ActionContributionItem item = new ActionContributionItem(action);
- action.setText(presentation.getName());
- action.setImageDescriptor(presentation.getImageDescriptor());
- action.setChecked(view.getCurrentPresentation().getId().equals(presentation.getId()));
- item.fill(dropDownMenu, -1);
- }
- }
- boolean separatorAdded = false;
-
- for (AbstractTaskListPresentation presentation : TaskListView.getPresentations()) {
- if (!presentation.isPrimary()) {
- if (!separatorAdded) {
- new Separator().fill(dropDownMenu, -1);
- separatorAdded = true;
- }
-
- PresentationSelectionAction action = new PresentationSelectionAction(presentation);
- ActionContributionItem item = new ActionContributionItem(action);
- action.setText(presentation.getName());
- action.setImageDescriptor(presentation.getImageDescriptor());
- action.setChecked(view.getCurrentPresentation().getId().equals(presentation.getId()));
- item.fill(dropDownMenu, -1);
- }
- }
- }
-
- @Override
- public void run() {
- AbstractTaskListPresentation current = view.getCurrentPresentation();
- List<AbstractTaskListPresentation> all = TaskListView.getPresentations();
- int size = all.size();
- if (size == 0) {
- return;
- }
-
- // cycle between primary presentations
- int index = all.indexOf(current) + 1;
- for (int i = 0; i < size; i++) {
- AbstractTaskListPresentation presentation = all.get(index % size);
- if (presentation.isPrimary()) {
- view.applyPresentation(presentation);
- return;
- }
- index++;
- }
-
- // fall back to next presentation in list
- index = all.indexOf(current) + 1;
- if (index < size) {
- view.applyPresentation(all.get(index));
- } else {
- view.applyPresentation(all.get(0));
- }
- }
-
- public void dispose() {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- dropDownMenu = null;
- }
- }
-
- public Menu getMenu(Control parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- public Menu getMenu(Menu parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- private class PresentationSelectionAction extends Action {
-
- private final AbstractTaskListPresentation presentation;
-
- public PresentationSelectionAction(AbstractTaskListPresentation presentation) {
- this.presentation = presentation;
- setText(presentation.getName());
- }
-
- @Override
- public void run() {
- view.applyPresentation(presentation);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/QueryCloneAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/QueryCloneAction.java
deleted file mode 100644
index 770ac92bc..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/QueryCloneAction.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jevgeni Holodkov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jevgeni Holodkov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Allow to clone a selected query.
- *
- * @author Jevgeni Holodkov
- */
-public class QueryCloneAction extends Action implements IViewActionDelegate {
-
- protected ISelection selection;
-
- public void init(IViewPart view) {
- // ignore
- }
-
- public void run(IAction action) {
- run(getSelectedQuery(selection));
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- this.selection = selection;
- IRepositoryQuery selectedQuery = getSelectedQuery(selection);
- action.setEnabled(true);
- if (selectedQuery != null) {
- action.setEnabled(true);
- } else {
- action.setEnabled(false);
- }
- }
-
- protected RepositoryQuery getSelectedQuery(ISelection newSelection) {
- if (selection instanceof StructuredSelection) {
- // allow to select only one element
- if (((StructuredSelection) selection).size() == 1) {
- Object selectedObject = ((StructuredSelection) selection).getFirstElement();
- if (selectedObject instanceof IRepositoryQuery) {
- return (RepositoryQuery) selectedObject;
- }
- }
- }
- return null;
- }
-
- public void run(RepositoryQuery selectedQuery) {
- if (selectedQuery == null) {
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.QueryCloneAction_Clone_Query, Messages.QueryCloneAction_No_query_selected);
- return;
- }
-
- List<RepositoryQuery> queries = new ArrayList<RepositoryQuery>();
- queries.add(selectedQuery);
-
- List<RepositoryQuery> clonedQueries = new ArrayList<RepositoryQuery>(queries.size());
- for (RepositoryQuery query : queries) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(),
- query.getRepositoryUrl());
- RepositoryQuery clonedQuery = (RepositoryQuery) TasksUi.getRepositoryModel().createRepositoryQuery(
- repository);
- clonedQuery.setSummary(NLS.bind(Messages.QueryCloneAction_Copy_of_X, query.getSummary()));
- clonedQuery.setUrl(query.getUrl());
- Map<String, String> attributes = query.getAttributes();
- for (Map.Entry<String, String> entry : attributes.entrySet()) {
- clonedQuery.setAttribute(entry.getKey(), entry.getValue());
- }
- clonedQueries.add(clonedQuery);
- }
- for (RepositoryQuery query : clonedQueries) {
- TasksUiPlugin.getTaskList().addQuery(query);
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(query.getConnectorKind());
- TasksUiInternal.openEditQueryDialog(connectorUi, query);
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RefreshRepositoryTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RefreshRepositoryTasksAction.java
deleted file mode 100644
index 7d760656d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RefreshRepositoryTasksAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Steffen Pingel
- */
-public class RefreshRepositoryTasksAction extends AbstractTaskRepositoryAction implements IViewActionDelegate {
-
- private static final String ID = "org.eclipse.mylyn.tasklist.repositories.refreshAllTasks"; //$NON-NLS-1$
-
- public RefreshRepositoryTasksAction() {
- super(Messages.RefreshRepositoryTasksAction_Refresh_All_Tasks);
- setId(ID);
- setEnabled(false);
- }
-
- @Override
- public void run() {
- IStructuredSelection selection = getStructuredSelection();
- for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
- Object selectedObject = iter.next();
- if (selectedObject instanceof TaskRepository) {
- TaskRepository repository = (TaskRepository) selectedObject;
- synchronizeAllTasks(repository);
- }
- }
- }
-
- private void synchronizeAllTasks(TaskRepository repository) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- if (connector != null) {
- Set<ITask> repositoryTasks = TasksUiPlugin.getTaskList().getTasks(repository.getRepositoryUrl());
- TasksUiInternal.synchronizeTasks(connector, repositoryTasks, true, null);
- }
- }
-
- public void init(IViewPart view) {
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- selectionChanged((IStructuredSelection) selection);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RemoveFromCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RemoveFromCategoryAction.java
deleted file mode 100644
index ecdcc46b5..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RemoveFromCategoryAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ken Sueda - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Ken Sueda
- * @author Mik Kersten
- */
-public class RemoveFromCategoryAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.remove"; //$NON-NLS-1$
-
- private final TaskListView view;
-
- public RemoveFromCategoryAction(TaskListView view) {
- this.view = view;
- setText(Messages.RemoveFromCategoryAction_Remove_From_Category);
- setId(ID);
- setImageDescriptor(CommonImages.REMOVE);
- }
-
- @Override
- public void run() {
- ISelection selection = view.getViewer().getSelection();
- for (Object selectedObject : ((IStructuredSelection) selection).toList()) {
- if (selectedObject instanceof ITask) {
- AbstractTask task = (AbstractTask) selectedObject;
- AbstractTaskCategory category = TaskCategory.getParentTaskCategory(task);
- if (category != null) {
- TasksUiInternal.getTaskList().removeFromContainer(category, task);
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RenameAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RenameAction.java
deleted file mode 100644
index e7629d0cb..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RenameAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Mik Kersten
- */
-public class RenameAction extends BaseSelectionListenerAction {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.rename"; //$NON-NLS-1$
-
- private final TaskListView view;
-
- public RenameAction(TaskListView view) {
- super(Messages.RenameAction_Rename);
- this.view = view;
- setId(ID);
- setAccelerator(SWT.F2);
- }
-
- @Override
- public void run() {
- Object selectedObject = ((IStructuredSelection) this.view.getViewer().getSelection()).getFirstElement();
- if (selectedObject instanceof IRepositoryElement) {
- IRepositoryElement element = (IRepositoryElement) selectedObject;
- view.setInRenameAction(true);
- view.getViewer().editElement(element, 0);
- view.setInRenameAction(false);
- }
- }
-
- @Override
- protected boolean updateSelection(IStructuredSelection selection) {
- Object selectedObject = selection.getFirstElement();
- if (selectedObject instanceof AbstractTaskCategory) {
- AbstractTaskCategory container = (AbstractTaskCategory) selectedObject;
- return container.isUserManaged();
- } else if (selectedObject instanceof IRepositoryQuery) {
- return true;
- }
- return (selectedObject instanceof LocalTask);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java
deleted file mode 100644
index 544209f99..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizard;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- */
-public class RestoreTaskListAction extends Action implements IViewActionDelegate, IWorkbenchWindowActionDelegate {
-
- public void init(IViewPart view) {
- }
-
- public void run(IAction action) {
- run();
- }
-
- @Override
- public void run() {
- try {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null && !shell.isDisposed()) {
- IWizard wizard = new TaskDataImportWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.CANCEL) {
- dialog.close();
- return;
- }
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void dispose() {
- // ignore
-
- }
-
- public void init(IWorkbenchWindow window) {
- // ignore
-
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SearchForRepositoryTask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SearchForRepositoryTask.java
deleted file mode 100644
index 24fbc9c63..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SearchForRepositoryTask.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.ui.TaskSearchPage;
-import org.eclipse.search.internal.ui.SearchDialog;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- */
-public class SearchForRepositoryTask extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate {
-
- public void run(IAction action) {
- new SearchDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), TaskSearchPage.ID).open();
- }
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void init(IViewPart view) {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowInTaskListAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowInTaskListAction.java
deleted file mode 100644
index 8c2967f0b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowInTaskListAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Willian Mitsuda
- */
-public class ShowInTaskListAction extends BaseSelectionListenerAction {
-
- public ShowInTaskListAction() {
- super(Messages.ShowInTaskListAction_Show_In_Task_List);
- }
-
- @Override
- public void run() {
- IStructuredSelection struSel = getStructuredSelection();
- if (!struSel.isEmpty()) {
- Object element = struSel.getFirstElement();
- if (element instanceof ITask) {
- TasksUiUtil.openTasksViewInActivePerspective();
- TaskListView.getFromActivePerspective().selectedAndFocusTask((AbstractTask) element);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTaskRepositoriesViewAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTaskRepositoriesViewAction.java
deleted file mode 100644
index dde0dc1e8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTaskRepositoriesViewAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Mik Kersten
- */
-public class ShowTaskRepositoriesViewAction implements IViewActionDelegate {
-
- public void init(IViewPart view) {
- }
-
- public void run(IAction action) {
- TaskRepositoriesView.openInActivePerspective();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTasksUiLegendAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTasksUiLegendAction.java
deleted file mode 100644
index 22fcd3b72..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ShowTasksUiLegendAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.ui.dialogs.UiLegendDialog;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.intro.IIntroManager;
-import org.eclipse.ui.intro.IIntroPart;
-
-/**
- * @author Mik Kersten
- * @author Leo Dos Santos
- */
-public class ShowTasksUiLegendAction implements IWorkbenchWindowActionDelegate, IViewActionDelegate {
-
- private IWorkbenchWindow wbWindow;
-
- public void dispose() {
- // ignore
- }
-
- public void init(IWorkbenchWindow window) {
- wbWindow = window;
- }
-
- public void run(IAction action) {
- IIntroManager introMgr = wbWindow.getWorkbench().getIntroManager();
- IIntroPart intro = introMgr.getIntro();
- if (intro != null) {
- introMgr.setIntroStandby(intro, true);
- }
-
- TasksUiUtil.openTasksViewInActivePerspective();
- Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- UiLegendDialog uiLegendDialog = new UiLegendDialog(parentShell);
- uiLegendDialog.open();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
- }
-
- public void init(IViewPart view) {
- wbWindow = view.getViewSite().getWorkbenchWindow();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAllAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAllAction.java
deleted file mode 100644
index 0dc2f4763..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAllAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class SynchronizeAllAction implements IViewActionDelegate {
-
- public void init(IViewPart view) {
- // ignore
- }
-
- public void run(IAction action) {
- TasksUiInternal.synchronizeAllRepositories(true);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAutomaticallyAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAutomaticallyAction.java
deleted file mode 100644
index a84949799..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeAutomaticallyAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-
-/**
- * @author Mik Kersten
- */
-public class SynchronizeAutomaticallyAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.synchronize.background"; //$NON-NLS-1$
-
- public SynchronizeAutomaticallyAction() {
- setText(Messages.SynchronizeAutomaticallyAction_Synchronize_Automatically);
- setToolTipText(Messages.SynchronizeAutomaticallyAction_Synchronize_Automatically);
- setId(ID);
- setChecked(TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
- }
-
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, isChecked());
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction.java
deleted file mode 100644
index 69f7967b3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeEditorAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-
-/**
- * @author Rob Elves
- */
-public class SynchronizeEditorAction extends BaseSelectionListenerAction {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.synchronize.editor"; //$NON-NLS-1$
-
- public SynchronizeEditorAction() {
- super(Messages.SynchronizeEditorAction_Synchronize);
- setToolTipText(Messages.SynchronizeEditorAction_Synchronize_Incoming_Changes);
- setId(ID);
- setImageDescriptor(CommonImages.REFRESH_SMALL);
- // setAccelerator(SWT.MOD1 + 'r');
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- if (getStructuredSelection() != null) {
- for (Iterator it = getStructuredSelection().iterator(); it.hasNext();) {
- runWithSelection(it.next());
- }
- }
- }
-
- private void runWithSelection(final Object selectedObject) {
- final TaskEditor editor;
- final ITask task;
- if (selectedObject instanceof TaskEditor) {
- editor = (TaskEditor) selectedObject;
- task = editor.getTaskEditorInput().getTask();
- } else {
- return;
- }
-
- if (task != null) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- task.getConnectorKind());
- if (connector != null) {
- TasksUiInternal.synchronizeTask(connector, task, true, new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- if (selectedObject instanceof TaskEditor) {
- TaskEditor editor = (TaskEditor) selectedObject;
- editor.refreshPages();
- }
- } finally {
- if (editor != null) {
- editor.showBusy(false);
- }
- }
- }
- });
- }
- });
- }
- if (editor != null) {
- editor.showBusy(true);
- }
- }
-
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java
deleted file mode 100644
index 7e35e8435..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/SynchronizeSelectedAction.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.actions.ActionDelegate;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class SynchronizeSelectedAction extends ActionDelegate implements IViewActionDelegate {
-
- private final Map<AbstractRepositoryConnector, List<RepositoryQuery>> queriesToSyncMap = new LinkedHashMap<AbstractRepositoryConnector, List<RepositoryQuery>>();
-
- private final Map<AbstractRepositoryConnector, List<ITask>> tasksToSyncMap = new LinkedHashMap<AbstractRepositoryConnector, List<ITask>>();
-
- @Override
- public void run(IAction action) {
-
- if (TaskListView.getFromActivePerspective() != null) {
-
- ISelection selection = TaskListView.getFromActivePerspective().getViewer().getSelection();
- for (Object obj : ((IStructuredSelection) selection).toList()) {
- if (obj instanceof IRepositoryQuery) {
- final RepositoryQuery repositoryQuery = (RepositoryQuery) obj;
- AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
- repositoryQuery.getConnectorKind());
- if (client != null) {
- List<RepositoryQuery> queriesToSync = queriesToSyncMap.get(client);
- if (queriesToSync == null) {
- queriesToSync = new ArrayList<RepositoryQuery>();
- queriesToSyncMap.put(client, queriesToSync);
- }
- queriesToSync.add(repositoryQuery);
- }
- } else if (obj instanceof TaskCategory) {
- TaskCategory cat = (TaskCategory) obj;
- for (ITask task : cat.getChildren()) {
- AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
- task.getConnectorKind());
- addTaskToSync(client, task);
- }
- } else if (obj instanceof ITask) {
- AbstractTask repositoryTask = (AbstractTask) obj;
- AbstractRepositoryConnector client = TasksUi.getRepositoryManager().getRepositoryConnector(
- repositoryTask.getConnectorKind());
- addTaskToSync(client, repositoryTask);
- }
- }
-
- if (!queriesToSyncMap.isEmpty()) {
- // determine which repositories to synch changed tasks for
- HashMap<TaskRepository, Set<RepositoryQuery>> repositoriesToSync = new HashMap<TaskRepository, Set<RepositoryQuery>>();
- for (AbstractRepositoryConnector connector : queriesToSyncMap.keySet()) {
- List<RepositoryQuery> queriesToSync = queriesToSyncMap.get(connector);
- if (queriesToSync == null || queriesToSync.isEmpty()) {
- continue;
- }
-
- for (RepositoryQuery query : queriesToSync) {
- TaskRepository repos = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(),
- query.getRepositoryUrl());
- Set<RepositoryQuery> queries = repositoriesToSync.get(repos);
- if (queries == null) {
- queries = new HashSet<RepositoryQuery>();
- repositoriesToSync.put(repos, queries);
- }
- queries.add(query);
- }
- }
-
- for (Map.Entry<TaskRepository, Set<RepositoryQuery>> entry : repositoriesToSync.entrySet()) {
- TaskRepository repository = entry.getKey();
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- Set<RepositoryQuery> queries = entry.getValue();
- TasksUiInternal.synchronizeQueries(connector, repository, queries, null, true);
- }
- }
- if (!tasksToSyncMap.isEmpty()) {
- for (AbstractRepositoryConnector connector : tasksToSyncMap.keySet()) {
- List<ITask> tasksToSync = tasksToSyncMap.get(connector);
- if (tasksToSync != null && tasksToSync.size() > 0) {
- TasksUiInternal.synchronizeTasks(connector, new HashSet<ITask>(tasksToSync), true, null);
- }
- }
- }
-
- }
-
- queriesToSyncMap.clear();
- tasksToSyncMap.clear();
- }
-
- private void addTaskToSync(AbstractRepositoryConnector connector, ITask task) {
- if (connector == null //
- || task instanceof LocalTask //
- || task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
- return;
- }
-
- List<ITask> tasksToSync = tasksToSyncMap.get(connector);
- if (tasksToSync == null) {
- tasksToSync = new ArrayList<ITask>();
- tasksToSyncMap.put(connector, tasksToSync);
- }
- tasksToSync.add(task);
- }
-
- private IAction action;
-
- @Override
- public void init(IAction action) {
- this.action = action;
- }
-
- public void init(IViewPart view) {
- IActionBars actionBars = view.getViewSite().getActionBars();
- actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), action);
- actionBars.updateActionBars();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskActivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskActivateAction.java
deleted file mode 100644
index 5e6259636..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskActivateAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * @author Mik Kersten
- */
-public class TaskActivateAction extends Action implements IViewActionDelegate {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.context.activate"; //$NON-NLS-1$
-
- public TaskActivateAction() {
- setId(ID);
- setText(Messages.TaskActivateAction_Activate);
- setImageDescriptor(TasksUiImages.CONTEXT_ACTIVE_CENTERED);
- }
-
- public void init(IViewPart view) {
- // ignore
- }
-
- @Override
- public void run() {
- run(TaskListView.getFromActivePerspective().getSelectedTask());
- }
-
- public void run(ITask task) {
- if (task != null && !task.isActive()) {
- TasksUi.getTaskActivityManager().activateTask(task);
- }
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // ignore
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskDeactivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskDeactivateAction.java
deleted file mode 100644
index 46fe058f3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskDeactivateAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-
-/**
- * @author Mik Kersten
- */
-public class TaskDeactivateAction extends Action {
-
- public static final String ID = "org.eclipse.mylyn.tasklist.actions.context.deactivate"; //$NON-NLS-1$
-
- public TaskDeactivateAction() {
- setId(ID);
- setText(Messages.TaskDeactivateAction_Deactivate);
- setImageDescriptor(TasksUiImages.CONTEXT_INACTIVE_EMPTY);
- }
-
- public void run(ITask task) {
- try {
- if (task != null) {
- TasksUi.getTaskActivityManager().deactivateTask(task);
- }
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Closing task editor on task deactivation failed", e)); //$NON-NLS-1$
- }
- }
-
- @Override
- public void run() {
- run(TaskListView.getFromActivePerspective().getSelectedTask());
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorCopyAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorCopyAction.java
deleted file mode 100644
index afdfbfea5..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorCopyAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-
-/**
- * TODO: delete?
- *
- * @author Mik Kersten
- */
-public class TaskEditorCopyAction extends Action {
-
- public TaskEditorCopyAction() {
- setText("TaskInfoEditor.copy.text"); //$NON-NLS-1$
- }
-
- @Override
- public void run() {
- // if (editorPart instanceof TaskInfoEditor)
- // ((TaskInfoEditor)editorPart).getCurrentText().copy();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorScheduleAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorScheduleAction.java
deleted file mode 100644
index 77fa4ac3a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskEditorScheduleAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Collections;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.ui.ScheduleTaskMenuContributor;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * @author Mik Kersten
- */
-public class TaskEditorScheduleAction extends Action implements IMenuCreator {
-
- private final ITask task;
-
- private MenuManager menuManager;
-
- private final ScheduleTaskMenuContributor scheduleMenuContributor = new ScheduleTaskMenuContributor();
-
- public TaskEditorScheduleAction(ITask task) {
- this.task = task;
- this.setImageDescriptor(CommonImages.SCHEDULE_DAY);
- setMenuCreator(this);
- }
-
- @Override
- public void run() {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
- TaskActivityUtil.getCurrentWeek().getToday());
- }
-
- public Menu getMenu(Control parent) {
- if (menuManager != null) {
- menuManager.dispose();
- }
- menuManager = scheduleMenuContributor.getSubMenuManager(Collections.singletonList((IRepositoryElement) task));
- menuManager.createContextMenu(parent);
- return menuManager.getMenu();
- }
-
- public Menu getMenu(Menu parent) {
- if (menuManager != null) {
- return menuManager.getMenu();
- }
- return null;
- }
-
- public void dispose() {
- if (menuManager != null) {
- menuManager.dispose();
- }
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskListSortAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskListSortAction.java
deleted file mode 100644
index 0d6ee8f5a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskListSortAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.tasks.ui.dialogs.TaskListSortDialog;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-/**
- * @author Mik Kersten
- */
-public class TaskListSortAction extends Action {
-
- private final TaskListSortDialog dialog;
-
- private final TaskListView taskListView;
-
- public TaskListSortAction(IWorkbenchPartSite site, TaskListView taskListView) {
- super(Messages.TaskListSortAction_Sort_);
- this.taskListView = taskListView;
- setEnabled(true);
- dialog = new TaskListSortDialog(site, taskListView);
- }
-
- @Override
- public void run() {
- if (dialog.open() == Window.OK) {
- taskListView.getViewer().refresh();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
deleted file mode 100644
index f529b4c54..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java
+++ /dev/null
@@ -1,728 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- * Tasktop Technologies - improvements
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TaskSearchPage;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskDetailLabelProvider;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListFilteredTree;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
-import org.eclipse.mylyn.internal.tasks.ui.workingsets.WorkingSetLabelComparator;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.search.internal.ui.SearchDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.dialogs.SearchPattern;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * @author Willian Mitsuda
- * @author Mik Kersten
- * @author Eugene Kuleshov
- * @author Shawn Minto
- */
-public class TaskSelectionDialog extends FilteredItemsSelectionDialog {
-
- private class DeselectWorkingSetAction extends Action {
-
- public DeselectWorkingSetAction() {
- super(Messages.TaskSelectionDialog_Deselect_Working_Set, IAction.AS_PUSH_BUTTON);
- }
-
- @Override
- public void run() {
- setSelectedWorkingSet(null);
- }
- }
-
- private class EditWorkingSetAction extends Action {
-
- public EditWorkingSetAction() {
- super(Messages.TaskSelectionDialog_Edit_Active_Working_Set_, IAction.AS_PUSH_BUTTON);
- }
-
- @Override
- public void run() {
- IWorkingSetEditWizard wizard = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetEditWizard(
- selectedWorkingSet);
- if (wizard != null) {
- WizardDialog dlg = new WizardDialog(getShell(), wizard);
- dlg.open();
- }
- }
- }
-
- private class FilterWorkingSetAction extends Action {
-
- private final IWorkingSet workingSet;
-
- public FilterWorkingSetAction(IWorkingSet workingSet, int shortcutKeyNumber) {
- super("", IAction.AS_RADIO_BUTTON); //$NON-NLS-1$
- this.workingSet = workingSet;
- if (shortcutKeyNumber >= 1 && shortcutKeyNumber <= 9) {
- setText("&" + String.valueOf(shortcutKeyNumber) + " " + workingSet.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- setText(workingSet.getLabel());
- }
- setImageDescriptor(workingSet.getImageDescriptor());
- }
-
- @Override
- public void run() {
- setSelectedWorkingSet(workingSet);
- }
- }
-
- private class SelectWorkingSetAction extends Action {
-
- public SelectWorkingSetAction() {
- super(Messages.TaskSelectionDialog_Select_Working_Set_, IAction.AS_PUSH_BUTTON);
- }
-
- @Override
- public void run() {
- IWorkingSetSelectionDialog dlg = PlatformUI.getWorkbench()
- .getWorkingSetManager()
- .createWorkingSetSelectionDialog(getShell(), false,
- new String[] { TaskWorkingSetUpdater.ID_TASK_WORKING_SET });
- if (selectedWorkingSet != null) {
- dlg.setSelection(new IWorkingSet[] { selectedWorkingSet });
- }
- if (dlg.open() == Window.OK) {
- IWorkingSet[] selection = dlg.getSelection();
- if (selection.length == 0) {
- setSelectedWorkingSet(null);
- } else {
- setSelectedWorkingSet(selection[0]);
- }
- }
- }
- }
-
- private class ShowCompletedTasksAction extends Action {
-
- public ShowCompletedTasksAction() {
- super(Messages.TaskSelectionDialog_Show_Completed_Tasks, IAction.AS_CHECK_BOX);
- }
-
- @Override
- public void run() {
- showCompletedTasks = isChecked();
- applyFilter();
- }
-
- }
-
- private class TaskHistoryItemsComparator implements Comparator<Object> {
-
- Map<AbstractTask, Integer> positionByTask = new HashMap<AbstractTask, Integer>();
-
- public TaskHistoryItemsComparator(List<AbstractTask> history) {
- for (int i = 0; i < history.size(); i++) {
- positionByTask.put(history.get(i), i);
- }
- }
-
- public int compare(Object o1, Object o2) {
- Integer p1 = positionByTask.get(o1);
- Integer p2 = positionByTask.get(o2);
- if (p1 != null && p2 != null) {
- return p2.compareTo(p1);
- }
- return labelProvider.getText(o1).compareTo(labelProvider.getText(o2));
- }
-
- }
-
- /**
- * Integrates {@link FilteredItemsSelectionDialog} history management with Mylyn's task list activation history
- * <p>
- * Due to {@link SelectionHistory} use of memento-based history storage, many methods are overridden
- */
- private class TaskSelectionHistory extends SelectionHistory {
-
- @Override
- public synchronized void accessed(Object object) {
- // ignore, handled by TaskActivationHistory
- }
-
- @Override
- public synchronized boolean contains(Object object) {
- return history.contains(object);
- }
-
- @Override
- public synchronized Object[] getHistoryItems() {
- return history.toArray();
- }
-
- @Override
- public synchronized boolean isEmpty() {
- return history.isEmpty();
- }
-
- @Override
- public void load(IMemento memento) {
- // do nothing because tasklist history handles this
- }
-
- @Override
- public synchronized boolean remove(Object object) {
- taskActivationHistory.removeTask((ITask) object);
- return history.remove(object);
- }
-
- @Override
- protected Object restoreItemFromMemento(IMemento memento) {
- // do nothing because tasklist history handles this
- return null;
- }
-
- @Override
- public void save(IMemento memento) {
- // do nothing because tasklist history handles this
- }
-
- @Override
- protected void storeItemToMemento(Object item, IMemento memento) {
- // do nothing because tasklist history handles this
- }
- }
-
- /**
- * Supports filtering of completed tasks.
- */
- private class TasksFilter extends ItemsFilter {
-
- private Set<ITask> allTasksFromWorkingSets;
-
- /**
- * Stores the task containers from selected working set; empty, which can come from no working set selection or
- * working set with no task containers selected, means no filtering
- */
- private final Set<AbstractTaskContainer> elements;
-
- private final boolean showCompletedTasks;
-
- public TasksFilter(boolean showCompletedTasks, IWorkingSet selectedWorkingSet) {
- super(new SearchPattern());
- // Little hack to force always a match inside any part of task text
- patternMatcher.setPattern("*" + patternMatcher.getPattern()); //$NON-NLS-1$
- this.showCompletedTasks = showCompletedTasks;
-
- elements = new HashSet<AbstractTaskContainer>();
- if (selectedWorkingSet != null) {
- for (IAdaptable adaptable : selectedWorkingSet.getElements()) {
- AbstractTaskContainer container = (AbstractTaskContainer) adaptable.getAdapter(AbstractTaskContainer.class);
- if (container != null) {
- elements.add(container);
- }
- }
- }
- }
-
- @Override
- public boolean equalsFilter(ItemsFilter filter) {
- if (!super.equalsFilter(filter)) {
- return false;
- }
- if (filter instanceof TasksFilter) {
- TasksFilter tasksFilter = (TasksFilter) filter;
- if (showCompletedTasks != tasksFilter.showCompletedTasks) {
- return false;
- }
- return elements.equals(tasksFilter.elements);
- }
- return true;
- }
-
- @Override
- public boolean isConsistentItem(Object item) {
- return item instanceof ITask;
- }
-
- @Override
- public boolean isSubFilter(ItemsFilter filter) {
- if (!super.isSubFilter(filter)) {
- return false;
- }
- if (filter instanceof TasksFilter) {
- TasksFilter tasksFilter = (TasksFilter) filter;
- if (!showCompletedTasks && tasksFilter.showCompletedTasks) {
- return false;
- }
- if (elements.isEmpty()) {
- return true;
- }
- if (tasksFilter.elements.isEmpty()) {
- return false;
- }
- return elements.containsAll(tasksFilter.elements);
- }
- return true;
- }
-
- @Override
- public boolean matchItem(Object item) {
- if (!(item instanceof ITask)) {
- return false;
- }
- if (!showCompletedTasks && ((ITask) item).isCompleted()) {
- return false;
- }
- if (!elements.isEmpty()) {
- if (allTasksFromWorkingSets == null) {
- populateTasksFromWorkingSets();
- }
- if (!allTasksFromWorkingSets.contains(item)) {
- return false;
- }
- }
- return matches(labelProvider.getText(item));
- }
-
- private void populateTasksFromWorkingSets() {
- allTasksFromWorkingSets = new HashSet<ITask>(1000);
- for (ITaskContainer container : elements) {
- allTasksFromWorkingSets.addAll(container.getChildren());
- }
- }
- }
-
- private static final int SEARCH_ID = IDialogConstants.CLIENT_ID + 1;
-
- private static final int CREATE_ID = SEARCH_ID + 1;
-
- private static final String IS_USING_WINDOW_WORKING_SET_SETTING = "IsUsingWindowWorkingSet"; //$NON-NLS-1$
-
- private static final String OPEN_IN_BROWSER_SETTING = "OpenInBrowser"; //$NON-NLS-1$
-
- private static final String SHOW_COMPLETED_TASKS_SETTING = "ShowCompletedTasks"; //$NON-NLS-1$
-
- private static final String TASK_SELECTION_DIALOG_SECTION = "TaskSelectionDialogSection"; //$NON-NLS-1$
-
- private static final String WORKING_SET_NAME_SETTING = "WorkingSetName"; //$NON-NLS-1$
-
- /**
- * Caches all tasks; populated at first access
- */
- private Set<AbstractTask> allTasks;
-
- private Button createTaskButton;
-
- /**
- * Mylyn's task activation history
- */
- private final LinkedHashSet<AbstractTask> history;
-
- private final TaskHistoryItemsComparator itemsComparator;
-
- private final TaskElementLabelProvider labelProvider;
-
- private boolean needsCreateTask;
-
- private boolean openInBrowser;
-
- private Button openInBrowserCheck;
-
- /**
- * Set of filtered working sets
- */
- private IWorkingSet selectedWorkingSet;
-
- private boolean showCompletedTasks;
-
- private final ShowCompletedTasksAction showCompletedTasksAction;
-
- private boolean showExtendedOpeningOptions;
-
- /**
- * Caches the window working set
- */
- private final IWorkingSet windowWorkingSet;
-
- /**
- * Refilters if the current working set content has changed
- */
- private final IPropertyChangeListener workingSetListener = new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE)) {
- if (event.getNewValue().equals(selectedWorkingSet)) {
- applyFilter();
- }
- }
- }
-
- };
-
- private final TaskActivationHistory taskActivationHistory;
-
- public TaskSelectionDialog(Shell parent) {
- super(parent);
- this.taskActivationHistory = TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory();
- this.history = new LinkedHashSet<AbstractTask>(taskActivationHistory.getPreviousTasks());
- this.itemsComparator = new TaskHistoryItemsComparator(new ArrayList<AbstractTask>(history));
- this.needsCreateTask = true;
- this.labelProvider = new TaskElementLabelProvider(false);
- this.showCompletedTasksAction = new ShowCompletedTasksAction();
-
- setSelectionHistory(new TaskSelectionHistory());
- setListLabelProvider(labelProvider);
-
-// setListLabelProvider(new DecoratingLabelProvider(labelProvider, PlatformUI.getWorkbench()
-// .getDecoratorManager()
-// .getLabelDecorator()));
- setDetailsLabelProvider(new TaskDetailLabelProvider());
- setSeparatorLabel(TaskListView.LABEL_VIEW + Messages.TaskSelectionDialog__matches);
-
- // If there is a text selection, use it as the initial filter
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- ISelection selection = window.getSelectionService().getSelection();
- if (selection instanceof ITextSelection) {
- // Get only get first line
- String text = ((ITextSelection) selection).getText();
- int n = text.indexOf('\n');
- if (n > -1) {
- text.substring(0, n);
- }
- setInitialPattern(text);
- }
-
- windowWorkingSet = window.getActivePage().getAggregateWorkingSet();
- selectedWorkingSet = windowWorkingSet;
-
- PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(workingSetListener);
- }
-
- @Override
- public boolean close() {
- PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(workingSetListener);
- if (openInBrowserCheck != null) {
- openInBrowser = openInBrowserCheck.getSelection();
- }
- return super.close();
- }
-
- @Override
- protected Control createButtonBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 0; // create
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
-
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // create help control if needed
- if (isHelpAvailable()) {
- createHelpControl(composite);
- }
- if (needsCreateTask) {
- createTaskButton = createButton(composite, CREATE_ID, Messages.TaskSelectionDialog_New_Task_, true);
- createTaskButton.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- close();
- new NewTaskAction().run();
- }
- });
- }
-
- Label filler = new Label(composite, SWT.NONE);
- filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- layout.numColumns++;
- super.createButtonsForButtonBar(composite); // cancel button
-
- return composite;
- }
-
- @Override
- protected Control createExtendedContentArea(Composite parent) {
- if (!showExtendedOpeningOptions) {
- return null;
- }
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(GridLayoutFactory.swtDefaults().margins(0, 5).create());
- composite.setLayoutData(GridDataFactory.fillDefaults().create());
-
- openInBrowserCheck = new Button(composite, SWT.CHECK);
- openInBrowserCheck.setText(Messages.TaskSelectionDialog_Open_with_Browser);
- openInBrowserCheck.setSelection(openInBrowser);
-
- ImageHyperlink openHyperlink = new ImageHyperlink(composite, SWT.NONE);
- openHyperlink.setText(TaskListFilteredTree.LABEL_SEARCH);
- openHyperlink.setForeground(CommonColors.HYPERLINK_WIDGET);
- openHyperlink.setUnderlined(true);
- openHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent e) {
- getShell().close();
- new SearchDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), TaskSearchPage.ID).open();
- }
-
- });
-
- return composite;
- }
-
- @Override
- protected ItemsFilter createFilter() {
- return new TasksFilter(showCompletedTasks, selectedWorkingSet);
- }
-
- @Override
- protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter,
- IProgressMonitor progressMonitor) throws CoreException {
- progressMonitor.beginTask(Messages.TaskSelectionDialog_Search_for_tasks, 100);
-
- if (allTasks == null) {
- allTasks = new HashSet<AbstractTask>();
- TaskList taskList = TasksUiPlugin.getTaskList();
- allTasks.addAll(taskList.getAllTasks());
- }
- progressMonitor.worked(10);
-
- SubProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, 90);
- subMonitor.beginTask(Messages.TaskSelectionDialog_Scanning_tasks, allTasks.size());
- for (ITask task : allTasks) {
- contentProvider.add(task, itemsFilter);
- subMonitor.worked(1);
- }
- subMonitor.done();
-
- progressMonitor.done();
- }
-
- @Override
- protected void fillViewMenu(IMenuManager menuManager) {
- super.fillViewMenu(menuManager);
- menuManager.add(showCompletedTasksAction);
- menuManager.add(new Separator());
-
- // Fill existing tasks working sets
- menuManager.add(new SelectWorkingSetAction());
- final DeselectWorkingSetAction deselectAction = new DeselectWorkingSetAction();
- menuManager.add(deselectAction);
- final EditWorkingSetAction editAction = new EditWorkingSetAction();
- menuManager.add(editAction);
- menuManager.add(new Separator("lruActions")); //$NON-NLS-1$
- final FilterWorkingSetAction windowWorkingSetAction = new FilterWorkingSetAction(windowWorkingSet, 1);
- menuManager.add(windowWorkingSetAction);
-
- menuManager.addMenuListener(new IMenuListener() {
-
- private final List<ActionContributionItem> lruActions = new ArrayList<ActionContributionItem>();
-
- public void menuAboutToShow(IMenuManager manager) {
- deselectAction.setEnabled(selectedWorkingSet != null);
- editAction.setEnabled(selectedWorkingSet != null && selectedWorkingSet.isEditable());
-
- // Remove previous LRU actions
- for (ActionContributionItem action : lruActions) {
- manager.remove(action);
- }
- lruActions.clear();
-
- // Adds actual LRU actions
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
- Arrays.sort(workingSets, new WorkingSetLabelComparator());
- int count = 2;
- for (IWorkingSet workingSet : workingSets) {
- if (workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- IAction action = new FilterWorkingSetAction(workingSet, count++);
- if (workingSet.equals(selectedWorkingSet)) {
- action.setChecked(true);
- }
- ActionContributionItem ci = new ActionContributionItem(action);
- lruActions.add(ci);
- manager.appendToGroup("lruActions", ci); //$NON-NLS-1$
- }
- }
- windowWorkingSetAction.setChecked(windowWorkingSet.equals(selectedWorkingSet));
- }
-
- });
- }
-
- @Override
- protected IDialogSettings getDialogSettings() {
- IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(TASK_SELECTION_DIALOG_SECTION);
- if (section == null) {
- section = settings.addNewSection(TASK_SELECTION_DIALOG_SECTION);
- section.put(OPEN_IN_BROWSER_SETTING, false);
- section.put(SHOW_COMPLETED_TASKS_SETTING, true);
- section.put(IS_USING_WINDOW_WORKING_SET_SETTING, true);
- section.put(WORKING_SET_NAME_SETTING, ""); //$NON-NLS-1$
- }
- return section;
- }
-
- @Override
- public String getElementName(Object item) {
- return labelProvider.getText(item);
- }
-
- /**
- * Sort tasks by summary
- */
- @SuppressWarnings("unchecked")
- @Override
- protected Comparator getItemsComparator() {
- return itemsComparator;
- }
-
- public boolean getOpenInBrowser() {
- return openInBrowser;
- }
-
- public boolean getShowExtendedOpeningOptions() {
- return showExtendedOpeningOptions;
- }
-
- public boolean needsCreateTask() {
- return needsCreateTask;
- }
-
- @Override
- protected void restoreDialog(IDialogSettings settings) {
- openInBrowser = settings.getBoolean(OPEN_IN_BROWSER_SETTING);
- showCompletedTasks = settings.getBoolean(SHOW_COMPLETED_TASKS_SETTING);
- showCompletedTasksAction.setChecked(showCompletedTasks);
- boolean isUsingWindowWorkingSet = settings.getBoolean(IS_USING_WINDOW_WORKING_SET_SETTING);
- if (isUsingWindowWorkingSet) {
- selectedWorkingSet = windowWorkingSet;
- } else {
- String workingSetName = settings.get(WORKING_SET_NAME_SETTING);
- if (workingSetName != null) {
- selectedWorkingSet = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName);
- }
- }
- super.restoreDialog(settings);
- }
-
- public void setNeedsCreateTask(boolean value) {
- needsCreateTask = value;
- }
-
- public void setOpenInBrowser(boolean openInBrowser) {
- this.openInBrowser = openInBrowser;
- }
-
- /**
- * All working set filter changes should be made through this method; ensures proper history handling and triggers
- * refiltering
- */
- private void setSelectedWorkingSet(IWorkingSet workingSet) {
- selectedWorkingSet = workingSet;
- if (workingSet != null) {
- PlatformUI.getWorkbench().getWorkingSetManager().addRecentWorkingSet(workingSet);
- }
- applyFilter();
- }
-
- public void setShowExtendedOpeningOptions(boolean showExtendedOpeningOptions) {
- this.showExtendedOpeningOptions = showExtendedOpeningOptions;
- }
-
- @Override
- protected void storeDialog(IDialogSettings settings) {
- settings.put(OPEN_IN_BROWSER_SETTING, openInBrowser);
- settings.put(SHOW_COMPLETED_TASKS_SETTING, showCompletedTasks);
- settings.put(IS_USING_WINDOW_WORKING_SET_SETTING, selectedWorkingSet == windowWorkingSet);
- if (selectedWorkingSet == null) {
- settings.put(WORKING_SET_NAME_SETTING, ""); //$NON-NLS-1$
- } else {
- settings.put(WORKING_SET_NAME_SETTING, selectedWorkingSet.getName());
- }
- super.storeDialog(settings);
- }
-
- @Override
- protected IStatus validateItem(Object item) {
- if (item instanceof ITask) {
- return Status.OK_STATUS;
- }
- return new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, Messages.TaskSelectionDialog_Selected_item_is_not_a_task);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java
deleted file mode 100644
index e9b9fdc52..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.internal.tasks.ui.dialogs.AbstractWorkingSetDialogCOPY;
-import org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkingSetComparator;
-import org.eclipse.ui.internal.dialogs.WorkingSetFilter;
-import org.eclipse.ui.internal.dialogs.WorkingSetLabelProvider;
-
-/**
- * Derived from SelectWorkingSetsAction
- *
- * @author Leo Dos Santos
- * @author Mik Kersten
- */
-public class TaskWorkingSetAction extends Action implements IMenuCreator {
-
- public static final String LABEL_SETS_NONE = Messages.TaskWorkingSetAction_All;
-
- private Menu dropDownMenu;
-
- public TaskWorkingSetAction() {
- setText(Messages.TaskWorkingSetAction_Sets);
- setToolTipText(Messages.TaskWorkingSetAction_Select_and_Edit_Working_Sets);
- setImageDescriptor(TasksUiImages.TASK_WORKING_SET);
- setEnabled(true);
- setMenuCreator(this);
- }
-
- public void dispose() {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- dropDownMenu = null;
- }
- }
-
- public Menu getMenu(Control parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- public Menu getMenu(Menu parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- @SuppressWarnings("unchecked")
- private void addActionsToMenu() {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
-
- if (doTaskWorkingSetsExist()) {
- ActionContributionItem itemAll = new ActionContributionItem(new ToggleAllWorkingSetsAction(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()));
-// ActionContributionItem itemNone = new ActionContributionItem(new ToggleNoWorkingSetsAction());
-
- List<IWorkingSet> sortedWorkingSets = Arrays.asList(workingSets);
- Collections.sort(sortedWorkingSets, new WorkingSetComparator());
-
- Iterator<IWorkingSet> iter = sortedWorkingSets.iterator();
- while (iter.hasNext()) {
- IWorkingSet workingSet = iter.next();
- if (workingSet != null
- && workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- ActionContributionItem itemSet = new ActionContributionItem(new ToggleWorkingSetAction(workingSet));
- itemSet.fill(dropDownMenu, -1);
- }
- }
-
- Separator separator = new Separator();
- separator.fill(dropDownMenu, -1);
- itemAll.fill(dropDownMenu, -1);
- }
-
- ActionContributionItem editItem = new ActionContributionItem(new ManageWorkingSetsAction());
- editItem.fill(dropDownMenu, -1);
- }
-
- private boolean doTaskWorkingSetsExist() {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
- for (IWorkingSet workingSet : workingSets) {
- if (workingSet != null && workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void run() {
- String[] ids = new String[1];
- ids[0] = TaskWorkingSetUpdater.ID_TASK_WORKING_SET;
- ConfigureWindowWorkingSetsDialog dialog = new ConfigureWindowWorkingSetsDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow(), ids);
- dialog.open();
- }
-
- public void run(IAction action) {
- this.run();
- }
-
- public void run(IWorkingSet editWorkingSet) {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(editWorkingSet);
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
-
-// dialog.create();
- dialog.open();
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
-// IWorkbenchHelpContextIds.WORKING_SET_EDIT_WIZARD);
-// if (dialog.open() == Window.OK) {
-// editWorkingSet = wizard.getSelection();
-// availableWorkingSetsChanged();
-// // make sure ok button is enabled when the selected working set
-// // is edited. Fixes bug 33386.
-// updateButtonAvailability();
-// }
-// editedWorkingSets.put(editWorkingSet, originalWorkingSet);
- }
-
- private class ManageWorkingSetsAction extends Action {
- ManageWorkingSetsAction() {
- super(Messages.TaskWorkingSetAction_Edit_Label);
- }
-
- @Override
- public void run() {
- TaskWorkingSetAction.this.run(this);
- }
- }
-
- // TODO: remove?
- protected class ToggleEnableAllSetsAction extends Action {
-
- ToggleEnableAllSetsAction() {
- super(Messages.TaskWorkingSetAction_Deselect_All, IAction.AS_CHECK_BOX);
-// setImageDescriptor(TasksUiImages.TASK_WORKING_SET);
-// setChecked(!areAllTaskWorkingSetsEnabled());
- }
-
- @Override
- public void runWithEvent(Event event) {
- Set<IWorkingSet> newList = new HashSet<IWorkingSet>(Arrays.asList(TaskWorkingSetUpdater.getEnabledSets()));
-
- Set<IWorkingSet> tempList = new HashSet<IWorkingSet>();
- Iterator<IWorkingSet> iter = newList.iterator();
- while (iter.hasNext()) {
- IWorkingSet workingSet = iter.next();
- if (workingSet != null
- && workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- tempList.add(workingSet);
- }
- }
- newList.removeAll(tempList);
-
- if (isChecked()) {
- IWorkingSet[] allWorkingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
- for (IWorkingSet workingSet : allWorkingSets) {
- if (workingSet != null
- && workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- newList.add(workingSet);
- }
- }
- }
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setWorkingSets(
- newList.toArray(new IWorkingSet[newList.size()]));
- }
-
- }
-
- class ConfigureWindowWorkingSetsDialog extends AbstractWorkingSetDialogCOPY {
-
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
-
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 50;
-
- private final IWorkbenchWindow window;
-
- private CheckboxTableViewer viewer;
-
- private Set<String> taskWorkingSetIds;
-
- protected ConfigureWindowWorkingSetsDialog(IWorkbenchWindow window, String[] workingSetIds) {
- super(window.getShell(), workingSetIds, true);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- this.window = window;
- //setTitle(WorkbenchMessages.WorkingSetSelectionDialog_title_multiSelect);
- setTitle(Messages.TaskWorkingSetAction_Select_and_Edit_Working_Sets);
- setMessage(""); //$NON-NLS-1$
-
- if (workingSetIds == null || workingSetIds.length == 0) {
- taskWorkingSetIds = null;
- } else {
- taskWorkingSetIds = new HashSet<String>();
- for (String id : workingSetIds) {
- taskWorkingSetIds.add(id);
- }
- }
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = (Composite) super.createDialogArea(parent);
-
- Composite viewerComposite = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = layout.marginWidth = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- viewerComposite.setLayout(layout);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH + 300; // fudge? I like fudge.
- viewerComposite.setLayoutData(data);
-
- viewer = CheckboxTableViewer.newCheckList(viewerComposite, SWT.BORDER);
- viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
- viewer.setLabelProvider(new WorkingSetLabelProvider());
- viewer.setContentProvider(new ArrayContentProvider());
- viewer.addFilter(new WorkingSetFilter(taskWorkingSetIds));
- viewer.setInput(window.getWorkbench().getWorkingSetManager().getWorkingSets());
-
- viewer.setCheckedElements(window.getActivePage().getWorkingSets());
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged();
- }
- });
-
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
-
- viewer.getControl().setLayoutData(data);
- addModifyButtons(viewerComposite);
-
- addSelectionButtons(composite);
-
- availableWorkingSetsChanged();
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- @Override
- protected void okPressed() {
- Set<IWorkingSet> newList = new HashSet<IWorkingSet>(Arrays.asList(TaskWorkingSetUpdater.getEnabledSets()));
- Set<IWorkingSet> tempList = new HashSet<IWorkingSet>();
- for (IWorkingSet workingSet : newList) {
- for (String id : taskWorkingSetIds) {
- if (workingSet.getId().equalsIgnoreCase(id)) {
- tempList.add(workingSet);
- }
- }
- }
- newList.removeAll(tempList);
-
- Object[] selection = viewer.getCheckedElements();
- IWorkingSet[] setsToEnable = new IWorkingSet[selection.length];
- System.arraycopy(selection, 0, setsToEnable, 0, selection.length);
- newList.addAll(new HashSet<IWorkingSet>(Arrays.asList(setsToEnable)));
-
- window.getActivePage().setWorkingSets(newList.toArray(new IWorkingSet[newList.size()]));
- super.okPressed();
- }
-
- @Override
- protected List<?> getSelectedWorkingSets() {
- ISelection selection = viewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- return ((IStructuredSelection) selection).toList();
- }
- return null;
- }
-
- @Override
- protected void availableWorkingSetsChanged() {
- viewer.setInput(window.getWorkbench().getWorkingSetManager().getWorkingSets());
- super.availableWorkingSetsChanged();
- }
-
- /**
- * Called when the selection has changed.
- */
- void handleSelectionChanged() {
- updateButtonAvailability();
- }
-
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- }
-
- @Override
- protected void selectAllSets() {
- viewer.setCheckedElements(window.getWorkbench().getWorkingSetManager().getWorkingSets());
- updateButtonAvailability();
- }
-
- @Override
- protected void deselectAllSets() {
- viewer.setCheckedElements(new Object[0]);
- updateButtonAvailability();
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleAllWorkingSetsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleAllWorkingSetsAction.java
deleted file mode 100644
index bbee79fef..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleAllWorkingSetsAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * @author Mik Kersten
- */
-public class ToggleAllWorkingSetsAction extends Action {
-
- private final IWorkbenchWindow window;
-
- public ToggleAllWorkingSetsAction(IWorkbenchWindow window) {
- super(Messages.ToggleAllWorkingSetsAction_Show_All, IAction.AS_CHECK_BOX);
- super.setChecked(TaskWorkingSetUpdater.areNoTaskWorkingSetsEnabled());
- this.window = window;
- }
-
- @Override
- public void run() {
- Set<IWorkingSet> newList = new HashSet<IWorkingSet>(Arrays.asList(TaskWorkingSetUpdater.getEnabledSets()));
-
- Set<IWorkingSet> tempList = new HashSet<IWorkingSet>();
- Iterator<IWorkingSet> iter = newList.iterator();
- while (iter.hasNext()) {
- IWorkingSet workingSet = iter.next();
- if (workingSet != null && workingSet.getId() != null
- && workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- tempList.add(workingSet);
- }
- }
- newList.removeAll(tempList);
- window.getActivePage().setWorkingSets(newList.toArray(new IWorkingSet[newList.size()]));
- }
-
- @Override
- public void runWithEvent(Event event) {
- run();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java
deleted file mode 100644
index f049297c8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-
-/**
- * @author Mik Kersten
- */
-public class ToggleTaskActivationAction extends Action implements ITaskActivationListener {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.actions.task.activation.toggle"; //$NON-NLS-1$
-
- private final ITask task;
-
- /**
- * @param task
- * cannot be null
- * @param toolBarManager
- * cannot be null
- */
- public ToggleTaskActivationAction(ITask task) {
- Assert.isNotNull(task);
- this.task = task;
- setId(ID);
- setImageDescriptor(TasksUiImages.CONTEXT_ACTIVE_CENTERED);
- update();
- TasksUi.getTaskActivityManager().addActivationListener(this);
- }
-
- public void dispose() {
- TasksUi.getTaskActivityManager().removeActivationListener(this);
- }
-
- private void update() {
- setChecked(task.isActive());
- if (task.isActive()) {
- setText(Messages.ToggleTaskActivationAction_Deactivate_Task);
- setToolTipText(Messages.ToggleTaskActivationAction_Deactivate_Task);
- } else {
- setText(Messages.ToggleTaskActivationAction_Activate_Task);
- setToolTipText(Messages.ToggleTaskActivationAction_Activate_Task);
- }
- }
-
- @Override
- public void run() {
- if (!task.isActive()) {
- TasksUi.getTaskActivityManager().activateTask(task);
- } else {
- TasksUi.getTaskActivityManager().deactivateTask(task);
- }
- update();
- }
-
- public void taskActivated(ITask task) {
- update();
- }
-
- public void taskDeactivated(ITask task) {
- update();
- }
-
- public void preTaskActivated(ITask task) {
- // ignore
- }
-
- public void preTaskDeactivated(ITask task) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleWorkingSetAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleWorkingSetAction.java
deleted file mode 100644
index ef156b0e7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleWorkingSetAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.actions;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.bindings.keys.IKeyLookup;
-import org.eclipse.jface.bindings.keys.KeyLookupFactory;
-import org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- */
-public class ToggleWorkingSetAction extends Action {
-
- private final IWorkingSet workingSet;
-
- public ToggleWorkingSetAction(IWorkingSet set) {
- super(set.getLabel(), IAction.AS_CHECK_BOX);
- setImageDescriptor(set.getImageDescriptor());
- this.workingSet = set;
- setChecked(TaskWorkingSetUpdater.isWorkingSetEnabled(set));
- }
-
- @Override
- public void run() {
- runWithEvent(null);
- }
-
- @Override
- public void runWithEvent(Event event) {
- Set<IWorkingSet> newList = new HashSet<IWorkingSet>(Arrays.asList(TaskWorkingSetUpdater.getEnabledSets()));
-
- boolean modified = false;
- if (event != null) {
- modified = (event.stateMask & KeyLookupFactory.getDefault().formalModifierLookup(IKeyLookup.M1_NAME)) != 0;
- }
-
- if (!modified) {
- // Default behavior is to act as a radio button.
- Set<IWorkingSet> tempList = new HashSet<IWorkingSet>();
- Iterator<IWorkingSet> iter = newList.iterator();
- while (iter.hasNext()) {
- IWorkingSet workingSet = iter.next();
- if (workingSet != null && workingSet.getId() != null
- && workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- tempList.add(workingSet);
- }
- }
- newList.removeAll(tempList);
-
- if (isChecked()) {
- newList.add(workingSet);
- } else {
- // If multiples were previously selected, make this action active
- if (!TaskWorkingSetUpdater.isOnlyTaskWorkingSetEnabled(workingSet)) {
- newList.add(workingSet);
- }
- }
- } else {
- // If modifier key is pressed, de/selections are additive.
- if (isChecked()) {
- newList.add(workingSet);
- } else {
- newList.remove(workingSet);
- }
- }
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().setWorkingSets(
- newList.toArray(new IWorkingSet[newList.size()]));
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
deleted file mode 100644
index 0d3c7e055..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/messages.properties
+++ /dev/null
@@ -1,156 +0,0 @@
-AbstractChangeCompletionAction_Mark_selected_local_tasks_X=Mark selected local tasks {0}?
-ActivateTaskDialogAction_Activate_Task=Activate Task
-ActivateTaskDialogAction_Select_a_task_to_activate__=&Select a task to activate (? = any character, * = any String):
-
-ActivateTaskHistoryDropDownAction_Activate_Previous_Task=Activate Previous Task
-
-AddRepositoryAction_Add_new_query=Add new query
-
-AddRepositoryAction_Add_a_query_to_the_Task_List=Would you like to add a query to the Task List for this repository?
-AddRepositoryAction_Add_Task_Repository=Add Task Repository...
-AddRepositoryAction_Do_not_show_again=Do not show again
-
-ClearOutgoingAction_Clear_outgoing=Clear outgoing
-ClearOutgoingAction_Clear_outgoing_failed=Clear outgoing failed
-ClearOutgoingAction_Confirm_discard=Confirm discard
-ClearOutgoingAction_Discard_all_outgoing_changes_=Discard all outgoing changes?
-
-CloneTaskAction_Clone_Task_Failed=Clone Task Failed
-CloneTaskAction_Clone_This_Task=Clone This Task
-CloneTaskAction_Cloned_from_=Cloned from\:\
-
-CollapseAllAction_Collapse_All=Collapse All
-
-CompareAttachmentsAction_Compare__=Compare (
-CompareAttachmentsAction_Compare_Attachments=Compare Attachments
-CompareAttachmentsAction_Failed_to_find_attachment=Failed to find attachment\:\
-
-CopyCommentDetailsAction_Copy_User_ID=Copy User ID
-CopyCommentDetailsAction_Copy_User_ID_Tooltip=Copy User ID of Comment Author to Clipboard
-CopyTaskDetailsAction_Copy_Details=Copy Details
-
-DeleteAction_Confirm_Delete=Confirm Delete
-DeleteAction_Delete=Delete
-DeleteAction_Delete_all_of_the_unsubmitted_tasks=Delete all of the unsubmitted tasks?
-DeleteAction_Delete_the_elements_listed_below=Delete the elements listed below? If categories or queries are selected contained tasks will not be deleted. Contexts will be deleted for selected tasks.
-DeleteAction_Delete_failed=Delete failed
-DeleteAction_Delete_in_progress=Deleting task list elements
-DeleteAction_Delete_the_planning_information_and_context_for_the_repository_task=Delete the planning information and context for the repository task? The server copy will not be deleted and the task will remain in queries that match it.
-DeleteAction_Delete_the_planning_information_and_context_of_all_unmatched_tasks=Delete the planning information and context of all unmatched tasks? The server copy of these tasks will not be deleted and the task will remain in queries that match it.
-DeleteAction_Nothing_selected=Nothing selected.
-DeleteAction_Permanently_delete_the_category=Permanently delete the category? Local tasks will be moved to the Uncategorized folder. Repository tasks will be moved to the Unmatched folder.
-DeleteAction_Permanently_delete_the_element_listed_below=Permanently delete the element listed below?
-DeleteAction_Permanently_delete_the_query=Permanently delete the query? Contained tasks will be moved to the Unmatched folder.
-DeleteAction_Permanently_delete_the_task_listed_below=Permanently delete the task listed below?
-
-
-DeleteTaskRepositoryAction_Confirm_Delete=Confirm Delete
-DeleteTaskRepositoryAction_Delete_Specific_Task_Repository=Are you sure you want to delete task repository "{0}"?
-DeleteTaskRepositoryAction_Delete_Repository=Delete Repository
-DeleteTaskRepositoryAction_Delete_Repository_In_Progress=Deleting repository and related artifacts
-DeleteTaskRepositoryAction_Delete_the_selected_task_repositories=This repository is being used by {0} tasks and {1} queries. Do you wish to delete the repository, tasks, and queries?
-DeleteTaskRepositoryAction_Delete_Task_Repository_Failed=Delete Task Repository Failed
-
-EditRepositoryPropertiesAction_Properties=Properties
-
-ExpandAllAction_Expand_All=Expand All
-ExportAction_Dialog_Title=Task List Export
-ExportAction_Nothing_selected=Nothing selected.
-ExportAction_Problems_encountered=Problems encountered during export. See error log for details.
-ExportAction_X_exists_Do_you_wish_to_overwrite={0} exists. Do you wish to overwrite?
-
-FilterCompletedTasksAction_Filter_Completed_Tasks=Filter Completed Tasks
-
-GoIntoAction_Go_Into=Go Into
-
-GoUpAction_Go_Up_To_Root=Go Up To Root
-
-GroupSubTasksAction_Group_Subtasks=Group Subtasks
-ImportAction_Dialog_Title=Task List Import
-ImportAction_Problems_encountered=Problems encountered during importing. See error log for details
-
-LinkWithEditorAction_Link_with_Editor=&Link with Editor
-
-NewCategoryAction_A_category_with_this_name_already_exists=A category with this name already exists, please choose another name.
-NewCategoryAction_Enter_name=Enter name
-NewCategoryAction_Enter_a_name_for_the_Category=Enter a name for the Category\:\
-NewCategoryAction_New_Category=New Category
-NewCategoryAction_New_Category_=New Category...
-NewCategoryAction_A_query_with_this_name_already_exists=A query with this name already exists, please choose another name.
-NewQueryAction_new_query_=New Query...
-
-NewSubTaskAction_The_connector_does_not_support_creating_subtasks_for_this_task=The connector does not support creating subtasks for this task
-NewSubTaskAction_Could_not_initialize_sub_task_data_for_task_=Could not initialize sub task data for task\:\
-NewSubTaskAction_Could_not_retrieve_task_data_for_task_=Could not retrieve task data for task:
-NewSubTaskAction_Create_a_new_subtask=Create a new subtask
-NewSubTaskAction_Failed_to_create_new_sub_task_=Failed to create new sub task:
-NewSubTaskAction_Subtask=Subtask
-NewSubTaskAction_Unable_to_create_subtask=Unable to create subtask
-
-NewTaskAction_new_task=New Task
-NewTaskFromSelectionAction_Comment_=Comment\:\
-NewTaskFromSelectionAction____Created_from_Comment___=-- Created from Comment --
-NewTaskFromSelectionAction_New_Task_from_Selection=New Task from Selection
-NewTaskFromSelectionAction_Nothing_selected_to_create_task_from=Nothing selected to create task from.
-NewTaskFromSelectionAction_URL_=URL\:\
-
-OpenRepositoryTask_Could_not_find_matching_repository_task=Could not find matching repository task.
-OpenRepositoryTask_Open_Repository_Task=Open Repository Task
-OpenRepositoryTask_Open_Task=Open Task
-
-OpenTaskAction_Open_Task=Open Task
-OpenTaskAction_Select_a_task_to_open__=&Select a task to open (? = any character, * = any String)\:
-
-OpenTaskListElementAction_Open=Open
-OpenTaskListElementAction_Open_Task_List_Element=Open Task List Element
-
-OpenTasksUiPreferencesAction_Preferences_=Preferences...
-
-OpenWithBrowserAction_Open_with_Browser=Open with Browser
-
-PresentationDropDownSelectionAction_Task_Presentation=Task Presentation
-
-QueryCloneAction_Clone_Query=Clone Query
-QueryCloneAction_Copy_of_X=Copy of {0}
-QueryCloneAction_No_query_selected=No query selected.
-
-RefreshRepositoryTasksAction_Refresh_All_Tasks=Refresh All Tasks
-
-RemoveFromCategoryAction_Remove_From_Category=Remove From Category
-
-RenameAction_Rename=Rename
-
-ShowInTaskListAction_Show_In_Task_List=&Show In Task List
-
-SynchronizeAutomaticallyAction_Synchronize_Automatically=Synchronize Automatically
-
-SynchronizeEditorAction_Synchronize=Synchronize
-SynchronizeEditorAction_Synchronize_Incoming_Changes=Synchronize Incoming Changes
-
-TaskActivateAction_Activate=Activate
-
-TaskDeactivateAction_Deactivate=Deactivate
-
-TaskListSortAction_Sort_=Sort...
-
-TaskSelectionDialog__matches=\ matches
-TaskSelectionDialog_Deselect_Working_Set=&Deselect Working Set
-TaskSelectionDialog_Edit_Active_Working_Set_=&Edit Active Working Set...
-TaskSelectionDialog_New_Task_=&New Task...
-TaskSelectionDialog_Open_with_Browser=Open with &Browser
-TaskSelectionDialog_Scanning_tasks=Scanning tasks
-TaskSelectionDialog_Search_for_tasks=Search for tasks
-TaskSelectionDialog_Select_Working_Set_=Select &Working Set...
-TaskSelectionDialog_Selected_item_is_not_a_task=Selected item is not a task
-TaskSelectionDialog_Show_Completed_Tasks=Show &Completed Tasks
-
-TaskWorkingSetAction_All=All
-TaskWorkingSetAction_Deselect_All=Deselect All
-TaskWorkingSetAction_Edit_Label=&Edit...
-TaskWorkingSetAction_Select_and_Edit_Working_Sets=Select and Edit Working Sets
-TaskWorkingSetAction_Sets=Sets
-
-ToggleAllWorkingSetsAction_Show_All=Show All
-
-ToggleTaskActivationAction_Activate_Task=Activate Task
-ToggleTaskActivationAction_Deactivate_Task=Deactivate Task
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskHandler.java
deleted file mode 100644
index 39666096b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Steffen Pingel
- */
-public abstract class AbstractTaskHandler extends AbstractHandler {
-
- protected boolean recurse;
-
- public AbstractTaskHandler() {
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- Object[] items = ((IStructuredSelection) selection).toArray();
- for (Object item : items) {
- process(event, item, recurse);
- }
- }
- return null;
- }
-
- private void process(ExecutionEvent event, Object item, boolean recurse) throws ExecutionException {
- if (item instanceof ITask) {
- execute(event, (ITask) item);
- }
- if (item instanceof ITaskContainer && (recurse || !(item instanceof AbstractTask))) {
- execute(event, (ITaskContainer) item);
- }
- }
-
- protected void execute(ExecutionEvent event, ITaskContainer item) throws ExecutionException {
- for (ITask task : item.getChildren()) {
- process(event, task, true);
- }
- }
-
- protected void execute(ExecutionEvent event, ITask task) throws ExecutionException {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskListViewHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskListViewHandler.java
deleted file mode 100644
index 7f833b34d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AbstractTaskListViewHandler.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import java.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Steffen Pingel
- */
-public abstract class AbstractTaskListViewHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchSite site = HandlerUtil.getActiveSite(event);
- if (site instanceof IViewSite) {
- IViewSite viewSite = (IViewSite) site;
- IWorkbenchPart part = viewSite.getPart();
- if (part instanceof TaskListView) {
- TaskListView taskListView = (TaskListView) part;
- execute(event, taskListView);
- }
- }
- return null;
- }
-
- protected void execute(ExecutionEvent event, TaskListView taskListView) throws ExecutionException {
- ITreeSelection selection = (ITreeSelection) taskListView.getViewer().getSelection();
- for (Iterator<?> it = selection.iterator(); it.hasNext();) {
- Object item = it.next();
- if (item instanceof IRepositoryElement) {
- execute(event, taskListView, (IRepositoryElement) item);
- }
- }
- }
-
- protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item)
- throws ExecutionException {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AddTaskRepositoryHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AddTaskRepositoryHandler.java
deleted file mode 100644
index 4217f8149..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/AddTaskRepositoryHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- * Tasktop Technologies - improvements
- * Peter Stibrany - fix for parameter name (bug 247077)
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewRepositoryWizard;
-import org.eclipse.mylyn.tasks.ui.wizards.TaskRepositoryWizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Displays a wizard dialog for adding a new task repository.
- *
- * @author Willian Mitsuda
- * @author Steffen Pingel
- */
-public class AddTaskRepositoryHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Shell shell = HandlerUtil.getActiveShell(event);
- if (shell != null && !shell.isDisposed()) {
- String connectorKind = event.getParameter("connectorKind"); //$NON-NLS-1$
- NewRepositoryWizard repositoryWizard = new NewRepositoryWizard(connectorKind);
-
- WizardDialog repositoryDialog = new TaskRepositoryWizardDialog(shell, repositoryWizard);
- repositoryDialog.create();
- repositoryDialog.getShell().setText(Messages.AddTaskRepositoryHandler_Add_Task_Repository);
- repositoryDialog.setBlockOnOpen(true);
- repositoryDialog.open();
- if (repositoryDialog.getReturnCode() == Window.OK) {
- return repositoryWizard.getTaskRepository();
- }
- }
-
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java
deleted file mode 100644
index 0aed92281..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/CollapseAllHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-
-/**
- * @author Steffen Pingel
- */
-// TODO e3.4 replace with org.eclipse.ui.handlers.CollapseAllHandler
-public class CollapseAllHandler extends AbstractHandler {
-
- public static final String ID_COMMAND = "org.eclipse.ui.navigate.collapseAll"; //$NON-NLS-1$
-
- private final AbstractTreeViewer treeViewer;
-
- public CollapseAllHandler(AbstractTreeViewer treeViewer) {
- Assert.isNotNull(treeViewer);
- this.treeViewer = treeViewer;
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- treeViewer.collapseAll();
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/GoToUnreadTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/GoToUnreadTaskHandler.java
deleted file mode 100644
index 1723ac970..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/GoToUnreadTaskHandler.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker;
-import org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker.Direction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker.TreeVisitor;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Steffen Pingel
- */
-public abstract class GoToUnreadTaskHandler extends AbstractTaskListViewHandler {
-
- public static final String ID_NEXT = "org.eclipse.mylyn.tasklist.actions.goToNextUnread"; //$NON-NLS-1$
-
- public static final String ID_PREVIOUS = "org.eclipse.mylyn.tasklist.actions.goToPreviousUnread"; //$NON-NLS-1$
-
- private Direction direction = Direction.DOWN;
-
- public Direction getDirection() {
- return direction;
- }
-
- private TreePath getUnreadItem(TreeViewer treeViewer, Tree tree) {
- TreeItem[] selection = tree.getSelection();
- TreeItem selectedItem = (selection.length > 0) ? selection[0] : null;
-
- TreeVisitor visitor = new TreeVisitor() {
- @Override
- public boolean visit(Object object) {
- if (object instanceof ITask) {
- ITask task = (ITask) object;
- if (task.getSynchronizationState().isIncoming()) {
- return true;
- }
- }
- return false;
- }
- };
-
- TreeWalker treeWalker = new TreeWalker(treeViewer);
- treeWalker.setDirection(direction);
- treeWalker.setExpandNodes(true);
- return treeWalker.walk(visitor, selectedItem);
- }
-
- @Override
- protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item) {
- TreeViewer treeViewer = taskListView.getViewer();
- Tree tree = treeViewer.getTree();
-
- // need to expand nodes to traverse the tree, disable redraw to avoid flickering
- TreePath treePath = null;
- try {
- tree.setRedraw(false);
- treePath = getUnreadItem(treeViewer, tree);
- } finally {
- tree.setRedraw(true);
- }
-
- if (treePath != null) {
- treeViewer.expandToLevel(treePath, 0);
- treeViewer.setSelection(new TreeSelection(treePath), true);
- }
- }
-
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
- public static void execute(ExecutionEvent event, Direction direction) throws ExecutionException {
- GoToUnreadTaskHandler handler = new GoToUnreadTaskHandler() {
- };
- handler.setDirection(direction);
- handler.execute(event);
- }
-
- public static class GoToNextUnreadTaskHandler extends GoToUnreadTaskHandler {
-
- public GoToNextUnreadTaskHandler() {
- setDirection(Direction.DOWN);
- }
-
- }
-
- public static class GoToPreviousUnreadTaskHandler extends GoToUnreadTaskHandler {
-
- public GoToPreviousUnreadTaskHandler() {
- setDirection(Direction.UP);
- }
-
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MarkTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MarkTaskHandler.java
deleted file mode 100644
index 57e024d94..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MarkTaskHandler.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import java.util.Collections;
-import java.util.Date;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Steffen Pingel
- */
-public abstract class MarkTaskHandler extends AbstractTaskHandler {
-
- public static class ClearOutgoingHandler extends AbstractTaskHandler {
- @Override
- protected void execute(ExecutionEvent event, ITask task) throws ExecutionException {
- ClearOutgoingAction action = new ClearOutgoingAction(Collections.singletonList((IRepositoryElement) task));
- if (action.isEnabled()) {
- action.run();
- }
- }
- }
-
- public static class MarkTaskCompleteHandler extends AbstractTaskHandler {
-
- public static final String ID_COMMAND = "org.eclipse.mylyn.tasks.ui.command.markTaskComplete"; //$NON-NLS-1$
-
- @Override
- protected void execute(ExecutionEvent event, ITask task) throws ExecutionException {
- if (TasksUiInternal.hasLocalCompletionState(task)) {
- task.setCompletionDate(new Date());
- TasksUiPlugin.getTaskList().notifyElementChanged(task);
- }
- }
- }
-
- public static class MarkTaskIncompleteHandler extends AbstractTaskHandler {
- @Override
- protected void execute(ExecutionEvent event, ITask task) throws ExecutionException {
- if (TasksUiInternal.hasLocalCompletionState(task)) {
- task.setCompletionDate(null);
- TasksUiPlugin.getTaskList().notifyElementChanged(task);
- }
- }
- }
-
- public static class MarkTaskReadHandler extends AbstractTaskHandler {
- @Override
- protected void execute(ExecutionEvent event, ITask task) throws ExecutionException {
- TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
- }
- }
-
- public static class MarkTaskUnreadHandler extends AbstractTaskHandler {
- @Override
- protected void execute(ExecutionEvent event, ITask task) throws ExecutionException {
- TasksUiPlugin.getTaskDataManager().setTaskRead(task, false);
- }
- }
-
- public static class MarkTaskReadGoToNextUnreadTaskHandler extends AbstractTaskListViewHandler {
- @Override
- protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item)
- throws ExecutionException {
- if (item instanceof ITask) {
- ITask task = (ITask) item;
- TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
- GoToUnreadTaskHandler.execute(event, org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker.Direction.DOWN);
- }
- }
- }
-
- public static class MarkTaskReadGoToPreviousUnreadTaskHandler extends AbstractTaskListViewHandler {
- @Override
- protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item)
- throws ExecutionException {
- if (item instanceof ITask) {
- ITask task = (ITask) item;
- TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
- GoToUnreadTaskHandler.execute(event, org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker.Direction.UP);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MaximizePartHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MaximizePartHandler.java
deleted file mode 100644
index f1ad5170f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/MaximizePartHandler.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jingwen Ou and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jingwen Ou - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author
- */
-public class MaximizePartHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchSite site = HandlerUtil.getActiveSite(event);
- if (site instanceof IEditorSite) {
- IWorkbenchPart part = ((IEditorSite) site).getPart();
- if (part instanceof FormEditor) {
- IFormPage page = ((FormEditor) part).getActivePageInstance();
- Control focusedControl = EditorUtil.getFocusControl(page);
- if (focusedControl != null) {
- Object data = focusedControl.getData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION);
- if (data instanceof IAction) {
- IAction action = (IAction) data;
- action.setChecked(!action.isChecked());
- action.run();
- }
- }
- }
- }
-
- return null;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/Messages.java
deleted file mode 100644
index f00f90ffd..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/Messages.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.commands.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String AddTaskRepositoryHandler_Add_Task_Repository;
-
- public static String NewLocalTaskHandler_Could_not_create_local_task;
-
- public static String OpenTaskAttachmentInDefaultEditorHandler_Failed_to_open_editor;
-
- public static String OpenTaskAttachmentInDefaultEditorHandler_No_default_editor_for_X_found;
-
- public static String OpenTaskAttachmentInDefaultEditorHandler_Open_Attachment_Failed;
-
- public static String RemoteTaskSelectionDialog_Add_;
-
- public static String RemoteTaskSelectionDialog_Add_to_Task_List_category;
-
- public static String RemoteTaskSelectionDialog_Enter_Key_ID__use_comma_for_multiple_;
-
- public static String RemoteTaskSelectionDialog_Enter_a_valid_task_ID;
-
- public static String RemoteTaskSelectionDialog_Matching_tasks;
-
- public static String RemoteTaskSelectionDialog_Select_a_task_or_repository;
-
- public static String RemoteTaskSelectionDialog_Select_a_task_repository;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewLocalTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewLocalTaskHandler.java
deleted file mode 100644
index 524bf3390..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewLocalTaskHandler.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Steffen Pingel
- */
-public class NewLocalTaskHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchSite site = HandlerUtil.getActiveSite(event);
- if (site instanceof IViewSite) {
- IViewSite viewSite = (IViewSite) site;
- IWorkbenchPart part = viewSite.getPart();
- if (part instanceof TaskListView) {
- TaskListView taskListView = (TaskListView) part;
- NewTaskAction action = new NewTaskAction();
- try {
- action.setInitializationData(null, null, "local"); //$NON-NLS-1$
- } catch (CoreException e) {
- throw new ExecutionException(Messages.NewLocalTaskHandler_Could_not_create_local_task, e);
- }
- action.selectionChanged(action, taskListView.getViewer().getSelection());
- if (action.isEnabled()) {
- action.run();
- }
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewSubTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewSubTaskHandler.java
deleted file mode 100644
index 90ca64726..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/NewSubTaskHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewSubTaskAction;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Shawn Minto
- */
-public class NewSubTaskHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchSite site = HandlerUtil.getActiveSite(event);
- if (site instanceof IViewSite) {
- IViewSite viewSite = (IViewSite) site;
- IWorkbenchPart part = viewSite.getPart();
- if (part instanceof TaskListView) {
- TaskListView taskListView = (TaskListView) part;
- NewSubTaskAction action = new NewSubTaskAction();
- action.selectionChanged(action, taskListView.getViewer().getSelection());
- if (action.isEnabled()) {
- action.run();
- }
- return null;
- }
- }
- return null;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenRepositoryTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenRepositoryTaskHandler.java
deleted file mode 100644
index 24b119ebd..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenRepositoryTaskHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenRepositoryTaskAction;
-
-/**
- * @author Steffen Pingel
- */
-public class OpenRepositoryTaskHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- new OpenRepositoryTaskAction().run(null);
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenSelectedTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenSelectedTaskHandler.java
deleted file mode 100644
index 7cf87c323..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenSelectedTaskHandler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Steffen Pingel
- */
-public class OpenSelectedTaskHandler extends AbstractTaskListViewHandler {
-
- @Override
- protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item) {
- if (item instanceof ITask) {
- TasksUiInternal.openTaskInBackground((AbstractTask) item, true);
- }
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInBrowserHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInBrowserHandler.java
deleted file mode 100644
index 5922bfaa9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInBrowserHandler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Steffen Pingel
- */
-public class OpenTaskAttachmentInBrowserHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- List<?> items = ((IStructuredSelection) selection).toList();
- for (Object item : items) {
- if (item instanceof ITaskAttachment) {
- TasksUiUtil.openUrl(((ITaskAttachment) item).getUrl());
- }
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInDefaultEditorHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInDefaultEditorHandler.java
deleted file mode 100644
index 2d8969a11..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskAttachmentInDefaultEditorHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskAttachmentEditorInput;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Steffen Pingel
- */
-public class OpenTaskAttachmentInDefaultEditorHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPage page = null;
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- List<?> items = ((IStructuredSelection) selection).toList();
- for (Object item : items) {
- if (item instanceof ITaskAttachment) {
- if (page == null) {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- page = window.getActivePage();
- if (page == null) {
- throw new ExecutionException("No active workbench page"); //$NON-NLS-1$
- }
- }
- openAttachment(page, (ITaskAttachment) item);
- }
- }
- }
- return null;
- }
-
- private void openAttachment(IWorkbenchPage page, ITaskAttachment attachment) throws ExecutionException {
- TaskAttachmentEditorInput input = new TaskAttachmentEditorInput(attachment);
- IEditorDescriptor description = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(input.getName());
- if (description == null) {
- TasksUiInternal.displayStatus(Messages.OpenTaskAttachmentInDefaultEditorHandler_Open_Attachment_Failed,
- new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, MessageFormat.format(
- Messages.OpenTaskAttachmentInDefaultEditorHandler_No_default_editor_for_X_found,
- input.getName())));
- } else {
- try {
- page.openEditor(input, description.getId());
- } catch (PartInitException e) {
- throw new ExecutionException(Messages.OpenTaskAttachmentInDefaultEditorHandler_Failed_to_open_editor, e);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskListElementPropertiesHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskListElementPropertiesHandler.java
deleted file mode 100644
index 2a5fc492a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskListElementPropertiesHandler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-
-/**
- * @author Steffen Pingel
- */
-public class OpenTaskListElementPropertiesHandler extends AbstractTaskListViewHandler {
-
- @Override
- protected void execute(ExecutionEvent event, TaskListView taskListView, IRepositoryElement item) {
- if (item instanceof TaskCategory || item instanceof IRepositoryQuery) {
- TasksUiInternal.refreshAndOpenTaskListElement(item);
- }
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskRepositoryPropertiesHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskRepositoryPropertiesHandler.java
deleted file mode 100644
index 957cba00f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/OpenTaskRepositoryPropertiesHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Steffen Pingel
- */
-public class OpenTaskRepositoryPropertiesHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection) selection).getFirstElement();
- if (item instanceof TaskRepository) {
- TasksUiUtil.openEditRepositoryWizard((TaskRepository) item);
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
deleted file mode 100644
index e0a6dab14..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- * Tasktop Technologies - improvements
- * Tomasz Zarna, IBM Corporation - improvements for bug 261648
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.common.CommandException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.internal.tasks.ui.ITaskCommandIds;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoryLabelProvider;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionStatusDialog;
-import org.eclipse.ui.handlers.IHandlerService;
-
-/**
- * @author Willian Mitsuda
- */
-public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
-
- public RemoteTaskSelectionDialog(Shell parent) {
- super(parent);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- setStatusLineAboveButtons(true);
- }
-
- private Text idText;
-
- private TableViewer tasksViewer;
-
- private ComboViewer repositoriesViewer;
-
- private Button addToTaskListCheck;
-
- private ComboViewer categoryViewer;
-
- // TODO: copy'n pasted code; make API?
- private List<TaskRepository> getTaskRepositories() {
- List<TaskRepository> repositories = new ArrayList<TaskRepository>();
- TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
- for (AbstractRepositoryConnector connector : repositoryManager.getRepositoryConnectors()) {
- Set<TaskRepository> connectorRepositories = repositoryManager.getRepositories(connector.getConnectorKind());
- for (TaskRepository repository : connectorRepositories) {
- if (ITaskRepositoryFilter.CAN_CREATE_TASK_FROM_KEY.accept(repository, connector)) {
- repositories.add(repository);
- }
- }
- }
- return repositories;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite area = (Composite) super.createDialogArea(parent);
-
- Label idLabel = new Label(area, SWT.NULL);
- idLabel.setText(Messages.RemoteTaskSelectionDialog_Enter_Key_ID__use_comma_for_multiple_);
- idText = new Text(area, SWT.BORDER);
- idText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Label matchingTasksLabel = new Label(area, SWT.NONE);
- matchingTasksLabel.setText(Messages.RemoteTaskSelectionDialog_Matching_tasks);
- tasksViewer = new TableViewer(area, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- tasksViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, 200).create());
- tasksViewer.setLabelProvider(new DecoratingLabelProvider(new TaskElementLabelProvider(true),
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- tasksViewer.setContentProvider(new ArrayContentProvider());
- tasksViewer.addFilter(new ViewerFilter() {
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (selectedIds == null) {
- return false;
- }
-
- // Only shows exact task matches
- if (!(element instanceof ITask)) {
- return false;
- }
- ITask task = (ITask) element;
- String taskId = task.getTaskKey();
- for (String id : selectedIds) {
- if (id.equals(taskId)) {
- return true;
- }
- }
- return false;
- }
-
- });
- tasksViewer.setInput(TasksUiPlugin.getTaskList().getAllTasks());
- idText.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- computeIds();
- validate();
- tasksViewer.refresh(false);
- }
-
- });
- tasksViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- validate();
- }
-
- });
- tasksViewer.addOpenListener(new IOpenListener() {
-
- public void open(OpenEvent event) {
- if (getOkButton().getEnabled()) {
- okPressed();
- }
- }
-
- });
- Table table = tasksViewer.getTable();
- table.showSelection();
-
- Composite repositoriesComposite = new Composite(area, SWT.NONE);
- repositoriesComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
- repositoriesComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create());
-
- Label repositoriesLabel = new Label(repositoriesComposite, SWT.NONE);
- repositoriesLabel.setText(Messages.RemoteTaskSelectionDialog_Select_a_task_repository);
-
- repositoriesViewer = new ComboViewer(repositoriesComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
- repositoriesViewer.setLabelProvider(new TaskRepositoryLabelProvider());
- repositoriesViewer.setContentProvider(new ArrayContentProvider());
- List<TaskRepository> taskRepositories = getTaskRepositories();
- repositoriesViewer.setInput(taskRepositories);
- if (taskRepositories.size() == 1) {
- repositoriesViewer.setSelection(new StructuredSelection(taskRepositories.get(0)));
- }
- TaskRepository currentRepository = TasksUiUtil.getSelectedRepository(null);
- if (currentRepository != null) {
- repositoriesViewer.setSelection(new StructuredSelection(currentRepository), true);
- }
- repositoriesViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
- repositoriesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- tasksViewer.setSelection(StructuredSelection.EMPTY);
- validate();
- }
-
- });
-
- Button addRepositoryButton = new Button(repositoriesComposite, SWT.NONE);
- addRepositoryButton.setText(Messages.RemoteTaskSelectionDialog_Add_);
- addRepositoryButton.setEnabled(TasksUiPlugin.getRepositoryManager().hasUserManagedRepositoryConnectors());
- addRepositoryButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- IHandlerService hndSvc = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
- try {
- hndSvc.executeCommand(ITaskCommandIds.ADD_TASK_REPOSITORY, null);
- repositoriesViewer.setInput(getTaskRepositories());
- } catch (CommandException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- }
- });
-
- Composite addToTaskListComposite = new Composite(area, SWT.NONE);
- addToTaskListComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
-
- addToTaskListCheck = new Button(addToTaskListComposite, SWT.CHECK);
- addToTaskListCheck.setText(Messages.RemoteTaskSelectionDialog_Add_to_Task_List_category);
-
- categoryViewer = new ComboViewer(addToTaskListComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
- categoryViewer.setContentProvider(new ArrayContentProvider());
- TaskList taskList = TasksUiPlugin.getTaskList();
- LinkedList<AbstractTaskContainer> categories = new LinkedList<AbstractTaskContainer>(taskList.getCategories());
- categories.addFirst(taskList.getDefaultCategory());
- categoryViewer.setInput(categories);
- categoryViewer.setLabelProvider(new LabelProvider() {
-
- @Override
- public String getText(Object element) {
- if (element instanceof IRepositoryElement) {
- return ((IRepositoryElement) element).getSummary();
- }
- return super.getText(element);
- }
-
- });
- categoryViewer.setSelection(new StructuredSelection(taskList.getDefaultCategory()));
-
- categoryViewer.getControl().setEnabled(addToTaskListCheck.getSelection());
- addToTaskListCheck.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- categoryViewer.getControl().setEnabled(addToTaskListCheck.getSelection());
- }
-
- });
-
- idText.addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.ARROW_DOWN) {
- tasksViewer.getControl().setFocus();
- }
- }
-
- });
-
- return area;
- }
-
- private void validate() {
- if (idText.getText().trim().equals("")) { //$NON-NLS-1$
- updateStatus(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, 0,
- Messages.RemoteTaskSelectionDialog_Enter_a_valid_task_ID, null));
- return;
- }
- if (tasksViewer.getSelection().isEmpty() && repositoriesViewer.getSelection().isEmpty()) {
- updateStatus(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, 0,
- Messages.RemoteTaskSelectionDialog_Select_a_task_or_repository, null));
- return;
- }
- updateStatus(new Status(IStatus.OK, TasksUiPlugin.ID_PLUGIN, 0, "", null)); //$NON-NLS-1$
- }
-
- private String[] selectedIds;
-
- private TaskRepository selectedRepository;
-
- private AbstractTask selectedTask;
-
- private boolean shouldAddToTaskList;
-
- private AbstractTaskCategory selectedCategory;
-
- public String[] getSelectedIds() {
- return selectedIds;
- }
-
- public TaskRepository getSelectedTaskRepository() {
- return selectedRepository;
- }
-
- public AbstractTask getSelectedTask() {
- return selectedTask;
- }
-
- public boolean shouldAddToTaskList() {
- return shouldAddToTaskList;
- }
-
- public AbstractTaskCategory getSelectedCategory() {
- return selectedCategory;
- }
-
- @Override
- protected void computeResult() {
- computeIds();
-
- ISelection taskSelection = tasksViewer.getSelection();
- if (!taskSelection.isEmpty()) {
- selectedTask = (AbstractTask) ((IStructuredSelection) taskSelection).getFirstElement();
- } else {
- selectedRepository = (TaskRepository) ((IStructuredSelection) repositoriesViewer.getSelection()).getFirstElement();
- }
- shouldAddToTaskList = addToTaskListCheck.getSelection();
- if (shouldAddToTaskList) {
- selectedCategory = (AbstractTaskCategory) ((IStructuredSelection) categoryViewer.getSelection()).getFirstElement();
- }
- }
-
- private void computeIds() {
- selectedIds = idText.getText().split(","); //$NON-NLS-1$
- for (String id : selectedIds) {
- id = id.trim();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/SubmitTaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/SubmitTaskHandler.java
deleted file mode 100644
index 9e6460d77..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/SubmitTaskHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Steffen Pingel
- */
-public class SubmitTaskHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchSite site = HandlerUtil.getActiveSite(event);
- if (site instanceof IEditorSite) {
- IWorkbenchPart part = ((IEditorSite) site).getPart();
- if (part instanceof FormEditor) {
- IFormPage page = ((FormEditor) part).getActivePageInstance();
- if (page instanceof AbstractTaskEditorPage) {
- ((AbstractTaskEditorPage) page).doSubmit();
- }
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskListToolTipHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskListToolTipHandler.java
deleted file mode 100644
index 21f59f006..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskListToolTipHandler.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListToolTip;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskListToolTipHandler extends AbstractTaskListViewHandler {
-
- @Override
- protected void execute(ExecutionEvent event, TaskListView taskListView) throws ExecutionException {
- TaskListToolTip toolTip = taskListView.getToolTip();
- if (toolTip.isVisible()) {
- toolTip.hide();
- } else {
- taskListView.getViewer().getControl().getBounds();
- Tree tree = taskListView.getViewer().getTree();
- TreeItem[] selection = tree.getSelection();
- if (selection.length > 0) {
- toolTip.show(new Point(selection[0].getBounds().x + 1, selection[0].getBounds().y + 1));
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskRepositoryParameterValues.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskRepositoryParameterValues.java
deleted file mode 100644
index 78509b4bf..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/TaskRepositoryParameterValues.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.commands.IParameterValues;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * Compute repository connectors type/label map
- *
- * @author Willian Mitsuda
- */
-public class TaskRepositoryParameterValues implements IParameterValues {
-
- public Map<String, String> getParameterValues() {
- Collection<AbstractRepositoryConnector> connectors = TasksUi.getRepositoryManager().getRepositoryConnectors();
- Map<String, String> values = new HashMap<String, String>();
- for (AbstractRepositoryConnector connector : connectors) {
- values.put(connector.getConnectorKind(), connector.getLabel());
- }
- return values;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java
deleted file mode 100644
index be06428bd..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jingwen Ou and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jingwen Ou - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.commands;
-
-import java.util.Map;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.HandlerEvent;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-
-/**
- * @author Jingwen Ou
- * @author Steffen Pingel
- */
-public class ViewSourceHandler extends AbstractHandler implements IElementUpdater {
-
- private static boolean checked;
-
- private static ViewSourceHandler instance;
-
- public ViewSourceHandler() {
- instance = this;
- }
-
- public boolean isChecked() {
- return checked;
- }
-
- public static void setChecked(boolean checked) {
- ViewSourceHandler.checked = checked;
- if (instance != null) {
- instance.fireHandlerChanged(new HandlerEvent(instance, true, false));
- }
- }
-
- private Control getFocusControl() {
- return PlatformUI.getWorkbench().getDisplay().getFocusControl();
- }
-
- @Override
- public boolean isEnabled() {
- Control focusControl = getFocusControl();
- if (focusControl instanceof StyledText && focusControl.getData(VIEW_SOURCE_ACTION) instanceof IAction) {
- return true;
- }
-
- return false;
- }
-
- public static final String VIEW_SOURCE_ACTION = "viewSourceAction"; //$NON-NLS-1$
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchSite site = HandlerUtil.getActiveSite(event);
- if (site instanceof IEditorSite) {
- IWorkbenchPart part = ((IEditorSite) site).getPart();
- if (part instanceof FormEditor) {
- IFormPage page = ((FormEditor) part).getActivePageInstance();
- Control focusedControl = EditorUtil.getFocusControl(page);
- if (focusedControl != null) {
- Object data = focusedControl.getData(VIEW_SOURCE_ACTION);
- if (data instanceof IAction) {
- IAction action = (IAction) data;
- action.setChecked(!action.isChecked());
- action.run();
- setChecked(action.isChecked());
- }
- }
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public void updateElement(UIElement element, Map parameters) {
- element.setChecked(checked);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/messages.properties
deleted file mode 100644
index 36acfab29..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/messages.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-AddTaskRepositoryHandler_Add_Task_Repository=Add Task Repository
-
-NewLocalTaskHandler_Could_not_create_local_task=Could not create local task
-
-OpenTaskAttachmentInDefaultEditorHandler_Failed_to_open_editor=Failed to open editor
-OpenTaskAttachmentInDefaultEditorHandler_No_default_editor_for_X_found=No default editor for "{0}" found
-OpenTaskAttachmentInDefaultEditorHandler_Open_Attachment_Failed=Open Attachment Failed
-
-RemoteTaskSelectionDialog_Add_=&Add...
-RemoteTaskSelectionDialog_Add_to_Task_List_category=Add to Task &List category\:
-RemoteTaskSelectionDialog_Enter_Key_ID__use_comma_for_multiple_=Enter Key/&ID (use comma for multiple)\:\
-RemoteTaskSelectionDialog_Enter_a_valid_task_ID=Enter a valid task ID
-RemoteTaskSelectionDialog_Matching_tasks=&Matching tasks:
-RemoteTaskSelectionDialog_Select_a_task_or_repository=Select a task or repository
-RemoteTaskSelectionDialog_Select_a_task_repository=&Select a task repository\:
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/AbstractWorkingSetDialogCOPY.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/AbstractWorkingSetDialogCOPY.java
deleted file mode 100644
index aa1dbdc67..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/AbstractWorkingSetDialogCOPY.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog font
- * should be activated and used by other components.
- *******************************************************************************/
-package org.eclipse.mylyn.internal.tasks.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-import org.eclipse.ui.dialogs.IWorkingSetNewWizard;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkingSet;
-import org.eclipse.ui.internal.registry.WorkingSetRegistry;
-
-/**
- * Abstract baseclass for various working set dialogs.
- *
- * COPIED FROM: AbstractWorkingSetDialog
- */
-@SuppressWarnings( { "unchecked", "null" })
-public abstract class AbstractWorkingSetDialogCOPY extends SelectionDialog implements IWorkingSetSelectionDialog {
-
- private static final int ID_NEW = IDialogConstants.CLIENT_ID + 1;
-
- private static final int ID_DETAILS = ID_NEW + 1;
-
- private static final int ID_REMOVE = ID_DETAILS + 1;
-
- private static final int ID_SELECTALL = ID_REMOVE + 1;
-
- private static final int ID_DESELECTALL = ID_SELECTALL + 1;
-
- private Button newButton;
-
- private Button detailsButton;
-
- private Button removeButton;
-
- private Button selectAllButton;
-
- private Button deselectAllButton;
-
- private IWorkingSet[] result;
-
- private List addedWorkingSets;
-
- private List removedWorkingSets;
-
- private Map editedWorkingSets;
-
- private List removedMRUWorkingSets;
-
- private Set workingSetIds;
-
- private final boolean canEdit;
-
- protected AbstractWorkingSetDialogCOPY(Shell parentShell, String[] workingSetIds, boolean canEdit) {
- super(parentShell);
- if (workingSetIds != null) {
- this.workingSetIds = new HashSet();
- for (String workingSetId : workingSetIds) {
- this.workingSetIds.add(workingSetId);
- }
- }
- this.canEdit = canEdit;
- }
-
- /**
- * Return the set of supported working set types.
- *
- * @return the supported working set types
- */
- protected Set getSupportedWorkingSetIds() {
- return workingSetIds;
- }
-
- /**
- * Adds the modify buttons to the dialog.
- *
- * @param composite
- * Composite to add the buttons to
- */
- protected void addModifyButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.marginHeight = layout.marginWidth = 0;
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- buttonComposite.setLayout(layout);
- GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_VERTICAL);
- buttonComposite.setLayoutData(data);
-
- newButton = createButton(buttonComposite, ID_NEW, WorkbenchMessages.WorkingSetSelectionDialog_newButton_label,
- false);
- newButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- createWorkingSet();
- }
- });
-
- if (canEdit) {
- detailsButton = createButton(buttonComposite, ID_DETAILS,
- WorkbenchMessages.WorkingSetSelectionDialog_detailsButton_label, false);
- detailsButton.setEnabled(false);
- detailsButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- editSelectedWorkingSet();
- }
- });
-
- removeButton = createButton(buttonComposite, ID_REMOVE,
- WorkbenchMessages.WorkingSetSelectionDialog_removeButton_label, false);
- removeButton.setEnabled(false);
- removeButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- removeSelectedWorkingSets();
- }
- });
- }
-
- layout.numColumns = 1; // must manually reset the number of columns because createButton increments it - we want these buttons to be laid out vertically.
- }
-
- /**
- * Add the select/deselect buttons.
- *
- * @param composite
- * Composite to add the buttons to
- */
- protected void addSelectionButtons(Composite composite) {
- Composite buttonComposite = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = layout.marginWidth = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- buttonComposite.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- buttonComposite.setLayoutData(data);
-
- selectAllButton = createButton(buttonComposite, ID_SELECTALL, WorkbenchMessages.SelectionDialog_selectLabel,
- false);
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- selectAllSets();
- }
- });
-
- deselectAllButton = createButton(buttonComposite, ID_DESELECTALL,
- WorkbenchMessages.SelectionDialog_deselectLabel, false);
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- deselectAllSets();
- }
- });
- }
-
- /**
- * Select all working sets.
- */
- protected abstract void selectAllSets();
-
- /**
- * Deselect all working sets.
- */
- protected abstract void deselectAllSets();
-
- /**
- * Opens a working set wizard for editing the currently selected working set.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetPage
- */
- void editSelectedWorkingSet() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- IWorkingSet editWorkingSet = (IWorkingSet) getSelectedWorkingSets().get(0);
- IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(editWorkingSet);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- IWorkingSet originalWorkingSet = (IWorkingSet) editedWorkingSets.get(editWorkingSet);
- boolean firstEdit = originalWorkingSet == null;
-
- // save the original working set values for restoration when selection
- // dialog is cancelled.
- if (firstEdit) {
- originalWorkingSet = new WorkingSet(editWorkingSet.getName(), editWorkingSet.getLabel(),
- editWorkingSet.getElements());
- } else {
- editedWorkingSets.remove(editWorkingSet);
- }
- dialog.create();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
- IWorkbenchHelpContextIds.WORKING_SET_EDIT_WIZARD);
- if (dialog.open() == Window.OK) {
- editWorkingSet = wizard.getSelection();
- availableWorkingSetsChanged();
- // make sure ok button is enabled when the selected working set
- // is edited. Fixes bug 33386.
- updateButtonAvailability();
- }
- editedWorkingSets.put(editWorkingSet, originalWorkingSet);
- }
-
- /**
- * Opens a working set wizard for creating a new working set.
- */
- void createWorkingSet() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- String ids[] = null;
- if (workingSetIds != null) {
- ids = (String[]) workingSetIds.toArray(new String[workingSetIds.size()]);
- }
- IWorkingSetNewWizard wizard = manager.createWorkingSetNewWizard(ids);
- // the wizard can never be null since we have at least a resource
- // working set
- // creation page
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
-
- dialog.create();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
- IWorkbenchHelpContextIds.WORKING_SET_NEW_WIZARD);
- if (dialog.open() == Window.OK) {
- IWorkingSet workingSet = wizard.getSelection();
- manager.addWorkingSet(workingSet);
- addedWorkingSets.add(workingSet);
- availableWorkingSetsChanged();
- }
- }
-
- protected abstract List getSelectedWorkingSets();
-
- /**
- * Notifies the dialog that there has been a change to the sets available for use. In other words, the user has
- * either added, deleted or renamed a set.
- * <p>
- * Subclasses should override, but should call <code>super.availableWorkingSetsChanged</code> to update the
- * selection button enablements.
- * </p>
- */
- protected void availableWorkingSetsChanged() {
- boolean enable = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets().length > 0;
- if (!(selectAllButton == null || selectAllButton.isDisposed())) {
- selectAllButton.setEnabled(enable);
- }
- if (!(deselectAllButton == null || deselectAllButton.isDisposed())) {
- deselectAllButton.setEnabled(enable);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.IWorkingSetSelectionDialog#getSelection()
- */
- public IWorkingSet[] getSelection() {
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.IWorkingSetSelectionDialog#setSelection(org.eclipse.ui.IWorkingSet[])
- */
- public void setSelection(IWorkingSet[] selection) {
- result = selection;
- }
-
- /**
- * Overrides method in Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#open()
- */
- @Override
- public int open() {
- addedWorkingSets = new ArrayList();
- removedWorkingSets = new ArrayList();
- editedWorkingSets = new HashMap();
- removedMRUWorkingSets = new ArrayList();
- return super.open();
- }
-
- /**
- * Return the list of working sets that were added during the life of this dialog.
- *
- * @return the working sets
- */
- protected final List getAddedWorkingSets() {
- return addedWorkingSets;
- }
-
- /**
- * Return the map of working sets that were edited during the life of this dialog.
- *
- * @return the working sets
- */
- protected final Map getEditedWorkingSets() {
- return editedWorkingSets;
- }
-
- /**
- * Return the list of working sets that were removed from the MRU list during the life of this dialog.
- *
- * @return the working sets
- */
- protected final List getRemovedMRUWorkingSets() {
- return removedMRUWorkingSets;
- }
-
- /**
- * Return the list of working sets that were removed during the life of this dialog.
- *
- * @return the working sets
- */
- protected final List getRemovedWorkingSets() {
- return removedWorkingSets;
- }
-
- /**
- * Updates the modify buttons' enabled state based on the current seleciton.
- */
- protected void updateButtonAvailability() {
- List selection = getSelectedWorkingSets();
- boolean hasSelection = selection != null && !selection.isEmpty();
- boolean hasSingleSelection = hasSelection;
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
-
- newButton.setEnabled(registry.hasNewPageWorkingSetDescriptor());
-
- if (canEdit) {
- removeButton.setEnabled(hasSelection);
- }
-
- IWorkingSet selectedWorkingSet = null;
- if (hasSelection) {
- hasSingleSelection = selection.size() == 1;
- if (hasSingleSelection) {
- selectedWorkingSet = (IWorkingSet) selection.get(0);
- }
- }
- if (canEdit) {
- detailsButton.setEnabled(hasSingleSelection && selectedWorkingSet.isEditable());
- }
-
- getOkButton().setEnabled(true);
- }
-
- /**
- * Removes the selected working sets from the workbench.
- */
- protected void removeSelectedWorkingSets() {
- List selection = getSelectedWorkingSets();
- removeSelectedWorkingSets(selection);
- }
-
- /**
- * Remove the working sets contained in the provided selection from the working set manager.
- *
- * @param selection
- * the sets
- */
- protected void removeSelectedWorkingSets(List selection) {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- Iterator iter = selection.iterator();
- while (iter.hasNext()) {
- IWorkingSet workingSet = (IWorkingSet) iter.next();
- if (getAddedWorkingSets().contains(workingSet)) {
- getAddedWorkingSets().remove(workingSet);
- } else {
- IWorkingSet[] recentWorkingSets = manager.getRecentWorkingSets();
- for (IWorkingSet recentWorkingSet : recentWorkingSets) {
- if (workingSet.equals(recentWorkingSet)) {
- getRemovedMRUWorkingSets().add(workingSet);
- break;
- }
- }
- getRemovedWorkingSets().add(workingSet);
- }
- manager.removeWorkingSet(workingSet);
- }
- availableWorkingSetsChanged();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java
deleted file mode 100644
index 6fb0ba9a9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.dialogs;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.dialogs.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String TaskCompareDialog_Ascending;
-
- public static String TaskCompareDialog_DateCreated;
-
- public static String TaskCompareDialog_Descending;
-
- public static String TaskCompareDialog_Priority;
-
- public static String TaskCompareDialog_Sorting;
-
- public static String TaskCompareDialog_SortOrder;
-
- public static String TaskCompareDialog_Summary;
-
- public static String TaskCompareDialog_TaskID;
-
- public static String TaskListSortDialog_Sort_order;
-
- public static String TaskListSortDialog_Title;
-
- public static String TaskRepositoryCredentialsDialog_Enter_Credentials;
-
- public static String TaskRepositoryCredentialsDialog_Enter_repository_credentials;
-
- public static String TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties;
-
- public static String TaskRepositoryCredentialsDialog_Password;
-
- public static String TaskRepositoryCredentialsDialog_Repository_Authentication;
-
- public static String TaskRepositoryCredentialsDialog_Save_Password;
-
- public static String TaskRepositoryCredentialsDialog_Saved_passwords_are_stored_that_is_difficult;
-
- public static String TaskRepositoryCredentialsDialog_Task_Repository;
-
- public static String TaskRepositoryCredentialsDialog_User_ID;
-
- public static String UiLegendControl_Active_task;
-
- public static String UiLegendControl_Adjust_Colors_and_Fonts_;
-
- public static String UiLegendControl_Also_see_the_Getting_Started_documentation_online;
-
- public static String UiLegendControl_Category;
-
- public static String UiLegendControl_Completed;
-
- public static String UiLegendControl_Completed_today;
-
- public static String UiLegendControl_Conflicting_changes;
-
- public static String UiLegendControl_Date_range;
-
- public static String UiLegendControl__default_;
-
- public static String UiLegendControl_Focus_view_on_active_task;
-
- public static String UiLegendControl_Has_due_date;
-
- public static String UiLegendControl_http_www_eclipse_org_mylyn_start;
-
- public static String UiLegendControl_Inactive_task_with_context;
-
- public static String UiLegendControl_Inactive_task_with_no_context;
-
- public static String UiLegendControl_Incoming_changes;
-
- public static String UiLegendControl_New_task;
-
- public static String UiLegendControl_Open_Task_List_;
-
- public static String UiLegendControl_Outgoing_changes;
-
- public static String UiLegendControl_Past_Due_date;
-
- public static String UiLegendControl_Past_scheduled_date;
-
- public static String UiLegendControl_Priorities;
-
- public static String UiLegendControl_Query;
-
- public static String UiLegendControl_Scheduled_for_today;
-
- public static String UiLegendControl_Synchronization;
-
- public static String UiLegendControl_Synchronization_failed;
-
- public static String UiLegendControl_Task;
-
- public static String UiLegendControl_Task_Activity;
-
- public static String UiLegendControl_Task_Context;
-
- public static String UiLegendControl_Tasks;
-
- public static String UiLegendControl_Tasks_UI_Legend;
-
- public static String UiLegendControl_Unsubmitted_outgoing_changes;
-
- public static String UiLegendDialog_Close_Dialog;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskCompareDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskCompareDialog.java
deleted file mode 100644
index ec9b5c124..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskCompareDialog.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator.SortByIndex;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-/**
- * @author FrankBecker
- */
-public class TaskCompareDialog extends SelectionDialog {
-
- private Combo[] priorityCombos;
-
- private Button[] ascendingButtons;
-
- private Button[] descendingButtons;
-
- private final String[] propertyText;
-
- private boolean dirty = false;
-
- private final TaskComparator taskComparator;
-
- public TaskCompareDialog(IShellProvider parentShell, TaskComparator taskComparator) {
- super(parentShell.getShell());
- SortByIndex[] values = SortByIndex.values();
- propertyText = new String[values.length];
- for (int i = 0; i < values.length; i++) {
- propertyText[i] = values[i].getLabel();
- }
- this.taskComparator = taskComparator;
- setTitle(Messages.TaskCompareDialog_Sorting);
- }
-
- protected void createDialogStartArea(Composite parent) {
- Label sortByLabel = new Label(parent, SWT.NULL);
- sortByLabel.setText(Messages.TaskCompareDialog_SortOrder);
- GridData data = new GridData();
- data.horizontalSpan = 3;
- sortByLabel.setLayoutData(data);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
-
- initializeDialogUnits(composite);
-
- Composite prioritiesArea = new Composite(composite, SWT.NULL);
- prioritiesArea.setLayout(new GridLayout(3, false));
-
- createDialogStartArea(prioritiesArea);
-
- ascendingButtons = new Button[2];
- descendingButtons = new Button[2];
- priorityCombos = new Combo[2];
-
- for (int i = 0; i < 2; i++) {
- final int index = i;
- Label numberLabel = new Label(prioritiesArea, SWT.NULL);
- numberLabel.setText("" + (i + 1) + "."); //$NON-NLS-1$ //$NON-NLS-2$
- priorityCombos[i] = new Combo(prioritiesArea, SWT.READ_ONLY);
- priorityCombos[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite directionGroup = new Composite(prioritiesArea, SWT.NONE);
- directionGroup.setLayout(new GridLayout(2, false));
- ascendingButtons[i] = new Button(directionGroup, SWT.RADIO);
- ascendingButtons[i].setText(Messages.TaskCompareDialog_Ascending);
- ascendingButtons[i].addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- markDirty();
- }
- });
- descendingButtons[i] = new Button(directionGroup, SWT.RADIO);
- descendingButtons[i].setText(Messages.TaskCompareDialog_Descending);
- descendingButtons[i].addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- markDirty();
- }
- });
- if (i < priorityCombos.length - 1) {
- priorityCombos[i].addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- int oldSelectionDirection = 1;
- if (descendingButtons[index].getSelection()) {
- oldSelectionDirection = -1;
- }
- ArrayList<String> oldSelectionList = new ArrayList<String>(
- Arrays.asList(priorityCombos[index].getItems()));
- oldSelectionList.removeAll(Arrays.asList(priorityCombos[index + 1].getItems()));
- if (oldSelectionList.size() != 1) {
- return;
- }
- String oldSelection = oldSelectionList.get(0);
- String newSelection = priorityCombos[index].getItem(priorityCombos[index].getSelectionIndex());
- if (oldSelection.equals(newSelection)) {
- return;
- }
- for (int j = index + 1; j < priorityCombos.length; j++) {
- int newSelectionIndex = priorityCombos[j].indexOf(newSelection);
- //this combo's current selection is equal to newSelection
- if (priorityCombos[j].getSelectionIndex() == newSelectionIndex) {
- priorityCombos[j].remove(newSelection);
- int insertionPoint = -1
- - Arrays.binarySearch(priorityCombos[j].getItems(), oldSelection,
- columnComparator);
- if (insertionPoint >= 0 && insertionPoint <= priorityCombos[j].getItemCount()) {
- priorityCombos[j].add(oldSelection, insertionPoint);
- } else {
- priorityCombos[j].add(oldSelection);
- }
- priorityCombos[j].select(priorityCombos[j].indexOf(oldSelection));
- ascendingButtons[index].setSelection(ascendingButtons[j].getSelection());
- descendingButtons[index].setSelection(descendingButtons[j].getSelection());
- ascendingButtons[j].setSelection(oldSelectionDirection == 1);
- descendingButtons[j].setSelection(oldSelectionDirection == -1);
- }
- //this combo contains newSelection
- else if (newSelectionIndex >= 0) {
- String currentText = priorityCombos[j].getText();
- priorityCombos[j].remove(newSelection);
- int insertionPoint = -1
- - Arrays.binarySearch(priorityCombos[j].getItems(), oldSelection,
- columnComparator);
- if (insertionPoint >= 0 && insertionPoint <= priorityCombos[j].getItemCount()) {
- priorityCombos[j].add(oldSelection, insertionPoint);
- priorityCombos[j].select(priorityCombos[j].indexOf(currentText));
- } else {
- priorityCombos[j].add(oldSelection);
- }
- }
- }
- markDirty();
- }
- });
- } else {
- priorityCombos[i].addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- markDirty();
- }
- });
- }
-
- }
- int a[] = new int[2];
- int b[] = new int[2];
- a[0] = taskComparator.getSortByIndex().ordinal();
- a[1] = taskComparator.getSortByIndex2().ordinal();
- b[0] = taskComparator.getSortDirection();
- b[1] = taskComparator.getSortDirection2();
- updateUI(a, b);
- Dialog.applyDialogFont(composite);
- return composite;
- }
-
- @Override
- protected void okPressed() {
- if (isDirty()) {
- taskComparator.setSortByIndex(SortByIndex.valueOfLabel(priorityCombos[0].getText()));
- taskComparator.setSortByIndex2(SortByIndex.valueOfLabel(priorityCombos[1].getText()));
- if (descendingButtons[0].getSelection()) {
- taskComparator.setSortDirection(-1);
- } else {
- taskComparator.setSortDirection(1);
- }
- if (descendingButtons[1].getSelection()) {
- taskComparator.setSortDirection2(-1);
- } else {
- taskComparator.setSortDirection2(1);
- }
- }
- super.okPressed();
- }
-
- protected boolean isDirty() {
- return dirty;
- }
-
- /**
- * Sets the dirty flag to true.
- */
- protected void markDirty() {
- dirty = true;
- }
-
- private final Comparator<String> columnComparator = new Comparator<String>() {
- public int compare(String arg0, String arg1) {
- int index0 = -1;
- int index1 = -1;
- for (int i = 0; i < propertyText.length; i++) {
- if (propertyText[i].equals(arg0)) {
- index0 = i;
- }
- if (propertyText[i].equals(arg1)) {
- index1 = i;
- }
- }
- return index0 - index1;
- }
- };
-
- protected void updateUI(int[] priorities, int[] directions) {
- ArrayList<String> availablePriorities = new ArrayList<String>(Arrays.asList(propertyText));
-
- for (int i = 0; i < priorityCombos.length; i++) {
- priorityCombos[i].removeAll();
- for (int j = 0; j < availablePriorities.size(); j++) {
- priorityCombos[i].add(availablePriorities.get(j));
- }
- priorityCombos[i].select(priorityCombos[i].indexOf(propertyText[priorities[i]]));
- availablePriorities.remove(propertyText[priorities[i]]);
- ascendingButtons[i].setSelection(directions[i] == 1);
- descendingButtons[i].setSelection(directions[i] == -1);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java
deleted file mode 100644
index 36fe7ab10..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskListSortDialog.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.dialogs;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Frank Becker
- */
-public class TaskListSortDialog extends TaskCompareDialog {
-
- public TaskListSortDialog(IShellProvider parentShell, TaskListView taskListView) {
- super(parentShell, taskListView.getSorter().getComparator());
- setTitle(Messages.TaskListSortDialog_Title);
- }
-
- @Override
- protected void createDialogStartArea(Composite parent) {
- Label sortByLabel = new Label(parent, SWT.NULL);
- sortByLabel.setText(Messages.TaskListSortDialog_Sort_order);
- GridData data = new GridData();
- data.horizontalSpan = 3;
- sortByLabel.setLayoutData(data);
- Dialog.applyDialogFont(parent);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java
deleted file mode 100644
index 13a6b71c0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.dialogs;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class TaskRepositoryCredentialsDialog extends TitleAreaDialog {
-
- private static final String DIALOG_TITLE = Messages.TaskRepositoryCredentialsDialog_Enter_Credentials;
-
- private static final String IMAGE_FILE_KEYLOCK = "icons/wizban/secur_role_wiz.gif"; //$NON-NLS-1$
-
- public static final int TASK_REPOSITORY_CHANGED = 1000;
-
- private static final String MESSAGE = Messages.TaskRepositoryCredentialsDialog_Enter_repository_credentials;
-
- private static final String TITLE = Messages.TaskRepositoryCredentialsDialog_Repository_Authentication;
-
- public static TaskRepositoryCredentialsDialog createDialog(Shell shell) {
- return new TaskRepositoryCredentialsDialog(shell);
- }
-
- private Image keyLockImage;
-
- private String message;
-
- private String password = ""; //$NON-NLS-1$
-
- private boolean savePassword;
-
- private TaskRepository taskRepository;
-
- private String username = ""; //$NON-NLS-1$
-
- private TaskRepositoryCredentialsDialog(Shell parentShell) {
- super(parentShell);
- }
-
- @Override
- public boolean close() {
- if (keyLockImage != null) {
- keyLockImage.dispose();
- }
- return super.close();
- }
-
- private void createLinkArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Link link = new Link(composite, SWT.WRAP);
- link.setText(Messages.TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties);
- link.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- close();
- int returnCode = TasksUiUtil.openEditRepositoryWizard(taskRepository);
- if (returnCode == Window.OK) {
- setReturnCode(TASK_REPOSITORY_CHANGED);
- } else {
- setReturnCode(returnCode);
- }
- }
- });
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).hint(
- convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).grab(true,
- false).applyTo(link);
- }
-
- private void createCenterArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- if (taskRepository != null) {
- Composite labelComposite = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- labelComposite.setLayout(layout);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(
- labelComposite);
-
- Label label = new Label(labelComposite, SWT.NONE);
- label.setImage(TasksUiPlugin.getDefault().getBrandingIcon(taskRepository.getConnectorKind()));
-
- label = new Label(labelComposite, SWT.NONE);
- label.setText(Messages.TaskRepositoryCredentialsDialog_Task_Repository);
-
- label = new Label(labelComposite, SWT.NONE);
- label.setText(taskRepository.getRepositoryLabel());
- }
-
- new Label(composite, SWT.NONE).setText(Messages.TaskRepositoryCredentialsDialog_User_ID);
-
- final Text usernameField = new Text(composite, SWT.BORDER);
- usernameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- username = usernameField.getText();
- }
- });
- usernameField.setText(username);
- if (username.length() == 0) {
- usernameField.setFocus();
- }
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.CENTER)
- .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
- .grab(true, false)
- .applyTo(usernameField);
-
- new Label(composite, SWT.NONE).setText(Messages.TaskRepositoryCredentialsDialog_Password);
-
- final Text passwordField = new Text(composite, SWT.BORDER | SWT.PASSWORD);
- passwordField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- password = passwordField.getText();
- }
- });
- passwordField.setText(password);
- if (username.length() > 0) {
- passwordField.setFocus();
- }
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.CENTER)
- .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
- .grab(true, false)
- .applyTo(passwordField);
-
- final Button savePasswordButton = new Button(composite, SWT.CHECK);
- savePasswordButton.setText(Messages.TaskRepositoryCredentialsDialog_Save_Password);
- savePasswordButton.setSelection(savePassword);
- savePasswordButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- savePassword = savePasswordButton.getSelection();
- }
- });
- GridDataFactory.fillDefaults().span(2, 1).applyTo(savePasswordButton);
-
- createWarningMessage(composite);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- getShell().setText(DIALOG_TITLE);
-
- setTitle(TITLE);
- Control control = super.createContents(parent);
- if (taskRepository != null) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskRepository.getConnectorKind());
- if (connector != null) {
- setTitle(connector.getShortLabel() + " " + TITLE); //$NON-NLS-1$
- }
- }
-
- ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(TasksUiPlugin.ID_PLUGIN,
- IMAGE_FILE_KEYLOCK);
- if (descriptor != null) {
- keyLockImage = descriptor.createImage();
- setTitleImage(keyLockImage);
- }
- if (message != null) {
- super.setMessage(message);
- } else {
- super.setMessage(MESSAGE);
- }
- applyDialogFont(control);
- return control;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite parent2 = (Composite) super.createDialogArea(parent);
-
- Composite composite = new Composite(parent2, SWT.NONE);
- composite.setLayout(new GridLayout(1, false));
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(composite);
-
- createCenterArea(composite);
- if (taskRepository != null) {
- createLinkArea(composite);
- }
-
- composite.pack();
- return parent;
- }
-
- private void createWarningMessage(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(composite);
-
- Label label = new Label(composite, SWT.NONE);
- label.setImage(Dialog.getImage(DLG_IMG_MESSAGE_WARNING));
- label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- label = new Label(composite, SWT.WRAP);
- label.setText(Messages.TaskRepositoryCredentialsDialog_Saved_passwords_are_stored_that_is_difficult);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).hint(
- convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT).grab(true,
- false).applyTo(label);
- }
-
- public String getMessage() {
- return message;
- }
-
- public String getPassword() {
- return password;
- }
-
- public boolean getSavePassword() {
- return savePassword;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public String getUserName() {
- return username;
- }
-
- @Override
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void setPassword(String password) {
- if (password == null) {
- throw new IllegalArgumentException();
- }
- this.password = password;
- }
-
- public void setSavePassword(boolean savePassword) {
- this.savePassword = savePassword;
- }
-
- public void setTaskRepository(TaskRepository taskRepository) {
- this.taskRepository = taskRepository;
- }
-
- public void setUsername(String username) {
- if (username == null) {
- throw new IllegalArgumentException();
- }
- this.username = username;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java
deleted file mode 100644
index eba1c9eaa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java
+++ /dev/null
@@ -1,573 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFonts;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.ITasksUiConstants;
-import org.eclipse.mylyn.tasks.ui.LegendElement;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * @author Mik Kersten
- * @author Leo Dos Santos
- */
-public class UiLegendControl extends Composite {
-
- private final FormToolkit toolkit;
-
- private Window window = null;
-
- private final TaskElementLabelProvider labelProvider = new TaskElementLabelProvider(false);
-
- private final IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
-
- private final ArrayList<LegendElement> legendElements = new ArrayList<LegendElement>();
-
- public UiLegendControl(Composite parent, FormToolkit toolkit) {
- this(parent, toolkit, true, SWT.VERTICAL);
- }
-
- public UiLegendControl(Composite parent, FormToolkit toolkit, boolean showConnectors, int style) {
- super(parent, SWT.NONE);
- this.toolkit = toolkit;
- toolkit.adapt(this);
-
- addListeners();
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.leftMargin = 0;
- layout.rightMargin = 0;
- layout.topMargin = 0;
- layout.bottomMargin = 0;
-
- if (style == SWT.DEFAULT) {
- createContentsVertical(layout, showConnectors);
- } else if ((style & SWT.HORIZONTAL) != 0) {
- createContentsHorizontal(layout, showConnectors);
- } else {
- createContentsVertical(layout, showConnectors);
- }
-
- setLayout(layout);
- setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB));
- }
-
- private void addListeners() {
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- doDispose();
- }
- });
- }
-
- private void doDispose() {
- for (LegendElement element : legendElements) {
- element.dispose();
- }
- if (labelProvider != null) {
- labelProvider.dispose();
- }
- dispose();
- }
-
- public void setWindow(Window window) {
- this.window = window;
- }
-
- public boolean close() {
- if (window != null) {
- return window.close();
- } else {
- return false;
- }
- }
-
- private void createContentsHorizontal(TableWrapLayout layout, boolean showConnectors) {
- layout.numColumns = 2;
- createTasksPrioritiesSection(this);
- createContextSection(this);
- createActivitySection(this);
- createSynchronizationSection(this);
-
- Composite subComp = toolkit.createComposite(this);
- TableWrapLayout subLayout = new TableWrapLayout();
- subLayout.topMargin = 0;
- subLayout.bottomMargin = 0;
- subLayout.leftMargin = 0;
- subLayout.rightMargin = 0;
- subComp.setLayout(subLayout);
- subComp.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 2));
-
- if (showConnectors) {
- createConnectorsSection(subComp);
- }
- createGettingStartedSection(subComp);
- }
-
- private void createContentsVertical(TableWrapLayout layout, boolean showConnectors) {
- layout.numColumns = 1;
- createTasksPrioritiesSection(this);
- createActivitySection(this);
- createContextSection(this);
- createSynchronizationSection(this);
- if (showConnectors) {
- createConnectorsSection(this);
- }
- createGettingStartedSection(this);
- }
-
- private void createTasksPrioritiesSection(Composite parent) {
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- layout.leftMargin = 0;
- layout.rightMargin = 0;
- layout.topMargin = 0;
- layout.bottomMargin = 0;
-
- Composite composite = toolkit.createComposite(parent);
- composite.setLayout(layout);
- composite.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- createTasksSection(composite);
- createPrioritiesSection(composite);
- }
-
- private void createTasksSection(Composite parent) {
- Section tasksSection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- tasksSection.setText(Messages.UiLegendControl_Tasks);
- tasksSection.setLayout(new TableWrapLayout());
- tasksSection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- layout.verticalSpacing = 1;
- layout.topMargin = 1;
- layout.bottomMargin = 1;
-
- Composite tasksClient = toolkit.createComposite(tasksSection);
- tasksClient.setLayout(layout);
- tasksClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- tasksSection.setClient(tasksClient);
-
- Label imageLabel;
- imageLabel = toolkit.createLabel(tasksClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
- toolkit.createLabel(tasksClient, Messages.UiLegendControl_Task);
-
- imageLabel = toolkit.createLabel(tasksClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.CATEGORY));
- toolkit.createLabel(tasksClient, Messages.UiLegendControl_Category);
-
- imageLabel = toolkit.createLabel(tasksClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.QUERY));
- toolkit.createLabel(tasksClient, Messages.UiLegendControl_Query);
-
- imageLabel = toolkit.createLabel(tasksClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.CALENDAR));
- toolkit.createLabel(tasksClient, Messages.UiLegendControl_Date_range);
-
- imageLabel = toolkit.createLabel(tasksClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.BLANK));
-
- Hyperlink openView = toolkit.createHyperlink(tasksClient, Messages.UiLegendControl_Open_Task_List_, SWT.WRAP);
- openView.addHyperlinkListener(new IHyperlinkListener() {
- public void linkActivated(HyperlinkEvent e) {
- close();
- TasksUiUtil.openTasksViewInActivePerspective();
- }
-
- public void linkEntered(HyperlinkEvent e) {
- // ignore
- }
-
- public void linkExited(HyperlinkEvent e) {
- // ignore
- }
- });
- }
-
- private void createPrioritiesSection(Composite parent) {
- Section prioritiesSection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- prioritiesSection.setText(Messages.UiLegendControl_Priorities);
- prioritiesSection.setLayout(new TableWrapLayout());
- prioritiesSection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- layout.verticalSpacing = 1;
- layout.topMargin = 1;
- layout.bottomMargin = 1;
-
- Composite prioritiesClient = toolkit.createComposite(prioritiesSection);
- prioritiesClient.setLayout(layout);
- prioritiesClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- prioritiesSection.setClient(prioritiesClient);
-
- Label imageLabel;
- imageLabel = toolkit.createLabel(prioritiesClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.PRIORITY_1));
- toolkit.createLabel(prioritiesClient, PriorityLevel.P1.getDescription());
-
- imageLabel = toolkit.createLabel(prioritiesClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.PRIORITY_2));
- toolkit.createLabel(prioritiesClient, PriorityLevel.P2.getDescription());
-
- imageLabel = toolkit.createLabel(prioritiesClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.PRIORITY_3));
- toolkit.createLabel(prioritiesClient, PriorityLevel.P3.getDescription() + Messages.UiLegendControl__default_);
-
- imageLabel = toolkit.createLabel(prioritiesClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.PRIORITY_4));
- toolkit.createLabel(prioritiesClient, PriorityLevel.P4.getDescription());
-
- imageLabel = toolkit.createLabel(prioritiesClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.PRIORITY_5));
- toolkit.createLabel(prioritiesClient, PriorityLevel.P5.getDescription());
- }
-
- private void createActivitySection(Composite parent) {
- Section activitySection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- activitySection.setText(Messages.UiLegendControl_Task_Activity);
- activitySection.setLayout(new TableWrapLayout());
- activitySection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- layout.verticalSpacing = 1;
- layout.topMargin = 1;
- layout.bottomMargin = 1;
-
- Composite activityClient = toolkit.createComposite(activitySection);
- activityClient.setLayout(layout);
- activityClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- activitySection.setClient(activityClient);
-
- Label imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
- Label labelToday = toolkit.createLabel(activityClient, Messages.UiLegendControl_Scheduled_for_today);
- labelToday.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_SCHEDULED_TODAY));
-
- imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
- Label labelOverdue = toolkit.createLabel(activityClient, Messages.UiLegendControl_Past_scheduled_date);
- labelOverdue.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_SCHEDULED_PAST));
-
-// imageLabel = toolkit.createLabel(activityClient, "");
-// imageLabel.setImage(TasksUiImages.getImage(TasksUiImages.TASK));
-// Label labelThisWeek = toolkit.createLabel(activityClient, "Scheduled for this
-// week");
-// labelThisWeek.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(
-// TaskListColorsAndFonts.THEME_COLOR_TASK_THISWEEK_SCHEDULED));
-
- imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
- Label labelCompleted = toolkit.createLabel(activityClient, Messages.UiLegendControl_Completed);
- labelCompleted.setFont(CommonFonts.STRIKETHROUGH);
-// labelCompleted.setForeground(TaskListColorsAndFonts.COLOR_TASK_COMPLETED);
- labelCompleted.setForeground(themeManager.getCurrentTheme()
- .getColorRegistry()
- .get(CommonThemes.COLOR_COMPLETED));
-
- imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
- Label labelCompletedToday = toolkit.createLabel(activityClient, Messages.UiLegendControl_Completed_today);
- labelCompletedToday.setFont(CommonFonts.STRIKETHROUGH);
- labelCompletedToday.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_COMPLETED_TODAY));
-
- imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_DATE_DUE));
- toolkit.createLabel(activityClient, Messages.UiLegendControl_Has_due_date);
-
- imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_DATE_OVERDUE));
- Label textLabel = toolkit.createLabel(activityClient, Messages.UiLegendControl_Past_Due_date);
- textLabel.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_OVERDUE));
-
- imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.BLANK));
- Hyperlink adjust = toolkit.createHyperlink(activityClient, Messages.UiLegendControl_Adjust_Colors_and_Fonts_, SWT.WRAP);
- adjust.addHyperlinkListener(new IHyperlinkListener() {
- public void linkActivated(HyperlinkEvent e) {
- PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(), ITasksUiConstants.ID_PREFERENCES_COLORS_AND_FONTS,
- new String[] { ITasksUiConstants.ID_PREFERENCES_COLORS_AND_FONTS }, null);
- dlg.open();
- }
-
- public void linkEntered(HyperlinkEvent e) {
- // ignore
- }
-
- public void linkExited(HyperlinkEvent e) {
- // ignore
- }
- });
- }
-
- private void createContextSection(Composite parent) {
- Section contextSection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- contextSection.setText(Messages.UiLegendControl_Task_Context);
- contextSection.setLayout(new TableWrapLayout());
- contextSection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- layout.verticalSpacing = 1;
- layout.topMargin = 1;
- layout.bottomMargin = 1;
-
- Composite contextClient = toolkit.createComposite(contextSection);
- contextClient.setLayout(layout);
- contextClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- contextSection.setClient(contextClient);
-
- Label imageLabel;
- imageLabel = toolkit.createLabel(contextClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_FOCUS));
- toolkit.createLabel(contextClient, Messages.UiLegendControl_Focus_view_on_active_task);
-
- imageLabel = toolkit.createLabel(contextClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE_EMPTY));
- toolkit.createLabel(contextClient, Messages.UiLegendControl_Inactive_task_with_no_context);
-
- imageLabel = toolkit.createLabel(contextClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE));
- toolkit.createLabel(contextClient, Messages.UiLegendControl_Inactive_task_with_context);
-
- imageLabel = toolkit.createLabel(contextClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_ACTIVE));
- toolkit.createLabel(contextClient, Messages.UiLegendControl_Active_task);
- }
-
- private void createSynchronizationSection(Composite parent) {
- Section synchroSection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- synchroSection.setText(Messages.UiLegendControl_Synchronization);
- synchroSection.setLayout(new TableWrapLayout());
- synchroSection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = false;
- layout.verticalSpacing = 3;
- layout.topMargin = 1;
- layout.bottomMargin = 1;
-
- Composite synchroClient = toolkit.createComposite(synchroSection);
- synchroClient.setLayout(layout);
- synchroClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- synchroSection.setClient(synchroClient);
-
- Label imageLabel;
- imageLabel = toolkit.createLabel(synchroClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW));
- toolkit.createLabel(synchroClient, Messages.UiLegendControl_New_task);
-
- imageLabel = toolkit.createLabel(synchroClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING));
- toolkit.createLabel(synchroClient, Messages.UiLegendControl_Incoming_changes);
-
- imageLabel = toolkit.createLabel(synchroClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_OUTGOING));
- toolkit.createLabel(synchroClient, Messages.UiLegendControl_Outgoing_changes);
-
- imageLabel = toolkit.createLabel(synchroClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_OUTGOING_NEW));
- toolkit.createLabel(synchroClient, Messages.UiLegendControl_Unsubmitted_outgoing_changes);
-
- imageLabel = toolkit.createLabel(synchroClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_WARNING));
- toolkit.createLabel(synchroClient, Messages.UiLegendControl_Synchronization_failed);
-
- imageLabel = toolkit.createLabel(synchroClient, ""); //$NON-NLS-1$
- imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_SYNC_CONFLICT));
- toolkit.createLabel(synchroClient, Messages.UiLegendControl_Conflicting_changes);
- }
-
- @SuppressWarnings("deprecation")
- private void createConnectorsSection(Composite parent) {
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 3;
- layout.makeColumnsEqualWidth = true;
- layout.leftMargin = 0;
- layout.rightMargin = 0;
- layout.topMargin = 0;
- layout.bottomMargin = 0;
-
- Composite composite = toolkit.createComposite(parent);
- composite.setLayout(layout);
- composite.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- Collection<AbstractRepositoryConnector> connectors = TasksUi.getRepositoryManager().getRepositoryConnectors();
- for (AbstractRepositoryConnector connector : connectors) {
- AbstractRepositoryConnectorUi connectorUi = TasksUi.getRepositoryConnectorUi(connector.getConnectorKind());
- if (connectorUi != null) {
- List<LegendElement> elements = connectorUi.getLegendElements();
- if (elements != null && elements.size() > 0) {
- legendElements.addAll(elements);
- addLegendElements(composite, connector, elements);
- } else {
- List<ITask> items = connectorUi.getLegendItems();
- if (items != null && !items.isEmpty()) {
- addLegacyLegendItems(composite, connector, items);
- }
- }
- }
- }
- }
-
- private void addLegendElements(Composite composite, AbstractRepositoryConnector connector,
- List<LegendElement> elements) {
- Section connectorSection = toolkit.createSection(composite, ExpandableComposite.TITLE_BAR);
- connectorSection.setLayout(new TableWrapLayout());
- connectorSection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- String label = connector.getLabel();
- int parenIndex = label.indexOf('(');
- if (parenIndex != -1) {
- label = label.substring(0, parenIndex);
- }
- connectorSection.setText(label);
-
- TableWrapLayout clientLayout = new TableWrapLayout();
- clientLayout.numColumns = 2;
- clientLayout.makeColumnsEqualWidth = false;
- clientLayout.verticalSpacing = 1;
- clientLayout.topMargin = 1;
- clientLayout.bottomMargin = 1;
-
- Composite connectorClient = toolkit.createComposite(connectorSection);
- connectorClient.setLayout(clientLayout);
- connectorClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- connectorSection.setClient(connectorClient);
-
- Label imageLabel;
- for (LegendElement element : elements) {
- imageLabel = toolkit.createLabel(connectorClient, ""); //$NON-NLS-1$
- imageLabel.setImage(element.getImage());
- toolkit.createLabel(connectorClient, element.getLabel());
- }
-
- if (elements.size() < 4) {
- imageLabel = toolkit.createLabel(connectorClient, ""); //$NON-NLS-1$
- toolkit.createLabel(connectorClient, ""); //$NON-NLS-1$
- }
- }
-
- private void addLegacyLegendItems(Composite composite, AbstractRepositoryConnector connector, List<ITask> elements) {
- Section connectorSection = toolkit.createSection(composite, ExpandableComposite.TITLE_BAR);
- connectorSection.setLayout(new TableWrapLayout());
- connectorSection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- String label = connector.getLabel();
- int parenIndex = label.indexOf('(');
- if (parenIndex != -1) {
- label = label.substring(0, parenIndex);
- }
- connectorSection.setText(label);
-
- TableWrapLayout clientLayout = new TableWrapLayout();
- clientLayout.numColumns = 2;
- clientLayout.makeColumnsEqualWidth = false;
- clientLayout.verticalSpacing = 1;
- clientLayout.topMargin = 1;
- clientLayout.bottomMargin = 1;
-
- Composite connectorClient = toolkit.createComposite(connectorSection);
- connectorClient.setLayout(clientLayout);
- connectorClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- connectorSection.setClient(connectorClient);
-
- Label imageLabel;
- for (IRepositoryElement taskListElement : elements) {
- imageLabel = toolkit.createLabel(connectorClient, ""); //$NON-NLS-1$
- imageLabel.setImage(labelProvider.getImage(taskListElement));
- toolkit.createLabel(connectorClient, taskListElement.getSummary());
- }
-
- if (elements.size() < 4) {
- imageLabel = toolkit.createLabel(connectorClient, ""); //$NON-NLS-1$
- toolkit.createLabel(connectorClient, ""); //$NON-NLS-1$
- }
- }
-
- private void createGettingStartedSection(Composite parent) {
- TableWrapLayout layout = new TableWrapLayout();
- layout.verticalSpacing = 0;
- layout.leftMargin = 0;
- layout.rightMargin = 0;
- layout.topMargin = 0;
- layout.bottomMargin = 0;
-
- Composite hyperlinkClient = toolkit.createComposite(parent);
- hyperlinkClient.setLayout(layout);
- hyperlinkClient.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- Hyperlink gettingStartedLink = toolkit.createHyperlink(hyperlinkClient,
- Messages.UiLegendControl_Also_see_the_Getting_Started_documentation_online, SWT.WRAP);
- gettingStartedLink.addHyperlinkListener(new IHyperlinkListener() {
- public void linkActivated(HyperlinkEvent e) {
- close();
- TasksUiUtil.openUrl(Messages.UiLegendControl_http_www_eclipse_org_mylyn_start);
- }
-
- public void linkEntered(HyperlinkEvent e) {
- // ignore
- }
-
- public void linkExited(HyperlinkEvent e) {
- // ignore
- }
- });
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
deleted file mode 100644
index cb488d25b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.dialogs;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.PopupDialog;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-/**
- * @author Mik Kersten
- * @author Leo Dos Santos
- */
-public class UiLegendDialog extends PopupDialog {
-
- private FormToolkit toolkit;
-
- private ScrolledForm form;
-
- private UiLegendControl content;
-
- // TODO e3.4 move to new api
- @SuppressWarnings("deprecation")
- public UiLegendDialog(Shell parent) {
- super(parent, PopupDialog.INFOPOPUP_SHELLSTYLE | SWT.ON_TOP, false, false, false, false, null, null);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- getShell().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- return createDialogArea(parent);
- }
-
- @Override
- public int open() {
- int open = super.open();
-// getShell().setLocation(getShell().getLocation().x, getShell().getLocation().y+20);
- getShell().setFocus();
- return open;
- }
-
- @Override
- public boolean close() {
- if (form != null && !form.isDisposed()) {
- form.dispose();
- }
-
- if (toolkit != null) {
- if (toolkit.getColors() != null) {
- toolkit.dispose();
- }
- }
-
- if (content != null && !content.isDisposed()) {
- content.dispose();
- }
-
- return super.close();
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- toolkit = new FormToolkit(parent.getDisplay());
- form = toolkit.createScrolledForm(parent);
- form.setText(Messages.UiLegendControl_Tasks_UI_Legend);
- form.getToolBarManager().add(new CloseDialogAction());
- form.getToolBarManager().update(true);
- form.getBody().setLayout(new TableWrapLayout());
- toolkit.decorateFormHeading(form.getForm());
-
- content = new UiLegendControl(form.getBody(), toolkit);
- content.setWindow(this);
-
- return parent;
- }
-
- private class CloseDialogAction extends Action {
-
- private CloseDialogAction() {
- setImageDescriptor(CommonImages.NOTIFICATION_CLOSE);
- setText(Messages.UiLegendDialog_Close_Dialog);
- }
-
- @Override
- public void run() {
- close();
- }
-
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties
deleted file mode 100644
index 1513d5c38..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties
+++ /dev/null
@@ -1,54 +0,0 @@
-TaskCompareDialog_Ascending=Ascending
-TaskCompareDialog_DateCreated=Date Created
-TaskCompareDialog_Descending=Descending
-TaskCompareDialog_Priority=Priority
-TaskCompareDialog_Sorting=Sorting
-TaskCompareDialog_SortOrder=Sort order:
-TaskCompareDialog_Summary=Summary
-TaskCompareDialog_TaskID=Task ID
-TaskListSortDialog_Sort_order=Sort order for tasks\:
-TaskListSortDialog_Title=Task List Sorting
-
-TaskRepositoryCredentialsDialog_Enter_Credentials=Enter Credentials
-TaskRepositoryCredentialsDialog_Enter_repository_credentials=Enter repository credentials
-TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties=<a href="properties">Open Repository Properties</a> to disable background synchronization by disconnecting the repository.
-TaskRepositoryCredentialsDialog_Password=&Password:
-TaskRepositoryCredentialsDialog_Repository_Authentication=Repository Authentication
-TaskRepositoryCredentialsDialog_Save_Password=&Save Password
-TaskRepositoryCredentialsDialog_Saved_passwords_are_stored_that_is_difficult=Saved passwords are stored on your computer in a file that is difficult, but not impossible, for an intruder to read.
-TaskRepositoryCredentialsDialog_Task_Repository=Task Repository\:
-TaskRepositoryCredentialsDialog_User_ID=&User ID:
-
-UiLegendControl_Active_task=Active task
-UiLegendControl_Adjust_Colors_and_Fonts_=Adjust Colors and Fonts...
-UiLegendControl_Also_see_the_Getting_Started_documentation_online=Also see the Getting Started documentation online
-UiLegendControl_Category=Category
-UiLegendControl_Completed=Completed
-UiLegendControl_Completed_today=Completed today
-UiLegendControl_Conflicting_changes=Conflicting changes, need to synchronize
-UiLegendControl_Date_range=Date range
-UiLegendControl__default_=\ (default)
-UiLegendControl_Focus_view_on_active_task=Focus view on active task
-UiLegendControl_Has_due_date=Has due date
-UiLegendControl_http_www_eclipse_org_mylyn_start=http://www.eclipse.org/mylyn/start/
-UiLegendControl_Inactive_task_with_context=Inactive task with context
-UiLegendControl_Inactive_task_with_no_context=Inactive task with no context
-UiLegendControl_Incoming_changes=Incoming changes, open to view
-UiLegendControl_New_task=New task, open to view
-UiLegendControl_Open_Task_List_=Open Task List...
-UiLegendControl_Outgoing_changes=Outgoing changes
-UiLegendControl_Past_Due_date=Past Due date
-UiLegendControl_Past_scheduled_date=Past scheduled date
-UiLegendControl_Priorities=Priorities
-UiLegendControl_Query=Query
-UiLegendControl_Scheduled_for_today=Scheduled for today
-UiLegendControl_Synchronization=Synchronization
-UiLegendControl_Synchronization_failed=Synchronization failed, mouse over for details
-UiLegendControl_Task=Task
-UiLegendControl_Task_Activity=Task Activity
-UiLegendControl_Task_Context=Task Context
-UiLegendControl_Tasks=Tasks
-UiLegendControl_Tasks_UI_Legend=Tasks UI Legend
-UiLegendControl_Unsubmitted_outgoing_changes=Unsubmitted outgoing changes
-
-UiLegendDialog_Close_Dialog=Close Dialog
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractHyperlinkTextPresentationManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractHyperlinkTextPresentationManager.java
deleted file mode 100644
index 4820603db..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractHyperlinkTextPresentationManager.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextPresentationListener;
-import org.eclipse.jface.text.ITextViewerExtension4;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.mylyn.tasks.ui.IHighlightingHyperlink;
-import org.eclipse.mylyn.tasks.ui.TaskHyperlink;
-import org.eclipse.swt.custom.StyleRange;
-
-/**
- * A manager that ensures that all task hyperlinks have the appropriate text presentation. Subclasses may specify logic
- * for filtering detected hyperlinks and text decoration.
- *
- * @author David Green
- */
-public abstract class AbstractHyperlinkTextPresentationManager {
-
- private static class RegionComparator implements Comparator<IRegion> {
-
- public int compare(IRegion o1, IRegion o2) {
- if (o1 == o2) {
- return 0;
- }
- if (o1.getOffset() < o2.getOffset()) {
- return -1;
- } else if (o1.getOffset() > o2.getOffset()) {
- return 1;
- } else if (o1.getLength() < o2.getLength()) {
- return -1;
- } else {
- return 1;
- }
- }
-
- }
-
- private class Support implements ITextPresentationListener {
- public void applyTextPresentation(TextPresentation textPresentation) {
- StyleRange[] styleRanges = computeStyleRanges(textPresentation.getCoverage());
- if (styleRanges != null && styleRanges.length > 0) {
- textPresentation.mergeStyleRanges(styleRanges);
- }
- }
- }
-
- private static final RegionComparator REGION_COMPARATOR = new RegionComparator();
-
- private IHyperlinkDetector[] hyperlinkDetectors;
-
- private final ITextPresentationListener textPresentationListener = new Support();
-
- private ISourceViewer viewer;
-
- public AbstractHyperlinkTextPresentationManager() {
- }
-
- private void addRange(List<StyleRange> ranges, int start, int end) {
- // the style range is to be merged with other styles, so only set the bits that are needed
- StyleRange styleRange = new StyleRange(start, end - start, null, null);
- decorate(styleRange);
- ranges.add(styleRange);
- }
-
- protected StyleRange[] computeStyleRanges(IRegion extent) {
- if (viewer == null || hyperlinkDetectors == null || viewer.getDocument() == null || extent == null) {
- return null;
- }
- List<IRegion> regions = getRegions(extent);
- if (regions != null) {
- // style ranges may be adjacent but must not overlap, and they must be in order
- // of increasing offset.
- List<StyleRange> ranges = new ArrayList<StyleRange>(regions.size());
- // sort them first to ensure increasing offset
- Collections.sort(regions, REGION_COMPARATOR);
- // now merge overlapping (and adjacent) ranges
- int start = -1;
- int end = -1;
- for (int x = 0; x < regions.size(); ++x) {
- IRegion region = regions.get(x);
- if (start == -1) {
- start = region.getOffset();
- end = region.getOffset() + region.getLength();
- } else {
- if (region.getOffset() >= end) {
- addRange(ranges, start, end);
- start = region.getOffset();
- end = region.getOffset() + region.getLength();
- } else {
- end = region.getOffset() + region.getLength();
- }
- }
- }
- if (start != -1) {
- addRange(ranges, start, end);
- }
- return ranges.toArray(new StyleRange[ranges.size()]);
- }
- return null;
- }
-
- protected abstract void decorate(StyleRange styleRange);
-
- /**
- * The hyperlink detectors that are used to detect {@link TaskHyperlink task hyperlinks}
- */
- public IHyperlinkDetector[] getHyperlinkDetector() {
- return hyperlinkDetectors;
- }
-
- protected List<IRegion> getRegions(IRegion extent) {
- List<IRegion> regions = null;
- for (IHyperlinkDetector hyperlinkDetector : hyperlinkDetectors) {
- IHyperlink[] hyperlinks = hyperlinkDetector.detectHyperlinks(viewer, extent, true);
- if (hyperlinks != null && hyperlinks.length > 0) {
- for (IHyperlink hyperlink : hyperlinks) {
- if (select(hyperlink)) {
- if (regions == null) {
- regions = new ArrayList<IRegion>();
- }
- regions.add(hyperlink instanceof IHighlightingHyperlink ? ((IHighlightingHyperlink) hyperlink).getHighlightingRegion()
- : hyperlink.getHyperlinkRegion());
- }
- }
- }
- }
- return regions;
- }
-
- public void install(ISourceViewer viewer) {
- this.viewer = viewer;
- ((ITextViewerExtension4) viewer).addTextPresentationListener(textPresentationListener);
- }
-
- public boolean select(IHyperlink hyperlink) {
- return true;
- }
-
- /**
- * The hyperlink detector that are used to detect {@link TaskHyperlink task hyperlinks}
- */
- public void setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors) {
- this.hyperlinkDetectors = hyperlinkDetectors;
- }
-
- public void uninstall() {
- ((ITextViewerExtension4) viewer).removeTextPresentationListener(textPresentationListener);
- this.viewer = null;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractReplyToCommentAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractReplyToCommentAction.java
deleted file mode 100644
index f04fe1a45..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AbstractReplyToCommentAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.mylyn.internal.tasks.core.CommentQuoter;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-
-/**
- * @author Steffen Pingel
- */
-public abstract class AbstractReplyToCommentAction extends Action {
-
- private final AbstractTaskEditorPage editor;
-
- private final ITaskComment taskComment;
-
- public AbstractReplyToCommentAction(AbstractTaskEditorPage editor, ITaskComment taskComment) {
- this.editor = editor;
- this.taskComment = taskComment;
- setImageDescriptor(TasksUiImages.COMMENT_REPLY);
- setText(Messages.AbstractReplyToCommentAction_Reply);
- setToolTipText(Messages.AbstractReplyToCommentAction_Reply);
- }
-
- protected abstract String getReplyText();
-
- @Override
- public void run() {
- reply(editor, taskComment, getReplyText());
- }
-
- public static void reply(AbstractTaskEditorPage editor, ITaskComment taskComment, String text) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(editor.getConnectorKind());
- String reference = connectorUi.getReplyText(editor.getTaskRepository(), editor.getTask(), taskComment, false);
- StringBuilder sb = new StringBuilder();
- sb.append(reference);
- sb.append("\n"); //$NON-NLS-1$
- if (text != null) {
- CommentQuoter quoter = new CommentQuoter();
- sb.append(quoter.quote(text));
- }
- editor.appendTextToNewComment(sb.toString());
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentSizeFormatter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentSizeFormatter.java
deleted file mode 100644
index b06ebcac2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentSizeFormatter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.Locale;
-
-/**
- * Format attachment size values originally in bytes to nice messages.
- * <p>
- * This formatter tries to use the most applicable measure unit based on size magnitude, i.e.:
- * <p>
- * <ul>
- * <li>< 1 KB - byte based: 1 byte, 100 bytes, etc. <li>>= 1 KB and < 1 MB - KB based: 2.00 KB, 100.76 KB <li>>= 1 MB
- * and < 1 GB - MB based: 1.00 MB, 33.33 MB <li>>= 1 GB - GB based: 2.00 GB
- * </ul>
- * <p>
- * This formatter assumes 1 KB == 1024 bytes, <strong>NOT</strong> 1000 bytes.
- * <p>
- * This formatter always uses 2 decimal places.
- * <p>
- * The size is provided as a String, because it will probably come from a attachment attribute. If the value cannot be
- * decoded, for any reason, it returns {@link #UNKNOWN_SIZE}
- *
- * @author Willian Mitsuda
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class AttachmentSizeFormatter {
-
- /**
- * Default value returned by this formatter when the size is unparseable, contain errors, etc.
- */
- public static final String UNKNOWN_SIZE = "-"; //$NON-NLS-1$
-
- public final static AttachmentSizeFormatter getInstance() {
- return new AttachmentSizeFormatter();
- }
-
- private final DecimalFormat decimalFormat;
-
- public AttachmentSizeFormatter() {
- this(Locale.getDefault());
- }
-
- public AttachmentSizeFormatter(Locale locale) {
- this.decimalFormat = (DecimalFormat) NumberFormat.getInstance(locale);
- }
-
- public String format(String sizeInBytes) {
- if (sizeInBytes == null) {
- return UNKNOWN_SIZE;
- }
- try {
- return format(Long.parseLong(sizeInBytes));
- } catch (NumberFormatException e) {
- return UNKNOWN_SIZE;
- }
- }
-
- public String format(long size) {
- if (size < 0) {
- return UNKNOWN_SIZE;
- }
- if (size < 1024) {
- // format as byte
- if (size == 1) {
- return Messages.AttachmentSizeFormatter_1_byte;
- }
- DecimalFormat fmt = new DecimalFormat(Messages.AttachmentSizeFormatter_0_bytes);
- return fmt.format(size);
- } else if (size >= 1024 && size <= 1048575) {
- // format as KB
- double formattedValue = size / 1024.0;
- decimalFormat.applyPattern(Messages.AttachmentSizeFormatter_0_KB);
- return decimalFormat.format(formattedValue);
- } else if (size >= 1048576 && size <= 1073741823) {
- // format as MB
- double formattedValue = size / 1048576.0;
- decimalFormat.applyPattern(Messages.AttachmentSizeFormatter_0_MB);
- return decimalFormat.format(formattedValue);
- }
-
- // format as GB
- double formattedValue = size / 1073741824.0;
- decimalFormat.applyPattern(Messages.AttachmentSizeFormatter_0_GB);
- return decimalFormat.format(formattedValue);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java
deleted file mode 100644
index 141996ebb..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - indicate deprecated attachments, bug 215549
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorToolkit;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class AttachmentTableLabelProvider extends ColumnLabelProvider {
-
- private final AttachmentSizeFormatter sizeFormatter = AttachmentSizeFormatter.getInstance();
-
- private final IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
-
- private static final String[] IMAGE_EXTENSIONS = { "jpg", "gif", "png", "tiff", "tif", "bmp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-
- private final TaskDataModel model;
-
- private final AttributeEditorToolkit attributeEditorToolkit;
-
- public AttachmentTableLabelProvider(TaskDataModel model, AttributeEditorToolkit attributeEditorToolkit) {
- this.model = model;
- this.attributeEditorToolkit = attributeEditorToolkit;
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- ITaskAttachment attachment = (ITaskAttachment) element;
- if (columnIndex == 0) {
- if (AttachmentUtil.isContext(attachment)) {
- return CommonImages.getImage(TasksUiImages.CONTEXT_TRANSFER);
- } else if (attachment.isPatch()) {
- return CommonImages.getImage(TasksUiImages.TASK_ATTACHMENT_PATCH);
- } else {
- String filename = attachment.getFileName();
- if (filename != null) {
- int dotIndex = filename.lastIndexOf('.');
- if (dotIndex != -1) {
- String fileType = filename.substring(dotIndex + 1);
- for (String element2 : IMAGE_EXTENSIONS) {
- if (element2.equalsIgnoreCase(fileType)) {
- return CommonImages.getImage(CommonImages.IMAGE_FILE);
- }
- }
- }
- }
- return WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FILE);
- }
- } else {
- }
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- ITaskAttachment attachment = (ITaskAttachment) element;
- switch (columnIndex) {
- case 0:
- if (AttachmentUtil.isContext(attachment)) {
- return Messages.AttachmentTableLabelProvider_Task_Context;
- } else if (attachment.isPatch()) {
- return Messages.AttachmentTableLabelProvider_Patch;
- } else {
- return " " + attachment.getFileName(); //$NON-NLS-1$
- }
- case 1:
- return attachment.getDescription();
- case 2:
- Long length = attachment.getLength();
- if (length < 0) {
- return "-"; //$NON-NLS-1$
- }
- return sizeFormatter.format(length);
- case 3:
- return (attachment.getAuthor() != null) ? attachment.getAuthor().toString() : ""; //$NON-NLS-1$
- case 4:
- return (attachment.getCreationDate() != null) ? EditorUtil.formatDateTime(attachment.getCreationDate())
- : ""; //$NON-NLS-1$
- }
- return "unrecognized column"; //$NON-NLS-1$
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- // ignore
- }
-
- @Override
- public void dispose() {
- // ignore
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- // ignore
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- // ignore
- }
-
- @Override
- public Color getForeground(Object element) {
- ITaskAttachment att = (ITaskAttachment) element;
- if (att.isDeprecated()) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_COMPLETED);
- }
- return super.getForeground(element);
- }
-
- @Override
- public String getToolTipText(Object element) {
- ITaskAttachment attachment = (ITaskAttachment) element;
- StringBuilder sb = new StringBuilder();
- sb.append(Messages.AttachmentTableLabelProvider_File_);
- sb.append(attachment.getFileName());
- if (attachment.getContentType() != null) {
- sb.append("\n"); //$NON-NLS-1$
- sb.append(Messages.AttachmentTableLabelProvider_Type_);
- sb.append(attachment.getContentType());
- }
- return sb.toString();
- /*"\nFilename\t\t" + attachment.getAttributeValue("filename")
- +"ID\t\t\t" + attachment.getAttributeValue("attachid")
- + "\nDate\t\t\t" + attachment.getAttributeValue("date")
- + "\nDescription\t" + attachment.getAttributeValue("desc")
- + "\nCreator\t\t" + attachment.getCreator()
- + "\nType\t\t\t" + attachment.getAttributeValue("type")
- + "\nURL\t\t\t" + attachment.getAttributeValue("task.common.attachment.url");*/
- }
-
- @Override
- public Point getToolTipShift(Object object) {
- return new Point(5, 5);
- }
-
- @Override
- public int getToolTipDisplayDelayTime(Object object) {
- return 200;
- }
-
- @Override
- public int getToolTipTimeDisplayed(Object object) {
- return 5000;
- }
-
- @Override
- public void update(ViewerCell cell) {
- Object element = cell.getElement();
- cell.setText(getColumnText(element, cell.getColumnIndex()));
- Image image = getColumnImage(element, cell.getColumnIndex());
- cell.setImage(image);
- cell.setBackground(getBackground(element));
- cell.setForeground(getForeground(element));
- cell.setFont(getFont(element));
- }
-
- @Override
- public Color getBackground(Object element) {
- ITaskAttachment attachment = (ITaskAttachment) element;
- if (model.hasIncomingChanges(attachment.getTaskAttribute())) {
- return attributeEditorToolkit.getColorIncoming();
- } else {
- return null;
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java
deleted file mode 100644
index f8fce1508..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- */
-public class BooleanAttributeEditor extends AbstractAttributeEditor {
-
- private Button button;
-
- private boolean ignoreNotification;
-
- public BooleanAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- button = toolkit.createButton(parent, super.getLabel(), SWT.CHECK);
- button.setEnabled(!isReadOnly());
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (!ignoreNotification) {
- setValue(button.getSelection());
- }
- }
- });
- refresh();
- setControl(button);
- }
-
- @Override
- public String getLabel() {
- return ""; //$NON-NLS-1$
- }
-
- public boolean getValue() {
- return getAttributeMapper().getBooleanValue(getTaskAttribute());
- }
-
- public void setValue(boolean value) {
- getAttributeMapper().setBooleanValue(getTaskAttribute(), value);
- attributeChanged();
- }
-
- @Override
- public void refresh() {
- if (button == null) {
- return;
- }
-
- try {
- ignoreNotification = true;
- button.setSelection(getValue());
- } finally {
- ignoreNotification = false;
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BrowserPreviewViewer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BrowserPreviewViewer.java
deleted file mode 100644
index ef1314fe3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BrowserPreviewViewer.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Xiaoyang Guan - browser preview
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractRenderingEngine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.LocationAdapter;
-import org.eclipse.swt.browser.LocationEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- * @author Xiaoyang Guan
- */
-public class BrowserPreviewViewer {
-
- private Browser browser;
-
- private boolean ignoreLocationEvents;
-
- private final AbstractRenderingEngine renderingEngine;
-
- private final TaskRepository taskRepository;
-
- public BrowserPreviewViewer(TaskRepository taskRepository, AbstractRenderingEngine renderingEngine) {
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(renderingEngine);
- this.taskRepository = taskRepository;
- this.renderingEngine = renderingEngine;
- }
-
- public void createControl(Composite parent, FormToolkit toolkit) {
- browser = new Browser(parent, SWT.NONE);
- // intercept links to open tasks in rich editor and urls in separate browser
- browser.addLocationListener(new LocationAdapter() {
- @Override
- public void changing(LocationEvent event) {
- // ignore events that are caused by manually setting the contents of the browser
- if (ignoreLocationEvents) {
- return;
- }
-
- if (event.location != null && !event.location.startsWith("about")) { //$NON-NLS-1$
- event.doit = false;
- IHyperlink link = new TaskUrlHyperlink(
- new Region(0, 0)/* a fake region just to make constructor happy */, event.location);
- link.open();
- }
- }
-
- });
- }
-
- public Browser getControl() {
- return browser;
- }
-
- private void previewWiki(final Browser browser, String sourceText) {
- final class PreviewWikiJob extends Job {
- private String htmlText;
-
- private IStatus jobStatus;
-
- private final String sourceText;
-
- public PreviewWikiJob(String sourceText) {
- super(Messages.BrowserPreviewViewer_Formatting_Wiki_Text);
-
- if (sourceText == null) {
- throw new IllegalArgumentException("source text must not be null"); //$NON-NLS-1$
- }
-
- this.sourceText = sourceText;
- }
-
- public String getHtmlText() {
- return htmlText;
- }
-
- public IStatus getStatus() {
- return jobStatus;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (renderingEngine == null) {
- jobStatus = new RepositoryStatus(taskRepository, IStatus.INFO, TasksUiPlugin.ID_PLUGIN,
- RepositoryStatus.ERROR_INTERNAL, Messages.BrowserPreviewViewer_The_repository_does_not_support_HTML_preview);
- return Status.OK_STATUS;
- }
-
- jobStatus = Status.OK_STATUS;
- try {
- htmlText = renderingEngine.renderAsHtml(taskRepository, sourceText, monitor);
- } catch (CoreException e) {
- jobStatus = e.getStatus();
- }
- return Status.OK_STATUS;
- }
-
- }
-
- final PreviewWikiJob job = new PreviewWikiJob(sourceText);
-
- job.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(final IJobChangeEvent event) {
- if (!browser.isDisposed()) {
- if (job.getStatus().isOK()) {
- browser.getDisplay().asyncExec(new Runnable() {
- public void run() {
- setText(browser, job.getHtmlText());
- // TODO 3.1 error handling
- //getAttributeEditorManager().setMessage(null, IMessageProvider.NONE);
- }
- });
- } else {
- browser.getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.displayStatus(Messages.BrowserPreviewViewer_Error, job.getStatus());
- // TODO 3.1 error handling
- //getAttributeEditorManager().setMessage(job.getStatus().getMessage(), IMessageProvider.ERROR);
- }
- });
- }
- }
- super.done(event);
- }
- });
-
- job.setUser(true);
- job.schedule();
- }
-
- private void setText(Browser browser, String html) {
- try {
- ignoreLocationEvents = true;
- browser.setText((html != null) ? html : ""); //$NON-NLS-1$
- } finally {
- ignoreLocationEvents = false;
- }
-
- }
-
- public void update(String value) {
- setText(browser, Messages.BrowserPreviewViewer_Loading_preview_);
- previewWiki(browser, value);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditor.java
deleted file mode 100644
index 65ce0653d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditor.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ken Sueda - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import org.eclipse.ui.part.EditorPart;
-
-/**
- * @author Ken Sueda
- * @author Mik Kersten
- */
-public class CategoryEditor extends EditorPart {
-
- public static final String ID_EDITOR = "org.eclipse.mylyn.tasks.ui.editors.category"; //$NON-NLS-1$
-
- private Text url;
-
- private CategoryEditorInput input = null;
-
- private boolean isDirty = false;
-
- private Text description = null;
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- input.setCategoryName(description.getText());
- input.setUrl(url.getText());
- isDirty = false;
- firePropertyChange(PROP_DIRTY);
- }
-
- @Override
- public void doSaveAs() {
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- setSite(site);
- setInput(input);
- this.input = (CategoryEditorInput) input;
- setPartName(input.getName());
- setTitleToolTip(input.getToolTipText());
- }
-
- @Override
- public boolean isDirty() {
- return isDirty;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Override
- public void createPartControl(Composite parent) {
- FormToolkit toolkit = new FormToolkit(parent.getDisplay());
- ScrolledForm sform = toolkit.createScrolledForm(parent);
- sform.getBody().setLayout(new TableWrapLayout());
- Composite editorComposite = sform.getBody();
-
- createSummarySection(editorComposite, toolkit);
- }
-
- @Override
- public void setFocus() {
- }
-
- private void createSummarySection(Composite parent, FormToolkit toolkit) {
- Section summarySection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- summarySection.setText(Messages.CategoryEditor_Category_Summary);
- summarySection.setLayout(new TableWrapLayout());
- summarySection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-
- Composite summaryContainer = toolkit.createComposite(summarySection);
- summarySection.setClient(summaryContainer);
- TableWrapLayout layout = new TableWrapLayout();
- layout.numColumns = 2;
- summaryContainer.setLayout(layout);
-
- ModifyListener modifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- markDirty();
- }
- };
-
- toolkit.createLabel(summaryContainer, Messages.CategoryEditor_Description_, SWT.NULL);
-// lblDescription.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- description = toolkit.createText(summaryContainer, input.getCategoryName(), SWT.FLAT);
- description.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- description.setData(FormToolkit.KEY_DRAW_BORDER);
- description.addModifyListener(modifyListener);
-
- toolkit.createLabel(summaryContainer, Messages.CategoryEditor_URL_, SWT.NONE);
-// lblUrl.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- url = toolkit.createText(summaryContainer, input.getUrl(), SWT.FLAT);
- url.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP));
- url.addModifyListener(modifyListener);
-
- toolkit.paintBordersFor(summaryContainer);
- }
-
- private void markDirty() {
- isDirty = true;
- firePropertyChange(PROP_DIRTY);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java
deleted file mode 100644
index e0bff2af3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CategoryEditorInput.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ken Sueda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * @author Ken Sueda
- */
-public class CategoryEditorInput implements IEditorInput {
-
- private final TaskCategory category;
-
- public CategoryEditorInput(TaskCategory cat) {
- this.category = cat;
- }
-
- public boolean exists() {
- return true;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public String getName() {
- return Messages.CategoryEditorInput_Category_Editor;
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- return Messages.CategoryEditorInput_Category_Editor;
- }
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public String getCategoryName() {
- return category.getSummary();
- }
-
- public String getUrl() {
- return category.getUrl();
- }
-
- public void setCategoryName(String description) {
- TasksUiPlugin.getTaskList().renameContainer(category, description);
-// category.setDescription(summary);
- }
-
- public void setUrl(String url) {
- category.setUrl(url);
- TasksUiPlugin.getTaskList().notifyElementChanged(category);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CommentGroupStrategy.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CommentGroupStrategy.java
deleted file mode 100644
index cc5742169..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CommentGroupStrategy.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jingwen Ou and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jingwen Ou - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * @author Jingwen Ou
- * @author Steffen Pingel
- */
-public class CommentGroupStrategy {
-
- public static class CommentGroup {
-
- public static final String CURRENT = Messages.CommentGroupStrategy_Current;
-
- public static final String OLDER = Messages.CommentGroupStrategy_Older;
-
- public static final String RECENT = Messages.CommentGroupStrategy_Recent;
-
- private final List<ITaskComment> comments;
-
- private final String groupName;
-
- private final boolean incoming;
-
- public CommentGroup(String groupName, List<ITaskComment> comments, boolean incoming) {
- this.groupName = groupName;
- this.comments = comments;
- this.incoming = incoming;
- }
-
- public List<TaskAttribute> getCommentAttributes() {
- List<TaskAttribute> commentAttributes = new ArrayList<TaskAttribute>(comments.size());
- for (ITaskComment comment : comments) {
- commentAttributes.add(comment.getTaskAttribute());
- }
- return Collections.unmodifiableList(commentAttributes);
- }
-
- public List<ITaskComment> getComments() {
- return Collections.unmodifiableList(comments);
- }
-
- public String getGroupName() {
- return groupName;
- }
-
- public boolean hasIncoming() {
- return incoming;
- }
- }
-
- // public for testing
- public static final int MAX_CURRENT = 12;
-
- // public for testing
- public static final int MAX_RECENT = 20;
-
- /**
- * Groups comments according to "Older", "Recent" and "Current".
- *
- * @param comments
- * a list of comments to be grouped
- * @param currentPersonId
- * current login user id
- * @return a list of groups
- */
- public List<CommentGroup> groupComments(List<ITaskComment> comments, String currentPersonId) {
- if (comments.size() == 0) {
- return Collections.emptyList();
- }
-
- List<CommentGroup> commentGroups = new ArrayList<CommentGroup>(3);
-
- // current
- List<ITaskComment> current = new ArrayList<ITaskComment>(MAX_CURRENT);
- if (comments.size() > MAX_CURRENT) {
- for (int i = comments.size() - 1; i >= 0; i--) {
- ITaskComment comment = comments.get(i);
- if (isCurrent(current, comment, currentPersonId)) {
- current.add(comment);
- }
- }
- Collections.reverse(current);
- } else {
- current = comments;
- }
- commentGroups.add(new CommentGroup(CommentGroup.CURRENT, current, hasIncomingChanges(current)));
-
- // recent
- if (comments.size() > current.size()) {
- int recentToIndex = comments.size() - current.size();
- int recentFromIndex = Math.max(recentToIndex - MAX_RECENT, 0);
- List<ITaskComment> recent = new ArrayList<ITaskComment>(comments.subList(recentFromIndex, recentToIndex));
- if (recent.size() > 0) {
- commentGroups.add(new CommentGroup(CommentGroup.RECENT, recent, hasIncomingChanges(recent)));
-
- // the rest goes to older
- if (comments.size() > current.size() + recent.size()) {
- int olderToIndex = comments.size() - current.size() - recent.size();
- List<ITaskComment> older = new ArrayList<ITaskComment>(comments.subList(0, olderToIndex));
- commentGroups.add(new CommentGroup(CommentGroup.OLDER, older, hasIncomingChanges(older)));
- }
- }
- }
-
- Collections.reverse(commentGroups);
- return commentGroups;
- }
-
- protected boolean hasIncomingChanges(ITaskComment taskComment) {
- return false;
- }
-
- private boolean hasIncomingChanges(List<ITaskComment> comments) {
- for (ITaskComment comment : comments) {
- if (hasIncomingChanges(comment)) {
- return true;
- }
- }
- return false;
- }
-
- // public for testing
- public boolean isCurrent(List<ITaskComment> current, ITaskComment comment, String currentPersonId) {
- if (current.size() >= MAX_CURRENT) {
- return false;
- }
-
- // add all incoming changes
- if (hasIncomingChanges(comment)) {
- return true;
- }
-
- if (!current.isEmpty()) {
- // check if last comment was by current user
- ITaskComment lastComment = current.get(current.size() - 1);
- IRepositoryPerson lastPerson = lastComment.getAuthor();
- if (lastPerson != null && lastPerson.getPersonId().equals(currentPersonId)) {
- // bug 238038 comment #58, if the latest comment is generated automatically, look back one comment
- IRepositoryPerson person = comment.getAuthor();
- if (person != null && person.getPersonId().equals(currentPersonId) && lastComment.getText() != null
- && lastComment.getText().contains(AttachmentUtil.CONTEXT_DESCRIPTION)) {
- return true;
- }
-
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java
deleted file mode 100644
index 7563aa4d1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/DateAttributeEditor.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-/**
- * @author Steffen Pingel
- * @author Robert Elves
- */
-public class DateAttributeEditor extends AbstractAttributeEditor {
-
- private DatePicker datePicker;
-
- private boolean showTime;
-
- public DateAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE));
- }
-
- @Override
- public void createControl(Composite composite, FormToolkit toolkit) {
- if (isReadOnly()) {
- Text text = new Text(composite, SWT.FLAT | SWT.READ_ONLY);
- text.setFont(EditorUtil.TEXT_FONT);
- toolkit.adapt(text, false, false);
- text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
- text.setText(getTextValue());
- setControl(text);
- } else {
- Composite dateWithClearComposite = toolkit.createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 2;
- layout.marginWidth = 1;
- layout.verticalSpacing = 2;
- layout.horizontalSpacing = 2;
- dateWithClearComposite.setLayout(layout);
- datePicker = new DatePicker(dateWithClearComposite, SWT.FLAT, getTextValue(), showTime, 0);
- datePicker.setFont(EditorUtil.TEXT_FONT);
- if (!showTime) {
- datePicker.setDateFormat(EditorUtil.getDateFormat());
- } else {
- datePicker.setDateFormat(EditorUtil.getDateTimeFormat());
- }
- if (getValue() != null) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(getValue());
- datePicker.setDate(cal);
- }
- datePicker.addPickerSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- Calendar cal = datePicker.getDate();
- if (cal != null) {
- if (!showTime) {
- TaskActivityUtil.snapStartOfDay(cal);
- }
- Date value = cal.getTime();
- if (!value.equals(getValue())) {
- setValue(value);
- }
- } else {
- if (getValue() != null) {
- setValue(null);
- }
- datePicker.setDate(null);
- }
- }
- });
-
- GridDataFactory.fillDefaults().grab(true, false).applyTo(datePicker);
- datePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- toolkit.adapt(datePicker, false, false);
-
- ImageHyperlink clearDeadlineDate = toolkit.createImageHyperlink(dateWithClearComposite, SWT.NONE);
- clearDeadlineDate.setImage(CommonImages.getImage(CommonImages.REMOVE));
- clearDeadlineDate.setToolTipText(Messages.DateAttributeEditor_Clear);
- clearDeadlineDate.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- if (getValue() != null) {
- setValue(null);
- }
- datePicker.setDate(null);
- }
-
- });
-
- toolkit.paintBordersFor(dateWithClearComposite);
- setControl(dateWithClearComposite);
- }
- }
-
- @Override
- protected void decorateIncoming(Color color) {
- if (datePicker != null) {
- datePicker.setBackground(color);
- }
- }
-
- public boolean getShowTime() {
- return showTime;
- }
-
- private String getTextValue() {
- Date date = getValue();
- if (date != null) {
- if (getShowTime()) {
- return EditorUtil.formatDateTime(date);
- } else {
- return EditorUtil.formatDate(date);
- }
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- public Date getValue() {
- return getAttributeMapper().getDateValue(getTaskAttribute());
- }
-
- public void setShowTime(boolean showTime) {
- this.showTime = showTime;
- }
-
- public void setValue(Date date) {
- getAttributeMapper().setDateValue(getTaskAttribute(), date);
- attributeChanged();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorBusyIndicator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorBusyIndicator.java
deleted file mode 100644
index 910e46410..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorBusyIndicator.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * @author Shawn Minto
- * @author Steffen Pingel
- */
-public class EditorBusyIndicator {
-
- private class Animator implements Runnable {
-
- int imageDataIndex = 0;
-
- private final Image[] images;
-
- private boolean stopped;
-
- public Animator(Image[] images) {
- this.images = images;
- }
-
- public void run() {
- if (stopped) {
- return;
- }
-
- try {
- Image image = images[imageDataIndex];
- imageDataIndex = (imageDataIndex + 1) % images.length;
-
- if (updateTitleImage(image)) {
- PlatformUI.getWorkbench().getDisplay().timerExec(DELAY, this);
- }
- } catch (Exception e) {
- WorkbenchPlugin.log(e);
- }
- }
-
- public void stop() {
- stopped = true;
- }
- }
-
- public static final int DELAY = 90;
-
- private Animator animator;
-
- private final IBusyEditor editor;
-
- private Image[] images;
-
- private Image oldImage;
-
- public EditorBusyIndicator(IBusyEditor editor) {
- this.editor = editor;
- }
-
- /**
- * Start the busy indication.
- */
- public void start() {
- if (animator != null) {
- stop();
- }
-
- try {
- if (images == null) {
- images = CommonImages.getProgressImages();
- // if image fails to load do not continue
- if (images == null) {
- return;
- }
- }
-
- oldImage = editor.getTitleImage();
-
- if (images.length > 1) {
- animator = new Animator(images);
- animator.run();
- }
- } catch (SWTException e) {
- WorkbenchPlugin.log(e);
- }
- }
-
- /**
- * Stop showing the busy cursor.
- */
- public void stop() {
- if (animator != null) {
- animator.stop();
- animator = null;
-
- updateTitleImage(oldImage);
- oldImage = null;
- }
- }
-
- private boolean updateTitleImage(final Image image) {
- if (!PlatformUI.getWorkbench().isClosing()) {
- if (image != null && !image.isDisposed()) {
- editor.setTitleImage(image);
- return true;
- } else {
- if (oldImage != null && !oldImage.isDisposed()) {
- editor.setTitleImage(oldImage);
- }
- }
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
deleted file mode 100644
index ca403f1d0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizardDialog;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard.Mode;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
-import org.eclipse.ui.internal.forms.widgets.FormUtil;
-
-public class EditorUtil {
-
-// public static final String DATE_FORMAT = "yyyy-MM-dd";
-//
-// public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm";
-
- static final String KEY_MARKER = "marker"; //$NON-NLS-1$
-
- static final String KEY_DISABLED = "org.eclipse.mylyn.tasks.ui.disabled"; //$NON-NLS-1$
-
- static final String KEY_TEXT_VIEWER = "textViewer"; //$NON-NLS-1$
-
- public static final int MAXIMUM_HEIGHT = 140;
-
- public static final int MAXIMUM_WIDTH = 500;
-
- // XXX why is this required?
- public static final Font TEXT_FONT = JFaceResources.getDefaultFont();
-
- public static final String KEY_TOGGLE_TO_MAXIMIZE_ACTION = "maximizeAction"; //$NON-NLS-1$
-
- static boolean canDoGlobalAction(String actionId, TextViewer textViewer) {
- if (actionId.equals(ActionFactory.CUT.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.CUT);
- } else if (actionId.equals(ActionFactory.COPY.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.COPY);
- } else if (actionId.equals(ActionFactory.PASTE.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.PASTE);
- } else if (actionId.equals(ActionFactory.DELETE.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.DELETE);
- } else if (actionId.equals(ActionFactory.UNDO.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.UNDO);
- } else if (actionId.equals(ActionFactory.REDO.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.REDO);
- } else if (actionId.equals(ActionFactory.SELECT_ALL.getId())) {
- return textViewer.canDoOperation(ITextOperationTarget.SELECT_ALL);
- }
- return false;
- }
-
- /**
- * @deprecated use {@link CommonTextSupport#canPerformAction(String, Control)} instead
- */
- @Deprecated
- public static boolean canPerformAction(String actionId, Control focusControl) {
- return CommonTextSupport.canPerformAction(actionId, focusControl);
- }
-
- /**
- * @deprecated use {@link CommonTextSupport#doAction(String, Control)} instead
- */
- @Deprecated
- public static void doAction(String actionId, Control focusControl) {
- CommonTextSupport.doAction(actionId, focusControl);
- }
-
- private static Control findControl(Composite composite, String key) {
- if (!composite.isDisposed()) {
- for (Control child : composite.getChildren()) {
- if (key.equals(getMarker(child))) {
- return child;
- }
- if (child instanceof Composite) {
- Control found = findControl((Composite) child, key);
- if (found != null) {
- return found;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Scroll to a specified piece of text
- *
- * @param control
- * The StyledText to scroll to
- */
- private static void focusOn(ScrolledForm form, Control control) {
- int pos = 0;
- control.setEnabled(true);
- control.setFocus();
- control.forceFocus();
- while (control != null && control != form.getBody()) {
- pos += control.getLocation().y;
- control = control.getParent();
- }
-
- pos = pos - 60; // form.getOrigin().y;
- if (!form.getBody().isDisposed()) {
- form.setOrigin(0, pos);
- }
- }
-
- static DateFormat getDateFormat() {
- return DateFormat.getDateInstance(DateFormat.MEDIUM);
- }
-
- static String formatDate(Date date) {
- return getDateFormat().format(date);
- }
-
- static String formatDateTime(Date date) {
- return getDateTimeFormat().format(date);
- }
-
- static DateFormat getDateTimeFormat() {
- return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
- }
-
- public static Control getFocusControl(IFormPage page) {
- if (page == null) {
- return null;
- }
- IManagedForm form = page.getManagedForm();
- if (form == null) {
- return null;
- }
- Control control = form.getForm();
- if (control == null || control.isDisposed()) {
- return null;
- }
- Display display = control.getDisplay();
- Control focusControl = display.getFocusControl();
- if (focusControl == null || focusControl.isDisposed()) {
- return null;
- }
- return focusControl;
- }
-
- public static String getMarker(Widget widget) {
- return (String) widget.getData(KEY_MARKER);
- }
-
- /**
- * @deprecated use {@link CommonTextSupport#getTextViewer(Widget)} instead
- */
- @Deprecated
- public static TextViewer getTextViewer(Widget widget) {
- return CommonTextSupport.getTextViewer(widget);
- }
-
- public static NewAttachmentWizardDialog openNewAttachmentWizard(final AbstractTaskEditorPage page, Mode mode,
- AbstractTaskAttachmentSource source) {
- TaskAttributeMapper mapper = page.getModel().getTaskData().getAttributeMapper();
- TaskAttribute attribute = mapper.createTaskAttachment(page.getModel().getTaskData());
- final NewAttachmentWizardDialog dialog = TasksUiInternal.openNewAttachmentWizard(page.getSite().getShell(),
- page.getTaskRepository(), page.getTask(), attribute, mode, source);
- dialog.getShell().addDisposeListener(new DisposeListener() {
-
- public void widgetDisposed(DisposeEvent e) {
- if (dialog.getReturnCode() == Window.OK) {
- page.getTaskEditor().refreshPages();
- }
- }
-
- });
- return dialog;
- }
-
- /**
- * Selects the given object in the editor.
- *
- * @param o
- * The object to be selected.
- * @param highlight
- * Whether or not the object should be highlighted.
- */
- public static boolean reveal(ScrolledForm form, String key) {
- Control control = findControl(form.getBody(), key);
- if (control != null) {
- // expand all children
- if (control instanceof ExpandableComposite) {
- ExpandableComposite ex = (ExpandableComposite) control;
- if (!ex.isExpanded()) {
- toggleExpandableComposite(true, ex);
- }
- }
-
- // expand all parents of control
- Composite comp = control.getParent();
- while (comp != null) {
- if (comp instanceof Section) {
- if (!((Section) comp).isExpanded()) {
- ((Section) comp).setExpanded(true);
- }
- } else if (comp instanceof ExpandableComposite) {
- ExpandableComposite ex = (ExpandableComposite) comp;
- if (!ex.isExpanded()) {
- toggleExpandableComposite(true, ex);
- }
-
- // HACK: This is necessary
- // due to a bug in SWT's ExpandableComposite.
- // 165803: Expandable bars should expand when clicking anywhere
- // https://bugs.eclipse.org/bugs/show_bug.cgi?taskId=165803
- if (ex.getData() != null && ex.getData() instanceof Composite) {
- ((Composite) ex.getData()).setVisible(true);
- }
- }
- comp = comp.getParent();
- }
- focusOn(form, control);
- }
- return true;
- }
-
- public static void setEnabledState(Composite composite, boolean enabled) {
- if (enabled) {
- enable(composite);
- } else {
- disable(composite);
- }
- }
-
- private static void disable(Composite composite) {
- if (!composite.isDisposed()) {
- if (!composite.getEnabled()) {
- composite.setData(KEY_DISABLED, Boolean.TRUE);
- } else {
- composite.setEnabled(false);
- }
- for (Control control : composite.getChildren()) {
- if (control instanceof Composite) {
- disable((Composite) control);
- } else {
- if (!control.getEnabled()) {
- control.setData(KEY_DISABLED, Boolean.TRUE);
- } else {
- control.setEnabled(false);
- }
- }
- }
- }
- }
-
- private static void enable(Composite composite) {
- if (!composite.isDisposed()) {
- if (composite.getData(KEY_DISABLED) == null) {
- composite.setEnabled(true);
- } else {
- composite.setData(KEY_DISABLED, null);
- }
- for (Control control : composite.getChildren()) {
- if (control instanceof Composite) {
- enable((Composite) control);
- } else {
- if (control.getData(KEY_DISABLED) == null) {
- control.setEnabled(true);
- } else {
- control.setData(KEY_DISABLED, null);
- }
- }
- }
- }
- }
-
- public static void setMarker(Widget widget, String text) {
- widget.setData(KEY_MARKER, text);
- }
-
- /**
- * @deprecated use {@link CommonTextSupport#setTextViewer(Widget, TextViewer)} instead
- */
- @Deprecated
- public static void setTextViewer(Widget widget, TextViewer textViewer) {
- CommonTextSupport.setTextViewer(widget, textViewer);
- }
-
- /**
- * Programmatically expand the provided ExpandableComposite, using reflection to fire the expansion listeners (see
- * bug#70358)
- *
- * @param comp
- */
- public static void toggleExpandableComposite(boolean expanded, ExpandableComposite comp) {
- if (comp.isExpanded() != expanded) {
- Method method = null;
- try {
- method = ExpandableComposite.class.getDeclaredMethod("programmaticToggleState"); //$NON-NLS-1$
- method.setAccessible(true);
- method.invoke(comp);
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- public static void disableScrollingOnFocus(ScrolledForm form) {
- form.setData(FormUtil.FOCUS_SCROLLING, Boolean.FALSE);
- }
-
- public static void ensureVisible(Control control) {
- ScrolledComposite form = FormUtil.getScrolledComposite(control);
- if (form != null) {
- FormUtil.ensureVisible(form, control);
- }
- }
-
- // copied from Section.reflow()
- public static void reflow(Control control) {
- Composite c = control.getParent();
- while (c != null) {
- c.setRedraw(false);
- c = c.getParent();
- if (c instanceof SharedScrolledComposite) {
- break;
- }
- }
- c = control.getParent();
- while (c != null) {
- c.layout(true);
- c = c.getParent();
- if (c instanceof SharedScrolledComposite) {
- ((SharedScrolledComposite) c).reflow(true);
- break;
- }
- }
- c = control.getParent();
- while (c != null) {
- c.setRedraw(true);
- c = c.getParent();
- if (c instanceof SharedScrolledComposite) {
- break;
- }
- }
- }
-
- public static Composite getLayoutAdvisor(AbstractTaskEditorPage page) {
- Composite layoutAdvisor = page.getEditorComposite();
- do {
- layoutAdvisor = layoutAdvisor.getParent();
- } while (!(layoutAdvisor instanceof CTabFolder));
- return layoutAdvisor.getParent();
- }
-
- /**
- * Recursively sets the menu of all children of <code>composite</code>.
- */
- public static void setMenu(Composite composite, Menu menu) {
- if (!composite.isDisposed()) {
- composite.setMenu(menu);
- for (Control child : composite.getChildren()) {
- child.setMenu(menu);
- if (child instanceof Composite) {
- setMenu((Composite) child, menu);
- }
- }
- }
- }
-
- // TODO e3.4 replace reflection by assignment to RowLayout.center
- public static void center(RowLayout rowLayout) {
- try {
- Field field = RowLayout.class.getDeclaredField("center"); //$NON-NLS-1$
- field.set(rowLayout, Boolean.TRUE);
- } catch (Throwable e) {
- // ignore
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/FillWidthLayout.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/FillWidthLayout.java
deleted file mode 100644
index 352728cd6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/FillWidthLayout.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.ui.forms.widgets.ILayoutExtension;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * A layout that uses the width hint or client area of a composite to recommend the width of its children, allowing
- * children to fill the width and specify their preferred height for a given width.
- *
- * Intended for use with a composite that contains a single child that should fill available horizontal space.
- *
- * @author David Green
- */
-class FillWidthLayout extends Layout implements ILayoutExtension {
-
- private final int marginLeft;
-
- private final int marginRight;
-
- private final int marginTop;
-
- private final int marginBottom;
-
- private final int widthHintMargin;
-
- private Composite layoutAdvisor;
-
- private int lastWidthHint;
-
- private Point lastComputedSize;
-
- /**
- * create with 0 margins
- *
- */
- public FillWidthLayout() {
- this(0, 0, 0, 0);
- }
-
- /**
- * create while specifying margins
- *
- * @param marginLeft
- * the left margin in pixels, or 0 if there should be none
- * @param marginRight
- * the right margin in pixels, or 0 if there should be none
- * @param marginTop
- * the top margin in pixels, or 0 if there should be none
- * @param marginBottom
- * the bottom margin in pixels, or 0 if there should be none
- */
- public FillWidthLayout(int marginLeft, int marginRight, int marginTop, int marginBottom) {
- this(null, marginLeft, marginRight, marginTop, marginBottom);
- }
-
- /**
- * create specifying margins and a {@link #getLayoutAdvisor() layout advisor}.
- *
- * @param layoutAdvisor
- * the composite that is used to advise on layout based on its {@link Composite#getClientArea() client
- * area}.
- * @param marginLeft
- * the left margin in pixels, or 0 if there should be none
- * @param marginRight
- * the right margin in pixels, or 0 if there should be none
- * @param marginTop
- * the top margin in pixels, or 0 if there should be none
- * @param marginBottom
- * the bottom margin in pixels, or 0 if there should be none
- */
- public FillWidthLayout(Composite layoutAdvisor, int marginLeft, int marginRight, int marginTop, int marginBottom) {
- this.layoutAdvisor = layoutAdvisor;
- this.marginLeft = marginLeft;
- this.marginRight = marginRight;
- this.marginTop = marginTop;
- this.marginBottom = marginBottom;
- if (Platform.OS_MACOSX.equals(Platform.getOS())) {
- this.widthHintMargin = 15;
- } else {
- this.widthHintMargin = 18;
- }
- }
-
- /**
- * calculate the client area of the given container, accomodating for insets and margins.
- */
- private int calculateWidthHint(Composite container) {
- return calculateWidthHint(container, layoutAdvisor == null);
- }
-
- /**
- * calculate the client area of the given container, accomodating for insets and margins.
- */
- private int calculateWidthHint(Composite container, boolean layoutAdvisorHit) {
- if (container == layoutAdvisor) {
- layoutAdvisorHit = true;
- }
- Rectangle clientArea = container.getClientArea();
- int horizontalMargin = 0;
- if (clientArea.width <= 1 || !layoutAdvisorHit) { // sometimes client area is incorrectly reported as 1
- clientArea.width = calculateWidthHint(container.getParent(), layoutAdvisorHit);
- }
- Layout bodyLayout = container.getLayout();
- if (bodyLayout instanceof GridLayout) {
- GridLayout gridLayout = (GridLayout) bodyLayout;
- horizontalMargin = (gridLayout.marginWidth * 2) + gridLayout.marginLeft + gridLayout.marginRight;
- } else if (bodyLayout instanceof FillLayout) {
- FillLayout fillLayout = (FillLayout) bodyLayout;
- horizontalMargin = fillLayout.marginWidth * 2;
- } else if (container instanceof Section) {
- horizontalMargin = ((Section) container).marginWidth * 2;
- } else if (container instanceof CTabFolder) {
- CTabFolder folder = (CTabFolder) container;
- horizontalMargin = folder.marginWidth * 2;
- }
- if (container instanceof ScrolledComposite) {
- ScrolledComposite composite = (ScrolledComposite) container;
- ScrollBar verticalBar = composite.getVerticalBar();
- if (verticalBar != null) {
- int verticalBarWidth = verticalBar.getSize().x;
- horizontalMargin += Math.max(15, verticalBarWidth);
- }
- }
- return clientArea.width - horizontalMargin;
- }
-
- @Override
- protected Point computeSize(Composite composite, int widthHint, int heightHint, boolean flushCache) {
- Control[] children = composite.getChildren();
- if (children.length == 0) {
- return new Point(0, 0);
- }
- if (widthHint <= 0) {
- widthHint = calculateWidthHint(composite);
- widthHint -= widthHintMargin;
- }
-
- int horizontalMargin = marginLeft + marginRight;
- if (widthHint < horizontalMargin) {
- widthHint = horizontalMargin;
- }
-
- if (lastComputedSize == null || widthHint != lastWidthHint) {
- int resultX = 1;
- int resultY = 1;
- for (Control control : children) {
- Point sz = control.computeSize(widthHint - horizontalMargin, -1, flushCache);
- resultX = Math.max(resultX, sz.x);
- resultY = Math.max(resultY, sz.y);
- }
-
- lastWidthHint = widthHint;
- lastComputedSize = new Point(resultX + horizontalMargin, resultY + marginTop + marginBottom);
- }
- return new Point(lastComputedSize.x, lastComputedSize.y + 1);
- }
-
- @Override
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle area = composite.getClientArea();
- if (area.width == 0) {
- area.width = calculateWidthHint(composite);
- }
-
- // account for margins
- area.x += marginLeft;
- area.y += marginTop;
- area.width -= (marginRight + marginLeft);
- area.height -= (marginBottom + marginTop);
-
- Control[] children = composite.getChildren();
- for (Control control : children) {
- control.setBounds(area);
- }
- }
-
- /**
- * the composite that is used to advise on layout based on its {@link Composite#getClientArea() client area}.
- *
- * @return the layout advisor, or null if there is none
- */
- public Composite getLayoutAdvisor() {
- return layoutAdvisor;
- }
-
- /**
- * the composite that is used to advise on layout based on its {@link Composite#getClientArea() client area}.
- *
- * @param layoutAdvisor
- * the layout advisor, or null if there is none
- */
- public void setLayoutAdvisor(Composite layoutAdvisor) {
- this.layoutAdvisor = layoutAdvisor;
- }
-
- /**
- * Flushes all cached information about control sizes.
- */
- public void flush() {
- lastComputedSize = null;
- }
-
- public int computeMaximumWidth(Composite parent, boolean changed) {
- int width = marginLeft + marginRight;
- Control[] children = parent.getChildren();
- for (Control control : children) {
- width = Math.max(control.computeSize(SWT.DEFAULT, 0, changed).x + marginLeft + marginRight, width);
- }
- return width;
- }
-
- public int computeMinimumWidth(Composite parent, boolean changed) {
- int width = marginLeft + marginRight;
-// Control[] children = parent.getChildren();
-// for (Control control : children) {
-// width = Math.max(control.computeSize(0, SWT.DEFAULT, changed).x + marginLeft + marginRight, width);
-// }
- return width;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/HighlightingHyperlinkTextPresentationManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/HighlightingHyperlinkTextPresentationManager.java
deleted file mode 100644
index 5defed7e3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/HighlightingHyperlinkTextPresentationManager.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.preference.JFacePreferences;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.custom.StyleRange;
-
-/**
- * A manager that decorates hyperlinks with the hyperlink color.
- *
- * @author Steffen Pingel
- */
-public class HighlightingHyperlinkTextPresentationManager extends AbstractHyperlinkTextPresentationManager {
-
- @Override
- protected void decorate(StyleRange styleRange) {
- styleRange.foreground = JFaceResources.getColorRegistry().get(JFacePreferences.ACTIVE_HYPERLINK_COLOR);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/IBusyEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/IBusyEditor.java
deleted file mode 100644
index 41108aafd..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/IBusyEditor.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Shawn Minto
- */
-public interface IBusyEditor {
-
- public void setTitleImage(Image image);
-
- public Image getTitleImage();
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java
deleted file mode 100644
index 7becd03cf..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- */
-public class LongTextAttributeEditor extends AbstractAttributeEditor {
-
- public LongTextAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- setLayoutHint(new LayoutHint(RowSpan.MULTIPLE, ColumnSpan.MULTIPLE));
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- int style = SWT.FLAT | SWT.MULTI | SWT.WRAP;
- if (!isReadOnly()) {
- style |= SWT.V_SCROLL;
- }
- TextViewer viewer = new TextViewer(parent, style);
- viewer.setDocument(new Document(getValue()));
-
- final StyledText text = viewer.getTextWidget();
- toolkit.adapt(text, false, false);
-
- // enable cut/copy/paste
- CommonTextSupport.setTextViewer(text, viewer);
-
- if (isReadOnly()) {
- viewer.setEditable(false);
- } else {
- viewer.setEditable(true);
- text.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setValue(text.getText());
- EditorUtil.ensureVisible(text);
- }
- });
- }
-
- setControl(text);
- }
-
- public String getValue() {
- return getAttributeMapper().getValue(getTaskAttribute());
- }
-
- public void setValue(String text) {
- getAttributeMapper().setValue(getTaskAttribute(), text);
- attributeChanged();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
deleted file mode 100644
index 0fd1843f1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.editors.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String AbstractReplyToCommentAction_Reply;
-
- public static String AttachmentSizeFormatter_0_bytes;
-
- public static String AttachmentSizeFormatter_0_GB;
-
- public static String AttachmentSizeFormatter_0_KB;
-
- public static String AttachmentSizeFormatter_0_MB;
-
- public static String AttachmentSizeFormatter_1_byte;
-
- public static String AttachmentTableLabelProvider_File_;
-
- public static String AttachmentTableLabelProvider_Patch;
-
- public static String AttachmentTableLabelProvider_Task_Context;
-
- public static String AttachmentTableLabelProvider_Type_;
-
- public static String BrowserPreviewViewer_Error;
-
- public static String BrowserPreviewViewer_Formatting_Wiki_Text;
-
- public static String BrowserPreviewViewer_Loading_preview_;
-
- public static String BrowserPreviewViewer_The_repository_does_not_support_HTML_preview;
-
- public static String CategoryEditor_Category_Summary;
-
- public static String CategoryEditor_Description_;
-
- public static String CategoryEditor_URL_;
-
- public static String CategoryEditorInput_Category_Editor;
-
- public static String CommentGroupStrategy_Current;
-
- public static String CommentGroupStrategy_Older;
-
- public static String CommentGroupStrategy_Recent;
-
- public static String DateAttributeEditor_Clear;
-
- public static String PlanningPageFactory_Planning;
-
- public static String PreviewAttributeEditor_Edit;
-
- public static String PreviewAttributeEditor_Error;
-
- public static String PreviewAttributeEditor_Formatting_Wiki_Text;
-
- public static String PreviewAttributeEditor_Loading_preview_;
-
- public static String PreviewAttributeEditor_Preview;
-
- public static String RichTextAttributeEditor_Viewer_Source;
-
- public static String TaskAttachmentDropListener_Note_that_only_the_first_file_dragged_will_be_attached;
-
- public static String TaskEditorActionContributor_Add_to_X;
-
- public static String TaskEditorActionPart_Actions;
-
- public static String TaskEditorActionPart_Add_to_Category;
-
- public static String TaskEditorActionPart_Attach_Context;
-
- public static String TaskEditorActionPart_Submit;
-
- public static String TaskEditorActionPart_Submit_to_X;
-
- public static String TaskEditorAttachmentPart_Attach_;
-
- public static String TaskEditorAttachmentPart_Attach__Screenshot;
-
- public static String TaskEditorAttachmentPart_Attachments;
-
- public static String TaskEditorAttachmentPart_Created;
-
- public static String TaskEditorAttachmentPart_Creator;
-
- public static String TaskEditorAttachmentPart_Description;
-
- public static String TaskEditorAttachmentPart_Name;
-
- public static String TaskEditorAttachmentPart_No_attachments;
-
- public static String TaskEditorAttachmentPart_Size;
-
- public static String TaskEditorAttributePart_Attributes;
-
- public static String TaskEditorAttributePart_Refresh_Attributes;
-
- public static String TaskEditorAttributePart_Update_Failed;
-
- public static String TaskEditorAttributePart_Updating_of_repository_configuration_failed;
-
- public static String TaskEditorCommentPart_0;
-
- public static String TaskEditorCommentPart_1;
-
- public static String TaskEditorCommentPart_Collapse_Comments;
-
- public static String TaskEditorCommentPart_Comments;
-
- public static String TaskEditorCommentPart_Expand_Comments;
-
- public static String TaskEditorDescriptionPart_Description;
-
- public static String TaskEditorDescriptionPart_Detector;
-
- public static String TaskEditorDescriptionPart_Duplicate_Detection_Failed;
-
- public static String TaskEditorDescriptionPart_Duplicate_Detection;
-
- public static String TaskEditorDescriptionPart_The_duplicate_detector_did_not_return_a_valid_query;
-
- public static String TaskEditorDescriptionPart_Search;
-
- public static String TaskEditorNewCommentPart_New_Comment;
-
- public static String TaskEditorOutlineNode_Comments;
-
- public static String TaskEditorOutlineNode_Description;
-
- public static String TaskEditorOutlineNode_New_Comment;
-
- public static String TaskEditorOutlineNode_Task_;
-
- public static String TaskEditorPeoplePart_People;
-
- public static String TaskEditorPlanningPart_0_SECOUNDS;
-
- public static String TaskEditorPlanningPart_Active;
-
- public static String TaskEditorPlanningPart_Clear;
-
- public static String TaskEditorPlanningPart_Confirm_Activity_Time_Deletion;
-
- public static String TaskEditorPlanningPart_Do_you_wish_to_reset_your_activity_time_on_this_task_;
-
- public static String TaskEditorPlanningPart_Due;
-
- public static String TaskEditorPlanningPart_Estimated;
-
- public static String TaskEditorPlanningPart_Personal_Planning;
-
- public static String TaskEditorPlanningPart_Reset;
-
- public static String TaskEditorPlanningPart_Scheduled;
-
- public static String TaskEditorPlanningPart_Time_working_on_this_task;
-
- public static String TaskEditorRichTextPart_Browser_Preview;
-
- public static String TaskEditorRichTextPart_Maximize;
-
- public static String TaskEditorRichTextPart_Preview;
-
- public static String TaskEditorSummaryPart_Summary;
-
- public static String TaskPlanningEditor_0_seconds;
-
- public static String TaskPlanningEditor_Active;
-
- public static String TaskPlanningEditor_Clear;
-
- public static String TaskPlanningEditor_Complete;
-
- public static String TaskPlanningEditor_Completed;
-
- public static String TaskPlanningEditor_Confirm_Activity_Time_Deletion;
-
- public static String TaskPlanningEditor_Created;
-
- public static String TaskPlanningEditor_Do_you_wish_to_reset_your_activity_time_on_this_task_;
-
- public static String TaskPlanningEditor_Due;
-
- public static String TaskPlanningEditor_Estimated_hours;
-
- public static String TaskPlanningEditor_Incomplete;
-
- public static String TaskPlanningEditor__info_editor_for_task_;
-
- public static String TaskPlanningEditor_Notes;
-
- public static String TaskPlanningEditor_Open_with_Web_Browser;
-
- public static String TaskPlanningEditor_Personal_Planning;
-
- public static String TaskPlanningEditor_Planning;
-
- public static String TaskPlanningEditor_Priority;
-
- public static String TaskPlanningEditor_Reset;
-
- public static String TaskPlanningEditor_Retrieve_task_description_from_URL;
-
- public static String TaskPlanningEditor_Scheduled_for;
-
- public static String TaskPlanningEditor_Status;
-
- public static String TaskPlanningEditor_Time_working_on_this_task;
-
- public static String TaskPlanningEditor_URL;
-
- public static String AbstractTaskEditorPage_Comment_required;
-
- public static String AbstractTaskEditorPage_Could_not_save_task;
-
- public static String AbstractTaskEditorPage_Error_opening_task;
-
- public static String AbstractTaskEditorPage_Failed_to_read_task_data_;
-
- public static String AbstractTaskEditorPage_History;
-
- public static String AbstractTaskEditorPage_Open_failed;
-
- public static String AbstractTaskEditorPage_Open_with_Web_Browser;
-
- public static String AbstractTaskEditorPage_Save_failed;
-
- public static String AbstractTaskEditorPage_Submit_failed;
-
- public static String AbstractTaskEditorPage_Submit_failed_;
-
- public static String AbstractTaskEditorPage_Synchronize_to_retrieve_task_data;
-
- public static String AbstractTaskEditorPage_Synchronize_to_update_editor_contents;
-
- public static String AbstractTaskEditorPage_Add_task_to_tasklist;
-
- public static String AbstractTaskEditorPage_Task_has_incoming_changes;
-
- public static String AbstractTaskEditorPage_Title;
-
- public static String AbstractTaskEditorPage_Unable_to_submit_at_this_time;
-
- public static String AttributeEditorToolkit_Content_Assist_Available__X_;
-
- public static String TaskEditor_Task_;
-
- public static String TaskEditor_Task_added_to_the_Uncategorized_container;
-
- public static String TaskEditorExtensionSettingsContribution__default_;
-
- public static String TaskEditorExtensionSettingsContribution_Editor;
-
- public static String TaskEditorExtensionSettingsContribution_Plain_Text;
-
- public static String TaskEditorExtensionSettingsContribution_Select_the_capabilities_of_the_task_editor;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java
deleted file mode 100644
index 08b3c06ea..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- */
-public class MultiSelectionAttributeEditor extends AbstractAttributeEditor {
-
- private String[] allValues;
-
- private List list;
-
- public MultiSelectionAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- setLayoutHint(new LayoutHint(RowSpan.MULTIPLE, ColumnSpan.SINGLE));
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- list = new List(parent, SWT.FLAT | SWT.MULTI | SWT.V_SCROLL);
- toolkit.adapt(list, false, false);
- list.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- list.setFont(EditorUtil.TEXT_FONT);
-
- Map<String, String> labelByValue = getAttributeMapper().getOptions(getTaskAttribute());
- if (labelByValue != null) {
- allValues = labelByValue.keySet().toArray(new String[0]);
- for (String value : allValues) {
- list.add(labelByValue.get(value));
- }
- }
-
- select(getValues(), getValuesLabels());
-
- if (allValues != null) {
- list.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- Assert.isNotNull(allValues);
- int[] indices = list.getSelectionIndices();
- String[] selectedValues = new String[indices.length];
- for (int i = 0; i < indices.length; i++) {
- int index = indices[i];
- Assert.isLegal(index >= 0 && index <= allValues.length - 1);
- selectedValues[i] = allValues[index];
- }
- setValues(selectedValues);
- }
- });
- list.showSelection();
- }
-
- setControl(list);
- }
-
- public String[] getValues() {
- return getAttributeMapper().getValues(getTaskAttribute()).toArray(new String[0]);
- }
-
- public String[] getValuesLabels() {
- return getAttributeMapper().getValueLabels(getTaskAttribute()).toArray(new String[0]);
- }
-
- private void select(String[] values, String[] labels) {
- if (values != null) {
- list.deselectAll();
- Set<String> selectedValues = new HashSet<String>(Arrays.asList(values));
- for (int i = 0; i < allValues.length; i++) {
- if (selectedValues.contains(allValues[i])) {
- list.select(i);
- }
- }
- } else {
- list.setItems(labels);
- list.setSelection(labels);
- }
- }
-
- public void setValues(String[] values) {
- getAttributeMapper().setValues(getTaskAttribute(), Arrays.asList(values));
- attributeChanged();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java
deleted file mode 100644
index 17b86e4aa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PersonAttributeEditor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-
-/**
- * @author Steffen Pingel
- */
-public class PersonAttributeEditor extends TextAttributeEditor {
-
- public PersonAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- }
-
- @Override
- public String getValue() {
- IRepositoryPerson repositoryPerson = getAttributeMapper().getRepositoryPerson(getTaskAttribute());
- if (repositoryPerson != null) {
- return (isReadOnly()) ? repositoryPerson.toString() : repositoryPerson.getPersonId();
- }
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public void setValue(String text) {
- IRepositoryPerson person = getAttributeMapper().getTaskRepository().createPerson(text);
- getAttributeMapper().setRepositoryPerson(getTaskAttribute(), person);
- attributeChanged();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPageFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPageFactory.java
deleted file mode 100644
index 2ab408ff0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PlanningPageFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.forms.editor.IFormPage;
-
-public class PlanningPageFactory extends AbstractTaskEditorPageFactory {
-
- @Override
- public boolean canCreatePageFor(TaskEditorInput input) {
- return true;
- }
-
- @Override
- public IFormPage createPage(TaskEditor parentEditor) {
- return new TaskPlanningEditor(parentEditor);
- }
-
- @Override
- public Image getPageImage() {
- return CommonImages.getImage(CommonImages.CALENDAR_SMALL);
- }
-
- @Override
- public String getPageText() {
- return Messages.PlanningPageFactory_Planning;
- }
-
- @Override
- public int getPriority() {
- return PRIORITY_PLANNING;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PreviewAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PreviewAttributeEditor.java
deleted file mode 100644
index 0466acd9b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/PreviewAttributeEditor.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Xiaoyang Guan - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractRenderingEngine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.LocationAdapter;
-import org.eclipse.swt.browser.LocationEvent;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- * @deprecated replaced by {@link BrowserPreviewViewer}
- */
-// TODO 3.1 remove class
-@Deprecated
-public class PreviewAttributeEditor extends AbstractAttributeEditor {
-
- private final RichTextAttributeEditor editor;
-
- private boolean ignoreLocationEvents;
-
- private final AbstractRenderingEngine renderingEngine;
-
- private final TaskRepository taskRepository;
-
- public PreviewAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute, TaskRepository taskRepository,
- AbstractRenderingEngine renderingEngine, RichTextAttributeEditor editor) {
- super(manager, taskAttribute);
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(editor);
- Assert.isNotNull(renderingEngine);
- this.taskRepository = taskRepository;
- this.editor = editor;
- this.renderingEngine = renderingEngine;
- }
-
- private Browser addBrowser(Composite parent, int style) {
- Browser browser = new Browser(parent, style);
- // intercept links to open tasks in rich editor and urls in separate browser
- browser.addLocationListener(new LocationAdapter() {
- @Override
- public void changing(LocationEvent event) {
- // ignore events that are caused by manually setting the contents of the browser
- if (ignoreLocationEvents) {
- return;
- }
-
- if (event.location != null && !event.location.startsWith("about")) { //$NON-NLS-1$
- event.doit = false;
- IHyperlink link = new TaskUrlHyperlink(
- new Region(0, 0)/* a fake region just to make constructor happy */, event.location);
- link.open();
- }
- }
-
- });
-
- return browser;
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- final Composite composite = toolkit.createComposite(parent);
- composite.setLayout(new GridLayout(1, false));
-
- // composite with StackLayout to hold text editor and preview widget
- Composite editorComposite = toolkit.createComposite(composite);
- editorComposite.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- GridData gd = new GridData(GridData.FILL_BOTH);
-// gd.widthHint = EditorUtil.MAXIMUM_WIDTH;
- gd.minimumHeight = EditorUtil.MAXIMUM_HEIGHT;
- gd.grabExcessHorizontalSpace = true;
- editorComposite.setLayoutData(gd);
- StackLayout descriptionLayout = new StackLayout();
- editorComposite.setLayout(descriptionLayout);
-
- editor.createControl(editorComposite, toolkit);
-
- // composite for edit/preview button
- Composite buttonComposite = toolkit.createComposite(composite);
- buttonComposite.setLayout(new GridLayout());
- createPreviewButton(buttonComposite, editor.getViewer(), editorComposite, descriptionLayout, toolkit);
- descriptionLayout.topControl = editor.getControl();
-
- toolkit.paintBordersFor(composite);
- setControl(composite);
- }
-
- /**
- * Creates and sets up the button for switching between text editor and HTML preview. Subclasses that support HTML
- * preview of new comments must override this method.
- *
- * @param buttonComposite
- * the composite that holds the button
- * @param editor
- * the TextViewer for editing text
- * @param previewBrowser
- * the Browser for displaying the preview
- * @param editorLayout
- * the StackLayout of the <code>editorComposite</code>
- * @param editorComposite
- * the composite that holds <code>editor</code> and <code>previewBrowser</code>
- * @since 2.1
- */
- private void createPreviewButton(final Composite buttonComposite, final TextViewer editor,
- final Composite editorComposite, final StackLayout editorLayout, final FormToolkit toolkit) {
- // create an anonymous object that encapsulates the edit/preview button together with
- // its state and String constants for button text;
- // this implementation keeps all information needed to set up the button
- // in this object and the method parameters, and this method is reused by both the
- // description section and new comments section.
- new Object() {
- private/*static*/final String LABEL_BUTTON_EDIT = Messages.PreviewAttributeEditor_Edit;
-
- private/*static*/final String LABEL_BUTTON_PREVIEW = Messages.PreviewAttributeEditor_Preview;
-
- private int buttonState = 0;
-
- private Browser previewBrowser;
-
- private Button previewButton;
-
- {
- previewButton = toolkit.createButton(buttonComposite, LABEL_BUTTON_PREVIEW, SWT.PUSH);
- GridData previewButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- previewButtonData.widthHint = 100;
- //previewButton.setImage(TasksUiImages.getImage(TasksUiImages.PREVIEW));
- previewButton.setLayoutData(previewButtonData);
- previewButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- if (previewBrowser == null) {
- previewBrowser = addBrowser(editorComposite, SWT.NONE);
- }
-
- buttonState = ++buttonState % 2;
- if (buttonState == 1) {
- setText(previewBrowser, Messages.PreviewAttributeEditor_Loading_preview_);
- previewWiki(previewBrowser, editor.getTextWidget().getText());
- }
- previewButton.setText(buttonState == 0 ? LABEL_BUTTON_PREVIEW : LABEL_BUTTON_EDIT);
- editorLayout.topControl = (buttonState == 0 ? editor.getControl() : previewBrowser);
- editorComposite.layout();
- }
- });
- }
-
- };
- }
-
- private void previewWiki(final Browser browser, String sourceText) {
- final class PreviewWikiJob extends Job {
- private String htmlText;
-
- private IStatus jobStatus;
-
- private final String sourceText;
-
- public PreviewWikiJob(String sourceText) {
- super(Messages.PreviewAttributeEditor_Formatting_Wiki_Text);
-
- if (sourceText == null) {
- throw new IllegalArgumentException("source text must not be null"); //$NON-NLS-1$
- }
-
- this.sourceText = sourceText;
- }
-
- public String getHtmlText() {
- return htmlText;
- }
-
- public IStatus getStatus() {
- return jobStatus;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- if (renderingEngine == null) {
- jobStatus = new RepositoryStatus(taskRepository, IStatus.INFO, TasksUiPlugin.ID_PLUGIN,
- RepositoryStatus.ERROR_INTERNAL, "The repository does not support HTML preview."); //$NON-NLS-1$
- return Status.OK_STATUS;
- }
-
- jobStatus = Status.OK_STATUS;
- try {
- htmlText = renderingEngine.renderAsHtml(taskRepository, sourceText, monitor);
- } catch (CoreException e) {
- jobStatus = e.getStatus();
- }
- return Status.OK_STATUS;
- }
-
- }
-
- final PreviewWikiJob job = new PreviewWikiJob(sourceText);
-
- job.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(final IJobChangeEvent event) {
- if (!getControl().isDisposed()) {
- if (job.getStatus().isOK()) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- setText(browser, job.getHtmlText());
- // TODO EDITOR error handling
- //getAttributeEditorManager().setMessage(null, IMessageProvider.NONE);
- }
- });
- } else {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.displayStatus(Messages.PreviewAttributeEditor_Error, job.getStatus());
- // TODO EDITOR error handling
- //getAttributeEditorManager().setMessage(job.getStatus().getMessage(), IMessageProvider.ERROR);
- }
- });
- }
- }
- super.done(event);
- }
- });
-
- job.setUser(true);
- job.schedule();
- }
-
- private void setText(Browser browser, String html) {
- try {
- ignoreLocationEvents = true;
- browser.setText((html != null) ? html : ""); //$NON-NLS-1$
- } finally {
- ignoreLocationEvents = false;
- }
-
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryCompletionProcessor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryCompletionProcessor.java
deleted file mode 100644
index 313cbec1d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryCompletionProcessor.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Frank Becker and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Frank Becker - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivationHistory;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Frank Becker
- * @author Steffen Pingel
- * @since 3.0
- */
-public class RepositoryCompletionProcessor implements IContentAssistProcessor {
-
- private class ProposalComputer {
-
- public static final String LABEL_SEPARATOR = " -------------------------------------------- "; //$NON-NLS-1$
-
- private final Set<ITask> addedTasks = new HashSet<ITask>();
-
- private boolean addSeparator;
-
- private final int offset;
-
- private final String prefix;
-
- private final List<CompletionProposal> resultList = new ArrayList<CompletionProposal>();
-
- public ProposalComputer(ITextViewer viewer, int offset) {
- this.offset = offset;
- this.prefix = extractPrefix(viewer, offset).toLowerCase();
- }
-
- private void addProposal(ITask task, String replacement, boolean includeTaskPrefix) {
- if (addSeparator) {
- if (!addedTasks.isEmpty()) {
- resultList.add(createSeparator());
- }
- addSeparator = false;
- }
-
- replacement = getReplacement(task, replacement, includeTaskPrefix);
- String displayString = labelProvider.getText(task);
- resultList.add(new CompletionProposal(replacement, offset - prefix.length(), prefix.length(),
- replacement.length(), labelProvider.getImage(task), displayString, null, null));
-
- addedTasks.add(task);
- }
-
- public void addSeparator() {
- addSeparator = true;
- }
-
- public void addTasks(List<AbstractTask> tasks) {
- for (AbstractTask task : tasks) {
- addTask(task);
- }
- }
-
- public void addTask(ITask task) {
- if (addedTasks.contains(task)) {
- return;
- }
-
- if (getNeverIncludePrefix() && !task.getRepositoryUrl().equals(taskRepository.getRepositoryUrl())) {
- return;
- }
-
- String taskKey = task.getTaskKey();
- if (prefix.length() == 0) {
- addProposal(task, taskKey, !getNeverIncludePrefix());
- } else if (taskKey != null && taskKey.startsWith(prefix)) {
- addProposal(task, taskKey, false);
- } else if (containsPrefix(task)) {
- addProposal(task, taskKey, !getNeverIncludePrefix());
- }
- }
-
- private String getReplacement(ITask task, String text, boolean includeTaskPrefix) {
- // add an absolute reference to the task if the viewer does not have a repository
- if (taskRepository == null || text == null
- || !taskRepository.getRepositoryUrl().equals(task.getRepositoryUrl())) {
- return CopyTaskDetailsAction.getTextForTask(task);
- }
-
- if (includeTaskPrefix) {
- return getTaskPrefix(task) + text;
- } else {
- return text;
- }
- }
-
- private boolean containsPrefix(ITask task) {
- String searchTest = getTaskPrefix(task) + " " + labelProvider.getText(task); //$NON-NLS-1$
- String[] tokens = searchTest.split("\\s"); //$NON-NLS-1$
- for (String token : tokens) {
- if (token.toLowerCase().startsWith(prefix)) {
- return true;
- }
- }
- return false;
- }
-
- private CompletionProposal createSeparator() {
- return new CompletionProposal("", offset, 0, 0, CommonImages.getImage(CommonImages.SEPARATOR_LIST), //$NON-NLS-1$
- LABEL_SEPARATOR, null, null);
- }
-
- /**
- * Returns the prefix of the currently completed text. Assumes that any character that is not a line break or
- * white space can be part of a task id.
- */
- private String extractPrefix(ITextViewer viewer, int offset) {
- int i = offset;
- IDocument document = viewer.getDocument();
- if (i > document.getLength()) {
- return ""; //$NON-NLS-1$
- }
-
- try {
- while (i > 0) {
- char ch = document.getChar(i - 1);
- if (Character.isWhitespace(ch)) {
- break;
- }
- i--;
- }
-
- return document.get(i, offset - i);
- } catch (BadLocationException e) {
- return ""; //$NON-NLS-1$
- }
- }
-
- public void filterTasks(List<AbstractTask> tasks) {
- for (Iterator<AbstractTask> it = tasks.iterator(); it.hasNext();) {
- ITask task = it.next();
- if (!select(task)) {
- it.remove();
- }
- }
- }
-
- private boolean select(ITask task) {
- return !(task instanceof LocalTask) //
- && (taskRepository == null || task.getRepositoryUrl().equals(taskRepository.getRepositoryUrl()));
- }
-
- public ICompletionProposal[] getResult() {
- return resultList.toArray(new ICompletionProposal[resultList.size()]);
- }
-
- }
-
- private static final int MAX_OPEN_EDITORS = 10;
-
- private static final int MAX_ACTIVATED_TASKS = 10;
-
- private final TaskElementLabelProvider labelProvider = new TaskElementLabelProvider(false);
-
- private final TaskRepository taskRepository;
-
- private boolean neverIncludePrefix;
-
- public RepositoryCompletionProcessor(TaskRepository taskRepository) {
- this.taskRepository = taskRepository;
- this.neverIncludePrefix = false;
- }
-
- public boolean getNeverIncludePrefix() {
- return neverIncludePrefix;
- }
-
- public void setNeverIncludePrefix(boolean includePrefix) {
- this.neverIncludePrefix = includePrefix;
- }
-
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection();
- // adjust offset to end of normalized selection
- if (selection.getOffset() == offset) {
- offset = selection.getOffset() + selection.getLength();
- }
-
- ProposalComputer proposalComputer = new ProposalComputer(viewer, offset);
-
- // add tasks from navigation history
-// IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-// if (window != null) {
-// IWorkbenchPage page = window.getActivePage();
-// if (page != null) {
-// INavigationHistory history = page.getNavigationHistory();
-// INavigationLocation[] locations = history.getLocations();
-// if (locations != null) {
-// for (INavigationLocation location : locations) {
-// // location is always null
-// }
-// }
-// }
-// }
-
- // add open editor
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IEditorReference[] editorReferences = page.getEditorReferences();
- int count = 0;
- for (int i = editorReferences.length - 1; i >= 0 && count < MAX_OPEN_EDITORS; i--) {
- try {
- if (editorReferences[i].getEditorInput() instanceof TaskEditorInput) {
- TaskEditorInput input = (TaskEditorInput) editorReferences[i].getEditorInput();
- ITask task = input.getTask();
- if (task != null && !(task instanceof LocalTask)) {
- proposalComputer.addTask(task);
- count++;
- }
- }
- } catch (PartInitException e) {
- // ignore
- }
- }
- }
- }
-
- // add tasks from activation history
- TaskActivationHistory taskHistory = TasksUiPlugin.getTaskActivityManager().getTaskActivationHistory();
- List<AbstractTask> tasks = taskHistory.getPreviousTasks(TasksUiInternal.getContainersFromWorkingSet(TaskListView.getActiveWorkingSets()));
- int count = 0;
- for (int i = tasks.size() - 1; i >= 0 && count < MAX_ACTIVATED_TASKS; i--) {
- AbstractTask task = tasks.get(i);
- if (!(task instanceof LocalTask)) {
- proposalComputer.addTask(task);
- }
- }
-
- // add all remaining tasks for repository
- if (taskRepository != null) {
- proposalComputer.addSeparator();
-
- TaskList taskList = TasksUiPlugin.getTaskList();
- tasks = new ArrayList<AbstractTask>(taskList.getAllTasks());
- proposalComputer.filterTasks(tasks);
- Collections.sort(tasks, new Comparator<AbstractTask>() {
- public int compare(AbstractTask o1, AbstractTask o2) {
- return labelProvider.getText(o1).compareTo(labelProvider.getText(o2));
- }
- });
- proposalComputer.addTasks(tasks);
- }
-
- return proposalComputer.getResult();
- }
-
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- public String getErrorMessage() {
- return null;
- }
-
- private String getTaskPrefix(ITask task) {
- AbstractRepositoryConnector connector = TasksUiPlugin.getConnector(task.getConnectorKind());
- String prefix = connector.getTaskIdPrefix();
- // FIXME work around for Trac "#" prefix
- return (prefix.length() > 1) ? prefix + " " : prefix; //$NON-NLS-1$
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewer.java
deleted file mode 100644
index ced0f83aa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewer.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IOverviewRuler;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * @author Rob Elves
- * @deprecated
- */
-// TODO 3.1 remove
-@Deprecated
-public class RepositoryTextViewer extends SourceViewer {
-
- @Deprecated
- private final MenuManager menuManager;
-
- private TaskRepository repository;
-
- public RepositoryTextViewer(IVerticalRuler vertRuler, IOverviewRuler overRuler, TaskRepository repository,
- Composite composite, int style) {
- super(composite, vertRuler, overRuler, true, style);
- this.menuManager = new MenuManager();
- this.repository = repository;
-
- }
-
- public RepositoryTextViewer(TaskRepository repository, Composite composite, int style) {// FormEditor
- super(composite, null, style);
- this.menuManager = new MenuManager();
- this.repository = repository;
- }
-
- @Override
- public void setDocument(IDocument doc) {
- if (doc != null && this.getAnnotationModel() != null) {
- this.getAnnotationModel().connect(doc);
- super.setDocument(doc, this.getAnnotationModel());
- } else {
- super.setDocument(doc);
- }
- }
-
- public TaskRepository getRepository() {
- return repository;
- }
-
- public void setRepository(TaskRepository repository) {
- this.repository = repository;
- }
-
- @Override
- protected void handleDispose() {
- menuManager.dispose();
- super.handleDispose();
- }
-
- @Deprecated
- public MenuManager getMenuManager() {
- return menuManager;
- }
-
- @Deprecated
- public void setMenu(Menu menu) {
- if (getTextWidget() != null && !getTextWidget().isDisposed()) {
- getTextWidget().setMenu(menu);
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java
deleted file mode 100644
index 5043ce2be..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RepositoryTextViewerConfiguration.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.preference.JFacePreferences;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.SingleLineRule;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TaskHyperlinkPresenter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-
-/**
- * @author Rob Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-public class RepositoryTextViewerConfiguration extends TextSourceViewerConfiguration {
-
- public enum Mode {
- URL, TASK, TASK_RELATION, DEFAULT
- }
-
- private static final String ID_CONTEXT_EDITOR_TASK = "org.eclipse.mylyn.tasks.ui.TaskEditor"; //$NON-NLS-1$
-
- private static final String ID_CONTEXT_EDITOR_TEXT = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
-
- private RepositoryTextScanner scanner;
-
- private final boolean spellCheck;
-
- private final TaskRepository taskRepository;
-
- private Mode mode;
-
- public RepositoryTextViewerConfiguration(TaskRepository taskRepository, boolean spellCheck) {
- super(EditorsUI.getPreferenceStore());
- this.taskRepository = taskRepository;
- this.spellCheck = spellCheck;
- this.mode = Mode.DEFAULT;
- }
-
- public Mode getMode() {
- return mode;
- }
-
- public void setMode(Mode mode) {
- Assert.isNotNull(mode);
- this.mode = mode;
- }
-
- @Override
- public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- if (getMode() == Mode.DEFAULT) {
- PresentationReconciler reconciler = new PresentationReconciler();
- reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
- DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getDefaultScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
- return reconciler;
- }
- return super.getPresentationReconciler(sourceViewer);
- }
-
- private RepositoryTextScanner getDefaultScanner() {
- if (scanner == null) {
- scanner = new RepositoryTextScanner(getMode());
- }
- return scanner;
- }
-
- @Override
- public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
- if (mode == Mode.URL || mode == Mode.TASK_RELATION) {
- return getDefaultHyperlinkDetectors(sourceViewer, mode);
- }
- return super.getHyperlinkDetectors(sourceViewer);
- }
-
- public IHyperlinkDetector[] getDefaultHyperlinkDetectors(ISourceViewer sourceViewer, Mode mode) {
- IHyperlinkDetector[] detectors;
- if (mode == Mode.URL) {
- detectors = new IHyperlinkDetector[] { new TaskUrlHyperlinkDetector() };
- } else if (mode == Mode.TASK) {
- detectors = new IHyperlinkDetector[] { new TaskHyperlinkDetector() };
- } else if (mode == Mode.TASK_RELATION) {
- detectors = new IHyperlinkDetector[] { new TaskRelationHyperlinkDetector() };
- } else {
- detectors = super.getHyperlinkDetectors(sourceViewer);
- }
- if (detectors != null) {
- IAdaptable target = getDefaultHyperlinkTarget();
- for (IHyperlinkDetector hyperlinkDetector : detectors) {
- if (hyperlinkDetector instanceof AbstractHyperlinkDetector) {
- ((AbstractHyperlinkDetector) hyperlinkDetector).setContext(target);
- }
- }
- }
- return detectors;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected Map getHyperlinkDetectorTargets(final ISourceViewer sourceViewer) {
- IAdaptable context = getDefaultHyperlinkTarget();
-
- Map targets = new HashMap();
- targets.put(ID_CONTEXT_EDITOR_TEXT, context);
- targets.put(ID_CONTEXT_EDITOR_TASK, context);
- return targets;
- }
-
- @SuppressWarnings("unchecked")
- private IAdaptable getDefaultHyperlinkTarget() {
- IAdaptable context = new IAdaptable() {
- public Object getAdapter(Class adapter) {
- if (adapter == TaskRepository.class) {
- return getTaskRepository();
- }
- return null;
- }
- };
- return context;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- @Override
- public IHyperlinkPresenter getHyperlinkPresenter(final ISourceViewer sourceViewer) {
- if (fPreferenceStore == null) {
- return new TaskHyperlinkPresenter(new RGB(0, 0, 255));
- }
- return new TaskHyperlinkPresenter(fPreferenceStore);
- }
-
- @Override
- public int getHyperlinkStateMask(ISourceViewer sourceViewer) {
- return SWT.NONE;
- }
-
- @Override
- public IReconciler getReconciler(ISourceViewer sourceViewer) {
- if (spellCheck) {
- return super.getReconciler(sourceViewer);
- } else {
- return null;
- }
- }
-
- private static class RepositoryTextScanner extends RuleBasedScanner {
-
- public RepositoryTextScanner(Mode mode) {
- IToken bugToken = new Token(new TextAttribute(JFaceResources.getColorRegistry().get(
- JFacePreferences.ACTIVE_HYPERLINK_COLOR)));
- IToken quoteToken = new Token(new TextAttribute(CommonColors.TEXT_QUOTED));
- IRule[] rules = new IRule[16];
- rules[0] = (new SingleLineRule("http://", " ", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[1] = (new SingleLineRule("https://", " ", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[2] = (new SingleLineRule("bug#", " ", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[3] = (new SingleLineRule("bug#", "", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[4] = (new SingleLineRule("bug #", "", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[5] = (new SingleLineRule("http://", "\n", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[6] = (new SingleLineRule("https://", "\n", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[7] = (new SingleLineRule("task#", " ", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[8] = (new MultiLineRule("task#", "\n", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[9] = (new MultiLineRule("task# ", " ", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[10] = (new SingleLineRule("task #", "\n", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[11] = (new SingleLineRule("*** This bug has been ", "***", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[12] = (new SingleLineRule("http://", "", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[13] = (new SingleLineRule("https://", "", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- rules[14] = (new MultiLineRule("task #", " ", bugToken)); //$NON-NLS-1$ //$NON-NLS-2$
- SingleLineRule quoteRule = new SingleLineRule(">", null, quoteToken, (char) 0, true); //$NON-NLS-1$
- quoteRule.setColumnConstraint(0);
- rules[15] = quoteRule;
- setRules(rules);
- }
-
- }
-
- @Override
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- if (mode == Mode.URL) {
- return null;
- }
- ContentAssistant assistant = new ContentAssistant();
- RepositoryCompletionProcessor processor = new RepositoryCompletionProcessor(taskRepository);
- if (mode == Mode.TASK_RELATION) {
- processor.setNeverIncludePrefix(true);
- }
- assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
- return assistant;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
deleted file mode 100644
index abeedbf39..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
+++ /dev/null
@@ -1,533 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Raphael Ackermann - spell checking support on bug 195514
- * Jingwen Ou - extensibility improvements
- * David Green - fix for bug 256702
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.mylyn.internal.tasks.ui.commands.ViewSourceHandler;
-import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTextViewerConfiguration.Mode;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractRenderingEngine;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
-import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
-import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * A text attribute editor that can switch between a editor, preview and source view.
- *
- * @author Raphael Ackermann
- * @author Steffen Pingel
- * @author Jingwen Ou
- */
-public class RichTextAttributeEditor extends AbstractAttributeEditor {
-
- private IContextActivation contextActivation;
-
- private final IContextService contextService;
-
- private SourceViewer defaultViewer;
-
- private Composite editorComposite;
-
- private StackLayout editorLayout;
-
- private final AbstractTaskEditorExtension extension;
-
- private SourceViewer editorViewer;
-
- private SourceViewer previewViewer;
-
- private final TaskRepository taskRepository;
-
- private FormToolkit toolkit;
-
- public class ViewSourceAction extends Action {
-
- public ViewSourceAction() {
- super(Messages.RichTextAttributeEditor_Viewer_Source, SWT.TOGGLE);
- setChecked(false);
- setEnabled(false);
- }
-
- @Override
- public void run() {
- if (isChecked()) {
- showDefault();
- } else {
- showEditor();
- }
- if (editorLayout != null) {
- EditorUtil.reflow(editorLayout.topControl);
- }
- ViewSourceHandler.setChecked(isChecked());
- }
-
- }
-
- private final IAction viewSourceAction = new ViewSourceAction();
-
- private boolean spellCheckingEnabled;
-
- private final int style;
-
- private Mode mode;
-
- private AbstractRenderingEngine renderingEngine;
-
- private BrowserPreviewViewer browserViewer;
-
- public RichTextAttributeEditor(TaskDataModel manager, TaskRepository taskRepository, TaskAttribute taskAttribute) {
- this(manager, taskRepository, taskAttribute, SWT.MULTI);
- }
-
- public RichTextAttributeEditor(TaskDataModel manager, TaskRepository taskRepository, TaskAttribute taskAttribute,
- int style) {
- this(manager, taskRepository, taskAttribute, style, null, null);
- }
-
- public RichTextAttributeEditor(TaskDataModel manager, TaskRepository taskRepository, TaskAttribute taskAttribute,
- int style, IContextService contextService, AbstractTaskEditorExtension extension) {
- super(manager, taskAttribute);
- this.taskRepository = taskRepository;
- this.style = style;
- this.contextService = contextService;
- this.extension = extension;
- if ((style & SWT.MULTI) != 0) {
- setLayoutHint(new LayoutHint(RowSpan.MULTIPLE, ColumnSpan.MULTIPLE));
- } else {
- setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.MULTIPLE));
- }
- setMode(Mode.DEFAULT);
- }
-
- public Mode getMode() {
- return mode;
- }
-
- public void setMode(Mode mode) {
- Assert.isNotNull(mode);
- this.mode = mode;
- }
-
- private void installListeners(final SourceViewer viewer) {
- viewer.addTextListener(new ITextListener() {
- public void textChanged(TextEvent event) {
- // filter out events caused by text presentation changes, e.g. annotation drawing
- String value = viewer.getTextWidget().getText();
- if (!getValue().equals(value)) {
- setValue(value);
- EditorUtil.ensureVisible(viewer.getTextWidget());
- }
- }
- });
- // ensure that tab traverses to next control instead of inserting a tab character unless editing multi-line text
- if ((style & SWT.MULTI) != 0 && mode != Mode.DEFAULT) {
- viewer.getTextWidget().addListener(SWT.Traverse, new Listener() {
- public void handleEvent(Event event) {
- switch (event.detail) {
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- event.doit = true;
- break;
- }
- }
- });
- }
- }
-
- public String getValue() {
- return getAttributeMapper().getValue(getTaskAttribute());
- }
-
- public boolean isSpellCheckingEnabled() {
- return spellCheckingEnabled;
- }
-
- public void setSpellCheckingEnabled(boolean spellCheckingEnabled) {
- this.spellCheckingEnabled = spellCheckingEnabled;
- }
-
- public void setValue(String value) {
- getAttributeMapper().setValue(getTaskAttribute(), value);
- attributeChanged();
- }
-
- /** Configures annotation model for spell checking. */
- private void configureAsEditor(SourceViewer viewer, Document document) {
- AnnotationModel annotationModel = new AnnotationModel();
- viewer.showAnnotations(false);
- viewer.showAnnotationsOverview(false);
- IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
- final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(viewer, null, annotationAccess,
- EditorsUI.getSharedTextColors());
- Iterator<?> e = new MarkerAnnotationPreferences().getAnnotationPreferences().iterator();
- while (e.hasNext()) {
- support.setAnnotationPreference((AnnotationPreference) e.next());
- }
- support.install(EditorsUI.getPreferenceStore());
- viewer.getTextWidget().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- support.uninstall();
- }
- });
- //viewer.getTextWidget().setIndent(2);
- viewer.setDocument(document, annotationModel);
- }
-
- private RepositoryTextViewerConfiguration installHyperlinkPresenter(SourceViewer viewer) {
- RepositoryTextViewerConfiguration configuration = new RepositoryTextViewerConfiguration(taskRepository, false);
- configuration.setMode(getMode());
-
- // do not configure viewer, this has already been done in extension
-
- AbstractHyperlinkTextPresentationManager manager;
- if (getMode() == Mode.DEFAULT) {
- manager = new HighlightingHyperlinkTextPresentationManager();
- manager.setHyperlinkDetectors(configuration.getDefaultHyperlinkDetectors(viewer, null));
- manager.install(viewer);
-
- manager = new TaskHyperlinkTextPresentationManager();
- manager.setHyperlinkDetectors(configuration.getDefaultHyperlinkDetectors(viewer, Mode.TASK));
- manager.install(viewer);
- } else if (getMode() == Mode.TASK_RELATION) {
- manager = new TaskHyperlinkTextPresentationManager();
- manager.setHyperlinkDetectors(configuration.getDefaultHyperlinkDetectors(viewer, Mode.TASK_RELATION));
- manager.install(viewer);
- }
-
- return configuration;
- }
-
- private SourceViewer configure(final SourceViewer viewer, boolean readOnly) {
- // do this before setting the document to not require invalidating the presentation
- installHyperlinkPresenter(viewer);
-
- Document document = new Document(getValue());
- if (readOnly) {
- viewer.setDocument(document);
- if (extension != null) {
- // setting view source action
- viewer.getControl().setData(ViewSourceHandler.VIEW_SOURCE_ACTION, viewSourceAction);
- viewer.getControl().addFocusListener(new FocusAdapter() {
- @Override
- public void focusGained(FocusEvent e) {
- ViewSourceHandler.setChecked(getViewer() == defaultViewer);
- }
- });
- }
- } else {
- configureAsEditor(viewer, document);
- installListeners(viewer);
- viewer.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- }
-
- // enable cut/copy/paste
- CommonTextSupport.setTextViewer(viewer.getTextWidget(), viewer);
- viewer.setEditable(!readOnly);
- viewer.getTextWidget().setFont(getFont());
- toolkit.adapt(viewer.getControl(), false, false);
-
- return viewer;
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- this.toolkit = toolkit;
-
- int style = this.style;
- if (!isReadOnly() && (style & TasksUiInternal.SWT_NO_SCROLL) == 0) {
- style |= SWT.V_SCROLL;
- }
-
- if (extension != null || renderingEngine != null) {
- editorComposite = new Composite(parent, SWT.NULL);
- editorLayout = new StackLayout() {
- @Override
- protected Point computeSize(Composite composite, int hint, int hint2, boolean flushCache) {
- return topControl.computeSize(hint, hint2, flushCache);
- }
- };
- editorComposite.setLayout(editorLayout);
- setControl(editorComposite);
-
- if (extension != null) {
- if (isReadOnly()) {
- editorViewer = extension.createViewer(taskRepository, editorComposite, style);
- } else {
- editorViewer = extension.createEditor(taskRepository, editorComposite, style);
- editorViewer.getTextWidget().addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- setContext();
- }
-
- public void focusLost(FocusEvent e) {
- unsetContext();
- }
- });
- editorViewer.getTextWidget().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- unsetContext();
- }
- });
- }
- configure(editorViewer, isReadOnly());
- show(editorViewer);
- } else {
- defaultViewer = createDefaultEditor(editorComposite, style);
- configure(defaultViewer, isReadOnly());
- show(defaultViewer);
- }
-
- viewSourceAction.setEnabled(true);
- } else {
- defaultViewer = createDefaultEditor(parent, style);
- configure(defaultViewer, isReadOnly());
- setControl(defaultViewer.getControl());
-
- viewSourceAction.setEnabled(false);
- }
- }
-
- private SourceViewer createDefaultEditor(Composite parent, int styles) {
- SourceViewer defaultEditor = new SourceViewer(parent, null, styles | SWT.WRAP);
-
- RepositoryTextViewerConfiguration viewerConfig = new RepositoryTextViewerConfiguration(taskRepository,
- isSpellCheckingEnabled() && !isReadOnly());
- viewerConfig.setMode(getMode());
- defaultEditor.configure(viewerConfig);
-
- return defaultEditor;
- }
-
- public SourceViewer getDefaultViewer() {
- if (defaultViewer == null) {
- defaultViewer = createDefaultEditor(editorComposite, style);
- configure(defaultViewer, isReadOnly());
-
- // fixed font size
- defaultViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
- // adapt maximize action
- defaultViewer.getControl().setData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION,
- editorViewer.getControl().getData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION));
- // adapt menu to the new viewer
- installMenu(defaultViewer.getControl(), editorViewer.getControl().getMenu());
- }
- return defaultViewer;
- }
-
- private void installMenu(final Control control, Menu menu) {
- if (menu != null) {
- control.setMenu(menu);
- control.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- control.setMenu(null);
- }
- });
- }
- }
-
- private Font getFont() {
- IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
- Font font = themeManager.getCurrentTheme().getFontRegistry().get(CommonThemes.FONT_EDITOR_COMMENT);
- return font;
- }
-
- private SourceViewer getPreviewViewer() {
- if (extension == null) {
- return null;
- }
-
- // construct as needed
- if (previewViewer == null) {
- // previewer should always have a vertical scroll bar if it's editable
- int previewViewerStyle = style;
- if (getEditorViewer() != null) {
- previewViewerStyle |= SWT.V_SCROLL;
- }
- previewViewer = extension.createViewer(taskRepository, editorComposite, previewViewerStyle);
- configure(previewViewer, true);
- // adapt maximize action
- previewViewer.getControl().setData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION,
- editorViewer.getControl().getData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION));
- }
- Document document = new Document(editorViewer.getDocument().get());
- previewViewer.setDocument(document);
- return previewViewer;
- }
-
- public SourceViewer getEditorViewer() {
- return editorViewer;
- }
-
- public SourceViewer getViewer() {
- if (editorLayout == null) {
- return defaultViewer;
- }
- if (defaultViewer != null && editorLayout.topControl == defaultViewer.getControl()) {
- return defaultViewer;
- } else if (previewViewer != null && editorLayout.topControl == previewViewer.getControl()) {
- return previewViewer;
- } else {
- return editorViewer;
- }
- }
-
- private void setContext() {
- if (contextService == null) {
- return;
- }
- if (contextActivation != null) {
- contextService.deactivateContext(contextActivation);
- contextActivation = null;
- }
- if (contextService != null && extension.getEditorContextId() != null) {
- contextActivation = contextService.activateContext(extension.getEditorContextId());
- }
- }
-
- /**
- * Brings <code>viewer</code> to top.
- */
- private void show(SourceViewer viewer) {
- show(viewer.getControl());
- }
-
- /**
- * Brings <code>control</code> to top.
- */
- private void show(Control control) {
- // no extension is available
- if (editorComposite == null) {
- return;
- }
-
- editorLayout.topControl = control;
- if (editorComposite.getParent().getLayout() instanceof FillWidthLayout) {
- ((FillWidthLayout) editorComposite.getParent().getLayout()).flush();
- }
- editorComposite.layout();
- control.setFocus();
- }
-
- public void showDefault() {
- show(getDefaultViewer());
- }
-
- public void showPreview() {
- if (!isReadOnly()) {
- show(getPreviewViewer());
- }
- }
-
- public void showEditor() {
- if (getEditorViewer() != null) {
- show(getEditorViewer());
- } else {
- show(getDefaultViewer());
- }
- }
-
- private void unsetContext() {
- if (contextService == null) {
- return;
- }
- if (contextActivation != null) {
- contextService.deactivateContext(contextActivation);
- contextActivation = null;
- }
- }
-
- public boolean hasPreview() {
- return extension != null && !isReadOnly();
- }
-
- public boolean hasBrowser() {
- return renderingEngine != null;
- }
-
- private BrowserPreviewViewer getBrowserViewer() {
- if (editorComposite == null || renderingEngine == null) {
- return null;
- }
-
- if (browserViewer == null) {
- browserViewer = new BrowserPreviewViewer(getModel().getTaskRepository(), renderingEngine);
- browserViewer.createControl(editorComposite, toolkit);
- }
- return browserViewer;
- }
-
- public AbstractRenderingEngine getRenderingEngine() {
- return renderingEngine;
- }
-
- public void setRenderingEngine(AbstractRenderingEngine renderingEngine) {
- this.renderingEngine = renderingEngine;
- }
-
- public void showBrowser() {
- BrowserPreviewViewer viewer = getBrowserViewer();
- viewer.update(getValue());
- if (viewer != null) {
- show(viewer.getControl());
- }
- }
-
- public IAction getViewSourceAction() {
- return viewSourceAction;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/SingleSelectionAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/SingleSelectionAttributeEditor.java
deleted file mode 100644
index 176c5b92c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/SingleSelectionAttributeEditor.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- */
-public class SingleSelectionAttributeEditor extends AbstractAttributeEditor {
-
- private String[] values;
-
- private CCombo combo;
-
- private boolean ignoreNotification;
-
- private Text text;
-
- public SingleSelectionAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- if (isReadOnly()) {
- text = new Text(parent, SWT.FLAT | SWT.READ_ONLY);
- text.setFont(EditorUtil.TEXT_FONT);
- toolkit.adapt(text, false, false);
- text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
- refresh();
- setControl(text);
- } else {
- combo = new CCombo(parent, SWT.FLAT | SWT.READ_ONLY);
- combo.setVisibleItemCount(10);
- toolkit.adapt(combo, false, false);
- combo.setFont(EditorUtil.TEXT_FONT);
- combo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
-
- refresh();
-
- if (values != null) {
- combo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- if (!ignoreNotification) {
- int index = combo.getSelectionIndex();
- if (index > -1) {
- Assert.isNotNull(values);
- Assert.isLegal(index >= 0 && index <= values.length - 1);
- setValue(values[index]);
- }
- }
- }
- });
- }
-
- setControl(combo);
- }
- }
-
- public String getValue() {
- return getAttributeMapper().getValue(getTaskAttribute());
- }
-
- public String getValueLabel() {
- return getAttributeMapper().getValueLabel(getTaskAttribute());
- }
-
- private void select(String value, String label) {
- if (values != null) {
- for (int i = 0; i < values.length; i++) {
- if (values[i].equals(value)) {
- combo.select(i);
- break;
- }
- }
- } else {
- combo.setText(label);
- }
- }
-
- public void setValue(String value) {
- String oldValue = getAttributeMapper().getValue(getTaskAttribute());
- if (!oldValue.equals(value)) {
- getAttributeMapper().setValue(getTaskAttribute(), value);
- attributeChanged();
- }
- }
-
- void selectDefaultValue() {
- if (combo.getSelectionIndex() == -1 && values.length > 0) {
- combo.select(0);
- setValue(values[0]);
- }
- }
-
- @Override
- public void refresh() {
- try {
- ignoreNotification = true;
- if (text != null) {
- String label = getValueLabel();
- if ("".equals(label)) { //$NON-NLS-1$
- // if set to the empty string the label will use 64px on GTK
- text.setText(" "); //$NON-NLS-1$
- } else {
- text.setText(label);
- }
- } else if (combo != null) {
- combo.removeAll();
- Map<String, String> labelByValue = getAttributeMapper().getOptions(getTaskAttribute());
- if (labelByValue != null) {
- values = labelByValue.keySet().toArray(new String[0]);
- for (String value : values) {
- combo.add(labelByValue.get(value));
- }
- }
- select(getValue(), getValueLabel());
- combo.redraw();
- }
- } finally {
- ignoreNotification = false;
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java
deleted file mode 100644
index 58e3b05a0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentDropListener.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Maarten Meijer - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.io.File;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
-import org.eclipse.mylyn.internal.tasks.core.data.TextTaskAttachmentSource;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizardDialog;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.TransferData;
-
-/**
- * @author Mik Kersten
- * @author Maarten Meijer
- * @author Steffen Pingel
- */
-public class TaskAttachmentDropListener implements DropTargetListener {
-
- private final AbstractTaskEditorPage page;
-
- public TaskAttachmentDropListener(AbstractTaskEditorPage page) {
- this.page = page;
- }
-
- public void dragEnter(DropTargetEvent event) {
- if (event.detail == DND.DROP_DEFAULT) {
- if ((event.operations & DND.DROP_COPY) != 0) {
- event.detail = DND.DROP_COPY;
- } else {
- event.detail = DND.DROP_NONE;
- }
- }
- // will accept text but prefer to have files dropped
- for (TransferData dataType : event.dataTypes) {
- if (FileTransfer.getInstance().isSupportedType(dataType)) {
- event.currentDataType = dataType;
- // files should only be copied
- if (event.detail != DND.DROP_COPY) {
- event.detail = DND.DROP_NONE;
- }
- break;
- }
- }
- }
-
- public void dragOver(DropTargetEvent event) {
- event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
- }
-
- public void dragOperationChanged(DropTargetEvent event) {
- if ((event.detail == DND.DROP_DEFAULT) || (event.operations & DND.DROP_COPY) != 0) {
- event.detail = DND.DROP_COPY;
- } else {
- event.detail = DND.DROP_NONE;
- }
- // allow text to be moved but files should only be copied
- if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
- if (event.detail != DND.DROP_COPY) {
- event.detail = DND.DROP_NONE;
- }
- }
- }
-
- public void dragLeave(DropTargetEvent event) {
- }
-
- public void dropAccept(DropTargetEvent event) {
- }
-
- public void drop(DropTargetEvent event) {
- if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) {
- String text = (String) event.data;
- EditorUtil.openNewAttachmentWizard(page, null, new TextTaskAttachmentSource(text));
- }
- if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
- String[] files = (String[]) event.data;
- if (files.length > 0) {
- File file = new File(files[0]);
- NewAttachmentWizardDialog dialog = EditorUtil.openNewAttachmentWizard(page, null,
- new FileTaskAttachmentSource(file));
- if (files.length > 1) {
- dialog.setMessage(Messages.TaskAttachmentDropListener_Note_that_only_the_first_file_dragged_will_be_attached,
- IMessageProvider.WARNING);
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentEditorInput.java
deleted file mode 100644
index 006b85ea9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentEditorInput.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jeff Pound and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jeff Pound - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IStorageEditorInput;
-
-/**
- * @author Jeff Pound
- * @author Steffen Pingel
- */
-public class TaskAttachmentEditorInput extends PlatformObject implements IStorageEditorInput {
-
- private final ITaskAttachment attachment;
-
- public TaskAttachmentEditorInput(ITaskAttachment attachment) {
- this.attachment = attachment;
- }
-
- public boolean exists() {
- return true;
- }
-
- public ImageDescriptor getImageDescriptor() {
- // ignore
- return null;
- }
-
- public String getName() {
- return attachment.getFileName();
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- return attachment.getUrl();
- }
-
- public IStorage getStorage() throws CoreException {
- return TaskAttachmentStorage.create(attachment);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentStorage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentStorage.java
deleted file mode 100644
index ced37c7f9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskAttachmentStorage.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jeff Pound and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jeff Pound - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Jeff Pound
- * @author Steffen Pingel
- */
-public class TaskAttachmentStorage extends PlatformObject implements IStorage {
-
- private static final String ATTACHMENT_DEFAULT_NAME = "attachment"; //$NON-NLS-1$
-
- private static final String CTYPE_ZIP = "zip"; //$NON-NLS-1$
-
- private static final String CTYPE_OCTET_STREAM = "octet-stream"; //$NON-NLS-1$
-
- private static final String CTYPE_TEXT = "text"; //$NON-NLS-1$
-
- private static final String CTYPE_HTML = "html"; //$NON-NLS-1$
-
- private final TaskRepository taskRepository;
-
- private final ITask task;
-
- private final TaskAttribute attachmentAttribute;
-
- private final String name;
-
- public TaskAttachmentStorage(TaskRepository taskRepository, ITask task, TaskAttribute attachmentAttribute,
- String name) {
- this.taskRepository = taskRepository;
- this.task = task;
- this.attachmentAttribute = attachmentAttribute;
- this.name = name;
- }
-
- public static IStorage create(ITaskAttachment attachment) throws CoreException {
- Assert.isNotNull(attachment);
- TaskAttribute taskAttribute = attachment.getTaskAttribute();
- if (taskAttribute == null) {
- throw new CoreException(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to find attachment: " //$NON-NLS-1$
- + attachment.getUrl()));
- }
- return new TaskAttachmentStorage(attachment.getTaskRepository(), attachment.getTask(), taskAttribute,
- getName(attachment));
- }
-
- private static String getName(ITaskAttachment attachment) {
- String name = attachment.getFileName();
- // if no filename is set, make one up with the proper extension so
- // we can support opening in that filetype's default editor
- if (name == null || "".equals(name)) { //$NON-NLS-1$
- String ctype = attachment.getContentType();
- if (ctype.endsWith(CTYPE_HTML)) {
- name = ATTACHMENT_DEFAULT_NAME + ".html"; //$NON-NLS-1$
- } else if (ctype.startsWith(CTYPE_TEXT)) {
- name = ATTACHMENT_DEFAULT_NAME + ".txt"; //$NON-NLS-1$
- } else if (ctype.endsWith(CTYPE_OCTET_STREAM)) {
- name = ATTACHMENT_DEFAULT_NAME;
- } else if (ctype.endsWith(CTYPE_ZIP)) {
- name = ATTACHMENT_DEFAULT_NAME + "." + CTYPE_ZIP; //$NON-NLS-1$
- } else {
- name = ATTACHMENT_DEFAULT_NAME + "." + ctype.substring(ctype.indexOf("/") + 1); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- // treat .patch files as text files
- if (name.endsWith(".patch")) { //$NON-NLS-1$
- name += ".txt"; //$NON-NLS-1$
- }
- return name;
- }
-
- public InputStream getContents() throws CoreException {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskRepository.getConnectorKind());
- AbstractTaskAttachmentHandler handler = connector.getTaskAttachmentHandler();
- return handler.getContent(taskRepository, task, attachmentAttribute, new NullProgressMonitor());
- }
-
- public IPath getFullPath() {
- // ignore
- return null;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isReadOnly() {
- return true;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java
deleted file mode 100644
index e72a9b0aa..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.ICoolBarManager;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchActionSupport;
-import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchActionSupport.WorkbenchActionCallback;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.AddExistingTaskJob;
-import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskFromSelectionAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenWithBrowserAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ShowInTaskListAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeEditorAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskDeactivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class TaskEditorActionContributor extends MultiPageEditorActionBarContributor implements
- ISelectionChangedListener {
-
- private class EditorPageCallback extends WorkbenchActionCallback {
-
- @Override
- public boolean canPerformAction(String actionId, Control control) {
- IFormPage activePage = getActivePage();
- if (activePage instanceof AbstractTaskEditorPage) {
- AbstractTaskEditorPage page = (AbstractTaskEditorPage) activePage;
- return page.canPerformAction(actionId);
- } else if (activePage != null) {
- WorkbenchActionCallback textSupport = (WorkbenchActionCallback) activePage.getAdapter(WorkbenchActionCallback.class);
- if (textSupport != null) {
- return textSupport.canPerformAction(actionId, control);
- }
- }
- return super.canPerformAction(actionId, control);
- }
-
- @Override
- public void doAction(String actionId, Control control) {
- IFormPage activePage = getActivePage();
- if (activePage instanceof AbstractTaskEditorPage) {
- AbstractTaskEditorPage page = (AbstractTaskEditorPage) activePage;
- page.doAction(actionId);
- return;
- } else if (activePage != null) {
- WorkbenchActionCallback textSupport = (WorkbenchActionCallback) activePage.getAdapter(WorkbenchActionCallback.class);
- if (textSupport != null) {
- textSupport.doAction(actionId, control);
- return;
- }
- }
- super.doAction(actionId, control);
- }
-
- @Override
- public Control getFocusControl() {
- IFormPage page = getActivePage();
- return (page != null) ? EditorUtil.getFocusControl(page) : null;
- }
-
- @Override
- public ISelection getSelection() {
- return TaskEditorActionContributor.this.getSelection();
- }
-
- }
-
- private TaskEditor editor;
-
- private final OpenWithBrowserAction openWithBrowserAction = new OpenWithBrowserAction();
-
- private final CopyTaskDetailsAction copyTaskDetailsAction = new CopyTaskDetailsAction();
-
- private final SynchronizeEditorAction synchronizeEditorAction = new SynchronizeEditorAction();
-
- private final ShowInTaskListAction showInTaskListAction = new ShowInTaskListAction();
-
- private final NewTaskFromSelectionAction newTaskFromSelectionAction = new NewTaskFromSelectionAction();
-
- private final WorkbenchActionSupport actionSupport;
-
- public TaskEditorActionContributor() {
- actionSupport = new WorkbenchActionSupport();
- actionSupport.setCallback(new EditorPageCallback());
- }
-
- public void addClipboardActions(IMenuManager manager) {
- manager.add(actionSupport.getUndoAction());
- manager.add(actionSupport.getRedoAction());
- manager.add(new Separator());
- manager.add(actionSupport.getCutAction());
- manager.add(actionSupport.getCopyAction());
- manager.add(copyTaskDetailsAction);
- manager.add(actionSupport.getPasteAction());
- manager.add(actionSupport.getSelectAllAction());
- manager.add(newTaskFromSelectionAction);
- manager.add(new Separator());
- }
-
- public void contextMenuAboutToShow(IMenuManager mng) {
- IFormPage page = getActivePage();
- boolean addClipboard = (page instanceof TaskPlanningEditor || page instanceof AbstractTaskEditorPage);
- contextMenuAboutToShow(mng, addClipboard);
- }
-
- public void contextMenuAboutToShow(IMenuManager manager, boolean addClipboard) {
- if (editor != null) {
- updateSelectableActions(getSelection());
- }
- if (addClipboard) {
- addClipboardActions(manager);
- }
- if (editor.getTaskEditorInput() == null) {
- final MenuManager subMenuManager = new MenuManager(MessageFormat.format(
- Messages.TaskEditorActionContributor_Add_to_X, TaskListView.LABEL_VIEW));
- List<AbstractTaskCategory> categories = new ArrayList<AbstractTaskCategory>(TasksUiInternal.getTaskList()
- .getCategories());
- Collections.sort(categories);
- for (final AbstractTaskCategory category : categories) {
- if (!(category instanceof UnmatchedTaskContainer)) {//.equals(TasksUiPlugin.getTaskList().getArchiveContainer())) {
- Action action = new Action() {
- @Override
- public void run() {
- moveToCategory(category);
- }
- };
- String text = category.getSummary();
- action.setText(text);
- action.setImageDescriptor(TasksUiImages.CATEGORY);
- subMenuManager.add(action);
- }
- }
- copyTaskDetailsAction.selectionChanged(new StructuredSelection(getSelection()));
- manager.add(subMenuManager);
- } else {
- final ITask task = editor.getTaskEditorInput().getTask();
- if (task != null) {
- // TODO: refactor
- IStructuredSelection selection = new StructuredSelection(task);
- openWithBrowserAction.selectionChanged(selection);
- copyTaskDetailsAction.selectionChanged(selection);
- synchronizeEditorAction.selectionChanged(new StructuredSelection(this.getEditor()));
- showInTaskListAction.selectionChanged(selection);
-
- manager.add(new Separator());
- if (!(task instanceof LocalTask)) {
- manager.add(synchronizeEditorAction);
- }
- String taskUrl = task.getUrl();
- openWithBrowserAction.setEnabled(taskUrl != null && taskUrl.length() > 0);
- manager.add(openWithBrowserAction);
-
- if (task.isActive()) {
- manager.add(new TaskDeactivateAction() {
- @Override
- public void run() {
- super.run(task);
- }
- });
- } else {
- manager.add(new TaskActivateAction() {
- @Override
- public void run() {
-// TasksUiPlugin.getTaskListManager().getTaskActivationHistory().addTask(task);
- super.run(task);
- }
- });
- }
- manager.add(showInTaskListAction);
- manager.add(new Separator());
-
- for (String menuPath : TasksUiPlugin.getDefault().getDynamicMenuMap().keySet()) {
- for (IDynamicSubMenuContributor contributor : TasksUiPlugin.getDefault().getDynamicMenuMap().get(
- menuPath)) {
- if (TaskListView.ID_SEPARATOR_TASKS.equals(menuPath)) {
- List<IRepositoryElement> selectedElements = new ArrayList<IRepositoryElement>();
- selectedElements.add(task);
- MenuManager subMenuManager = contributor.getSubMenuManager(selectedElements);
- if (subMenuManager != null) {
- subMenuManager.setVisible(selectedElements.size() > 0
- && selectedElements.get(0) instanceof ITask);
- manager.add(subMenuManager);
- }
- }
- }
- }
- manager.add(new GroupMarker(TaskListView.ID_SEPARATOR_NAVIGATE));
- manager.add(new Separator());
- manager.add(new GroupMarker(TaskListView.ID_SEPARATOR_OPERATIONS));
- manager.add(new GroupMarker(TaskListView.ID_SEPARATOR_CONTEXT));
- manager.add(new Separator());
- }
- }
- manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- @Override
- public void contributeToCoolBar(ICoolBarManager cbm) {
- }
-
- @Override
- public void contributeToMenu(IMenuManager mm) {
- }
-
- @Override
- public void contributeToStatusLine(IStatusLineManager slm) {
- }
-
- @Override
- public void contributeToToolBar(IToolBarManager tbm) {
- }
-
- public void forceActionsEnabled() {
- actionSupport.forceEditActionsEnabled();
- }
-
- private IFormPage getActivePage() {
- return (editor != null) ? editor.getActivePageInstance() : null;
- }
-
- public TaskEditor getEditor() {
- return editor;
- }
-
- public ISelection getSelection() {
- if (editor != null && editor.getSite().getSelectionProvider() != null) {
- return editor.getSite().getSelectionProvider().getSelection();
- } else {
- return StructuredSelection.EMPTY;
- }
- }
-
- @Override
- public void init(IActionBars bars, IWorkbenchPage page) {
- super.init(bars, page);
- actionSupport.install(bars);
- }
-
- private void moveToCategory(AbstractTaskCategory category) {
- IEditorInput input = getEditor().getEditorInput();
- if (input instanceof TaskEditorInput) {
- TaskEditorInput repositoryTaskEditorInput = (TaskEditorInput) input;
- final IProgressService svc = PlatformUI.getWorkbench().getProgressService();
- final AddExistingTaskJob job = new AddExistingTaskJob(repositoryTaskEditorInput.getTaskRepository(),
- repositoryTaskEditorInput.getTask().getTaskId(), category);
- job.schedule();
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- svc.showInDialog(getEditor().getSite().getShell(), job);
- }
- });
- }
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- actionSupport.selectionChanged(event);
- newTaskFromSelectionAction.selectionChanged(event.getSelection());
- }
-
- @Override
- public void setActiveEditor(IEditorPart activeEditor) {
- if (activeEditor instanceof TaskEditor) {
- this.editor = (TaskEditor) activeEditor;
- updateSelectableActions(getSelection());
- } else {
- this.editor = null;
- }
- }
-
- @Override
- public void setActivePage(IEditorPart activePage) {
- updateSelectableActions(getSelection());
- }
-
- public void updateSelectableActions(ISelection selection) {
- if (editor != null) {
- actionSupport.updateActions(selection);
- newTaskFromSelectionAction.selectionChanged(selection);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java
deleted file mode 100644
index 9ceca76c4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionPart.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * David Green - fix for bug 254806
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.ITaskList;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskContainerComparator;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskOperation;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.TextChangeListener;
-import org.eclipse.swt.custom.TextChangedEvent;
-import org.eclipse.swt.custom.TextChangingEvent;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskEditorActionPart extends AbstractTaskEditorPart {
-
- private static final String KEY_OPERATION = "operation"; //$NON-NLS-1$
-
- public class SelectButtonListener implements ModifyListener, VerifyListener, SelectionListener, FocusListener,
- TextChangeListener {
-
- private final Button button;
-
- public SelectButtonListener(Button button) {
- this.button = button;
- }
-
- public void modifyText(ModifyEvent e) {
- selected();
- }
-
- public void verifyText(VerifyEvent e) {
- selected();
- }
-
- public void widgetSelected(SelectionEvent e) {
- selected();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- selected();
- }
-
- public void focusGained(FocusEvent event) {
- selected();
- }
-
- public void focusLost(FocusEvent e) {
- }
-
- public void textChanged(TextChangedEvent event) {
- selected();
- }
-
- public void textSet(TextChangedEvent event) {
- selected();
- }
-
- public void textChanging(TextChangingEvent event) {
- }
-
- private void selected() {
- setSelectedRadionButton(button, true);
- }
-
- }
-
- private static final int DEFAULT_FIELD_WIDTH = 150;
-
- private static final int RADIO_OPTION_WIDTH = 120;
-
- private static final String KEY_ASSOCIATED_EDITOR = "associatedEditor"; //$NON-NLS-1$
-
- private List<Button> operationButtons;
-
- private Button submitButton;
-
- private Button attachContextButton;
-
- private Button addToCategory;
-
- private CCombo categoryChooser;
-
- private AbstractTaskCategory category;
-
- private TaskAttribute selectedOperationAttribute;
-
- public TaskEditorActionPart() {
- setPartName(Messages.TaskEditorActionPart_Actions);
- }
-
- protected void addAttachContextButton(Composite buttonComposite, FormToolkit toolkit) {
- attachContextButton = toolkit.createButton(buttonComposite, Messages.TaskEditorActionPart_Attach_Context,
- SWT.CHECK);
- attachContextButton.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_ATTACH));
- }
-
- /**
- * Adds buttons to this composite. Subclasses can override this method to provide different/additional buttons.
- *
- * @param buttonComposite
- * Composite to add the buttons to.
- * @param toolkit
- */
- private void createActionButtons(Composite buttonComposite, FormToolkit toolkit) {
- submitButton = toolkit.createButton(buttonComposite, Messages.TaskEditorActionPart_Submit, SWT.NONE);
- GridData submitButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- submitButtonData.widthHint = 100;
- submitButton.setImage(CommonImages.getImage(TasksUiImages.REPOSITORY_SUBMIT));
- submitButton.setLayoutData(submitButtonData);
- submitButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- getTaskEditorPage().doSubmit();
- }
- });
-
- setSubmitEnabled(true);
-
- toolkit.createLabel(buttonComposite, " "); //$NON-NLS-1$
-
- if (!getTaskData().isNew()) {
- addAttachContextButton(buttonComposite, toolkit);
- }
- }
-
- /**
- * Creates the button layout. This displays options and buttons at the bottom of the editor to allow actions to be
- * performed on the bug.
- *
- * @param toolkit
- */
- private void createCategoryChooser(Composite buttonComposite, FormToolkit toolkit) {
- addToCategory = getManagedForm().getToolkit().createButton(buttonComposite,
- Messages.TaskEditorActionPart_Add_to_Category, SWT.CHECK);
- categoryChooser = new CCombo(buttonComposite, SWT.FLAT | SWT.READ_ONLY);
- categoryChooser.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- categoryChooser.setLayoutData(GridDataFactory.swtDefaults().hint(150, SWT.DEFAULT).create());
- toolkit.adapt(categoryChooser, false, false);
- categoryChooser.setFont(TEXT_FONT);
- ITaskList taskList = TasksUiInternal.getTaskList();
- final List<AbstractTaskCategory> categories = new ArrayList<AbstractTaskCategory>(taskList.getCategories());
- Collections.sort(categories, new TaskContainerComparator());
- AbstractTaskCategory selectedCategory = TasksUiInternal.getSelectedCategory(TaskListView.getFromActivePerspective());
- int i = 0;
- int selectedIndex = 0;
- for (IRepositoryElement category : categories) {
- categoryChooser.add(category.getSummary());
- if (category.equals(selectedCategory)) {
- selectedIndex = i;
- }
- i++;
- }
- categoryChooser.select(selectedIndex);
- categoryChooser.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- if (categoryChooser.getSelectionIndex() != -1) {
- category = categories.get(categoryChooser.getSelectionIndex());
- }
- }
- });
- categoryChooser.setEnabled(false);
-
- addToCategory.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- markDirty();
- if (!addToCategory.getSelection()) {
- category = null;
- } else if (categoryChooser.getSelectionIndex() != -1) {
- category = categories.get(categoryChooser.getSelectionIndex());
- }
- categoryChooser.setEnabled(addToCategory.getSelection());
- }
- });
-
- GridDataFactory.fillDefaults().hint(DEFAULT_FIELD_WIDTH, SWT.DEFAULT).span(3, SWT.DEFAULT).applyTo(
- categoryChooser);
- }
-
- public AbstractTaskCategory getCategory() {
- return category;
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- Section section = createSection(parent, toolkit, true);
-
- Composite buttonComposite = toolkit.createComposite(section);
- GridLayout buttonLayout = new GridLayout();
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(buttonComposite);
- buttonLayout.numColumns = 4;
- buttonComposite.setLayout(buttonLayout);
-
- if (getTaskEditorPage().needsAddToCategory()) {
- createCategoryChooser(buttonComposite, toolkit);
- }
-
- selectedOperationAttribute = getTaskData().getRoot().getMappedAttribute(TaskAttribute.OPERATION);
- if (selectedOperationAttribute != null
- && TaskAttribute.TYPE_OPERATION.equals(selectedOperationAttribute.getMetaData().getType())) {
- TaskOperation selectedOperation = getTaskData().getAttributeMapper().getTaskOperation(
- selectedOperationAttribute);
- createRadioButtons(buttonComposite, toolkit, selectedOperation);
- }
-
- createActionButtons(buttonComposite, toolkit);
-
- toolkit.paintBordersFor(buttonComposite);
- section.setClient(buttonComposite);
- setSection(toolkit, section);
- }
-
- private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute, Button button) {
- AbstractAttributeEditor editor = createAttributeEditor(attribute);
- if (editor != null) {
- editor.createControl(composite, toolkit);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 3;
- Control editorControl = editor.getControl();
- if (editorControl instanceof CCombo) {
- // XXX combo boxes are too tall by default and wider than other controls
- gd.heightHint = 20;
- gd.widthHint = RADIO_OPTION_WIDTH;
- } else {
- gd.widthHint = RADIO_OPTION_WIDTH - 5;
- }
- editorControl.setLayoutData(gd);
-
- // the following listeners are hooked up so that changes to something in the actions area
- // will cause the corresponding radio button to become selected. Note that we can't just use
- // a focus listener due to bug 254806
- if (editorControl instanceof CCombo) {
- ((CCombo) editorControl).addSelectionListener(new SelectButtonListener(button));
- } else if (editorControl instanceof Text) {
- ((Text) editorControl).addModifyListener(new SelectButtonListener(button));
- ((Text) editorControl).addVerifyListener(new SelectButtonListener(button));
- } else if (editorControl instanceof StyledText) {
- ((StyledText) editorControl).getContent().addTextChangeListener(new SelectButtonListener(button));
- } else {
- // last resort
- editorControl.addFocusListener(new SelectButtonListener(button));
- }
-
- button.setData(KEY_ASSOCIATED_EDITOR, editor);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
- }
- }
-
- private void createRadioButtons(Composite buttonComposite, FormToolkit toolkit, TaskOperation selectedOperation) {
- List<TaskOperation> operations = getTaskData().getAttributeMapper().getTaskOperations(
- selectedOperationAttribute);
- if (operations.size() > 0) {
- operationButtons = new ArrayList<Button>();
- Button selectedButton = null;
- for (TaskOperation operation : operations) {
- Button button = toolkit.createButton(buttonComposite, operation.getLabel(), SWT.RADIO);
- button.setFont(TEXT_FONT);
- button.setData(KEY_OPERATION, operation);
- GridData radioData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- TaskAttribute associatedAttribute = getTaskData().getAttributeMapper().getAssoctiatedAttribute(
- operation);
- if (associatedAttribute != null) {
- radioData.horizontalSpan = 1;
- addAttribute(buttonComposite, toolkit, associatedAttribute, button);
- } else {
- radioData.horizontalSpan = 4;
- }
- button.setLayoutData(radioData);
- button.addSelectionListener(new SelectButtonListener(button));
- operationButtons.add(button);
- if (operation.equals(selectedOperation)) {
- selectedButton = button;
- }
- }
- // do this last to ensure only a single button is selected
- if (selectedButton == null && !operationButtons.isEmpty()) {
- selectedButton = operationButtons.get(0);
- }
- setSelectedRadionButton(selectedButton, false);
- }
- }
-
- public boolean getAttachContext() {
- if (attachContextButton == null || attachContextButton.isDisposed()) {
- return false;
- } else {
- return attachContextButton.getSelection();
- }
- }
-
-// boolean needsAttachContext() {
-// return needsAttachContext;
-// }
-//
-// void setNeedsAttachContext(boolean attachContextEnabled) {
-// this.needsAttachContext = attachContextEnabled;
-// }
-
- public void setSubmitEnabled(boolean enabled) {
- if (submitButton != null && !submitButton.isDisposed()) {
- submitButton.setEnabled(enabled);
- if (enabled) {
- submitButton.setToolTipText(MessageFormat.format(Messages.TaskEditorActionPart_Submit_to_X,
- getTaskEditorPage().getTaskRepository().getRepositoryUrl()));
- }
- }
- }
-
- private void setSelectedRadionButton(Button selectedButton, boolean updateModel) {
- // avoid changes to the model if the button is already selected
- if (selectedButton.getSelection()) {
- return;
- }
-
- selectedButton.setSelection(true);
- for (Button button : operationButtons) {
- if (button != selectedButton) {
- button.setSelection(false);
- }
- }
-
- if (updateModel) {
- TaskOperation taskOperation = (TaskOperation) selectedButton.getData(KEY_OPERATION);
- getTaskData().getAttributeMapper().setTaskOperation(selectedOperationAttribute, taskOperation);
- getModel().attributeChanged(selectedOperationAttribute);
-
- AbstractAttributeEditor editor = (AbstractAttributeEditor) selectedButton.getData(KEY_ASSOCIATED_EDITOR);
- if (editor instanceof SingleSelectionAttributeEditor) {
- ((SingleSelectionAttributeEditor) editor).selectDefaultValue();
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
deleted file mode 100644
index f9bf86153..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Jeff Pound - attachment support
- * Frank Becker - improvements for bug 204051
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.window.ToolTip;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiMenus;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard.Mode;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.internal.WorkbenchImages;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class TaskEditorAttachmentPart extends AbstractTaskEditorPart {
-
- private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.attachments"; //$NON-NLS-1$
-
- private final String[] attachmentsColumns = { Messages.TaskEditorAttachmentPart_Name,
- Messages.TaskEditorAttachmentPart_Description, /*"Type", */Messages.TaskEditorAttachmentPart_Size,
- Messages.TaskEditorAttachmentPart_Creator, Messages.TaskEditorAttachmentPart_Created };
-
- private final int[] attachmentsColumnWidths = { 130, 150, /*100,*/70, 100, 100 };
-
- private List<TaskAttribute> attachments;
-
- private boolean hasIncoming;
-
- private MenuManager menuManager;
-
- private Composite attachmentsComposite;
-
- public TaskEditorAttachmentPart() {
- setPartName(Messages.TaskEditorAttachmentPart_Attachments);
- }
-
- private void createAttachmentTable(FormToolkit toolkit, final Composite attachmentsComposite) {
- Table attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
- attachmentsTable.setLinesVisible(true);
- attachmentsTable.setHeaderVisible(true);
- attachmentsTable.setLayout(new GridLayout());
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).hint(500, SWT.DEFAULT).applyTo(
- attachmentsTable);
-
- for (int i = 0; i < attachmentsColumns.length; i++) {
- TableColumn column = new TableColumn(attachmentsTable, SWT.LEFT, i);
- column.setText(attachmentsColumns[i]);
- column.setWidth(attachmentsColumnWidths[i]);
- }
- // size column
- attachmentsTable.getColumn(2).setAlignment(SWT.RIGHT);
-
- TableViewer attachmentsViewer = new TableViewer(attachmentsTable);
- attachmentsViewer.setUseHashlookup(true);
- attachmentsViewer.setColumnProperties(attachmentsColumns);
- ColumnViewerToolTipSupport.enableFor(attachmentsViewer, ToolTip.NO_RECREATE);
-
- attachmentsViewer.setSorter(new ViewerSorter() {
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- ITaskAttachment attachment1 = (ITaskAttachment) e1;
- ITaskAttachment attachment2 = (ITaskAttachment) e2;
- Date created1 = attachment1.getCreationDate();
- Date created2 = attachment2.getCreationDate();
- if (created1 != null && created2 != null) {
- return created1.compareTo(created2);
- } else if (created1 == null && created2 != null) {
- return -1;
- } else if (created1 != null && created2 == null) {
- return 1;
- } else {
- return 0;
- }
- }
- });
-
- List<ITaskAttachment> attachmentList = new ArrayList<ITaskAttachment>(attachments.size());
- for (TaskAttribute attribute : attachments) {
- TaskAttachment taskAttachment = new TaskAttachment(getModel().getTaskRepository(), getModel().getTask(),
- attribute);
- getTaskData().getAttributeMapper().updateTaskAttachment(taskAttachment, attribute);
- attachmentList.add(taskAttachment);
- }
- attachmentsViewer.setContentProvider(new ArrayContentProvider());
- attachmentsViewer.setLabelProvider(new AttachmentTableLabelProvider(getModel(),
- getTaskEditorPage().getAttributeEditorToolkit()));
- attachmentsViewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- if (!event.getSelection().isEmpty()) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- ITaskAttachment attachment = (ITaskAttachment) selection.getFirstElement();
- TasksUiUtil.openUrl(attachment.getUrl());
- }
- }
- });
- attachmentsViewer.addSelectionChangedListener(getTaskEditorPage());
- attachmentsViewer.setInput(attachmentList.toArray());
-
- menuManager = new MenuManager();
- menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- TasksUiMenus.fillTaskAttachmentMenu(manager);
- }
- });
- getTaskEditorPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, attachmentsViewer, false);
- Menu menu = menuManager.createContextMenu(attachmentsTable);
- attachmentsTable.setMenu(menu);
- }
-
- private void createButtons(Composite attachmentsComposite, FormToolkit toolkit) {
- final Composite attachmentControlsComposite = toolkit.createComposite(attachmentsComposite);
- attachmentControlsComposite.setLayout(new GridLayout(2, false));
- attachmentControlsComposite.setLayoutData(new GridData(GridData.BEGINNING));
-
- Button attachFileButton = toolkit.createButton(attachmentControlsComposite,
- Messages.TaskEditorAttachmentPart_Attach_, SWT.PUSH);
- attachFileButton.setImage(WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FILE));
- attachFileButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- EditorUtil.openNewAttachmentWizard(getTaskEditorPage(), Mode.DEFAULT, null);
- }
- });
- getTaskEditorPage().registerDefaultDropListener(attachFileButton);
-
- Button attachScreenshotButton = toolkit.createButton(attachmentControlsComposite,
- Messages.TaskEditorAttachmentPart_Attach__Screenshot, SWT.PUSH);
- attachScreenshotButton.setImage(CommonImages.getImage(CommonImages.IMAGE_CAPTURE));
- attachScreenshotButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- EditorUtil.openNewAttachmentWizard(getTaskEditorPage(), Mode.SCREENSHOT, null);
- }
- });
- getTaskEditorPage().registerDefaultDropListener(attachScreenshotButton);
- }
-
- @Override
- public void createControl(Composite parent, final FormToolkit toolkit) {
- initialize();
-
- final Section section = createSection(parent, toolkit, hasIncoming);
- section.setText(getPartName() + " (" + attachments.size() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- if (hasIncoming) {
- expandSection(toolkit, section);
- } else {
- section.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent event) {
- if (attachmentsComposite == null) {
- expandSection(toolkit, section);
- getTaskEditorPage().reflow();
- }
- }
- });
- }
- setSection(toolkit, section);
- }
-
- private void expandSection(FormToolkit toolkit, Section section) {
- attachmentsComposite = toolkit.createComposite(section);
- attachmentsComposite.setLayout(new GridLayout(1, false));
- attachmentsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- getTaskEditorPage().registerDefaultDropListener(section);
-
- if (attachments.size() > 0) {
- createAttachmentTable(toolkit, attachmentsComposite);
- } else {
- Label label = toolkit.createLabel(attachmentsComposite, Messages.TaskEditorAttachmentPart_No_attachments);
- getTaskEditorPage().registerDefaultDropListener(label);
- }
-
- createButtons(attachmentsComposite, toolkit);
-
- section.setClient(attachmentsComposite);
- }
-
- @Override
- public void dispose() {
- if (menuManager != null) {
- menuManager.dispose();
- }
- super.dispose();
- }
-
- private void initialize() {
- attachments = getTaskData().getAttributeMapper().getAttributesByType(getTaskData(),
- TaskAttribute.TYPE_ATTACHMENT);
- for (TaskAttribute attachmentAttribute : attachments) {
- if (getModel().hasIncomingChanges(attachmentAttribute)) {
- hasIncoming = true;
- break;
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttributePart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttributePart.java
deleted file mode 100644
index 1fadf4cb3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttributePart.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskDiffUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.UpdateRepositoryConfigurationAction;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
-import org.eclipse.mylyn.tasks.core.sync.TaskJob;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskEditorAttributePart extends AbstractTaskEditorPart {
-
- private static final int LABEL_WIDTH = 100;
-
- private static final int COLUMN_WIDTH = 140;
-
- private static final int COLUMN_GAP = 5;
-
- private static final int MULTI_COLUMN_WIDTH = COLUMN_WIDTH + 5 + COLUMN_GAP + LABEL_WIDTH + 5 + COLUMN_WIDTH;
-
- private static final int MULTI_ROW_HEIGHT = 55;
-
- private List<AbstractAttributeEditor> attributeEditors;
-
- private boolean hasIncoming;
-
- private Composite attributesComposite;
-
- public TaskEditorAttributePart() {
- setPartName(Messages.TaskEditorAttributePart_Attributes);
- }
-
- private void createAttributeControls(Composite attributesComposite, FormToolkit toolkit, int columnCount) {
- int currentColumn = 1;
- int currentPriority = 0;
- for (AbstractAttributeEditor attributeEditor : attributeEditors) {
- int priority = (attributeEditor.getLayoutHint() != null) ? attributeEditor.getLayoutHint().getPriority()
- : LayoutHint.DEFAULT_PRIORITY;
- if (priority != currentPriority) {
- currentPriority = priority;
- if (currentColumn > 1) {
- while (currentColumn <= columnCount) {
- getManagedForm().getToolkit().createLabel(attributesComposite, ""); //$NON-NLS-1$
- currentColumn++;
- }
- currentColumn = 1;
- }
- }
-
- if (attributeEditor.hasLabel()) {
- attributeEditor.createLabelControl(attributesComposite, toolkit);
- Label label = attributeEditor.getLabelControl();
- String text = label.getText();
- String shortenText = TaskDiffUtil.shortenText(label, text, LABEL_WIDTH);
- label.setText(shortenText);
- if (!text.equals(shortenText)) {
- label.setToolTipText(text);
- }
- GridData gd = GridDataFactory.fillDefaults()
- .align(SWT.RIGHT, SWT.CENTER)
- .hint(LABEL_WIDTH, SWT.DEFAULT)
- .create();
- if (currentColumn > 1) {
- gd.horizontalIndent = COLUMN_GAP;
- gd.widthHint = LABEL_WIDTH + COLUMN_GAP;
- }
- label.setLayoutData(gd);
- currentColumn++;
- }
-
- attributeEditor.createControl(attributesComposite, toolkit);
- LayoutHint layoutHint = attributeEditor.getLayoutHint();
- GridData gd = new GridData(SWT.FILL, SWT.CENTER, false, false);
- if (layoutHint != null
- && !(layoutHint.rowSpan == RowSpan.SINGLE && layoutHint.columnSpan == ColumnSpan.SINGLE)) {
- if (layoutHint.rowSpan == RowSpan.MULTIPLE) {
- gd.heightHint = MULTI_ROW_HEIGHT;
- }
- if (layoutHint.columnSpan == ColumnSpan.SINGLE) {
- gd.widthHint = COLUMN_WIDTH;
- gd.horizontalSpan = 1;
- } else {
- gd.widthHint = MULTI_COLUMN_WIDTH;
- gd.horizontalSpan = columnCount - currentColumn + 1;
- }
- } else {
- gd.widthHint = COLUMN_WIDTH;
- gd.horizontalSpan = 1;
- }
- attributeEditor.getControl().setLayoutData(gd);
-
- getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor);
-
- currentColumn += gd.horizontalSpan;
- currentColumn %= columnCount;
- }
- }
-
- @Override
- public void createControl(Composite parent, final FormToolkit toolkit) {
- initialize();
-
- boolean expand = getTaskData().isNew() || hasIncoming;
- final Section section = createSection(parent, toolkit, expand);
- if (expand) {
- expandSection(toolkit, section);
- } else {
- section.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent event) {
- if (attributesComposite == null) {
- expandSection(toolkit, section);
- getTaskEditorPage().reflow();
- }
- }
- });
- }
- setSection(toolkit, section);
- }
-
- private void expandSection(FormToolkit toolkit, Section section) {
- attributesComposite = toolkit.createComposite(section);
- attributesComposite.addListener(SWT.MouseDown, new Listener() {
- public void handleEvent(Event event) {
- Control focus = event.display.getFocusControl();
- if (focus instanceof Text && ((Text) focus).getEditable() == false) {
- getManagedForm().getForm().setFocus();
- }
- }
- });
-
- GridLayout attributesLayout = new GridLayout();
- attributesLayout.numColumns = 4;
- attributesLayout.horizontalSpacing = 5;
- attributesLayout.verticalSpacing = 6;
- attributesComposite.setLayout(attributesLayout);
-
- GridData attributesData = new GridData(GridData.FILL_BOTH);
- attributesData.horizontalSpan = 1;
- attributesData.grabExcessVerticalSpace = false;
- attributesComposite.setLayoutData(attributesData);
-
- createAttributeControls(attributesComposite, toolkit, attributesLayout.numColumns);
- toolkit.paintBordersFor(attributesComposite);
-
- section.setClient(attributesComposite);
- }
-
- @Override
- protected void fillToolBar(ToolBarManager toolBar) {
- UpdateRepositoryConfigurationAction repositoryConfigRefresh = new UpdateRepositoryConfigurationAction() {
- @Override
- public void run() {
- getTaskEditorPage().showEditorBusy(true);
- final TaskJob job = TasksUiInternal.getJobFactory().createUpdateRepositoryConfigurationJob(
- getTaskEditorPage().getConnector(), getTaskEditorPage().getTaskRepository());
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getTaskEditorPage().showEditorBusy(false);
- if (job.getStatus() != null) {
- getTaskEditorPage().getTaskEditor().setStatus(
- Messages.TaskEditorAttributePart_Updating_of_repository_configuration_failed, Messages.TaskEditorAttributePart_Update_Failed,
- job.getStatus());
- } else {
- getTaskEditorPage().refreshFormContent();
- }
- }
- });
- }
- });
- job.setUser(true);
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- };
-
-// @Override
-// public void performUpdate(TaskRepository repository, AbstractRepositoryConnector connector,
-// IProgressMonitor monitor) {
-// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// getTaskEditorPage().showEditorBusy(true);
-// }
-// });
-// try {
-// super.performUpdate(repository, connector, monitor);
-// AbstractTask task = getTaskEditorPage().getTask();
-// Job job = TasksUi.synchronizeTask(connector, task, true, null);
-// job.join();
-// } catch (InterruptedException e) {
-// // ignore
-// } finally {
-// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// getTaskEditorPage().refreshFormContent();
-// }
-// });
-// }
-// }
- };
- repositoryConfigRefresh.setImageDescriptor(TasksUiImages.REPOSITORY_SYNCHRONIZE_SMALL);
- repositoryConfigRefresh.selectionChanged(new StructuredSelection(getTaskEditorPage().getTaskRepository()));
- repositoryConfigRefresh.setToolTipText(Messages.TaskEditorAttributePart_Refresh_Attributes);
- toolBar.add(repositoryConfigRefresh);
- }
-
- private void initialize() {
- attributeEditors = new ArrayList<AbstractAttributeEditor>();
- hasIncoming = false;
-
- Map<String, TaskAttribute> attributes = getTaskData().getRoot().getAttributes();
- for (TaskAttribute attribute : attributes.values()) {
- TaskAttributeMetaData properties = attribute.getMetaData();
- if (!TaskAttribute.KIND_DEFAULT.equals(properties.getKind())) {
- continue;
- }
-
- AbstractAttributeEditor attributeEditor = createAttributeEditor(attribute);
- if (attributeEditor != null) {
- attributeEditors.add(attributeEditor);
- if (getModel().hasIncomingChanges(attribute)) {
- hasIncoming = true;
- }
- }
- }
-
- Collections.sort(attributeEditors, new Comparator<AbstractAttributeEditor>() {
- public int compare(AbstractAttributeEditor o1, AbstractAttributeEditor o2) {
- int p1 = (o1.getLayoutHint() != null) ? o1.getLayoutHint().getPriority() : LayoutHint.DEFAULT_PRIORITY;
- int p2 = (o2.getLayoutHint() != null) ? o2.getLayoutHint().getPriority() : LayoutHint.DEFAULT_PRIORITY;
- return p1 - p2;
- }
- });
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
deleted file mode 100644
index a0932cd31..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
+++ /dev/null
@@ -1,750 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Jingwen Ou - comment grouping
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.TaskComment;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CommentActionGroup;
-import org.eclipse.mylyn.internal.tasks.ui.editors.CommentGroupStrategy.CommentGroup;
-import org.eclipse.mylyn.internal.tasks.ui.util.SelectionProviderAdapter;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Robert Elves
- * @author Steffen Pingel
- * @author Jingwen Ou
- */
-public class TaskEditorCommentPart extends AbstractTaskEditorPart {
-
- private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.comments"; //$NON-NLS-1$
-
- private class CommentGroupViewer {
-
- private final CommentGroup commentGroup;
-
- private ArrayList<CommentViewer> commentViewers;
-
- private Section groupSection;
-
- private boolean renderedInSubSection;
-
- public CommentGroupViewer(CommentGroup commentGroup) {
- this.commentGroup = commentGroup;
- }
-
- private Composite createCommentViewers(Composite parent, FormToolkit toolkit) {
- Composite composite = toolkit.createComposite(parent);
- GridLayout contentLayout = new GridLayout();
- contentLayout.marginHeight = 0;
- contentLayout.marginWidth = 0;
- composite.setLayout(contentLayout);
-
- List<CommentViewer> viewers = getCommentViewers();
- for (CommentViewer commentViewer : viewers) {
- Control control = commentViewer.createControl(composite, toolkit);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(control);
- }
- return composite;
- }
-
- private Control createControl(final Composite parent, final FormToolkit toolkit) {
- if (renderedInSubSection) {
- return createSection(parent, toolkit);
- } else {
- return createCommentViewers(parent, toolkit);
- }
- }
-
- private Section createSection(final Composite parent, final FormToolkit toolkit) {
- int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
-// if (/*commentGroup.hasIncoming() || */expandAllInProgress) {
-// style |= ExpandableComposite.EXPANDED;
-// }
-
- groupSection = toolkit.createSection(parent, style);
- groupSection.clientVerticalSpacing = 0;
- if (commentGroup.hasIncoming()) {
- groupSection.setBackground(getTaskEditorPage().getAttributeEditorToolkit().getColorIncoming());
- }
- groupSection.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- groupSection.setText(commentGroup.getGroupName() + Messages.TaskEditorCommentPart_0
- + commentGroup.getCommentAttributes().size() + Messages.TaskEditorCommentPart_1);
-
- if (groupSection.isExpanded()) {
- Composite composite = createCommentViewers(groupSection, toolkit);
- groupSection.setClient(composite);
- } else {
- groupSection.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent e) {
- if (commentGroup.hasIncoming()) {
- if (e.getState()) {
- groupSection.setBackground(null);
- } else {
- // only decorate background with incoming color when collapsed, otherwise
- // there is too much decoration in the editor
- groupSection.setBackground(getTaskEditorPage().getAttributeEditorToolkit()
- .getColorIncoming());
- }
- }
- if (groupSection.getClient() == null) {
- try {
- getTaskEditorPage().setReflow(false);
- Composite composite = createCommentViewers(groupSection, toolkit);
- groupSection.setClient(composite);
- } finally {
- getTaskEditorPage().setReflow(true);
- }
- getTaskEditorPage().reflow();
- }
- }
- });
- }
-
- return groupSection;
- }
-
- public List<CommentViewer> getCommentViewers() {
- if (commentViewers != null) {
- return commentViewers;
- }
-
- commentViewers = new ArrayList<CommentViewer>(commentGroup.getCommentAttributes().size());
- for (final TaskAttribute commentAttribute : commentGroup.getCommentAttributes()) {
- CommentViewer commentViewer = new CommentViewer(commentAttribute);
- commentViewers.add(commentViewer);
- }
- return commentViewers;
- }
-
- public boolean isExpanded() {
- if (groupSection != null) {
- return groupSection.isExpanded();
- }
-
- if (commentViewers != null) {
- for (CommentViewer commentViewer : commentViewers) {
- if (commentViewer.isExpanded()) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns true if this group and all comments in it are expanded.
- */
- public boolean isFullyExpanded() {
- if (groupSection != null && !groupSection.isExpanded()) {
- return false;
- }
- if (commentViewers != null) {
- for (CommentViewer commentViewer : commentViewers) {
- if (!commentViewer.isExpanded()) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- public boolean isRenderedInSubSection() {
- return renderedInSubSection;
- }
-
- /**
- * Expands this group and all comments in it.
- */
- public void setExpanded(boolean expanded) {
- if (groupSection != null && groupSection.isExpanded() != expanded) {
- EditorUtil.toggleExpandableComposite(expanded, groupSection);
- }
-
- if (commentViewers != null) {
- for (CommentViewer commentViewer : commentViewers) {
- commentViewer.setExpanded(expanded);
- }
- }
- }
-
- public void setRenderedInSubSection(boolean renderedInSubSection) {
- this.renderedInSubSection = renderedInSubSection;
- }
-
- // private void createToolBar(final FormToolkit toolkit) {
-// if (section == null) {
-// return;
-// }
-//
-// ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-//
-// Action collapseAllAction = new Action("") {
-// @Override
-// public void run() {
-// toggleSection(section, false);
-// }
-// };
-// collapseAllAction.setImageDescriptor(CommonImages.COLLAPSE_ALL_SMALL);
-// collapseAllAction.setToolTipText("Collapse All Current Comments");
-// toolBarManager.add(collapseAllAction);
-//
-// Action expandAllAction = new Action("") {
-// @Override
-// public void run() {
-// toggleSection(section, true);
-// }
-// };
-// expandAllAction.setImageDescriptor(CommonImages.EXPAND_ALL_SMALL);
-// expandAllAction.setToolTipText("Expand All Current Comments");
-// toolBarManager.add(expandAllAction);
-//
-// Composite toolbarComposite = toolkit.createComposite(section);
-// toolbarComposite.setBackground(null);
-// RowLayout rowLayout = new RowLayout();
-// rowLayout.marginTop = 0;
-// rowLayout.marginBottom = 0;
-// rowLayout.marginLeft = 0;
-// rowLayout.marginRight = 0;
-// toolbarComposite.setLayout(rowLayout);
-//
-// toolBarManager.createControl(toolbarComposite);
-// section.setTextClient(toolbarComposite);
-// }
-
- }
-
- private class CommentViewer {
-
- private Composite buttonComposite;
-
- private final TaskAttribute commentAttribute;
-
- private ExpandableComposite commentComposite;
-
- private final TaskComment taskComment;
-
- private AbstractAttributeEditor editor;
-
- public CommentViewer(TaskAttribute commentAttribute) {
- this.commentAttribute = commentAttribute;
- this.taskComment = new TaskComment(getModel().getTaskRepository(), getModel().getTask(), commentAttribute);
- }
-
- public Control createControl(Composite composite, final FormToolkit toolkit) {
- boolean hasIncomingChanges = getModel().hasIncomingChanges(commentAttribute);
- getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute);
- int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
- | ExpandableComposite.COMPACT;
- if (hasIncomingChanges || expandAllInProgress) {
- style |= ExpandableComposite.EXPANDED;
- }
- commentComposite = toolkit.createExpandableComposite(composite, style);
- commentComposite.clientVerticalSpacing = 0;
- commentComposite.setLayout(new GridLayout());
- commentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- commentComposite.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- buttonComposite = createTitle(commentComposite, toolkit);
-
- final Composite commentTextComposite = toolkit.createComposite(commentComposite);
- commentComposite.setClient(commentTextComposite);
- commentTextComposite.setLayout(new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 15, 0,
- 0, 3));
- commentComposite.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent event) {
- expandComment(toolkit, commentTextComposite, event.getState());
- }
- });
- if (hasIncomingChanges) {
- commentComposite.setBackground(getTaskEditorPage().getAttributeEditorToolkit().getColorIncoming());
- }
- if (commentComposite.isExpanded()) {
- expandComment(toolkit, commentTextComposite, true);
- }
-
- // for outline
- EditorUtil.setMarker(commentComposite, commentAttribute.getId());
- return commentComposite;
- }
-
- private Composite createTitle(final ExpandableComposite commentComposite, final FormToolkit toolkit) {
- // always visible
- Composite titleComposite = toolkit.createComposite(commentComposite);
- commentComposite.setTextClient(titleComposite);
- RowLayout rowLayout = new RowLayout();
- rowLayout.pack = true;
- rowLayout.marginLeft = 0;
- rowLayout.marginBottom = 0;
- rowLayout.marginTop = 0;
- EditorUtil.center(rowLayout);
- titleComposite.setLayout(rowLayout);
- titleComposite.setBackground(null);
-
- ImageHyperlink expandCommentHyperlink = createTitleHyperLink(toolkit, titleComposite, taskComment);
- expandCommentHyperlink.setFont(commentComposite.getFont());
- expandCommentHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- EditorUtil.toggleExpandableComposite(!commentComposite.isExpanded(), commentComposite);
- }
- });
-
- // only visible when section is expanded
- final Composite buttonComposite = toolkit.createComposite(titleComposite);
- RowLayout buttonCompLayout = new RowLayout();
- buttonCompLayout.marginBottom = 0;
- buttonCompLayout.marginTop = 0;
- buttonComposite.setLayout(buttonCompLayout);
- buttonComposite.setBackground(null);
- buttonComposite.setVisible(commentComposite.isExpanded());
-
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- ReplyToCommentAction replyAction = new ReplyToCommentAction(this, taskComment);
- replyAction.setImageDescriptor(TasksUiImages.COMMENT_REPLY_SMALL);
- toolBarManager.add(replyAction);
- toolBarManager.createControl(buttonComposite);
-
- return buttonComposite;
- }
-
- private ImageHyperlink createTitleHyperLink(final FormToolkit toolkit, final Composite toolbarComp,
- final ITaskComment taskComment) {
- ImageHyperlink formHyperlink = toolkit.createImageHyperlink(toolbarComp, SWT.NONE);
- formHyperlink.setBackground(null);
- formHyperlink.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- IRepositoryPerson author = taskComment.getAuthor();
- if (author != null
- && author.getPersonId().equalsIgnoreCase(getTaskEditorPage().getTaskRepository().getUserName())) {
- formHyperlink.setImage(CommonImages.getImage(CommonImages.PERSON_ME_NARROW));
- } else {
- formHyperlink.setImage(CommonImages.getImage(CommonImages.PERSON_NARROW));
- }
- StringBuilder sb = new StringBuilder();
- if (taskComment.getNumber() >= 0) {
- sb.append(taskComment.getNumber());
- sb.append(": "); //$NON-NLS-1$
- }
- if (author != null) {
- if (author.getName() != null) {
- sb.append(author.getName());
- formHyperlink.setToolTipText(author.getPersonId());
- } else {
- sb.append(author.getPersonId());
- }
- }
- if (taskComment.getCreationDate() != null) {
- sb.append(", "); //$NON-NLS-1$
- sb.append(EditorUtil.formatDateTime(taskComment.getCreationDate()));
- }
- formHyperlink.setText(sb.toString());
- formHyperlink.setEnabled(true);
- formHyperlink.setUnderlined(false);
- return formHyperlink;
- }
-
- private void expandComment(FormToolkit toolkit, Composite composite, boolean expanded) {
- buttonComposite.setVisible(expanded);
- if (expanded && composite.getData(KEY_EDITOR) == null) {
- // create viewer
- TaskAttribute textAttribute = getTaskData().getAttributeMapper().getAssoctiatedAttribute(
- taskComment.getTaskAttribute());
- editor = createAttributeEditor(textAttribute);
- if (editor != null) {
- editor.setDecorationEnabled(false);
- editor.createControl(composite, toolkit);
- editor.getControl().addMouseListener(new MouseAdapter() {
- @Override
- public void mouseDown(MouseEvent e) {
- getTaskEditorPage().selectionChanged(taskComment);
- }
- });
- composite.setData(KEY_EDITOR, editor);
-
- getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
- getTaskEditorPage().reflow();
- }
- } else if (!expanded && composite.getData(KEY_EDITOR) != null) {
- // dispose viewer
- AbstractAttributeEditor editor = (AbstractAttributeEditor) composite.getData(KEY_EDITOR);
- editor.getControl().setMenu(null);
- editor.getControl().dispose();
- composite.setData(KEY_EDITOR, null);
- getTaskEditorPage().reflow();
- }
- getTaskEditorPage().selectionChanged(taskComment);
- }
-
- public boolean isExpanded() {
- return commentComposite != null && commentComposite.isExpanded();
- }
-
- public void setExpanded(boolean expanded) {
- if (commentComposite != null && commentComposite.isExpanded() != expanded) {
- EditorUtil.toggleExpandableComposite(expanded, commentComposite);
- }
- }
-
- /**
- * Returns the comment viewer.
- *
- * @return null, if the viewer has not been constructed
- */
- public AbstractAttributeEditor getEditor() {
- return editor;
- }
-
- }
-
- private class ReplyToCommentAction extends AbstractReplyToCommentAction implements IMenuCreator {
-
- private final ITaskComment taskComment;
-
- private final CommentViewer commentViewer;
-
- public ReplyToCommentAction(CommentViewer commentViewer, ITaskComment taskComment) {
- super(TaskEditorCommentPart.this.getTaskEditorPage(), taskComment);
- this.commentViewer = commentViewer;
- this.taskComment = taskComment;
- setMenuCreator(this);
- }
-
- @Override
- protected String getReplyText() {
- return taskComment.getText();
- }
-
- public Menu getMenu(Control parent) {
- currentViewer = commentViewer;
- selectionProvider.setSelection(new StructuredSelection(taskComment));
- return commentMenu;
- }
-
- public void dispose() {
- }
-
- public Menu getMenu(Menu parent) {
- selectionProvider.setSelection(new StructuredSelection(taskComment));
- return commentMenu;
- }
-
- }
-
- /** Expandable composites are indented by 6 pixels by default. */
- private static final int INDENT = -6;
-
- private static final String KEY_EDITOR = "viewer"; //$NON-NLS-1$
-
- private List<TaskAttribute> commentAttributes;
-
- private CommentGroupStrategy commentGroupStrategy;
-
- private List<CommentGroupViewer> commentGroupViewers;
-
- private boolean expandAllInProgress;
-
- private boolean hasIncoming;
-
- protected Section section;
-
- private SelectionProviderAdapter selectionProvider;
-
- // XXX: stores a reference to the viewer for which the commentMenu was displayed last
- private CommentViewer currentViewer;
-
- private Menu commentMenu;
-
- private CommentActionGroup actionGroup;
-
- public TaskEditorCommentPart() {
- this.commentGroupStrategy = new CommentGroupStrategy() {
- @Override
- protected boolean hasIncomingChanges(ITaskComment taskComment) {
- return getModel().hasIncomingChanges(taskComment.getTaskAttribute());
- }
- };
- setPartName(Messages.TaskEditorCommentPart_Comments);
- }
-
- private void collapseAllComments() {
- try {
- getTaskEditorPage().setReflow(false);
-
- boolean collapsed = false;
- List<CommentGroupViewer> viewers = getCommentGroupViewers();
- for (int i = 0; i < viewers.size(); i++) {
- if (viewers.get(i).isExpanded()) {
- viewers.get(i).setExpanded(false);
- collapsed = viewers.get(i).isRenderedInSubSection();
- break;
- }
- }
-
- if (!collapsed && section != null) {
- EditorUtil.toggleExpandableComposite(false, section);
- }
- } finally {
- getTaskEditorPage().setReflow(true);
- }
- getTaskEditorPage().reflow();
- }
-
- private TaskComment convertToTaskComment(TaskDataModel taskDataModel, TaskAttribute commentAttribute) {
- TaskComment taskComment = new TaskComment(taskDataModel.getTaskRepository(), taskDataModel.getTask(),
- commentAttribute);
- taskDataModel.getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute);
- return taskComment;
- }
-
- @Override
- public void createControl(Composite parent, final FormToolkit toolkit) {
- initialize();
-
- selectionProvider = new SelectionProviderAdapter();
- actionGroup = new CommentActionGroup();
-
- MenuManager menuManager = new MenuManager();
- menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- // get comment and add reply action as first item in the menu
- ISelection selection = selectionProvider.getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof ITaskComment) {
- final ITaskComment comment = (ITaskComment) element;
- AbstractReplyToCommentAction replyAction = new AbstractReplyToCommentAction(
- getTaskEditorPage(), comment) {
- @Override
- protected String getReplyText() {
- return comment.getText();
- }
- };
- manager.add(replyAction);
- }
- }
- actionGroup.fillContextMenu(manager);
- actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
-
- if (currentViewer != null && currentViewer.getEditor() instanceof RichTextAttributeEditor) {
- RichTextAttributeEditor editor = (RichTextAttributeEditor) currentViewer.getEditor();
- if (editor.getViewSourceAction().isEnabled()) {
- manager.add(new Separator("planning")); //$NON-NLS-1$
- manager.add(editor.getViewSourceAction());
- }
- }
- }
- });
- getTaskEditorPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, selectionProvider, false);
- commentMenu = menuManager.createContextMenu(parent);
-
- section = createSection(parent, toolkit, hasIncoming);
- section.setText(section.getText() + " (" + commentAttributes.size() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (commentAttributes.isEmpty()) {
- section.setEnabled(false);
- } else {
- if (hasIncoming) {
- expandSection(toolkit, section);
- } else {
- section.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent event) {
- if (section.getClient() == null) {
- try {
- getTaskEditorPage().setReflow(false);
- expandSection(toolkit, section);
- } finally {
- getTaskEditorPage().setReflow(true);
- }
- getTaskEditorPage().reflow();
- }
- }
- });
- }
- }
- setSection(toolkit, section);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- if (actionGroup != null) {
- actionGroup.dispose();
- }
- }
-
- private void expandAllComments() {
- try {
- expandAllInProgress = true;
- getTaskEditorPage().setReflow(false);
-
- if (section != null) {
- // the expandAllInProgress flag will ensure that comments in top-level groups have been
- // expanded, no need to expand groups explicitly
- boolean expandGroups = section.getClient() != null;
-
- EditorUtil.toggleExpandableComposite(true, section);
-
- if (expandGroups) {
- List<CommentGroupViewer> viewers = getCommentGroupViewers();
- for (int i = viewers.size() - 1; i >= 0; i--) {
- if (!viewers.get(i).isFullyExpanded()) {
- viewers.get(i).setExpanded(true);
- break;
- }
- }
- }
- }
- } finally {
- expandAllInProgress = false;
- getTaskEditorPage().setReflow(true);
- }
- getTaskEditorPage().reflow();
- }
-
- private void expandSection(final FormToolkit toolkit, final Section section) {
- Composite composite = toolkit.createComposite(section);
- section.setClient(composite);
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- List<CommentGroupViewer> viewers = getCommentGroupViewers();
- for (CommentGroupViewer viewer : viewers) {
- Control control = viewer.createControl(composite, toolkit);
- if (viewer.isRenderedInSubSection()) {
- // align twistie of sub-section with section
- GridDataFactory.fillDefaults().grab(true, false).indent(2 * INDENT, 0).applyTo(control);
- } else {
- GridDataFactory.fillDefaults().grab(true, false).indent(INDENT, 0).applyTo(control);
- }
- }
- }
-
- @Override
- protected void fillToolBar(ToolBarManager barManager) {
- if (commentAttributes.isEmpty()) {
- return;
- }
-
- Action collapseAllAction = new Action("") { //$NON-NLS-1$
- @Override
- public void run() {
- collapseAllComments();
- }
- };
- collapseAllAction.setImageDescriptor(CommonImages.COLLAPSE_ALL_SMALL);
- collapseAllAction.setToolTipText(Messages.TaskEditorCommentPart_Collapse_Comments);
- barManager.add(collapseAllAction);
-
- Action expandAllAction = new Action("") { //$NON-NLS-1$
- @Override
- public void run() {
- expandAllComments();
- }
- };
- expandAllAction.setImageDescriptor(CommonImages.EXPAND_ALL_SMALL);
- expandAllAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Comments);
- barManager.add(expandAllAction);
- }
-
- public CommentGroupStrategy getCommentGroupStrategy() {
- return commentGroupStrategy;
- }
-
- public void setCommentGroupStrategy(CommentGroupStrategy commentGroupStrategy) {
- this.commentGroupStrategy = commentGroupStrategy;
- }
-
- private List<CommentGroupViewer> getCommentGroupViewers() {
- if (commentGroupViewers != null) {
- return commentGroupViewers;
- }
-
- // group comments
- List<ITaskComment> comments = new ArrayList<ITaskComment>();
- for (TaskAttribute commentAttribute : this.commentAttributes) {
- comments.add(convertToTaskComment(getModel(), commentAttribute));
- }
- String currentPersonId = getModel().getTaskRepository().getUserName();
- List<CommentGroup> commentGroups = getCommentGroupStrategy().groupComments(comments, currentPersonId);
-
- commentGroupViewers = new ArrayList<CommentGroupViewer>(commentGroups.size());
- if (commentGroups.size() > 0) {
- for (int i = 0; i < commentGroups.size(); i++) {
- CommentGroupViewer viewer = new CommentGroupViewer(commentGroups.get(i));
- boolean isLastGroup = i == commentGroups.size() - 1;
- viewer.setRenderedInSubSection(!isLastGroup);
- commentGroupViewers.add(viewer);
- }
- }
- return commentGroupViewers;
- }
-
- private void initialize() {
- commentAttributes = getTaskData().getAttributeMapper().getAttributesByType(getTaskData(),
- TaskAttribute.TYPE_COMMENT);
- if (commentAttributes.size() > 0) {
- for (TaskAttribute commentAttribute : commentAttributes) {
- if (getModel().hasIncomingChanges(commentAttribute)) {
- hasIncoming = true;
- break;
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorDescriptionPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorDescriptionPart.java
deleted file mode 100644
index e7cd85ca6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorDescriptionPart.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.search.SearchHitCollector;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskEditorDescriptionPart extends TaskEditorRichTextPart {
-
- public TaskEditorDescriptionPart() {
- setPartName(Messages.TaskEditorDescriptionPart_Description);
- }
-
- private void addDuplicateDetection(Composite composite, FormToolkit toolkit) {
- List<AbstractDuplicateDetector> allCollectors = new ArrayList<AbstractDuplicateDetector>();
- if (getDuplicateSearchCollectorsList() != null) {
- allCollectors.addAll(getDuplicateSearchCollectorsList());
- }
- if (!allCollectors.isEmpty()) {
- int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
- if (getTaskData().isNew()) {
- style |= ExpandableComposite.EXPANDED;
- }
- Section duplicatesSection = toolkit.createSection(composite, style);
- duplicatesSection.setText(Messages.TaskEditorDescriptionPart_Duplicate_Detection);
- duplicatesSection.setLayout(new GridLayout());
- GridDataFactory.fillDefaults().indent(SWT.DEFAULT, 15).applyTo(duplicatesSection);
- Composite relatedBugsComposite = toolkit.createComposite(duplicatesSection);
- relatedBugsComposite.setLayout(new GridLayout(4, false));
- relatedBugsComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- duplicatesSection.setClient(relatedBugsComposite);
- Label duplicateDetectorLabel = new Label(relatedBugsComposite, SWT.LEFT);
- duplicateDetectorLabel.setText(Messages.TaskEditorDescriptionPart_Detector);
-
- final CCombo duplicateDetectorChooser = new CCombo(relatedBugsComposite, SWT.FLAT | SWT.READ_ONLY);
- toolkit.adapt(duplicateDetectorChooser, false, false);
- duplicateDetectorChooser.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- duplicateDetectorChooser.setFont(TEXT_FONT);
- duplicateDetectorChooser.setLayoutData(GridDataFactory.swtDefaults().hint(150, SWT.DEFAULT).create());
-
- Collections.sort(allCollectors, new Comparator<AbstractDuplicateDetector>() {
-
- public int compare(AbstractDuplicateDetector c1, AbstractDuplicateDetector c2) {
- return c1.getName().compareToIgnoreCase(c2.getName());
- }
-
- });
-
- for (AbstractDuplicateDetector detector : allCollectors) {
- duplicateDetectorChooser.add(detector.getName());
- }
-
- duplicateDetectorChooser.select(0);
- duplicateDetectorChooser.setEnabled(true);
- duplicateDetectorChooser.setData(allCollectors);
-
- if (allCollectors.size() > 0) {
- Button searchForDuplicates = toolkit.createButton(relatedBugsComposite,
- Messages.TaskEditorDescriptionPart_Search, SWT.NONE);
- GridData searchDuplicatesButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- searchForDuplicates.setLayoutData(searchDuplicatesButtonData);
- searchForDuplicates.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- String selectedDetector = duplicateDetectorChooser.getItem(duplicateDetectorChooser.getSelectionIndex());
- searchForDuplicates(selectedDetector);
- }
- });
- }
-
- toolkit.paintBordersFor(relatedBugsComposite);
- }
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- if (getAttribute() == null) {
- return;
- }
-
- super.createControl(parent, toolkit);
- addDuplicateDetection(getComposite(), toolkit);
- }
-
- @Override
- protected void fillToolBar(ToolBarManager toolBar) {
- if (!getTaskData().isNew()) {
- AbstractReplyToCommentAction replyAction = new AbstractReplyToCommentAction(getTaskEditorPage(), null) {
- @Override
- protected String getReplyText() {
- return getEditor().getValue();
- }
- };
- replyAction.setImageDescriptor(TasksUiImages.COMMENT_REPLY_SMALL);
- toolBar.add(replyAction);
- }
- super.fillToolBar(toolBar);
- }
-
- protected IRepositoryQuery getDuplicateQuery(String name) throws CoreException {
- String duplicateDetectorName = name.equals("default") ? "Stack Trace" : name; //$NON-NLS-1$ //$NON-NLS-2$
- for (AbstractDuplicateDetector detector : getDuplicateSearchCollectorsList()) {
- if (detector.getName().equals(duplicateDetectorName)) {
- return detector.getDuplicatesQuery(getTaskEditorPage().getTaskRepository(), getTaskData());
- }
- }
- return null;
- }
-
- protected Set<AbstractDuplicateDetector> getDuplicateSearchCollectorsList() {
- Set<AbstractDuplicateDetector> duplicateDetectors = new HashSet<AbstractDuplicateDetector>();
- for (AbstractDuplicateDetector detector : TasksUiPlugin.getDefault().getDuplicateSearchCollectorsList()) {
- if (isValidDuplicateDetector(detector)) {
- duplicateDetectors.add(detector);
- }
- }
- return duplicateDetectors;
- }
-
- @Override
- public void initialize(AbstractTaskEditorPage taskEditorPage) {
- super.initialize(taskEditorPage);
- setAttribute(getModel().getTaskData().getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION));
- }
-
- private boolean isValidDuplicateDetector(AbstractDuplicateDetector detector) {
- return (detector.getConnectorKind() == null || detector.getConnectorKind().equals(
- getTaskEditorPage().getConnectorKind())) //
- && detector.canQuery(getTaskData());
- }
-
- public void searchForDuplicates(String duplicateDetectorName) {
- try {
- IRepositoryQuery duplicatesQuery = getDuplicateQuery(duplicateDetectorName);
- if (duplicatesQuery != null) {
- SearchHitCollector collector = new SearchHitCollector(TasksUiInternal.getTaskList(),
- getTaskEditorPage().getTaskRepository(), duplicatesQuery);
- NewSearchUI.runQueryInBackground(collector);
- } else {
- TasksUiInternal.displayStatus(Messages.TaskEditorDescriptionPart_Duplicate_Detection_Failed,
- new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.TaskEditorDescriptionPart_The_duplicate_detector_did_not_return_a_valid_query));
- }
- } catch (CoreException e) {
- TasksUiInternal.displayStatus(Messages.TaskEditorDescriptionPart_Duplicate_Detection_Failed, e.getStatus());
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionReader.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionReader.java
deleted file mode 100644
index 3b109a63a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionReader.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
-
-/**
- * @author David Green
- */
-public class TaskEditorExtensionReader {
-
- private static final String CONNECTOR_KIND = "connectorKind"; //$NON-NLS-1$
-
- public static final String ATTR_ID = "id"; //$NON-NLS-1$
-
- public static final String ATTR_NAME = "name"; //$NON-NLS-1$
-
- public static final String EXTENSION_TASK_EDITOR_EXTENSIONS = "org.eclipse.mylyn.tasks.ui.taskEditorExtensions"; //$NON-NLS-1$
-
- private static final String REPOSITORY_ASSOCIATION = "repositoryAssociation"; //$NON-NLS-1$
-
- private static final String TASK_EDITOR_EXTENSION = "taskEditorExtension"; //$NON-NLS-1$
-
- public static void initExtensions() {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- IExtensionPoint editorExtensionPoint = registry.getExtensionPoint(EXTENSION_TASK_EDITOR_EXTENSIONS);
- IExtension[] editorExtensions = editorExtensionPoint.getExtensions();
- for (IExtension extension : editorExtensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(TASK_EDITOR_EXTENSION)) {
- readEditorExtension(element);
- } else if (element.getName().equals(REPOSITORY_ASSOCIATION)) {
- readEditorExtensionAssociation(element);
- }
- }
- }
- }
-
- private static void readEditorExtension(IConfigurationElement element) {
- try {
- String id = element.getAttribute(ATTR_ID);
- String name = element.getAttribute(ATTR_NAME);
- AbstractTaskEditorExtension extension = (AbstractTaskEditorExtension) element.createExecutableExtension("class"); //$NON-NLS-1$
- TaskEditorExtensions.addTaskEditorExtension(id, name, extension);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load taskEditorExtension", //$NON-NLS-1$
- e));
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load taskEditorExtension", //$NON-NLS-1$
- e));
- }
- }
-
- private static void readEditorExtensionAssociation(IConfigurationElement element) {
- try {
- String repository = element.getAttribute(CONNECTOR_KIND);
- String taskEditorExtension = element.getAttribute(TASK_EDITOR_EXTENSION);
- TaskEditorExtensions.addRepositoryAssociation(repository, taskEditorExtension);
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load repositoryAssociation", e)); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionSettingsContribution.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionSettingsContribution.java
deleted file mode 100644
index e6f5a4d00..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensionSettingsContribution.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.SortedSet;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions.RegisteredTaskEditorExtension;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractTaskRepositoryPageContribution;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * A contribution that adds a section for 'Editor' on the task repository settings page.
- *
- * @author David Green
- */
-public class TaskEditorExtensionSettingsContribution extends AbstractTaskRepositoryPageContribution {
-
- private static final String LABEL_NONE = Messages.TaskEditorExtensionSettingsContribution_Plain_Text;
-
- private static final String LABEL_DEFAULT_SUFFIX = Messages.TaskEditorExtensionSettingsContribution__default_;
-
- private static final String DATA_EDITOR_EXTENSION = "editorExtension"; //$NON-NLS-1$
-
- private final SelectionListener listener = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- selectedExtensionId = (String) ((Widget) e.getSource()).getData(DATA_EDITOR_EXTENSION);
- fireValidationRequired();
- }
- };
-
- private String selectedExtensionId;
-
- public TaskEditorExtensionSettingsContribution() {
- super(Messages.TaskEditorExtensionSettingsContribution_Editor,
- Messages.TaskEditorExtensionSettingsContribution_Select_the_capabilities_of_the_task_editor);
- }
-
- @Override
- public void applyTo(TaskRepository repository) {
- TaskEditorExtensions.setTaskEditorExtensionId(repository, selectedExtensionId == null ? "none" //$NON-NLS-1$
- : selectedExtensionId);
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return true;
- }
-
- @Override
- public boolean isPageComplete() {
- return true;
- }
-
- @Override
- public Control createControl(Composite parentControl) {
- Composite parent = new Composite(parentControl, SWT.NONE);
- GridLayout layout = new GridLayout(1, true);
- layout.marginWidth = 0;
- parent.setLayout(layout);
-
- String defaultExtensionId = TaskEditorExtensions.getDefaultTaskEditorExtensionId(getConnectorKind());
- selectedExtensionId = getRepository() == null ? defaultExtensionId
- : TaskEditorExtensions.getTaskEditorExtensionId(getRepository());
-
- // configure a 'Plain Text' (none) button
- Button noneButton = new Button(parent, SWT.RADIO);
- String noneTitle = LABEL_NONE;
- boolean isDefault = defaultExtensionId == null || defaultExtensionId.length() == 0;
- if (isDefault) {
- noneTitle += LABEL_DEFAULT_SUFFIX;
- }
- noneButton.setText(noneTitle);
- noneButton.addSelectionListener(listener);
-
- boolean foundSelection = false;
-
- // now add selection buttons for all registered extensions
- SortedSet<RegisteredTaskEditorExtension> allEditorExtensions = TaskEditorExtensions.getTaskEditorExtensions();
- for (RegisteredTaskEditorExtension editorExtension : allEditorExtensions) {
- String name = editorExtension.getName();
- isDefault = editorExtension.getId().equals(defaultExtensionId);
- if (isDefault) {
- name += LABEL_DEFAULT_SUFFIX;
- }
- Button button = new Button(parent, SWT.RADIO);
- button.setText(name);
-
- if (editorExtension.getId().equals(selectedExtensionId)) {
- foundSelection = true;
- button.setSelection(true);
- }
- button.setText(name);
- button.setData(DATA_EDITOR_EXTENSION, editorExtension.getId());
- button.addSelectionListener(listener);
- }
- if (!foundSelection) {
- noneButton.setSelection(true);
- }
- return parent;
- }
-
- @Override
- public IStatus validate() {
- // nothing to validate
- return null;
- }
-
- /**
- * only enabled when there are installed/registered task editor extensions.
- */
- @Override
- public boolean isEnabled() {
- return !TaskEditorExtensions.getTaskEditorExtensions().isEmpty();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensions.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensions.java
deleted file mode 100644
index 5446198c3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensions.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
-
-/**
- * @author David Green
- */
-public class TaskEditorExtensions {
-
- public static final String REPOSITORY_PROPERTY_EDITOR_EXTENSION = "editorExtension"; //$NON-NLS-1$
-
- private static Map<String, RegisteredTaskEditorExtension> extensionsById = new HashMap<String, RegisteredTaskEditorExtension>();
-
- private static Map<String, String> associationByConnectorKind = new HashMap<String, String>();
-
- private static boolean initialized;
-
- public static SortedSet<RegisteredTaskEditorExtension> getTaskEditorExtensions() {
- init();
- return new TreeSet<RegisteredTaskEditorExtension>(extensionsById.values());
- }
-
- public static void addTaskEditorExtension(String id, String name, AbstractTaskEditorExtension extension) {
- Assert.isNotNull(id);
- RegisteredTaskEditorExtension previous = extensionsById.put(id, new RegisteredTaskEditorExtension(extension,
- id, name));
- if (previous != null) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Duplicate taskEditorExtension id=" //$NON-NLS-1$
- + id, null));
- }
- }
-
- public static void addRepositoryAssociation(String connectorKind, String extensionId) {
- if (connectorKind == null || extensionId == null) {
- throw new IllegalArgumentException();
- }
- String previous = associationByConnectorKind.put(connectorKind, extensionId);
- if (previous != null) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, String.format(
- "Duplicate association for repository %s: %s replaces %s", connectorKind, extensionId, previous), //$NON-NLS-1$
- null));
- }
- }
-
- /**
- * get a task editor extension for a specific repository
- *
- * @param taskRepository
- * @return the extension, or null if there is none
- *
- * @see #getDefaultTaskEditorExtension(TaskRepository)
- */
- public static AbstractTaskEditorExtension getTaskEditorExtension(TaskRepository taskRepository) {
- init();
- String extensionId = getTaskEditorExtensionId(taskRepository);
- if (extensionId != null) {
- RegisteredTaskEditorExtension taskEditorExtension = extensionsById.get(extensionId);
- return taskEditorExtension == null ? null : taskEditorExtension.getExtension();
- }
- return null;
- }
-
- public static String getTaskEditorExtensionId(TaskRepository taskRepository) {
- init();
- String id = taskRepository.getProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION);
- if (id == null) {
- id = getDefaultTaskEditorExtensionId(taskRepository);
- }
- return id;
- }
-
- public static void setTaskEditorExtensionId(TaskRepository repository, String editorExtensionId) {
- repository.setProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION, editorExtensionId);
- }
-
- /**
- * Get the default task editor extension id for the given task repository
- *
- * @param taskRepository
- * @return the default task editor extension id or null if there is no default
- */
- public static String getDefaultTaskEditorExtensionId(TaskRepository taskRepository) {
- return getDefaultTaskEditorExtensionId(taskRepository.getConnectorKind());
- }
-
- /**
- * Get the default task editor extension id for the given kind of connector
- *
- * @param connectorKind
- * the kind of connector
- *
- * @return the default task editor extension id or null if there is no default
- */
- public static String getDefaultTaskEditorExtensionId(String connectorKind) {
- init();
- return associationByConnectorKind.get(connectorKind);
- }
-
- /**
- * get a default task editor extension for a specific repository
- *
- * @param taskRepository
- * @return the extension, or null if there is none
- *
- * @see #getTaskEditorExtension(TaskRepository)
- */
- public static AbstractTaskEditorExtension getDefaultTaskEditorExtension(TaskRepository taskRepository) {
- init();
- String extensionId = getDefaultTaskEditorExtensionId(taskRepository);
- if (extensionId != null) {
- RegisteredTaskEditorExtension taskEditorExtension = extensionsById.get(extensionId);
- return taskEditorExtension == null ? null : taskEditorExtension.getExtension();
- }
- return null;
- }
-
- private static void init() {
- if (!initialized) {
- initialized = true;
- TaskEditorExtensionReader.initExtensions();
- }
- }
-
- public static class RegisteredTaskEditorExtension implements Comparable<RegisteredTaskEditorExtension> {
-
- private final String id;
-
- private final String name;
-
- private final AbstractTaskEditorExtension extension;
-
- private RegisteredTaskEditorExtension(AbstractTaskEditorExtension extension, String id, String name) {
- this.extension = extension;
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public AbstractTaskEditorExtension getExtension() {
- return extension;
- }
-
- public int compareTo(RegisteredTaskEditorExtension o) {
- if (o == this) {
- return 0;
- }
- int i = name.compareTo(o.name);
- if (i == 0) {
- i = id.compareTo(o.id);
- }
- return i;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorInputFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorInputFactory.java
deleted file mode 100644
index 4d44e4b19..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorInputFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-
-/**
- * @author Rob Elves
- */
-public class TaskEditorInputFactory implements IElementFactory {
-
- public static final String TAG_TASK_HANDLE = "taskHandle"; //$NON-NLS-1$
-
- public static final String ID_FACTORY = "org.eclipse.mylyn.tasks.ui.elementFactories.task.editor"; //$NON-NLS-1$
-
- public IAdaptable createElement(IMemento memento) {
- String handle = memento.getString(TAG_TASK_HANDLE);
- AbstractTask task = TasksUiPlugin.getTaskList().getTask(handle);
- if (task != null) {
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- if (taskRepository != null) {
- return new TaskEditorInput(taskRepository, task);
- } else {
- StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, "Repository for connector kind " //$NON-NLS-1$
- + task.getConnectorKind() + " with url " + task.getRepositoryUrl() + " cannont be found.")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- "Failed to restore task editor: Task with handle \"" + handle //$NON-NLS-1$
- + "\" could not be found in task list.")); //$NON-NLS-1$
- }
- return null;
- }
-
- public static void saveState(IMemento memento, TaskEditorInput input) {
- if (input.getTask() != null) {
- memento.putString(TAG_TASK_HANDLE, input.getTask().getHandleIdentifier());
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNewCommentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNewCommentPart.java
deleted file mode 100644
index 0def5c59a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNewCommentPart.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskEditorNewCommentPart extends TaskEditorRichTextPart {
-
- public TaskEditorNewCommentPart() {
- setPartName(Messages.TaskEditorNewCommentPart_New_Comment);
- setSectionStyle(ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
- setExpandVertically(true);
- }
-
- @Override
- public void initialize(AbstractTaskEditorPage taskEditorPage) {
- super.initialize(taskEditorPage);
- setAttribute(getModel().getTaskData().getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW));
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNotesPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNotesPart.java
deleted file mode 100644
index 368a43542..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorNotesPart.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.internal.EditorAreaHelper;
-import org.eclipse.ui.internal.WorkbenchPage;
-
-/**
- * @author Shawn Minto
- * @author Steffen Pingel
- */
-public class TaskEditorNotesPart extends AbstractTaskEditorPart {
-
- private String value;
-
- private AbstractTask task;
-
- private SourceViewer noteEditor;
-
- public TaskEditorNotesPart() {
- setPartName(Messages.TaskPlanningEditor_Notes);
- }
-
- @Override
- public void initialize(AbstractTaskEditorPage taskEditorPage) {
- super.initialize(taskEditorPage);
- task = (AbstractTask) taskEditorPage.getTask();
- }
-
- private boolean notesEqual() {
- if (task.getNotes() == null && value == null) {
- return true;
- }
-
- if (task.getNotes() != null && value != null) {
- return task.getNotes().equals(value);
- }
- return false;
- }
-
- @Override
- public void commit(boolean onSave) {
- Assert.isNotNull(task);
-
- if (!notesEqual()) {
- task.setNotes(value);
- // XXX REFRESH THE TASLKIST
- }
-
- super.commit(onSave);
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- this.value = task.getNotes();
- if (this.value == null) {
- this.value = ""; //$NON-NLS-1$
- }
-
- Section section = createSection(parent, toolkit, this.value != null && this.value.length() > 0);
-
- Composite composite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
-
- noteEditor = new SourceViewer(parent, null, SWT.FLAT | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
- noteEditor.configure(new RepositoryTextViewerConfiguration(getModel().getTaskRepository(), true));
- CommonTextSupport textSupport = (CommonTextSupport) getTaskEditorPage().getAdapter(CommonTextSupport.class);
- if (textSupport != null) {
- textSupport.configure(noteEditor, new Document(this.value), true);
- }
- noteEditor.addTextListener(new ITextListener() {
- public void textChanged(TextEvent event) {
- TaskEditorNotesPart.this.value = noteEditor.getTextWidget().getText();
- markDirty();
- }
- });
-
- final GridData gd = new GridData(GridData.FILL_BOTH);
- int widthHint = 0;
-
- if (getManagedForm() != null && getManagedForm().getForm() != null) {
- widthHint = getManagedForm().getForm().getClientArea().width - 90;
- }
- if (widthHint <= 0 && getTaskEditorPage().getEditor().getEditorSite() != null
- && getTaskEditorPage().getEditor().getEditorSite().getPage() != null) {
- EditorAreaHelper editorManager = ((WorkbenchPage) getTaskEditorPage().getEditor().getEditorSite().getPage()).getEditorPresentation();
- if (editorManager != null && editorManager.getLayoutPart() != null) {
- widthHint = editorManager.getLayoutPart().getControl().getBounds().width - 90;
- }
- }
-
- if (widthHint <= 0) {
- widthHint = 100;
- }
-
- gd.widthHint = widthHint;
- gd.minimumHeight = 100;
- gd.grabExcessHorizontalSpace = true;
-
- noteEditor.getControl().setLayoutData(gd);
- noteEditor.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- noteEditor.setEditable(true);
-
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
- setSection(toolkit, section);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java
deleted file mode 100644
index a3ada9523..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * A node for the tree in {@link TaskEditorOutlinePage}.
- *
- * @author Steffen Pingel
- */
-public class TaskEditorOutlineNode {
-
- public static final String LABEL_COMMENTS = Messages.TaskEditorOutlineNode_Comments;
-
- public static final String LABEL_DESCRIPTION = Messages.TaskEditorOutlineNode_Description;
-
- public static final String LABEL_NEW_COMMENT = Messages.TaskEditorOutlineNode_New_Comment;
-
- private static TaskEditorOutlineNode createNode(TaskData taskData, String attributeId, String label) {
- TaskAttribute taskAttribute = taskData.getRoot().getMappedAttribute(attributeId);
- if (taskAttribute != null) {
- if (label == null) {
- label = taskAttribute.getValue();
- }
- return new TaskEditorOutlineNode(label, taskAttribute);
- }
- return null;
- }
-
- private static TaskEditorOutlineNode createNode(TaskAttribute taskAttribute) {
- String type = taskAttribute.getMetaData().getType();
- if (TaskAttribute.TYPE_COMMENT.equals(type)) {
- ITaskComment taskComment = TasksUiPlugin.getRepositoryModel().createTaskComment(taskAttribute);
- if (taskComment != null) {
- taskAttribute.getTaskData().getAttributeMapper().updateTaskComment(taskComment, taskAttribute);
- StringBuilder sb = new StringBuilder();
- sb.append(taskComment.getNumber());
- sb.append(": "); //$NON-NLS-1$
- IRepositoryPerson author = taskComment.getAuthor();
- if (author != null) {
- sb.append(author.toString());
- }
- Date creationDate = taskComment.getCreationDate();
- if (creationDate != null) {
- sb.append(" ("); //$NON-NLS-1$
- sb.append(EditorUtil.formatDateTime(creationDate));
- sb.append(")"); //$NON-NLS-1$
- }
- TaskEditorOutlineNode node = new TaskEditorOutlineNode(sb.toString(), taskAttribute);
- node.setTaskComment(taskComment);
- return node;
- }
- } else {
- String label = taskAttribute.getTaskData().getAttributeMapper().getValueLabel(taskAttribute);
- return new TaskEditorOutlineNode(label, taskAttribute);
- }
- return null;
- }
-
- public static TaskEditorOutlineNode parse(TaskData taskData) {
- TaskEditorOutlineNode rootNode = createNode(taskData, TaskAttribute.SUMMARY, null);
- if (rootNode == null) {
- rootNode = new TaskEditorOutlineNode(Messages.TaskEditorOutlineNode_Task_ + taskData.getTaskId());
- }
- addNode(rootNode, taskData, TaskAttribute.DESCRIPTION, LABEL_DESCRIPTION);
- List<TaskAttribute> comments = taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_COMMENT);
- if (comments.size() > 0) {
- TaskEditorOutlineNode commentsNode = new TaskEditorOutlineNode(LABEL_COMMENTS);
- rootNode.addChild(commentsNode);
- for (TaskAttribute commentAttribute : comments) {
- TaskEditorOutlineNode node = createNode(commentAttribute);
- if (node != null) {
- commentsNode.addChild(node);
- }
- }
- }
- addNode(rootNode, taskData, TaskAttribute.COMMENT_NEW, LABEL_NEW_COMMENT);
- return rootNode;
- }
-
- private static TaskEditorOutlineNode addNode(TaskEditorOutlineNode parentNode, TaskData taskData,
- String attributeId, String label) {
- TaskEditorOutlineNode node = createNode(taskData, attributeId, label);
- if (node != null) {
- parentNode.addChild(node);
- }
- return node;
- }
-
- private List<TaskEditorOutlineNode> children;
-
- private final String label;
-
- /** The parent of this node or null if it is the bug report */
- private TaskEditorOutlineNode parent;
-
- private final TaskAttribute taskAttribute;
-
- private ITaskComment taskComment;
-
- public TaskEditorOutlineNode(String label) {
- this(label, null);
- }
-
- public TaskEditorOutlineNode(String label, TaskAttribute taskAttribute) {
- this.label = label;
- this.taskAttribute = taskAttribute;
- }
-
- public void addChild(TaskEditorOutlineNode node) {
- Assert.isNotNull(node);
- if (children == null) {
- children = new ArrayList<TaskEditorOutlineNode>();
- }
- node.parent = this;
- children.add(node);
- }
-
- /**
- * @return <code>true</code> if the given object is another node representing the same piece of data in the editor.
- */
- @Override
- public boolean equals(Object o) {
- if (o instanceof TaskEditorOutlineNode) {
- TaskEditorOutlineNode node = (TaskEditorOutlineNode) o;
- return getLabel().equals(node.getLabel());
- }
- return false;
- }
-
- public TaskEditorOutlineNode[] getChildren() {
- return (children == null) ? new TaskEditorOutlineNode[0]
- : children.toArray(new TaskEditorOutlineNode[children.size()]);
- }
-
- public ITaskComment getTaskComment() {
- return taskComment;
- }
-
- public void setTaskComment(ITaskComment taskComment) {
- this.taskComment = taskComment;
- }
-
- public TaskAttribute getData() {
- return taskAttribute;
- }
-
- public String getLabel() {
- return label;
- }
-
- public TaskEditorOutlineNode getParent() {
- return parent;
- }
-
- @Override
- public int hashCode() {
- return getLabel().hashCode();
- }
-
- @Override
- public String toString() {
- return getLabel();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlinePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlinePage.java
deleted file mode 100644
index 52a3046b7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlinePage.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
-/**
- * An outline page for a {@link TaskEditor}.
- *
- * @author Steffen Pingel
- */
-public class TaskEditorOutlinePage extends ContentOutlinePage {
-
- private static class TaskEditorOutlineContentProvider implements ITreeContentProvider {
-
- public void dispose() {
- // ignore
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof TaskEditorOutlineNode) {
- Object[] children = ((TaskEditorOutlineNode) parentElement).getChildren();
- return children;
- }
- return new Object[0];
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof TaskEditorOutlineModel) {
- return new Object[] { ((TaskEditorOutlineModel) inputElement).getRoot() };
- }
- return new Object[0];
- }
-
- public Object getParent(Object element) {
- if (element instanceof TaskEditorOutlineNode) {
- return ((TaskEditorOutlineNode) element).getParent();
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof TaskEditorOutlineNode) {
- return ((TaskEditorOutlineNode) element).getChildren().length > 0;
- }
- return false;
- }
-
- public void inputChanged(Viewer viewerChanged, Object oldInput, Object newInput) {
- // ignore
- }
-
- }
-
- private static class TaskEditorOutlineModel {
-
- private final TaskEditorOutlineNode root;
-
- public TaskEditorOutlineModel(TaskEditorOutlineNode root) {
- this.root = root;
- }
-
- public TaskEditorOutlineNode getRoot() {
- return root;
- }
-
- }
-
- private TaskEditorOutlineModel model;
-
- private TaskRepository taskRepository;
-
- private TreeViewer viewer;
-
- public TaskEditorOutlinePage() {
- }
-
- public void setInput(TaskRepository taskRepository, TaskEditorOutlineNode rootNode) {
- this.taskRepository = taskRepository;
- if (rootNode != null) {
- this.model = new TaskEditorOutlineModel(rootNode);
- } else {
- this.model = null;
- }
- if (viewer != null) {
- viewer.setInput(this.model);
- viewer.refresh(true);
- }
- }
-
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
- viewer = getTreeViewer();
- viewer.setContentProvider(new TaskEditorOutlineContentProvider());
- viewer.setLabelProvider(new LabelProvider() {
- @Override
- public Image getImage(Object element) {
- if (element instanceof TaskEditorOutlineNode) {
- TaskEditorOutlineNode node = (TaskEditorOutlineNode) element;
- if (TaskEditorOutlineNode.LABEL_COMMENTS.equals(node.getLabel())
- || TaskEditorOutlineNode.LABEL_NEW_COMMENT.equals(node.getLabel())) {
- return CommonImages.getImage(TasksUiImages.COMMENT);
- }
- if (TaskEditorOutlineNode.LABEL_DESCRIPTION.equals(node.getLabel())) {
- return CommonImages.getImage(TasksUiImages.TASK_NOTES);
- } else if (node.getTaskComment() != null) {
- IRepositoryPerson author = node.getTaskComment().getAuthor();
- if (taskRepository != null && author != null
- && author.getPersonId().equals(taskRepository.getUserName())) {
- return CommonImages.getImage(CommonImages.PERSON_ME);
- } else {
- return CommonImages.getImage(CommonImages.PERSON);
- }
- } else {
- return CommonImages.getImage(TasksUiImages.TASK);
- }
- } else {
- return super.getImage(element);
- }
- }
-
- @Override
- public String getText(Object element) {
- if (element instanceof TaskEditorOutlineNode) {
- TaskEditorOutlineNode node = (TaskEditorOutlineNode) element;
- return node.getLabel();
- }
- return super.getText(element);
- }
- });
- viewer.setInput(model);
- viewer.expandAll();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPeoplePart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPeoplePart.java
deleted file mode 100644
index 650a6755b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPeoplePart.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskEditorPeoplePart extends AbstractTaskEditorPart {
-
- private static final int COLUMN_MARGIN = 5;
-
- public TaskEditorPeoplePart() {
- setPartName(Messages.TaskEditorPeoplePart_People);
- }
-
- private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) {
- AbstractAttributeEditor editor = createAttributeEditor(attribute);
- if (editor != null) {
- editor.createLabelControl(composite, toolkit);
- GridDataFactory.defaultsFor(editor.getLabelControl()).indent(COLUMN_MARGIN, 0).applyTo(
- editor.getLabelControl());
- editor.createControl(composite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
- GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(editor.getControl());
- }
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- Section section = createSection(parent, toolkit, true);
-
- Composite peopleComposite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 5;
- peopleComposite.setLayout(layout);
-
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED));
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_REPORTER));
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC));
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_CC));
-
- toolkit.paintBordersFor(peopleComposite);
- section.setClient(peopleComposite);
- setSection(toolkit, section);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
deleted file mode 100644
index 26d2f835b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.Calendar;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.commons.core.DateUtil;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.DayDateRange;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-import org.eclipse.mylyn.internal.tasks.ui.ScheduleDatePicker;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.monitor.ui.MonitorUi;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
-import org.eclipse.mylyn.tasks.core.TaskActivityAdapter;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskEditorPlanningPart extends AbstractTaskEditorPart {
-
- private static final int CONTROL_WIDTH = 135;
-
- private DatePicker dueDatePicker;
-
- private Text elapsedTimeText;
-
- private Spinner estimatedTime;
-
- private ScheduleDatePicker scheduleDatePicker;
-
- private AbstractTask task;
-
- private final ITaskListChangeListener TASK_LIST_LISTENER = new TaskListChangeAdapter() {
-
- @Override
- public void containersChanged(Set<TaskContainerDelta> containers) {
- for (TaskContainerDelta taskContainerDelta : containers) {
- if (taskContainerDelta.getElement() instanceof ITask) {
- final AbstractTask updateTask = (AbstractTask) taskContainerDelta.getElement();
- if (updateTask != null && task != null
- && updateTask.getHandleIdentifier().equals(task.getHandleIdentifier())) {
- if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- updateFromTask(updateTask);
- }
- });
- }
- }
- }
- }
- }
-
- };
-
- private final ITaskActivityListener timingListener = new TaskActivityAdapter() {
-
- @Override
- public void elapsedTimeUpdated(ITask task, long newElapsedTime) {
- if (task.equals(TaskEditorPlanningPart.this.task)) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (elapsedTimeText != null && !elapsedTimeText.isDisposed()) {
- updateElapsedTime();
- }
- }
- });
-
- }
- }
- };
-
- public TaskEditorPlanningPart() {
- setPartName(Messages.TaskEditorPlanningPart_Personal_Planning);
- }
-
- @Override
- public void commit(boolean onSave) {
- AbstractTask task = (AbstractTask) getTaskEditorPage().getTask();
- Assert.isNotNull(task);
-
- if (scheduleDatePicker != null && scheduleDatePicker.getScheduledDate() != null) {
- if (task.getScheduledForDate() == null
- || (task.getScheduledForDate() != null && !scheduleDatePicker.getScheduledDate().equals(
- task.getScheduledForDate())) || (task).getScheduledForDate() instanceof DayDateRange) {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, scheduleDatePicker.getScheduledDate());
- (task).setReminded(false);
- }
- } else {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, null);
- (task).setReminded(false);
- }
-
- if (estimatedTime != null) {
- task.setEstimatedTimeHours(estimatedTime.getSelection());
- }
-
- if (dueDatePicker != null && dueDatePicker.getDate() != null) {
- TasksUiPlugin.getTaskActivityManager().setDueDate(task, dueDatePicker.getDate().getTime());
- } else {
- TasksUiPlugin.getTaskActivityManager().setDueDate(task, null);
- }
-
- super.commit(onSave);
- }
-
- private void createActualTime(FormToolkit toolkit, Composite parent) {
- Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Active);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- label.setToolTipText(Messages.TaskEditorPlanningPart_Time_working_on_this_task);
-
- Composite nameValueComp = createComposite(parent, 2, toolkit);
-
- elapsedTimeText = toolkit.createText(nameValueComp, null);
- updateElapsedTime();
-
- GridData td = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- td.grabExcessHorizontalSpace = true;
- elapsedTimeText.setLayoutData(td);
- elapsedTimeText.setEditable(false);
-
- ImageHyperlink resetActivityTimeButton = toolkit.createImageHyperlink(nameValueComp, SWT.NONE);
- resetActivityTimeButton.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR));
- resetActivityTimeButton.setToolTipText(Messages.TaskEditorPlanningPart_Reset);
- resetActivityTimeButton.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent e) {
- if (MessageDialog.openConfirm(getControl().getShell(), Messages.TaskEditorPlanningPart_Confirm_Activity_Time_Deletion,
- Messages.TaskEditorPlanningPart_Do_you_wish_to_reset_your_activity_time_on_this_task_)) {
- MonitorUi.getActivityContextManager().removeActivityTime(task.getHandleIdentifier(), 0l,
- System.currentTimeMillis());
- }
- }
- });
- }
-
- private void updateElapsedTime() {
- String elapsedTimeString = DateUtil.getFormattedDurationShort(TasksUiPlugin.getTaskActivityManager()
- .getElapsedTime(task));
- if (elapsedTimeString.equals("")) { //$NON-NLS-1$
- elapsedTimeString = Messages.TaskEditorPlanningPart_0_SECOUNDS;
- }
- elapsedTimeText.setText(elapsedTimeString);
- }
-
- private Composite createComposite(Composite parent, int col, FormToolkit toolkit) {
- Composite nameValueComp = toolkit.createComposite(parent);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 3;
- nameValueComp.setLayout(layout);
- return nameValueComp;
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- task = (AbstractTask) getTaskEditorPage().getTask();
- boolean hasDueDate = !getTaskEditorPage().getConnector().hasRepositoryDueDate(
- getTaskEditorPage().getTaskRepository(), task, getTaskData());
-
- Section section = createSection(parent, toolkit, true);
- Composite composite = getManagedForm().getToolkit().createComposite(section);
- composite.setLayout(new GridLayout((hasDueDate) ? 4 : 6, false));
-
- createScheduledDatePicker(toolkit, composite);
-
- // disable due date picker if it's a repository due date
- if (hasDueDate) {
- createDueDatePicker(toolkit, composite);
- }
-
- createEstimatedTime(toolkit, composite);
-
- createActualTime(toolkit, composite);
-
- TasksUiInternal.getTaskList().addChangeListener(TASK_LIST_LISTENER);
- TasksUiPlugin.getTaskActivityManager().addActivityListener(timingListener);
-
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
- setSection(toolkit, section);
- }
-
- private void createDueDatePicker(FormToolkit toolkit, Composite parent) {
- Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Due);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- Composite composite = createComposite(parent, 2, toolkit);
-
- dueDatePicker = new DatePicker(composite, SWT.FLAT, DatePicker.LABEL_CHOOSE, true, 0);
- GridDataFactory.fillDefaults().hint(CONTROL_WIDTH, SWT.DEFAULT).applyTo(dueDatePicker);
- dueDatePicker.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- dueDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- if (task.getDueDate() != null) {
- Calendar calendar = TaskActivityUtil.getCalendar();
- calendar.setTime(task.getDueDate());
- dueDatePicker.setDate(calendar);
- }
- dueDatePicker.addPickerSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent arg0) {
- markDirty();
- }
- });
- toolkit.adapt(dueDatePicker, false, false);
- toolkit.paintBordersFor(composite);
-
- ImageHyperlink clearDueDate = toolkit.createImageHyperlink(composite, SWT.NONE);
- clearDueDate.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR));
- clearDueDate.setToolTipText(Messages.TaskEditorPlanningPart_Clear);
- clearDueDate.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- dueDatePicker.setDate(null);
- markDirty();
- }
- });
- }
-
- private void createEstimatedTime(FormToolkit toolkit, Composite parent) {
- Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Estimated);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- Composite composite = createComposite(parent, 2, toolkit);
-
- // Estimated time
- estimatedTime = new Spinner(composite, SWT.FLAT);
- estimatedTime.setDigits(0);
- estimatedTime.setMaximum(100);
- estimatedTime.setMinimum(0);
- estimatedTime.setIncrement(1);
- estimatedTime.setSelection(task.getEstimatedTimeHours());
- estimatedTime.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- estimatedTime.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (task.getEstimatedTimeHours() != estimatedTime.getSelection()) {
- markDirty();
- }
- }
- });
-
- ImageHyperlink clearEstimated = toolkit.createImageHyperlink(composite, SWT.NONE);
- clearEstimated.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR));
- clearEstimated.setToolTipText(Messages.TaskEditorPlanningPart_Clear);
- clearEstimated.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- estimatedTime.setSelection(0);
- markDirty();
- }
- });
- toolkit.paintBordersFor(composite);
- }
-
- private void createScheduledDatePicker(FormToolkit toolkit, Composite parent) {
- Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Scheduled);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- Composite composite = createComposite(parent, 2, toolkit);
-
- scheduleDatePicker = new ScheduleDatePicker(composite, task, SWT.FLAT);
- GridDataFactory.fillDefaults().hint(CONTROL_WIDTH, SWT.DEFAULT).applyTo(scheduleDatePicker);
- scheduleDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- toolkit.adapt(scheduleDatePicker, false, false);
- toolkit.paintBordersFor(composite);
-
- scheduleDatePicker.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- scheduleDatePicker.addPickerSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent arg0) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent arg0) {
- markDirty();
- }
- });
-
- ImageHyperlink clearScheduledDate = toolkit.createImageHyperlink(composite, SWT.NONE);
- clearScheduledDate.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR));
- clearScheduledDate.setToolTipText(Messages.TaskEditorPlanningPart_Clear);
- clearScheduledDate.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- scheduleDatePicker.setScheduledDate(null);
- // XXX why is this set here?
- task.setReminded(false);
- markDirty();
- }
- });
- }
-
- @Override
- public void dispose() {
- TasksUiPlugin.getTaskActivityManager().removeActivityListener(timingListener);
- TasksUiInternal.getTaskList().removeChangeListener(TASK_LIST_LISTENER);
- }
-
- private void updateFromTask(AbstractTask updateTask) {
- if (scheduleDatePicker != null && !scheduleDatePicker.isDisposed()) {
- if (updateTask.getScheduledForDate() != null) {
- scheduleDatePicker.setScheduledDate(updateTask.getScheduledForDate());
- } else {
- scheduleDatePicker.setScheduledDate(null);
- }
- }
-
- if (estimatedTime != null && !estimatedTime.isDisposed()) {
- estimatedTime.setSelection(updateTask.getEstimatedTimeHours());
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorRichTextPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorRichTextPart.java
deleted file mode 100644
index cb5608ffc..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorRichTextPart.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.internal.EditorAreaHelper;
-import org.eclipse.ui.internal.WorkbenchPage;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskEditorRichTextPart extends AbstractTaskEditorPart {
-
- private RichTextAttributeEditor editor;
-
- private TaskAttribute attribute;
-
- private Composite composite;
-
- private int sectionStyle;
-
- private ToggleToMaximizePartAction toggleToMaximizePartAction;
-
- private Action togglePreviewAction;
-
- private Action toggleBrowserAction;
-
- public TaskEditorRichTextPart() {
- setSectionStyle(ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- }
-
- public void appendText(String text) {
- if (editor == null) {
- return;
- }
-
- StringBuilder strBuilder = new StringBuilder();
- String oldText = editor.getViewer().getDocument().get();
- if (strBuilder.length() != 0) {
- strBuilder.append("\n"); //$NON-NLS-1$
- }
- strBuilder.append(oldText);
- strBuilder.append(text);
- editor.getViewer().getDocument().set(strBuilder.toString());
- TaskAttribute attribute = getTaskData().getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW);
- if (attribute != null) {
- attribute.setValue(strBuilder.toString());
- getTaskEditorPage().getModel().attributeChanged(attribute);
- }
- editor.getViewer().getTextWidget().setCaretOffset(strBuilder.length());
- }
-
- public int getSectionStyle() {
- return sectionStyle;
- }
-
- public void setSectionStyle(int sectionStyle) {
- this.sectionStyle = sectionStyle;
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- if (attribute == null) {
- return;
- }
- AbstractAttributeEditor attributEditor = createAttributeEditor(attribute);
- if (!(attributEditor instanceof RichTextAttributeEditor)) {
- String clazz;
- if (attributEditor != null) {
- clazz = attributEditor.getClass().getName();
- } else {
- clazz = "<null>"; //$NON-NLS-1$
- }
- StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- "Expected an instance of RichTextAttributeEditor, got \"" + clazz + "\"")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- Section section = createSection(parent, toolkit, sectionStyle);
-
- composite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
-
- editor = (RichTextAttributeEditor) attributEditor;
-
- editor.createControl(composite, toolkit);
- if (editor.isReadOnly()) {
- composite.setLayout(new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 0, 0, 0, 3));
- } else {
- final GridData gd = new GridData();
- // wrap text at this margin, see comment below
- int width = getEditorWidth();
- // the goal is to make the text viewer as big as the text so it does not require scrolling when first drawn
- // on screen
- Point size = editor.getViewer().getTextWidget().computeSize(width, SWT.DEFAULT, true);
- gd.widthHint = EditorUtil.MAXIMUM_WIDTH;
- gd.minimumWidth = EditorUtil.MAXIMUM_WIDTH;
- gd.horizontalAlignment = SWT.FILL;
- gd.grabExcessHorizontalSpace = true;
- // limit height to be avoid dynamic resizing of the text widget:
- // MAXIMUM_HEIGHT < height < MAXIMUM_HEIGHT * 3
- //gd.minimumHeight = AbstractAttributeEditor.MAXIMUM_HEIGHT;
- gd.heightHint = Math.min(Math.max(EditorUtil.MAXIMUM_HEIGHT, size.y), EditorUtil.MAXIMUM_HEIGHT * 3);
- if (getExpandVertically()) {
- gd.verticalAlignment = SWT.FILL;
- gd.grabExcessVerticalSpace = true;
- }
- editor.getControl().setLayoutData(gd);
- editor.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- // shrink the text control if the editor width is reduced, otherwise the text field will always keep it's original
- // width and will cause the editor to have a horizonal scroll bar
-// composite.addControlListener(new ControlAdapter() {
-// @Override
-// public void controlResized(ControlEvent e) {
-// int width = sectionComposite.getSize().x;
-// Point size = descriptionTextViewer.getTextWidget().computeSize(width, SWT.DEFAULT, true);
-// // limit width to parent widget
-// gd.widthHint = width;
-// // limit height to avoid dynamic resizing of the text widget
-// gd.heightHint = Math.min(Math.max(DESCRIPTION_HEIGHT, size.y), DESCRIPTION_HEIGHT * 4);
-// sectionComposite.layout();
-// }
-// });
- }
-
- getEditor().getControl().setData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION, getMaximizePartAction());
- if (getEditor().getControl() instanceof Composite) {
- for (Control control : ((Composite) getEditor().getControl()).getChildren()) {
- control.setData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION, getMaximizePartAction());
- }
- }
- getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
-
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
- setSection(toolkit, section);
- }
-
- private int getEditorWidth() {
- int widthHint = 0;
- if (getManagedForm() != null && getManagedForm().getForm() != null) {
- widthHint = getManagedForm().getForm().getClientArea().width - 90;
- }
- if (widthHint <= 0 && getTaskEditorPage().getEditor().getEditorSite() != null
- && getTaskEditorPage().getEditor().getEditorSite().getPage() != null) {
- EditorAreaHelper editorManager = ((WorkbenchPage) getTaskEditorPage().getEditor().getEditorSite().getPage()).getEditorPresentation();
- if (editorManager != null && editorManager.getLayoutPart() != null) {
- widthHint = editorManager.getLayoutPart().getControl().getBounds().width - 90;
- }
- }
- if (widthHint <= 0) {
- widthHint = EditorUtil.MAXIMUM_WIDTH;
- }
- return widthHint;
- }
-
- public TaskAttribute getAttribute() {
- return attribute;
- }
-
- protected Composite getComposite() {
- return composite;
- }
-
- protected RichTextAttributeEditor getEditor() {
- return editor;
- }
-
- public void setAttribute(TaskAttribute attribute) {
- this.attribute = attribute;
- }
-
- @Override
- public void setFocus() {
- if (editor != null) {
- editor.getControl().setFocus();
- }
- }
-
- // TODO 3.1 move to AbstractTaskEditorPart?
- protected Action getMaximizePartAction() {
- if (toggleToMaximizePartAction == null) {
- toggleToMaximizePartAction = new ToggleToMaximizePartAction();
- }
- return toggleToMaximizePartAction;
- }
-
- private class ToggleToMaximizePartAction extends Action {
-
- private static final String COMMAND_ID = "org.eclipse.mylyn.tasks.ui.command.maximizePart"; //$NON-NLS-1$
-
- private/*static*/final String MAXIMIZE = Messages.TaskEditorRichTextPart_Maximize;
-
- private static final int SECTION_HEADER_HEIGHT = 50;
-
- private int originalHeight = -1;
-
- public ToggleToMaximizePartAction() {
- super("", SWT.TOGGLE); //$NON-NLS-1$
- setImageDescriptor(CommonImages.PART_MAXIMIZE);
- setToolTipText(MAXIMIZE);
- setActionDefinitionId(COMMAND_ID);
- setChecked(false);
- }
-
- @Override
- public void run() {
- if (!(getEditor().getControl().getLayoutData() instanceof GridData)) {
- return;
- }
-
- GridData gd = (GridData) getEditor().getControl().getLayoutData();
-
- if (originalHeight == -1) {
- originalHeight = gd.heightHint;
- }
-
- try {
- getTaskEditorPage().setReflow(false);
-
- int heightHint;
- if (isChecked()) {
- heightHint = getManagedForm().getForm().getClientArea().height - SECTION_HEADER_HEIGHT;
- } else {
- heightHint = originalHeight;
- }
-
- // ignore when not necessary
- if (gd.heightHint == heightHint) {
- return;
- }
- gd.heightHint = heightHint;
- gd.minimumHeight = heightHint;
- } finally {
- getTaskEditorPage().setReflow(true);
- }
-
- getTaskEditorPage().reflow();
- EditorUtil.ensureVisible(getEditor().getControl());
- }
- }
-
- @Override
- protected void fillToolBar(ToolBarManager manager) {
- if (getEditor().hasPreview()) {
- togglePreviewAction = new Action("", SWT.TOGGLE) { //$NON-NLS-1$
- @Override
- public void run() {
- if (isChecked()) {
- editor.showPreview();
- } else {
- editor.showEditor();
- }
-
- if (toggleBrowserAction != null) {
- toggleBrowserAction.setChecked(false);
- }
- }
- };
- togglePreviewAction.setImageDescriptor(CommonImages.PREVIEW_WEB);
- togglePreviewAction.setToolTipText(Messages.TaskEditorRichTextPart_Preview);
- togglePreviewAction.setChecked(false);
- manager.add(togglePreviewAction);
- }
- if (togglePreviewAction == null && getEditor().hasBrowser()) {
- toggleBrowserAction = new Action("", SWT.TOGGLE) { //$NON-NLS-1$
- @Override
- public void run() {
- if (isChecked()) {
- editor.showBrowser();
- } else {
- editor.showEditor();
- }
-
- if (togglePreviewAction != null) {
- togglePreviewAction.setChecked(false);
- }
- }
- };
- toggleBrowserAction.setImageDescriptor(CommonImages.PREVIEW_WEB);
- toggleBrowserAction.setToolTipText(Messages.TaskEditorRichTextPart_Browser_Preview);
- toggleBrowserAction.setChecked(false);
- manager.add(toggleBrowserAction);
- }
- manager.add(getMaximizePartAction());
- super.fillToolBar(manager);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorSummaryPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorSummaryPart.java
deleted file mode 100644
index 21c15872a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorSummaryPart.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Raphael Ackermann - initial API and implementation, bug 195514
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Raphael Ackermann
- * @author Steffen Pingel
- */
-public class TaskEditorSummaryPart extends AbstractTaskEditorPart {
-
- private static final int COLUMN_MARGIN = 6;
-
- private Composite headerComposite;
-
- private AbstractAttributeEditor summaryEditor;
-
- public TaskEditorSummaryPart() {
- setPartName(Messages.TaskEditorSummaryPart_Summary);
- }
-
- private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) {
- addAttribute(composite, toolkit, attribute, COLUMN_MARGIN);
- }
-
- private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute, int indent) {
- addAttribute(composite, toolkit, attribute, indent, true);
- }
-
- private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute, int indent,
- boolean showLabel) {
- AbstractAttributeEditor editor = createAttributeEditor(attribute);
- if (editor != null) {
- // having editable controls in the header looks odd
- editor.setReadOnly(true);
- editor.setDecorationEnabled(false);
-
- boolean isPriority = isAttribute(attribute, TaskAttribute.PRIORITY);
-
- if (showLabel && !isPriority) {
- editor.createLabelControl(composite, toolkit);
- GridDataFactory.defaultsFor(editor.getLabelControl()).indent(indent, 0).applyTo(
- editor.getLabelControl());
- }
-
- if (isPriority) {
- ITaskMapping mapping = getTaskEditorPage().getConnector().getTaskMapping(getTaskData());
- if (mapping != null) {
- PriorityLevel priorityLevel = mapping.getPriorityLevel();
- if (priorityLevel != null) {
- Image image = CommonImages.getImage(TasksUiInternal.getPriorityImage(getTaskEditorPage().getTask()));
- if (image != null) {
- Label label = toolkit.createLabel(headerComposite, null);
- label.setImage(image);
- GridDataFactory.defaultsFor(label).indent(5, -3).applyTo(label);
- }
- }
- }
- }
-
- if (isAttribute(attribute, TaskAttribute.DATE_MODIFICATION) && editor instanceof DateAttributeEditor) {
- ((DateAttributeEditor) editor).setShowTime(true);
- }
-
- editor.createControl(composite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
- }
- }
-
- private boolean isAttribute(TaskAttribute attribute, String id) {
- return attribute.getId().equals(
- attribute.getTaskData().getAttributeMapper().mapToRepositoryKey(attribute.getParentAttribute(), id));
- }
-
- private void addSummaryText(Composite composite, FormToolkit toolkit) {
- summaryEditor = createAttributeEditor(getTaskData().getRoot().getMappedAttribute(TaskAttribute.SUMMARY));
- if (summaryEditor != null) {
- summaryEditor.createControl(composite, toolkit);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryEditor.getControl());
- getTaskEditorPage().getAttributeEditorToolkit().adapt(summaryEditor);
- }
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- Composite composite = toolkit.createComposite(parent);
- GridLayout layout = new GridLayout();
- layout.verticalSpacing = 5;
- composite.setLayout(layout);
-
- addSummaryText(composite, toolkit);
-
- if (needsHeader()) {
- createHeaderLayout(composite, toolkit);
- }
-
- toolkit.paintBordersFor(composite);
-
- setControl(composite);
- }
-
- protected void createHeaderLayout(Composite composite, FormToolkit toolkit) {
- headerComposite = toolkit.createComposite(composite);
- GridLayout layout = new GridLayout(11, false);
- layout.verticalSpacing = 1;
- layout.marginHeight = 1;
- layout.marginWidth = 1;
- headerComposite.setLayout(layout);
-
-// ITaskMapping mapping = getTaskEditorPage().getConnector().getTaskMapping(getTaskData());
-// if (mapping != null) {
-// toolkit.createLabel(headerComposite, mapping.getStatus());
-// String resolution = mapping.getResolution();
-// if (resolution != null && resolution.length() > 0) {
-// toolkit.createLabel(headerComposite, "(" + resolution + ")");
-// }
-// String priority = mapping.getPriority();
-// if (priority != null) {
-// Label label = toolkit.createLabel(headerComposite, "Priority:");
-// label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-// PriorityLevel priorityLevel = mapping.getPriorityLevel();
-// if (priorityLevel != null) {
-// Image image = TasksUiImages.getImageForPriority(priorityLevel);
-// if (image != null) {
-// label = toolkit.createLabel(headerComposite, null);
-// label.setImage(image);
-// }
-// }
-// toolkit.createLabel(headerComposite, priority);
-// }
-// }
- TaskAttribute priorityAttribute = getTaskData().getRoot().getMappedAttribute(TaskAttribute.PRIORITY);
- addAttribute(headerComposite, toolkit, priorityAttribute);
-
- TaskAttribute statusAtribute = getTaskData().getRoot().getMappedAttribute(TaskAttribute.STATUS);
- addAttribute(headerComposite, toolkit, statusAtribute, 0);
-
- ITaskMapping mapping = getTaskEditorPage().getConnector().getTaskMapping(getTaskData());
- if (mapping != null && mapping.getResolution() != null && mapping.getResolution().length() > 0) {
- TaskAttribute resolutionAtribute = getTaskData().getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
- addAttribute(headerComposite, toolkit, resolutionAtribute, 0, false);
- }
-
- TaskAttribute keyAttribute = getTaskData().getRoot().getMappedAttribute(TaskAttribute.TASK_KEY);
- addAttribute(headerComposite, toolkit, keyAttribute);
-
- TaskAttribute dateCreation = getTaskData().getRoot().getMappedAttribute(TaskAttribute.DATE_CREATION);
- addAttribute(headerComposite, toolkit, dateCreation);
-
- TaskAttribute dateModified = getTaskData().getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
- addAttribute(headerComposite, toolkit, dateModified);
- }
-
- public boolean needsHeader() {
- return !getTaskData().isNew();
- }
-
- @Override
- public void setFocus() {
- if (summaryEditor != null) {
- summaryEditor.getControl().setFocus();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkDetector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkDetector.java
deleted file mode 100644
index d3d7cfd06..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkDetector.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.AbstractTaskHyperlinkDetector;
-
-/**
- * Delegates to {@link AbstractRepositoryConnectorUi} for detecting hyperlinks.
- *
- * @author Steffen Pingel
- */
-public class TaskHyperlinkDetector extends AbstractTaskHyperlinkDetector {
-
- @Override
- protected List<IHyperlink> detectHyperlinks(ITextViewer textViewer, final String content, final int index,
- final int contentOffset) {
- List<IHyperlink> result = null;
- for (final TaskRepository repository : getTaskRepositories(textViewer)) {
- final AbstractRepositoryConnectorUi connectorUi = getConnectorUi(repository);
- if (connectorUi == null) {
- continue;
- }
- final IHyperlink[][] links = new IHyperlink[1][];
- SafeRunnable.run(new ISafeRunnable() {
-
- public void handleException(Throwable exception) {
- }
-
- public void run() throws Exception {
- links[0] = connectorUi.findHyperlinks(repository, content, index, contentOffset);
- }
-
- });
- if (links[0] != null && links[0].length > 0) {
- if (result == null) {
- result = new ArrayList<IHyperlink>();
- }
- result.addAll(Arrays.asList(links[0]));
- }
- }
- return result;
- }
-
- protected AbstractRepositoryConnectorUi getConnectorUi(TaskRepository repository) {
- return TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkTextPresentationManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkTextPresentationManager.java
deleted file mode 100644
index 55d75624d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskHyperlinkTextPresentationManager.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TaskHyperlink;
-import org.eclipse.swt.custom.StyleRange;
-
-/**
- * A manager that decorates task hyperlinks with strike-through when the task is completed.
- *
- * @author David Green
- */
-public class TaskHyperlinkTextPresentationManager extends AbstractHyperlinkTextPresentationManager {
-
- private final TaskList taskList = TasksUiPlugin.getTaskList();
-
- @Override
- public boolean select(IHyperlink hyperlink) {
- if (hyperlink instanceof TaskHyperlink) {
- TaskHyperlink taskHyperlink = (TaskHyperlink) hyperlink;
- String taskId = taskHyperlink.getTaskId();
- String repositoryUrl = taskHyperlink.getRepository().getRepositoryUrl();
-
- ITask task = taskList.getTask(repositoryUrl, taskId);
- if (task == null) {
- task = taskList.getTaskByKey(repositoryUrl, taskId);
- }
- return task != null && task.isCompleted();
- }
- return false;
- }
-
- @Override
- protected void decorate(StyleRange styleRange) {
- // currently only strike-through is used to indicate completed tasks
- styleRange.strikeout = true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskListChangeAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskListChangeAdapter.java
deleted file mode 100644
index 0cb4e91e1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskListChangeAdapter.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-
-public class TaskListChangeAdapter implements ITaskListChangeListener {
-
- public void containersChanged(Set<TaskContainerDelta> containers) {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
deleted file mode 100644
index ac12ac5ac..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
+++ /dev/null
@@ -1,961 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Ken Sueda - initial prototype
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.text.DateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.DayDateRange;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.ScheduleDatePicker;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.DeleteTaskEditorAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewSubTaskAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.AbstractRetrieveTitleFromUrlJob;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.monitor.ui.MonitorUi;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
-import org.eclipse.mylyn.tasks.core.TaskActivityAdapter;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.ITasksUiConstants;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.mylyn.tasks.ui.editors.TaskFormPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IExpansionListener;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class TaskPlanningEditor extends TaskFormPage {
-
- private static final int WIDTH_SUMMARY = 500;
-
- private static final int NOTES_MINSIZE = 100;
-
- private DatePicker dueDatePicker;
-
- private ScheduleDatePicker scheduleDatePicker;
-
- private AbstractTask task;
-
- private Composite editorComposite;
-
- private Text endDate;
-
- private ScrolledForm form;
-
- private TextViewer summaryEditor;
-
- private Text issueReportURL;
-
- private CCombo priorityCombo;
-
- private CCombo statusCombo;
-
- private TextViewer noteEditor;
-
- private Spinner estimated;
-
- private ImageHyperlink getDescLink;
-
- private ImageHyperlink openUrlLink;
-
- private final TaskEditor parentEditor;
-
- private final ITaskListChangeListener TASK_LIST_LISTENER = new TaskListChangeAdapter() {
-
- @Override
- public void containersChanged(Set<TaskContainerDelta> containers) {
- for (TaskContainerDelta taskContainerDelta : containers) {
- if (taskContainerDelta.getElement() instanceof ITask) {
- final AbstractTask updateTask = (AbstractTask) taskContainerDelta.getElement();
- if (updateTask != null && task != null
- && updateTask.getHandleIdentifier().equals(task.getHandleIdentifier())) {
- if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (summaryEditor != null && summaryEditor.getTextWidget() != null) {
- updateTaskData(updateTask);
- }
- }
- });
- }
- break;
- }
- }
- }
- }
-
- };
-
- private FormToolkit toolkit;
-
- private ITaskActivityListener timingListener;
-
- private boolean isDirty;
-
- private CommonTextSupport textSupport;
-
- private boolean summaryChanged;
-
- public TaskPlanningEditor(TaskEditor editor) {
- super(editor, ITasksUiConstants.ID_PAGE_PLANNING, Messages.TaskPlanningEditor_Planning);
- this.parentEditor = editor;
- TasksUiInternal.getTaskList().addChangeListener(TASK_LIST_LISTENER);
- }
-
- @Override
- public TaskEditor getEditor() {
- return (TaskEditor) super.getEditor();
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) {
- super.init(site, input);
- this.textSupport = new CommonTextSupport((IHandlerService) getSite().getService(IHandlerService.class));
- this.textSupport.setSelectionChangedListener((TaskEditorActionContributor) getEditorSite().getActionBarContributor());
- }
-
- /**
- * Override for customizing the tool bar.
- */
- @Override
- public void fillToolBar(IToolBarManager toolBarManager) {
- TaskEditorInput taskEditorInput = (TaskEditorInput) getEditorInput();
- if (taskEditorInput.getTask() instanceof LocalTask) {
- DeleteTaskEditorAction deleteAction = new DeleteTaskEditorAction(taskEditorInput.getTask());
- toolBarManager.add(deleteAction);
-
- NewSubTaskAction newSubTaskAction = new NewSubTaskAction();
- newSubTaskAction.selectionChanged(newSubTaskAction, new StructuredSelection(taskEditorInput.getTask()));
- if (newSubTaskAction.isEnabled()) {
- toolBarManager.add(newSubTaskAction);
- }
- }
- }
-
- /** public for testing */
- public void updateTaskData(final AbstractTask updateTask) {
- if (scheduleDatePicker != null && !scheduleDatePicker.isDisposed()) {
- if (updateTask.getScheduledForDate() != null) {
- scheduleDatePicker.setScheduledDate(updateTask.getScheduledForDate());
- } else {
- scheduleDatePicker.setScheduledDate(null);
- }
- }
-
- if (summaryEditor == null) {
- return;
- }
-
- if (!summaryEditor.getTextWidget().isDisposed()) {
- if (!summaryChanged) {
- summaryEditor.getTextWidget().setText(updateTask.getSummary());
- }
- if (parentEditor != null) {
- parentEditor.updateHeaderToolBar();
- }
- }
-
- if (!priorityCombo.isDisposed() && updateTask != null) {
- PriorityLevel level = PriorityLevel.fromString(updateTask.getPriority());
- if (level != null) {
- int prioritySelectionIndex = priorityCombo.indexOf(level.getDescription());
- priorityCombo.select(prioritySelectionIndex);
- }
- }
- if (!statusCombo.isDisposed()) {
- if (task.isCompleted()) {
- statusCombo.select(0);
- } else {
- statusCombo.select(1);
- }
- }
- if ((updateTask instanceof LocalTask) && !endDate.isDisposed()) {
- endDate.setText(getTaskDateString(updateTask));
- }
- }
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- if (task instanceof LocalTask) {
- String label = summaryEditor.getTextWidget().getText();
- task.setSummary(label);
-
- // TODO: refactor mutation into TaskList?
- task.setUrl(issueReportURL.getText());
- String priorityDescription = priorityCombo.getItem(priorityCombo.getSelectionIndex());
- PriorityLevel level = PriorityLevel.fromDescription(priorityDescription);
- if (level != null) {
- task.setPriority(level.toString());
- }
- if (!task.isCompleted() && statusCombo.getSelectionIndex() == 0) {
- task.setCompletionDate(new Date());
- } else {
- task.setCompletionDate(null);
- }
- TasksUiInternal.getTaskList().notifyElementChanged(task);
- }
-
- String note = noteEditor.getTextWidget().getText();// notes.getText();
- task.setNotes(note);
- task.setEstimatedTimeHours(estimated.getSelection());
- if (scheduleDatePicker != null && scheduleDatePicker.getScheduledDate() != null) {
- if (task.getScheduledForDate() == null
- || (task.getScheduledForDate() != null && !scheduleDatePicker.getScheduledDate().equals(
- task.getScheduledForDate())) || (task).getScheduledForDate() instanceof DayDateRange) {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, scheduleDatePicker.getScheduledDate());
- (task).setReminded(false);
- }
- } else {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, null);
- (task).setReminded(false);
- }
- if (dueDatePicker != null && dueDatePicker.getDate() != null) {
- TasksUiPlugin.getTaskActivityManager().setDueDate(task, dueDatePicker.getDate().getTime());
- } else {
- TasksUiPlugin.getTaskActivityManager().setDueDate(task, null);
- }
-// if (parentEditor != null) {
-// parentEditor.notifyTaskChanged();
-// }
- markDirty(false);
- }
-
- @Override
- public void doSaveAs() {
- // don't support saving as
- }
-
- @Override
- public boolean isDirty() {
- return isDirty;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
-
- form = managedForm.getForm();
-
- TaskEditorInput taskEditorInput = (TaskEditorInput) getEditorInput();
- task = (AbstractTask) taskEditorInput.getTask();
-
- toolkit = managedForm.getToolkit();
-
- editorComposite = managedForm.getForm().getBody();
- GridLayout editorLayout = new GridLayout();
- editorLayout.verticalSpacing = 3;
- editorComposite.setLayout(editorLayout);
- //editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- if (task instanceof LocalTask) {
- createSummarySection(editorComposite);
- }
- createPlanningSection(editorComposite);
- createNotesSection(editorComposite);
-
- if (summaryEditor != null && summaryEditor.getTextWidget() != null
- && LocalRepositoryConnector.DEFAULT_SUMMARY.equals(summaryEditor.getTextWidget().getText())) {
- summaryEditor.setSelectedRange(0, summaryEditor.getTextWidget().getText().length());
- summaryEditor.getTextWidget().setFocus();
- } else if (summaryEditor != null && summaryEditor.getTextWidget() != null) {
- summaryEditor.getTextWidget().setFocus();
- }
- }
-
- @Override
- public void setFocus() {
- // form.setFocus();
- if (summaryEditor != null && summaryEditor.getTextWidget() != null
- && !summaryEditor.getTextWidget().isDisposed()) {
- summaryEditor.getTextWidget().setFocus();
- }
- }
-
- private Text addNameValueComp(Composite parent, String label, String value, int style) {
- Composite nameValueComp = toolkit.createComposite(parent);
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 3;
- nameValueComp.setLayout(layout);
- toolkit.createLabel(nameValueComp, label, SWT.NONE).setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
- Text text;
- if ((SWT.READ_ONLY & style) == SWT.READ_ONLY) {
- text = new Text(nameValueComp, style);
- toolkit.adapt(text, false, false);
- text.setText(value);
- } else {
- text = toolkit.createText(nameValueComp, value, style);
- }
- return text;
- }
-
- private void createSummarySection(Composite parent) {
- // Summary
- Composite summaryComposite = toolkit.createComposite(parent);
- GridLayout summaryLayout = new GridLayout();
- summaryLayout.verticalSpacing = 2;
- summaryLayout.marginHeight = 2;
- summaryLayout.marginLeft = 5;
- summaryComposite.setLayout(summaryLayout);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite);
-
- TaskRepository repository = null;
- if (task != null && !(task instanceof LocalTask)) {
- ITask repositoryTask = task;
- repository = TasksUi.getRepositoryManager().getRepository(repositoryTask.getConnectorKind(),
- repositoryTask.getRepositoryUrl());
- }
- summaryEditor = addTextEditor(repository, summaryComposite, task.getSummary(), true, SWT.FLAT | SWT.SINGLE);
-
- GridDataFactory.fillDefaults().hint(WIDTH_SUMMARY, SWT.DEFAULT).minSize(NOTES_MINSIZE, SWT.DEFAULT).grab(true,
- false).applyTo(summaryEditor.getTextWidget());
- summaryEditor.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
-
- if (!(task instanceof LocalTask)) {
- summaryEditor.setEditable(false);
- } else {
- summaryEditor.setEditable(true);
- summaryEditor.addTextListener(new ITextListener() {
- public void textChanged(TextEvent event) {
- if (!task.getSummary().equals(summaryEditor.getTextWidget().getText())) {
- summaryChanged = true;
- markDirty(true);
- }
- }
- });
- }
- toolkit.paintBordersFor(summaryComposite);
-
- Composite statusComposite = toolkit.createComposite(parent);
- GridLayout compLayout = new GridLayout(8, false);
- compLayout.verticalSpacing = 0;
- compLayout.horizontalSpacing = 5;
- compLayout.marginHeight = 3;
- statusComposite.setLayout(compLayout);
- statusComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite nameValueComp = toolkit.createComposite(statusComposite);
- GridLayout nameValueLayout = new GridLayout(2, false);
- nameValueLayout.marginHeight = 3;
- nameValueComp.setLayout(nameValueLayout);
- toolkit.createLabel(nameValueComp, Messages.TaskPlanningEditor_Priority).setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
- priorityCombo = new CCombo(nameValueComp, SWT.FLAT | SWT.READ_ONLY);
- toolkit.adapt(priorityCombo, false, false);
- priorityCombo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- toolkit.paintBordersFor(nameValueComp);
-
- // Populate the combo box with priority levels
- for (String priorityLevel : TaskListView.PRIORITY_LEVEL_DESCRIPTIONS) {
- priorityCombo.add(priorityLevel);
- }
-
- PriorityLevel level = PriorityLevel.fromString(task.getPriority());
- if (level != null) {
- int prioritySelectionIndex = priorityCombo.indexOf(level.getDescription());
- priorityCombo.select(prioritySelectionIndex);
- }
-
- if (!(task instanceof LocalTask)) {
- priorityCombo.setEnabled(false);
- } else {
- priorityCombo.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- TaskPlanningEditor.this.markDirty(true);
-
- }
- });
- }
-
- nameValueComp = toolkit.createComposite(statusComposite);
- nameValueComp.setLayout(new GridLayout(2, false));
- toolkit.createLabel(nameValueComp, Messages.TaskPlanningEditor_Status).setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
- statusCombo = new CCombo(nameValueComp, SWT.FLAT | SWT.READ_ONLY);
- toolkit.adapt(statusCombo, true, true);
- statusCombo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- toolkit.paintBordersFor(nameValueComp);
- statusCombo.add(Messages.TaskPlanningEditor_Complete);
- statusCombo.add(Messages.TaskPlanningEditor_Incomplete);
- if (task.isCompleted()) {
- statusCombo.select(0);
- } else {
- statusCombo.select(1);
- }
- if (!(task instanceof LocalTask)) {
- statusCombo.setEnabled(false);
- } else {
- statusCombo.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- TaskPlanningEditor.this.markDirty(true);
- }
- });
- }
-
- Date creationDate = task.getCreationDate();
- String creationDateString = (creationDate != null) ? DateFormat.getDateInstance(DateFormat.LONG).format(
- creationDate) : ""; //$NON-NLS-1$
- addNameValueComp(statusComposite, Messages.TaskPlanningEditor_Created, creationDateString, SWT.FLAT
- | SWT.READ_ONLY);
-
- String completionDateString = ""; //$NON-NLS-1$
- if (task.isCompleted()) {
- completionDateString = getTaskDateString(task);
- }
- endDate = addNameValueComp(statusComposite, Messages.TaskPlanningEditor_Completed, completionDateString,
- SWT.FLAT | SWT.READ_ONLY);
- // URL
- Composite urlComposite = toolkit.createComposite(parent);
- GridLayout urlLayout = new GridLayout(4, false);
- urlLayout.verticalSpacing = 0;
- urlLayout.marginHeight = 2;
- urlLayout.marginLeft = 5;
- urlComposite.setLayout(urlLayout);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(urlComposite);
-
- Label label = toolkit.createLabel(urlComposite, Messages.TaskPlanningEditor_URL);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- issueReportURL = toolkit.createText(urlComposite, task.getUrl(), SWT.FLAT);
- issueReportURL.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- if (!(task instanceof LocalTask)) {
- issueReportURL.setEditable(false);
- } else {
- issueReportURL.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- markDirty(true);
- }
- });
- }
-
- getDescLink = toolkit.createImageHyperlink(urlComposite, SWT.NONE);
- getDescLink.setImage(CommonImages.getImage(TasksUiImages.TASK_RETRIEVE));
- getDescLink.setToolTipText(Messages.TaskPlanningEditor_Retrieve_task_description_from_URL);
- getDescLink.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- setButtonStatus();
-
- issueReportURL.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- setButtonStatus();
- }
-
- public void keyReleased(KeyEvent e) {
- setButtonStatus();
- }
- });
-
- getDescLink.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- retrieveTaskDescription(issueReportURL.getText());
- }
-
- public void linkEntered(HyperlinkEvent e) {
- }
-
- public void linkExited(HyperlinkEvent e) {
- }
- });
-
- openUrlLink = toolkit.createImageHyperlink(urlComposite, SWT.NONE);
- openUrlLink.setImage(CommonImages.getImage(CommonImages.BROWSER_SMALL));
- openUrlLink.setToolTipText(Messages.TaskPlanningEditor_Open_with_Web_Browser);
- openUrlLink.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- openUrlLink.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- TasksUiUtil.openUrl(issueReportURL.getText());
- }
-
- public void linkEntered(HyperlinkEvent e) {
- }
-
- public void linkExited(HyperlinkEvent e) {
- }
- });
-
- toolkit.paintBordersFor(urlComposite);
- toolkit.paintBordersFor(statusComposite);
- }
-
- private TextViewer addTextEditor(TaskRepository repository, Composite parent, String text, boolean spellCheck,
- int style) {
- SourceViewer viewer = new SourceViewer(parent, null, style);
- viewer.configure(new RepositoryTextViewerConfiguration(repository, spellCheck));
- textSupport.configure(viewer, new Document(text), spellCheck);
- viewer.getControl().setMenu(getEditor().getMenu());
- viewer.getTextWidget().setFont(getCommentFont());
- return viewer;
- }
-
- private void markDirty(boolean dirty) {
- if (!dirty) {
- summaryChanged = false;
- }
- isDirty = dirty;
- getManagedForm().dirtyStateChanged();
- }
-
- /**
- * Attempts to set the task pageTitle to the title from the specified url
- */
- protected void retrieveTaskDescription(final String url) {
- AbstractRetrieveTitleFromUrlJob job = new AbstractRetrieveTitleFromUrlJob(issueReportURL.getText()) {
- @Override
- protected void titleRetrieved(String pageTitle) {
- if (summaryEditor != null && summaryEditor.getControl() != null
- && !summaryEditor.getControl().isDisposed()) {
- summaryEditor.getTextWidget().setText(pageTitle);
- TaskPlanningEditor.this.markDirty(true);
- }
- }
- };
- job.schedule();
- }
-
- /**
- * Sets the Get Description button enabled or not depending on whether there is a URL specified
- */
- protected void setButtonStatus() {
- String url = issueReportURL.getText();
-
- if (url.length() > 10 && (url.startsWith("http://") || url.startsWith("https://"))) { //$NON-NLS-1$ //$NON-NLS-2$
- // String defaultPrefix =
- // ContextCore.getPreferenceStore().getString(
- // TaskListPreferenceConstants.DEFAULT_URL_PREFIX);
- // if (url.equals(defaultPrefix)) {
- // getDescButton.setEnabled(false);
- // } else {
- getDescLink.setEnabled(true);
- // }
- } else {
- getDescLink.setEnabled(false);
- }
- }
-
- private void createPlanningSection(Composite parent) {
- Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
- section.setText(Messages.TaskPlanningEditor_Personal_Planning);
- section.setLayout(new GridLayout());
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- section.setExpanded(true);
- section.addExpansionListener(new IExpansionListener() {
- public void expansionStateChanging(ExpansionEvent e) {
- form.reflow(true);
- }
-
- public void expansionStateChanged(ExpansionEvent e) {
- form.reflow(true);
- }
- });
-
- Composite sectionClient = toolkit.createComposite(section);
- section.setClient(sectionClient);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.horizontalSpacing = 15;
- layout.makeColumnsEqualWidth = false;
- sectionClient.setLayout(layout);
- GridData clientDataLayout = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- sectionClient.setLayoutData(clientDataLayout);
-
- Composite nameValueComp = makeComposite(sectionClient, 3);
- Label label = toolkit.createLabel(nameValueComp, Messages.TaskPlanningEditor_Scheduled_for);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- scheduleDatePicker = new ScheduleDatePicker(nameValueComp, task, SWT.FLAT);
- GridData gd = new GridData();
- gd.widthHint = 135;
- scheduleDatePicker.setLayoutData(gd);
- scheduleDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- toolkit.adapt(scheduleDatePicker, false, false);
- toolkit.paintBordersFor(nameValueComp);
-
- scheduleDatePicker.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- scheduleDatePicker.addPickerSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent arg0) {
- TaskPlanningEditor.this.markDirty(true);
- }
- });
-
- ImageHyperlink clearScheduledDate = toolkit.createImageHyperlink(nameValueComp, SWT.NONE);
- clearScheduledDate.setImage(CommonImages.getImage(CommonImages.REMOVE));
- clearScheduledDate.setToolTipText(Messages.TaskPlanningEditor_Clear);
- clearScheduledDate.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- scheduleDatePicker.setScheduledDate(null);
- (task).setReminded(false);
- TaskPlanningEditor.this.markDirty(true);
- }
- });
-
- nameValueComp = makeComposite(sectionClient, 3);
- label = toolkit.createLabel(nameValueComp, Messages.TaskPlanningEditor_Due);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- dueDatePicker = new DatePicker(nameValueComp, SWT.FLAT, DatePicker.LABEL_CHOOSE, true,
- TasksUiPlugin.getDefault().getPreferenceStore().getInt(ITasksUiPreferenceConstants.PLANNING_ENDHOUR));
-
- Calendar calendar = TaskActivityUtil.getCalendar();
-
- if (task.getDueDate() != null) {
- calendar.setTime(task.getDueDate());
- dueDatePicker.setDate(calendar);
- }
-
- dueDatePicker.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- dueDatePicker.addPickerSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- if (!areEqual(dueDatePicker.getDate(), task.getDueDate())) {
- TaskPlanningEditor.this.markDirty(true);
- }
- }
- });
-
- dueDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- toolkit.adapt(dueDatePicker, false, false);
- toolkit.paintBordersFor(nameValueComp);
-
- ImageHyperlink clearDueDate = toolkit.createImageHyperlink(nameValueComp, SWT.NONE);
- clearDueDate.setImage(CommonImages.getImage(CommonImages.REMOVE));
- clearDueDate.setToolTipText(Messages.TaskPlanningEditor_Clear);
- clearDueDate.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- dueDatePicker.setDate(null);
- if (!areEqual(dueDatePicker.getDate(), task.getDueDate())) {
- TaskPlanningEditor.this.markDirty(true);
- }
- }
- });
-
- // disable due date picker if it's a repository due date
- if (task != null) {
- try {
- TaskData taskData = TasksUi.getTaskDataManager().getTaskData(task);
- if (taskData != null) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(taskData.getConnectorKind());
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(
- taskData.getConnectorKind(), taskData.getRepositoryUrl());
- if (connector != null && taskRepository != null
- && connector.hasRepositoryDueDate(taskRepository, task, taskData)) {
- dueDatePicker.setEnabled(false);
- clearDueDate.setEnabled(false);
- }
- }
- } catch (CoreException e) {
- // ignore
- }
- }
-
- // Estimated time
- nameValueComp = makeComposite(sectionClient, 3);
- label = toolkit.createLabel(nameValueComp, Messages.TaskPlanningEditor_Estimated_hours);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-
- estimated = new Spinner(nameValueComp, SWT.FLAT);
- toolkit.adapt(estimated, false, false);
- estimated.setSelection(task.getEstimatedTimeHours());
- estimated.setDigits(0);
- estimated.setMaximum(100);
- estimated.setMinimum(0);
- estimated.setIncrement(1);
- estimated.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- TaskPlanningEditor.this.markDirty(true);
- }
- });
-
- estimated.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- toolkit.paintBordersFor(nameValueComp);
- GridData estimatedDataLayout = new GridData();
- estimatedDataLayout.widthHint = 30;
- estimated.setLayoutData(estimatedDataLayout);
-
- ImageHyperlink clearEstimated = toolkit.createImageHyperlink(nameValueComp, SWT.NONE);
- clearEstimated.setImage(CommonImages.getImage(CommonImages.REMOVE));
- clearEstimated.setToolTipText(Messages.TaskPlanningEditor_Clear);
- clearEstimated.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- estimated.setSelection(0);
- TaskPlanningEditor.this.markDirty(true);
- }
- });
-
- // Active Time
- nameValueComp = makeComposite(sectionClient, 3);
- GridDataFactory.fillDefaults().applyTo(nameValueComp);
-
- label = toolkit.createLabel(nameValueComp, Messages.TaskPlanningEditor_Active);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- label.setToolTipText(Messages.TaskPlanningEditor_Time_working_on_this_task);
-
- String elapsedTimeString = Messages.TaskPlanningEditor_0_seconds;
- try {
- elapsedTimeString = TasksUiInternal.getFormattedDuration(TasksUiPlugin.getTaskActivityManager()
- .getElapsedTime(task), false);
- if (elapsedTimeString.equals("")) { //$NON-NLS-1$
- elapsedTimeString = Messages.TaskPlanningEditor_0_seconds;
- }
- } catch (RuntimeException e) {
- // FIXME what exception is caught here?
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not format elapsed time", e)); //$NON-NLS-1$
- }
-
- final Text elapsedTimeText = toolkit.createText(nameValueComp, elapsedTimeString);
- elapsedTimeText.setText(elapsedTimeString);
-
- GridData td = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- td.grabExcessHorizontalSpace = true;
- elapsedTimeText.setLayoutData(td);
- elapsedTimeText.setEditable(false);
-
- timingListener = new TaskActivityAdapter() {
-
- @Override
- public void elapsedTimeUpdated(ITask task, long newElapsedTime) {
- if (task.equals(TaskPlanningEditor.this.task)) {
- String elapsedTimeString = Messages.TaskPlanningEditor_0_seconds;
- try {
- elapsedTimeString = TasksUiInternal.getFormattedDuration(newElapsedTime, false);
- if (elapsedTimeString.equals("")) { //$NON-NLS-1$
- elapsedTimeString = Messages.TaskPlanningEditor_0_seconds;
- }
-
- } catch (RuntimeException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not format elapsed time", e)); //$NON-NLS-1$
- }
- final String elapsedString = elapsedTimeString;
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-
- public void run() {
- if (!elapsedTimeText.isDisposed()) {
- elapsedTimeText.setText(elapsedString);
- }
- }
- });
-
- }
- }
- };
-
- TasksUiPlugin.getTaskActivityManager().addActivityListener(timingListener);
-
- ImageHyperlink resetActivityTimeButton = toolkit.createImageHyperlink(nameValueComp, SWT.NONE);
- resetActivityTimeButton.setImage(CommonImages.getImage(CommonImages.REMOVE));
- resetActivityTimeButton.setToolTipText(Messages.TaskPlanningEditor_Reset);
- resetActivityTimeButton.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent e) {
- if (MessageDialog.openConfirm(TaskPlanningEditor.this.getSite().getShell(),
- Messages.TaskPlanningEditor_Confirm_Activity_Time_Deletion,
- Messages.TaskPlanningEditor_Do_you_wish_to_reset_your_activity_time_on_this_task_)) {
- MonitorUi.getActivityContextManager().removeActivityTime(task.getHandleIdentifier(), 0l,
- System.currentTimeMillis());
- }
- }
- });
-
- toolkit.paintBordersFor(sectionClient);
- }
-
- private Composite makeComposite(Composite parent, int col) {
- Composite nameValueComp = toolkit.createComposite(parent);
- GridLayout layout = new GridLayout(3, false);
- layout.marginHeight = 3;
- nameValueComp.setLayout(layout);
- return nameValueComp;
- }
-
- private void createNotesSection(Composite parent) {
- Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
- section.setText(Messages.TaskPlanningEditor_Notes);
- section.setExpanded(true);
- section.setLayout(new GridLayout());
- section.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite container = toolkit.createComposite(section);
- section.setClient(container);
- container.setLayout(new GridLayout());
- GridData notesData = new GridData(GridData.FILL_BOTH);
- notesData.grabExcessVerticalSpace = true;
- container.setLayoutData(notesData);
-
- TaskRepository repository = null;
- if (task != null && !(task instanceof LocalTask)) {
- ITask repositoryTask = task;
- repository = TasksUi.getRepositoryManager().getRepository(repositoryTask.getConnectorKind(),
- repositoryTask.getRepositoryUrl());
- }
-
- noteEditor = addTextEditor(repository, container, task.getNotes(), true, SWT.FLAT | SWT.MULTI | SWT.WRAP
- | SWT.V_SCROLL);
- GridDataFactory.fillDefaults().minSize(NOTES_MINSIZE, NOTES_MINSIZE).grab(true, true).applyTo(
- noteEditor.getControl());
- noteEditor.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- noteEditor.setEditable(true);
- noteEditor.addTextListener(new ITextListener() {
- public void textChanged(TextEvent event) {
- if (!task.getNotes().equals(noteEditor.getTextWidget().getText())) {
- markDirty(true);
- }
- }
- });
-
- toolkit.paintBordersFor(container);
- }
-
- private Font getCommentFont() {
- IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
- Font font = themeManager.getCurrentTheme().getFontRegistry().get(CommonThemes.FONT_EDITOR_COMMENT);
- return font;
- }
-
- private String getTaskDateString(ITask task) {
- if (task == null) {
- return ""; //$NON-NLS-1$
- }
- if (task.getCompletionDate() == null) {
- return ""; //$NON-NLS-1$
- }
-
- String completionDateString = ""; //$NON-NLS-1$
- try {
- completionDateString = DateFormat.getDateInstance(DateFormat.LONG).format(task.getCompletionDate());
- } catch (RuntimeException e) {
- // FIXME what exception is caught here?
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not format date", e)); //$NON-NLS-1$
- return completionDateString;
- }
- return completionDateString;
- }
-
- @Override
- public void dispose() {
- if (textSupport != null) {
- textSupport.dispose();
- }
- if (timingListener != null) {
- TasksUiPlugin.getTaskActivityManager().removeActivityListener(timingListener);
- }
- TasksUiInternal.getTaskList().removeChangeListener(TASK_LIST_LISTENER);
- }
-
- @Override
- public String toString() {
- return Messages.TaskPlanningEditor__info_editor_for_task_ + task + ")"; //$NON-NLS-1$
- }
-
- /** for testing - should cause dirty state */
- public void setNotes(String notes) {
- this.noteEditor.getTextWidget().setText(notes);
- }
-
- /** for testing - should cause dirty state */
- public void setDescription(String desc) {
- this.summaryEditor.getTextWidget().setText(desc);
- }
-
- /** for testing */
- public String getDescription() {
- return this.summaryEditor.getTextWidget().getText();
- }
-
- private boolean areEqual(Object oldValue, Object newValue) {
- return (oldValue != null) ? oldValue.equals(newValue) : oldValue == newValue;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskRelationHyperlinkDetector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskRelationHyperlinkDetector.java
deleted file mode 100644
index ee5ca57b8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskRelationHyperlinkDetector.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractTaskHyperlinkDetector;
-import org.eclipse.mylyn.tasks.ui.TaskHyperlink;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskRelationHyperlinkDetector extends AbstractTaskHyperlinkDetector {
-
- private static Pattern HYPERLINK_PATTERN = Pattern.compile("([^\\s,]+)"); //$NON-NLS-1$
-
- @Override
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
- if (region.getLength() > 0) {
- return super.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks);
- } else {
- if (textViewer.getDocument() == null) {
- return null;
- }
-
- TaskRepository taskRepository = getTaskRepository(textViewer);
- if (taskRepository != null) {
- String prefix = extractPrefix(textViewer, region.getOffset());
- String postfix = extractPostfix(textViewer, region.getOffset());
- String taskKey = prefix + postfix;
- if (taskKey.length() > 0) {
- Region hyperlinkRegion = new Region(region.getOffset() - prefix.length(), taskKey.length());
- return new IHyperlink[] { new TaskHyperlink(hyperlinkRegion, taskRepository, taskKey) };
- }
- }
- }
- return null;
- }
-
- @Override
- protected List<IHyperlink> detectHyperlinks(ITextViewer textViewer, String content, int index, int contentOffset) {
- List<IHyperlink> links = null;
- for (TaskRepository repository : getTaskRepositories(textViewer)) {
- Matcher m = HYPERLINK_PATTERN.matcher(content);
- while (m.find()) {
- if (links == null) {
- links = new ArrayList<IHyperlink>();
- }
- Region region = new Region(contentOffset + m.start(), m.end() - m.start());
- links.add(new TaskHyperlink(region, repository, m.group()));
- }
- }
- return links;
- }
-
- private String extractPrefix(ITextViewer viewer, int offset) {
- int i = offset;
- IDocument document = viewer.getDocument();
- if (i > document.getLength()) {
- return ""; //$NON-NLS-1$
- }
-
- try {
- if (isSeparator(document.getChar(i))) {
- return ""; //$NON-NLS-1$
- }
- while (i > 0) {
- char ch = document.getChar(i - 1);
- if (isSeparator(ch)) {
- break;
- }
- i--;
- }
- return document.get(i, offset - i);
- } catch (BadLocationException e) {
- return ""; //$NON-NLS-1$
- }
- }
-
- private String extractPostfix(ITextViewer viewer, int offset) {
- int i = offset;
- IDocument document = viewer.getDocument();
- int length = document.getLength();
- if (i > length) {
- return ""; //$NON-NLS-1$
- }
-
- try {
- if (isSeparator(document.getChar(i))) {
- return ""; //$NON-NLS-1$
- }
- while (i < length - 1) {
- char ch = document.getChar(i + 1);
- if (isSeparator(ch)) {
- break;
- }
- i++;
- }
- return document.get(offset, i - offset + 1);
- } catch (BadLocationException e) {
- }
- return ""; //$NON-NLS-1$
- }
-
- private boolean isSeparator(char ch) {
- return Character.isWhitespace(ch) || ch == ',';
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlink.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlink.java
deleted file mode 100644
index 8ba190b74..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlink.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.hyperlink.URLHyperlink;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-
-/**
- * @author Rob Elves
- */
-public class TaskUrlHyperlink extends URLHyperlink {
-
- public TaskUrlHyperlink(IRegion region, String urlString) {
- super(region, urlString);
- }
-
- @Override
- public void open() {
- TasksUiUtil.openTask(getURLString());
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java
deleted file mode 100644
index 27b288e09..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskUrlHyperlinkDetector.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * David Green - fix for bug 266693
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-
-/**
- * Source from {@link org.eclipse.jface.text.hyperlink.URLHyperlinkDetector}. Returns hyperlinks that use
- * {@link TasksUiUtil} to open urls.
- *
- * @author Rob Elves
- */
-public class TaskUrlHyperlinkDetector extends AbstractHyperlinkDetector {
-
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
- if (region == null || textViewer == null) {
- return null;
- }
-
- IDocument document = textViewer.getDocument();
-
- int offset = region.getOffset();
- if (document == null) {
- return null;
- }
-
- IRegion lineInfo;
- String line;
- try {
- lineInfo = document.getLineInformationOfOffset(offset);
- line = document.get(lineInfo.getOffset(), lineInfo.getLength());
- } catch (BadLocationException ex) {
- return null;
- }
-
- int offsetInLine = offset - lineInfo.getOffset();
-
- return findHyperlinks(line, offsetInLine, lineInfo.getOffset(), region.getLength());
- }
-
- private IHyperlink[] findHyperlinks(String line, int offsetInLine, int offset, int regionLength) {
- char doubleChar = ' ';
-
- String urlString = null;
- boolean startDoubleQuote = false;
- int urlOffsetInLine = 0;
- int urlLength = 0;
-
- int urlSeparatorOffset = line.indexOf("://"); //$NON-NLS-1$
- while (urlSeparatorOffset >= 0) {
-
- // URL protocol (left to "://")
- urlOffsetInLine = urlSeparatorOffset;
- char ch;
- do {
- urlOffsetInLine--;
- ch = ' ';
- if (urlOffsetInLine > -1) {
- ch = line.charAt(urlOffsetInLine);
- }
- } while (Character.isUnicodeIdentifierStart(ch));
- urlOffsetInLine++;
-
- switch (ch) {
- case '"':
- doubleChar = '"';
- break;
- case '\'':
- doubleChar = '\'';
- break;
- case '[':
- doubleChar = ']';
- break;
- case '(':
- doubleChar = ')';
- break;
- case '{':
- doubleChar = '}';
- break;
-
- default:
- doubleChar = ' ';
- break;
- }
- startDoubleQuote = doubleChar != ' ';
-
- // Right to "://"
- StringTokenizer tokenizer = new StringTokenizer(line.substring(urlSeparatorOffset + 3),
- " \t\n\r\f<>", false); //$NON-NLS-1$
- if (!tokenizer.hasMoreTokens()) {
- return null;
- }
-
- urlLength = tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffsetInLine;
- if ((regionLength == 0 && offsetInLine >= urlOffsetInLine && offsetInLine <= urlOffsetInLine + urlLength)
- || ((regionLength > 0 && offsetInLine <= urlOffsetInLine && (offsetInLine + regionLength) > urlOffsetInLine))) {
- // region length of 0 and offset hits within the hyperlink url
- // OR
- // region spans the start of the hyperlink url.
- break;
- }
-
- urlSeparatorOffset = line.indexOf("://", urlSeparatorOffset + 1); //$NON-NLS-1$
- }
-
- if (urlSeparatorOffset < 0) {
- return null;
- }
-
- if (startDoubleQuote) {
- int endOffset = -1;
- int nextDoubleQuote = line.indexOf(doubleChar, urlOffsetInLine);
- int nextWhitespace = line.indexOf(' ', urlOffsetInLine);
- if (nextDoubleQuote != -1 && nextWhitespace != -1) {
- endOffset = Math.min(nextDoubleQuote, nextWhitespace);
- } else if (nextDoubleQuote != -1) {
- endOffset = nextDoubleQuote;
- } else if (nextWhitespace != -1) {
- endOffset = nextWhitespace;
- }
- if (endOffset != -1) {
- urlLength = endOffset - urlOffsetInLine;
- }
- }
-
- // Set and validate URL string
- try {
- char lastChar = line.charAt(urlOffsetInLine + urlLength - 1);
- if (lastChar == ',' || lastChar == '.') {
- urlLength--;
- }
- if (urlLength > 0) {
- lastChar = line.charAt(urlOffsetInLine + urlLength - 1);
- if (lastChar == ')') {
- urlLength--;
- }
- }
- urlString = line.substring(urlOffsetInLine, urlOffsetInLine + urlLength);
- new URL(urlString);
- } catch (MalformedURLException ex) {
- urlString = null;
- return null;
- }
-
- IRegion urlRegion = new Region(offset + urlOffsetInLine, urlLength);
- return new IHyperlink[] { new TaskUrlHyperlink(urlRegion, urlString) };
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java
deleted file mode 100644
index 59cef686e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- */
-public class TextAttributeEditor extends AbstractAttributeEditor {
-
- private Text text;
-
- public TextAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE));
- }
-
- protected Text getText() {
- return text;
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- if (isReadOnly()) {
- text = new Text(parent, SWT.FLAT | SWT.READ_ONLY);
- text.setFont(EditorUtil.TEXT_FONT);
- text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
- text.setText(getValue());
- } else {
- text = toolkit.createText(parent, getValue(), SWT.FLAT);
- text.setFont(EditorUtil.TEXT_FONT);
- text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.TRUE);
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setValue(text.getText());
- EditorUtil.ensureVisible(text);
- }
- });
- }
- toolkit.adapt(text, false, false);
- setControl(text);
- }
-
- public String getValue() {
- return getAttributeMapper().getValue(getTaskAttribute());
- }
-
- public void setValue(String text) {
- getAttributeMapper().setValue(getTaskAttribute(), text);
- attributeChanged();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TraverseOnTabKeyListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TraverseOnTabKeyListener.java
deleted file mode 100644
index 3d21fd125..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TraverseOnTabKeyListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.editors;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.VerifyEvent;
-
-class TraverseOnTabKeyListener implements VerifyKeyListener {
-
- public void verifyKey(VerifyEvent event) {
- // if there is a tab key, do not "execute" it and instead traverse to the next control
- if (event.keyCode == SWT.TAB) {
- event.doit = false;
- }
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
deleted file mode 100644
index b9bbf02dd..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
+++ /dev/null
@@ -1,150 +0,0 @@
-AbstractReplyToCommentAction_Reply=Reply
-
-AttachmentSizeFormatter_0_bytes=0 bytes
-AttachmentSizeFormatter_0_GB=0.00 GB
-AttachmentSizeFormatter_0_KB=0.00 KB
-AttachmentSizeFormatter_0_MB=0.00 MB
-AttachmentSizeFormatter_1_byte=1 byte
-
-AttachmentTableLabelProvider_File_=File:
-AttachmentTableLabelProvider_Patch=\ Patch
-AttachmentTableLabelProvider_Task_Context=\ Task Context
-AttachmentTableLabelProvider_Type_=Type:
-BrowserPreviewViewer_Error=Error
-BrowserPreviewViewer_Formatting_Wiki_Text=Formatting Wiki Text
-BrowserPreviewViewer_Loading_preview_=Loading preview...
-BrowserPreviewViewer_The_repository_does_not_support_HTML_preview=The repository does not support HTML preview.
-
-CategoryEditor_Category_Summary=Category Summary
-CategoryEditor_Description_=Description:
-CategoryEditor_URL_=URL:
-
-CategoryEditorInput_Category_Editor=Category Editor
-
-CommentGroupStrategy_Current=Current
-CommentGroupStrategy_Older=Older
-CommentGroupStrategy_Recent=Recent
-
-DateAttributeEditor_Clear=Clear
-
-PlanningPageFactory_Planning=Planning
-
-PreviewAttributeEditor_Edit=Edit
-PreviewAttributeEditor_Error=Error
-PreviewAttributeEditor_Formatting_Wiki_Text=Formatting Wiki Text
-PreviewAttributeEditor_Loading_preview_=Loading preview...
-PreviewAttributeEditor_Preview=Preview
-
-RichTextAttributeEditor_Viewer_Source=View Unformatted Text
-
-TaskAttachmentDropListener_Note_that_only_the_first_file_dragged_will_be_attached=Note that only the first file dragged will be attached.
-TaskEditorActionContributor_Add_to_X=Add to {0}
-
-TaskEditorActionPart_Actions=Actions
-TaskEditorActionPart_Add_to_Category=Add to Category
-TaskEditorActionPart_Attach_Context=Attach Context
-TaskEditorActionPart_Submit=Submit
-TaskEditorActionPart_Submit_to_X=Submit to {0}
-TaskEditorAttachmentPart_Attach_=Attach...
-TaskEditorAttachmentPart_Attach__Screenshot=Attach Screenshot...
-TaskEditorAttachmentPart_Attachments=Attachments
-TaskEditorAttachmentPart_Created=Created
-TaskEditorAttachmentPart_Creator=Creator
-TaskEditorAttachmentPart_Description=Description
-TaskEditorAttachmentPart_Name=Name
-TaskEditorAttachmentPart_No_attachments=No attachments
-TaskEditorAttachmentPart_Size=Size
-
-TaskEditorAttributePart_Attributes=Attributes
-TaskEditorAttributePart_Refresh_Attributes=Refresh Attributes
-TaskEditorAttributePart_Update_Failed=Update Failed
-TaskEditorAttributePart_Updating_of_repository_configuration_failed=Updating of repository configuration failed
-
-TaskEditorCommentPart_0=\ (
-TaskEditorCommentPart_1=)
-TaskEditorCommentPart_Collapse_Comments=Collapse Comments
-TaskEditorCommentPart_Comments=Comments
-TaskEditorCommentPart_Expand_Comments=Expand Comments
-
-TaskEditorDescriptionPart_Description=Description
-TaskEditorDescriptionPart_Detector=Detector:
-TaskEditorDescriptionPart_Duplicate_Detection_Failed=Duplicate Detection Failed
-TaskEditorDescriptionPart_Duplicate_Detection=Duplicate Detection
-TaskEditorDescriptionPart_The_duplicate_detector_did_not_return_a_valid_query=The duplicate detector did not return a valid query.
-TaskEditorDescriptionPart_Search=Search
-
-TaskEditorNewCommentPart_New_Comment=New Comment
-TaskEditorOutlineNode_Comments=Comments
-TaskEditorOutlineNode_Description=Description
-TaskEditorOutlineNode_New_Comment=New Comment
-TaskEditorOutlineNode_Task_=Task
-
-TaskEditorPeoplePart_People=People
-
-TaskEditorPlanningPart_0_SECOUNDS=0 seconds
-TaskEditorPlanningPart_Active=Active:
-TaskEditorPlanningPart_Clear=Clear
-TaskEditorPlanningPart_Confirm_Activity_Time_Deletion=Confirm Activity Time Deletion
-TaskEditorPlanningPart_Do_you_wish_to_reset_your_activity_time_on_this_task_=Do you wish to reset your activity time on this task?\n\nThis will take immediate affect and can not be undone.
-TaskEditorPlanningPart_Due=Due:
-TaskEditorPlanningPart_Estimated=Estimated:
-TaskEditorPlanningPart_Personal_Planning=Personal Planning
-TaskEditorPlanningPart_Reset=Reset
-TaskEditorPlanningPart_Scheduled=Scheduled:
-TaskEditorPlanningPart_Time_working_on_this_task=Time working on this task
-
-TaskEditorRichTextPart_Browser_Preview=Browser Preview
-TaskEditorRichTextPart_Maximize=Maximize
-TaskEditorRichTextPart_Preview=Preview
-
-TaskEditorSummaryPart_Summary=Summary
-
-TaskPlanningEditor_0_seconds=0 seconds
-TaskPlanningEditor_Active=Active:
-TaskPlanningEditor_Clear=Clear
-TaskPlanningEditor_Complete=Complete
-TaskPlanningEditor_Completed=Completed:
-TaskPlanningEditor_Confirm_Activity_Time_Deletion=Confirm Activity Time Deletion
-TaskPlanningEditor_Created=Created:
-TaskPlanningEditor_Do_you_wish_to_reset_your_activity_time_on_this_task_=Do you wish to reset your activity time on this task?\n\nThis will take immediate affect and can not be undone.
-TaskPlanningEditor_Due=Due:
-TaskPlanningEditor_Estimated_hours=Estimated hours:
-TaskPlanningEditor_Incomplete=Incomplete
-TaskPlanningEditor__info_editor_for_task_=(info editor for task:
-TaskPlanningEditor_Notes=Notes
-TaskPlanningEditor_Open_with_Web_Browser=Open with Web Browser
-TaskPlanningEditor_Personal_Planning=Personal Planning
-TaskPlanningEditor_Planning=Planning
-TaskPlanningEditor_Priority=Priority:
-TaskPlanningEditor_Reset=Reset
-TaskPlanningEditor_Retrieve_task_description_from_URL=Retrieve task description from URL
-TaskPlanningEditor_Scheduled_for=Scheduled for:
-TaskPlanningEditor_Status=Status:
-TaskPlanningEditor_Time_working_on_this_task=Time working on this task
-TaskPlanningEditor_URL=URL:
-
-AbstractTaskEditorPage_Comment_required=Comment required
-AbstractTaskEditorPage_Could_not_save_task=Could not save task
-AbstractTaskEditorPage_Error_opening_task=Error opening task
-AbstractTaskEditorPage_Failed_to_read_task_data_=Failed to read task data:
-AbstractTaskEditorPage_History=History
-AbstractTaskEditorPage_Open_failed=Open failed
-AbstractTaskEditorPage_Open_with_Web_Browser=Open with Web Browser
-AbstractTaskEditorPage_Save_failed=Save failed
-AbstractTaskEditorPage_Submit_failed=Submit failed
-AbstractTaskEditorPage_Submit_failed_=Submit failed:
-AbstractTaskEditorPage_Synchronize_to_retrieve_task_data=Synchronize to retrieve task data
-AbstractTaskEditorPage_Synchronize_to_update_editor_contents=Synchronize to update editor contents
-AbstractTaskEditorPage_Add_task_to_tasklist=Not in Task List. Click to add.
-AbstractTaskEditorPage_Task_has_incoming_changes=Task has incoming changes
-AbstractTaskEditorPage_Title=Title
-AbstractTaskEditorPage_Unable_to_submit_at_this_time=Unable to submit at this time. Check connectivity and retry.
-
-AttributeEditorToolkit_Content_Assist_Available__X_=Content Assist Available ({0})
-TaskEditor_Task_=Task:
-TaskEditor_Task_added_to_the_Uncategorized_container=Task added to the Uncategorized container
-
-TaskEditorExtensionSettingsContribution__default_=\ (default)
-TaskEditorExtensionSettingsContribution_Editor=Task Editor Settings
-TaskEditorExtensionSettingsContribution_Plain_Text=Plain Text
-TaskEditorExtensionSettingsContribution_Select_the_capabilities_of_the_task_editor=Select the capabilities of the task editor
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
deleted file mode 100644
index 75471b50e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
+++ /dev/null
@@ -1,86 +0,0 @@
-ActivityExternalizationParticipant_Activity_Context=Activity Context
-
-AddExistingTaskJob_Adding_task_X_=Adding task: "{0}"...
-ChangeActivityHandleOperation_Activity_migration=Activity migration
-
-DialogErrorReporter_Mylyn_Error=Mylyn Error
-DialogErrorReporter_Please_report_the_following_error_at=Please report the following error at:\n\
-\n\
-http://bugs.eclipse.org/bugs/enter_bug.cgi?product=Mylyn\n\
-\n\
-Or via the popup menu in the Error Log view (see Window -> Show View)
-
-MoveToCategoryMenuContributor_Move_to=Move to
-
-OpenRepositoryTaskJob_Could_not_find_repository_configuration_for_X=Could not find repository configuration for {0}.
-OpenRepositoryTaskJob_Opening_Remote_Task=Opening Remote Task
-OpenRepositoryTaskJob_Opening_repository_task_X=Opening repository task {0}
-OpenRepositoryTaskJob_Please_set_up_repository_via_X=Please set up repository via {0}.
-OpenRepositoryTaskJob_Repository_Not_Found=Repository Not Found
-OpenRepositoryTaskJob_Unable_to_open_task=Unable to open task
-
-RefactorRepositoryUrlOperation_Repository_URL_update=Repository URL update
-
-ScheduleTaskMenuContributor_Cannot_schedule_completed_tasks=Cannot schedule completed tasks
-ScheduleTaskMenuContributor_Choose_Date_=Choose Date...
-ScheduleTaskMenuContributor_Future=Future
-ScheduleTaskMenuContributor_Not_Scheduled=Not Scheduled
-ScheduleTaskMenuContributor_Schedule_for=Schedule for
-
-TaskHistoryDropDown_Activate_Task_=Activate Task...
-TaskHistoryDropDown_Deactivate_Task=Deactivate Task
-
-TaskJobFactory_Receiving_configuration=Receiving configuration
-TaskJobFactory_Refreshing_repository_configuration=Refreshing repository configuration
-
-TaskLabelDecorator____unknown_host___=\ \ \ [ <unknown host> ]
-
-TaskListBackupManager_Could_not_backup_task_data=Could not backup task data. Check backup preferences.\n
-TaskListBackupManager_Error_occured_during_scheduled_tasklist_backup=Error occured during scheduled tasklist backup.\nCheck settings on Tasklist preferences page.
-TaskListBackupManager_Scheduled_task_data_backup=Scheduled task data backup
-TaskListBackupManager_Tasklist_Backup=Tasklist Backup
-
-TaskListNotificationManager_Open_Notification_Job=Open Notification Job
-
-TaskRepositoryLocationUi_Enter_HTTP_password=Enter HTTP password
-TaskRepositoryLocationUi_Enter_proxy_password=Enter proxy password
-TaskRepositoryLocationUi_Enter_repository_password=Enter repository password
-
-TaskSearchPage_ERROR_Unable_to_present_query_page=ERROR: Unable to present query page, ensure repository configuration is valid and retry
-
-TaskSearchPage_No_task_found_matching_key_=No task found matching key:
-TaskSearchPage_Repository_Search=Repository Search
-TaskSearchPage_Select_Repository_=Se&lect Repository:
-TaskSearchPage_Task_Key_ID=Task Key/ID:
-TaskSearchPage_Task_Search=Task Search
-
-TasksReminderDialog_Description=Description
-TasksReminderDialog_Dismiss_All=Dismiss All
-TasksReminderDialog_Dismiss_Selected=Dismiss Selected
-TasksReminderDialog_Priority=Priority
-TasksReminderDialog_Remind_tommorrow=Remind tomorrow
-TasksReminderDialog_Reminder_Day=Reminder Day
-TasksReminderDialog_Reminders=Reminders
-
-TasksUiMessages_Task_Editor=Task Editor
-
-TasksUiPlugin_Initializing_Task_List=Initializing Task List
-TasksUiPlugin_Task_Repositories=Task Repositories
-TasksUiPlugin_Load_Data_Directory=Load Data Directory
-
-TaskTrimWidget__no_active_task_=<no active task>
-TaskTrimWidget__no_task_active_=<no task active>
-
-AbstractRepositoryConnectorUi_Task=Task
-
-TaskElementLabelProvider__no_summary_available_=: <no summary available>
-TaskHyperlink_Could_not_determine_repository_for_report=Could not determine repository for report
-TaskHyperlink_Open_Task_X_in_X=Open Task {0} in {1}
-TasksUiUtil_Browser_could_not_be_initiated=Browser could not be initiated
-TasksUiUtil_Browser_init_error=Browser init error
-TasksUiUtil_Could_not_open_URL_=Could not open URL:
-TasksUiUtil_create_task=Create Task
-TasksUiUtil_failed_to_create_new_task=Failed to create new task:\n\n
-TasksUiUtil_No_URL_to_open=No URL to open.
-
-AbstractRetrieveTitleFromUrlJob_Retrieving_summary_from_URL=Retrieving summary from URL
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/Messages.java
deleted file mode 100644
index 8b9d50d42..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/Messages.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.notifications.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String TaskDataDiff_more_;
-
- public static String TaskDiffUtil_attachment;
-
- public static String TaskDiffUtil_Comment_by_X;
-
- public static String TaskDiffUtil_Unknown;
-
- public static String TaskListNotificationPopup_Mark_Task_Read;
-
- public static String TaskListNotificationPopup_more;
-
- public static String TaskListNotifier_New_unread_task;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskAttributeDiff.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskAttributeDiff.java
deleted file mode 100644
index f7c0deff4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskAttributeDiff.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskAttributeDiff {
-
- private String attributeId;
-
- private final TaskAttribute newAttribute;
-
- private final List<String> newValues;
-
- private final TaskAttribute oldAttribute;
-
- private final List<String> oldValues;
-
- public TaskAttributeDiff(TaskAttribute oldAttribute, TaskAttribute newAttribute) {
- Assert.isTrue(oldAttribute != null || newAttribute != null);
- this.oldAttribute = oldAttribute;
- this.newAttribute = newAttribute;
- if (oldAttribute != null) {
- this.oldValues = oldAttribute.getTaskData().getAttributeMapper().getValueLabels(oldAttribute);
- this.attributeId = oldAttribute.getId();
- } else {
- this.oldValues = Collections.emptyList();
- }
- if (newAttribute != null) {
- this.newValues = newAttribute.getTaskData().getAttributeMapper().getValueLabels(newAttribute);
- this.attributeId = newAttribute.getId();
- } else {
- this.newValues = Collections.emptyList();
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TaskAttributeDiff other = (TaskAttributeDiff) obj;
- if (attributeId == null) {
- if (other.attributeId != null) {
- return false;
- }
- } else if (!attributeId.equals(other.attributeId)) {
- return false;
- }
- return true;
- }
-
- public List<String> getAddedValues() {
- List<String> result = new ArrayList<String>(getNewValues());
- if (getOldValues() != null) {
- result.removeAll(getOldValues());
- }
- return result;
- }
-
- public TaskAttribute getNewAttribute() {
- return newAttribute;
- }
-
- public List<String> getNewValues() {
- return newValues;
- }
-
- public TaskAttribute getOldAttribute() {
- return oldAttribute;
- }
-
- public List<String> getOldValues() {
- return oldValues;
- }
-
- public List<String> getRemovedValues() {
- List<String> result = new ArrayList<String>(getOldValues());
- if (getNewValues() != null) {
- result.removeAll(getNewValues());
- }
- return result;
- }
-
- public boolean hasChanges() {
- return !oldValues.equals(newValues);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((attributeId == null) ? 0 : attributeId.hashCode());
- return result;
- }
-
- public String getLabel() {
- if (newAttribute != null) {
- return newAttribute.getTaskData().getAttributeMapper().getLabel(newAttribute);
- } else {
- return oldAttribute.getTaskData().getAttributeMapper().getLabel(oldAttribute);
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDataDiff.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDataDiff.java
deleted file mode 100644
index 23a756790..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDataDiff.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskDataDiff {
-
- private static final int MAX_CHANGED_ATTRIBUTES = 2;
-
- private final String[] ATTRIBUTES_IDS = new String[] { TaskAttribute.SUMMARY, TaskAttribute.DESCRIPTION,
- TaskAttribute.PRODUCT, TaskAttribute.PRIORITY, TaskAttribute.USER_ASSIGNED, TaskAttribute.STATUS, };
-
- private final TaskData newTaskData;
-
- private final TaskData oldTaskData;
-
- private final Set<ITaskComment> newComments = new LinkedHashSet<ITaskComment>();
-
- private final Set<TaskAttributeDiff> changedAttributes = new LinkedHashSet<TaskAttributeDiff>();
-
- private final RepositoryModel repositoryModel;
-
- public TaskDataDiff(RepositoryModel repositoryModel, TaskData newTaskData, TaskData oldTaskData) {
- Assert.isNotNull(repositoryModel);
- Assert.isNotNull(newTaskData);
- this.repositoryModel = repositoryModel;
- this.newTaskData = newTaskData;
- this.oldTaskData = oldTaskData;
- parse();
- }
-
- public Collection<ITaskComment> getNewComments() {
- return newComments;
- }
-
- public Collection<TaskAttributeDiff> getChangedAttributes() {
- return changedAttributes;
- }
-
- private void parse() {
- for (String attributeId : ATTRIBUTES_IDS) {
- TaskAttribute newAttribute = newTaskData.getRoot().getMappedAttribute(attributeId);
- TaskAttribute oldAttribute = null;
- if (oldTaskData != null) {
- oldAttribute = oldTaskData.getRoot().getMappedAttribute(attributeId);
- }
- if (oldAttribute == null && newAttribute == null) {
- continue;
- }
- addChangedAttribute(oldAttribute, newAttribute, true);
- }
-
- // other attributes that have changed on newTaskData
- for (TaskAttribute newAttribute : newTaskData.getRoot().getAttributes().values()) {
- TaskAttribute oldAttribute = null;
- if (oldTaskData != null) {
- oldAttribute = oldTaskData.getRoot().getMappedAttribute(newAttribute.getPath());
- }
- addChangedAttribute(oldAttribute, newAttribute, false);
- }
- // other attributes that have been removed from newTaskData
- if (oldTaskData != null) {
- for (TaskAttribute oldAttribute : oldTaskData.getRoot().getAttributes().values()) {
- TaskAttribute newAttribute = newTaskData.getRoot().getMappedAttribute(oldAttribute.getPath());
- if (newAttribute == null) {
- addChangedAttribute(oldAttribute, newAttribute, false);
- }
- }
- }
- }
-
- private void addChangedAttribute(TaskAttribute oldAttribute, TaskAttribute newAttribute, boolean ignoreKind) {
- TaskAttribute attribute;
- if (newAttribute != null) {
- attribute = newAttribute;
- } else {
- attribute = oldAttribute;
- }
- String type = attribute.getMetaData().getType();
- if (TaskAttribute.TYPE_COMMENT.equals(type)) {
- addChangedComment(oldAttribute, newAttribute);
- } else if (TaskAttribute.TYPE_OPERATION.equals(type)) {
- // ignore
- } else if (ignoreKind || attribute.getMetaData().getKind() != null) {
- TaskAttributeDiff diff = new TaskAttributeDiff(oldAttribute, newAttribute);
- if (diff.hasChanges()) {
- changedAttributes.add(diff);
- }
- }
- }
-
- private void addChangedComment(TaskAttribute oldAttribute, TaskAttribute newAttribute) {
- if (oldAttribute == null) {
- ITaskComment comment = repositoryModel.createTaskComment(newAttribute);
- if (comment != null) {
- newComments.add(comment);
- }
- }
- }
-
- @Override
- public String toString() {
- return toString(60);
- }
-
- // TODO implement trim based on text width
- public String toString(int maxWidth) {
- StringBuilder sb = new StringBuilder();
- String sep = ""; //$NON-NLS-1$
- // append first comment
- int newCommentCount = newComments.size();
- if (newCommentCount > 0) {
- ITaskComment comment = newComments.iterator().next();
- sb.append(TaskDiffUtil.trim(TaskDiffUtil.commentToString(comment), 60));
- if (newCommentCount > 1) {
- sb.append(" (" + (newCommentCount - 1) + Messages.TaskDataDiff_more_); //$NON-NLS-1$
- }
- sep = "\n"; //$NON-NLS-1$
- }
- // append changed attributes
- int n = 0;
- for (TaskAttributeDiff attributeDiff : changedAttributes) {
- String label = attributeDiff.getLabel();
- if (label != null) {
- sb.append(sep);
- sb.append(" "); //$NON-NLS-1$
- sb.append(label);
- sb.append(" "); //$NON-NLS-1$
- sb.append(TaskDiffUtil.trim(TaskDiffUtil.listToString(attributeDiff.getRemovedValues()), 28));
- sb.append(" -> "); //$NON-NLS-1$
- sb.append(TaskDiffUtil.trim(TaskDiffUtil.listToString(attributeDiff.getAddedValues()), 28));
- if (++n == MAX_CHANGED_ATTRIBUTES) {
- break;
- }
- sep = "\n"; //$NON-NLS-1$
- }
- }
- return sb.toString();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDiffUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDiffUtil.java
deleted file mode 100644
index 15d99876e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskDiffUtil.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Drawable;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskDiffUtil {
-
- private static final String ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026"
-
- private static int DRAW_FLAGS = SWT.DRAW_MNEMONIC | SWT.DRAW_TAB | SWT.DRAW_TRANSPARENT | SWT.DRAW_DELIMITER;
-
- public static String commentToString(ITaskComment comment) {
- StringBuilder sb = new StringBuilder();
- sb.append(MessageFormat.format(Messages.TaskDiffUtil_Comment_by_X, personToString(comment.getAuthor())));
- sb.append(": "); //$NON-NLS-1$
- sb.append(cleanCommentText(comment.getText()));
- return sb.toString();
- }
-
- private static String personToString(IRepositoryPerson author) {
- if (author == null) {
- return Messages.TaskDiffUtil_Unknown;
- } else if (author.getName() != null) {
- return author.getName();
- }
- return author.getPersonId();
- }
-
- public static String cleanCommentText(String value) {
- String text = ""; //$NON-NLS-1$
- String[] lines = value.split("\n"); //$NON-NLS-1$
- boolean attachment = false;
- boolean needSeparator = false;
- for (String line : lines) {
- // skip comments and info lines
- if (attachment) {
- text += Messages.TaskDiffUtil_attachment + line;
- needSeparator = true;
- attachment = false;
- } else if (line.startsWith(">") // //$NON-NLS-1$
- || line.matches("^\\s*\\(In reply to comment.*")) { //$NON-NLS-1$
- needSeparator = true;
- continue;
- } else if (line.startsWith("Created an attachment (id=")) { //$NON-NLS-1$
- attachment = true;
- } else {
- if (needSeparator) {
- if (!text.matches(".*\\p{Punct}\\s*")) { //$NON-NLS-1$
- text = text.trim();
- if (text.length() > 0) {
- text += "."; //$NON-NLS-1$
- }
- }
- }
- text += " " + line; //$NON-NLS-1$
- attachment = false;
- needSeparator = false;
- }
- }
- return foldSpaces(text);
- }
-
- public static String listToString(List<String> values) {
- if (values == null) {
- return ""; //$NON-NLS-1$
- }
-
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- for (String value : values) {
- if (!first) {
- sb.append(", "); //$NON-NLS-1$
- } else {
- first = false;
- }
- sb.append(foldSpaces(value));
- }
- return sb.toString();
- }
-
- public static String foldSpaces(String value) {
- return value.replaceAll("\\s+", " ").trim(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public static String trim(String value, int length) {
- if (value.length() > length) {
- value = value.substring(0, length - 3) + "..."; //$NON-NLS-1$
- }
- return value;
- }
-
- /**
- * Note: Copied from CLabel.
- *
- * Shorten the given text <code>t</code> so that its length doesn't exceed the given width. The default
- * implementation replaces characters in the center of the original string with an ellipsis ("..."). Override if you
- * need a different strategy.
- *
- * @param gc
- * the gc to use for text measurement
- * @param t
- * the text to shorten
- * @param width
- * the width to shorten the text to, in pixels
- * @return the shortened text
- */
- public static final String shortenText2(Composite composite, String t, int width) {
- GC gc = new GC(composite);
-
- if (t == null) {
- return null;
- }
- int w = gc.textExtent(ELLIPSIS, DRAW_FLAGS).x;
- if (width <= w) {
- return t;
- }
- int l = t.length();
- int max = l / 2;
- int min = 0;
- int mid = (max + min) / 2 - 1;
- if (mid <= 0) {
- return t;
- }
- while (min < mid && mid < max) {
- String s1 = t.substring(0, mid);
- String s2 = t.substring(l - mid, l);
- int l1 = gc.textExtent(s1, DRAW_FLAGS).x;
- int l2 = gc.textExtent(s2, DRAW_FLAGS).x;
- if (l1 + w + l2 > width) {
- max = mid;
- mid = (max + min) / 2;
- } else if (l1 + w + l2 < width) {
- min = mid;
- mid = (max + min) / 2;
- } else {
- min = max;
- }
- }
-
- gc.dispose();
-
- if (mid == 0) {
- return t;
- }
- return t.substring(0, mid) + ELLIPSIS + t.substring(l - mid, l);
- }
-
- // From PerspectiveBarContributionItem
- public static String shortenText(Drawable composite, String text, int maxWidth) {
- String returnText = text;
- GC gc = new GC(composite);
- if (gc.textExtent(text).x > maxWidth) {
- for (int i = text.length(); i > 0; i--) {
- String subString = text.substring(0, i);
- subString = subString + "..."; //$NON-NLS-1$
- if (gc.textExtent(subString).x < maxWidth) {
- returnText = subString;
- break;
- }
- }
- }
- gc.dispose();
- return returnText;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotification.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotification.java
deleted file mode 100644
index 32e693dbe..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotification.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- */
-public class TaskListNotification extends AbstractNotification {
-
- protected final ITask task;
-
- protected Date date;
-
- private String description;
-
- private final DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(
- new TaskElementLabelProvider(true), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
-
- private final Object token;
-
- public TaskListNotification(ITask task) {
- this(task, null);
- }
-
- public TaskListNotification(ITask task, Object token) {
- Assert.isNotNull(task);
- this.task = task;
- this.token = token;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public String getLabel() {
- return labelProvider.getText(task);
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public void open() {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- TasksUiInternal.refreshAndOpenTaskListElement(task);
- }
- });
- }
-
- @Override
- public Image getNotificationImage() {
- return labelProvider.getImage(task);
- }
-
- protected ITask getTask() {
- return task;
- }
-
- @Override
- public Image getNotificationKindImage() {
- if (task.getSynchronizationState() == SynchronizationState.INCOMING_NEW) {
- return CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW);
- } else if (task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
- return CommonImages.getImage(CommonImages.OVERLAY_SYNC_OUTGOING_NEW);
- } else {
- return CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING);
- }
- }
-
- @Override
- public Date getDate() {
- return date;
- }
-
- @Override
- public void setDate(Date date) {
- this.date = date;
- }
-
- public int compareTo(AbstractNotification anotherNotification) throws ClassCastException {
- if (!(anotherNotification != null)) {
- throw new ClassCastException("A ITaskListNotification object expected."); //$NON-NLS-1$
- }
- Date anotherDate = (anotherNotification).getDate();
- if (date != null && anotherDate != null) {
- return date.compareTo(anotherDate);
- } else if (date == null) {
- return -1;
- } else {
- return 1;
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((date == null) ? 0 : date.hashCode());
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((task == null) ? 0 : task.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TaskListNotification other = (TaskListNotification) obj;
- if (date == null) {
- if (other.date != null) {
- return false;
- }
- } else if (!date.equals(other.date)) {
- return false;
- }
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
- return false;
- }
- if (task == null) {
- if (other.task != null) {
- return false;
- }
- } else if (!task.equals(other.task)) {
- return false;
- }
- return true;
- }
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- if (adapter == AbstractTask.class) {
- return task;
- }
- return null;
- }
-
- @Override
- public Object getToken() {
- return token;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationPopup.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationPopup.java
deleted file mode 100644
index 2a5b31646..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationPopup.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotificationPopup;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- */
-public class TaskListNotificationPopup extends AbstractNotificationPopup {
-
- private static final String NOTIFICATIONS_HIDDEN = Messages.TaskListNotificationPopup_more;
-
- private static final int NUM_NOTIFICATIONS_TO_DISPLAY = 4;
-
- private List<AbstractNotification> notifications;
-
- public TaskListNotificationPopup(Shell parent) {
- super(parent.getDisplay());
- }
-
- public void setContents(List<AbstractNotification> notifications) {
- this.notifications = notifications;
- }
-
- public List<AbstractNotification> getNotifications() {
- return new ArrayList<AbstractNotification>(notifications);
- }
-
- @Override
- protected void createTitleArea(Composite parent) {
- super.createTitleArea(parent);
- }
-
- @Override
- protected void createContentArea(Composite parent) {
- int count = 0;
- for (final AbstractNotification notification : notifications) {
- Composite notificationComposite = new Composite(parent, SWT.NO_FOCUS);
- GridLayout gridLayout = new GridLayout(2, false);
- GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(notificationComposite);
- notificationComposite.setLayout(gridLayout);
- notificationComposite.setBackground(parent.getBackground());
-
- if (count < NUM_NOTIFICATIONS_TO_DISPLAY) {
- final Label notificationLabelIcon = new Label(notificationComposite, SWT.NO_FOCUS);
- notificationLabelIcon.setBackground(parent.getBackground());
- notificationLabelIcon.setImage(notification.getNotificationKindImage());
- if (!(notification instanceof TaskListNotificationReminder)) {
- final AbstractTask task = (AbstractTask) notification.getAdapter(AbstractTask.class);
- if (task != null) {
- notificationLabelIcon.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseUp(MouseEvent e) {
- TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
- notificationLabelIcon.setImage(null);
- notificationLabelIcon.setToolTipText(null);
- }
- });
- notificationLabelIcon.setToolTipText(Messages.TaskListNotificationPopup_Mark_Task_Read);
- }
- }
-
- final TaskHyperlink itemLink = new TaskHyperlink(notificationComposite, SWT.BEGINNING | SWT.NO_FOCUS);
- GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(itemLink);
-
- itemLink.setText(notification.getLabel());
- itemLink.setImage(notification.getNotificationImage());
- itemLink.setBackground(parent.getBackground());
- itemLink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- notification.open();
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- Shell windowShell = window.getShell();
- if (windowShell != null) {
- if (windowShell.getMinimized()) {
- windowShell.setMinimized(false);
- }
-
- windowShell.open();
- windowShell.forceActive();
- }
- }
- }
- });
-
- String descriptionText = null;
- if (notification.getDescription() != null) {
- descriptionText = notification.getDescription();
- }
- if (descriptionText != null && !descriptionText.trim().equals("")) { //$NON-NLS-1$
- Label descriptionLabel = new Label(notificationComposite, SWT.NO_FOCUS);
- descriptionLabel.setText(descriptionText);
- descriptionLabel.setBackground(parent.getBackground());
- GridDataFactory.fillDefaults()
- .span(2, SWT.DEFAULT)
- .grab(true, false)
- .align(SWT.FILL, SWT.TOP)
- .applyTo(descriptionLabel);
- }
- } else {
- int numNotificationsRemain = notifications.size() - count;
- TaskHyperlink remainingHyperlink = new TaskHyperlink(notificationComposite, SWT.NO_FOCUS);
- remainingHyperlink.setBackground(parent.getBackground());
-
- remainingHyperlink.setText(numNotificationsRemain + " " + NOTIFICATIONS_HIDDEN); //$NON-NLS-1$
- GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(remainingHyperlink);
- remainingHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiUtil.openTasksViewInActivePerspective().setFocus();
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- Shell windowShell = window.getShell();
- if (windowShell != null) {
- windowShell.setMaximized(true);
- windowShell.open();
- }
- }
- }
- });
- break;
- }
- count++;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationQueryIncoming.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationQueryIncoming.java
deleted file mode 100644
index 04c466529..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationQueryIncoming.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.util.Date;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Rob Elves
- */
-public class TaskListNotificationQueryIncoming extends TaskListNotification {
-
- public TaskListNotificationQueryIncoming(ITask task) {
- super(task);
- }
-
- @Override
- public String getDescription() {
- return task.getSummary();
- }
-
- @Override
- public int compareTo(AbstractNotification anotherNotification) throws ClassCastException {
- if (!(anotherNotification != null)) {
- throw new ClassCastException("A ITaskListNotification object expected."); //$NON-NLS-1$
- }
- Date anotherDate = (anotherNotification).getDate();
- if (date != null && anotherDate != null) {
- return date.compareTo(anotherDate);
- } else if (date == null) {
- return -1;
- } else {
- return 1;
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationReminder.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationReminder.java
deleted file mode 100644
index ddcf7bb26..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotificationReminder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.util.Date;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- */
-public class TaskListNotificationReminder extends TaskListNotification {
-
- public TaskListNotificationReminder(AbstractTask task) {
- super(task);
- }
-
- @Override
- public Image getNotificationKindImage() {
- return CommonImages.getImage(CommonImages.OVERLAY_DATE_DUE);
- }
-
- @Override
- public int compareTo(AbstractNotification anotherNotification) throws ClassCastException {
- if (!(anotherNotification != null)) {
- throw new ClassCastException("A ITaskListNotification object expected."); //$NON-NLS-1$
- }
- Date anotherDate = (anotherNotification).getDate();
- if (date != null && anotherDate != null) {
- return date.compareTo(anotherDate);
- } else if (date == null) {
- return -1;
- } else {
- return 1;
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java
deleted file mode 100644
index ff11b4077..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/TaskListNotifier.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.notifications;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
-import org.eclipse.mylyn.internal.tasks.core.data.ITaskDataManagerListener;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManagerEvent;
-import org.eclipse.mylyn.internal.tasks.ui.ITaskListNotificationProvider;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskListNotifier implements ITaskDataManagerListener, ITaskListNotificationProvider {
-
- private final TaskDataManager taskDataManager;
-
- private final List<TaskListNotification> notificationQueue = new ArrayList<TaskListNotification>();
-
- private final RepositoryModel repositoryModel;
-
- public TaskListNotifier(RepositoryModel repositoryModel, TaskDataManager taskDataManager) {
- this.repositoryModel = repositoryModel;
- this.taskDataManager = taskDataManager;
- this.taskDataManager.addListener(this);
- }
-
- public TaskListNotification getNotification(ITask task, Object token) {
- if (task.getSynchronizationState() == SynchronizationState.INCOMING_NEW) {
- TaskListNotification notification = new TaskListNotification(task, token);
- notification.setDescription(Messages.TaskListNotifier_New_unread_task);
- return notification;
- } else if (task.getSynchronizationState() == SynchronizationState.INCOMING) {
- TaskDataDiff diff = getDiff(task);
- if (diff != null) {
- TaskListNotification notification = new TaskListNotification(task, token);
- notification.setDescription(diff.toString());
- return notification;
- }
- }
- return null;
- }
-
- public TaskDataDiff getDiff(ITask task) {
- ITaskDataWorkingCopy workingCopy;
- try {
- workingCopy = taskDataManager.getTaskDataState(task);
- if (workingCopy != null) {
- TaskDataDiff diff = new TaskDataDiff(repositoryModel, workingCopy.getRepositoryData(),
- workingCopy.getLastReadData());
- return diff;
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to get task data for task: \"" //$NON-NLS-1$
- + task + "\"", e)); //$NON-NLS-1$
- }
- return null;
- }
-
- public void taskDataUpdated(TaskDataManagerEvent event) {
- if (event.getToken() != null && event.getTaskDataChanged()) {
- AbstractRepositoryConnectorUi connectorUi = TasksUi.getRepositoryConnectorUi(event.getTaskData()
- .getConnectorKind());
- if (!connectorUi.hasCustomNotifications()) {
- TaskListNotification notification = getNotification(event.getTask(), event.getToken());
- if (notification != null) {
- synchronized (notificationQueue) {
- notificationQueue.add(notification);
- }
- }
- }
- }
- }
-
- public Set<AbstractNotification> getNotifications() {
- synchronized (notificationQueue) {
- if (notificationQueue.isEmpty()) {
- return Collections.emptySet();
- }
- HashSet<AbstractNotification> result = new HashSet<AbstractNotification>(notificationQueue);
- notificationQueue.clear();
- return result;
- }
- }
-
- public void editsDiscarded(TaskDataManagerEvent event) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/messages.properties
deleted file mode 100644
index 794076479..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/notifications/messages.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-TaskDataDiff_more_=\ more)
-
-TaskDiffUtil_attachment=\ attachment:
-TaskDiffUtil_Comment_by_X=Comment by {0}
-TaskDiffUtil_Unknown=Unknown
-
-TaskListNotificationPopup_Mark_Task_Read=Mark Task Read
-TaskListNotificationPopup_more=more, Open Task List to view
-
-TaskListNotifier_New_unread_task=New unread task
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java
deleted file mode 100644
index aa5c47226..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.preferences;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.preferences.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String TasksUiPreferencePage_Advanced;
-
- public static String TasksUiPreferencePage_Browse_;
-
- public static String TasksUiPreferencePage_Change_data_directory;
-
- public static String TasksUiPreferencePage_Confirm_Task_List_data_directory_change;
-
- public static String TasksUiPreferencePage_Data_directory_;
-
- public static String TasksUiPreferencePage_Destination_folder_does_not_exist;
-
- public static String TasksUiPreferencePage_Display_notifications_for_overdue_tasks_and_incoming_changes;
-
- public static String TasksUiPreferencePage_Enable_inactivity_timeouts;
-
- public static String TasksUiPreferencePage_Error_applying_Task_List_data_directory_changes;
-
- public static String TasksUiPreferencePage_Folder_Selection;
-
- public static String TasksUiPreferencePage_If_disabled;
-
- public static String TasksUiPreferencePage_minutes;
-
- public static String TasksUiPreferencePage_minutes_of_inactivity;
-
- public static String TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists;
-
- public static String TasksUiPreferencePage_Rich_Editor__Recommended_;
-
- public static String TasksUiPreferencePage_Scheduling;
-
- public static String TasksUiPreferencePage_See_X_for_configuring_Task_List_colors;
-
- public static String TasksUiPreferencePage_Specify_the_folder_for_tasks;
-
- public static String TasksUiPreferencePage_Stop_time_accumulation_after;
-
- public static String TasksUiPreferencePage_Synchronize_schedule_time_must_be_GT_0;
-
- public static String TasksUiPreferencePage_Synchronize_schedule_time_must_be_valid_integer;
-
- public static String TasksUiPreferencePage_Synchronize_with_repositories_every;
-
- public static String TasksUiPreferencePage_Synchronization;
-
- public static String TasksUiPreferencePage_Task_Data;
-
- public static String TasksUiPreferencePage_Task_Data_Directory_Error;
-
- public static String TasksUiPreferencePage_Task_Editing;
-
- public static String TasksUiPreferencePage_Task_Timing;
-
- public static String TasksUiPreferencePage_Use_the_Restore_dialog_to_recover_missing_tasks;
-
- public static String TasksUiPreferencePage_Web_Browser;
-
- public static String TasksUiPreferencePage_Week_Start;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java
deleted file mode 100644
index 76d865c2e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java
+++ /dev/null
@@ -1,772 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.preferences;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.monitor.ui.ActivityContextManager;
-import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
-import org.eclipse.mylyn.internal.provisional.commons.core.CommonMessages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.RestoreTaskListAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class TasksUiPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.preferences"; //$NON-NLS-1$
-
- private static final String FORWARDSLASH = "/"; //$NON-NLS-1$
-
- private static final String BACKSLASH_MULTI = "\\\\"; //$NON-NLS-1$
-
- private static final int MS_MINUTES = 60 * 1000;
-
- private Button useRichEditor;
-
- private Button useWebBrowser;
-
- private Text synchScheduleTime = null;
-
- private Button enableBackgroundSynch;
-
- private Text taskDirectoryText = null;
-
- private Button browse = null;
-
- private Button notificationEnabledButton = null;
-
- private int taskDataDirectoryAction = -1;
-
- private final FormToolkit toolkit;
-
- private Spinner timeoutMinutes;
-
- private Button timeoutEnabledButton;
-
- private ExpandableComposite advancedComposite;
-
- private Combo weekStartCombo;
-
- public TasksUiPreferencePage() {
- super();
- setPreferenceStore(TasksUiPlugin.getDefault().getPreferenceStore());
- toolkit = new FormToolkit(Display.getCurrent());
-
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(1, false);
- container.setLayout(layout);
-
- if (getContainer() instanceof IWorkbenchPreferenceContainer) {
- String message = Messages.TasksUiPreferencePage_See_X_for_configuring_Task_List_colors;
- new PreferenceLinkArea(container, SWT.NONE, "org.eclipse.ui.preferencePages.ColorsAndFonts", message, //$NON-NLS-1$
- (IWorkbenchPreferenceContainer) getContainer(), null);
- }
-
- createTaskRefreshScheduleGroup(container);
- createSchedulingGroup(container);
- createOpenWith(container);
- Composite advanced = createAdvancedSection(container);
- createTaskActivityGroup(advanced);
- createTaskDataControl(advanced);
- createLinks(container);
-
- updateRefreshGroupEnablements();
- applyDialogFont(container);
- return container;
- }
-
- private void createLinks(Composite container) {
- Hyperlink link = new Hyperlink(container, SWT.NULL);
- link.setForeground(CommonColors.HYPERLINK_WIDGET);
- link.setUnderlined(true);
- link.setText(Messages.TasksUiPreferencePage_Use_the_Restore_dialog_to_recover_missing_tasks);
- link.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- getShell().close();
- new RestoreTaskListAction().run();
- }
-
- public void linkEntered(HyperlinkEvent e) {
- // ignore
- }
-
- public void linkExited(HyperlinkEvent e) {
- // ignore
- }
-
- });
- }
-
- private Composite createAdvancedSection(Composite container) {
- advancedComposite = toolkit.createExpandableComposite(container, ExpandableComposite.COMPACT
- | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- advancedComposite.setFont(container.getFont());
- advancedComposite.setBackground(container.getBackground());
- advancedComposite.setText(Messages.TasksUiPreferencePage_Advanced);
- advancedComposite.setLayout(new GridLayout(1, false));
- advancedComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- advancedComposite.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent e) {
- getControl().getShell().pack();
- }
- });
-
- Composite advanced = new Composite(advancedComposite, SWT.NONE);
- advanced.setLayout(new GridLayout(1, false));
- advancedComposite.setClient(advanced);
- return advanced;
- }
-
- public void init(IWorkbench workbench) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public boolean performOk() {
- getPreferenceStore().setValue(ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED,
- notificationEnabledButton.getSelection());
- //getPreferenceStore().setValue(TasksUiPreferenceConstants.BACKUP_SCHEDULE, backupScheduleTimeText.getText());
-
- getPreferenceStore().setValue(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH, useRichEditor.getSelection());
- getPreferenceStore().setValue(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED,
- enableBackgroundSynch.getSelection());
- long miliseconds = 60000 * Long.parseLong(synchScheduleTime.getText());
- getPreferenceStore().setValue(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS,
- "" + miliseconds); //$NON-NLS-1$
-
- getPreferenceStore().setValue(ITasksUiPreferenceConstants.WEEK_START_DAY, getWeekStartValue());
- //getPreferenceStore().setValue(TasksUiPreferenceConstants.PLANNING_STARTHOUR, hourDayStart.getSelection());
-// getPreferenceStore().setValue(TasksUiPreferenceConstants.PLANNING_ENDHOUR, hourDayEnd.getSelection());
- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED,
- timeoutEnabledButton.getSelection());
- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(ActivityContextManager.ACTIVITY_TIMEOUT,
- timeoutMinutes.getSelection() * (60 * 1000));
- //backupNow.setEnabled(true);
-
- String taskDirectory = taskDirectoryText.getText();
- taskDirectory = taskDirectory.replaceAll(BACKSLASH_MULTI, FORWARDSLASH);
-
- if (!taskDirectory.equals(TasksUiPlugin.getDefault().getDataDirectory())) {
- if (taskDataDirectoryAction == IDialogConstants.OK_ID) {
- Exception exception = null;
- try {
- TasksUiPlugin.getDefault().setDataDirectory(taskDirectory);
- } catch (CoreException e) {
- exception = e;
- StatusHandler.log(e.getStatus());
- MessageDialog.openError(getShell(), Messages.TasksUiPreferencePage_Task_Data_Directory_Error,
- Messages.TasksUiPreferencePage_Error_applying_Task_List_data_directory_changes);
-
- } catch (OperationCanceledException ce) {
- exception = ce;
- }
- if (exception != null && !taskDirectoryText.isDisposed()) {
- String originalDirectory = TasksUiPlugin.getDefault().getDefaultDataDirectory();
- if (!taskDirectory.equals(originalDirectory)) {
- taskDirectoryText.setText(originalDirectory);
- }
- }
-
- } else if (taskDataDirectoryAction == IDialogConstants.CANCEL_ID) {
- // shouldn't get here
- }
- }
-
- return true;
- }
-
- private int getWeekStartValue() {
- return weekStartCombo.getSelectionIndex() + 1;
- }
-
- @Override
- public boolean performCancel() {
- taskDirectoryText.setText(TasksUiPlugin.getDefault().getDefaultDataDirectory());
- notificationEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
- //backupScheduleTimeText.setText(getPreferenceStore().getString(TasksUiPreferenceConstants.BACKUP_SCHEDULE));
- //backupFolderText.setText(TasksUiPlugin.getDefault().getBackupFolderPath());
-
- useRichEditor.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH));
-
- // synchQueries.setSelection(getPreferenceStore().getBoolean(
- // TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP));
- enableBackgroundSynch.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
- synchScheduleTime.setText(getMinutesString());
-
- weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
- //hourDayStart.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_STARTHOUR));
-// hourDayEnd.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
- //backupNow.setEnabled(true);
- int minutes = MonitorUiPlugin.getDefault().getPreferenceStore().getInt(ActivityContextManager.ACTIVITY_TIMEOUT)
- / MS_MINUTES;
- timeoutMinutes.setSelection(minutes);
- timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED));
- return true;
- }
-
- @Override
- public void performDefaults() {
- super.performDefaults();
- String taskDirectory = TasksUiPlugin.getDefault().getDefaultDataDirectory();
- if (!taskDirectory.equals(TasksUiPlugin.getDefault().getDataDirectory())) {
- checkForExistingTasklist(taskDirectory);
- if (taskDataDirectoryAction != IDialogConstants.CANCEL_ID) {
- taskDirectoryText.setText(taskDirectory);
-// backupFolderText.setText(taskDirectory + FORWARDSLASH + ITasksCoreConstants.DEFAULT_BACKUP_FOLDER_NAME);
-// backupNow.setEnabled(false);
- }
- } else {
- taskDirectoryText.setText(taskDirectory);
-// backupFolderText.setText(taskDirectory + FORWARDSLASH + ITasksCoreConstants.DEFAULT_BACKUP_FOLDER_NAME);
-// backupNow.setEnabled(true);
- }
-
- notificationEnabledButton.setSelection(getPreferenceStore().getDefaultBoolean(
- ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
- //backupScheduleTimeText.setText(getPreferenceStore().getDefaultString(TasksUiPreferenceConstants.BACKUP_SCHEDULE));
-
- useRichEditor.setSelection(getPreferenceStore().getDefaultBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH));
-
- // synchQueries.setSelection(getPreferenceStore().getDefaultBoolean(
- // TaskListPreferenceConstants.REPOSITORY_SYNCH_ON_STARTUP));
- enableBackgroundSynch.setSelection(getPreferenceStore().getDefaultBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
- // userRefreshOnly.setSelection(!enableBackgroundSynch.getSelection());
- long miliseconds = getPreferenceStore().getDefaultLong(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
- long minutes = miliseconds / 60000;
- synchScheduleTime.setText("" + minutes); //$NON-NLS-1$
- weekStartCombo.select(getPreferenceStore().getDefaultInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
- // hourDayStart.setSelection(getPreferenceStore().getDefaultInt(TasksUiPreferenceConstants.PLANNING_STARTHOUR));
-// hourDayEnd.setSelection(getPreferenceStore().getDefaultInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
- int activityTimeoutMinutes = MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultInt(
- ActivityContextManager.ACTIVITY_TIMEOUT)
- / MS_MINUTES;
- timeoutMinutes.setSelection(activityTimeoutMinutes);
- timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultBoolean(
- ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED));
- updateRefreshGroupEnablements();
- }
-
- private void createTaskRefreshScheduleGroup(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
- group.setText(Messages.TasksUiPreferencePage_Synchronization);
- GridLayout gridLayout = new GridLayout(1, false);
- group.setLayout(gridLayout);
-
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Composite enableSynch = new Composite(group, SWT.NULL);
- gridLayout = new GridLayout(4, false);
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- enableSynch.setLayout(gridLayout);
- enableBackgroundSynch = new Button(enableSynch, SWT.CHECK);
- enableBackgroundSynch.setText(Messages.TasksUiPreferencePage_Synchronize_with_repositories_every);
- enableBackgroundSynch.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED));
- enableBackgroundSynch.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- updateRefreshGroupEnablements();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- synchScheduleTime = new Text(enableSynch, SWT.BORDER | SWT.RIGHT);
- GridData gridData = new GridData();
- gridData.widthHint = 25;
- synchScheduleTime.setLayoutData(gridData);
- synchScheduleTime.setText(getMinutesString());
- synchScheduleTime.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateRefreshGroupEnablements();
- }
- });
- Label label = new Label(enableSynch, SWT.NONE);
- label.setText(Messages.TasksUiPreferencePage_minutes);
-
- notificationEnabledButton = new Button(group, SWT.CHECK);
- notificationEnabledButton.setText(Messages.TasksUiPreferencePage_Display_notifications_for_overdue_tasks_and_incoming_changes);
- notificationEnabledButton.setSelection(getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.NOTIFICATIONS_ENABLED));
-
- }
-
- private void createOpenWith(Composite parent) {
- Group container = new Group(parent, SWT.SHADOW_ETCHED_IN);
- container.setLayout(new GridLayout(3, false));
- container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- container.setText(Messages.TasksUiPreferencePage_Task_Editing);
- useRichEditor = new Button(container, SWT.RADIO);
- useRichEditor.setText(Messages.TasksUiPreferencePage_Rich_Editor__Recommended_);
- useRichEditor.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH));
- useWebBrowser = new Button(container, SWT.RADIO);
- useWebBrowser.setText(Messages.TasksUiPreferencePage_Web_Browser);
- useWebBrowser.setSelection(!getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH));
- }
-
- private void createTaskDataControl(Composite parent) {
-
- Group taskDataGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
- taskDataGroup.setText(Messages.TasksUiPreferencePage_Task_Data);
- taskDataGroup.setLayout(new GridLayout(1, false));
- taskDataGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite dataDirComposite = new Composite(taskDataGroup, SWT.NULL);
- GridLayout gridLayout = new GridLayout(3, false);
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- dataDirComposite.setLayout(gridLayout);
- dataDirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label label = new Label(dataDirComposite, SWT.NULL);
- label.setText(Messages.TasksUiPreferencePage_Data_directory_);
-
- String taskDirectory = TasksUiPlugin.getDefault().getDataDirectory();
- taskDirectory = taskDirectory.replaceAll(BACKSLASH_MULTI, FORWARDSLASH);
- taskDirectoryText = new Text(dataDirComposite, SWT.BORDER);
- taskDirectoryText.setText(taskDirectory);
- taskDirectoryText.setEditable(false);
- taskDirectoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- browse = new Button(dataDirComposite, SWT.TRAIL);
- browse.setText(Messages.TasksUiPreferencePage_Browse_);
- browse.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setText(Messages.TasksUiPreferencePage_Folder_Selection);
- dialog.setMessage(Messages.TasksUiPreferencePage_Specify_the_folder_for_tasks);
- String dir = taskDirectoryText.getText();
- dir = dir.replaceAll(BACKSLASH_MULTI, FORWARDSLASH);
- dialog.setFilterPath(dir);
-
- dir = dialog.open();
- if (dir == null || dir.equals("")) { //$NON-NLS-1$
- return;
- }
- dir = dir.replaceAll(BACKSLASH_MULTI, FORWARDSLASH);
- checkForExistingTasklist(dir);
-
- if (taskDataDirectoryAction != IDialogConstants.CANCEL_ID) {
- taskDirectoryText.setText(dir);
-// backupFolderText.setText(dir + FORWARDSLASH + ITasksCoreConstants.DEFAULT_BACKUP_FOLDER_NAME);
-// backupNow.setEnabled(false);
- }
- }
-
- });
-
-// Composite backupComposite = new Composite(taskDataGroup, SWT.NULL);
-// gridLayout = new GridLayout(5, false);
-// gridLayout.marginWidth = 0;
-// gridLayout.marginHeight = 0;
-// backupComposite.setLayout(gridLayout);
-// backupComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-// label = new Label(backupComposite, SWT.NULL);
-// label.setText("Backup every");
-// backupScheduleTimeText = new Text(backupComposite, SWT.BORDER | SWT.RIGHT);
-// final GridData gridData_1 = new GridData();
-// gridData_1.widthHint = 13;
-// backupScheduleTimeText.setLayoutData(gridData_1);
-//
-// backupScheduleTimeText.setText("" + getPreferenceStore().getInt(TasksUiPreferenceConstants.BACKUP_SCHEDULE));
-// backupScheduleTimeText.addModifyListener(new ModifyListener() {
-// public void modifyText(ModifyEvent e) {
-// updateRefreshGroupEnablements();
-// }
-// });
-//
-// label = new Label(backupComposite, SWT.NONE);
-// label.setText("days to");
-
-// String backupDirectory = TasksUiPlugin.getDefault().getBackupFolderPath();// getPreferenceStore().getString(TaskListPreferenceConstants.BACKUP_FOLDER);
-// backupDirectory = backupDirectory.replaceAll(BACKSLASH_MULTI, FORWARDSLASH);
-// backupFolderText = new Text(backupComposite, SWT.BORDER);
-// backupFolderText.setText(backupDirectory);
-// backupFolderText.setEditable(false);
-// backupFolderText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-//
-// backupNow = new Button(backupComposite, SWT.NONE);
-// backupNow.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
-// backupNow.setText("Backup Now");
-// backupNow.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// TasksUiPlugin.getBackupManager().backupNow(true);
-// }
-// });
- }
-
- private void createSchedulingGroup(Composite container) {
- Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
- group.setText(Messages.TasksUiPreferencePage_Scheduling);
- group.setLayout(new GridLayout(5, false));
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Label weekStartLabel = new Label(group, SWT.NONE);
- weekStartLabel.setText(Messages.TasksUiPreferencePage_Week_Start);
- weekStartCombo = new Combo(group, SWT.READ_ONLY);
- // Note: Calendar.SUNDAY = 1
-// weekStartCombo.add(LABEL_SUNDAY);
-// weekStartCombo.add(LABEL_MONDAY);
-// weekStartCombo.add(LABEL_SATURDAY);
- weekStartCombo.add(CommonMessages.Sunday);
- weekStartCombo.add(CommonMessages.Monday);
- weekStartCombo.add(CommonMessages.Tuesday);
- weekStartCombo.add(CommonMessages.Wednesday);
- weekStartCombo.add(CommonMessages.Thursday);
- weekStartCombo.add(CommonMessages.Friday);
- weekStartCombo.add(CommonMessages.Saturday);
- weekStartCombo.select(getPreferenceStore().getInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1);
-
-// Label workWeekBeginLabel = new Label(group, SWT.NONE);
-// workWeekBeginLabel.setText(START_DAY_LABEL);
-// workWeekBegin = new Combo(group, SWT.READ_ONLY);
-// // Calendar.SUNDAY = 1
-// workWeekBegin.add("SUNDAY");
-// workWeekBegin.add("MONDAY");
-// workWeekBegin.add("TUESDAY");
-// workWeekBegin.add("WEDNESDAY");
-// workWeekBegin.add("THURSDAY");
-// workWeekBegin.add("FRIDAY");
-// workWeekBegin.add("SATURDAY");
-// workWeekBegin.select(getPreferenceStore().getInt(TaskListPreferenceConstants.PLANNING_STARTDAY)
-// - 1);
-
-// Label workWeekEndLabel = new Label(group, SWT.NONE);
-// workWeekEndLabel.setText(END_DAY_LABEL);
-// workWeekEnd = new Combo(group, SWT.READ_ONLY);
-// workWeekEnd.add("SUNDAY");
-// workWeekEnd.add("MONDAY");
-// workWeekEnd.add("TUESDAY");
-// workWeekEnd.add("WEDNESDAY");
-// workWeekEnd.add("THURSDAY");
-// workWeekEnd.add("FRIDAY");
-// workWeekEnd.add("SATURDAY");
-// workWeekEnd.select(getPreferenceStore().getInt(TaskListPreferenceConstants.PLANNING_ENDDAY)
-// - 1);
-
-// Label hourDayStartLabel = new Label(group, SWT.NONE);
-// hourDayStartLabel.setText(START_HOUR_LABEL);
-// hourDayStart = new Spinner(group, SWT.BORDER);
-// hourDayStart.setDigits(0);
-// hourDayStart.setIncrement(1);
-// hourDayStart.setMaximum(23);
-// hourDayStart.setMinimum(0);
-// hourDayStart.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_STARTHOUR));
-// hourDayStart.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// updateRefreshGroupEnablements();
-// }
-//
-// });
-//
-// Label spacer = new Label(group, SWT.NONE);
-// GridDataFactory.fillDefaults().hint(40, SWT.DEFAULT).applyTo(spacer);
-//
-// Label hourDayEndLabel = new Label(group, SWT.NONE);
-// hourDayEndLabel.setText(END_HOUR_LABEL);
-//
-// hourDayEnd = new Spinner(group, SWT.BORDER);
-// hourDayEnd.setDigits(0);
-// hourDayEnd.setIncrement(1);
-// hourDayEnd.setMaximum(23);
-// hourDayEnd.setMinimum(0);
-// hourDayEnd.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
-// hourDayEnd.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// updateRefreshGroupEnablements();
-// }
-//
-// });
-
- }
-
- private void createTaskActivityGroup(Composite container) {
- Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
- group.setText(Messages.TasksUiPreferencePage_Task_Timing);
- group.setLayout(new GridLayout(3, false));
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- boolean timeoutEnabled = MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED);
-
- timeoutEnabledButton = new Button(group, SWT.CHECK);
- timeoutEnabledButton.setText(Messages.TasksUiPreferencePage_Enable_inactivity_timeouts);
- timeoutEnabledButton.setSelection(timeoutEnabled);
- timeoutEnabledButton.setToolTipText(Messages.TasksUiPreferencePage_If_disabled);
- timeoutEnabledButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateRefreshGroupEnablements();
- }
- });
- GridDataFactory.swtDefaults().span(3, 1).applyTo(timeoutEnabledButton);
-
- Label timeoutLabel = new Label(group, SWT.NONE);
- timeoutLabel.setText(Messages.TasksUiPreferencePage_Stop_time_accumulation_after);
- timeoutMinutes = new Spinner(group, SWT.BORDER);
- timeoutMinutes.setDigits(0);
- timeoutMinutes.setIncrement(5);
- timeoutMinutes.setMaximum(60);
- timeoutMinutes.setMinimum(1);
- long minutes = MonitorUiPlugin.getDefault().getPreferenceStore().getLong(
- ActivityContextManager.ACTIVITY_TIMEOUT)
- / MS_MINUTES;
- timeoutMinutes.setSelection((int) minutes);
- timeoutMinutes.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateRefreshGroupEnablements();
- }
-
- });
-
- timeoutLabel = new Label(group, SWT.NONE);
- timeoutLabel.setText(Messages.TasksUiPreferencePage_minutes_of_inactivity);
-
-// Label spacer = new Label(group, SWT.NONE);
-// GridDataFactory.fillDefaults().hint(40, SWT.DEFAULT).applyTo(spacer);
-//
-// Label hourDayEndLabel = new Label(group, SWT.NONE);
-// hourDayEndLabel.setText(END_HOUR_LABEL);
-//
-// hourDayEnd = new Spinner(group, SWT.BORDER);
-// hourDayEnd.setDigits(0);
-// hourDayEnd.setIncrement(1);
-// hourDayEnd.setMaximum(23);
-// hourDayEnd.setMinimum(0);
-// hourDayEnd.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
-// hourDayEnd.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// updateRefreshGroupEnablements();
-// }
-//
-// });
-
- }
-
-// private void createSchedulingGroup(Composite container) {
-// Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
-// group.setText(GROUP_WORK_WEEK_LABEL);
-// group.setLayout(new GridLayout(5, false));
-// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-//
-// // Label workWeekBeginLabel = new Label(group, SWT.NONE);
-// // workWeekBeginLabel.setText(START_DAY_LABEL);
-// // workWeekBegin = new Combo(group, SWT.READ_ONLY);
-// // // Calendar.SUNDAY = 1
-// // workWeekBegin.add("SUNDAY");
-// // workWeekBegin.add("MONDAY");
-// // workWeekBegin.add("TUESDAY");
-// // workWeekBegin.add("WEDNESDAY");
-// // workWeekBegin.add("THURSDAY");
-// // workWeekBegin.add("FRIDAY");
-// // workWeekBegin.add("SATURDAY");
-// // workWeekBegin.select(getPreferenceStore().getInt(TaskListPreferenceConstants.PLANNING_STARTDAY)
-// // - 1);
-// //
-// // Label workWeekEndLabel = new Label(group, SWT.NONE);
-// // workWeekEndLabel.setText(END_DAY_LABEL);
-// // workWeekEnd = new Combo(group, SWT.READ_ONLY);
-// // workWeekEnd.add("SUNDAY");
-// // workWeekEnd.add("MONDAY");
-// // workWeekEnd.add("TUESDAY");
-// // workWeekEnd.add("WEDNESDAY");
-// // workWeekEnd.add("THURSDAY");
-// // workWeekEnd.add("FRIDAY");
-// // workWeekEnd.add("SATURDAY");
-// // workWeekEnd.select(getPreferenceStore().getInt(TaskListPreferenceConstants.PLANNING_ENDDAY)
-// // - 1);
-//
-// Label hourDayStartLabel = new Label(group, SWT.NONE);
-// hourDayStartLabel.setText(START_HOUR_LABEL);
-// hourDayStart = new Spinner(group, SWT.BORDER);
-// hourDayStart.setDigits(0);
-// hourDayStart.setIncrement(1);
-// hourDayStart.setMaximum(23);
-// hourDayStart.setMinimum(0);
-// hourDayStart.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_STARTHOUR));
-// hourDayStart.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// updateRefreshGroupEnablements();
-// }
-//
-// });
-//
-// Label spacer = new Label(group, SWT.NONE);
-// GridDataFactory.fillDefaults().hint(40, SWT.DEFAULT).applyTo(spacer);
-//
-// Label hourDayEndLabel = new Label(group, SWT.NONE);
-// hourDayEndLabel.setText(END_HOUR_LABEL);
-//
-// hourDayEnd = new Spinner(group, SWT.BORDER);
-// hourDayEnd.setDigits(0);
-// hourDayEnd.setIncrement(1);
-// hourDayEnd.setMaximum(23);
-// hourDayEnd.setMinimum(0);
-// hourDayEnd.setSelection(getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
-// hourDayEnd.addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// updateRefreshGroupEnablements();
-// }
-//
-// });
-//
-// }
-
- public void updateRefreshGroupEnablements() {
- String errorMessage = null;
-
-// try {
-// long number = Integer.parseInt(backupScheduleTimeText.getText());
-// if (number <= 0) {
-// errorMessage = "Backup schedule time must be > 0";
-// } else if (backupFolderText.getText() == "") {
-// errorMessage = "Backup destination folder must be specified";
-// }
-// } catch (NumberFormatException e) {
-// errorMessage = "Backup schedule time must be valid integer";
-// }
-
- if (enableBackgroundSynch.getSelection()) {
- try {
- long number = Long.parseLong(synchScheduleTime.getText());
- if (number <= 0) {
- errorMessage = Messages.TasksUiPreferencePage_Synchronize_schedule_time_must_be_GT_0;
- }
- } catch (NumberFormatException e) {
- errorMessage = Messages.TasksUiPreferencePage_Synchronize_schedule_time_must_be_valid_integer;
- }
- }
-
-// if (hourDayEnd.getSelection() <= hourDayStart.getSelection()) {
-// errorMessage = "Planning: Work day start must be before end.";
-// }
-
- setErrorMessage(errorMessage);
- setValid(errorMessage == null);
-
- synchScheduleTime.setEnabled(enableBackgroundSynch.getSelection());
-
- timeoutMinutes.setEnabled(timeoutEnabledButton.getSelection());
-
- }
-
- private String getMinutesString() {
- long miliseconds = getPreferenceStore().getLong(
- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS);
- long minutes = miliseconds / 60000;
- return "" + minutes; //$NON-NLS-1$
- }
-
- private void checkForExistingTasklist(String dir) {
- File newDataFolder = new File(dir);
- if (newDataFolder.exists()) {
-
- MessageDialog dialogConfirm = new MessageDialog(
- null,
- Messages.TasksUiPreferencePage_Confirm_Task_List_data_directory_change,
- null,
- Messages.TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists,
- MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL },
- IDialogConstants.CANCEL_ID);
- taskDataDirectoryAction = dialogConfirm.open();
-
- for (TaskEditor taskEditor : TasksUiInternal.getActiveRepositoryTaskEditors()) {
- TasksUiInternal.closeEditorInActivePage(taskEditor.getTaskEditorInput().getTask(), true);
- }
-
- } else {
- MessageDialog.openWarning(getControl().getShell(), Messages.TasksUiPreferencePage_Change_data_directory,
- Messages.TasksUiPreferencePage_Destination_folder_does_not_exist);
- }
- }
-
- @Override
- public void dispose() {
- if (toolkit != null) {
- if (toolkit.getColors() != null) {
- toolkit.dispose();
- }
- }
- super.dispose();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties
deleted file mode 100644
index 407438f5e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-TasksUiPreferencePage_Advanced=Advanced
-TasksUiPreferencePage_Browse_=Browse...
-TasksUiPreferencePage_Change_data_directory=Change data directory
-TasksUiPreferencePage_Confirm_Task_List_data_directory_change=Confirm Task List data directory change
-TasksUiPreferencePage_Data_directory_=Data directory:
-TasksUiPreferencePage_Destination_folder_does_not_exist=Destination folder does not exist.
-TasksUiPreferencePage_Display_notifications_for_overdue_tasks_and_incoming_changes=Display notifications for overdue tasks and incoming changes
-TasksUiPreferencePage_Enable_inactivity_timeouts=Enable inactivity timeouts
-TasksUiPreferencePage_Error_applying_Task_List_data_directory_changes=Error applying Task List data directory changes. The previous setting will be restored.
-TasksUiPreferencePage_Folder_Selection=Folder Selection
-TasksUiPreferencePage_If_disabled=If disabled, time accumulates while a task is active with no timeout due to inactivity.
-TasksUiPreferencePage_minutes=minutes
-TasksUiPreferencePage_minutes_of_inactivity=minutes of inactivity.
-TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists=A new empty Task List will be created in the chosen directory if one does not already exists. Your previous directory and its contents will not be deleted.\n\nProceed?
-TasksUiPreferencePage_Rich_Editor__Recommended_=Rich Editor (Recommended)
-TasksUiPreferencePage_Scheduling=Scheduling
-TasksUiPreferencePage_See_X_for_configuring_Task_List_colors=See <a>''{0}''</a> for configuring Task List colors.
-TasksUiPreferencePage_Specify_the_folder_for_tasks=Specify the folder for tasks
-TasksUiPreferencePage_Stop_time_accumulation_after=Stop time accumulation after
-TasksUiPreferencePage_Synchronize_schedule_time_must_be_GT_0=Synchronize schedule time must be > 0
-TasksUiPreferencePage_Synchronize_schedule_time_must_be_valid_integer=Synchronize schedule time must be valid integer
-TasksUiPreferencePage_Synchronize_with_repositories_every=Synchronize with repositories every
-TasksUiPreferencePage_Synchronization=Synchronization
-TasksUiPreferencePage_Task_Data=Task Data
-TasksUiPreferencePage_Task_Data_Directory_Error=Task Data Directory Error
-TasksUiPreferencePage_Task_Editing=Task Editing
-TasksUiPreferencePage_Task_Timing=Task Timing
-TasksUiPreferencePage_Use_the_Restore_dialog_to_recover_missing_tasks=Use the Restore dialog to recover missing tasks
-TasksUiPreferencePage_Web_Browser=Web Browser
-TasksUiPreferencePage_Week_Start=Week Start:
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/Messages.java
deleted file mode 100644
index 3a40d71c1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/Messages.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.properties;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.properties.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String ProjectTaskRepositoryPage_Select_a_task_repository_to_associate_with_this_project_below;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectPropertiesLinkProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectPropertiesLinkProvider.java
deleted file mode 100644
index 79f588617..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectPropertiesLinkProvider.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.properties;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * Default Task Repository link provider
- *
- * @author Eugene Kuleshov
- */
-public class ProjectPropertiesLinkProvider extends AbstractTaskRepositoryLinkProvider {
-
- private static final String PROPERTY_PREFIX = "project.repository"; //$NON-NLS-1$
-
- private static final String PROJECT_REPOSITORY_KIND = PROPERTY_PREFIX + ".kind"; //$NON-NLS-1$
-
- private static final String PROJECT_REPOSITORY_URL = PROPERTY_PREFIX + ".url"; //$NON-NLS-1$
-
- @Override
- public TaskRepository getTaskRepository(IResource resource, IRepositoryManager repositoryManager) {
- IProject project = resource.getProject();
- if (project == null || !project.isAccessible()) {
- return null;
- }
-
- IScopeContext projectScope = new ProjectScope(project);
- IEclipsePreferences projectNode = projectScope.getNode(TasksUiPlugin.ID_PLUGIN);
- if (projectNode != null) {
- String kind = projectNode.get(PROJECT_REPOSITORY_KIND, ""); //$NON-NLS-1$
- String urlString = projectNode.get(PROJECT_REPOSITORY_URL, ""); //$NON-NLS-1$
- return repositoryManager.getRepository(kind, urlString);
- }
- return null;
- }
-
- @Override
- public boolean canSetTaskRepository(IResource resource) {
- IProject project = resource.getProject();
- return project != null && project.isAccessible();
- }
-
- @Override
- public boolean setTaskRepository(IResource resource, TaskRepository repository) {
- IProject project = resource.getProject();
- if (project == null || !project.isAccessible()) {
- return false;
- }
-
- IScopeContext projectScope = new ProjectScope(project);
- IEclipsePreferences projectNode = projectScope.getNode(TasksUiPlugin.ID_PLUGIN);
- if (projectNode != null) {
- if (repository != null) {
- projectNode.put(PROJECT_REPOSITORY_KIND, repository.getConnectorKind());
- projectNode.put(PROJECT_REPOSITORY_URL, repository.getRepositoryUrl());
- } else {
- projectNode.remove(PROJECT_REPOSITORY_KIND);
- projectNode.remove(PROJECT_REPOSITORY_URL);
- }
- try {
- projectNode.flush();
- return true;
- } catch (BackingStoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Failed to save task repository to project association preference", e)); //$NON-NLS-1$
- }
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectTaskRepositoryPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectTaskRepositoryPage.java
deleted file mode 100644
index 8ef28d2bf..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/ProjectTaskRepositoryPage.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.properties;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.AddRepositoryAction;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesSorter;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoryLabelProvider;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-
-/**
- * A property page that support per project configuration of an associated task repository.
- *
- * @author Rob Elves
- * @see Adapted from org.eclipse.ui.internal.ide.dialogs.ProjectReferencePage
- */
-public class ProjectTaskRepositoryPage extends PropertyPage {
-
- private static final int REPOSITORY_LIST_MULTIPLIER = 30;
-
- private IProject project;
-
- private boolean modified = false;
-
- private CheckboxTableViewer listViewer;
-
- public ProjectTaskRepositoryPage() {
- }
-
- @Override
- protected Control createContents(Composite parent) {
-
- Font font = parent.getFont();
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(font);
-
- initialize();
-
- Label description = createDescriptionLabel(composite);
- description.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.TOP | SWT.BORDER);
- listViewer.getTable().setFont(font);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessHorizontalSpace = true;
-
- // Only set a height hint if it will not result in a cut off dialog
- if (DialogUtil.inRegularFontMode(parent)) {
- data.heightHint = getDefaultFontHeight(listViewer.getTable(), REPOSITORY_LIST_MULTIPLIER);
- }
- listViewer.getTable().setLayoutData(data);
- listViewer.getTable().setFont(font);
-
- listViewer.setLabelProvider(new DecoratingLabelProvider(new TaskRepositoryLabelProvider(),
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- listViewer.setContentProvider(new IStructuredContentProvider() {
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object parent) {
- return TasksUi.getRepositoryManager().getAllRepositories().toArray();
- }
-
- });
-
- listViewer.setSorter(new TaskRepositoriesSorter());
- listViewer.setInput(project.getWorkspace());
-
- listViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (event.getChecked()) {
- // only allow single selection
- listViewer.setAllChecked(false);
- listViewer.setChecked(event.getElement(), event.getChecked());
- }
- modified = true;
- }
- });
- updateLinkedRepository();
-
- // TODO this code was copied from SelectRepositoryPage
- final AddRepositoryAction action = new AddRepositoryAction();
- action.setPromptToAddQuery(false);
-
- Button button = new Button(composite, SWT.NONE);
- button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
- button.setText(AddRepositoryAction.TITLE);
- button.setEnabled(action.isEnabled());
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- TaskRepository taskRepository = action.showWizard();
- if (taskRepository != null) {
- listViewer.setInput(project.getWorkspace());
- listViewer.setSelection(new StructuredSelection(taskRepository));
- updateLinkedRepository();
- }
- }
- });
-
- return composite;
- }
-
- void updateLinkedRepository() {
- TaskRepository repository = TasksUiPlugin.getDefault().getRepositoryForResource(project);
- if (repository != null) {
- listViewer.setCheckedElements(new Object[] { repository });
- }
- listViewer.getControl().setEnabled(TasksUiPlugin.getDefault().canSetRepositoryForResource(project));
- }
-
- private static int getDefaultFontHeight(Control control, int lines) {
- FontData[] viewerFontData = control.getFont().getFontData();
- int fontHeight = 10;
-
- // If we have no font data use our guess
- if (viewerFontData.length > 0) {
- fontHeight = viewerFontData[0].getHeight();
- }
- return lines * fontHeight;
-
- }
-
- private void initialize() {
- project = (IProject) getElement().getAdapter(IResource.class);
- noDefaultAndApplyButton();
- setDescription(Messages.ProjectTaskRepositoryPage_Select_a_task_repository_to_associate_with_this_project_below);
- }
-
- @Override
- public boolean performOk() {
- if (!modified) {
- return true;
- }
- if (listViewer.getCheckedElements().length > 0) {
- TaskRepository selectedRepository = (TaskRepository) listViewer.getCheckedElements()[0];
- TasksUiPlugin.getDefault().setRepositoryForResource(project, selectedRepository);
- } else {
- TasksUiPlugin.getDefault().setRepositoryForResource(project, null);
- }
- return true;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/messages.properties
deleted file mode 100644
index f3b472428..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/properties/messages.properties
+++ /dev/null
@@ -1 +0,0 @@
-ProjectTaskRepositoryPage_Select_a_task_repository_to_associate_with_this_project_below=Select a task repository to associate with this project below:
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/CreateQueryFromSearchAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/CreateQueryFromSearchAction.java
deleted file mode 100644
index cd9dcbb1c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/CreateQueryFromSearchAction.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Balazs Brinkus - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Used for add the last search result to the Task List.
- *
- * @author Balazs Brinkus (bug 172699)
- * @author Mik Kersten
- */
-public class CreateQueryFromSearchAction extends Action {
-
- /** The view this action works on */
- private final RepositorySearchResultView resultView;
-
- /**
- * Constructor
- *
- * @param text
- * The text for this action
- * @param resultView
- * The <code>RepositorySearchResultView</code> this action works on
- */
- public CreateQueryFromSearchAction(String text, RepositorySearchResultView resultView) {
- setText(text);
- setImageDescriptor(TasksUiImages.QUERY_NEW);
- this.resultView = resultView;
- }
-
- /**
- * Add the search result to the Task List.
- */
- @Override
- public void run() {
- ISelection selection = resultView.getViewer().getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if (structuredSelection.getFirstElement() instanceof ITask) {
- ISearchQuery[] queries = NewSearchUI.getQueries();
- ITask task = (ITask) structuredSelection.getFirstElement();
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- task.getConnectorKind());
- if (queries.length != 0 && connector != null) {
- SearchHitCollector searchHitCollector = (SearchHitCollector) queries[0];
- IRepositoryQuery query = searchHitCollector.getRepositoryQuery();
- InputDialog dialog = new InputDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell(), Messages.CreateQueryFromSearchAction_CLEAR_QUERY, MessageFormat.format(
- Messages.CreateQueryFromSearchAction_Name_of_query_to_be_added_to_the_X, TaskListView.LABEL_VIEW)
- + ": ", "", null); //$NON-NLS-1$ //$NON-NLS-2$
- int dialogResult = dialog.open();
- if (dialogResult == Window.OK) {
- query.setSummary(dialog.getValue());
- TasksUiInternal.getTaskList().addQuery((RepositoryQuery) query);
- TasksUiInternal.synchronizeQuery(connector, (RepositoryQuery) query, null, true);
- }
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/Messages.java
deleted file mode 100644
index 4093336f6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/Messages.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.search.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String CreateQueryFromSearchAction_CLEAR_QUERY;
-
- public static String CreateQueryFromSearchAction_Name_of_query_to_be_added_to_the_X;
-
- public static String RepositorySearchResult_Task_search_X_matches;
-
- public static String RepositorySearchResult_Task_search_1_match;
-
- public static String RepositorySearchResultView_Add_to_X_Category;
-
- public static String RepositorySearchResultView_Create_Query_from_Search_;
-
- public static String RepositorySearchResultView_Filter_Completed_Tasks;
-
- public static String RepositorySearchResultView_Group_By_Owner;
-
- public static String RepositorySearchResultView_Open_in_Editor;
-
- public static String RepositorySearchResultView_Open_Search_with_Browser_Label;
-
- public static String RepositorySearchResultView_Refine_Search_;
-
- public static String RepositorySearchResultView_Sort_by;
-
- public static String RepositorySearchResultView_Task_Priority;
-
- public static String RepositorySearchResultView_Task_Summary;
-
- public static String SearchHitCollector_Max_allowed_number_of_hits_returned_exceeded;
-
- public static String SearchHitCollector_Querying_Repository_;
-
- public static String SearchHitCollector_Repository_connector_could_not_be_found;
-
- public static String SearchHitCollector_Search_failed;
-
- public static String SearchHitCollector_Search_cancelled;
-
- public static String SearchHitCollector_Search_returned_maximum_number_of_hits;
-
- public static String SearchResultsLabelProvider_OF;
-
- public static String SearchResultTreeContentProvider_Complete;
-
- public static String SearchResultTreeContentProvider_Incomplete;
-
- public static String SearchResultTreeContentProvider__unknown_;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java
deleted file mode 100644
index 605389dd4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/OpenSearchResultAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-
-/**
- * This class is used to open a bug report in an editor.
- */
-public class OpenSearchResultAction extends Action {
-
- /** The view this action works on */
- private final RepositorySearchResultView resultView;
-
- /**
- * Constructor
- *
- * @param text
- * The text for this action
- * @param resultView
- * The <code>RepositorySearchResultView</code> this action works on
- */
- public OpenSearchResultAction(String text, RepositorySearchResultView resultView) {
- setText(text);
- this.resultView = resultView;
- }
-
- /**
- * Open the selected bug reports in their own editors.
- */
- @SuppressWarnings("unchecked")
- @Override
- public void run() {
- // Get the selected items
- ISelection s = resultView.getViewer().getSelection();
- if (s instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) s;
-
- // go through each of the selected items and show it in an editor
- for (Iterator<AbstractTask> it = selection.iterator(); it.hasNext();) {
- AbstractTask repositoryHit = it.next();
- TasksUiUtil.openTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(),
- repositoryHit.getUrl());
- }
-
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResult.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResult.java
deleted file mode 100644
index 4de34d9ca..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResult.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-import org.eclipse.search.ui.text.IEditorMatchAdapter;
-import org.eclipse.search.ui.text.IFileMatchAdapter;
-
-/**
- * Captures the results of a task repository search.
- *
- * @author Rob Elves
- * @see org.eclipse.search.ui.text.AbstractTextSearchResult
- * @since 2.0
- */
-public class RepositorySearchResult extends AbstractTextSearchResult {
-
- /**
- * The query producing this result.
- */
- private final ISearchQuery repositoryQuery;
-
- /**
- * Constructor for <code>RepositorySearchResult</code> class.
- *
- * @param query
- * <code>AbstractRepositorySearchQuery</code> that is producing this result.
- */
- public RepositorySearchResult(ISearchQuery query) {
- repositoryQuery = query;
- }
-
- @Override
- public IEditorMatchAdapter getEditorMatchAdapter() {
- return null;
- }
-
- /**
- * This function always returns <code>null</code>, as the matches for this implementation of
- * <code>AbstractTextSearchResult</code> never contain files.
- *
- * @see org.eclipse.search.ui.text.AbstractTextSearchResult#getFileMatchAdapter()
- */
- @Override
- public IFileMatchAdapter getFileMatchAdapter() {
- return null;
- }
-
- public String getLabel() {
- return getMatchCount() == 1 ? getSingularLabel() : getPluralLabel();
- }
-
- /**
- * Get the singular label for the number of results
- *
- * @return The singular label
- */
- protected String getSingularLabel() {
- return Messages.RepositorySearchResult_Task_search_1_match;
- }
-
- /**
- * Get the plural label for the number of results
- *
- * @return The plural label
- */
- protected String getPluralLabel() {
- return MessageFormat.format(Messages.RepositorySearchResult_Task_search_X_matches, getMatchCount());
- }
-
- public String getTooltip() {
- return getLabel();
- }
-
- public ImageDescriptor getImageDescriptor() {
- return SearchPluginImages.DESC_OBJ_TSEARCH_DPDN;
- }
-
- public ISearchQuery getQuery() {
- return repositoryQuery;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
deleted file mode 100644
index d54488ed9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.mylyn.internal.provisional.commons.ui.SubstringPatternFilter;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskGroup;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.AddExistingTaskJob;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenTaskSearchAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenWithBrowserAction;
-import org.eclipse.mylyn.internal.tasks.ui.search.SearchResultTreeContentProvider.GroupBy;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListToolTip;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.search.ui.IContextMenuConstants;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FilteredTree;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * Displays the results of a Repository search.
- *
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage
- *
- * @author Rob Elves
- * @author Mik Kersten
- * @author Shawn Minto
- * @author Frank Becker
- * @author Steffen Pingel
- */
-public class RepositorySearchResultView extends AbstractTextSearchViewPage implements IAdaptable {
-
- private class GroupingAction extends Action {
-
- private final GroupBy groupBy;
-
- public GroupingAction(String text, GroupBy groupBy) {
- super(text, IAction.AS_CHECK_BOX);
- this.groupBy = groupBy;
- groupingActions.add(this);
- }
-
- public GroupBy getGroupBy() {
- return groupBy;
- }
-
- @Override
- public void run() {
- for (GroupingAction action : groupingActions) {
- action.setChecked(false);
- }
-
- SearchResultTreeContentProvider contentProvider = (SearchResultTreeContentProvider) getViewer().getContentProvider();
- if (contentProvider.getSelectedGroup() == groupBy) {
- contentProvider.setSelectedGroup(GroupBy.NONE);
- } else {
- contentProvider.setSelectedGroup(groupBy);
- setChecked(true);
- }
- getViewer().refresh();
- }
- }
-
- private class FilteringAction extends Action {
-
- private final ViewerFilter filter;
-
- public FilteringAction(String text, ViewerFilter filter) {
- super(text, IAction.AS_CHECK_BOX);
- this.filter = filter;
- filterActions.add(this);
- }
-
- @Override
- public void runWithEvent(Event event) {
- if (isChecked()) {
- getViewer().addFilter(filter);
- } else {
- getViewer().removeFilter(filter);
- }
- }
- }
-
- public static final int ORDER_PRIORITY = 1;
-
- public static final int ORDER_DESCRIPTION = 2;
-
- public static final int ORDER_SEVERITY = 3;
-
- public static final int ORDER_STATUS = 4;
-
- public static final int ORDER_ID = 5;
-
- public static final int ORDER_DEFAULT = ORDER_PRIORITY;
-
- private static final String KEY_SORTING = TasksUiPlugin.ID_PLUGIN + ".search.resultpage.sorting"; //$NON-NLS-1$
-
- private SearchResultContentProvider searchResultProvider;
-
- private int currentSortOrder;
-
- private final SearchResultSortAction sortByPriorityAction;
-
- private final SearchResultSortAction sortByDescriptionAction;
-
- private final OpenSearchResultAction openInEditorAction;
-
- private final CreateQueryFromSearchAction createQueryAction;
-
- private final Action refineSearchAction;
-
- private static final String[] SHOW_IN_TARGETS = new String[] { TaskListView.ID };
-
- private TaskListToolTip toolTip;
-
- private final List<GroupingAction> groupingActions;
-
- private final List<FilteringAction> filterActions;
-
- private final OpenWithBrowserAction openSearchWithBrowserAction;
-
- private static final IShowInTargetList SHOW_IN_TARGET_LIST = new IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return SHOW_IN_TARGETS;
- }
- };
-
- public RepositorySearchResultView() {
- // Only use the table layout.
- super(FLAG_LAYOUT_TREE);
-
- sortByPriorityAction = new SearchResultSortAction(Messages.RepositorySearchResultView_Task_Priority, this,
- ORDER_PRIORITY);
- sortByDescriptionAction = new SearchResultSortAction(Messages.RepositorySearchResultView_Task_Summary, this,
- ORDER_DESCRIPTION);
- currentSortOrder = ORDER_DEFAULT;
-
- openInEditorAction = new OpenSearchResultAction(Messages.RepositorySearchResultView_Open_in_Editor, this);
- createQueryAction = new CreateQueryFromSearchAction(
- Messages.RepositorySearchResultView_Create_Query_from_Search_, this);
- refineSearchAction = new OpenTaskSearchAction();
- refineSearchAction.setText(Messages.RepositorySearchResultView_Refine_Search_);
- openSearchWithBrowserAction = new OpenWithBrowserAction();
- openSearchWithBrowserAction.setText(Messages.RepositorySearchResultView_Open_Search_with_Browser_Label);
-
- groupingActions = new ArrayList<GroupingAction>();
- new GroupingAction(Messages.RepositorySearchResultView_Group_By_Owner, GroupBy.OWNER);
- //new GroupingAction("Group By Complete", GroupBy.COMPLETION);
-
- filterActions = new ArrayList<FilteringAction>();
- new FilteringAction(Messages.RepositorySearchResultView_Filter_Completed_Tasks, new ViewerFilter() {
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof ITask) {
- return !((ITask) element).isCompleted();
- } else if (element instanceof TaskGroup) {
- TaskGroup taskGroup = (TaskGroup) element;
- return taskGroup.getHandleIdentifier().equals("group-incompleteIncomplete"); //$NON-NLS-1$
- }
- return true;
- }
- });
- }
-
- @Override
- protected void elementsChanged(Object[] objects) {
- if (searchResultProvider != null) {
- searchResultProvider.elementsChanged(objects);
- getViewer().refresh();
- }
- }
-
- @Override
- protected void clear() {
- if (searchResultProvider != null) {
- searchResultProvider.clear();
- getViewer().refresh();
- }
- }
-
- // Allows the inherited method "getViewer" to be accessed publicly.
- @Override
- public StructuredViewer getViewer() {
- return super.getViewer();
- }
-
- @Override
- protected void configureTreeViewer(TreeViewer viewer) {
- viewer.setUseHashlookup(true);
- searchResultProvider = new SearchResultTreeContentProvider();
- viewer.setContentProvider(searchResultProvider);
-
- DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new SearchResultsLabelProvider(
- searchResultProvider, viewer), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
- viewer.setLabelProvider(labelProvider);
-
- // Set the order when the search view is loading so that the items are
- // sorted right away
- setSortOrder(currentSortOrder);
-
- toolTip = new TaskListToolTip(viewer.getControl());
- }
-
- @SuppressWarnings("deprecation")
- @Override
- protected TreeViewer createTreeViewer(Composite parent) {
- // create a filtered tree
- Composite treeComposite = parent;
- Layout parentLayout = parent.getLayout();
- if (!(parentLayout instanceof GridLayout)) {
- treeComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- treeComposite.setLayout(layout);
- }
-
- // TODO e3.5 use new FilteredTree API
- FilteredTree searchTree = new FilteredTree(treeComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL,
- new SubstringPatternFilter());
- return searchTree.getViewer();
- }
-
- @Override
- protected void configureTableViewer(TableViewer viewer) {
-// viewer.setUseHashlookup(true);
-// String[] columnNames = new String[] { "Summary" };
-// TableColumn[] columns = new TableColumn[columnNames.length];
-// int[] columnWidths = new int[] { 500 };
-// viewer.setColumnProperties(columnNames);
-//
-// viewer.getTable().setHeaderVisible(false);
-// for (int i = 0; i < columnNames.length; i++) {
-// columns[i] = new TableColumn(viewer.getTable(), 0, i); // SWT.LEFT
-// columns[i].setText(columnNames[i]);
-// columns[i].setWidth(columnWidths[i]);
-// columns[i].setData(new Integer(i));
-// columns[i].addSelectionListener(new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// TableColumn col = (TableColumn) e.getSource();
-// Integer integer = (Integer) col.getData();
-// setSortOrder(integer.intValue());
-// }
-// });
-// }
-//
-// IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
-// Color categoryBackground = themeManager.getCurrentTheme().getColorRegistry().get(
-// TaskListColorsAndFonts.THEME_COLOR_TASKLIST_CATEGORY);
-//
-// SearchViewTableLabelProvider taskListTableLabelProvider = new SearchViewTableLabelProvider(
-// new TaskElementLabelProvider(true),
-// PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground);
-//
-// viewer.setLabelProvider(taskListTableLabelProvider);
-// viewer.setContentProvider(new SearchResultTableContentProvider(this));
-//
-// // Set the order when the search view is loading so that the items are
-// // sorted right away
-// setSortOrder(currentSortOrder);
-//
-// taskContentProvider = (SearchResultContentProvider) viewer.getContentProvider();
- }
-
- @Override
- public void dispose() {
- toolTip.dispose();
- super.dispose();
- }
-
- /**
- * Sets the new sorting category, and reorders all of the tasks.
- *
- * @param sortOrder
- * The new category to sort by
- */
- public void setSortOrder(int sortOrder) {
- StructuredViewer viewer = getViewer();
-
- switch (sortOrder) {
- case ORDER_ID:
- viewer.setSorter(new SearchResultSorterId());
- break;
- case ORDER_DESCRIPTION:
- viewer.setSorter(new SearchResultSorter());
- break;
- case ORDER_PRIORITY:
- viewer.setSorter(new SearchResultSorterPriority());
- break;
- default:
- // If the setting is not one of the four valid ones,
- // use the default order setting.
- sortOrder = ORDER_DEFAULT;
- viewer.setSorter(new SearchResultSorterPriority());
- break;
- }
- currentSortOrder = sortOrder;
- getSettings().put(KEY_SORTING, currentSortOrder);
- }
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- return getAdapterDelegate(adapter);
- }
-
- private Object getAdapterDelegate(Class<?> adapter) {
- if (IShowInTargetList.class.equals(adapter)) {
- return SHOW_IN_TARGET_LIST;
- }
- return null;
- }
-
- @Override
- protected void showMatch(Match match, int currentOffset, int currentLength, boolean activate)
- throws PartInitException {
- AbstractTask repositoryHit = (AbstractTask) match.getElement();
- TasksUiInternal.refreshAndOpenTaskListElement(repositoryHit);
- }
-
- @Override
- protected void fillContextMenu(IMenuManager menuManager) {
- super.fillContextMenu(menuManager);
-
- // open actions
-
- menuManager.appendToGroup(IContextMenuConstants.GROUP_OPEN, openInEditorAction);
-
- // Add to Task List menu
- // HACK: this should be a contribution
- final MenuManager subMenuManager = new MenuManager(MessageFormat.format(
- Messages.RepositorySearchResultView_Add_to_X_Category, TaskListView.LABEL_VIEW));
- List<AbstractTaskCategory> categories = new ArrayList<AbstractTaskCategory>(TasksUiInternal.getTaskList()
- .getCategories());
- Collections.sort(categories);
- for (final AbstractTaskCategory category : categories) {
- if (!(category instanceof UnmatchedTaskContainer)) {//.equals(TasksUiPlugin.getTaskList().getArchiveContainer())) {
- Action action = new Action() {
- @Override
- public void run() {
- moveToCategory(category);
- }
- };
- String text = category.getSummary();
- action.setText(text);
- action.setImageDescriptor(TasksUiImages.CATEGORY);
- subMenuManager.add(action);
- }
- }
- menuManager.appendToGroup(IContextMenuConstants.GROUP_OPEN, subMenuManager);
-
- // search actions
-
- menuManager.appendToGroup(IContextMenuConstants.GROUP_SEARCH, createQueryAction);
- menuManager.appendToGroup(IContextMenuConstants.GROUP_SEARCH, refineSearchAction);
- menuManager.appendToGroup(IContextMenuConstants.GROUP_SEARCH, openSearchWithBrowserAction);
-
- // sort actions
-
- MenuManager sortMenuManager = new MenuManager(Messages.RepositorySearchResultView_Sort_by);
- sortMenuManager.add(sortByPriorityAction);
- sortMenuManager.add(sortByDescriptionAction);
-
- sortByPriorityAction.setChecked(currentSortOrder == sortByPriorityAction.getSortOrder());
- sortByDescriptionAction.setChecked(currentSortOrder == sortByDescriptionAction.getSortOrder());
-
- menuManager.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenuManager);
- for (Action action : groupingActions) {
- menuManager.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, action);
- }
- for (Action action : filterActions) {
- menuManager.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, action);
- }
-
- }
-
- private void moveToCategory(AbstractTaskCategory category) {
- final IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
- StructuredSelection selection = (StructuredSelection) this.getViewer().getSelection();
- for (Iterator<?> iterator = selection.iterator(); iterator.hasNext();) {
- Object selectedObject = iterator.next();
- if (selectedObject instanceof ITask) {
- ITask task = (ITask) selectedObject;
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- final AddExistingTaskJob job = new AddExistingTaskJob(repository, task.getTaskId(), category);
- job.schedule();
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- progressService.showInDialog(RepositorySearchResultView.this.getSite().getShell(), job);
- }
- });
- }
- }
- }
-
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
- IMenuManager menuManager = getSite().getActionBars().getMenuManager();
- for (Action action : groupingActions) {
- menuManager.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, action);
- }
- menuManager.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, new Separator());
- for (Action action : filterActions) {
- menuManager.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, action);
- }
- }
-
- @Override
- public void setInput(ISearchResult newSearch, Object viewState) {
- super.setInput(newSearch, viewState);
- if (newSearch != null) {
- ISearchQuery query = ((RepositorySearchResult) newSearch).getQuery();
- IRepositoryQuery repositoryQuery = ((SearchHitCollector) query).getRepositoryQuery();
- openSearchWithBrowserAction.selectionChanged(new StructuredSelection(repositoryQuery));
- } else {
- openSearchWithBrowserAction.selectionChanged(StructuredSelection.EMPTY);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchHitCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchHitCollector.java
deleted file mode 100644
index 0da8723d9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchHitCollector.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.ITaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Used for returning results from Eclipse Search view. Collects results of a repository search.
- *
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class SearchHitCollector extends TaskDataCollector implements ISearchQuery {
-
- private final ITaskList taskList;
-
- private final TaskRepository repository;
-
- private final IRepositoryQuery repositoryQuery;
-
- private final RepositorySearchResult searchResult;
-
- private AbstractRepositoryConnector connector;
-
- public SearchHitCollector(ITaskList tasklist, TaskRepository repository, IRepositoryQuery repositoryQuery) {
- this.taskList = tasklist;
- this.repository = repository;
- this.repositoryQuery = repositoryQuery;
- this.searchResult = new RepositorySearchResult(this);
- }
-
- public void aboutToStart() {
- searchResult.removeAll();
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- NewSearchUI.activateSearchResultView();
- }
- });
- }
-
- @Override
- public void accept(TaskData taskData) {
- ITask task = taskList.getTask(repository.getRepositoryUrl(), taskData.getTaskId());
- if (task == null) {
- task = TasksUi.getRepositoryModel().createTask(repository, taskData.getTaskId());
- if (connector != null) {
- connector.updateTaskFromTaskData(repository, task, taskData);
- }
- }
- searchResult.addMatch(new Match(task, 0, 0));
- }
-
- public String getLabel() {
- return Messages.SearchHitCollector_Querying_Repository_;
- }
-
- public boolean canRerun() {
- return true;
- }
-
- public boolean canRunInBackground() {
- return true;
- }
-
- public ISearchResult getSearchResult() {
- return searchResult;
- }
-
- public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
- monitor = Policy.monitorFor(monitor);
-
- aboutToStart();
-
- if (monitor.isCanceled()) {
- throw new OperationCanceledException(Messages.SearchHitCollector_Search_cancelled);
- }
- connector = TasksUi.getRepositoryManager().getRepositoryConnector(repositoryQuery.getConnectorKind());
- if (connector != null) {
- final IStatus status = connector.performQuery(repository, repositoryQuery, this, null, monitor);
- if (!status.isOK()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.displayStatus(Messages.SearchHitCollector_Search_failed, status);
- }
- });
- } else {
- if (searchResult.getMatchCount() >= TaskDataCollector.MAX_HITS) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.displayStatus(Messages.SearchHitCollector_Search_returned_maximum_number_of_hits,
- RepositoryStatus.createStatus(repository.getRepositoryUrl(), IStatus.WARNING,
- TasksUiPlugin.ID_PLUGIN, Messages.SearchHitCollector_Max_allowed_number_of_hits_returned_exceeded));
- }
- });
- }
- }
- } else {
- return new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, IStatus.OK,
- Messages.SearchHitCollector_Repository_connector_could_not_be_found, null);
- }
-
- return Status.OK_STATUS;
- }
-
- public IRepositoryQuery getRepositoryQuery() {
- return repositoryQuery;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultContentProvider.java
deleted file mode 100644
index 98cb03481..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultContentProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * @author Rob Elves (moved into task.ui)
- * @see org.eclipse.jface.viewers.IContentProvider
- */
-public abstract class SearchResultContentProvider implements ITreeContentProvider {
-
- /** An empty array of objects */
- protected final Object[] EMPTY_ARR = new Object[0];
-
- /** The search result for this content provider */
- protected RepositorySearchResult searchResult;
-
- public void dispose() {
- // nothing to do
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof RepositorySearchResult) {
- initialize((RepositorySearchResult) newInput);
- }
- }
-
- /**
- * Initializes the content provider with the given search result.
- *
- * @param result
- * The search result to use with this content provider
- */
- protected void initialize(RepositorySearchResult result) {
- searchResult = result;
- }
-
- /**
- * This method is called whenever the set of matches for the given elements changes.
- *
- * @param updatedElements
- * The array of objects that has to be refreshed
- * @see
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#elementsChanged(java.lang.Object[])
- */
- public abstract void elementsChanged(Object[] updatedElements);
-
- /**
- * Clears the viewer.
- */
- public abstract void clear();
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSortAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSortAction.java
deleted file mode 100644
index f63e7c75d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSortAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.jface.action.Action;
-
-/**
- * This class sorts search results by a supplied category.
- *
- * @author Rob Elves (moved to tasks.ui)
- */
-public class SearchResultSortAction extends Action {
-
- /** The category that this class sorts Bugzilla search results by. */
- private final int bugSortOrder;
-
- /** The view where the Bugzilla search results are displayed. */
- private final RepositorySearchResultView bugPage;
-
- /**
- * Constructor
- *
- * @param label
- * The string used as the text for the action, or null if there is no text
- * @param page
- * The view where the Bugzilla search results are displayed.
- * @param sortOrder
- * The category that this class sorts Bugzilla search results by
- */
- public SearchResultSortAction(String label, RepositorySearchResultView page, int sortOrder) {
- super(label);
- bugPage = page;
- bugSortOrder = sortOrder;
- }
-
- /**
- * Reorder the Bugzilla search results.
- */
- @Override
- public void run() {
- bugPage.setSortOrder(bugSortOrder);
- }
-
- /**
- * Returns the category that this class sorts Bugzilla search results by.
- */
- public int getSortOrder() {
- return bugSortOrder;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorter.java
deleted file mode 100644
index f5a1411ba..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskKeyComparator;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * Sorts search results by summary.
- *
- * @author Rob Elves
- */
-public class SearchResultSorter extends ViewerSorter {
-
- private final TaskKeyComparator taskKeyComparator = new TaskKeyComparator();
-
- /**
- * Returns a negative, zero, or positive number depending on whether the first bug's summary goes before, is the
- * same as, or goes after the second element's summary.
- * <p>
- *
- * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object,
- * java.lang.Object)
- */
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- try {
-
- AbstractTask entry1 = (AbstractTask) e1;
- AbstractTask entry2 = (AbstractTask) e2;
- // NOTE we just comparing ids here, once summary and taskId separated
- // they should have their own column/sorter.
- return taskKeyComparator.compare(TaskComparator.getSortableFromElement(entry1),
- TaskComparator.getSortableFromElement(entry2));
- // return taskKeyComparator.compare(entry1.getDescription(),
- // entry2.getDescription());
- } catch (Exception ignored) {
- // do nothing
- }
-
- // if that didn't work, use the default compare method
- return super.compare(viewer, e1, e2);
- }
-
- /**
- * Returns the category of the given element. The category is a number used to allocate elements to bins; the bins
- * are arranged in ascending numeric order. The elements within a bin are arranged via a second level sort
- * criterion.
- * <p>
- *
- * @see org.eclipse.jface.viewers.ViewerSorter#category(Object)
- */
- @Override
- public int category(Object element) {
- try {
- ITask hit = (ITask) element;
- return Integer.parseInt(hit.getTaskId());
- } catch (Exception ignored) {
- // ignore if
- }
- // if that didn't work, use the default category method
- return super.category(element);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java
deleted file mode 100644
index 7b3a67d89..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterId.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * Sorts search results (AbstractQueryHit) by taskId.
- */
-public class SearchResultSorterId extends ViewerSorter {
-
- /**
- * Returns a negative, zero, or positive number depending on whether the first bug's taskId is less than, equal to,
- * or greater than the second bug's taskId.
- * <p>
- *
- * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object,
- * java.lang.Object)
- */
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- try {
- // cast the object and get its bug taskId
- ITask entry1 = (ITask) e1;
- Integer id1 = Integer.parseInt(entry1.getTaskId());
-
- // cast the other object and get its bug taskId
- ITask entry2 = (ITask) e2;
- Integer id2 = Integer.parseInt(entry2.getTaskId());
-
- // if neither is null, compare the bug taskId's
- if (id1 != null && id2 != null) {
- return id1.compareTo(id2);
- }
- } catch (Exception ignored) {
- // ignore if there is a problem
- }
-
- // if that didn't work, use the default compare method
- return super.compare(viewer, e1, e2);
- }
-
- /**
- * Returns the category of the given element. The category is a number used to allocate elements to bins; the bins
- * are arranged in ascending numeric order. The elements within a bin are arranged via a second level sort
- * criterion.
- * <p>
- *
- * @see org.eclipse.jface.viewers.ViewerSorter#category(Object)
- */
- @Override
- public int category(Object element) {
- try {
- ITask hit = (ITask) element;
- return Integer.parseInt(hit.getTaskId());
- } catch (Exception ignored) {
- // ignore
- }
- // if that didn't work, use the default category method
- return super.category(element);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java
deleted file mode 100644
index 534881703..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultSorterPriority.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * Sorts results of Bugzilla search by bug priority.
- *
- * @author Rob Elves (modifications)
- */
-public class SearchResultSorterPriority extends ViewerSorter {
-
- /**
- * Returns a negative, zero, or positive number depending on whether the first bug's priority goes before, is the
- * same as, or goes after the second element's priority.
- * <p>
- *
- * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object,
- * java.lang.Object)
- */
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- try {
- ITask hit1 = (ITask) e1;
- ITask hit2 = (ITask) e2;
- return hit1.getPriority().compareTo(hit2.getPriority());
- } catch (Exception ignored) {
- // do nothing
- }
- // if that didn't work, use the default compare method
- return super.compare(viewer, e1, e2);
- }
-
- /**
- * Returns the category of the given element. The category is a number used to allocate elements to bins; the bins
- * are arranged in ascending numeric order. The elements within a bin are arranged via a second level sort
- * criterion.
- * <p>
- *
- * @see org.eclipse.jface.viewers.ViewerSorter#category(Object)
- */
- @Override
- public int category(Object element) {
- try {
- ITask hit = (ITask) element;
- return Integer.parseInt(hit.getTaskId());
- } catch (Exception ignored) {
- // ignore if there is a problem
- }
- // if that didn't work, use the default category method
- return super.category(element);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java
deleted file mode 100644
index 0afc59d6f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultTreeContentProvider.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.Person;
-import org.eclipse.mylyn.internal.tasks.core.TaskGroup;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * This implementation of <code>SearchResultContentProvider</code> is used for the table view of a Bugzilla search
- * result.
- *
- * @author Rob Elves (moved into task.ui)
- * @author Mik Kersten
- */
-public class SearchResultTreeContentProvider extends SearchResultContentProvider {
-
- private final Set<Object> elements = new LinkedHashSet<Object>();
-
- private final Map<String, Person> owners = new HashMap<String, Person>();
-
- private final Map<String, TaskGroup> completeState = new HashMap<String, TaskGroup>();
-
- public enum GroupBy {
- NONE, OWNER, COMPLETION;
- }
-
- private GroupBy selectedGroup;
-
- public SearchResultTreeContentProvider() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof RepositorySearchResult) {
- searchResult = (RepositorySearchResult) newInput;
- clear();
- elementsChanged(searchResult.getElements());
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- if (inputElement == searchResult) {
- if (selectedGroup == GroupBy.OWNER) {
- return owners.values().toArray();
- } else if (selectedGroup == GroupBy.COMPLETION) {
- return completeState.values().toArray();
- } else {
- return elements.toArray();
- }
- } else {
- return EMPTY_ARR;
- }
- }
-
- public Object[] getChildren(Object parent) {
- if (parent instanceof TaskGroup || parent instanceof Person) {
- return ((ITaskContainer) parent).getChildren().toArray();
- } else {
- return EMPTY_ARR;
- }
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- @Override
- public void elementsChanged(Object[] updatedElements) {
- for (Object object : updatedElements) {
- boolean added = elements.add(object);
- if (added && object instanceof ITask) {
- AbstractTask task = ((AbstractTask) object);
- String owner = task.getOwner();
- if (owner == null) {
- owner = Messages.SearchResultTreeContentProvider__unknown_;
- }
- Person person = owners.get(owner);
- if (person == null) {
- person = new Person(owner, task.getConnectorKind(), task.getRepositoryUrl());
- owners.put(owner, person);
- }
- person.internalAddChild(task);
-
- TaskGroup completeIncomplete = null;
- if (task.isCompleted()) {
- completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Complete);
- if (completeIncomplete == null) {
- completeIncomplete = new TaskGroup("group-complete", Messages.SearchResultTreeContentProvider_Complete, GroupBy.COMPLETION.name()); //$NON-NLS-1$
- completeState.put(Messages.SearchResultTreeContentProvider_Complete, completeIncomplete);
- }
- } else {
- completeIncomplete = completeState.get(Messages.SearchResultTreeContentProvider_Incomplete);
- if (completeIncomplete == null) {
- completeIncomplete = new TaskGroup("group-incomplete", Messages.SearchResultTreeContentProvider_Incomplete, GroupBy.COMPLETION.name()); //$NON-NLS-1$
- completeState.put(Messages.SearchResultTreeContentProvider_Incomplete, completeIncomplete);
- }
- }
- completeIncomplete.internalAddChild(task);
- }
- }
- }
-
- @Override
- public void clear() {
- elements.clear();
- owners.clear();
- completeState.clear();
- }
-
- public GroupBy getSelectedGroup() {
- return selectedGroup;
- }
-
- public void setSelectedGroup(GroupBy selectedGroup) {
- this.selectedGroup = selectedGroup;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultsLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultsLabelProvider.java
deleted file mode 100644
index fba970216..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchResultsLabelProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.mylyn.internal.tasks.core.Person;
-import org.eclipse.mylyn.internal.tasks.core.TaskGroup;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class SearchResultsLabelProvider extends TaskElementLabelProvider {
-
- private final SearchResultContentProvider contentProvider;
-
- private final TreeViewer viewer;
-
- public SearchResultsLabelProvider(SearchResultContentProvider contentProvider, TreeViewer viewer) {
- super(true);
- this.contentProvider = contentProvider;
- this.viewer = viewer;
- }
-
- @Override
- public String getText(Object object) {
- if (object instanceof TaskGroup || object instanceof Person) {
- Object[] children = contentProvider.getChildren(object);
- ViewerFilter[] filters = viewer.getFilters();
- int filtered = 0;
- if (filters.length > 0) {
- for (Object child : children) {
- for (ViewerFilter filter : filters) {
- if (!filter.select(viewer, object, child)) {
- filtered++;
- }
- }
- }
- }
- if (filtered > 0) {
- return super.getText(object)
- + " (" //$NON-NLS-1$
- + MessageFormat.format(Messages.SearchResultsLabelProvider_OF, (children.length - filtered),
- children.length) + ")"; //$NON-NLS-1$
- } else {
- return super.getText(object) + " (" + children.length + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- return super.getText(object);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchScoreComputerAdapterFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchScoreComputerAdapterFactory.java
deleted file mode 100644
index 35b1b1337..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/SearchScoreComputerAdapterFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TaskSearchPage;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.search.ui.ISearchPageScoreComputer;
-
-/**
- * Implements a {@link IAdapterFactory} for {@link ISearchPageScoreComputer}s which ranks {@link AbstractTaskContainer}s
- * high for the task search page
- *
- * @author Willian Mitsuda
- */
-public class SearchScoreComputerAdapterFactory implements IAdapterFactory {
-
- private final ISearchPageScoreComputer computer = new ISearchPageScoreComputer() {
-
- public int computeScore(String pageId, Object input) {
- if (!TaskSearchPage.ID.equals(pageId)) {
- return ISearchPageScoreComputer.UNKNOWN;
- }
- if (input instanceof IRepositoryElement) {
- return 100;
- }
- return ISearchPageScoreComputer.LOWEST;
- }
-
- };
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (ISearchPageScoreComputer.class.equals(adapterType)) {
- return computer;
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList() {
- return new Class[] { ISearchPageScoreComputer.class };
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/StackTraceDuplicateDetector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/StackTraceDuplicateDetector.java
deleted file mode 100644
index 12af40934..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/StackTraceDuplicateDetector.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.search;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.internal.tasks.core.AbstractSearchHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Gail Murphy
- * @author Steffen Pingel
- */
-public class StackTraceDuplicateDetector extends AbstractDuplicateDetector {
-
- @Override
- public boolean canQuery(TaskData taskData) {
- return TasksUiPlugin.getDefault().getSearchHandler(taskData.getConnectorKind()) != null;
- }
-
- private String getDescription(TaskData taskData) {
- TaskAttribute attribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION);
- if (attribute == null) {
- attribute = taskData.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW);
- }
- return (attribute != null) ? attribute.getTaskData().getAttributeMapper().getValueLabel(attribute) : ""; //$NON-NLS-1$
- }
-
- @Override
- public IRepositoryQuery getDuplicatesQuery(TaskRepository taskRepository, TaskData taskData) throws CoreException {
- String description = getDescription(taskData);
- String searchString = getStackTraceFromDescription(description);
- if (searchString == null) {
- throw new CoreException(new Status(IStatus.INFO, TasksUiPlugin.ID_PLUGIN,
- "Unable to locate a stack trace in the description text.")); //$NON-NLS-1$
- }
-
- IRepositoryQuery query = TasksUi.getRepositoryModel().createRepositoryQuery(taskRepository);
- AbstractSearchHandler searchHandler = TasksUiPlugin.getDefault().getSearchHandler(
- taskRepository.getConnectorKind());
- if (searchHandler.queryForText(taskRepository, query, taskData, searchString)) {
- return query;
- }
- return null;
- }
-
- public static String getStackTraceFromDescription(String description) {
- String stackTrace = null;
-
- if (description == null) {
- return null;
- }
-
- String punct = "!\"#$%&'\\(\\)*+,-./:;\\<=\\>?@\\[\\]^_`\\{|\\}~\n"; //$NON-NLS-1$
- String lineRegex = " *at\\s+[\\w" + punct + "]+ ?\\(.*\\) *\n?"; //$NON-NLS-1$ //$NON-NLS-2$
- Pattern tracePattern = Pattern.compile(lineRegex);
- Matcher match = tracePattern.matcher(description);
-
- if (match.find()) {
- // record the index of the first stack trace line
- int start = match.start();
- int lastEnd = match.end();
-
- // find the last stack trace line
- while (match.find()) {
- lastEnd = match.end();
- }
-
- // make sure there's still room to find the exception
- if (start <= 0) {
- return null;
- }
-
- // count back to the line before the stack trace to find the
- // exception
- int stackStart = 0;
- int index = start - 1;
- while (index > 1 && description.charAt(index) == ' ') {
- index--;
- }
-
- // locate the exception line index
- stackStart = description.substring(0, index - 1).lastIndexOf("\n"); //$NON-NLS-1$
- stackStart = (stackStart == -1) ? 0 : stackStart + 1;
-
- stackTrace = description.substring(stackStart, lastEnd);
- }
-
- return stackTrace;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/messages.properties
deleted file mode 100644
index ba283104f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/messages.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-CreateQueryFromSearchAction_CLEAR_QUERY=Create Query
-CreateQueryFromSearchAction_Name_of_query_to_be_added_to_the_X=Name of query to be added to the {0}
-RepositorySearchResult_Task_search_X_matches=Task search - {0} matches
-RepositorySearchResult_Task_search_1_match=Task search - 1 match
-RepositorySearchResultView_Add_to_X_Category=Add to {0} Category
-RepositorySearchResultView_Create_Query_from_Search_=Create Query from Search...
-RepositorySearchResultView_Filter_Completed_Tasks=Filter Completed Tasks
-RepositorySearchResultView_Group_By_Owner=Group By Owner
-RepositorySearchResultView_Open_in_Editor=Open in Editor
-RepositorySearchResultView_Open_Search_with_Browser_Label=Open Search with Browser
-RepositorySearchResultView_Refine_Search_=Refine Search...
-RepositorySearchResultView_Sort_by=S&ort by
-RepositorySearchResultView_Task_Priority=Task Priority
-RepositorySearchResultView_Task_Summary=Task Summary
-
-SearchHitCollector_Max_allowed_number_of_hits_returned_exceeded=Max allowed number of hits returned exceeded. Some hits may not be displayed. Please narrow query scope.
-SearchHitCollector_Querying_Repository_=Querying Repository...
-SearchHitCollector_Repository_connector_could_not_be_found=Repository connector could not be found
-SearchHitCollector_Search_failed=Search failed
-SearchHitCollector_Search_cancelled=Search cancelled
-SearchHitCollector_Search_returned_maximum_number_of_hits=Search returned maximum number of hits
-
-SearchResultsLabelProvider_OF={0} of {1}
-
-SearchResultTreeContentProvider_Complete=Complete
-SearchResultTreeContentProvider_Incomplete=Incomplete
-SearchResultTreeContentProvider__unknown_=<unknown>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AbstractRetrieveTitleFromUrlJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AbstractRetrieveTitleFromUrlJob.java
deleted file mode 100644
index 47503e55b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AbstractRetrieveTitleFromUrlJob.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.commons.net.WebLocation;
-import org.eclipse.mylyn.commons.net.WebUtil;
-import org.eclipse.mylyn.internal.tasks.ui.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Retrieves a title for a web page.
- *
- * @author Wesley Coelho
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public abstract class AbstractRetrieveTitleFromUrlJob extends Job {
-
- private volatile String pageTitle;
-
- private final String url;
-
- public AbstractRetrieveTitleFromUrlJob(String url) {
- super(Messages.AbstractRetrieveTitleFromUrlJob_Retrieving_summary_from_URL);
- this.url = url;
- }
-
- public String getPageTitle() {
- return pageTitle;
- }
-
- public String getUrl() {
- return url;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- pageTitle = WebUtil.getTitleFromUrl(new WebLocation(getUrl()), monitor);
- if (pageTitle != null) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- titleRetrieved(pageTitle);
- }
- });
- }
- } catch (IOException e) {
- return new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Retrieving summary from URL failed", e); //$NON-NLS-1$
- }
- return Status.OK_STATUS;
- }
-
- protected void titleRetrieved(String pageTitle) {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
deleted file mode 100644
index 04d30271c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
-import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
-import org.eclipse.mylyn.internal.tasks.core.sync.SubmitTaskAttachmentJob;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Steffen Pingel
- */
-public class AttachmentUtil {
-
- protected static final int BUFFER_SIZE = 1024;
-
- public static final String CONTEXT_DESCRIPTION = "mylyn/context/zip"; //$NON-NLS-1$
-
- private static final String CONTEXT_DESCRIPTION_LEGACY = "mylar/context/zip"; //$NON-NLS-1$
-
- private static final String CONTEXT_FILENAME = "mylyn-context.zip"; //$NON-NLS-1$
-
- private static final String CONTEXT_CONTENT_TYPE = "application/octet-stream"; //$NON-NLS-1$
-
- public static boolean postContext(AbstractRepositoryConnector connector, TaskRepository repository, ITask task,
- String comment, TaskAttribute attribute, IProgressMonitor monitor) throws CoreException {
- AbstractTaskAttachmentHandler attachmentHandler = connector.getTaskAttachmentHandler();
- ContextCorePlugin.getContextStore().saveActiveContext();
-
- File file = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
- if (attachmentHandler != null && file != null && file.exists()) {
- FileTaskAttachmentSource attachment = new FileTaskAttachmentSource(file);
- attachment.setDescription(CONTEXT_DESCRIPTION);
- attachment.setName(CONTEXT_FILENAME);
- attachmentHandler.postContent(repository, task, attachment, comment, attribute, monitor);
- return true;
- }
- return false;
- }
-
- public static List<ITaskAttachment> getContextAttachments(TaskRepository repository, ITask task) {
- List<ITaskAttachment> contextAttachments = new ArrayList<ITaskAttachment>();
- TaskData taskData;
- try {
- taskData = TasksUi.getTaskDataManager().getTaskData(task);
- } catch (CoreException e) {
- // ignore
- return contextAttachments;
- }
- if (taskData != null) {
- List<TaskAttribute> taskAttachments = taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT);
- for (TaskAttribute attribute : taskAttachments) {
- TaskAttachment taskAttachment = new TaskAttachment(repository, task, attribute);
- taskData.getAttributeMapper().updateTaskAttachment(taskAttachment, attribute);
- if (isContext(taskAttachment)) {
- contextAttachments.add(taskAttachment);
- }
- }
- }
- return contextAttachments;
- }
-
- public static boolean hasContextAttachment(ITask task) {
- Assert.isNotNull(task);
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- List<ITaskAttachment> contextAttachments = getContextAttachments(repository, task);
- return contextAttachments.size() > 0;
- }
-
- public static boolean downloadContext(final ITask task, final ITaskAttachment attachment,
- final IRunnableContext context) {
- if (task.isActive()) {
- TasksUi.getTaskActivityManager().deactivateTask(task);
- }
- try {
- context.run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- File targetFile = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
- try {
- OutputStream out = new BufferedOutputStream(new FileOutputStream(targetFile));
- try {
- AttachmentUtil.downloadAttachment(attachment, out, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- out.close();
- }
- } catch (OperationCanceledException e) {
- throw new InterruptedException();
- } catch (IOException e) {
- throw new InvocationTargetException(
- new CoreException(new RepositoryStatus(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- RepositoryStatus.ERROR_IO, "Error writing to context file", e))); //$NON-NLS-1$
- }
- }
- });
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- TasksUiInternal.displayStatus(Messages.AttachmentUtil_Mylyn_Information, ((CoreException) e.getCause()).getStatus());
- } else {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Unexpected error while retrieving context", e)); //$NON-NLS-1$
- }
- return false;
- } catch (InterruptedException ignored) {
- // canceled
- return false;
- }
- TasksUiInternal.getTaskList().notifyElementChanged(task);
- TasksUi.getTaskActivityManager().activateTask(task);
- return true;
- }
-
- public static boolean uploadContext(final TaskRepository repository, final ITask task, final String comment,
- final IRunnableContext context) {
- ContextCorePlugin.getContextStore().saveActiveContext();
- File sourceContextFile = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
- if (!sourceContextFile.exists()) {
- TasksUiInternal.displayStatus(Messages.AttachmentUtil_Mylyn_Information, new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- Messages.AttachmentUtil_The_context_is_empty));
- return false;
- }
-
- FileTaskAttachmentSource source = new FileTaskAttachmentSource(sourceContextFile);
- source.setName(CONTEXT_FILENAME);
- source.setDescription(CONTEXT_DESCRIPTION);
- source.setContentType(CONTEXT_CONTENT_TYPE);
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- final SubmitJob submitJob = TasksUiInternal.getJobFactory().createSubmitTaskAttachmentJob(connector,
- repository, task, source, comment, null);
- try {
- context.run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (((SubmitTaskAttachmentJob) submitJob).run(monitor) == Status.CANCEL_STATUS) {
- throw new InterruptedException();
- }
- }
- });
- } catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Unexpected error while attaching context", e)); //$NON-NLS-1$
- return false;
- } catch (InterruptedException ignored) {
- // canceled
- return false;
- }
- if (submitJob.getStatus() != null) {
- TasksUiInternal.displayStatus(Messages.AttachmentUtil_Mylyn_Information, submitJob.getStatus());
- return false;
- }
- return true;
- }
-
- public static boolean hasLocalContext(ITask task) {
- Assert.isNotNull(task);
- return ContextCore.getContextManager().hasContext(task.getHandleIdentifier());
- }
-
- public static boolean isContext(ITaskAttachment attachment) {
- return CONTEXT_DESCRIPTION.equals(attachment.getDescription())
- || CONTEXT_DESCRIPTION_LEGACY.equals(attachment.getDescription());
- }
-
- public static boolean canUploadAttachment(ITask task) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- AbstractTaskAttachmentHandler attachmentHandler = connector.getTaskAttachmentHandler();
- if (attachmentHandler != null) {
- return attachmentHandler.canPostContent(repository, task);
- }
- return false;
- }
-
- public static boolean canDownloadAttachment(ITask task) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- AbstractTaskAttachmentHandler attachmentHandler = connector.getTaskAttachmentHandler();
- if (attachmentHandler != null) {
- return attachmentHandler.canGetContent(repository, task);
- }
- return false;
- }
-
- public static void downloadAttachment(ITaskAttachment attachment, OutputStream out, IProgressMonitor monitor)
- throws CoreException {
- try {
- monitor.beginTask(Messages.AttachmentUtil_Downloading_attachment, IProgressMonitor.UNKNOWN);
-
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- attachment.getConnectorKind());
- AbstractTaskAttachmentHandler handler = connector.getTaskAttachmentHandler();
- if (handler == null) {
- throw new CoreException(new RepositoryStatus(IStatus.INFO, TasksUiPlugin.ID_PLUGIN,
- RepositoryStatus.ERROR_INTERNAL, "The repository does not support attachments.")); //$NON-NLS-1$
- }
-
- InputStream in = handler.getContent(attachment.getTaskRepository(), attachment.getTask(),
- attachment.getTaskAttribute(), monitor);
- try {
- byte[] buffer = new byte[BUFFER_SIZE];
- while (true) {
- Policy.checkCanceled(monitor);
- int count = in.read(buffer);
- if (count == -1) {
- return;
- }
- out.write(buffer, 0, count);
- }
- } catch (IOException e) {
- throw new CoreException(new RepositoryStatus(attachment.getTaskRepository(), IStatus.ERROR,
- TasksUiPlugin.ID_PLUGIN, RepositoryStatus.ERROR_IO, "IO error reading attachment: " //$NON-NLS-1$
- + e.getMessage(), e));
- } finally {
- try {
- in.close();
- } catch (IOException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Error closing attachment stream", e)); //$NON-NLS-1$
- }
- }
- } finally {
- monitor.done();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ClipboardCopier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ClipboardCopier.java
deleted file mode 100644
index 895fe6ce1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ClipboardCopier.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Steffen Pingel
- */
-public abstract class ClipboardCopier {
-
- private Clipboard clipboard;
-
- public static String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-
- public ClipboardCopier() {
- }
-
- public void copy(IStructuredSelection selection) {
- if (!selection.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (Iterator<?> it = selection.iterator(); it.hasNext();) {
- Object item = it.next();
- String textForElement = getTextForElement(item);
- if (textForElement != null) {
- if (sb.length() > 0) {
- sb.append(LINE_SEPARATOR);
- sb.append(LINE_SEPARATOR);
- }
- sb.append(textForElement);
- }
- }
- copy(sb.toString());
- }
- }
-
- protected abstract String getTextForElement(Object element);
-
- public void copy(String text) {
- if (clipboard == null) {
- Display display = PlatformUI.getWorkbench().getDisplay();
- clipboard = new Clipboard(display);
- }
-
- TextTransfer textTransfer = TextTransfer.getInstance();
- clipboard.setContents(new Object[] { text }, new Transfer[] { textTransfer });
- }
-
- public void dispose() {
- if (clipboard != null) {
- clipboard.dispose();
- clipboard = null;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/CopyAttachmentToClipboardJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/CopyAttachmentToClipboardJob.java
deleted file mode 100644
index 8a47ef14e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/CopyAttachmentToClipboardJob.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.ByteArrayOutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Steffen Pingel
- */
-public class CopyAttachmentToClipboardJob extends Job {
-
- private final ITaskAttachment attachment;
-
- public CopyAttachmentToClipboardJob(ITaskAttachment attachment) {
- super(Messages.CopyAttachmentToClipboardJob_Copying_Attachment_to_Clipboard);
- this.attachment = attachment;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- AttachmentUtil.downloadAttachment(attachment, out, monitor);
- } catch (final CoreException e) {
- TasksUiInternal.asyncDisplayStatus(Messages.CopyAttachmentToClipboardJob_Copy_Attachment_to_Clipboard,
- e.getStatus());
- return Status.OK_STATUS;
- }
-
- String contents = new String(out.toByteArray());
- contents = contents.replaceAll("\r\n|\n", System.getProperty("line.separator")); //$NON-NLS-1$ //$NON-NLS-2$
- copyToClipboard(contents);
-
- return Status.OK_STATUS;
- }
-
- private void copyToClipboard(final String contents) {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
- clipboard.setContents(new Object[] { contents }, new Transfer[] { TextTransfer.getInstance() });
- clipboard.dispose();
- }
- });
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java
deleted file mode 100644
index a1347c4b4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/DownloadAttachmentJob.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-
-/**
- * @author Steffen Pingel
- */
-public class DownloadAttachmentJob extends Job {
-
- private final ITaskAttachment attachment;
-
- private final File targetFile;
-
- public DownloadAttachmentJob(ITaskAttachment attachment, File targetFile) {
- super(Messages.DownloadAttachmentJob_Downloading_Attachment);
- this.attachment = attachment;
- this.targetFile = targetFile;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- try {
- OutputStream out = new BufferedOutputStream(new FileOutputStream(targetFile));
- try {
- AttachmentUtil.downloadAttachment(attachment, out, monitor);
- } finally {
- out.close();
- }
- } catch (IOException e) {
- throw new CoreException(new RepositoryStatus(attachment.getTaskRepository(), IStatus.ERROR,
- TasksUiPlugin.ID_PLUGIN, RepositoryStatus.ERROR_IO, "IO error writing attachment: " //$NON-NLS-1$
- + e.getMessage(), e));
- }
- } catch (final CoreException e) {
- TasksUiInternal.asyncDisplayStatus(Messages.DownloadAttachmentJob_Copy_Attachment_to_Clipboard,
- e.getStatus());
- return Status.OK_STATUS;
- }
-
- return Status.OK_STATUS;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ImportExportUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ImportExportUtil.java
deleted file mode 100644
index 6786df7f6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/ImportExportUtil.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.File;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TransferList;
-import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.FileDialog;
-
-/**
- * @author Steffen Pingel
- */
-public class ImportExportUtil {
-
- public static void configureFilter(FileDialog dialog) {
- dialog.setFilterExtensions(new String[] { "*" + ITasksCoreConstants.FILE_EXTENSION }); //$NON-NLS-1$
- dialog.setFilterNames(new String[] { NLS.bind(Messages.ImportExportUtil_Tasks_and_queries_Filter0,
- ITasksCoreConstants.FILE_EXTENSION) });
- }
-
- public static void export(File file, IStructuredSelection selection) throws CoreException {
- // extract queries and tasks from selection
- TransferList list = new TransferList();
- for (Iterator<?> it = selection.iterator(); it.hasNext();) {
- Object element = it.next();
- if (element instanceof AbstractTaskCategory) {
- list.addCategory((TaskCategory) element);
- } else if (element instanceof RepositoryQuery) {
- list.addQuery((RepositoryQuery) element);
- } else if (element instanceof ITask) {
- list.addTask((AbstractTask) element);
- }
- }
-
- TaskListExternalizer externalizer = TasksUiPlugin.getDefault().createTaskListExternalizer();
- externalizer.writeTaskList(list, file);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java
deleted file mode 100644
index 8542bd013..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.util.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String AttachmentUtil_The_context_is_empty;
-
- public static String AttachmentUtil_Downloading_attachment;
-
- public static String AttachmentUtil_Mylyn_Information;
-
- public static String CopyAttachmentToClipboardJob_Copy_Attachment_to_Clipboard;
-
- public static String CopyAttachmentToClipboardJob_Copying_Attachment_to_Clipboard;
-
- public static String DownloadAttachmentJob_Copy_Attachment_to_Clipboard;
-
- public static String DownloadAttachmentJob_Downloading_Attachment;
-
- public static String ImportExportUtil_Tasks_and_queries_Filter0;
-
- public static String TaskDataExportOperation_exporting_task_data;
-
- public static String TasksUiInternal_Configuration_Refresh_Failed;
-
- public static String TasksUiInternal_Create_Task;
-
- public static String TasksUiInternal_The_new_task_will_be_added_to_the_X_container;
-
- public static String TasksUiInternal_Query_Synchronization_Failed;
-
- public static String TasksUiInternal_Task_Synchronization_Failed;
-
- public static String TasksUiInternal__hour_;
-
- public static String TasksUiInternal__hours_;
-
- public static String TasksUiInternal__minute_;
-
- public static String TasksUiInternal__minutes_;
-
- public static String TasksUiInternal__second;
-
- public static String TasksUiInternal__seconds;
-
- public static String TasksUiInternal_Failed_to_open_task;
-
- public static String TasksUiInternal_No_repository_found;
-
- public static String TasksUiInternal_See_error_log_for_details;
-
- public static String TasksUiMenus_Copy_Contents;
-
- public static String TasksUiMenus_Copy_URL;
-
- public static String TasksUiMenus_File_exists_;
-
- public static String TasksUiMenus_Overwrite_existing_file_;
-
- public static String TasksUiMenus_Save_;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java
deleted file mode 100644
index d73efb9f1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/PlatformUtil.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * David Green - fix for bug 247182
- * Frank Becker - fixes for bug 259877
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.lang.reflect.Method;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-
-/**
- * @author Steffen Pingel
- */
-public class PlatformUtil {
-
- private static ByteArrayTransfer urlTransfer;
- static {
- // TODO e3.4 use URLTransfer directly and not through reflection
- // URLTransfer is package protected in Eclipse 3.3 (bug 100095)
- // use reflection to access instance for now
- try {
- Class<?> clazz = Class.forName("org.eclipse.swt.dnd.URLTransfer"); //$NON-NLS-1$
- Method method = clazz.getMethod("getInstance"); //$NON-NLS-1$
- if (method != null) {
- urlTransfer = (ByteArrayTransfer) method.invoke(null);
- }
- } catch (Throwable e) {
- // ignore
- }
- if (urlTransfer == null) {
- urlTransfer = new ByteArrayTransfer() {
-
- private static final String TYPE = "dummy"; //$NON-NLS-1$
-
- private final int TYPE_ID = registerType(TYPE);
-
- @Override
- protected int[] getTypeIds() {
- return new int[] { TYPE_ID };
- }
-
- @Override
- protected String[] getTypeNames() {
- return new String[] { TYPE };
- }
-
- };
- }
- }
-
- /**
- * bug 247182: file import dialog doesn't work on Mac OS X if the file extension has more than one dot.
- */
- public static String[] getFilterExtensions(String... extensions) {
- for (int i = 0; i < extensions.length; i++) {
- String extension = extensions[i];
- if (Platform.OS_MACOSX.equals(Platform.getOS())) {
- int j = extension.lastIndexOf('.');
- if (j != -1) {
- extension = extension.substring(j);
- }
- }
- extensions[i] = "*" + extension; //$NON-NLS-1$
- }
- return extensions;
- }
-
- public static int getToolTipXShift() {
- if ("gtk".equals(SWT.getPlatform()) || "carbon".equals(SWT.getPlatform()) || "cocoa".equals(SWT.getPlatform())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return -26;
- } else {
- return -23;
- }
- }
-
- public static int getTreeImageOffset() {
- return "cocoa".equals(SWT.getPlatform()) ? 15 : 20; //$NON-NLS-1$
- }
-
- public static int getTreeItemSquish() {
- if ("gtk".equals(SWT.getPlatform())) { //$NON-NLS-1$
- return 8;
- } else if ("carbon".equals(SWT.getPlatform()) || "cocoa".equals(SWT.getPlatform())) { //$NON-NLS-1$ //$NON-NLS-2$
- return 3;
- } else {
- return 0;
- }
- }
-
- public static boolean isPaintItemClippingRequired() {
- return "gtk".equals(SWT.getPlatform()); //$NON-NLS-1$
- }
-
- public static ByteArrayTransfer getUrlTransfer() {
- return urlTransfer;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/SelectionProviderAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/SelectionProviderAdapter.java
deleted file mode 100644
index 501d5a569..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/SelectionProviderAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import org.eclipse.core.commands.common.EventManager;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-/**
- * @author Steffen Pingel
- */
-public class SelectionProviderAdapter extends EventManager implements ISelectionProvider {
-
- private ISelection selection;
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- addListenerObject(listener);
- }
-
- public ISelection getSelection() {
- return selection;
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- removeListenerObject(listener);
- }
-
- protected void selectionChanged(final SelectionChangedEvent event) {
- Object[] listeners = getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
- SafeRunner.run(new SafeRunnable() {
- public void run() {
- listener.selectionChanged(event);
- }
- });
- }
- }
-
- public void setSelection(ISelection selection) {
- this.selection = selection;
- selectionChanged(new SelectionChangedEvent(this, selection));
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskAttachmentPropertyTester.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskAttachmentPropertyTester.java
deleted file mode 100644
index 73722c3b9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskAttachmentPropertyTester.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Maarten Meijer - improvements for bug 252699
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskAttachmentPropertyTester extends PropertyTester {
-
- private static final String PROPERTY_IS_CONTEXT = "isContext"; //$NON-NLS-1$
-
- private static final String PROPERTY_HAS_URL = "hasUrl"; //$NON-NLS-1$
-
- private boolean equals(boolean value, Object expectedValue) {
- return new Boolean(value).equals(expectedValue);
- }
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof ITaskAttachment) {
- ITaskAttachment taskAttachment = (ITaskAttachment) receiver;
- if (PROPERTY_IS_CONTEXT.equals(property)) {
- return equals(AttachmentUtil.isContext(taskAttachment), expectedValue);
- }
- if (PROPERTY_HAS_URL.equals(property)) {
- return equals(taskAttachment.getUrl() != null && taskAttachment.getUrl().length() > 0, expectedValue);
- }
-
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskComparator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskComparator.java
deleted file mode 100644
index 7cd1d5a49..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskComparator.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - improvements for bug 231336
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.util.Comparator;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.internal.tasks.ui.dialogs.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskKeyComparator;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Mik Kersten
- * @author Frank Becker
- */
-public class TaskComparator implements Comparator<ITask> {
-
- private final TaskKeyComparator taskKeyComparator = new TaskKeyComparator();
-
- public enum SortByIndex {
- PRIORITY, SUMMARY, DATE_CREATED, TASK_ID;
-
- public String getLabel() {
- switch (this) {
- case PRIORITY:
- return Messages.TaskCompareDialog_Priority;
- case SUMMARY:
- return Messages.TaskCompareDialog_Summary;
- case DATE_CREATED:
- return Messages.TaskCompareDialog_DateCreated;
- case TASK_ID:
- return Messages.TaskCompareDialog_TaskID;
- default:
- return null;
- }
- }
-
- public static SortByIndex valueOfLabel(String label) {
- for (SortByIndex value : values()) {
- if (value.getLabel().equals(label)) {
- return value;
- }
- }
- return null;
- }
-
- }
-
- public static final int DEFAULT_SORT_DIRECTION = 1;
-
- /**
- * Return a array of values to pass to taskKeyComparator.compare() for sorting
- *
- * @param element
- * the element to sort
- * @return String array[component, taskId, summary]
- */
- public static String[] getSortableFromElement(IRepositoryElement element) {
- final String a[] = new String[] { "", null, element.getSummary() }; //$NON-NLS-1$
-
- if (element instanceof ITask) {
- ITask task1 = (ITask) element;
- if (task1.getTaskKey() != null) {
- a[1] = task1.getTaskKey();
- }
- }
- return a;
- }
-
- private int sortDirection = DEFAULT_SORT_DIRECTION;
-
- private SortByIndex sortByIndex = SortByIndex.PRIORITY;
-
- private int sortDirection2 = DEFAULT_SORT_DIRECTION;
-
- private SortByIndex sortByIndex2 = SortByIndex.DATE_CREATED;
-
- public TaskComparator() {
- }
-
- public int compare(ITask element1, ITask element2) {
- if (SortByIndex.PRIORITY.equals(sortByIndex)) {
- int result = sortByPriority(element1, element2, sortDirection);
- if (result != 0) {
- return result;
- }
-
- if (SortByIndex.DATE_CREATED.equals(sortByIndex2)) {
- return sortByDate(element1, element2, sortDirection2);
- } else {
- if (SortByIndex.SUMMARY.equals(sortByIndex2)) {
- return sortBySummary(element1, element2, sortDirection2);
- } else if (SortByIndex.TASK_ID.equals(sortByIndex2)) {
- return sortByID(element1, element2, sortDirection2);
- } else {
- return result;
- }
- }
- } else if (SortByIndex.DATE_CREATED.equals(sortByIndex)) {
- int result = sortByDate(element1, element2, sortDirection);
- if (result != 0) {
- return result;
- }
- if (SortByIndex.PRIORITY.equals(sortByIndex2)) {
- return sortByPriority(element1, element2, sortDirection2);
- } else {
- if (SortByIndex.SUMMARY.equals(sortByIndex2)) {
- return sortBySummary(element1, element2, sortDirection2);
- } else if (SortByIndex.TASK_ID.equals(sortByIndex2)) {
- return sortByID(element1, element2, sortDirection2);
- } else {
- return result;
- }
- }
- } else if (SortByIndex.SUMMARY.equals(sortByIndex)) {
- int result = sortBySummary(element1, element2, sortDirection);
- if (result != 0) {
- return result;
- }
- if (SortByIndex.DATE_CREATED.equals(sortByIndex2)) {
- return sortByDate(element1, element2, sortDirection2);
- } else {
- if (SortByIndex.PRIORITY.equals(sortByIndex2)) {
- return sortByPriority(element1, element2, sortDirection2);
- } else if (SortByIndex.TASK_ID.equals(sortByIndex2)) {
- return sortByID(element1, element2, sortDirection2);
- } else {
- return result;
- }
- }
- } else {
- int result = sortByID(element1, element2, sortDirection);
- if (result != 0) {
- return result;
- }
- if (SortByIndex.DATE_CREATED.equals(sortByIndex2)) {
- return sortByDate(element1, element2, sortDirection2);
- } else {
- if (SortByIndex.PRIORITY.equals(sortByIndex2)) {
- return sortByPriority(element1, element2, sortDirection2);
- } else if (SortByIndex.SUMMARY.equals(sortByIndex2)) {
- return sortBySummary(element1, element2, sortDirection2);
- } else {
- return result;
- }
- }
- }
- }
-
- private int sortBySummary(ITask element1, ITask element2, int sortDirection) {
- return sortDirection * (element1.getSummary().compareToIgnoreCase(element2.getSummary()));
- }
-
- private int sortByID(ITask element1, ITask element2, int sortDirection) {
- String key1 = element1.getTaskKey();
- String key2 = element2.getTaskKey();
- if (key1 == null) {
- return (key2 != null) ? sortDirection : 0;
- } else if (key2 == null) {
- return -sortDirection;
- }
- return sortDirection * taskKeyComparator.compare2(key1, key2);
- }
-
- private int sortByPriority(ITask element1, ITask element2, int sortDirection) {
- return sortDirection * (element1.getPriority().compareToIgnoreCase(element2.getPriority()));
- }
-
- private int sortByDate(ITask element1, ITask element2, int sortDirection) {
- if (element1.getCreationDate() == null) {
- return (element2.getCreationDate() != null) ? sortDirection : 0;
- } else if (element2.getCreationDate() == null) {
- return -sortDirection;
- }
- return sortDirection * (element1.getCreationDate().compareTo(element2.getCreationDate()));
- }
-
- public SortByIndex getSortByIndex() {
- return sortByIndex;
- }
-
- public void setSortByIndex(SortByIndex sortByIndex) {
- Assert.isNotNull(sortByIndex);
- this.sortByIndex = sortByIndex;
- }
-
- public int getSortDirection() {
- return sortDirection;
- }
-
- public void setSortDirection(int sortDirection) {
- this.sortDirection = sortDirection;
- }
-
- public SortByIndex getSortByIndex2() {
- return sortByIndex2;
- }
-
- public void setSortByIndex2(SortByIndex sortByIndex) {
- Assert.isNotNull(sortByIndex);
- this.sortByIndex2 = sortByIndex;
- }
-
- public int getSortDirection2() {
- return sortDirection2;
- }
-
- public void setSortDirection2(int sortDirection) {
- this.sortDirection2 = sortDirection;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskContainerComparator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskContainerComparator.java
deleted file mode 100644
index 0a1d866ba..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskContainerComparator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.util.Comparator;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskContainerComparator implements Comparator<AbstractTaskContainer> {
-
- public int compare(AbstractTaskContainer c1, AbstractTaskContainer c2) {
- if (c1.equals(TasksUiPlugin.getTaskList().getDefaultCategory())) {
- return -1;
- } else if (c2.equals(TasksUiPlugin.getTaskList().getDefaultCategory())) {
- return 1;
- } else {
- return c1.getSummary().compareToIgnoreCase(c2.getSummary());
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataExportOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataExportOperation.java
deleted file mode 100644
index fa3b49f6c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataExportOperation.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.commons.core.ZipFileUtil;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-
-/**
- * Zips task data up to specified directly and filename.
- *
- * @author Wesley Coelho
- * @author Mik Kersten
- * @author Rob Elves
- *
- * TODO: Move into internal.tasks.core
- */
-@SuppressWarnings("restriction")
-public class TaskDataExportOperation implements IRunnableWithProgress {
-
- private static final String EXPORT_JOB_LABEL = Messages.TaskDataExportOperation_exporting_task_data;
-
- private static final Pattern excludeHidden = Pattern.compile("^\\."); //$NON-NLS-1$
-
- private static final Pattern excludeBackup = Pattern.compile("backup\\z"); //$NON-NLS-1$
-
- private final String destinationDirectory;
-
- private final String destinationFilename;
-
- public TaskDataExportOperation(String destinationDirectory, String destinationFilename) {
- this.destinationFilename = destinationFilename;
- this.destinationDirectory = destinationDirectory;
- }
-
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- monitor = Policy.monitorFor(monitor);
- Set<File> filesToExport = new HashSet<File>();
-
- selectFiles(filesToExport);
-
- if (filesToExport.size() > 0 && Platform.isRunning()) {
- try {
- monitor.beginTask(EXPORT_JOB_LABEL, filesToExport.size() + 1);
-
- Job.getJobManager().beginRule(ITasksCoreConstants.ROOT_SCHEDULING_RULE,
- new SubProgressMonitor(monitor, 1));
- File destZipFile = new File(destinationDirectory + File.separator + destinationFilename);
-
- //TODO: append a (2) to the file?
- if (destZipFile.exists()) {
- destZipFile.delete();
- }
-
- ZipFileUtil.createZipFile(destZipFile, new ArrayList<File>(filesToExport), TasksUiPlugin.getDefault()
- .getDataDirectory(), monitor);
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not perform export", //$NON-NLS-1$
- e));
- } finally {
-
- Job.getJobManager().endRule(ITasksCoreConstants.ROOT_SCHEDULING_RULE);
- monitor.done();
- }
- }
- }
-
- protected void selectFiles(Set<File> filesToExport) {
- Set<Pattern> exclusionPatterns = new HashSet<Pattern>();
- exclusionPatterns.add(excludeHidden);
- exclusionPatterns.add(excludeBackup);
- String dataRoot = TasksUiPlugin.getDefault().getDataDirectory();
- File dataFolder = new File(dataRoot);
- for (File file : dataFolder.listFiles()) {
- boolean exclude = false;
- for (Pattern pattern : exclusionPatterns) {
- if (pattern.matcher(file.getName()).find()) {
- exclude = true;
- break;
- }
- }
- if (!exclude) {
- filesToExport.add(file);
- }
- }
-
- }
-
- protected File getSourceFolder() {
- return new File(TasksUiPlugin.getDefault().getDataDirectory());
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataSnapshotOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataSnapshotOperation.java
deleted file mode 100644
index 227fc6072..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDataSnapshotOperation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.File;
-import java.util.Set;
-
-/**
- * @author Robert Elves
- */
-public class TaskDataSnapshotOperation extends TaskDataExportOperation {
-
- public TaskDataSnapshotOperation(String destinationDirectory, String destinationFilename) {
- super(destinationDirectory, destinationFilename);
- }
-
- @Override
- protected void selectFiles(Set<File> filesToExport) {
-
- filesToExport.add(new File(getSourceFolder(), "tasks.xml.zip")); //$NON-NLS-1$
- filesToExport.add(new File(getSourceFolder(), "repositories.xml.zip")); //$NON-NLS-1$
- filesToExport.add(new File(getSourceFolder(), "contexts/activity.xml.zip")); //$NON-NLS-1$
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDragSourceListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDragSourceListener.java
deleted file mode 100644
index abf02f0cb..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskDragSourceListener.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Jevgeni Holodkov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-
-/**
- * @author Mik Kersten
- * @author Leo Dos Santos
- * @author Steffen Pingel
- */
-public class TaskDragSourceListener extends DragSourceAdapter {
-
- private IStructuredSelection currentSelection;
-
- private final ISelectionProvider selectionProvider;
-
- public TaskDragSourceListener(ISelectionProvider selectionProvider) {
- this.selectionProvider = selectionProvider;
- }
-
- @Override
- public void dragStart(DragSourceEvent event) {
- ISelection selection = selectionProvider.getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- this.currentSelection = (IStructuredSelection) selection;
- Iterator<?> it = currentSelection.iterator();
- while (it.hasNext()) {
- Object item = it.next();
- if (item instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) item;
- for (AbstractTaskContainer container : task.getParentContainers()) {
- if (container instanceof UnsubmittedTaskContainer) {
- event.doit = false;
- return;
- }
- }
- }
- }
- } else {
- this.currentSelection = null;
- event.doit = false;
- }
- }
-
- @Override
- public void dragSetData(DragSourceEvent event) {
- if (currentSelection == null || currentSelection.isEmpty()) {
- return;
- }
-
- if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
- LocalSelectionTransfer.getTransfer().setSelection(currentSelection);
- } else if (FileTransfer.getInstance().isSupportedType(event.dataType)) {
- try {
- File file = File.createTempFile(ITasksCoreConstants.EXPORT_FILE_NAME,
- ITasksCoreConstants.FILE_EXTENSION);
- file.deleteOnExit();
- ImportExportUtil.export(file, currentSelection);
-
- String[] paths = new String[1];
- paths[0] = file.getAbsolutePath();
- event.data = paths;
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Problems encountered dragging task", //$NON-NLS-1$
- e));
- } catch (IOException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Problems encountered dragging task", //$NON-NLS-1$
- e));
- }
- } else if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = CopyTaskDetailsAction.getTextForTask(currentSelection.getFirstElement());
- }
- }
-
- @Override
- public void dragFinished(DragSourceEvent event) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
- LocalSelectionTransfer.getTransfer().setSelection(null);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java
deleted file mode 100644
index 4828c2698..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskPropertyTester.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskPropertyTester extends PropertyTester {
-
- private static final String PROPERTY_CAN_GET_ATTACHEMNT = "canGetAttachment"; //$NON-NLS-1$
-
- private static final String PROPERTY_CAN_POST_ATTACHMENT = "canPostAttachment"; //$NON-NLS-1$
-
- private static final String PROPERTY_CONNECTOR_KIND = "connectorKind"; //$NON-NLS-1$
-
- private static final String PROPERTY_HAS_EDITS = "hasEdits"; //$NON-NLS-1$
-
- private static final String PROPERTY_HAS_LOCAL_CONTEXT = "hasLocalContext"; //$NON-NLS-1$
-
- private static final String PROPERTY_HAS_REPOSITORY_CONTEXT = "hasRepositoryContext"; //$NON-NLS-1$
-
- private static final String PROPERTY_IS_COMPLETED = "isCompleted"; //$NON-NLS-1$
-
- private static final String PROPERTY_IS_LOCAL = "isLocal"; //$NON-NLS-1$
-
- private static final String PROPERTY_LOCAL_COMPLETION_STATE = "hasLocalCompletionState"; //$NON-NLS-1$
-
- private boolean equals(boolean value, Object expectedValue) {
- return new Boolean(value).equals(expectedValue);
- }
-
- @SuppressWarnings("deprecation")
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof ITask) {
- ITask task = (ITask) receiver;
- if (PROPERTY_CONNECTOR_KIND.equals(property)) {
- return task.getConnectorKind().equals(expectedValue);
- } else if (PROPERTY_CAN_POST_ATTACHMENT.equals(property)) {
- return equals(AttachmentUtil.canDownloadAttachment(task), expectedValue);
- } else if (PROPERTY_CAN_GET_ATTACHEMNT.equals(property)) {
- return equals(AttachmentUtil.canUploadAttachment(task), expectedValue);
- } else if (PROPERTY_HAS_EDITS.equals(property)) {
- return equals(ClearOutgoingAction.hasOutgoingChanges(task), expectedValue);
- } else if (PROPERTY_HAS_LOCAL_CONTEXT.equals(property)) {
- return equals(AttachmentUtil.hasLocalContext(task), expectedValue);
- } else if (PROPERTY_HAS_REPOSITORY_CONTEXT.equals(property)) {
- return equals(AttachmentUtil.hasContextAttachment(task), expectedValue);
- } else if (PROPERTY_IS_COMPLETED.equals(property)) {
- return equals(task.isCompleted(), expectedValue);
- } else if (PROPERTY_IS_LOCAL.equals(property)) {
- return (task instanceof AbstractTask) && equals(((AbstractTask) task).isLocal(), expectedValue);
- } else if (PROPERTY_LOCAL_COMPLETION_STATE.equals(property)) {
- return equals(TasksUiInternal.hasLocalCompletionState(task), expectedValue);
- }
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskRepositoryPropertyTester.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskRepositoryPropertyTester.java
deleted file mode 100644
index 0a7027b92..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TaskRepositoryPropertyTester.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jingwen Ou and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jingwen Ou - initial API and implementation
- * Tasktop Technologies - enhancements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Jingwen Ou
- * @author Steffen Pingel
- */
-public class TaskRepositoryPropertyTester extends PropertyTester {
-
- private static final String PROPERTY_CONNECTOR_KIND = "connectorKind"; //$NON-NLS-1$
-
- private static final String PROPERTY_USER_MANAGED = "userManaged"; //$NON-NLS-1$
-
- private boolean equals(boolean value, Object expectedValue) {
- return new Boolean(value).equals(expectedValue);
- }
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof TaskRepository) {
- TaskRepository repository = (TaskRepository) receiver;
- if (PROPERTY_CONNECTOR_KIND.equals(property)) {
- return repository.getConnectorKind().equals(expectedValue);
- } else if (PROPERTY_USER_MANAGED.equals(property)) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- return equals(connector != null && connector.isUserManaged(), expectedValue);
- }
- }
-
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiExtensionReader.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiExtensionReader.java
deleted file mode 100644
index 1ed0e711f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiExtensionReader.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
-import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTaskListPresentation;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.tasks.core.AbstractDuplicateDetector;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
-import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * @author Mik Kersten
- * @author Shawn Minto
- * @author Rob Elves
- */
-public class TasksUiExtensionReader {
-
- public static final String EXTENSION_REPOSITORIES = "org.eclipse.mylyn.tasks.ui.repositories"; //$NON-NLS-1$
-
- public static final String EXTENSION_REPOSITORY_LINKS_PROVIDERS = "org.eclipse.mylyn.tasks.ui.projectLinkProviders"; //$NON-NLS-1$
-
- public static final String EXTENSION_TEMPLATES = "org.eclipse.mylyn.tasks.core.templates"; //$NON-NLS-1$
-
- public static final String EXTENSION_TMPL_REPOSITORY = "repository"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_LABEL = "label"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_URLREPOSITORY = "urlRepository"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_REPOSITORYKIND = "repositoryKind"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_CHARACTERENCODING = "characterEncoding"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_ANONYMOUS = "anonymous"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_VERSION = "version"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_URLNEWTASK = "urlNewTask"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_URLTASK = "urlTask"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_URLTASKQUERY = "urlTaskQuery"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_NEWACCOUNTURL = "urlNewAccount"; //$NON-NLS-1$
-
- public static final String ELMNT_TMPL_ADDAUTO = "addAutomatically"; //$NON-NLS-1$
-
- public static final String ELMNT_REPOSITORY_CONNECTOR = "connectorCore"; //$NON-NLS-1$
-
- public static final String ELMNT_REPOSITORY_LINK_PROVIDER = "linkProvider"; //$NON-NLS-1$
-
- public static final String ELMNT_REPOSITORY_UI = "connectorUi"; //$NON-NLS-1$
-
- public static final String ELMNT_MIGRATOR = "taskListMigrator"; //$NON-NLS-1$
-
- public static final String ATTR_BRANDING_ICON = "brandingIcon"; //$NON-NLS-1$
-
- public static final String ATTR_OVERLAY_ICON = "overlayIcon"; //$NON-NLS-1$
-
- public static final String ELMNT_TYPE = "type"; //$NON-NLS-1$
-
- public static final String ELMNT_QUERY_PAGE = "queryPage"; //$NON-NLS-1$
-
- public static final String ELMNT_SETTINGS_PAGE = "settingsPage"; //$NON-NLS-1$
-
- public static final String EXTENSION_TASK_CONTRIBUTOR = "org.eclipse.mylyn.tasks.ui.actions"; //$NON-NLS-1$
-
- public static final String ATTR_ACTION_CONTRIBUTOR_CLASS = "taskHandlerClass"; //$NON-NLS-1$
-
- public static final String DYNAMIC_POPUP_ELEMENT = "dynamicPopupMenu"; //$NON-NLS-1$
-
- public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
-
- public static final String ATTR_MENU_PATH = "menuPath"; //$NON-NLS-1$
-
- public static final String EXTENSION_EDITORS = "org.eclipse.mylyn.tasks.ui.editors"; //$NON-NLS-1$
-
- public static final String ELMNT_TASK_EDITOR_PAGE_FACTORY = "pageFactory"; //$NON-NLS-1$
-
- public static final String EXTENSION_DUPLICATE_DETECTORS = "org.eclipse.mylyn.tasks.ui.duplicateDetectors"; //$NON-NLS-1$
-
- public static final String ELMNT_DUPLICATE_DETECTOR = "detector"; //$NON-NLS-1$
-
- public static final String ATTR_NAME = "name"; //$NON-NLS-1$
-
- public static final String ATTR_KIND = "kind"; //$NON-NLS-1$
-
- private static final String EXTENSION_PRESENTATIONS = "org.eclipse.mylyn.tasks.ui.presentations"; //$NON-NLS-1$
-
- public static final String ELMNT_PRESENTATION = "presentation"; //$NON-NLS-1$
-
- public static final String ATTR_ICON = "icon"; //$NON-NLS-1$
-
- public static final String ATTR_PRIMARY = "primary"; //$NON-NLS-1$
-
- public static final String ATTR_ID = "id"; //$NON-NLS-1$
-
- private static boolean coreExtensionsRead = false;
-
- public static void initStartupExtensions(TaskListExternalizer taskListExternalizer) {
- if (!coreExtensionsRead) {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- // NOTE: has to be read first, consider improving
- List<AbstractTaskListMigrator> migrators = new ArrayList<AbstractTaskListMigrator>();
- IExtensionPoint repositoriesExtensionPoint = registry.getExtensionPoint(EXTENSION_REPOSITORIES);
- IExtension[] repositoryExtensions = repositoriesExtensionPoint.getExtensions();
- for (IExtension repositoryExtension : repositoryExtensions) {
- IConfigurationElement[] elements = repositoryExtension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(ELMNT_REPOSITORY_CONNECTOR)) {
- readRepositoryConnectorCore(element);
- } else if (element.getName().equals(ELMNT_MIGRATOR)) {
- readMigrator(element, migrators);
- }
- }
- }
- taskListExternalizer.initialize(migrators);
-
- IExtensionPoint templatesExtensionPoint = registry.getExtensionPoint(EXTENSION_TEMPLATES);
- IExtension[] templateExtensions = templatesExtensionPoint.getExtensions();
- for (IExtension templateExtension : templateExtensions) {
- IConfigurationElement[] elements = templateExtension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(EXTENSION_TMPL_REPOSITORY)) {
- readRepositoryTemplate(element);
- }
- }
- }
-
- IExtensionPoint presentationsExtensionPoint = registry.getExtensionPoint(EXTENSION_PRESENTATIONS);
- IExtension[] presentations = presentationsExtensionPoint.getExtensions();
- for (IExtension presentation : presentations) {
- IConfigurationElement[] elements = presentation.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- readPresentation(element);
- }
- }
-
- // NOTE: causes ..mylyn.context.ui to load
- IExtensionPoint editorsExtensionPoint = registry.getExtensionPoint(EXTENSION_EDITORS);
- IExtension[] editors = editorsExtensionPoint.getExtensions();
- for (IExtension editor : editors) {
- IConfigurationElement[] elements = editor.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(ELMNT_TASK_EDITOR_PAGE_FACTORY)) {
- readTaskEditorPageFactory(element);
- }
- }
- }
-
- coreExtensionsRead = true;
- }
- }
-
- public static void initWorkbenchUiExtensions() {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- IExtensionPoint repositoriesExtensionPoint = registry.getExtensionPoint(EXTENSION_REPOSITORIES);
- IExtension[] repositoryExtensions = repositoriesExtensionPoint.getExtensions();
- for (IExtension repositoryExtension : repositoryExtensions) {
- IConfigurationElement[] elements = repositoryExtension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(ELMNT_REPOSITORY_UI)) {
- readRepositoryConnectorUi(element);
- }
- }
- }
-
- IExtensionPoint linkProvidersExtensionPoint = registry.getExtensionPoint(EXTENSION_REPOSITORY_LINKS_PROVIDERS);
- IExtension[] linkProvidersExtensions = linkProvidersExtensionPoint.getExtensions();
- for (IExtension linkProvidersExtension : linkProvidersExtensions) {
- IConfigurationElement[] elements = linkProvidersExtension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(ELMNT_REPOSITORY_LINK_PROVIDER)) {
- readLinkProvider(element);
- }
- }
- }
-
- IExtensionPoint duplicateDetectorsExtensionPoint = registry.getExtensionPoint(EXTENSION_DUPLICATE_DETECTORS);
- IExtension[] dulicateDetectorsExtensions = duplicateDetectorsExtensionPoint.getExtensions();
- for (IExtension dulicateDetectorsExtension : dulicateDetectorsExtensions) {
- IConfigurationElement[] elements = dulicateDetectorsExtension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(ELMNT_DUPLICATE_DETECTOR)) {
- readDuplicateDetector(element);
- }
- }
- }
-
- IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_TASK_CONTRIBUTOR);
- IExtension[] extensions = extensionPoint.getExtensions();
- for (IExtension extension : extensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(DYNAMIC_POPUP_ELEMENT)) {
- readDynamicPopupContributor(element);
- }
- }
- }
- }
-
- private static void readPresentation(IConfigurationElement element) {
- try {
- String name = element.getAttribute(ATTR_NAME);
-
- String iconPath = element.getAttribute(ATTR_ICON);
- ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( //
- element.getContributor().getName(), iconPath);
- AbstractTaskListPresentation presentation = (AbstractTaskListPresentation) element.createExecutableExtension(ATTR_CLASS);
- presentation.setImageDescriptor(imageDescriptor);
- presentation.setName(name);
-
- String primary = element.getAttribute(ATTR_PRIMARY);
- if (primary != null && primary.equals("true")) { //$NON-NLS-1$
- presentation.setPrimary(true);
- }
-
- TaskListView.addPresentation(presentation);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load presentation extension", e)); //$NON-NLS-1$
- }
- }
-
- private static void readDuplicateDetector(IConfigurationElement element) {
- try {
- Object obj = element.createExecutableExtension(ATTR_CLASS);
- if (obj instanceof AbstractDuplicateDetector) {
- AbstractDuplicateDetector duplicateDetector = (AbstractDuplicateDetector) obj;
- duplicateDetector.setName(element.getAttribute(ATTR_NAME));
- duplicateDetector.setConnectorKind(element.getAttribute(ATTR_KIND));
- TasksUiPlugin.getDefault().addDuplicateDetector(duplicateDetector);
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load duplicate detector " + obj.getClass().getCanonicalName())); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load duplicate detector", e)); //$NON-NLS-1$
- }
- }
-
- private static void readLinkProvider(IConfigurationElement element) {
- try {
- Object repositoryLinkProvider = element.createExecutableExtension(ATTR_CLASS);
- if (repositoryLinkProvider instanceof AbstractTaskRepositoryLinkProvider) {
- TasksUiPlugin.getDefault().addRepositoryLinkProvider(
- (AbstractTaskRepositoryLinkProvider) repositoryLinkProvider);
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load repository link provider " //$NON-NLS-1$
- + repositoryLinkProvider.getClass().getCanonicalName()));
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load repository link provider", e)); //$NON-NLS-1$
- }
- }
-
- private static void readTaskEditorPageFactory(IConfigurationElement element) {
- String id = element.getAttribute(ATTR_ID);
- if (id == null) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Editor page factory must specify id")); //$NON-NLS-1$
- return;
- }
-
- try {
- Object item = element.createExecutableExtension(ATTR_CLASS);
- if (item instanceof AbstractTaskEditorPageFactory) {
- AbstractTaskEditorPageFactory editorPageFactory = (AbstractTaskEditorPageFactory) item;
- editorPageFactory.setId(id);
- TasksUiPlugin.getDefault().addTaskEditorPageFactory(editorPageFactory);
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load editor page factory " + item.getClass().getCanonicalName() + " must implement " //$NON-NLS-1$ //$NON-NLS-2$
- + AbstractTaskEditorPageFactory.class.getCanonicalName()));
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load page editor factory", //$NON-NLS-1$
- e));
- }
- }
-
- private static void readRepositoryConnectorCore(IConfigurationElement element) {
- try {
- Object connectorCore = element.createExecutableExtension(ATTR_CLASS);
- if (connectorCore instanceof AbstractRepositoryConnector) {
- AbstractRepositoryConnector repositoryConnector = (AbstractRepositoryConnector) connectorCore;
- TasksUiPlugin.getRepositoryManager().addRepositoryConnector(repositoryConnector);
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load connector core " //$NON-NLS-1$
- + connectorCore.getClass().getCanonicalName()));
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load connector core", e)); //$NON-NLS-1$
- }
- }
-
- private static void readRepositoryConnectorUi(IConfigurationElement element) {
- try {
- Object connectorUiObject = element.createExecutableExtension(ATTR_CLASS);
- if (connectorUiObject instanceof AbstractRepositoryConnectorUi) {
- AbstractRepositoryConnectorUi connectorUi = (AbstractRepositoryConnectorUi) connectorUiObject;
- TasksUiPlugin.getDefault().addRepositoryConnectorUi(connectorUi);
-
- String iconPath = element.getAttribute(ATTR_BRANDING_ICON);
- if (iconPath != null) {
- ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor()
- .getName(), iconPath);
- if (descriptor != null) {
- TasksUiPlugin.getDefault().addBrandingIcon(connectorUi.getConnectorKind(),
- CommonImages.getImage(descriptor));
- }
- }
- String overlayIconPath = element.getAttribute(ATTR_OVERLAY_ICON);
- if (overlayIconPath != null) {
- ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor()
- .getName(), overlayIconPath);
- if (descriptor != null) {
- TasksUiPlugin.getDefault().addOverlayIcon(connectorUi.getConnectorKind(), descriptor);
- }
- }
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load connector ui " //$NON-NLS-1$
- + connectorUiObject.getClass().getCanonicalName()));
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load connector ui", e)); //$NON-NLS-1$
- }
- }
-
- private static void readRepositoryTemplate(IConfigurationElement element) {
- boolean anonymous = false;
- boolean addAuto = false;
-
- String label = element.getAttribute(ELMNT_TMPL_LABEL);
- String serverUrl = element.getAttribute(ELMNT_TMPL_URLREPOSITORY);
- String repKind = element.getAttribute(ELMNT_TMPL_REPOSITORYKIND);
- String version = element.getAttribute(ELMNT_TMPL_VERSION);
- String newTaskUrl = element.getAttribute(ELMNT_TMPL_URLNEWTASK);
- String taskPrefix = element.getAttribute(ELMNT_TMPL_URLTASK);
- String taskQueryUrl = element.getAttribute(ELMNT_TMPL_URLTASKQUERY);
- String newAccountUrl = element.getAttribute(ELMNT_TMPL_NEWACCOUNTURL);
- String encoding = element.getAttribute(ELMNT_TMPL_CHARACTERENCODING);
- addAuto = Boolean.parseBoolean(element.getAttribute(ELMNT_TMPL_ADDAUTO));
- anonymous = Boolean.parseBoolean(element.getAttribute(ELMNT_TMPL_ANONYMOUS));
-
- if (serverUrl != null && label != null && repKind != null
- && TasksUi.getRepositoryManager().getRepositoryConnector(repKind) != null) {
- RepositoryTemplate template = new RepositoryTemplate(label, serverUrl, encoding, version, newTaskUrl,
- taskPrefix, taskQueryUrl, newAccountUrl, anonymous, addAuto);
- TasksUiPlugin.getRepositoryTemplateManager().addTemplate(repKind, template);
-
- for (IConfigurationElement configElement : element.getChildren()) {
- String name = configElement.getAttribute("name"); //$NON-NLS-1$
- String value = configElement.getAttribute("value"); //$NON-NLS-1$
- if (name != null && !name.equals("") && value != null) { //$NON-NLS-1$
- template.addAttribute(name, value);
- }
- }
- } else {
- // TODO change error message to include hints about the cause of the error
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load repository template extension " + element.getName())); //$NON-NLS-1$
- }
- }
-
- private static void readDynamicPopupContributor(IConfigurationElement element) {
- try {
- Object dynamicPopupContributor = element.createExecutableExtension(ATTR_CLASS);
- String menuPath = element.getAttribute(ATTR_MENU_PATH);
- if (dynamicPopupContributor instanceof IDynamicSubMenuContributor) {
- TasksUiPlugin.getDefault().addDynamicPopupContributor(menuPath,
- (IDynamicSubMenuContributor) dynamicPopupContributor);
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load dynamic popup menu: " + dynamicPopupContributor.getClass().getCanonicalName() //$NON-NLS-1$
- + " must implement " + IDynamicSubMenuContributor.class.getCanonicalName())); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load dynamic popup menu extension", e)); //$NON-NLS-1$
- }
- }
-
- private static void readMigrator(IConfigurationElement element, List<AbstractTaskListMigrator> migrators) {
- try {
- Object migratorObject = element.createExecutableExtension(ATTR_CLASS);
- if (migratorObject instanceof AbstractTaskListMigrator) {
- AbstractTaskListMigrator migrator = (AbstractTaskListMigrator) migratorObject;
- migrators.add(migrator);
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load task list migrator migrator: " + migratorObject.getClass().getCanonicalName() //$NON-NLS-1$
- + " must implement " + AbstractTaskListMigrator.class.getCanonicalName())); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not load task list migrator extension", e)); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
deleted file mode 100644
index 153a87777..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
+++ /dev/null
@@ -1,943 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ProgressMonitorWrapper;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.commons.core.CoreUtil;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITaskJobFactory;
-import org.eclipse.mylyn.internal.tasks.core.ITaskList;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.OpenRepositoryTaskJob;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.editors.CategoryEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.CategoryEditorInput;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.MultiRepositoryAwareWizard;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizardDialog;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewTaskWizard;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
-import org.eclipse.mylyn.tasks.core.sync.TaskJob;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Steffen Pingel
- */
-public class TasksUiInternal {
-
- // TODO e3.4 replace with SWT.NO_SCROLL constant
- public static final int SWT_NO_SCROLL = 1 << 4;
-
- public static MultiRepositoryAwareWizard createNewTaskWizard(ITaskMapping taskSelection) {
- return new NewTaskWizard(taskSelection);
- }
-
- public static ImageDescriptor getPriorityImage(ITask task) {
- if (task.isCompleted()) {
- return CommonImages.COMPLETE;
- } else {
- return TasksUiImages.getImageDescriptorForPriority(PriorityLevel.fromString(task.getPriority()));
- }
- }
-
- public static List<TaskEditor> getActiveRepositoryTaskEditors() {
- List<TaskEditor> repositoryTaskEditors = new ArrayList<TaskEditor>();
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (IWorkbenchWindow window : windows) {
- IEditorReference[] editorReferences = window.getActivePage().getEditorReferences();
- for (IEditorReference editorReference : editorReferences) {
- try {
- if (editorReference.getEditorInput() instanceof TaskEditorInput) {
- TaskEditorInput input = (TaskEditorInput) editorReference.getEditorInput();
- if (input.getTask() != null) {
- IEditorPart editorPart = editorReference.getEditor(false);
- if (editorPart instanceof TaskEditor) {
- repositoryTaskEditors.add((TaskEditor) editorPart);
- }
- }
- }
- } catch (PartInitException e) {
- // ignore
- }
- }
- }
- return repositoryTaskEditors;
- }
-
- public static IProgressMonitor getUiMonitor(IProgressMonitor monitor) {
- return new ProgressMonitorWrapper(monitor) {
- @Override
- public void beginTask(final String name, final int totalWork) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getWrappedProgressMonitor().beginTask(name, totalWork);
- }
- });
- }
-
- @Override
- public void done() {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getWrappedProgressMonitor().done();
- }
- });
- }
-
- @Override
- public void subTask(final String name) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getWrappedProgressMonitor().subTask(name);
- }
- });
- }
-
- @Override
- public void worked(final int work) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getWrappedProgressMonitor().worked(work);
- }
- });
- }
- };
- }
-
- public static void openEditor(TaskCategory category) {
- final IEditorInput input = new CategoryEditorInput(category);
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- TasksUiUtil.openEditor(input, CategoryEditor.ID_EDITOR, page);
- }
- }
- });
- }
-
- public static void refreshAndOpenTaskListElement(IRepositoryElement element) {
- if (element instanceof ITask) {
- final AbstractTask task = (AbstractTask) element;
-
- if (task instanceof LocalTask) {
- TasksUiUtil.openTask(task);
- } else {
- String repositoryKind = task.getConnectorKind();
- final AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repositoryKind);
-
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(repositoryKind,
- task.getRepositoryUrl());
- if (repository == null) {
- displayStatus(Messages.TasksUiInternal_Failed_to_open_task, new Status(IStatus.ERROR,
- TasksUiPlugin.ID_PLUGIN, Messages.TasksUiInternal_No_repository_found));
- return;
- }
-
- if (connector != null) {
- boolean opened = false;
- if (TasksUiPlugin.getTaskDataManager().hasTaskData(task)) {
- opened = TasksUiUtil.openTask(task);
- }
-
- if (!opened) {
- if (connector.canSynchronizeTask(repository, task)) {
- // TODO consider moving this into the editor, i.e. have the editor refresh the task if task data is missing
- TasksUiInternal.synchronizeTask(connector, task, true, new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiUtil.openTask(task);
- }
- });
- }
- });
- } else {
- TasksUiUtil.openTask(task);
- }
- }
- }
- }
- } else if (element instanceof TaskCategory) {
- TasksUiInternal.openEditor((TaskCategory) element);
- } else if (element instanceof IRepositoryQuery) {
- RepositoryQuery query = (RepositoryQuery) element;
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(query.getConnectorKind());
- TasksUiInternal.openEditQueryDialog(connectorUi, query);
- }
- }
-
- public static TaskJob updateRepositoryConfiguration(final TaskRepository taskRepository) {
- synchronized (taskRepository) {
- taskRepository.setUpdating(true);
- }
-
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskRepository.getConnectorKind());
- final TaskJob job = TasksUiInternal.getJobFactory().createUpdateRepositoryConfigurationJob(connector,
- taskRepository);
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- synchronized (taskRepository) {
- taskRepository.setUpdating(false);
- }
- if (job.getStatus() != null) {
- Display display = PlatformUI.getWorkbench().getDisplay();
- if (!display.isDisposed()) {
- TasksUiInternal.displayStatus(Messages.TasksUiInternal_Configuration_Refresh_Failed,
- job.getStatus());
- }
- }
- }
- });
- job.schedule();
- return job;
- }
-
- private static void joinIfInTestMode(SynchronizationJob job) {
- // FIXME the client code should join the job
- if (CoreUtil.TEST_MODE) {
- try {
- job.join();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- public static final Job synchronizeQueries(AbstractRepositoryConnector connector, TaskRepository repository,
- Set<RepositoryQuery> queries, IJobChangeListener listener, boolean force) {
- Assert.isTrue(queries.size() > 0);
-
- TaskList taskList = TasksUiPlugin.getTaskList();
- for (RepositoryQuery query : queries) {
- query.setSynchronizing(true);
- }
- taskList.notifySynchronizationStateChanged(queries);
-
- SynchronizationJob job = TasksUiPlugin.getTaskJobFactory().createSynchronizeQueriesJob(connector, repository,
- queries);
- job.setUser(force);
- if (listener != null) {
- job.addJobChangeListener(listener);
- }
- if (force) {
- final RepositoryQuery query = queries.iterator().next();
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- if (query.getStatus() != null) {
- TasksUiInternal.asyncDisplayStatus(Messages.TasksUiInternal_Query_Synchronization_Failed,
- query.getStatus());
- }
- }
- });
- }
- job.schedule();
- joinIfInTestMode(job);
- return job;
- }
-
- /**
- * For synchronizing a single query. Use synchronize(Set, IJobChangeListener) if synchronizing multiple queries at a
- * time.
- */
- public static final Job synchronizeQuery(AbstractRepositoryConnector connector, RepositoryQuery repositoryQuery,
- IJobChangeListener listener, boolean force) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(repositoryQuery.getConnectorKind(),
- repositoryQuery.getRepositoryUrl());
- return synchronizeQueries(connector, repository, Collections.singleton(repositoryQuery), listener, force);
- }
-
- public static SynchronizationJob synchronizeAllRepositories(boolean force) {
- SynchronizationJob job = TasksUiPlugin.getTaskJobFactory().createSynchronizeRepositoriesJob(null);
- job.setUser(force);
- job.schedule();
- joinIfInTestMode(job);
- return job;
- }
-
- public static SynchronizationJob synchronizeRepository(TaskRepository repository, boolean force) {
- return TasksUiPlugin.getSynchronizationScheduler().synchronize(repository);
- }
-
- /**
- * Synchronize a single task. Note that if you have a collection of tasks to synchronize with this connector then
- * you should call synchronize(Set<Set<AbstractTask> repositoryTasks, ...)
- *
- * @param listener
- * can be null
- */
- public static Job synchronizeTask(AbstractRepositoryConnector connector, ITask task, boolean force,
- IJobChangeListener listener) {
- return synchronizeTasks(connector, Collections.singleton(task), force, listener);
- }
-
- /**
- * @param listener
- * can be null
- */
- public static Job synchronizeTasks(AbstractRepositoryConnector connector, Set<ITask> tasks, boolean force,
- IJobChangeListener listener) {
- ITaskList taskList = TasksUiInternal.getTaskList();
- for (ITask task : tasks) {
- ((AbstractTask) task).setSynchronizing(true);
- }
- ((TaskList) taskList).notifySynchronizationStateChanged(tasks);
- // TODO notify task list?
-
- SynchronizationJob job = TasksUiPlugin.getTaskJobFactory().createSynchronizeTasksJob(connector, tasks);
- job.setUser(force);
- job.setPriority(Job.DECORATE);
- if (listener != null) {
- job.addJobChangeListener(listener);
- }
- if (force && tasks.size() == 1) {
- final ITask task = tasks.iterator().next();
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- if (task instanceof AbstractTask && ((AbstractTask) task).getStatus() != null) {
- TasksUiInternal.asyncDisplayStatus(Messages.TasksUiInternal_Task_Synchronization_Failed,
- ((AbstractTask) task).getStatus());
- }
- }
- });
- }
- job.schedule();
- joinIfInTestMode(job);
- return job;
- }
-
- public static ITaskJobFactory getJobFactory() {
- return TasksUiPlugin.getTaskJobFactory();
- }
-
- public static NewAttachmentWizardDialog openNewAttachmentWizard(Shell shell, TaskRepository taskRepository,
- ITask task, TaskAttribute taskAttribute, TaskAttachmentWizard.Mode mode, AbstractTaskAttachmentSource source) {
- TaskAttachmentWizard attachmentWizard = new TaskAttachmentWizard(taskRepository, task, taskAttribute);
- attachmentWizard.setSource(source);
- attachmentWizard.setMode(mode);
- NewAttachmentWizardDialog dialog = new NewAttachmentWizardDialog(shell, attachmentWizard, false);
- dialog.setBlockOnOpen(false);
- dialog.create();
- dialog.open();
- return dialog;
- }
-
- private static MessageDialog createDialog(Shell shell, String title, String message, int type) {
- return new MessageDialog(shell, title, null, message, type, new String[] { IDialogConstants.OK_LABEL }, 0);
- }
-
- private static void displayStatus(Shell shell, final String title, final IStatus status, boolean showLinkToErrorLog) {
- // avoid blocking ui when in test mode
- if (CoreUtil.TEST_MODE) {
- StatusHandler.log(status);
- return;
- }
-
- if (status.getCode() == RepositoryStatus.ERROR_INTERNAL) {
- StatusHandler.fail(status);
- } else {
- if (status instanceof RepositoryStatus && ((RepositoryStatus) status).isHtmlMessage()) {
- WebBrowserDialog.openAcceptAgreement(shell, title, status.getMessage(),
- ((RepositoryStatus) status).getHtmlMessage());
- } else {
- String message = status.getMessage();
- if (showLinkToErrorLog) {
- message += "\n\n" + Messages.TasksUiInternal_See_error_log_for_details; //$NON-NLS-1$
- }
- switch (status.getSeverity()) {
- case IStatus.CANCEL:
- case IStatus.INFO:
- createDialog(shell, title, message, MessageDialog.INFORMATION).open();
- break;
- case IStatus.WARNING:
- createDialog(shell, title, message, MessageDialog.WARNING).open();
- break;
- case IStatus.ERROR:
- default:
- createDialog(shell, title, message, MessageDialog.ERROR).open();
- break;
- }
- }
- }
- }
-
- public static void asyncDisplayStatus(final String title, final IStatus status) {
- Display display = PlatformUI.getWorkbench().getDisplay();
- if (!display.isDisposed()) {
- display.asyncExec(new Runnable() {
- public void run() {
- displayStatus(title, status);
- }
- });
- } else {
- StatusHandler.log(status);
- }
- }
-
- public static void logAndDisplayStatus(final String title, final IStatus status) {
- StatusHandler.log(status);
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null && !workbench.getDisplay().isDisposed()) {
- displayStatus(getShell(), title, status, true);
- }
- }
-
- public static void displayStatus(final String title, final IStatus status) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null && !workbench.getDisplay().isDisposed()) {
- displayStatus(getShell(), title, status, false);
- } else {
- StatusHandler.log(status);
- }
- }
-
- /**
- * Creates a new local task and schedules for today
- *
- * @param summary
- * if null DEFAULT_SUMMARY (New Task) used.
- */
- public static LocalTask createNewLocalTask(String summary) {
- if (summary == null) {
- summary = LocalRepositoryConnector.DEFAULT_SUMMARY;
- }
- TaskList taskList = TasksUiPlugin.getTaskList();
- LocalTask newTask = new LocalTask("" + taskList.getNextLocalTaskId(), summary); //$NON-NLS-1$
- newTask.setPriority(PriorityLevel.P3.toString());
- TasksUiInternal.getTaskList().addTask(newTask);
- TasksUiPlugin.getTaskActivityManager().scheduleNewTask(newTask);
-
- TaskListView view = TaskListView.getFromActivePerspective();
- AbstractTaskCategory category = getSelectedCategory(view);
- if (view != null && view.getDrilledIntoCategory() != null && view.getDrilledIntoCategory() != category) {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.TasksUiInternal_Create_Task,
- MessageFormat.format(Messages.TasksUiInternal_The_new_task_will_be_added_to_the_X_container,
- UncategorizedTaskContainer.LABEL));
- }
- taskList.addTask(newTask, category);
- return newTask;
- }
-
- public static AbstractTaskCategory getSelectedCategory(TaskListView view) {
- Object selectedObject = null;
- if (view != null) {
- selectedObject = ((IStructuredSelection) view.getViewer().getSelection()).getFirstElement();
- }
- if (selectedObject instanceof TaskCategory) {
- return (TaskCategory) selectedObject;
- } else if (selectedObject instanceof ITask) {
- ITask task = (ITask) selectedObject;
- AbstractTaskContainer container = TaskCategory.getParentTaskCategory(task);
- if (container instanceof TaskCategory) {
- return (TaskCategory) container;
- } else if (view != null && view.getDrilledIntoCategory() instanceof TaskCategory) {
- return (TaskCategory) view.getDrilledIntoCategory();
- }
- } else if (view != null && view.getDrilledIntoCategory() instanceof TaskCategory) {
- return (TaskCategory) view.getDrilledIntoCategory();
- }
- return TasksUiPlugin.getTaskList().getDefaultCategory();
- }
-
- public static Set<AbstractTaskContainer> getContainersFromWorkingSet(Set<IWorkingSet> containers) {
-
- Set<AbstractTaskContainer> allTaskContainersInWorkingSets = new HashSet<AbstractTaskContainer>();
- for (IWorkingSet workingSet : containers) {
- IAdaptable[] elements = workingSet.getElements();
- for (IAdaptable adaptable : elements) {
- if (adaptable instanceof AbstractTaskContainer) {
- allTaskContainersInWorkingSets.add(((AbstractTaskContainer) adaptable));
- }
- }
- }
- return allTaskContainersInWorkingSets;
- }
-
- /**
- * @since 3.0
- */
- public static void openEditQueryDialog(AbstractRepositoryConnectorUi connectorUi, IRepositoryQuery query) {
- try {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(),
- query.getRepositoryUrl());
- if (repository == null) {
- return;
- }
-
- IWizard wizard = connectorUi.getQueryWizard(repository, query);
-
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (wizard != null && shell != null && !shell.isDisposed()) {
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.CANCEL) {
- dialog.close();
- return;
- }
- }
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to open query dialog", e)); //$NON-NLS-1$
- }
- }
-
- public static ITaskList getTaskList() {
- return TasksUiPlugin.getTaskList();
- }
-
- public static boolean isAnimationsEnabled() {
- IPreferenceStore store = PlatformUI.getPreferenceStore();
- return store.getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
- }
-
- public static boolean hasValidUrl(ITask task) {
- return isValidUrl(task.getUrl());
- }
-
- public static boolean isValidUrl(String url) {
- if (url != null && !url.equals("") && !url.equals("http://") && !url.equals("https://")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- try {
- new URL(url);
- return true;
- } catch (MalformedURLException e) {
- return false;
- }
- }
- return false;
- }
-
- /**
- * @deprecated use {@link #closeTaskEditorInAllPages(ITask, boolean)}
- */
- @Deprecated
- public static void closeEditorInActivePage(ITask task, boolean save) {
- Assert.isNotNull(task);
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return;
- }
- IWorkbenchPage page = window.getActivePage();
- if (page == null) {
- return;
- }
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- IEditorInput input = new TaskEditorInput(taskRepository, task);
- IEditorPart editor = page.findEditor(input);
- if (editor != null) {
- page.closeEditor(editor, save);
- }
- }
-
- public static void closeTaskEditorInAllPages(ITask task, boolean save) {
- Assert.isNotNull(task);
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- IEditorInput input = new TaskEditorInput(taskRepository, task);
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (IWorkbenchWindow window : windows) {
- IWorkbenchPage[] pages = window.getPages();
- for (IWorkbenchPage page : pages) {
- IEditorPart editor = page.findEditor(input);
- if (editor != null) {
- page.closeEditor(editor, save);
- }
- }
- }
- }
-
- public static boolean hasLocalCompletionState(ITask task) {
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- task.getConnectorKind());
- return connector.hasLocalCompletionState(taskRepository, task);
- }
-
- /**
- * Return the modal shell that is currently open. If there isn't one then return null.
- * <p>
- * <b>Note: Applied from patch on bug 99472.</b>
- *
- * @param shell
- * A shell to exclude from the search. May be <code>null</code>.
- *
- * @return Shell or <code>null</code>.
- */
- private static Shell getModalShellExcluding(Shell shell) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- Shell[] shells = workbench.getDisplay().getShells();
- int modal = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL | SWT.PRIMARY_MODAL;
- for (Shell shell2 : shells) {
- if (shell2.equals(shell)) {
- break;
- }
- // Do not worry about shells that will not block the user.
- if (shell2.isVisible()) {
- int style = shell2.getStyle();
- if ((style & modal) != 0) {
- return shell2;
- }
- }
- }
- return null;
- }
-
- /**
- * Utility method to get the best parenting possible for a dialog. If there is a modal shell create it so as to
- * avoid two modal dialogs. If not then return the shell of the active workbench window. If neither can be found
- * return null.
- * <p>
- * <b>Note: Applied from patch on bug 99472.</b>
- *
- * @return Shell or <code>null</code>
- */
- public static Shell getShell() {
- if (!PlatformUI.isWorkbenchRunning() || PlatformUI.getWorkbench().isClosing()) {
- return null;
- }
- Shell modal = getModalShellExcluding(null);
- if (modal != null) {
- return modal;
- }
- return getNonModalShell();
- }
-
- /**
- * Get the active non modal shell. If there isn't one return null.
- * <p>
- * <b>Note: Applied from patch on bug 99472.</b>
- *
- * @return Shell
- */
- private static Shell getNonModalShell() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- if (windows.length > 0) {
- return windows[0].getShell();
- }
- } else {
- return window.getShell();
- }
-
- return null;
- }
-
- public static TaskData createTaskData(TaskRepository taskRepository, ITaskMapping initializationData,
- ITaskMapping selectionData, IProgressMonitor monitor) throws CoreException {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskRepository.getConnectorKind());
- AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- TaskAttributeMapper mapper = taskDataHandler.getAttributeMapper(taskRepository);
- TaskData taskData = new TaskData(mapper, taskRepository.getConnectorKind(), taskRepository.getRepositoryUrl(),
- ""); //$NON-NLS-1$
- taskDataHandler.initializeTaskData(taskRepository, taskData, initializationData, monitor);
- if (selectionData != null) {
- connector.getTaskMapping(taskData).merge(selectionData);
- }
- return taskData;
- }
-
- public static void createAndOpenNewTask(TaskData taskData) throws CoreException {
- ITask task = TasksUiUtil.createOutgoingNewTask(taskData.getConnectorKind(), taskData.getRepositoryUrl());
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskData.getConnectorKind());
- ITaskMapping mapping = connector.getTaskMapping(taskData);
- String summary = mapping.getSummary();
- if (summary != null && summary.length() > 0) {
- task.setSummary(summary);
- }
- UnsubmittedTaskContainer unsubmitted = TasksUiPlugin.getTaskList().getUnsubmittedContainer(
- taskData.getRepositoryUrl());
- if (unsubmitted != null) {
- TasksUiPlugin.getTaskList().addTask(task, unsubmitted);
- }
- ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(task, taskData);
- workingCopy.save(null, null);
- TaskRepository localTaskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- TaskEditorInput editorInput = new TaskEditorInput(localTaskRepository, task);
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
- }
-
- /**
- * Only override if task should be opened by a custom editor, default behavior is to open with a rich editor,
- * falling back to the web browser if not available.
- *
- * @return true if the task was successfully opened
- */
- public static boolean openRepositoryTask(String connectorKind, String repositoryUrl, String id) {
- IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
- AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(connectorKind);
- String taskUrl = connector.getTaskUrl(repositoryUrl, id);
- if (taskUrl == null) {
- return false;
- }
-
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- if (windows != null && windows.length > 0) {
- window = windows[0];
- }
- }
- if (window == null) {
- return false;
- }
- IWorkbenchPage page = window.getActivePage();
-
- OpenRepositoryTaskJob job = new OpenRepositoryTaskJob(connectorKind, repositoryUrl, id, taskUrl, page);
- job.schedule();
-
- return true;
- }
-
- /**
- * @since 3.0
- */
- public static boolean openTaskInBackground(ITask task, boolean bringToTop) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IEditorPart activeEditor = null;
- IWorkbenchPart activePart = null;
- IWorkbenchPage activePage = window.getActivePage();
- if (activePage != null) {
- activeEditor = activePage.getActiveEditor();
- activePart = activePage.getActivePart();
- }
- boolean opened = TasksUiUtil.openTask(task);
- if (opened && activePage != null) {
- if (!bringToTop && activeEditor != null) {
- activePage.bringToTop(activeEditor);
- }
- if (activePart != null) {
- activePage.activate(activePart);
- }
- }
- return opened;
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unable to open editor for \"" //$NON-NLS-1$
- + task.getSummary() + "\": no active workbench window")); //$NON-NLS-1$
- }
- return false;
- }
-
- /**
- * Returns text masking the &amp;-character from decoration as an accelerator in SWT labels.
- */
- public static String escapeLabelText(String text) {
- return (text != null) ? text.replace("&", "&&") : null; // mask & from SWT //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public static void preservingSelection(final TreeViewer viewer, Runnable runnable) {
- final ISelection selection = viewer.getSelection();
-
- runnable.run();
-
- if (selection != null) {
- ISelection newSelection = viewer.getSelection();
- if ((newSelection == null || newSelection.isEmpty()) && !(selection == null || selection.isEmpty())) {
- // delay execution to ensure that any delayed tree updates such as expand all have been processed and the selection is revealed properly
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- viewer.setSelection(selection, true);
- }
- });
- } else if (newSelection instanceof ITreeSelection && !newSelection.isEmpty()) {
- viewer.reveal(((ITreeSelection) newSelection).getFirstElement());
- }
- }
- }
-
- public static String getFormattedDuration(long duration, boolean includeSeconds) {
- long seconds = duration / 1000;
- long minutes = 0;
- long hours = 0;
- // final long SECOND = 1000;
- final long MIN = 60;
- final long HOUR = MIN * 60;
- String formatted = ""; //$NON-NLS-1$
-
- String hour = ""; //$NON-NLS-1$
- String min = ""; //$NON-NLS-1$
- String sec = ""; //$NON-NLS-1$
- if (seconds >= HOUR) {
- hours = seconds / HOUR;
- if (hours == 1) {
- hour = hours + Messages.TasksUiInternal__hour_;
- } else if (hours > 1) {
- hour = hours + Messages.TasksUiInternal__hours_;
- }
- seconds -= hours * HOUR;
-
- minutes = seconds / MIN;
- if (minutes == 1) {
- min = minutes + Messages.TasksUiInternal__minute_;
- } else if (minutes != 1) {
- min = minutes + Messages.TasksUiInternal__minutes_;
- }
- seconds -= minutes * MIN;
- if (seconds == 1) {
- sec = seconds + Messages.TasksUiInternal__second;
- } else if (seconds > 1) {
- sec = seconds + Messages.TasksUiInternal__seconds;
- }
- formatted += hour + min;
- if (includeSeconds) {
- formatted += sec;
- }
- } else if (seconds >= MIN) {
- minutes = seconds / MIN;
- if (minutes == 1) {
- min = minutes + Messages.TasksUiInternal__minute_;
- } else if (minutes != 1) {
- min = minutes + Messages.TasksUiInternal__minutes_;
- }
- seconds -= minutes * MIN;
- if (seconds == 1) {
- sec = seconds + Messages.TasksUiInternal__second;
- } else if (seconds > 1) {
- sec = seconds + Messages.TasksUiInternal__seconds;
- }
- formatted += min;
- if (includeSeconds) {
- formatted += sec;
- }
- } else {
- if (seconds == 1) {
- sec = seconds + Messages.TasksUiInternal__second;
- } else if (seconds > 1) {
- sec = seconds + Messages.TasksUiInternal__seconds;
- }
- if (includeSeconds) {
- formatted += sec;
- }
- }
- return formatted;
- }
-
- public static AbstractTask getTask(String repositoryUrl, String taskId, String fullUrl) {
- AbstractTask task = null;
- if (repositoryUrl != null && taskId != null) {
- task = (AbstractTask) TasksUiInternal.getTaskList().getTask(repositoryUrl, taskId);
- }
- if (task == null && fullUrl != null) {
- task = TasksUiInternal.getTaskByUrl(fullUrl);
- }
- if (task == null && repositoryUrl != null && taskId != null) {
- task = TasksUiPlugin.getTaskList().getTaskByKey(repositoryUrl, taskId);
- }
- return task;
- }
-
- /**
- * Searches for a task whose URL matches
- *
- * @return first task with a matching URL.
- */
- public static AbstractTask getTaskByUrl(String taskUrl) {
- Collection<AbstractTask> tasks = TasksUiPlugin.getTaskList().getAllTasks();
- for (AbstractTask task : tasks) {
- String currUrl = task.getUrl();
- if (currUrl != null && !currUrl.equals("") && currUrl.equals(taskUrl)) { //$NON-NLS-1$
- return task;
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiMenus.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiMenus.java
deleted file mode 100644
index d16de4315..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiMenus.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.io.File;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Steffen Pingel
- */
-public class TasksUiMenus {
-
- private static final String ATTACHMENT_DEFAULT_NAME = "attachment"; //$NON-NLS-1$
-
- private static final String CTYPE_ZIP = "zip"; //$NON-NLS-1$
-
- private static final String CTYPE_OCTET_STREAM = "octet-stream"; //$NON-NLS-1$
-
- private static final String CTYPE_TEXT = "text"; //$NON-NLS-1$
-
- private static final String CTYPE_HTML = "html"; //$NON-NLS-1$
-
- public static void fillTaskAttachmentMenu(IMenuManager manager) {
- final Action saveAction = new Action(Messages.TasksUiMenus_Save_) {
- @Override
- public void run() {
- ITaskAttachment attachment = getSelectedAttachment();
- if (attachment == null) {
- return;
- }
-
- /* Launch Browser */
- FileDialog fileChooser = new FileDialog(TasksUiInternal.getShell(), SWT.SAVE);
- String fname = attachment.getFileName();
- // default name if none is found
- if (fname.equals("")) { //$NON-NLS-1$
- String ctype = attachment.getContentType();
- if (ctype.endsWith(CTYPE_HTML)) {
- fname = ATTACHMENT_DEFAULT_NAME + ".html"; //$NON-NLS-1$
- } else if (ctype.startsWith(CTYPE_TEXT)) {
- fname = ATTACHMENT_DEFAULT_NAME + ".txt"; //$NON-NLS-1$
- } else if (ctype.endsWith(CTYPE_OCTET_STREAM)) {
- fname = ATTACHMENT_DEFAULT_NAME;
- } else if (ctype.endsWith(CTYPE_ZIP)) {
- fname = ATTACHMENT_DEFAULT_NAME + "." + CTYPE_ZIP; //$NON-NLS-1$
- } else {
- fname = ATTACHMENT_DEFAULT_NAME + "." + ctype.substring(ctype.indexOf("/") + 1); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- fileChooser.setFileName(fname);
- String filePath = fileChooser.open();
- // check if the dialog was canceled or an error occurred
- if (filePath == null) {
- return;
- }
-
- File file = new File(filePath);
- if (file.exists()) {
- if (!MessageDialog.openConfirm(TasksUiInternal.getShell(), Messages.TasksUiMenus_File_exists_,
- Messages.TasksUiMenus_Overwrite_existing_file_ + file.getName())) {
- return;
- }
- }
-
- DownloadAttachmentJob job = new DownloadAttachmentJob(attachment, file);
- job.setUser(true);
- job.schedule();
- }
- };
-
- final Action copyURLToClipAction = new Action(Messages.TasksUiMenus_Copy_URL) {
- @Override
- public void run() {
- ITaskAttachment attachment = getSelectedAttachment();
- if (attachment != null) {
- Clipboard clip = new Clipboard(PlatformUI.getWorkbench().getDisplay());
- clip.setContents(new Object[] { attachment.getUrl() },
- new Transfer[] { TextTransfer.getInstance() });
- clip.dispose();
- }
- }
- };
-
- final Action copyToClipAction = new Action(Messages.TasksUiMenus_Copy_Contents) {
- @Override
- public void run() {
- ITaskAttachment attachment = getSelectedAttachment();
- if (attachment != null) {
- CopyAttachmentToClipboardJob job = new CopyAttachmentToClipboardJob(attachment);
- job.setUser(true);
- job.schedule();
- }
- }
- };
-
- manager.add(new Separator("group.open")); //$NON-NLS-1$
- manager.add(new Separator("group.save")); //$NON-NLS-1$
- manager.add(saveAction);
- manager.add(copyURLToClipAction);
- manager.add(copyToClipAction);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- private static ITaskAttachment getSelectedAttachment() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- ISelection windowSelection = window.getSelectionService().getSelection();
- IStructuredSelection selection = null;
- if (windowSelection instanceof IStructuredSelection) {
- selection = (IStructuredSelection) windowSelection;
- }
- if (selection == null || selection.isEmpty()) {
- return null;
- }
- if (selection.getFirstElement() instanceof ITaskAttachment) {
- return (ITaskAttachment) selection.getFirstElement();
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TreeWalker.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TreeWalker.java
deleted file mode 100644
index cb2739144..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TreeWalker.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Steffen Pingel
- */
-public class TreeWalker {
-
- public enum Direction {
- UP, DOWN
- };
-
- public static abstract class TreeVisitor {
-
- public abstract boolean visit(Object object);
-
- }
-
- private Direction direction = Direction.DOWN;
-
- private final TreeViewer treeViewer;
-
- private final Tree tree;
-
- private boolean expandNodes;
-
- public TreeWalker(TreeViewer treeViewer) {
- this.treeViewer = treeViewer;
- this.tree = treeViewer.getTree();
- }
-
- public Direction getDirection() {
- return direction;
- }
-
- public boolean getExpandNodes() {
- return expandNodes;
- }
-
- private TreePath getTreePath(TreeItem item) {
- List<Object> path = new ArrayList<Object>();
- do {
- // the tree is probably not fully refreshed at this point
- if (item.getData() == null) {
- return null;
- }
- path.add(0, item.getData());
- item = item.getParentItem();
- } while (item != null);
- return new TreePath(path.toArray());
- }
-
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
- public void setExpandNodes(boolean expandNodes) {
- this.expandNodes = expandNodes;
- }
-
- private TreePath visitChildren(TreeViewer viewer, TreePath itemPath, TreeItem item, TreeVisitor visitor) {
- boolean restoreCollapsedState = false;
- // expand item
- try {
- if (getExpandNodes()) {
- boolean expandedState = item.getExpanded();
- if (!expandedState) {
- restoreCollapsedState = true;
- viewer.setExpandedState(itemPath, true);
- }
- }
-
- TreeItem[] children = item.getItems();
- if (children.length > 0 && children[0].getData() != null) {
- TreePath childPath = visitItems(viewer, itemPath, children, null, visitor);
- if (childPath != null) {
- return childPath;
- }
- }
-
- } finally {
- if (restoreCollapsedState) {
- // restore item state
- viewer.setExpandedState(itemPath, false);
- }
- }
-
- return null;
- }
-
- private TreePath visitItems(TreeViewer viewer, TreePath parentPath, TreeItem[] items, TreeItem visitedItem,
- TreeVisitor visitor) {
- if (direction == Direction.UP) {
- Collections.reverse(Arrays.asList(items));
- }
-
- boolean found = (visitedItem == null);
- for (TreeItem item : items) {
- if (!found) {
- if (item == visitedItem) {
- found = true;
- }
- } else {
- TreePath itemPath = parentPath.createChildPath(item.getData());
-
- if (direction == Direction.DOWN) {
- if (visitor.visit(item.getData())) {
- return itemPath;
- }
- }
-
- TreePath childPath = visitChildren(viewer, itemPath, item, visitor);
- if (childPath != null) {
- return childPath;
- }
-
- if (direction == Direction.UP) {
- if (visitor.visit(item.getData())) {
- return itemPath;
- }
- }
- }
- }
-
- // visit parent siblings
- if (visitedItem != null) {
- TreeItem parent = visitedItem.getParentItem();
- if (parent != null) {
- if (direction == Direction.UP) {
- if (visitor.visit(parent.getData())) {
- return parentPath;
- }
- }
-
- return visitSiblings(viewer, parent, visitor);
- }
- }
-
- return null;
- }
-
- private TreePath visitSiblings(TreeViewer viewer, TreeItem item, TreeVisitor visitor) {
- TreeItem[] siblings;
- TreePath path;
- TreeItem parent = item.getParentItem();
- if (parent != null) {
- path = getTreePath(parent);
- if (path == null) {
- return null;
- }
- siblings = parent.getItems();
- } else {
- path = TreePath.EMPTY;
- siblings = viewer.getTree().getItems();
- }
- return visitItems(viewer, path, siblings, item, visitor);
- }
-
- public TreePath walk(TreeVisitor visitor, TreeItem startItem) {
- TreePath path = null;
- if (startItem != null) {
- if (direction == Direction.DOWN) {
- path = getTreePath(startItem);
- if (path != null) {
- path = visitChildren(treeViewer, path, startItem, visitor);
- }
- }
- if (path == null) {
- path = visitSiblings(treeViewer, startItem, visitor);
- }
- } else {
- path = visitItems(treeViewer, TreePath.EMPTY, tree.getItems(), null, visitor);
- }
-
- return path;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/WebBrowserDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/WebBrowserDialog.java
deleted file mode 100644
index 5e4c53d0c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/WebBrowserDialog.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.util;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Dialog to show the contents of an html page to the user
- *
- * @author Shawn Minto
- */
-public class WebBrowserDialog extends MessageDialog {
-
- private String data = null;
-
- public WebBrowserDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
- int dialogImageType, String[] dialogButtonLabels, int defaultIndex, String data) {
- super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
- defaultIndex);
- this.data = data;
- this.setShellStyle(SWT.SHELL_TRIM | SWT.RESIZE);
- }
-
- public static int openAcceptAgreement(Shell parent, String title, String message, String data) {
- WebBrowserDialog dialog = new WebBrowserDialog(parent, title, null, // accept
- message, NONE, new String[] { IDialogConstants.OK_LABEL }, 0, data);
- // ok is the default
- return dialog.open();
- }
-
- @Override
- public Control createCustomArea(Composite parent) {
- GridLayout layout = new GridLayout();
- parent.setLayout(layout);
- layout.numColumns = 1;
-
- Browser b = new Browser(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.horizontalSpan = 1;
- gd.verticalSpan = 50;
- b.setLayoutData(gd);
- b.setText(data);
-
- return parent;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties
deleted file mode 100644
index d25da0968..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties
+++ /dev/null
@@ -1,33 +0,0 @@
-AttachmentUtil_The_context_is_empty=The context is empty.
-AttachmentUtil_Downloading_attachment=Downloading attachment
-AttachmentUtil_Mylyn_Information=Mylyn Information
-
-CopyAttachmentToClipboardJob_Copy_Attachment_to_Clipboard=Copy Attachment to Clipboard
-CopyAttachmentToClipboardJob_Copying_Attachment_to_Clipboard=Copying Attachment to Clipboard
-
-DownloadAttachmentJob_Copy_Attachment_to_Clipboard=Copy Attachment to Clipboard
-DownloadAttachmentJob_Downloading_Attachment=Downloading Attachment
-ImportExportUtil_Tasks_and_queries_Filter0=Mylyn Tasks and Queries (*{0})
-
-TaskDataExportOperation_exporting_task_data=Exporting Task Data
-
-TasksUiInternal_Configuration_Refresh_Failed=Configuration Refresh Failed
-TasksUiInternal_Create_Task=Create Task
-TasksUiInternal_The_new_task_will_be_added_to_the_X_container=The new task will be added to the {0} container, since tasks can not be added to a query.
-TasksUiInternal_Query_Synchronization_Failed=Query Synchronization Failed
-TasksUiInternal_Task_Synchronization_Failed=Task Synchronization Failed
-TasksUiInternal__hour_=\ hour
-TasksUiInternal__hours_=\ hours
-TasksUiInternal__minute_=\ minute
-TasksUiInternal__minutes_=\ minutes
-TasksUiInternal__second=\ second
-TasksUiInternal__seconds=\ seconds
-TasksUiInternal_Failed_to_open_task=Failed to Open Task
-TasksUiInternal_No_repository_found=No repository found for task. Please create repository in Task Repositories view.
-TasksUiInternal_See_error_log_for_details=See error log for details.
-
-TasksUiMenus_Copy_Contents=Copy Contents
-TasksUiMenus_Copy_URL=Copy &URL
-TasksUiMenus_File_exists_=File exists\!
-TasksUiMenus_Overwrite_existing_file_=Overwrite existing file?\n
-TasksUiMenus_Save_=Save...
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListContentProvider.java
deleted file mode 100644
index 39c7bb3f3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListContentProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-
-/**
- * @author Eugene Kuleshov
- * @author Mik Kersten
- */
-public abstract class AbstractTaskListContentProvider implements ITreeContentProvider {
-
- protected TaskListView taskListView;
-
- public AbstractTaskListContentProvider(TaskListView view) {
- this.taskListView = view;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListPresentation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListPresentation.java
deleted file mode 100644
index c06420314..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTaskListPresentation.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- */
-public abstract class AbstractTaskListPresentation {
-
- private final String id;
-
- private String name;
-
- private ImageDescriptor imageDescriptor;
-
- private boolean primary = false;
-
- private final Map<TaskListView, AbstractTaskListContentProvider> contentProviders = new HashMap<TaskListView, AbstractTaskListContentProvider>();
-
- public AbstractTaskListPresentation(String id) {
- this.id = id;
- }
-
- public AbstractTaskListContentProvider getContentProvider(TaskListView taskListView) {
- AbstractTaskListContentProvider contentProvider = contentProviders.get(taskListView);
- if (contentProvider == null) {
- contentProvider = createContentProvider(taskListView);
- contentProviders.put(taskListView, contentProvider);
- }
- return contentProvider;
- }
-
- /**
- * Creates a new instance of a content provider for a particular instance of the Task List
- *
- * TODO: change view parameter to be the viewer
- */
- protected abstract AbstractTaskListContentProvider createContentProvider(TaskListView taskListView);
-
- public ImageDescriptor getImageDescriptor() {
- return imageDescriptor;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setImageDescriptor(ImageDescriptor imageDescriptor) {
- this.imageDescriptor = imageDescriptor;
- }
-
- public boolean isPrimary() {
- return primary;
- }
-
- public void setPrimary(boolean primary) {
- this.primary = primary;
- }
-
- public String getId() {
- return id;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
deleted file mode 100644
index 1c06dd8c4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - fixes for bug 169916
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFonts;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Mik Kersten
- */
-class CustomTaskListDecorationDrawer implements Listener {
-
- private final TaskListView taskListView;
-
- private final int activationImageOffset;
-
- private final Image taskActive = CommonImages.getImage(TasksUiImages.CONTEXT_ACTIVE);
-
- private final Image taskInactive = CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE_EMPTY);
-
- private final Image taskInactiveContext = CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE);
-
- // see bug 185004
- private final int platformSpecificSquish;
-
- private final Rectangle lastClippingArea;
-
- private final boolean tweakClipping;
-
- private boolean useStrikethroughForCompleted;
-
- private final org.eclipse.jface.util.IPropertyChangeListener PROPERTY_LISTENER = new org.eclipse.jface.util.IPropertyChangeListener() {
-
- public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
- if (event.getProperty().equals(ITasksUiPreferenceConstants.USE_STRIKETHROUGH_FOR_COMPLETED)) {
- if (event.getNewValue() instanceof Boolean) {
- useStrikethroughForCompleted = (Boolean) event.getNewValue();
- taskListView.refresh();
- }
- }
- }
- };
-
- CustomTaskListDecorationDrawer(TaskListView taskListView, int activationImageOffset) {
- this.taskListView = taskListView;
- this.activationImageOffset = activationImageOffset;
- this.lastClippingArea = new Rectangle(0, 0, 0, 0);
- this.tweakClipping = PlatformUtil.isPaintItemClippingRequired();
- this.platformSpecificSquish = PlatformUtil.getTreeItemSquish();
- this.taskListView.synchronizationOverlaid = TasksUiPlugin.getDefault().getPluginPreferences().getBoolean(
- ITasksUiPreferenceConstants.OVERLAYS_INCOMING_TIGHT);
- this.useStrikethroughForCompleted = TasksUiPlugin.getDefault().getPluginPreferences().getBoolean(
- ITasksUiPreferenceConstants.USE_STRIKETHROUGH_FOR_COMPLETED);
- TasksUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER);
- }
-
- /*
- * NOTE: MeasureItem, PaintItem and EraseItem are called repeatedly.
- * Therefore, it is critical for performance that these methods be as
- * efficient as possible.
- */
- public void handleEvent(Event event) {
- Object data = event.item.getData();
- Image activationImage = null;
- if (data instanceof ITask) {
- AbstractTask task = (AbstractTask) data;
- if (task.isActive()) {
- activationImage = taskActive;
- } else if (ContextCore.getContextManager().hasContext(task.getHandleIdentifier())) {
- activationImage = taskInactiveContext;
- } else {
- activationImage = taskInactive;
- }
- }
- if (!CommonFonts.HAS_STRIKETHROUGH) {
- if (data instanceof AbstractTask & useStrikethroughForCompleted) {
- AbstractTask task = (AbstractTask) data;
- if (task.isCompleted()) {
- Rectangle bounds;
- //if (isCOCOA) {
- bounds = ((TreeItem) event.item).getTextBounds(0);
-// } else {
-// bounds = ((TreeItem) event.item).getBounds();
-// }
- int lineY = bounds.y + (bounds.height / 2);
- String itemText = ((TreeItem) event.item).getText();
- Point extent = event.gc.textExtent(itemText);
- event.gc.drawLine(bounds.x, lineY, bounds.x + extent.x, lineY);
- }
- }
- }
- if (data instanceof ITaskContainer) {
- switch (event.type) {
- case SWT.EraseItem: {
- if (activationImage != null) {
- drawActivationImage(activationImageOffset, event, activationImage);
- }
- if (!this.taskListView.synchronizationOverlaid) {
- if (data instanceof ITaskContainer) {
- drawSyncronizationImage((ITaskContainer) data, event);
- }
- }
-
- // TODO: would be nice not to do this on each item's painting
-// String text = tree.getFilterControl().getText();
-// if (text != null && !text.equals("") && tree.getViewer().getExpandedElements().length <= 12) {
-// int offsetY = tree.getViewer().getExpandedElements().length * tree.getViewer().getTree().getItemHeight();
-// event.gc.drawText("Open search dialog...", 20, offsetY - 10);
-// }
- if (tweakClipping) {
- lastClippingArea.x = event.x;
- lastClippingArea.y = event.y;
- lastClippingArea.width = event.width;
- lastClippingArea.height = event.height;
- }
- break;
- }
- case SWT.PaintItem: {
- Rectangle clipping = null;
- if (tweakClipping) {
- clipping = event.gc.getClipping();
- event.gc.setClipping(lastClippingArea);
- }
- if (activationImage != null) {
- drawActivationImage(activationImageOffset, event, activationImage);
- }
- if (data instanceof ITaskContainer) {
- drawSyncronizationImage((ITaskContainer) data, event);
- }
- if (tweakClipping) {
- event.gc.setClipping(clipping);
- }
- break;
- }
- }
- }
- }
-
- private void drawSyncronizationImage(ITaskContainer element, Event event) {
- Image image = null;
- int offsetX = 6;
- int offsetY = (event.height / 2) - 5;
- if (taskListView.synchronizationOverlaid) {
- offsetX = event.x + 18 - platformSpecificSquish;
- offsetY += 2;
- }
- if (element != null) {
- if (element instanceof ITask) {
- image = CommonImages.getImage(getSynchronizationImageDescriptor(element,
- taskListView.synchronizationOverlaid));
- } else {
- int imageOffset = 0;
- if (!hideDecorationOnContainer(element, (TreeItem) event.item)
- && AbstractTaskListFilter.hasDescendantIncoming(element)) {
- if (taskListView.synchronizationOverlaid) {
- image = CommonImages.getImage(CommonImages.OVERLAY_SYNC_OLD_INCOMMING);
- } else {
- image = CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING);
- }
- } else if (element instanceof IRepositoryQuery) {
- RepositoryQuery query = (RepositoryQuery) element;
- if (query.getStatus() != null) {
- image = CommonImages.getImage(CommonImages.OVERLAY_SYNC_WARNING);
- if (taskListView.synchronizationOverlaid) {
- imageOffset = 11;
- } else {
- imageOffset = 3;
- }
- }
- }
-
- int additionalSquish = 0;
- if (platformSpecificSquish > 0 && taskListView.synchronizationOverlaid) {
- additionalSquish = platformSpecificSquish + 3;
- } else if (platformSpecificSquish > 0) {
- additionalSquish = platformSpecificSquish / 2;
- }
- if (taskListView.synchronizationOverlaid) {
- offsetX = 42 - imageOffset - additionalSquish;
- } else {
- offsetX = 24 - imageOffset - additionalSquish;
- }
- }
- }
-
- if (image != null) {
- event.gc.drawImage(image, offsetX, event.y + offsetY);
- }
- }
-
- private boolean hideDecorationOnContainer(ITaskContainer element, TreeItem treeItem) {
- if (element instanceof UnmatchedTaskContainer) {
- if (!taskListView.isFocusedMode()) {
- return false;
- } else if (AbstractTaskListFilter.hasDescendantIncoming(element)) {
- return true;
- }
- } else if (element instanceof IRepositoryQuery) {
- RepositoryQuery query = (RepositoryQuery) element;
- if (query.getStatus() != null) {
- return true;
- }
- }
-
- if (!taskListView.isFocusedMode()) {
- return false;
- } else if (element instanceof IRepositoryQuery || element instanceof TaskCategory) {
- return treeItem.getExpanded();
- } else {
- return false;
- }
- }
-
- private void drawActivationImage(final int activationImageOffset, Event event, Image image) {
- Rectangle rect = image.getBounds();
- int offset = Math.max(0, (event.height - rect.height) / 2);
- event.gc.drawImage(image, activationImageOffset, event.y + offset);
- }
-
- private ImageDescriptor getSynchronizationImageDescriptor(Object element, boolean synchViewStyle) {
- if (element instanceof ITask) {
- ITask repositoryTask = (ITask) element;
- if (repositoryTask.getSynchronizationState() == SynchronizationState.INCOMING_NEW) {
- if (synchViewStyle) {
- return CommonImages.OVERLAY_SYNC_OLD_INCOMMING_NEW;
- } else {
- return CommonImages.OVERLAY_SYNC_INCOMMING_NEW;
- }
- } else if (repositoryTask.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
- if (synchViewStyle) {
- return CommonImages.OVERLAY_SYNC_OLD_OUTGOING;
- } else {
- return CommonImages.OVERLAY_SYNC_OUTGOING_NEW;
- }
- }
- ImageDescriptor imageDescriptor = null;
- if (repositoryTask.getSynchronizationState() == SynchronizationState.OUTGOING
- || repositoryTask.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
- if (synchViewStyle) {
- imageDescriptor = CommonImages.OVERLAY_SYNC_OLD_OUTGOING;
- } else {
- imageDescriptor = CommonImages.OVERLAY_SYNC_OUTGOING;
- }
- } else if (repositoryTask.getSynchronizationState() == SynchronizationState.INCOMING) {
- if (synchViewStyle) {
- imageDescriptor = CommonImages.OVERLAY_SYNC_OLD_INCOMMING;
- } else {
- imageDescriptor = CommonImages.OVERLAY_SYNC_INCOMMING;
- }
- } else if (repositoryTask.getSynchronizationState() == SynchronizationState.CONFLICT) {
- imageDescriptor = CommonImages.OVERLAY_SYNC_CONFLICT;
- }
- if (imageDescriptor == null && repositoryTask instanceof AbstractTask
- && ((AbstractTask) repositoryTask).getStatus() != null) {
- return CommonImages.OVERLAY_SYNC_WARNING;
- } else if (imageDescriptor != null) {
- return imageDescriptor;
- }
- } else if (element instanceof IRepositoryQuery) {
- RepositoryQuery query = (RepositoryQuery) element;
- if (query.getStatus() != null) {
- return CommonImages.OVERLAY_SYNC_WARNING;
- }
- }
- // HACK: need a proper blank image
- return CommonImages.OVERLAY_CLEAR;
- }
-
- public void dispose() {
- TasksUiPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(PROPERTY_LISTENER);
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java
deleted file mode 100644
index bbc8463ca..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/Messages.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.views.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String DisconnectRepositoryAction_Disconnected;
-
- public static String PriorityDropDownAction_Filter_Priority_Lower_Than;
-
- public static String TaskInputDialog_Clear;
-
- public static String TaskInputDialog_Description;
-
- public static String TaskInputDialog_Get_Description;
-
- public static String TaskInputDialog_New_Task;
-
- public static String TaskInputDialog_Web_Link;
-
- public static String TaskListDropAdapter__retrieving_from_URL_;
-
- public static String TaskListFilteredTree_Activate;
-
- public static String TaskListFilteredTree_Edit_Task_Working_Sets_;
-
- public static String TaskListFilteredTree_Estimated_hours;
-
- public static String TaskListFilteredTree__multiple_;
-
- public static String TaskListFilteredTree_Scheduled_tasks;
-
- public static String TaskListFilteredTree_Search_repository_for_key_or_summary_;
-
- public static String TaskListFilteredTree_Select_Active_Task;
-
- public static String TaskListFilteredTree_Select_Working_Set;
-
- public static String TaskListFilteredTree_Workweek_Progress;
-
- public static String TaskListToolTip_Automatic_container_for_all_local_tasks;
-
- public static String TaskListToolTip_Automatic_container_for_repository_tasks;
-
- public static String TaskListToolTip_Due;
-
- public static String TaskListToolTip_Elapsed;
-
- public static String TaskListToolTip_Estimate;
-
- public static String TaskListToolTip_Please_synchronize_manually_for_full_error_message;
-
- public static String TaskListToolTip_Scheduled;
-
- public static String TaskListToolTip_Some_incoming_elements_may_be_filtered;
-
- public static String TaskListToolTip_Synchronized;
-
- public static String TaskListToolTip_Total_Complete_Incomplete;
-
- public static String TaskListView_Mylyn_context_capture_paused;
-
- public static String TaskListView__paused_;
-
- public static String TaskListView_Repository;
-
- public static String TaskListView_Summary;
-
- public static String TaskListView_Task_List;
-
- public static String TaskScheduleContentProvider_Future;
-
- public static String TaskScheduleContentProvider_Two_Weeks;
-
- public static String TaskScheduleContentProvider_Unscheduled;
-
- public static String UpdateRepositoryConfigurationAction_Error_updating_repository_configuration;
-
- public static String UpdateRepositoryConfigurationAction_Update_Repository_Configuration;
-
- public static String UpdateRepositoryConfigurationAction_Updating_repository_configuration_for_X;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/PriorityDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/PriorityDropDownAction.java
deleted file mode 100644
index 3e42603c2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/PriorityDropDownAction.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * @author Mik Kersten
- */
-class PriorityDropDownAction extends Action implements IMenuCreator {
-
- /**
- *
- */
- private final TaskListView taskListView;
-
- private Action priority1;
-
- private Action priority2;
-
- private Action priority3;
-
- private Action priority4;
-
- private Action priority5;
-
- private Menu dropDownMenu = null;
-
- public PriorityDropDownAction(TaskListView taskListView) {
- super();
- this.taskListView = taskListView;
- setText(Messages.PriorityDropDownAction_Filter_Priority_Lower_Than);
- setToolTipText(Messages.PriorityDropDownAction_Filter_Priority_Lower_Than);
- setImageDescriptor(CommonImages.FILTER_PRIORITY);
- setMenuCreator(this);
- }
-
- public void dispose() {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- dropDownMenu = null;
- }
- }
-
- public Menu getMenu(Control parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- public Menu getMenu(Menu parent) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- dropDownMenu = new Menu(parent);
- addActionsToMenu();
- return dropDownMenu;
- }
-
- public void addActionsToMenu() {
- priority1 = new Action("", AS_CHECK_BOX) { //$NON-NLS-1$
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_PRIORITY,
- PriorityLevel.P1.toString());
- PriorityDropDownAction.this.taskListView.displayPrioritiesAbove(TaskListView.PRIORITY_LEVELS[0]);
- }
- };
- priority1.setEnabled(true);
- priority1.setText(PriorityLevel.P1.getDescription());
- priority1.setImageDescriptor(CommonImages.PRIORITY_1);
- ActionContributionItem item = new ActionContributionItem(priority1);
- item.fill(dropDownMenu, -1);
-
- priority2 = new Action("", AS_CHECK_BOX) { //$NON-NLS-1$
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_PRIORITY,
- PriorityLevel.P2.toString());
- PriorityDropDownAction.this.taskListView.displayPrioritiesAbove(TaskListView.PRIORITY_LEVELS[1]);
- }
- };
- priority2.setEnabled(true);
- priority2.setText(PriorityLevel.P2.getDescription());
- priority2.setImageDescriptor(CommonImages.PRIORITY_2);
- item = new ActionContributionItem(priority2);
- item.fill(dropDownMenu, -1);
-
- priority3 = new Action("", AS_CHECK_BOX) { //$NON-NLS-1$
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_PRIORITY,
- PriorityLevel.P3.toString());
- PriorityDropDownAction.this.taskListView.displayPrioritiesAbove(TaskListView.PRIORITY_LEVELS[2]);
- }
- };
- priority3.setEnabled(true);
- priority3.setText(PriorityLevel.P3.getDescription());
- priority3.setImageDescriptor(CommonImages.PRIORITY_3);
- item = new ActionContributionItem(priority3);
- item.fill(dropDownMenu, -1);
-
- priority4 = new Action("", AS_CHECK_BOX) { //$NON-NLS-1$
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_PRIORITY,
- PriorityLevel.P4.toString());
- PriorityDropDownAction.this.taskListView.displayPrioritiesAbove(TaskListView.PRIORITY_LEVELS[3]);
- }
- };
- priority4.setEnabled(true);
- priority4.setText(PriorityLevel.P4.getDescription());
- priority4.setImageDescriptor(CommonImages.PRIORITY_4);
- item = new ActionContributionItem(priority4);
- item.fill(dropDownMenu, -1);
-
- priority5 = new Action("", AS_CHECK_BOX) { //$NON-NLS-1$
- @Override
- public void run() {
- TasksUiPlugin.getDefault().getPreferenceStore().setValue(ITasksUiPreferenceConstants.FILTER_PRIORITY,
- PriorityLevel.P5.toString());
- PriorityDropDownAction.this.taskListView.displayPrioritiesAbove(TaskListView.PRIORITY_LEVELS[4]);
- }
- };
- priority5.setEnabled(true);
- priority5.setImageDescriptor(CommonImages.PRIORITY_5);
- priority5.setText(PriorityLevel.P5.getDescription());
- item = new ActionContributionItem(priority5);
- item.fill(dropDownMenu, -1);
-
- updateCheckedState();
-// updateCheckedState(priority1, priority2, priority3, priority4, priority5);
- }
-
- void updateCheckedState() {
- if (priority1 == null) {
- return;
- }
- String priority = TaskListView.getCurrentPriorityLevel();
-
- priority1.setChecked(false);
- priority2.setChecked(false);
- priority3.setChecked(false);
- priority4.setChecked(false);
- priority5.setChecked(false);
-
- if (priority.equals(TaskListView.PRIORITY_LEVELS[0])) {
- priority1.setChecked(true);
- } else if (priority.equals(TaskListView.PRIORITY_LEVELS[1])) {
- priority1.setChecked(true);
- priority2.setChecked(true);
- } else if (priority.equals(TaskListView.PRIORITY_LEVELS[2])) {
- priority1.setChecked(true);
- priority2.setChecked(true);
- priority3.setChecked(true);
- } else if (priority.equals(TaskListView.PRIORITY_LEVELS[3])) {
- priority1.setChecked(true);
- priority2.setChecked(true);
- priority3.setChecked(true);
- priority4.setChecked(true);
- } else if (priority.equals(TaskListView.PRIORITY_LEVELS[4])) {
- priority1.setChecked(true);
- priority2.setChecked(true);
- priority3.setChecked(true);
- priority4.setChecked(true);
- priority5.setChecked(true);
- }
- }
-
- @Override
- public void run() {
- this.setChecked(isChecked());
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
deleted file mode 100644
index 9b621a853..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Mik Kersten
- */
-public class TableDecoratingLabelProvider extends DecoratingLabelProvider implements ITableLabelProvider {
-
- public TableDecoratingLabelProvider(ILabelProvider provider, ILabelDecorator decorator) {
- super(provider, decorator);
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (!(element instanceof ITaskContainer)) {
- return null;
- }
- if (columnIndex == 0) {
- if (element instanceof ITaskContainer && !(element instanceof ITask)) {
- return super.getImage(element);
- } else {
- if (element instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) element;
- if (task.isActive()) {
- return CommonImages.getImage(TasksUiImages.CONTEXT_ACTIVE);
- } else {
- if (ContextCore.getContextManager().hasContext(task.getHandleIdentifier())) {
- return CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE);
- } else {
- return CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE_EMPTY);
- }
- }
- } else {
- return CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE_EMPTY);
- }
- }
- } else if (columnIndex == 1) {
- if (element instanceof ITaskContainer || element instanceof IRepositoryQuery) {
- return null;
- }
- return super.getImage(element);
- }
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskDetailLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskDetailLabelProvider.java
deleted file mode 100644
index 54673df23..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskDetailLabelProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Displays task repository info from a {@link AbstractTask}
- *
- * @author Willian Mitsuda
- */
-public class TaskDetailLabelProvider extends LabelProvider implements ILabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (!(element instanceof ITask)) {
- return super.getImage(element);
- }
-
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- ((ITask) element).getConnectorKind());
- ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(connector.getConnectorKind());
- if (overlay != null) {
- return CommonImages.getImageWithOverlay(TasksUiImages.REPOSITORY, overlay, false, false);
- } else {
- return CommonImages.getImage(TasksUiImages.REPOSITORY);
- }
- }
-
- @Override
- public String getText(Object element) {
- if (!(element instanceof ITask)) {
- return super.getText(element);
- }
-
- ITask task = (ITask) element;
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- return repository.getRepositoryLabel();
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskInputDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskInputDialog.java
deleted file mode 100644
index 2f1d17d99..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskInputDialog.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Ken Sueda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ken Sueda - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.AbstractRetrieveTitleFromUrlJob;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Ken Sueda
- * @author Wesley Coelho (Extended to allow URL input)
- * @author Mik Kersten
- */
-public class TaskInputDialog extends Dialog {
-
- private String taskName = ""; //$NON-NLS-1$
-
- private String priority = "P3"; //$NON-NLS-1$
-
- private String taskURL = "http://"; //$NON-NLS-1$
-
- private Date reminderDate;
-
- private Text taskNameTextWidget;
-
- private Text issueURLTextWidget;
-
- private Button getDescButton;
-
- public TaskInputDialog(Shell parentShell) {
- super(parentShell);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout gl = new GridLayout(5, false);
- composite.setLayout(gl);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH + 180);
- composite.setLayoutData(data);
-
- Label taskNameLabel = new Label(composite, SWT.WRAP);
- taskNameLabel.setText(Messages.TaskInputDialog_Description);
- taskNameLabel.setFont(parent.getFont());
-
- taskNameTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridData taskNameGD = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
- taskNameGD.widthHint = 200;
- taskNameGD.horizontalSpan = 1;
- taskNameTextWidget.setLayoutData(taskNameGD);
-
- final Combo c = new Combo(composite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY
- | SWT.DROP_DOWN);
- c.setItems(TaskListView.PRIORITY_LEVELS);
- c.setText(priority);
- c.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- priority = c.getText();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
-// Label spacer = new Label(composite, SWT.NONE);
-// GridData spacerGD = new GridData();
-// spacerGD.horizontalSpan = 1;
-//// spacerGD.widthHint = 5;
-// spacer.setLayoutData(spacerGD);
-//
-// Composite reminderComp = new Composite(composite, SWT.NONE);
-// GridLayout reminderCompGL = new GridLayout(3, false);
-// reminderCompGL.marginHeight = 0;
-// reminderCompGL.marginWidth = 0;
-// reminderComp.setLayout(reminderCompGL);
-// GridData reminderCompGD = new GridData();
-// reminderCompGD.horizontalSpan = 1;
-// reminderCompGD.horizontalAlignment = SWT.RIGHT;
-// reminderComp.setLayoutData(reminderCompGD);
-// Label reminderLabel = new Label(reminderComp, SWT.NONE);
- final DatePicker datePicker = new DatePicker(composite, SWT.BORDER, DatePicker.LABEL_CHOOSE, true,
- TasksUiPlugin.getDefault().getPreferenceStore().getInt(ITasksUiPreferenceConstants.PLANNING_ENDHOUR));
- datePicker.addPickerSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent arg0) {
- if (datePicker.getDate() != null) {
- reminderDate = datePicker.getDate().getTime();
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent arg0) {
- // ignore
- }
- });
-
- Button removeReminder = new Button(composite, SWT.PUSH | SWT.CENTER);
- removeReminder.setText(Messages.TaskInputDialog_Clear);
- removeReminder.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- datePicker.setDate(null);
- reminderDate = null;
- }
- });
-
-//
-// scheduledForDate.setLayout(new GridLayout());
-// GridData datePickerGD = new GridData();
-// datePickerGD.widthHint = 300;
-// scheduledForDate.setLayoutData(datePickerGD);
-
- Label urlLabel = new Label(composite, SWT.WRAP);
- urlLabel.setText(Messages.TaskInputDialog_Web_Link);
- urlLabel.setFont(parent.getFont());
-
- issueURLTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
- issueURLTextWidget.setText(getDefaultIssueUrl());
- GridData urlData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
- urlData.horizontalSpan = 3;
- urlData.grabExcessHorizontalSpace = true;
- issueURLTextWidget.setLayoutData(urlData);
-
- getDescButton = new Button(composite, SWT.PUSH);
- getDescButton.setText(Messages.TaskInputDialog_Get_Description);
- getDescButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- setButtonStatus();
-
- issueURLTextWidget.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- setButtonStatus();
- }
-
- public void keyReleased(KeyEvent e) {
- setButtonStatus();
- }
- });
-
- getDescButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- retrieveTaskDescription(issueURLTextWidget.getText());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- return composite;
- }
-
- /**
- * Sets the Get Description button enabled or not depending on whether there is a URL specified
- */
- protected void setButtonStatus() {
- String url = issueURLTextWidget.getText();
-
- if (url.length() > 10 && (url.startsWith("http://") || url.startsWith("https://"))) { //$NON-NLS-1$ //$NON-NLS-2$
-// String defaultPrefix = ContextCore.getPreferenceStore().getString(
-// TaskListPreferenceConstants.DEFAULT_URL_PREFIX);
-// if (url.equals(defaultPrefix)) {
-// getDescButton.setEnabled(false);
-// } else {
- getDescButton.setEnabled(true);
-// }
- } else {
- getDescButton.setEnabled(false);
- }
- }
-
- /**
- * Returns the default URL text for the task by first checking the contents of the clipboard and then using the
- * default prefix preference if that fails
- */
- protected String getDefaultIssueUrl() {
-
- String clipboardText = getClipboardText();
- if ((clipboardText.startsWith("http://") || clipboardText.startsWith("https://") && clipboardText.length() > 10)) { //$NON-NLS-1$ //$NON-NLS-2$
- return clipboardText;
- } else {
- return taskURL;
- }
-// String defaultPrefix = ContextCore.getPreferenceStore().getString(
-// TaskListPreferenceConstants.DEFAULT_URL_PREFIX);
-// if (!defaultPrefix.equals("")) {
-// return defaultPrefix;
-// }
- }
-
- /**
- * Attempts to set the task pageTitle to the title from the specified url
- */
- protected void retrieveTaskDescription(final String url) {
- try {
- AbstractRetrieveTitleFromUrlJob job = new AbstractRetrieveTitleFromUrlJob(issueURLTextWidget.getText()) {
- @Override
- protected void titleRetrieved(final String pageTitle) {
- taskNameTextWidget.setText(pageTitle);
- }
- };
- job.schedule();
- } catch (RuntimeException e) {
- // FIXME which exception is caught here?
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not open task web page", e)); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the contents of the clipboard or "" if no text content was available
- */
- protected String getClipboardText() {
- Clipboard clipboard = new Clipboard(Display.getDefault());
- TextTransfer transfer = TextTransfer.getInstance();
- String contents = (String) clipboard.getContents(transfer);
- if (contents != null) {
- return contents;
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- public String getSelectedPriority() {
- return priority;
- }
-
- public String getTaskname() {
- return taskName;
- }
-
- public Date getReminderDate() {
- return reminderDate;
- }
-
- public String getIssueURL() {
- return taskURL;
- }
-
- @Override
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- taskName = taskNameTextWidget.getText();
- taskURL = issueURLTextWidget.getText();
- } else {
- taskName = null;
- }
- super.buttonPressed(buttonId);
- }
-
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(Messages.TaskInputDialog_New_Task);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskKeyComparator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskKeyComparator.java
deleted file mode 100644
index 64d69d68c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskKeyComparator.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation for bug 129511
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.Comparator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author Eugene Kuleshov
- */
-public class TaskKeyComparator implements Comparator<String[]> {
-
- private static final String MODULE_TASK_PATTERN = "(?:([A-Za-z]*[:_\\-]?)(\\d+))?"; //$NON-NLS-1$
-
- private static final Pattern ID_PATTERN = Pattern.compile(MODULE_TASK_PATTERN);
-
- public static final Pattern PATTERN = Pattern.compile(MODULE_TASK_PATTERN + "(.*)"); //$NON-NLS-1$
-
- public int compare2(String o1, String o2) {
- String[] a1 = split(o1);
- String[] a2 = split(o2);
- return compare(a1, a2);
- }
-
- public int compare(String a1[], String a2[]) {
- if (a1[0] == null && a1[1] == null) {
- a1 = split(a1[2]);
- } else if ((a1[0] == null || a1[0].length() == 0) && a1[1] != null && a1[1].length() > 0) {
- String b1[] = splitTask(a1[1]);
- a1[0] = b1[0];
- a1[1] = b1[1];
- }
-
- if (a2[0] == null && a2[1] == null) {
- a2 = split(a2[2]);
- } else if ((a2[0] == null || a2[0].length() == 0) && a2[1] != null && a2[1].length() > 0) {
- String b2[] = splitTask(a2[1]);
- a2[0] = b2[0];
- a2[1] = b2[1];
-
- }
- return compare(a1[0], a1[1], a1[2], a2[0], a2[1], a2[2]);
- }
-
- private static int compare(final String component1, final String key1, final String value1,
- final String component2, final String key2, final String value2) {
- if (component1 == null && component2 != null) {
- return -1;
- }
- if (component1 != null && component2 == null) {
- return 1;
- }
-
- if (component1 != null && component2 != null) {
- int n = component1.compareToIgnoreCase(component2);
- if (n != 0) {
- return n;
- }
-
- if (key1 == null && key2 != null) {
- return -1;
- }
- if (key1 != null && key2 == null) {
- return 1;
- }
-
- if (key1 != null && key2 != null) {
- if (key1.length() == key2.length() || key1.length() == 0 || key2.length() == 0) {
- n = key1.compareTo(key2);
- } else {
- n = Integer.valueOf(key1).compareTo(Integer.valueOf(key2));
- }
- if (n != 0) {
- return n;
- }
- }
- }
-
- return value1.compareToIgnoreCase(value2);
- }
-
- public String[] split(String s) {
- Matcher matcher = PATTERN.matcher(s);
-
- if (!matcher.find()) {
- return new String[] { null, null, s };
- }
-
- int n = matcher.groupCount();
- String[] res = new String[n];
- for (int i = 1; i < n + 1; i++) {
- res[i - 1] = matcher.group(i);
- }
- return res;
- }
-
- private static String[] splitTask(final String s) {
- Matcher matcher = ID_PATTERN.matcher(s);
-
- if (!matcher.find()) {
- return new String[] { null, s };
- }
-
- int n = matcher.groupCount();
- String[] res = new String[n];
- for (int i = 1; i < n + 1; i++) {
- res[i - 1] = matcher.group(i);
- }
- return res;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
deleted file mode 100644
index 2cbb7a2f6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskDeactivateAction;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Mik Kersten
- */
-class TaskListCellModifier implements ICellModifier {
-
- private final TaskListView taskListView;
-
- private boolean disableActivateForParentTasks = false;
-
- TaskListCellModifier(TaskListView taskListView) {
- this.taskListView = taskListView;
-
- if (SWT.getPlatform().equals("gtk")) { //$NON-NLS-1$
- disableActivateForParentTasks = true;
- }
- }
-
- public boolean canModify(Object element, String property) {
- return taskListView.isInRenameAction;
- }
-
- public Object getValue(Object element, String property) {
- try {
- int columnIndex = Arrays.asList(this.taskListView.columnNames).indexOf(property);
- if (element instanceof IRepositoryElement) {
- final IRepositoryElement taskListElement = (IRepositoryElement) element;
- switch (columnIndex) {
- case 0:
- return taskListElement.getSummary();
- case 1:
- return ""; //$NON-NLS-1$
- case 2:
- return ""; //$NON-NLS-1$
- }
- }
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- return ""; //$NON-NLS-1$
- }
-
- public void modify(Object element, String property, Object value) {
- int columnIndex = -1;
- try {
- if (element instanceof TreeItem && ((TreeItem) element).isDisposed()) {
- return;
- }
- columnIndex = Arrays.asList(this.taskListView.columnNames).indexOf(property);
- Object data = ((TreeItem) element).getData();
- if (data instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) data;
- switch (columnIndex) {
- case 0:
- if (task != null) {
- task.setSummary(((String) value).trim());
- TasksUiPlugin.getTaskList().notifyElementChanged(task);
- }
- break;
- case 1:
- break;
- case 2:
- toggleTaskActivation((TreeItem) element);
- break;
- }
- } else if (data instanceof AbstractTaskCategory || data instanceof IRepositoryQuery) {
- AbstractTaskContainer container = (AbstractTaskContainer) data;
- switch (columnIndex) {
- case 0:
- TasksUiPlugin.getTaskList().renameContainer(container, ((String) value).trim());
- case 1:
- break;
- case 2:
- break;
- }
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- this.taskListView.refresh();//.getViewer().refresh();
- }
-
- public void toggleTaskActivation(TreeItem element) {
- AbstractTask task = null;
- if (element.getData() instanceof AbstractTask) {
- task = (AbstractTask) element.getData();
-
- if (disableActivateForParentTasks) {
- // check if activation column overlaps with tree expander control: element is on second hierarchy level and has children
- TreeItem parent = element.getParentItem();
- if (parent != null
- && (parent.getData() instanceof IRepositoryQuery || parent.getData() instanceof AbstractTaskCategory)
- && element.getItemCount() > 0) {
- return;
- }
- }
-
- if (task.isActive()) {
- new TaskDeactivateAction().run(task);
- } else {
- new TaskActivateAction().run(task);
- }
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
deleted file mode 100644
index ba99c3836..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListContentProvider.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * Provides custom content for the task list, e.g. guaranteed visibility of some elements, ability to suppress
- * containers showing if nothing should show under them.
- *
- * TODO: move to viewer filter architecture?
- *
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class TaskListContentProvider extends AbstractTaskListContentProvider {
-
- public TaskListContentProvider(TaskListView taskListView) {
- super(taskListView);
- }
-
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- this.taskListView.expandToActiveTasks();
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object parent) {
- if (parent.equals(this.taskListView.getViewSite())) {
- return applyFilter(TasksUiPlugin.getTaskList().getRootElements()).toArray();
- }
- return getChildren(parent);
- }
-
- /**
- * @return first parent found
- */
- public Object getParent(Object child) {
- // return first parent found, first search within categories then queries
- if (child instanceof ITask) {
- ITask task = (ITask) child;
- AbstractTaskCategory parent = TaskCategory.getParentTaskCategory(task);
- if (parent != null) {
- return parent;
- }
-
- Set<AbstractTaskContainer> parents = ((AbstractTask) task).getParentContainers();
- Iterator<AbstractTaskContainer> it = parents.iterator();
- if (it.hasNext()) {
- return parents.iterator().next();
- }
- }
- // no parent found
- return null;
- }
-
- public Object[] getChildren(Object parent) {
- return getFilteredChildrenFor(parent).toArray();
- }
-
- /**
- * NOTE: If parent is an ITask, this method checks if parent has unfiltered children (see bug 145194).
- */
- public boolean hasChildren(Object parent) {
- Object[] children = getChildren(parent);
- return children != null && children.length > 0;
-
-// if (parent instanceof AbstractRepositoryQuery) {
-// AbstractRepositoryQuery query = (AbstractRepositoryQuery) parent;
-// return !getFilteredChildrenFor(query).isEmpty();
-// //return !query.isEmpty();
-// } else if (parent instanceof AbstractTask) {
-// return taskHasUnfilteredChildren((AbstractTask) parent);
-// } else if (parent instanceof AbstractTaskContainer) {
-// AbstractTaskContainer container = (AbstractTaskContainer) parent;
-// return !getFilteredChildrenFor(container).isEmpty();
-// //return !container.getChildren().isEmpty();
-// }
-// return false;
- }
-
- protected List<AbstractTaskContainer> applyFilter(Set<AbstractTaskContainer> roots) {
- List<AbstractTaskContainer> filteredRoots = new ArrayList<AbstractTaskContainer>();
- for (AbstractTaskContainer element : roots) {
- // NOTE: tasks can no longer appear as root elements
- if (selectContainer(element)) {
- filteredRoots.add(element);
- }
- }
- return filteredRoots;
- }
-
- /**
- * See bug 109693
- */
- private boolean containsNoFilterText(String filterText) {
- return filterText == null || filterText.length() == 0;
- }
-
- private boolean selectContainer(ITaskContainer container) {
- if (filter(null, container)) {
- return false;
- }
- return true;
- }
-
- private List<IRepositoryElement> getFilteredChildrenFor(Object parent) {
- if (containsNoFilterText((this.taskListView.getFilteredTree().getFilterControl()).getText())) {
- List<IRepositoryElement> children = new ArrayList<IRepositoryElement>();
- if (parent instanceof ITask) {
- Collection<ITask> subTasks = ((AbstractTask) parent).getChildren();
- for (ITask task : subTasks) {
- if (!filter(parent, task)) {
- children.add(task);
- }
- }
- return children;
- } else if (parent instanceof ITaskContainer) {
- return getFilteredRootChildren((ITaskContainer) parent);
- }
- } else {
- List<IRepositoryElement> children = new ArrayList<IRepositoryElement>();
- if (parent instanceof ITaskContainer) {
- children.addAll(((ITaskContainer) parent).getChildren());
- return children;
- }
- }
- return Collections.emptyList();
- }
-
- /**
- * @return all children who aren't already revealed as a sub task
- */
- private List<IRepositoryElement> getFilteredRootChildren(ITaskContainer parent) {
- List<IRepositoryElement> result = new ArrayList<IRepositoryElement>();
- if (TasksUiPlugin.getDefault().groupSubtasks(parent)) {
- Collection<ITask> parentTasks = parent.getChildren();
- Set<IRepositoryElement> parents = new HashSet<IRepositoryElement>();
- Set<ITask> children = new HashSet<ITask>();
- // get all children
- for (ITask element : parentTasks) {
- if (element instanceof ITaskContainer) {
- for (ITask abstractTask : ((ITaskContainer) element).getChildren()) {
- children.add(abstractTask);
- }
- }
- }
- for (ITask task : parentTasks) {
- if (!filter(parent, task) && !children.contains(task)) {
- parents.add(task);
- }
- }
- result.addAll(parents);
- } else {
- for (IRepositoryElement element : parent.getChildren()) {
- if (!filter(parent, element)) {
- result.add(element);
- }
- }
- }
- return result;
- }
-
- protected boolean filter(Object parent, Object object) {
- boolean emptyFilterText = containsNoFilterText((this.taskListView.getFilteredTree().getFilterControl()).getText());
- for (AbstractTaskListFilter filter : this.taskListView.getFilters()) {
- if (emptyFilterText) {
- if (!filter.select(parent, object)) {
- return true;
- }
- } else {
- if (filter.applyToFilteredText()) {
- if (!filter.select(parent, object)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
deleted file mode 100644
index a37e7e028..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListDropAdapter.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Jevgeni Holodkov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.AbstractRetrieveTitleFromUrlJob;
-import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Unscheduled;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves (added URL based task creation support)
- * @author Jevgeni Holodkov
- */
-public class TaskListDropAdapter extends ViewerDropAdapter {
-
- private boolean fileTransfer;
-
- private boolean localTransfer;
-
- public TaskListDropAdapter(Viewer viewer) {
- super(viewer);
- setFeedbackEnabled(true);
- }
-
- @Override
- public void dragOver(DropTargetEvent event) {
- // support dragging from sources only supporting DROP_LINK
- if (event.detail == DND.DROP_NONE && (event.operations & DND.DROP_LINK) == DND.DROP_LINK) {
- event.detail = DND.DROP_LINK;
- }
- super.dragOver(event);
- }
-
- @Override
- public boolean performDrop(final Object data) {
- List<ITask> tasksToMove = new ArrayList<ITask>();
-
- if (localTransfer) {
- ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
- if (selection instanceof IStructuredSelection) {
- for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
- Object item = it.next();
- if (item instanceof ITask) {
- tasksToMove.add((ITask) item);
- }
- }
- }
- } else if (fileTransfer) {
- // TODO implement dropping of files
- } else if (data instanceof String) {
- String text = (String) data;
- AbstractTask task = createTaskFromUrl(text);
- if (task == null) {
- task = TasksUiInternal.createNewLocalTask(text);
- }
- if (task != null) {
- tasksToMove.add(task);
- final ITask newTask = task;
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiUtil.openTask(newTask);
- }
- });
- }
- }
-
- Object currentTarget = getCurrentTarget();
- if (currentTarget instanceof LocalTask && areAllLocalTasks(tasksToMove) && getCurrentLocation() == LOCATION_ON) {
- for (ITask task : tasksToMove) {
- if (!((AbstractTask) task).contains(((LocalTask) currentTarget).getHandleIdentifier())) {
- TasksUiInternal.getTaskList().addTask(task, (LocalTask) currentTarget);
- }
- }
- } else {
- for (ITask task : tasksToMove) {
- if (currentTarget instanceof UncategorizedTaskContainer) {
- TasksUiInternal.getTaskList().addTask(task, (UncategorizedTaskContainer) currentTarget);
- } else if (currentTarget instanceof TaskCategory) {
- TasksUiInternal.getTaskList().addTask(task, (TaskCategory) currentTarget);
- } else if (currentTarget instanceof UnmatchedTaskContainer) {
- if (((UnmatchedTaskContainer) currentTarget).getRepositoryUrl().equals(task.getRepositoryUrl())) {
- TasksUiInternal.getTaskList().addTask(task, (AbstractTaskCategory) currentTarget);
- }
- } else if (currentTarget instanceof ITask) {
- ITask targetTask = (ITask) currentTarget;
- AbstractTaskCategory targetCategory = null;
- // TODO: TaskCategory only used what about AbstractTaskCategory descendants?
- ITaskContainer container = TaskCategory.getParentTaskCategory(targetTask);
- if (container instanceof TaskCategory || container instanceof UncategorizedTaskContainer) {
- targetCategory = (AbstractTaskCategory) container;
- } else if (container instanceof UnmatchedTaskContainer) {
- if (((UnmatchedTaskContainer) container).getRepositoryUrl().equals(task.getRepositoryUrl())) {
- targetCategory = (AbstractTaskCategory) container;
- }
- }
- if (targetCategory != null) {
- TasksUiInternal.getTaskList().addTask(task, targetCategory);
- }
- } else if (currentTarget instanceof ScheduledTaskContainer) {
- ScheduledTaskContainer container = (ScheduledTaskContainer) currentTarget;
- if (container instanceof Unscheduled) {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, null);
- } else {
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task,
- container.getDateRange());
- }
- } else if (currentTarget == null) {
- TasksUiInternal.getTaskList().addTask(task, TasksUiPlugin.getTaskList().getDefaultCategory());
- }
- }
- }
-
- if (tasksToMove.size() == 1) {
- getViewer().setSelection(new StructuredSelection(tasksToMove.get(0)));
- }
- return true;
- }
-
- private boolean areAllLocalTasks(List<ITask> tasksToMove) {
- for (ITask task : tasksToMove) {
- if (!(task instanceof LocalTask)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * @param data
- * string containing url and title separated by <quote>\n</quote>
- */
- private AbstractTask createTaskFromUrl(String data) {
- if (!data.startsWith("http://") && !data.startsWith("https://")) { //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- }
-
- String[] urlTransfer = data.split("\n"); //$NON-NLS-1$
- if (urlTransfer.length > 0) {
- String url = urlTransfer[0];
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
- .getConnectorForRepositoryTaskUrl(url);
- if (connector != null) {
- // attempt to find task in task list
- String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(url);
- String taskId = connector.getTaskIdFromTaskUrl(url);
- AbstractTask task = TasksUiInternal.getTask(repositoryUrl, taskId, url);
- if (task != null) {
- return task;
- }
- if (repositoryUrl != null && taskId != null) {
- // attempt to open task in background
- // TODO: consider attaching a listener to OpenRepsitoryTaskJob to move task to drop target
- TasksUiInternal.openRepositoryTask(connector.getConnectorKind(), repositoryUrl, taskId);
- }
- } else {
- // create local task, using title of web page as a summary
- final String summary = Messages.TaskListDropAdapter__retrieving_from_URL_;
- final LocalTask newTask = TasksUiInternal.createNewLocalTask(summary);
- newTask.setUrl(url);
- AbstractRetrieveTitleFromUrlJob job = new AbstractRetrieveTitleFromUrlJob(url) {
- @Override
- protected void titleRetrieved(final String pageTitle) {
- // make sure summary was not changed in the mean time
- if (newTask.getSummary().equals(summary)) {
- newTask.setSummary(pageTitle);
- TasksUiInternal.getTaskList().notifyElementChanged(newTask);
- }
- }
- };
- job.schedule();
- return newTask;
- }
- }
- return null;
- }
-
- @Override
- public boolean validateDrop(Object targetObject, int operation, TransferData transferType) {
- fileTransfer = false;
- localTransfer = false;
- if (FileTransfer.getInstance().isSupportedType(transferType)) {
- fileTransfer = true;
- // TODO handle all files
- return false;
- } else if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
- localTransfer = true;
- if (getCurrentTarget() instanceof UncategorizedTaskContainer || getCurrentTarget() instanceof TaskCategory
- || getCurrentTarget() instanceof UnmatchedTaskContainer
- || getCurrentTarget() instanceof ScheduledTaskContainer) {
- return true;
- } else if (getCurrentTarget() instanceof ITaskContainer
- && (getCurrentLocation() == ViewerDropAdapter.LOCATION_AFTER || getCurrentLocation() == ViewerDropAdapter.LOCATION_BEFORE)) {
- return true;
- } else if (getCurrentTarget() instanceof LocalTask && getCurrentLocation() == ViewerDropAdapter.LOCATION_ON) {
- return true;
- } else {
- return false;
- }
- } else if (PlatformUtil.getUrlTransfer().isSupportedType(transferType)) {
- return true;
- }
-
- return TextTransfer.getInstance().isSupportedType(transferType);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
deleted file mode 100644
index e721c0016..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.layout.TreeColumnLayout;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractFilteredTree;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor;
-import org.eclipse.mylyn.internal.tasks.ui.TaskHistoryDropDown;
-import org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink;
-import org.eclipse.mylyn.internal.tasks.ui.TaskSearchPage;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ActivateTaskDialogAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenTaskListElementAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskDeactivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskWorkingSetAction;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskListChangeAdapter;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskActivityAdapter;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.search.internal.ui.SearchDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PatternFilter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.internal.ObjectActionContributorManager;
-
-/**
- * @author Mik Kersten
- * @author Leo Dos Santos - Task Working Set UI
- */
-public class TaskListFilteredTree extends AbstractFilteredTree {
-
- public static final String LABEL_SEARCH = Messages.TaskListFilteredTree_Search_repository_for_key_or_summary_;
-
- private TaskHyperlink workingSetLink;
-
- private TaskHyperlink activeTaskLink;
-
- private WorkweekProgressBar taskProgressBar;
-
- private int totalTasks;
-
- private int completeTime;
-
- private int completeTasks;
-
- private int incompleteTime;
-
- private IWorkingSet currentWorkingSet;
-
- private MenuManager activeTaskMenuManager = null;
-
- private Menu activeTaskMenu = null;
-
- private final CopyTaskDetailsAction copyTaskDetailsAction = new CopyTaskDetailsAction();
-
- private TaskListToolTip taskListToolTip;
-
- private ITaskListChangeListener changeListener;
-
- public TaskListFilteredTree(Composite parent, int treeStyle, PatternFilter filter) {
- super(parent, treeStyle, filter);
- hookContextMenu();
- }
-
- @Override
- public void dispose() {
- if (changeListener != null) {
- TasksUiInternal.getTaskList().removeChangeListener(changeListener);
- }
- super.dispose();
- taskListToolTip.dispose();
- }
-
- private void hookContextMenu() {
- activeTaskMenuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- activeTaskMenuManager.setRemoveAllWhenShown(true);
- activeTaskMenuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager, TasksUi.getTaskActivityManager().getActiveTask());
- }
- });
- }
-
- @Override
- protected TreeViewer doCreateTreeViewer(Composite parent, int style) {
- // Use a single Composite for the Tree to being able to use the
- // TreeColumnLayout. See Bug 177891 for more details.
- Composite container = new Composite(parent, SWT.None);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.verticalIndent = 0;
- gridData.horizontalIndent = 0;
- container.setLayoutData(gridData);
- container.setLayout(new TreeColumnLayout());
- return super.doCreateTreeViewer(container, style);
- }
-
- @Override
- protected Composite createProgressComposite(Composite container) {
- Composite progressComposite = new Composite(container, SWT.NONE);
- GridLayout progressLayout = new GridLayout(1, false);
- progressLayout.marginWidth = 4;
- progressLayout.marginHeight = 0;
- progressLayout.marginBottom = 0;
- progressLayout.horizontalSpacing = 0;
- progressLayout.verticalSpacing = 0;
- progressComposite.setLayout(progressLayout);
- progressComposite.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1));
-
- taskProgressBar = new WorkweekProgressBar(progressComposite);
- taskProgressBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- updateTaskProgressBar();
-
- TasksUiInternal.getTaskList().addChangeListener(new TaskListChangeAdapter() {
-
- @Override
- public void containersChanged(Set<TaskContainerDelta> containers) {
- for (TaskContainerDelta taskContainerDelta : containers) {
- if (taskContainerDelta.getElement() instanceof ITask) {
- updateTaskProgressBar();
- break;
- }
- }
- }
- });
-
- TasksUiPlugin.getTaskActivityManager().addActivityListener(new TaskActivityAdapter() {
-
- @Override
- public void activityReset() {
- updateTaskProgressBar();
- }
-
- });
-
- return progressComposite;
- }
-
- @Override
- protected Composite createSearchComposite(Composite container) {
- Composite searchComposite = new Composite(container, SWT.NONE);
- GridLayout searchLayout = new GridLayout(1, false);
- searchLayout.marginWidth = 8;
- searchLayout.marginHeight = 0;
- searchLayout.marginBottom = 0;
- searchLayout.horizontalSpacing = 0;
- searchLayout.verticalSpacing = 0;
- searchComposite.setLayout(searchLayout);
- searchComposite.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1));
-
- final TaskHyperlink searchLink = new TaskHyperlink(searchComposite, SWT.LEFT);
- searchLink.setText(LABEL_SEARCH);
-
- searchLink.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- new SearchDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), TaskSearchPage.ID).open();
- }
-
- public void linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- searchLink.setUnderlined(true);
- }
-
- public void linkExited(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- searchLink.setUnderlined(false);
- }
- });
-
- return searchComposite;
- }
-
- private void updateTaskProgressBar() {
- if (taskProgressBar.isDisposed()) {
- return;
- }
-
- Set<ITask> tasksThisWeek = TasksUiPlugin.getTaskActivityManager().getScheduledForADayThisWeek();
-
- totalTasks = tasksThisWeek.size();
- completeTime = 0;
- completeTasks = 0;
- incompleteTime = 0;
- for (ITask task : tasksThisWeek) {
- if (task instanceof AbstractTask) {
- AbstractTask abstractTask = (AbstractTask) task;
- if (task.isCompleted()) {
- completeTasks++;
- if (abstractTask.getEstimatedTimeHours() > 0) {
- completeTime += abstractTask.getEstimatedTimeHours();
- } else {
- completeTime++;
- }
- } else {
- if (abstractTask.getEstimatedTimeHours() > 0) {
- incompleteTime += abstractTask.getEstimatedTimeHours();
- } else {
- incompleteTime++;
- }
- }
- }
- }
-
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (PlatformUI.isWorkbenchRunning() && !taskProgressBar.isDisposed()) {
- taskProgressBar.reset(completeTime, (completeTime + incompleteTime));
-
- taskProgressBar.setToolTipText(Messages.TaskListFilteredTree_Workweek_Progress
- + "\n" //$NON-NLS-1$
- + MessageFormat.format(Messages.TaskListFilteredTree_Estimated_hours, completeTime,
- completeTime + incompleteTime)
- + "\n" //$NON-NLS-1$
- + MessageFormat.format(Messages.TaskListFilteredTree_Scheduled_tasks, completeTasks,
- totalTasks));
- }
- }
- });
- }
-
- @Override
- protected Composite createActiveWorkingSetComposite(Composite container) {
- final ImageHyperlink workingSetButton = new ImageHyperlink(container, SWT.FLAT);
- workingSetButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_RIGHT));
- workingSetButton.setToolTipText(Messages.TaskListFilteredTree_Select_Working_Set);
-
- workingSetLink = new TaskHyperlink(container, SWT.LEFT);
- workingSetLink.setText(TaskWorkingSetAction.LABEL_SETS_NONE);
- workingSetLink.setUnderlined(false);
-
- final TaskWorkingSetAction workingSetAction = new TaskWorkingSetAction();
- workingSetButton.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- workingSetAction.getMenu(workingSetButton).setVisible(true);
- }
-
- public void linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- workingSetButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_DOWN));
- }
-
- public void linkExited(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- workingSetButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_RIGHT));
- }
- });
- indicateActiveTaskWorkingSet();
-
- workingSetLink.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseDown(MouseEvent e) {
- if (currentWorkingSet != null) {
- workingSetAction.run(currentWorkingSet);
- } else {
- workingSetAction.run();
- }
- }
- });
-
- return workingSetLink;
- }
-
- @Override
- protected Composite createActiveTaskComposite(final Composite container) {
- final ImageHyperlink activeTaskButton = new ImageHyperlink(container, SWT.LEFT);// SWT.ARROW | SWT.RIGHT);
- activeTaskButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_RIGHT));
- activeTaskButton.setToolTipText(Messages.TaskListFilteredTree_Select_Active_Task);
-
- activeTaskLink = new TaskHyperlink(container, SWT.LEFT);
-
- changeListener = new TaskListChangeAdapter() {
- @Override
- public void containersChanged(Set<TaskContainerDelta> containers) {
- for (TaskContainerDelta taskContainerDelta : containers) {
- if (taskContainerDelta.getElement() instanceof ITask) {
- final AbstractTask changedTask = (AbstractTask) (taskContainerDelta.getElement());
- if (changedTask.isActive()) {
- if (Platform.isRunning() && PlatformUI.getWorkbench() != null) {
- if (Display.getCurrent() == null) {
- if (PlatformUI.getWorkbench().getDisplay() != null
- && !PlatformUI.getWorkbench().getDisplay().isDisposed()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- indicateActiveTask(changedTask);
- }
- });
- }
- } else {
- indicateActiveTask(changedTask);
- }
- }
- }
- }
- }
- }
- };
- TasksUiInternal.getTaskList().addChangeListener(changeListener);
-
- activeTaskLink.setText(Messages.TaskListFilteredTree_Activate);
- // avoid having the Hyperlink class show a native tooltip when it shortens the text which would overlap with the task list tooltip
- activeTaskLink.setToolTipText(""); //$NON-NLS-1$
-
- taskListToolTip = new TaskListToolTip(activeTaskLink);
-
- ITask activeTask = TasksUi.getTaskActivityManager().getActiveTask();
- if (activeTask != null) {
- indicateActiveTask(activeTask);
- }
-
- activeTaskButton.addHyperlinkListener(new IHyperlinkListener() {
-
- private Menu dropDownMenu;
-
- public void linkActivated(HyperlinkEvent event) {
- if (dropDownMenu != null) {
- dropDownMenu.dispose();
- }
- TaskHistoryDropDown taskHistory = new TaskHistoryDropDown();
- taskHistory.setScopedToWorkingSet(true);
- dropDownMenu = new Menu(activeTaskButton);
- taskHistory.fill(dropDownMenu, 0);
- dropDownMenu.setVisible(true);
- }
-
- public void linkEntered(HyperlinkEvent event) {
- activeTaskButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_DOWN));
- }
-
- public void linkExited(HyperlinkEvent event) {
- activeTaskButton.setImage(CommonImages.getImage(CommonImages.TOOLBAR_ARROW_RIGHT));
- }
- });
-
- activeTaskLink.addMenuDetectListener(new MenuDetectListener() {
- public void menuDetected(MenuDetectEvent e) {
- if (activeTaskMenu != null) {
- activeTaskMenu.dispose();
- }
- activeTaskMenu = activeTaskMenuManager.createContextMenu(container);
- activeTaskMenu.setVisible(true);
- }
- });
-
- activeTaskLink.addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseDown(MouseEvent e) {
- if (e.button == 1) {
- ITask activeTask = (TasksUi.getTaskActivityManager().getActiveTask());
- if (activeTask == null) {
- ActivateTaskDialogAction activateAction = new ActivateTaskDialogAction();
- activateAction.init(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- activateAction.run(null);
- } else {
-// if (TaskListFilteredTree.super.filterText.getText().length() > 0) {
-// TaskListFilteredTree.super.filterText.setText("");
-// TaskListFilteredTree.this.textChanged();
-// }
-// if (TaskListView.getFromActivePerspective().getDrilledIntoCategory() != null) {
-// TaskListView.getFromActivePerspective().goUpToRoot();
-// }
- TasksUiInternal.refreshAndOpenTaskListElement(activeTask);
- }
- }
- }
- });
-
- return activeTaskLink;
- }
-
- @Override
- protected void textChanged() {
- super.textChanged();
- if (getFilterString() != null && !getFilterString().trim().equals("")) { //$NON-NLS-1$
- setShowSearch(true);
- } else {
- setShowSearch(false);
- }
- }
-
- public void indicateActiveTaskWorkingSet() {
- Set<IWorkingSet> activeSets = TaskListView.getActiveWorkingSets();
-
- if (filterComposite.isDisposed() || activeSets == null) {
- return;
- }
-
- if (activeSets.size() == 0) {
- workingSetLink.setText(TaskWorkingSetAction.LABEL_SETS_NONE);
- workingSetLink.setToolTipText(Messages.TaskListFilteredTree_Edit_Task_Working_Sets_);
- currentWorkingSet = null;
- } else if (activeSets.size() > 1) {
- workingSetLink.setText(Messages.TaskListFilteredTree__multiple_);
- workingSetLink.setToolTipText(Messages.TaskListFilteredTree_Edit_Task_Working_Sets_);
- currentWorkingSet = null;
- } else {
- Object[] array = activeSets.toArray();
- IWorkingSet workingSet = (IWorkingSet) array[0];
- workingSetLink.setText(workingSet.getLabel());
- workingSetLink.setToolTipText(Messages.TaskListFilteredTree_Edit_Task_Working_Sets_);
- currentWorkingSet = workingSet;
- }
- filterComposite.layout();
- }
-
- public void indicateActiveTask(ITask task) {
- if (Display.getCurrent() != null) {
-
- if (filterComposite.isDisposed()) {
- return;
- }
-
- activeTaskLink.setTask(task);
-
- filterComposite.layout();
- }
- }
-
- public String getActiveTaskLabelText() {
- return activeTaskLink.getText();
- }
-
- public void indicateNoActiveTask() {
- if (filterComposite.isDisposed()) {
- return;
- }
-
- activeTaskLink.setTask(null);
- activeTaskLink.setText(Messages.TaskListFilteredTree_Activate);
- activeTaskLink.setToolTipText(""); //$NON-NLS-1$
-
- filterComposite.layout();
- }
-
- @Override
- public void setFilterText(String string) {
- if (filterText != null) {
- filterText.setText(string);
- selectAll();
- }
- }
-
- private void fillContextMenu(IMenuManager manager, final ITask activeTask) {
- if (activeTask != null) {
- IStructuredSelection selection = new StructuredSelection(activeTask);
- copyTaskDetailsAction.selectionChanged(selection);
-
- manager.add(new OpenTaskListElementAction(null) {
- @Override
- public void run() {
- TasksUiInternal.refreshAndOpenTaskListElement(activeTask);
- }
- });
-
- if (activeTask.isActive()) {
- manager.add(new TaskDeactivateAction() {
- @Override
- public void run() {
- super.run(activeTask);
- }
- });
- } else {
- manager.add(new TaskActivateAction() {
- @Override
- public void run() {
-// TasksUiPlugin.getTaskListManager().getTaskActivationHistory().addTask(activeTask);
- super.run(activeTask);
- }
- });
- }
-
- manager.add(new Separator());
-
- for (String menuPath : TasksUiPlugin.getDefault().getDynamicMenuMap().keySet()) {
- for (IDynamicSubMenuContributor contributor : TasksUiPlugin.getDefault().getDynamicMenuMap().get(
- menuPath)) {
- if (TaskListView.ID_SEPARATOR_TASKS.equals(menuPath)) {
- List<IRepositoryElement> selectedElements = new ArrayList<IRepositoryElement>();
- selectedElements.add(activeTask);
- MenuManager subMenuManager = contributor.getSubMenuManager(selectedElements);
- if (subMenuManager != null) {
- manager.add(subMenuManager);
- }
- }
- }
- }
-
- manager.add(new Separator());
- manager.add(copyTaskDetailsAction);
- manager.add(new Separator());
-
- ObjectActionContributorManager.getManager().contributeObjectActions(null, manager,
- new ISelectionProvider() {
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- // ignore
- }
-
- public ISelection getSelection() {
- return new StructuredSelection(activeTask);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- // ignore
- }
-
- public void setSelection(ISelection selection) {
- // ignore
- }
- });
- }
- }
-
- @Override
- protected String getFilterString() {
- String text = super.getFilterString();
- return (text != null) ? text.trim() : null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
deleted file mode 100644
index be3dbc59a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestFilter.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.Collection;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskScheduleContentProvider.Unscheduled;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * Goal is to have this reuse as much of the super as possible.
- *
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class TaskListInterestFilter extends AbstractTaskListFilter {
-
- @Override
- public boolean select(Object parent, Object child) {
- try {
- if (child instanceof ScheduledTaskContainer) {
- ScheduledTaskContainer dateRangeTaskContainer = (ScheduledTaskContainer) child;
- return isDateRangeInteresting(dateRangeTaskContainer);
- }
- if (child instanceof ITask) {
- AbstractTask task = null;
- if (child instanceof ITask) {
- task = (AbstractTask) child;
- }
- if (task != null) {
- if (isInteresting(parent, task)) {
- return true;
- } else {
- return false;
- }
- }
- } else if (child instanceof ITaskContainer) {
- Collection<ITask> children = ((ITaskContainer) child).getChildren();
- // Always display empty containers
- if (children.size() == 0) {
- return false;
- }
-
- for (ITask task : children) {
- if (shouldAlwaysShow(child, (AbstractTask) task, ITasksCoreConstants.MAX_SUBTASK_DEPTH)) {
- return true;
- }
- }
-
- }
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Interest filter failed", t)); //$NON-NLS-1$
- }
- return false;
- }
-
- private boolean isDateRangeInteresting(ScheduledTaskContainer scheduleContainer) {
- if (scheduleContainer instanceof TaskScheduleContentProvider.Unscheduled) {
- return true;
- }
- if (TaskActivityUtil.getCurrentWeek().isCurrentWeekDay(scheduleContainer.getDateRange())) {
- if (scheduleContainer.isPresent() || scheduleContainer.isFuture()) {
- return true;
- }
- } else if (scheduleContainer.isPresent() /*&& scheduleContainer.isCaptureFloating()*/) {
- return true;
- }
- return false;
- }
-
- // TODO: make meta-context more explicit
- protected boolean isInteresting(Object parent, AbstractTask task) {
- return shouldAlwaysShow(parent, task, ITasksCoreConstants.MAX_SUBTASK_DEPTH);
- }
-
- public boolean shouldAlwaysShow(Object parent, AbstractTask task, int depth) {
-
- return task.isActive() || TasksUiPlugin.getTaskActivityManager().isCompletedToday(task)
- || hasChanges(parent, task)
- || hasInterestingSubTasks(parent, task, depth)
- // note that following condition is wrapped in ()!
- || (!task.isCompleted() && (LocalRepositoryConnector.DEFAULT_SUMMARY.equals(task.getSummary())
- || shouldShowInFocusedWorkweekDateContainer(parent, task)
- || TasksUiPlugin.getTaskActivityManager().isOverdue(task) || isInterestingForThisWeek(parent,
- task)));
- }
-
- private boolean hasInterestingSubTasks(Object parent, AbstractTask task, int depth) {
- if (depth > 0) {
- if (!TasksUiPlugin.getDefault().groupSubtasks(task)) {
- return false;
- }
- if (task.getChildren() != null && task.getChildren().size() > 0) {
- for (ITask subTask : task.getChildren()) {
- if (shouldAlwaysShow(parent, (AbstractTask) subTask, depth - 1)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- private boolean shouldShowInFocusedWorkweekDateContainer(Object parent, ITask task) {
- if (parent instanceof ScheduledTaskContainer) {
-
- ScheduledTaskContainer container = (ScheduledTaskContainer) parent;
-
- if (container instanceof Unscheduled) {
- return false;
- }
-
- if (isDateRangeInteresting(container)) {
- return true;
- }
-
-// if (container.isWeekDay() || container.isPresent()) {
-// return true;
-// }
-//
-//// if (!TasksUiPlugin.getTaskActivityManager().isWeekDay((ScheduledTaskContainer) parent)) {
-//// return false;
-//// }
-// if (TasksUiPlugin.getTaskActivityManager().isOverdue(task)
-// || TasksUiPlugin.getTaskActivityManager().isPastReminder((AbstractTask) task)) {
-// return true;
-// }
-
- }
-
- return false;
- }
-
- public boolean isInterestingForThisWeek(Object parent, AbstractTask task) {
- if (parent instanceof ScheduledTaskContainer) {
- return shouldShowInFocusedWorkweekDateContainer(parent, task);
- } else {
- return TasksUiPlugin.getTaskActivityManager().isPastReminder(task)
- || TasksUiPlugin.getTaskActivityManager().isSheduledForPastWeek(task)
- || TasksUiPlugin.getTaskActivityManager().isScheduledForThisWeek(task)
- || TasksUiPlugin.getTaskActivityManager().isDueThisWeek(task)
- || TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task);
- }
- }
-
- public boolean hasChanges(Object parent, ITask task) {
- if (parent instanceof ScheduledTaskContainer && !(parent instanceof TaskScheduleContentProvider.Unscheduled)) {
- if (!shouldShowInFocusedWorkweekDateContainer(parent, task)) {
- return false;
- }
- }
- return hasChangesHelper(parent, task);
- }
-
- private boolean hasChangesHelper(Object parent, ITask task) {
- if (task.getSynchronizationState().isOutgoing()) {
- return true;
- } else if (task.getSynchronizationState().isIncoming()) {
- return true;
- }
- if (task instanceof ITaskContainer) {
- for (ITask child : ((ITaskContainer) task).getChildren()) {
- if (hasChangesHelper(parent, child)) {
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestSorter.java
deleted file mode 100644
index 99295bc0e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListInterestSorter.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * @author Mik Kersten
- */
-public class TaskListInterestSorter extends ViewerSorter {
-
- private final TaskKeyComparator taskKeyComparator = new TaskKeyComparator();
-
- @Override
- public int compare(Viewer compareViewer, Object o1, Object o2) {
-
- if (o1 instanceof ITaskContainer && o2 instanceof UnmatchedTaskContainer) {
- return -1;
- } else if (o2 instanceof ITaskContainer && o1 instanceof UnmatchedTaskContainer) {
- return 1;
- }
- if (o1 instanceof ScheduledTaskContainer && o2 instanceof ScheduledTaskContainer) {
- ScheduledTaskContainer dateRangeTaskContainer1 = (ScheduledTaskContainer) o1;
- ScheduledTaskContainer dateRangeTaskContainer2 = (ScheduledTaskContainer) o2;
- return dateRangeTaskContainer1.getDateRange().compareTo(dateRangeTaskContainer2.getDateRange());
- } else if (o1 instanceof ITaskContainer && o2 instanceof ScheduledTaskContainer) {
- return -1;
- } else if (o1 instanceof ScheduledTaskContainer && o2 instanceof ITaskContainer) {
- return 1;
- }
-
- if (o1 instanceof UncategorizedTaskContainer && o2 instanceof ITaskContainer) {
- return -1;
- } else if (o1 instanceof ITaskContainer && o2 instanceof UncategorizedTaskContainer) {
- return 1;
- }
-
- if (!(o1 instanceof ITask) && o2 instanceof ITask) {
- return 1;
- }
-
- if (!(o1 instanceof ITask)) {//o1 instanceof AbstractTaskContainer || o1 instanceof AbstractRepositoryQuery) {
- if (!(o2 instanceof ITask)) {//o2 instanceof AbstractTaskContainer || o2 instanceof AbstractRepositoryQuery) {
- return ((IRepositoryElement) o1).getSummary().compareToIgnoreCase(
- ((IRepositoryElement) o2).getSummary());
- } else {
- return -1;
- }
- } else if (o1 instanceof ITaskContainer) {
- if (!(o2 instanceof ITask)) {//o2 instanceof AbstractTaskContainer || o2 instanceof AbstractRepositoryQuery) {
- return -1;
- } else if (o2 instanceof ITaskContainer) {
- IRepositoryElement element1 = (IRepositoryElement) o1;
- IRepositoryElement element2 = (IRepositoryElement) o2;
-
- AbstractTask task1 = null;
- AbstractTask task2 = null;
- if (element1 instanceof ITask) {
- task1 = (AbstractTask) element1;
- }
- if (element2 instanceof ITask) {
- task2 = (AbstractTask) element2;
- }
-
- if (task1 == null && task2 == null) {
- return comparePrioritiesAndKeys(element1, element2);
- } else if (task1 == null) {
- return 1;
- } else if (task2 == null) {
- return -1;
- }
-
- int complete = compareCompleted(task1, task2);
- if (complete != 0) {
- return complete;
- } else {
- int due = compareDueDates(task1, task2);
- if (due != 0) {
- return due;
- } else {
- int today = compareScheduledDate(task1, task2);
- if (today == 0) {
- return comparePrioritiesAndKeys(element1, element2);
- } else {
- return today;
- }
- }
- }
- }
- }
- return 0;
- }
-
- private int compareDueDates(ITask task1, ITask task2) {
- if (TasksUiPlugin.getTaskActivityManager().isOverdue(task1)
- && !TasksUiPlugin.getTaskActivityManager().isOverdue(task2)) {
- return -1;
- } else if (!TasksUiPlugin.getTaskActivityManager().isOverdue(task1)
- && TasksUiPlugin.getTaskActivityManager().isOverdue(task2)) {
- return 1;
- }
- return 0;
- }
-
- private int compareScheduledDate(AbstractTask task1, AbstractTask task2) {
- if (isToday(task1) && !isToday(task2)) {
- return -1;
- } else if (!isToday(task1) && isToday(task2)) {
- return 1;
- } else {
- return 0;
- }
- }
-
- private boolean isToday(AbstractTask task) {
- return TasksUiPlugin.getTaskActivityManager().isPastReminder(task)
- || TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task);
- }
-
- private int compareCompleted(ITask task1, ITask task2) {
- if (task1.isCompleted() && !task2.isCompleted()) {
- return 1;
- } else if (!task1.isCompleted() && task2.isCompleted()) {
- return -1;
- } else {
- return 0;
- }
- }
-
- private int comparePrioritiesAndKeys(IRepositoryElement element1, IRepositoryElement element2) {
- int priority = comparePriorities(element1, element2);
- if (priority != 0) {
- return priority;
- }
-
- int description = compareKeys(element1, element2);
- if (description != 0) {
- return description;
- }
- return 0;
- }
-
- private int compareKeys(IRepositoryElement element1, IRepositoryElement element2) {
- return taskKeyComparator.compare(TaskComparator.getSortableFromElement(element1),
- TaskComparator.getSortableFromElement(element2));
- }
-
- private int comparePriorities(IRepositoryElement element1, IRepositoryElement element2) {
- if (element1 instanceof AbstractTaskContainer && element2 instanceof AbstractTaskContainer) {
- return ((AbstractTaskContainer) element1).getPriority().compareTo(
- ((AbstractTaskContainer) element2).getPriority());
- } else {
- // TODO: consider implementing
- return -1;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java
deleted file mode 100644
index 777beb21f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListSorter.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskGroup;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Mik Kersten
- */
-public class TaskListSorter extends ViewerSorter {
-
- public static final int DEFAULT_SORT_DIRECTION = 1;
-
- private int sortDirectionRootElement;
-
- private final TaskComparator taskComparator;
-
- public TaskListSorter() {
- this.sortDirectionRootElement = DEFAULT_SORT_DIRECTION;
- this.taskComparator = new TaskComparator();
- }
-
- /**
- * compare - invoked when column is selected calls the actual comparison method for particular criteria
- */
- @Override
- public int compare(Viewer compareViewer, Object o1, Object o2) {
- if (o1 instanceof AbstractTask && o2 instanceof AbstractTask) {
- // sort of the tasks within the container using the setting from the Sortdialog
- ITask element1 = (ITask) o1;
- ITask element2 = (ITask) o2;
- return compareElements(element1, element2);
- } else if (o1 instanceof ScheduledTaskContainer && o2 instanceof ScheduledTaskContainer) {
- // scheduled Mode compare
- ScheduledTaskContainer dateRangeTaskContainer1 = (ScheduledTaskContainer) o1;
- ScheduledTaskContainer dateRangeTaskContainer2 = (ScheduledTaskContainer) o2;
- return dateRangeTaskContainer1.getDateRange().compareTo(dateRangeTaskContainer2.getDateRange());
- } else {
- int o1Type;
- if (o1 instanceof AbstractTask) {
- o1Type = 0;
- } else if (o1 instanceof UncategorizedTaskContainer) {
- o1Type = 1;
- } else if (o1 instanceof UnsubmittedTaskContainer) {
- o1Type = 2;
- } else if (o1 instanceof TaskCategory) {
- o1Type = 3;
- } else if (o1 instanceof RepositoryQuery) {
- o1Type = 4;
- } else if (o1 instanceof TaskGroup) { // support for the experimental grouping of tasks
- o1Type = 5;
- } else if (o1 instanceof UnmatchedTaskContainer) {
- o1Type = 6;
- } else {
- o1Type = 99;
- }
- int o2Type;
- if (o2 instanceof AbstractTask) {
- o2Type = 0;
- } else if (o2 instanceof UncategorizedTaskContainer) {
- o2Type = 1;
- } else if (o2 instanceof UnsubmittedTaskContainer) {
- o2Type = 2;
- } else if (o2 instanceof TaskCategory) {
- o2Type = 3;
- } else if (o2 instanceof RepositoryQuery) {
- o2Type = 4;
- } else if (o2 instanceof TaskGroup) { // support for the experimental grouping of tasks
- o2Type = 5;
- } else if (o2 instanceof UnmatchedTaskContainer) {
- o2Type = 6;
- } else {
- o2Type = 99;
- }
- if (o1Type != o2Type) {
- return o1Type - o2Type < 0 ? -1 : 1;
- }
- if (o1Type < 7) {
- AbstractTaskContainer taskContainer1 = (AbstractTaskContainer) o1;
- AbstractTaskContainer taskContainer2 = (AbstractTaskContainer) o2;
-
- return this.sortDirectionRootElement
- * taskContainer1.getSummary().compareToIgnoreCase(taskContainer2.getSummary());
- }
- }
- return 0;
- }
-
- private int compareElements(ITask element1, ITask element2) {
- return taskComparator.compare(element1, element2);
- }
-
- @Override
- public TaskComparator getComparator() {
- return taskComparator;
- }
-
- public int getSortDirectionRootElement() {
- return sortDirectionRootElement;
- }
-
- public void setSortDirectionRootElement(int sortDirection) {
- this.sortDirectionRootElement = sortDirection;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java
deleted file mode 100644
index 96a870cc6..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTip.java
+++ /dev/null
@@ -1,644 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.window.ToolTip;
-import org.eclipse.mylyn.commons.core.DateUtil;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.ScalingHyperlink;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.DateRange;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskDataDiff;
-import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotifier;
-import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @author Mik Kersten
- * @author Eric Booth
- * @author Leo Dos Santos - multi-monitor support
- * @author Steffen Pingel
- */
-public class TaskListToolTip extends ToolTip {
-
- private final static int MAX_TEXT_WIDTH = 300;
-
- private final static int MAX_WIDTH = 600;
-
- private final static int X_SHIFT = PlatformUtil.getToolTipXShift();
-
- private final static int Y_SHIFT = 1;
-
- private IRepositoryElement currentTipElement;
-
- private final List<TaskListToolTipListener> listeners = new ArrayList<TaskListToolTipListener>();
-
- private boolean visible;
-
- private boolean triggeredByMouse;
-
- private final Control control;
-
- public TaskListToolTip(Control control) {
- super(control);
-
- this.control = control;
- setShift(new Point(1, 1));
- }
-
- public void dispose() {
- hide();
- }
-
- @Override
- protected void afterHideToolTip(Event event) {
- triggeredByMouse = true;
- visible = false;
- for (TaskListToolTipListener listener : listeners.toArray(new TaskListToolTipListener[0])) {
- listener.toolTipHidden(event);
- }
- }
-
- public void addTaskListToolTipListener(TaskListToolTipListener listener) {
- listeners.add(listener);
- }
-
- public void removeTaskListToolTipListener(TaskListToolTipListener listener) {
- listeners.remove(listener);
- }
-
- private IRepositoryElement getTaskListElement(Object hoverObject) {
- if (hoverObject instanceof ScalingHyperlink) {
- TaskHyperlink hyperlink = (TaskHyperlink) hoverObject;
- return hyperlink.getTask();
- } else if (hoverObject instanceof Widget) {
- Object data = ((Widget) hoverObject).getData();
- if (data != null) {
- if (data instanceof ITaskContainer) {
- return (IRepositoryElement) data;
- } else if (data instanceof IAdaptable) {
- return (IRepositoryElement) ((IAdaptable) data).getAdapter(AbstractTaskContainer.class);
- }
- }
- }
- return null;
- }
-
- private String getTitleText(IRepositoryElement element) {
- if (element instanceof ScheduledTaskContainer) {
- StringBuilder sb = new StringBuilder();
- sb.append(element.getSummary());
- Calendar start = ((ScheduledTaskContainer) element).getDateRange().getStartDate();
- sb.append(" ["); //$NON-NLS-1$
- sb.append(DateFormat.getDateInstance(DateFormat.LONG).format(start.getTime()));
- sb.append("]"); //$NON-NLS-1$
- return sb.toString();
- } else if (element instanceof IRepositoryQuery) {
- IRepositoryQuery query = (IRepositoryQuery) element;
- StringBuilder sb = new StringBuilder();
- sb.append(element.getSummary());
- sb.append(" ["); //$NON-NLS-1$
- sb.append(getRepositoryLabel(query.getConnectorKind(), query.getRepositoryUrl()));
- sb.append("]"); //$NON-NLS-1$
- return sb.toString();
- } else {
- return new TaskElementLabelProvider(false).getText(element);
- }
- }
-
- private String getDetailsText(IRepositoryElement element) {
- if (element instanceof ScheduledTaskContainer) {
- ScheduledTaskContainer container = (ScheduledTaskContainer) element;
- int estimateTotal = 0;
- long elapsedTotal = 0;
- for (ITask child : container.getChildren()) {
- if (child instanceof AbstractTask) {
- estimateTotal += ((AbstractTask) child).getEstimatedTimeHours();
- elapsedTotal += TasksUiPlugin.getTaskActivityManager().getElapsedTime(child,
- container.getDateRange());
- }
- }
- StringBuilder sb = new StringBuilder();
- sb.append(NLS.bind(Messages.TaskListToolTip_Estimate, estimateTotal));
- sb.append("\n"); //$NON-NLS-1$
- sb.append(NLS.bind(Messages.TaskListToolTip_Elapsed, DateUtil.getFormattedDurationShort(elapsedTotal)));
- sb.append("\n"); //$NON-NLS-1$
- return sb.toString();
- } else if (element instanceof ITask) {
- ITask task = (ITask) element;
- StringBuilder sb = new StringBuilder();
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(task.getConnectorKind());
- String kindLabel = null;
- if (connectorUi != null) {
- kindLabel = connectorUi.getTaskKindLabel(task);
- sb.append(kindLabel);
- }
- String key = task.getTaskKey();
- if (key != null) {
- sb.append(" "); //$NON-NLS-1$
- sb.append(key);
- }
- String taskKind = task.getTaskKind();
- if (taskKind != null && taskKind.length() > 0 && !taskKind.equals(kindLabel)) {
- sb.append(" ("); //$NON-NLS-1$
- sb.append(taskKind);
- sb.append(") "); //$NON-NLS-1$
- }
- sb.append(", "); //$NON-NLS-1$
- sb.append(task.getPriority());
- sb.append(" ["); //$NON-NLS-1$
- sb.append(getRepositoryLabel(task.getConnectorKind(), task.getRepositoryUrl()));
- sb.append("]"); //$NON-NLS-1$
- sb.append("\n"); //$NON-NLS-1$
- return sb.toString();
- } else {
- return null;
- }
- }
-
- private String getRepositoryLabel(String repositoryKind, String repositoryUrl) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(repositoryKind, repositoryUrl);
- if (repository != null) {
- String label = repository.getRepositoryLabel();
- if (label.indexOf("//") != -1) { //$NON-NLS-1$
- return label.substring((repository.getRepositoryUrl().indexOf("//") + 2)); //$NON-NLS-1$
- }
- return label;
- }
- return ""; //$NON-NLS-1$
- }
-
- private String getActivityText(IRepositoryElement element) {
-// if (element instanceof ScheduledTaskDelegate) {
-// ScheduledTaskDelegate task = (ScheduledTaskDelegate) element;
-//
-// StringBuilder sb = new StringBuilder();
-// Date date = task.getScheduledForDate();
-// if (date != null) {
-// sb.append("Scheduled for: ");
-// sb.append(new SimpleDateFormat("E").format(date)).append(", ");
-// sb.append(DateFormat.getDateInstance(DateFormat.LONG).format(date));
-// sb.append(" (").append(DateFormat.getTimeInstance(DateFormat.SHORT).format(date)).append(")\n");
-// }
-//
-// long elapsed = TasksUiPlugin.getTaskActivityManager().getElapsedTime(task.getCorrespondingTask(),
-// task.getDateRangeContainer().getStart(), task.getDateRangeContainer().getEnd());
-// String elapsedTimeString = DateUtil.getFormattedDurationShort(elapsed);
-// sb.append("Elapsed: ");
-// sb.append(elapsedTimeString);
-// sb.append("\n");
-//
-// return sb.toString();
-// } else
-//
- if (element instanceof ITask) {
- AbstractTask task = (AbstractTask) element;
-
- StringBuilder sb = new StringBuilder();
-
- Date dueDate = task.getDueDate();
- if (dueDate != null) {
- sb.append(NLS.bind(Messages.TaskListToolTip_Due, new Object[] {
- new SimpleDateFormat("E").format(dueDate), //$NON-NLS-1$
- DateFormat.getDateInstance(DateFormat.LONG).format(dueDate),
- DateFormat.getTimeInstance(DateFormat.SHORT).format(dueDate) }));
- sb.append("\n"); //$NON-NLS-1$
- }
-
- DateRange scheduledDate = task.getScheduledForDate();
- if (scheduledDate != null) {
- sb.append(NLS.bind(Messages.TaskListToolTip_Scheduled, scheduledDate.toString()));
- sb.append("\n"); //$NON-NLS-1$
- }
-
- long elapsed = TasksUiPlugin.getTaskActivityManager().getElapsedTime(task);
- sb.append(NLS.bind(Messages.TaskListToolTip_Elapsed, DateUtil.getFormattedDurationShort(elapsed)));
- sb.append("\n"); //$NON-NLS-1$
-
- return sb.toString();
- }
- return null;
- }
-
- private String getIncommingText(IRepositoryElement element) {
- if (element instanceof ITask) {
- ITask task = (ITask) element;
- if (task.getSynchronizationState().isIncoming()) {
- String text = null;
- TaskListNotifier notifier = new TaskListNotifier(TasksUiPlugin.getRepositoryModel(),
- TasksUiPlugin.getTaskDataManager());
- TaskDataDiff diff = notifier.getDiff(task);
- if (diff != null) {
- text = diff.toString(MAX_TEXT_WIDTH);
- }
- if (text != null && text.length() > 0) {
- return text;
- }
- }
- }
- return null;
- }
-
- private String getStatusText(IRepositoryElement element) {
- IStatus status = null;
- if (element instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) element;
- status = task.getStatus();
- } else if (element instanceof IRepositoryQuery) {
- RepositoryQuery query = (RepositoryQuery) element;
- status = query.getStatus();
- }
-
- if (status != null) {
- StringBuilder sb = new StringBuilder();
- sb.append(status.getMessage());
- if (status instanceof RepositoryStatus && ((RepositoryStatus) status).isHtmlMessage()) {
- sb.append(Messages.TaskListToolTip_Please_synchronize_manually_for_full_error_message);
- }
- return sb.toString();
- }
-
- return null;
- }
-
- @Override
- public Point getLocation(Point tipSize, Event event) {
- Widget widget = getTipWidget(event);
- if (widget != null) {
- Rectangle bounds = getBounds(widget);
- if (bounds != null) {
- return control.toDisplay(bounds.x + X_SHIFT, bounds.y + bounds.height + Y_SHIFT);
- }
- }
- return super.getLocation(tipSize, event);//control.toDisplay(event.x + xShift, event.y + yShift);
- }
-
- private ProgressData getProgressData(IRepositoryElement element) {
- if (element instanceof ITaskContainer) {
- Object[] children = new Object[0];
-
- children = ((ITaskContainer) element).getChildren().toArray();
-
- int total = children.length;
- if (total > 0) {
- int completed = 0;
- for (ITask task : ((ITaskContainer) element).getChildren()) {
- if (task.isCompleted()) {
- completed++;
- }
- }
- String text = NLS.bind(Messages.TaskListToolTip_Total_Complete_Incomplete, new Object[] { //
- total, completed, (total - completed) });
- return new ProgressData(completed, total, text);
- }
- }
- return null;
- }
-
- private Image getImage(IRepositoryElement element) {
- if (element instanceof IRepositoryQuery) {
- IRepositoryQuery query = (IRepositoryQuery) element;
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- query.getConnectorKind());
- if (connector != null) {
- return TasksUiPlugin.getDefault().getBrandingIcon(connector.getConnectorKind());
- }
- } else if (element instanceof ITask) {
- ITask repositoryTask = (ITask) element;
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repositoryTask.getConnectorKind());
- if (connector != null) {
- return TasksUiPlugin.getDefault().getBrandingIcon(connector.getConnectorKind());
- }
- } else if (element instanceof ScheduledTaskContainer) {
- return CommonImages.getImage(CommonImages.CALENDAR);
- }
- return null;
- }
-
- protected Widget getTipWidget(Event event) {
- Point widgetPosition = new Point(event.x, event.y);
- Widget widget = event.widget;
- if (widget instanceof ToolBar) {
- ToolBar w = (ToolBar) widget;
- return w.getItem(widgetPosition);
- }
- if (widget instanceof Table) {
- Table w = (Table) widget;
- return w.getItem(widgetPosition);
- }
- if (widget instanceof Tree) {
- Tree w = (Tree) widget;
- return w.getItem(widgetPosition);
- }
-
- return widget;
- }
-
- private Rectangle getBounds(Widget widget) {
- if (widget instanceof ToolItem) {
- ToolItem w = (ToolItem) widget;
- return w.getBounds();
- }
- if (widget instanceof TableItem) {
- TableItem w = (TableItem) widget;
- return w.getBounds();
- }
- if (widget instanceof TreeItem) {
- TreeItem w = (TreeItem) widget;
- return w.getBounds();
- }
- return null;
- }
-
- @Override
- protected boolean shouldCreateToolTip(Event event) {
- currentTipElement = null;
-
- if (super.shouldCreateToolTip(event)) {
- Widget tipWidget = getTipWidget(event);
- if (tipWidget != null) {
- Rectangle bounds = getBounds(tipWidget);
- if (tipWidget instanceof ScalingHyperlink) {
- currentTipElement = getTaskListElement(tipWidget);
- } else if (bounds != null && control.getBounds().contains(bounds.x, bounds.y)) {
- currentTipElement = getTaskListElement(tipWidget);
- }
- }
- }
-
- if (currentTipElement == null) {
- hide();
- return false;
- } else {
- return true;
- }
- }
-
- @Override
- protected Composite createToolTipContentArea(Event event, Composite parent) {
- assert currentTipElement != null;
-
- Composite composite = createToolTipContentAreaComposite(parent);
-
- addIconAndLabel(composite, getImage(currentTipElement), getTitleText(currentTipElement));
-
- String detailsText = getDetailsText(currentTipElement);
- if (detailsText != null) {
- addIconAndLabel(composite, null, detailsText);
- }
-
- String synchText = getSynchText(currentTipElement);
- if (synchText != null) {
- addIconAndLabel(composite, CommonImages.getImage(TasksUiImages.REPOSITORY_SYNCHRONIZE), synchText);
- }
-
- String activityText = getActivityText(currentTipElement);
- if (activityText != null) {
- addIconAndLabel(composite, CommonImages.getImage(CommonImages.CALENDAR), activityText);
- }
-
- String incommingText = getIncommingText(currentTipElement);
- if (incommingText != null) {
- Image image = CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING);
- if (currentTipElement instanceof ITask) {
- ITask task = (ITask) currentTipElement;
- if (task.getSynchronizationState() == SynchronizationState.INCOMING_NEW) {
- image = CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW);
- } else if (task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
- image = CommonImages.getImage(CommonImages.OVERLAY_SYNC_OUTGOING_NEW);
- }
- }
- addIconAndLabel(composite, image, incommingText);
- }
-
- ProgressData progress = getProgressData(currentTipElement);
- if (progress != null) {
- addIconAndLabel(composite, null, progress.text);
-
- // label height need to be set to 0 to remove gap below the progress bar
- Label label = new Label(composite, SWT.NONE);
- GridData labelGridData = new GridData(SWT.FILL, SWT.TOP, true, false);
- labelGridData.heightHint = 0;
- label.setLayoutData(labelGridData);
-
- Composite progressComposite = new Composite(composite, SWT.NONE);
- GridLayout progressLayout = new GridLayout(1, false);
- progressLayout.marginWidth = 0;
- progressLayout.marginHeight = 0;
- progressComposite.setLayout(progressLayout);
- progressComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- WorkweekProgressBar taskProgressBar = new WorkweekProgressBar(progressComposite);
- taskProgressBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- taskProgressBar.reset(progress.completed, progress.total);
-
- // do we really need custom canvas? code below renders the same
-// IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
-// Color color = themeManager.getCurrentTheme().getColorRegistry().get(
-// TaskListColorsAndFonts.THEME_COLOR_TASK_TODAY_COMPLETED);
-// ProgressBar bar = new ProgressBar(tipShell, SWT.SMOOTH);
-// bar.setForeground(color);
-// bar.setSelection((int) (100d * progress.completed / progress.total));
-// GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
-// gridData.heightHint = 5;
-// bar.setLayoutData(gridData);
- }
-
- String statusText = getStatusText(currentTipElement);
- if (statusText != null) {
- addIconAndLabel(composite, CommonImages.getImage(CommonImages.WARNING), statusText);
- }
-
- String helpText = getHelpText(currentTipElement);
- if (helpText != null) {
- addIconAndLabel(composite, CommonImages.getImage(CommonImages.QUESTION), helpText);
- }
-
- visible = true;
-
- return composite;
- }
-
- private String getHelpText(IRepositoryElement element) {
- if (element instanceof TaskCategory || element instanceof IRepositoryQuery) {
- if (AbstractTaskListFilter.hasDescendantIncoming((ITaskContainer) element)) {
- TaskListView taskListView = TaskListView.getFromActivePerspective();
- if (taskListView != null) {
-
- if (!taskListView.isFocusedMode()
- && TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.FILTER_COMPLETE_MODE)) {
- Object[] children = ((TaskListContentProvider) taskListView.getViewer().getContentProvider()).getChildren(element);
- boolean hasIncoming = false;
- for (Object child : children) {
- if (child instanceof ITask) {
- if (((ITask) child).getSynchronizationState().isIncoming()) {
- hasIncoming = true;
- break;
- }
- }
- }
- if (!hasIncoming) {
- return Messages.TaskListToolTip_Some_incoming_elements_may_be_filtered;
- }
- }
- }
- }
- // if has incoming but no top level children have incoming, suggest incoming tasks may be filtered
- }
- if (element instanceof UncategorizedTaskContainer) {
- return Messages.TaskListToolTip_Automatic_container_for_all_local_tasks;
- } else if (element instanceof UnmatchedTaskContainer) {
- return Messages.TaskListToolTip_Automatic_container_for_repository_tasks;
- }
- return null;
- }
-
- protected Composite createToolTipContentAreaComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- gridLayout.marginWidth = 5;
- gridLayout.marginHeight = 2;
- composite.setLayout(gridLayout);
- composite.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- return composite;
- }
-
- private String getSynchText(IRepositoryElement element) {
- if (element instanceof IRepositoryQuery) {
- String syncStamp = ((RepositoryQuery) element).getLastSynchronizedTimeStamp();
- if (syncStamp != null) {
- return NLS.bind(Messages.TaskListToolTip_Synchronized, syncStamp);
- }
- }
- return null;
- }
-
- private String removeTrailingNewline(String text) {
- if (text.endsWith("\n")) { //$NON-NLS-1$
- return text.substring(0, text.length() - 1);
- }
- return text;
- }
-
- protected void addIconAndLabel(Composite parent, Image image, String text) {
- Label imageLabel = new Label(parent, SWT.NONE);
- imageLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- imageLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- imageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
- imageLabel.setImage(image);
-
- Label textLabel = new Label(parent, SWT.WRAP);
- textLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- textLabel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
- text = removeTrailingNewline(text);
- textLabel.setText(TasksUiInternal.escapeLabelText(text));
- GC gc = new GC(textLabel);
- int width = Math.min(gc.textExtent(text).x, MAX_WIDTH);
- try {
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).hint(width, SWT.DEFAULT).applyTo(textLabel);
- } finally {
- gc.dispose();
- }
- }
-
- private static class ProgressData {
-
- int completed;
-
- int total;
-
- String text;
-
- public ProgressData(int completed, int total, String text) {
- this.completed = completed;
- this.total = total;
- this.text = text;
- }
-
- }
-
- public static interface TaskListToolTipListener {
-
- void toolTipHidden(Event event);
-
- }
-
- public boolean isVisible() {
- return visible;
- }
-
- public boolean isTriggeredByMouse() {
- return triggeredByMouse;
- }
-
- @Override
- public void show(Point location) {
- super.show(location);
- triggeredByMouse = false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
deleted file mode 100644
index 3c0d14680..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ /dev/null
@@ -1,1920 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Ken Sueda - improvements
- * Eugene Kuleshov - improvements
- * Frank Becker - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.layout.TreeColumnLayout;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.mylyn.internal.provisional.commons.ui.DelayedRefreshJob;
-import org.eclipse.mylyn.internal.provisional.commons.ui.SubstringPatternFilter;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.AbstractTaskListFilter;
-import org.eclipse.mylyn.internal.tasks.ui.CategorizedPresentation;
-import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.ScheduledPresentation;
-import org.eclipse.mylyn.internal.tasks.ui.TaskArchiveFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TaskCompletionFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TaskPriorityFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TaskWorkingSetFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CollapseAllAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.CopyTaskDetailsAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.DeleteAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.EditRepositoryPropertiesAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ExpandAllAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.FilterCompletedTasksAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.GoIntoAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.GoUpAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.GroupSubTasksAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.LinkWithEditorAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenTaskListElementAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenTasksUiPreferencesAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.OpenWithBrowserAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.PresentationDropDownSelectionAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.RemoveFromCategoryAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.RenameAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeAutomaticallyAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskDeactivateAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskListSortAction;
-import org.eclipse.mylyn.internal.tasks.ui.commands.CollapseAllHandler;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskListChangeAdapter;
-import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskComparator;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskDragSourceListener;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker;
-import org.eclipse.mylyn.internal.tasks.ui.util.TreeWalker.TreeVisitor;
-import org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetUpdater;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
-import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
-import org.eclipse.mylyn.tasks.core.TaskActivityAdapter;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.RTFTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Region;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Scrollable;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.part.DrillDownAdapter;
-import org.eclipse.ui.part.IShowInTarget;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * @author Mik Kersten
- * @author Ken Sueda
- * @author Eugene Kuleshov
- */
-public class TaskListView extends ViewPart implements IPropertyChangeListener, IShowInTarget {
-
- private final class TaskListRefreshJob extends DelayedRefreshJob {
-
- private TaskListRefreshJob(TreeViewer treeViewer, String name) {
- super(treeViewer, name);
- }
-
- @Override
- protected void doRefresh(Object[] items) {
- TreePath selection = preserveSelection();
-
- if (items == null) {
- viewer.refresh(true);
- } else if (items.length > 0) {
- try {
- if (TaskListView.this.isFocusedMode()) {
- Set<Object> children = new HashSet<Object>(Arrays.asList(items));
- Set<AbstractTaskContainer> parents = new HashSet<AbstractTaskContainer>();
- for (Object item : items) {
- if (item instanceof AbstractTask) {
- parents.addAll(((AbstractTask) item).getParentContainers());
- }
- }
- // 1. refresh parents
- children.removeAll(parents);
- for (AbstractTaskContainer parent : parents) {
- viewer.refresh(parent, false);
- // only refresh label of parent
- viewer.update(parent, null);
- }
- // 2. refresh children
- for (Object item : children) {
- viewer.refresh(item, true);
- }
- // 3. update states of all changed items
- for (Object item : items) {
- updateExpansionState(item);
- }
- } else {
- Set<AbstractTaskContainer> parents = new HashSet<AbstractTaskContainer>();
- for (Object item : items) {
- if (item instanceof AbstractTask) {
- parents.addAll(((AbstractTask) item).getParentContainers());
- }
- viewer.refresh(item, true);
- updateExpansionState(item);
- }
- // refresh labels of parents for task activation or incoming indicators
- for (AbstractTaskContainer parent : parents) {
- // only refresh label
- viewer.update(parent, null);
- }
- }
- } catch (SWTException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to refresh viewer: " //$NON-NLS-1$
- + viewer, e));
- }
- }
-
- updateToolTip(false);
- restoreSelection(selection);
- }
-
- private TreePath preserveSelection() {
- if (viewer instanceof TreeViewer) {
- TreeViewer treeViewer = (TreeViewer) viewer;
- // in case the refresh removes the currently selected item,
- // remember the next item in the tree to restore the selection
- // TODO: consider making this optional
- TreeItem[] selection = treeViewer.getTree().getSelection();
- if (selection.length > 0) {
- TreeWalker treeWalker = new TreeWalker(treeViewer);
- return treeWalker.walk(new TreeVisitor() {
- @Override
- public boolean visit(Object object) {
- return true;
- }
- }, selection[selection.length - 1]);
- }
- }
- return null;
- }
-
- private void restoreSelection(TreePath treePath) {
- if (treePath != null) {
- ISelection newSelection = viewer.getSelection();
- if (newSelection == null || newSelection.isEmpty()) {
- viewer.setSelection(new TreeSelection(treePath), true);
- }
- }
- }
-
- protected void updateExpansionState(Object item) {
- if (TaskListView.this.isFocusedMode() && isAutoExpandMode()) {
- TaskListView.this.getViewer().expandToLevel(item, 3);
- }
- }
- }
-
- // TODO e3.4 replace with SWT.NO_SCROLL constant
- public static final int SWT_NO_SCROLL = 1 << 4;
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.views.tasks"; //$NON-NLS-1$
-
- public static final String LABEL_VIEW = Messages.TaskListView_Task_List;
-
- private static final String MEMENTO_KEY_SORT_DIRECTION = "sortDirection"; //$NON-NLS-1$
-
- private static final String MEMENTO_KEY_ROOT_SORT_DIRECTION = "rootSortDirection"; //$NON-NLS-1$
-
- private static final String MEMENTO_KEY_SORTER = "sorter"; //$NON-NLS-1$
-
- private static final String MEMENTO_KEY_SORTER2 = "sorter2"; //$NON-NLS-1$
-
- private static final String MEMENTO_KEY_SORT_INDEX = "sortIndex"; //$NON-NLS-1$
-
- private static final String MEMENTO_SORT_INDEX = "org.eclipse.mylyn.tasklist.ui.views.tasklist.sortIndex"; //$NON-NLS-1$
-
- private static final String MEMENTO_LINK_WITH_EDITOR = "linkWithEditor"; //$NON-NLS-1$
-
- private static final String MEMENTO_PRESENTATION = "presentation"; //$NON-NLS-1$
-
- private static final String ID_SEPARATOR_NEW = "new"; //$NON-NLS-1$
-
- public static final String ID_SEPARATOR_OPERATIONS = "operations"; //$NON-NLS-1$
-
- public static final String ID_SEPARATOR_CONTEXT = "context"; //$NON-NLS-1$
-
- public static final String ID_SEPARATOR_TASKS = "tasks"; //$NON-NLS-1$
-
- private static final String ID_SEPARATOR_FILTERS = "filters"; //$NON-NLS-1$
-
- private static final String ID_SEPARATOR_REPOSITORY = "repository"; //$NON-NLS-1$
-
- private static final String ID_SEPARATOR_PROPERTIES = "properties"; //$NON-NLS-1$
-
- public static final String ID_SEPARATOR_NAVIGATE = "navigate"; //$NON-NLS-1$
-
- private static final String LABEL_NO_TASKS = "no task active"; //$NON-NLS-1$
-
- private final static int SIZE_MAX_SELECTION_HISTORY = 10;
-
- static final String[] PRIORITY_LEVELS = { PriorityLevel.P1.toString(), PriorityLevel.P2.toString(),
- PriorityLevel.P3.toString(), PriorityLevel.P4.toString(), PriorityLevel.P5.toString() };
-
- public static final String[] PRIORITY_LEVEL_DESCRIPTIONS = { PriorityLevel.P1.getDescription(),
- PriorityLevel.P2.getDescription(), PriorityLevel.P3.getDescription(), PriorityLevel.P4.getDescription(),
- PriorityLevel.P5.getDescription() };
-
- private static List<AbstractTaskListPresentation> presentationsPrimary = new ArrayList<AbstractTaskListPresentation>();
-
- private static List<AbstractTaskListPresentation> presentationsSecondary = new ArrayList<AbstractTaskListPresentation>();
-
- private boolean focusedMode = false;
-
- private boolean linkWithEditor;
-
- private final TaskListCellModifier taskListCellModifier = new TaskListCellModifier(this);
-
- private IThemeManager themeManager;
-
- private TaskListFilteredTree filteredTree;
-
- private DrillDownAdapter drillDownAdapter;
-
- private AbstractTaskContainer drilledIntoCategory = null;
-
- private GoIntoAction goIntoAction;
-
- private GoUpAction goUpAction;
-
- private CopyTaskDetailsAction copyDetailsAction;
-
- private OpenTaskListElementAction openAction;
-
- private OpenWithBrowserAction openWithBrowser;
-
- private RenameAction renameAction;
-
- private CollapseAllAction collapseAll;
-
- private ExpandAllAction expandAll;
-
- private DeleteAction deleteAction;
-
- private RemoveFromCategoryAction removeFromCategoryAction;
-
- private final TaskActivateAction activateAction = new TaskActivateAction();
-
- private final TaskDeactivateAction deactivateAction = new TaskDeactivateAction();
-
- private FilterCompletedTasksAction filterCompleteTask;
-
- private GroupSubTasksAction filterSubTasksAction;
-
- private SynchronizeAutomaticallyAction synchronizeAutomatically;
-
- private OpenTasksUiPreferencesAction openPreferencesAction;
-
- //private FilterArchiveContainerAction filterArchiveCategory;
-
- private PriorityDropDownAction filterOnPriorityAction;
-
- private TaskListSortAction sortDialogAction;
-
- private PresentationDropDownSelectionAction presentationDropDownSelectionAction;
-
- private NewTaskAction newTaskAction;
-
- private LinkWithEditorAction linkWithEditorAction;
-
- private final TaskPriorityFilter filterPriority = new TaskPriorityFilter();
-
- private final TaskCompletionFilter filterComplete = new TaskCompletionFilter();
-
- private final TaskArchiveFilter filterArchive = new TaskArchiveFilter();
-
- private TaskWorkingSetFilter filterWorkingSet;
-
- private final Set<AbstractTaskListFilter> filters = new HashSet<AbstractTaskListFilter>();
-
- protected String[] columnNames = new String[] { Messages.TaskListView_Summary };
-
- protected int[] columnWidths = new int[] { 200 };
-
- private TreeColumn[] columns;
-
- private IMemento taskListMemento;
-
- private AbstractTaskListPresentation currentPresentation;
-
- private TaskTableLabelProvider taskListTableLabelProvider;
-
- private TaskListSorter tableSorter;
-
- private Color categoryGradientStart;
-
- private Color categoryGradientEnd;
-
- private CustomTaskListDecorationDrawer customDrawer;
-
- private final IPageListener PAGE_LISTENER = new IPageListener() {
- public void pageActivated(IWorkbenchPage page) {
- filteredTree.indicateActiveTaskWorkingSet();
- }
-
- public void pageClosed(IWorkbenchPage page) {
- // ignore
-
- }
-
- public void pageOpened(IWorkbenchPage page) {
- // ignore
- }
- };
-
- private final LinkedHashMap<String, IStructuredSelection> lastSelectionByTaskHandle = new LinkedHashMap<String, IStructuredSelection>(
- SIZE_MAX_SELECTION_HISTORY);
-
- /**
- * True if the view should indicate that interaction monitoring is paused
- */
- protected boolean isPaused = false;
-
- boolean synchronizationOverlaid = false;
-
- private final Listener CATEGORY_GRADIENT_DRAWER = new Listener() {
- public void handleEvent(Event event) {
- if (event.item.getData() instanceof ITaskContainer && !(event.item.getData() instanceof ITask)) {
- Scrollable scrollable = (Scrollable) event.widget;
- GC gc = event.gc;
-
- Rectangle area = scrollable.getClientArea();
- Rectangle rect = event.getBounds();
-
- /* Paint the selection beyond the end of last column */
- expandRegion(event, scrollable, gc, area);
-
- /* Draw Gradient Rectangle */
- Color oldForeground = gc.getForeground();
- Color oldBackground = gc.getBackground();
-
- gc.setForeground(categoryGradientEnd);
- gc.drawLine(0, rect.y, area.width, rect.y);
-
- gc.setForeground(categoryGradientStart);
- gc.setBackground(categoryGradientEnd);
-
- // gc.setForeground(categoryGradientStart);
- // gc.setBackground(categoryGradientEnd);
- // gc.setForeground(new Clr(Display.getCurrent(), 255, 0, 0));
-
- gc.fillGradientRectangle(0, rect.y + 1, area.width, rect.height, true);
-
- /* Bottom Line */
- // gc.setForeground();
- gc.setForeground(categoryGradientEnd);
- gc.drawLine(0, rect.y + rect.height - 1, area.width, rect.y + rect.height - 1);
-
- gc.setForeground(oldForeground);
- gc.setBackground(oldBackground);
- /* Mark as Background being handled */
- event.detail &= ~SWT.BACKGROUND;
- }
- }
-
- private void expandRegion(Event event, Scrollable scrollable, GC gc, Rectangle area) {
- int columnCount;
- if (scrollable instanceof Table) {
- columnCount = ((Table) scrollable).getColumnCount();
- } else {
- columnCount = ((Tree) scrollable).getColumnCount();
- }
-
- if (event.index == columnCount - 1 || columnCount == 0) {
- int width = area.x + area.width - event.x;
- if (width > 0) {
- Region region = new Region();
- gc.getClipping(region);
- region.add(event.x, event.y, width, event.height);
- gc.setClipping(region);
- region.dispose();
- }
- }
- }
- };
-
- private boolean gradientListenerAdded = false;
-
- private final ITaskActivityListener TASK_ACTIVITY_LISTENER = new TaskActivityAdapter() {
- @Override
- public void activityReset() {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refreshJob.refresh();
- }
- });
- }
- };
-
- private final ITaskActivationListener TASK_ACTIVATION_LISTENER = new TaskActivationAdapter() {
-
- @Override
- public void taskActivated(final ITask task) {
- if (task != null) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- updateDescription();
- refresh(task);
- selectedAndFocusTask(task);
- filteredTree.indicateActiveTask(task);
- }
- });
- }
- }
-
- @Override
- public void taskDeactivated(final ITask task) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refresh(task);
- updateDescription();
- filteredTree.indicateNoActiveTask();
- }
- });
- }
-
- private void refresh(final ITask task) {
- if (TaskListView.this.isScheduledPresentation()) {
- refreshJob.refresh();
- } else {
- refreshJob.refreshElement(task);
- }
- }
-
- };
-
- private final ITaskListChangeListener TASKLIST_CHANGE_LISTENER = new TaskListChangeAdapter() {
-
- @Override
- public void containersChanged(final Set<TaskContainerDelta> deltas) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- for (TaskContainerDelta taskContainerDelta : deltas) {
- if (ScheduledPresentation.ID.equals(getCurrentPresentation().getId())) {
- // TODO: implement refresh policy for scheduled presentation
- refreshJob.refresh();
- } else {
- switch (taskContainerDelta.getKind()) {
- case ROOT:
- refreshJob.refresh();
- break;
- case ADDED:
- case REMOVED:
- if (taskContainerDelta.getElement() != null) {
- refreshJob.refreshElement(taskContainerDelta.getElement());
- }
- if (taskContainerDelta.getParent() != null) {
- refreshJob.refreshElement(taskContainerDelta.getParent());
- } else {
- // element was added/removed from the root
- refreshJob.refresh();
- }
- break;
- case CONTENT:
- refreshJob.refreshElement(taskContainerDelta.getElement());
- }
-
- }
- }
- }
- });
- }
- };
-
- private final IPropertyChangeListener THEME_CHANGE_LISTENER = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IThemeManager.CHANGE_CURRENT_THEME)
- || CommonThemes.isCommonTheme(event.getProperty())) {
- configureGradientColors();
- taskListTableLabelProvider.setCategoryBackgroundColor(themeManager.getCurrentTheme()
- .getColorRegistry()
- .get(CommonThemes.COLOR_CATEGORY));
- getViewer().refresh();
- }
- }
- };
-
- private TaskListToolTip taskListToolTip;
-
- private void configureGradientColors() {
- categoryGradientStart = themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_CATEGORY_GRADIENT_START);
- categoryGradientEnd = themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_CATEGORY_GRADIENT_END);
-
- boolean customized = true;
- if (categoryGradientStart != null && categoryGradientStart.getRed() == 240
- && categoryGradientStart.getGreen() == 240 && categoryGradientStart.getBlue() == 240
- && categoryGradientEnd != null && categoryGradientEnd.getRed() == 220
- && categoryGradientEnd.getGreen() == 220 && categoryGradientEnd.getBlue() == 220) {
- customized = false;
- }
-
- if (gradientListenerAdded == false && categoryGradientStart != null
- && !categoryGradientStart.equals(categoryGradientEnd)) {
- getViewer().getTree().addListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
- gradientListenerAdded = true;
- if (!customized) {
- // Set parent-based colors
- Color parentBackground = getViewer().getTree().getParent().getBackground();
- double GRADIENT_TOP = 1.05;// 1.02;
- double GRADIENT_BOTTOM = .995;// 1.035;
-
- int red = Math.min(255, (int) (parentBackground.getRed() * GRADIENT_TOP));
- int green = Math.min(255, (int) (parentBackground.getGreen() * GRADIENT_TOP));
- int blue = Math.min(255, (int) (parentBackground.getBlue() * GRADIENT_TOP));
-
- try {
- categoryGradientStart = new Color(Display.getDefault(), red, green, blue);
- } catch (Exception e) {
- categoryGradientStart = getViewer().getTree().getParent().getBackground();
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set color: " + red //$NON-NLS-1$
- + ", " + green + ", " + blue, e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- red = Math.max(0, (int) (parentBackground.getRed() / GRADIENT_BOTTOM));
- green = Math.max(0, (int) (parentBackground.getGreen() / GRADIENT_BOTTOM));
- blue = Math.max(0, (int) (parentBackground.getBlue() / GRADIENT_BOTTOM));
- if (red > 255) {
- red = 255;
- }
- try {
- categoryGradientEnd = new Color(Display.getDefault(), red, green, blue);
- } catch (Exception e) {
- categoryGradientStart = getViewer().getTree().getParent().getBackground();
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set color: " + red //$NON-NLS-1$
- + ", " + green + ", " + blue, e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- } else if (categoryGradientStart != null && categoryGradientStart.equals(categoryGradientEnd)) {
- getViewer().getTree().removeListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
- gradientListenerAdded = false;
- }
- }
-
- public static TaskListView getFromActivePerspective() {
- if (PlatformUI.isWorkbenchRunning()) {
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if (activePage != null) {
- IViewPart view = activePage.findView(ID);
- if (view instanceof TaskListView) {
- return (TaskListView) view;
- }
- }
- }
- return null;
- }
-
- public TaskListView() {
- PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(this);
- TasksUiPlugin.getTaskActivityManager().addActivityListener(TASK_ACTIVITY_LISTENER);
- TasksUiPlugin.getTaskActivityManager().addActivationListener(TASK_ACTIVATION_LISTENER);
- TasksUiInternal.getTaskList().addChangeListener(TASKLIST_CHANGE_LISTENER);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- TasksUiInternal.getTaskList().removeChangeListener(TASKLIST_CHANGE_LISTENER);
- TasksUiPlugin.getTaskActivityManager().removeActivityListener(TASK_ACTIVITY_LISTENER);
- TasksUiPlugin.getTaskActivityManager().removeActivationListener(TASK_ACTIVATION_LISTENER);
-
- PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().removePageListener(PAGE_LISTENER);
- }
-
- final IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
- if (themeManager != null) {
- themeManager.removePropertyChangeListener(THEME_CHANGE_LISTENER);
- }
-
- customDrawer.dispose();
- categoryGradientStart.dispose();
- categoryGradientEnd.dispose();
- }
-
- private void updateDescription() {
- ITask task = TasksUi.getTaskActivityManager().getActiveTask();
- if (getSite() == null || getSite().getPage() == null) {
- return;
- }
-
- IViewReference reference = getSite().getPage().findViewReference(ID);
- boolean shouldSetDescription = false;
- if (reference != null && reference.isFastView() && !getSite().getPage().isPartVisible(this)) {
- shouldSetDescription = true;
- }
-
- if (task != null) {
- setTitleToolTip(LABEL_VIEW + " (" + task.getSummary() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- if (shouldSetDescription) {
- setContentDescription(task.getSummary());
- } else {
- setContentDescription(""); //$NON-NLS-1$
- }
- } else {
- setTitleToolTip(LABEL_VIEW);
- if (shouldSetDescription) {
- setContentDescription(LABEL_NO_TASKS);
- } else {
- setContentDescription(""); //$NON-NLS-1$
- }
- }
- }
-
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- init(site);
- this.taskListMemento = memento;
- }
-
- @Override
- public void saveState(IMemento memento) {
- IMemento sorter = memento.createChild(MEMENTO_SORT_INDEX);
- IMemento m = sorter.createChild(MEMENTO_KEY_SORTER);
- switch (tableSorter.getComparator().getSortByIndex()) {
- case SUMMARY:
- m.putInteger(MEMENTO_KEY_SORT_INDEX, 1);
- break;
- case DATE_CREATED:
- m.putInteger(MEMENTO_KEY_SORT_INDEX, 2);
- break;
- case TASK_ID:
- m.putInteger(MEMENTO_KEY_SORT_INDEX, 3);
- break;
- default:
- m.putInteger(MEMENTO_KEY_SORT_INDEX, 0);
- }
-
- m.putInteger(MEMENTO_KEY_SORT_DIRECTION, tableSorter.getComparator().getSortDirection());
- IMemento m2 = sorter.createChild(MEMENTO_KEY_SORTER2);
- switch (tableSorter.getComparator().getSortByIndex2()) {
- case SUMMARY:
- m2.putInteger(MEMENTO_KEY_SORT_INDEX, 1);
- break;
- case DATE_CREATED:
- m2.putInteger(MEMENTO_KEY_SORT_INDEX, 2);
- break;
- case TASK_ID:
- m2.putInteger(MEMENTO_KEY_SORT_INDEX, 3);
- break;
- default:
- m2.putInteger(MEMENTO_KEY_SORT_INDEX, 0);
- }
-
- m2.putInteger(MEMENTO_KEY_SORT_DIRECTION, tableSorter.getComparator().getSortDirection2());
- memento.putString(MEMENTO_LINK_WITH_EDITOR, Boolean.toString(linkWithEditor));
- memento.putString(MEMENTO_PRESENTATION, currentPresentation.getId());
- memento.putInteger(MEMENTO_KEY_ROOT_SORT_DIRECTION, tableSorter.getSortDirectionRootElement());
- }
-
- private void restoreState() {
- if (taskListMemento != null) {
- IMemento sorterMemento = taskListMemento.getChild(MEMENTO_SORT_INDEX);
- int restoredSortIndex = 0;
- if (sorterMemento != null) {
- int sortDirection = -1;
- IMemento m = sorterMemento.getChild(MEMENTO_KEY_SORTER);
- if (m != null) {
- Integer sortIndexInt = m.getInteger(MEMENTO_KEY_SORT_INDEX);
- if (sortIndexInt != null) {
- restoredSortIndex = sortIndexInt.intValue();
- }
- Integer sortDirInt = m.getInteger(MEMENTO_KEY_SORT_DIRECTION);
- if (sortDirInt != null) {
- sortDirection = sortDirInt.intValue();
- tableSorter.getComparator().setSortDirection(sortDirection);
- switch (restoredSortIndex) {
- case 1:
- tableSorter.getComparator().setSortByIndex(TaskComparator.SortByIndex.SUMMARY);
- break;
- case 2:
- tableSorter.getComparator().setSortByIndex(TaskComparator.SortByIndex.DATE_CREATED);
- break;
- case 3:
- tableSorter.getComparator().setSortByIndex(TaskComparator.SortByIndex.TASK_ID);
- break;
- default:
- tableSorter.getComparator().setSortByIndex(TaskComparator.SortByIndex.PRIORITY);
- }
- }
- }
-
- IMemento m2 = sorterMemento.getChild(MEMENTO_KEY_SORTER2);
- if (m2 != null) {
- Integer sortIndexInt = m2.getInteger(MEMENTO_KEY_SORT_INDEX);
- if (sortIndexInt != null) {
- restoredSortIndex = sortIndexInt.intValue();
- }
- Integer sortDirInt = m2.getInteger(MEMENTO_KEY_SORT_DIRECTION);
- if (sortDirInt != null) {
- sortDirection = sortDirInt.intValue();
- tableSorter.getComparator().setSortDirection2(sortDirection);
- switch (restoredSortIndex) {
- case 1:
- tableSorter.getComparator().setSortByIndex2(TaskComparator.SortByIndex.SUMMARY);
- break;
- case 2:
- tableSorter.getComparator().setSortByIndex2(TaskComparator.SortByIndex.DATE_CREATED);
- break;
- case 3:
- tableSorter.getComparator().setSortByIndex2(TaskComparator.SortByIndex.TASK_ID);
- break;
- default:
- tableSorter.getComparator().setSortByIndex2(TaskComparator.SortByIndex.PRIORITY);
- }
- }
- }
- }
- applyPresentation(taskListMemento.getString(MEMENTO_PRESENTATION));
- Integer sortOrder = taskListMemento.getInteger(MEMENTO_KEY_ROOT_SORT_DIRECTION);
- if (sortOrder != null) {
- tableSorter.setSortDirectionRootElement(sortOrder);
- } else {
- tableSorter.setSortDirectionRootElement(TaskListSorter.DEFAULT_SORT_DIRECTION);
- }
- }
-
- filterWorkingSet = new TaskWorkingSetFilter();
- filterWorkingSet.updateWorkingSet(getSite().getPage().getAggregateWorkingSet());
- addFilter(filterWorkingSet);
- addFilter(filterPriority);
- if (TasksUiPlugin.getDefault().getPreferenceStore().contains(ITasksUiPreferenceConstants.FILTER_COMPLETE_MODE)) {
- addFilter(filterComplete);
- }
-
- //if (TasksUiPlugin.getDefault().getPreferenceStore().contains(TasksUiPreferenceConstants.FILTER_ARCHIVE_MODE)) {
- addFilter(filterArchive);
- //}
-
- // Restore "link with editor" value; by default true
- boolean linkValue = true;
- if (taskListMemento != null && taskListMemento.getString(MEMENTO_LINK_WITH_EDITOR) != null) {
- linkValue = Boolean.parseBoolean(taskListMemento.getString(MEMENTO_LINK_WITH_EDITOR));
- }
- setLinkWithEditor(linkValue);
-
- getViewer().refresh();
- }
-
- @Override
- public void createPartControl(Composite parent) {
- themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
- themeManager.addPropertyChangeListener(THEME_CHANGE_LISTENER);
-
- filteredTree = new TaskListFilteredTree(parent, SWT.MULTI | SWT.VERTICAL | /* SWT.H_SCROLL | */SWT.V_SCROLL
- | SWT_NO_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION, new SubstringPatternFilter());
- // Set to empty string to disable native tooltips (windows only?)
- // bug#160897
- // http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg29614.html
- getViewer().getTree().setToolTipText(""); //$NON-NLS-1$
-
- filteredTree.getFilterControl().addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateFilterEnablement();
- }
- });
-
- getViewer().getTree().setHeaderVisible(false);
- getViewer().setUseHashlookup(true);
- refreshJob = new TaskListRefreshJob(getViewer(), "Task List Refresh"); //$NON-NLS-1$
-
- configureColumns(columnNames, columnWidths);
-
- final IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
- Color categoryBackground = themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_CATEGORY);
- taskListTableLabelProvider = new TaskTableLabelProvider(new TaskElementLabelProvider(true),
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground);
- getViewer().setLabelProvider(taskListTableLabelProvider);
-
- CellEditor[] editors = new CellEditor[columnNames.length];
- TextCellEditor textEditor = new TextCellEditor(getViewer().getTree());
- ((Text) textEditor.getControl()).setOrientation(SWT.LEFT_TO_RIGHT);
- editors[0] = textEditor;
- // editors[1] = new ComboBoxCellEditor(getViewer().getTree(),
- // editors[2] = new CheckboxCellEditor();
-
- getViewer().setCellEditors(editors);
- getViewer().setCellModifier(taskListCellModifier);
-
- tableSorter = new TaskListSorter();
- getViewer().setSorter(tableSorter);
-
- applyPresentation(CategorizedPresentation.ID);
-
- drillDownAdapter = new DrillDownAdapter(getViewer());
- getViewer().setInput(getViewSite());
-
- final int activationImageOffset = PlatformUtil.getTreeImageOffset();
- customDrawer = new CustomTaskListDecorationDrawer(this, activationImageOffset);
- getViewer().getTree().addListener(SWT.EraseItem, customDrawer);
- getViewer().getTree().addListener(SWT.PaintItem, customDrawer);
-
- getViewer().getTree().addMouseListener(new MouseListener() {
-
- public void mouseDown(MouseEvent e) {
- // NOTE: need e.x offset for Linux/GTK, which does not see
- // left-aligned items in tree
- Object selectedNode = ((Tree) e.widget).getItem(new Point(e.x + 70, e.y));
- if (selectedNode instanceof TreeItem) {
- Object selectedObject = ((TreeItem) selectedNode).getData();
- if (selectedObject instanceof ITask) {
- if (e.x > activationImageOffset && e.x < activationImageOffset + 13) {
- taskListCellModifier.toggleTaskActivation((TreeItem) selectedNode);
- }
- }
- }
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- // ignore
- }
-
- public void mouseUp(MouseEvent e) {
- // ignore
- }
-
- });
-
- // TODO make these proper commands and move code into TaskListViewCommands
- getViewer().getTree().addKeyListener(new KeyListener() {
-
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.F2 && e.stateMask == 0) {
- if (renameAction.isEnabled()) {
- renameAction.run();
- }
- } else if ((e.keyCode & SWT.KEYCODE_BIT) != 0) {
- // Do nothing here since it is key code
- } else if (e.keyCode == SWT.ESC) {
- taskListToolTip.hide();
- } else if (e.keyCode == 'f' && e.stateMask == SWT.MOD1) {
- filteredTree.getFilterControl().setFocus();
- } else if (e.stateMask == 0) {
- if (Character.isLetter((char) e.keyCode) || Character.isDigit((char) e.keyCode)) {
- String string = new Character((char) e.keyCode).toString();
- filteredTree.getFilterControl().setText(string);
- filteredTree.getFilterControl().setSelection(1, 1);
- filteredTree.getFilterControl().setFocus();
- }
- }
- }
-
- public void keyReleased(KeyEvent e) {
- }
-
- });
-
- getViewer().addTreeListener(new ITreeViewerListener() {
-
- public void treeCollapsed(final TreeExpansionEvent event) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getViewer().refresh(event.getElement());
- }
- });
- }
-
- public void treeExpanded(final TreeExpansionEvent event) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getViewer().refresh(event.getElement());
- }
- });
- }
- });
-
- // HACK: shouldn't need to update explicitly
- getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object selectedObject = ((IStructuredSelection) getViewer().getSelection()).getFirstElement();
- if (selectedObject instanceof ITaskContainer) {
- updateActionEnablement(renameAction, (ITaskContainer) selectedObject);
- updateActionEnablement(deleteAction, (ITaskContainer) selectedObject);
- }
- }
- });
-
- taskListToolTip = new TaskListToolTip(getViewer().getControl());
-
- // update tooltip contents
- getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateToolTip(true);
- }
- });
-
- getViewer().getTree().addFocusListener(new FocusAdapter() {
- @Override
- public void focusLost(FocusEvent e) {
- taskListToolTip.hide();
- }
- });
-
- makeActions();
- hookGlobalActions();
- hookContextMenu();
- hookOpenAction();
- contributeToActionBars();
- initHandlers();
-
- configureGradientColors();
-
- initDragAndDrop(parent);
- expandToActiveTasks();
- restoreState();
-
- updateDescription();
-
- IContextService contextSupport = (IContextService) getSite().getService(IContextService.class);
- if (contextSupport != null) {
- contextSupport.activateContext(TaskListView.ID);
- }
-
- getSite().setSelectionProvider(getViewer());
- getSite().getPage().addPartListener(editorListener);
-
- // Need to do this because the page, which holds the active working set is not around on creation, see bug 203179
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPageListener(PAGE_LISTENER);
- }
-
- private void initHandlers() {
- IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
- handlerService.activateHandler(CollapseAllHandler.ID_COMMAND, new CollapseAllHandler(getViewer()));
- }
-
- private void hookGlobalActions() {
- IActionBars bars = getViewSite().getActionBars();
- bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
- bars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyDetailsAction);
- }
-
- private void applyPresentation(String id) {
- if (id != null) {
- for (AbstractTaskListPresentation presentation : presentationsPrimary) {
- if (id.equals(presentation.getId())) {
- applyPresentation(presentation);
- return;
- }
- }
- for (AbstractTaskListPresentation presentation : presentationsSecondary) {
- if (id.equals(presentation.getId())) {
- applyPresentation(presentation);
- return;
- }
- }
- }
- }
-
- public void applyPresentation(AbstractTaskListPresentation presentation) {
- try {
- getViewer().getControl().setRedraw(false);
- if (!filteredTree.getFilterControl().getText().equals("")) { //$NON-NLS-1$
- filteredTree.getFilterControl().setText(""); //$NON-NLS-1$
- }
- AbstractTaskListContentProvider contentProvider = presentation.getContentProvider(this);
- getViewer().setContentProvider(contentProvider);
- refresh(true);
-
- currentPresentation = presentation;
- } finally {
- getViewer().getControl().setRedraw(true);
- }
- }
-
- public AbstractTaskListPresentation getCurrentPresentation() {
- return currentPresentation;
- }
-
- private void configureColumns(final String[] columnNames, final int[] columnWidths) {
- TreeColumnLayout layout = (TreeColumnLayout) getViewer().getTree().getParent().getLayout();
- getViewer().setColumnProperties(columnNames);
- columns = new TreeColumn[columnNames.length];
- for (int i = 0; i < columnNames.length; i++) {
- columns[i] = new TreeColumn(getViewer().getTree(), 0);
- columns[i].setText(columnNames[i]);
-
- if (i == 0) {
- layout.setColumnData(columns[i], new ColumnWeightData(100));
- } else {
- layout.setColumnData(columns[i], new ColumnPixelData(columnWidths[i]));
- }
-
- columns[i].addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- tableSorter.getComparator().setSortDirection(tableSorter.getComparator().getSortDirection() * -1);
- getViewer().refresh(false);
- }
- });
- columns[i].addControlListener(new ControlListener() {
- public void controlResized(ControlEvent e) {
- for (int j = 0; j < columnWidths.length; j++) {
- if (columns[j].equals(e.getSource())) {
- columnWidths[j] = columns[j].getWidth();
- }
- }
- }
-
- public void controlMoved(ControlEvent e) {
- // don't care if the control is moved
- }
- });
- }
- }
-
- /**
- * Tracks editor activation and jump to corresponding task, if applicable
- */
- private final IPartListener editorListener = new IPartListener() {
-
- private void jumpToEditor(IWorkbenchPart part) {
- if (!linkWithEditor || !(part instanceof IEditorPart)) {
- return;
- }
- jumpToEditorTask((IEditorPart) part);
- }
-
- public void partActivated(IWorkbenchPart part) {
- if (part == TaskListView.this) {
- updateDescription();
- } else {
- jumpToEditor(part);
- }
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- public void partClosed(IWorkbenchPart part) {
- }
-
- public void partDeactivated(IWorkbenchPart part) {
- if (part == TaskListView.this) {
- IViewReference reference = getSite().getPage().findViewReference(ID);
- if (reference != null && reference.isFastView()) {
- updateDescription();
- }
- taskListToolTip.hide();
- }
- }
-
- public void partOpened(IWorkbenchPart part) {
- }
- };
-
- private void initDragAndDrop(Composite parent) {
- Transfer[] dragTypes = new Transfer[] { LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
- Transfer[] dropTypes = new Transfer[] { LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(),
- TextTransfer.getInstance(), RTFTransfer.getInstance(), PlatformUtil.getUrlTransfer() };
-
- getViewer().addDragSupport(DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK, dragTypes,
- new TaskDragSourceListener(getViewer()));
- getViewer().addDropSupport(DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT, dropTypes,
- new TaskListDropAdapter(getViewer()));
- }
-
- void expandToActiveTasks() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- workbench.getDisplay().asyncExec(new Runnable() {
- public void run() {
- ITask task = TasksUi.getTaskActivityManager().getActiveTask();
- if (task != null) {
- getViewer().expandToLevel(task, 0);
- }
- }
- });
- }
-
- private void hookContextMenu() {
- MenuManager menuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- TaskListView.this.fillContextMenu(manager);
- }
- });
- Menu menu = menuManager.createContextMenu(getViewer().getControl());
- getViewer().getControl().setMenu(menu);
- getSite().registerContextMenu(menuManager, getViewer());
- }
-
- private void contributeToActionBars() {
- IActionBars bars = getViewSite().getActionBars();
- fillLocalPullDown(bars.getMenuManager());
- fillLocalToolBar(bars.getToolBarManager());
- }
-
- private void fillLocalPullDown(IMenuManager manager) {
- updateDrillDownActions();
- manager.add(goUpAction);
- manager.add(collapseAll);
- manager.add(expandAll);
- manager.add(new Separator(ID_SEPARATOR_FILTERS));
- manager.add(sortDialogAction);
- manager.add(filterOnPriorityAction);
- manager.add(filterCompleteTask);
- //manager.add(filterArchiveCategory);
- manager.add(filterSubTasksAction);
-
- manager.add(new Separator(ID_SEPARATOR_TASKS));
- manager.add(synchronizeAutomatically);
-
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- manager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- filterOnPriorityAction.updateCheckedState();
- }
- });
-
- manager.add(linkWithEditorAction);
- manager.add(new Separator());
- manager.add(openPreferencesAction);
- }
-
- private void fillLocalToolBar(IToolBarManager manager) {
- manager.add(newTaskAction);
- manager.add(presentationDropDownSelectionAction);
- manager.add(new Separator());
- manager.add(collapseAll);
- manager.add(new GroupMarker(ID_SEPARATOR_CONTEXT));
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /*
- * TODO: clean up, consider relying on extension points for groups
- */
- private void fillContextMenu(final IMenuManager manager) {
- updateDrillDownActions();
- final ITaskContainer element;
-
- final Object firstSelectedObject = ((IStructuredSelection) getViewer().getSelection()).getFirstElement();
- if (firstSelectedObject instanceof ITaskContainer) {
- element = (ITaskContainer) firstSelectedObject;
- } else {
- element = null;
- }
- final List<IRepositoryElement> selectedElements = getSelectedTaskContainers();
- AbstractTask task = null;
- if (element instanceof ITask) {
- task = (AbstractTask) element;
- }
-
- manager.add(new Separator(ID_SEPARATOR_NEW));
- manager.add(new Separator());
-
- if (element instanceof ITask) {
- addAction(openAction, manager, element);
- }
- addAction(openWithBrowser, manager, element);
- if (task != null) {
- if (task.isActive()) {
- manager.add(deactivateAction);
- } else {
- manager.add(activateAction);
- }
- }
-
- manager.add(new Separator());
-
- Map<String, List<IDynamicSubMenuContributor>> dynamicMenuMap = TasksUiPlugin.getDefault().getDynamicMenuMap();
- for (String menuPath : dynamicMenuMap.keySet()) {
- if (!ID_SEPARATOR_CONTEXT.equals(menuPath)) {
- for (final IDynamicSubMenuContributor contributor : dynamicMenuMap.get(menuPath)) {
- SafeRunnable.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Menu contributor failed")); //$NON-NLS-1$
- }
-
- public void run() throws Exception {
- MenuManager subMenuManager = contributor.getSubMenuManager(selectedElements);
- if (subMenuManager != null) {
- addMenuManager(subMenuManager, manager, element);
- }
- }
-
- });
- }
- }
- }
- manager.add(new Separator(ID_SEPARATOR_NAVIGATE));
-// manager.add(new Separator(ID_SEPARATOR_OPERATIONS));
- manager.add(new Separator());
-
- addAction(copyDetailsAction, manager, element);
-
- boolean enableRemove = true;
- for (IRepositoryElement repositoryElement : selectedElements) {
- if (repositoryElement instanceof ITask) {
- AbstractTaskCategory tempCategory = TaskCategory.getParentTaskCategory((AbstractTask) repositoryElement);
- if (tempCategory == null) {
- enableRemove = false;
- break;
- }
- }
- }
- if (enableRemove) {
- addAction(removeFromCategoryAction, manager, element);
- }
-
- // This should also test for null, or else nothing to delete!
- addAction(deleteAction, manager, element);
- if (!(element instanceof ITask)) {
- addAction(renameAction, manager, element);
- }
-
- if (element != null && !(element instanceof ITask)) {
- manager.add(goIntoAction);
- }
- if (drilledIntoCategory != null) {
- manager.add(goUpAction);
- }
- manager.add(new Separator(ID_SEPARATOR_CONTEXT));
- manager.add(new Separator(ID_SEPARATOR_OPERATIONS));
-
- if (element instanceof ITask) {
- for (String menuPath : dynamicMenuMap.keySet()) {
- if (ID_SEPARATOR_CONTEXT.equals(menuPath)) {
- for (IDynamicSubMenuContributor contributor : dynamicMenuMap.get(menuPath)) {
- MenuManager subMenuManager = contributor.getSubMenuManager(selectedElements);
- if (subMenuManager != null) {
- addMenuManager(subMenuManager, manager, element);
- }
- }
- }
- }
- }
- if (element instanceof IRepositoryQuery) {
- EditRepositoryPropertiesAction repositoryPropertiesAction = new EditRepositoryPropertiesAction();
- repositoryPropertiesAction.selectionChanged(new StructuredSelection(element));
- if (repositoryPropertiesAction.isEnabled()) {
- MenuManager subMenu = new MenuManager(Messages.TaskListView_Repository);
- manager.add(subMenu);
-
- UpdateRepositoryConfigurationAction resetRepositoryConfigurationAction = new UpdateRepositoryConfigurationAction();
- resetRepositoryConfigurationAction.selectionChanged(new StructuredSelection(element));
- subMenu.add(resetRepositoryConfigurationAction);
- subMenu.add(new Separator());
- subMenu.add(repositoryPropertiesAction);
- }
- }
- manager.add(new Separator(ID_SEPARATOR_REPOSITORY));
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- manager.add(new Separator());
- manager.add(new Separator(ID_SEPARATOR_PROPERTIES));
- }
-
- public List<IRepositoryElement> getSelectedTaskContainers() {
- List<IRepositoryElement> selectedElements = new ArrayList<IRepositoryElement>();
- for (Iterator<?> i = ((IStructuredSelection) getViewer().getSelection()).iterator(); i.hasNext();) {
- Object object = i.next();
- if (object instanceof ITaskContainer) {
- selectedElements.add((IRepositoryElement) object);
- }
- }
- return selectedElements;
- }
-
- private void addMenuManager(IMenuManager menuToAdd, IMenuManager manager, ITaskContainer element) {
- if ((element instanceof ITask) || element instanceof IRepositoryQuery) {
- manager.add(menuToAdd);
- }
- }
-
- private void addAction(Action action, IMenuManager manager, ITaskContainer element) {
- manager.add(action);
- if (element != null) {
- updateActionEnablement(action, element);
- }
- }
-
- // FIXME move the enablement to the action classes
- private void updateActionEnablement(Action action, ITaskContainer element) {
- if (element instanceof ITask) {
- if (action instanceof OpenWithBrowserAction) {
- if (TasksUiInternal.isValidUrl(((ITask) element).getUrl())) {
- action.setEnabled(true);
- } else {
- action.setEnabled(false);
- }
- } else if (action instanceof DeleteAction) {
- action.setEnabled(true);
- } else if (action instanceof OpenTaskListElementAction) {
- action.setEnabled(true);
- } else if (action instanceof CopyTaskDetailsAction) {
- action.setEnabled(true);
- } else if (action instanceof RenameAction) {
- action.setEnabled(true);
- }
- } else if (element != null) {
- if (action instanceof DeleteAction) {
- if (element instanceof UncategorizedTaskContainer) {
- action.setEnabled(false);
- } else {
- action.setEnabled(true);
- }
- } else if (action instanceof GoIntoAction) {
- TaskCategory cat = (TaskCategory) element;
- if (cat.getChildren().size() > 0) {
- action.setEnabled(true);
- } else {
- action.setEnabled(false);
- }
- } else if (action instanceof OpenTaskListElementAction) {
- action.setEnabled(true);
- } else if (action instanceof CopyTaskDetailsAction) {
- action.setEnabled(true);
- } else if (action instanceof RenameAction) {
- if (element instanceof AbstractTaskCategory) {
- AbstractTaskCategory container = (AbstractTaskCategory) element;
- action.setEnabled(container.isUserManaged());
- } else if (element instanceof IRepositoryQuery) {
- action.setEnabled(true);
- }
- }
- } else {
- action.setEnabled(true);
- }
- }
-
- private void makeActions() {
- copyDetailsAction = new CopyTaskDetailsAction();
- copyDetailsAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
-
- goIntoAction = new GoIntoAction();
- goUpAction = new GoUpAction(drillDownAdapter);
-
- //newLocalTaskAction = new NewLocalTaskAction(this);
- removeFromCategoryAction = new RemoveFromCategoryAction(this);
- renameAction = new RenameAction(this);
- filteredTree.getViewer().addSelectionChangedListener(renameAction);
-
- deleteAction = new DeleteAction();
- collapseAll = new CollapseAllAction(this);
- expandAll = new ExpandAllAction(this);
- openAction = new OpenTaskListElementAction(this.getViewer());
- openWithBrowser = new OpenWithBrowserAction();
- filterCompleteTask = new FilterCompletedTasksAction(this);
- filterSubTasksAction = new GroupSubTasksAction(this);
- synchronizeAutomatically = new SynchronizeAutomaticallyAction();
- openPreferencesAction = new OpenTasksUiPreferencesAction();
- //filterArchiveCategory = new FilterArchiveContainerAction(this);
- sortDialogAction = new TaskListSortAction(getSite(), this);
- filterOnPriorityAction = new PriorityDropDownAction(this);
- linkWithEditorAction = new LinkWithEditorAction(this);
- presentationDropDownSelectionAction = new PresentationDropDownSelectionAction(this);
- newTaskAction = new NewTaskAction();
- filteredTree.getViewer().addSelectionChangedListener(newTaskAction);
- filteredTree.getViewer().addSelectionChangedListener(openWithBrowser);
- filteredTree.getViewer().addSelectionChangedListener(copyDetailsAction);
- }
-
- private void hookOpenAction() {
- getViewer().addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- openAction.run();
- }
- });
-
- getViewer().addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.ACTIVATE_WHEN_OPENED)) {
- AbstractTask selectedTask = TaskListView.getFromActivePerspective().getSelectedTask();
- if (selectedTask != null) {
- activateAction.run(selectedTask);
- }
- }
- }
- });
- }
-
- /**
- * Passing the focus request to the viewer's control.
- */
- @Override
- public void setFocus() {
- filteredTree.getViewer().getControl().setFocus();
- }
-
- public void refresh(boolean expandIfFocused) {
- if (expandIfFocused && isFocusedMode() && isAutoExpandMode()) {
- try {
- getViewer().getControl().setRedraw(false);
- refreshJob.refreshNow();
- getViewer().expandAll();
- } finally {
- getViewer().getControl().setRedraw(true);
- }
- } else {
- refreshJob.refreshNow();
- }
- }
-
- public void refresh() {
- refreshJob.refreshNow();
- }
-
- public TaskListToolTip getToolTip() {
- return taskListToolTip;
- }
-
- public TreeViewer getViewer() {
- return filteredTree.getViewer();
- }
-
- public TaskCompletionFilter getCompleteFilter() {
- return filterComplete;
- }
-
- public TaskPriorityFilter getPriorityFilter() {
- return filterPriority;
- }
-
- public void addFilter(AbstractTaskListFilter filter) {
- if (!filters.contains(filter)) {
- filters.add(filter);
- }
- }
-
- public void clearFilters() {
- filters.clear();
- filters.add(filterArchive);
- filters.add(filterWorkingSet);
- }
-
- public void removeFilter(AbstractTaskListFilter filter) {
- filters.remove(filter);
- }
-
- public void updateDrillDownActions() {
- if (drillDownAdapter.canGoBack()) {
- goUpAction.setEnabled(true);
- } else {
- goUpAction.setEnabled(false);
- }
- }
-
- boolean isInRenameAction = false;
-
- private DelayedRefreshJob refreshJob;
-
- private boolean itemNotFoundExceptionLogged;
-
- public void setInRenameAction(boolean b) {
- isInRenameAction = b;
- }
-
- public void goIntoCategory() {
- ISelection selection = getViewer().getSelection();
- if (selection instanceof StructuredSelection) {
- StructuredSelection structuredSelection = (StructuredSelection) selection;
- Object element = structuredSelection.getFirstElement();
- if (element instanceof ITaskContainer) {
- drilledIntoCategory = (AbstractTaskContainer) element;
- drillDownAdapter.goInto();
- IActionBars bars = getViewSite().getActionBars();
- bars.getToolBarManager().remove(goUpAction.getId());
- bars.getToolBarManager().add(goUpAction);
- bars.updateActionBars();
- updateDrillDownActions();
- }
- }
- }
-
- public void goUpToRoot() {
- drilledIntoCategory = null;
- drillDownAdapter.goBack();
- IActionBars bars = getViewSite().getActionBars();
- bars.getToolBarManager().remove(GoUpAction.ID);
- bars.updateActionBars();
- updateDrillDownActions();
- }
-
- public AbstractTask getSelectedTask() {
- ISelection selection = getViewer().getSelection();
- if (selection.isEmpty()) {
- return null;
- }
- if (selection instanceof StructuredSelection) {
- StructuredSelection structuredSelection = (StructuredSelection) selection;
- Object element = structuredSelection.getFirstElement();
- if (element instanceof ITask) {
- return (AbstractTask) structuredSelection.getFirstElement();
- }
- }
- return null;
- }
-
- public static AbstractTask getSelectedTask(ISelection selection) {
- if (selection instanceof StructuredSelection) {
- StructuredSelection structuredSelection = (StructuredSelection) selection;
- if (structuredSelection.size() != 1) {
- return null;
- }
- Object element = structuredSelection.getFirstElement();
- if (element instanceof ITask) {
- return (AbstractTask) structuredSelection.getFirstElement();
- }
- }
- return null;
- }
-
- public void indicatePaused(boolean paused) {
- isPaused = paused;
- IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
- if (isPaused) {
- statusLineManager.setMessage(CommonImages.getImage(TasksUiImages.TASKS_VIEW),
- Messages.TaskListView_Mylyn_context_capture_paused);
- setPartName(Messages.TaskListView__paused_ + LABEL_VIEW);
- } else {
- statusLineManager.setMessage(""); //$NON-NLS-1$
- setPartName(LABEL_VIEW);
- }
- }
-
- public AbstractTaskContainer getDrilledIntoCategory() {
- return drilledIntoCategory;
- }
-
- public TaskListFilteredTree getFilteredTree() {
- return filteredTree;
- }
-
- public void selectedAndFocusTask(ITask task) {
- if (task == null || getViewer().getControl().isDisposed()) {
- return;
- }
- saveSelection();
-
- IStructuredSelection selection = restoreSelection(task);
- try {
- getViewer().setSelection(selection, true);
- } catch (SWTError e) {
- if (!itemNotFoundExceptionLogged) {
- itemNotFoundExceptionLogged = true;
- // It's probably not worth displaying this to the user since the item
- // is not there in this case, so consider removing.
- StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- "Could not link Task List with editor", //$NON-NLS-1$
- e));
- }
- }
- }
-
- private void saveSelection() {
- IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
- if (!selection.isEmpty()) {
- if (selection.getFirstElement() instanceof ITaskContainer) {
- // make sure the new selection is inserted at the end of the
- // list
- String handle = ((IRepositoryElement) selection.getFirstElement()).getHandleIdentifier();
- lastSelectionByTaskHandle.remove(handle);
- lastSelectionByTaskHandle.put(handle, selection);
-
- if (lastSelectionByTaskHandle.size() > SIZE_MAX_SELECTION_HISTORY) {
- Iterator<String> it = lastSelectionByTaskHandle.keySet().iterator();
- it.next();
- it.remove();
- }
- }
- }
- }
-
- private IStructuredSelection restoreSelection(IRepositoryElement task) {
- IStructuredSelection selection = lastSelectionByTaskHandle.get(task.getHandleIdentifier());
- if (selection != null) {
- return selection;
- } else {
- return new StructuredSelection(task);
- }
- }
-
- public Image[] getPirorityImages() {
- Image[] images = new Image[PriorityLevel.values().length];
- for (int i = 0; i < PriorityLevel.values().length; i++) {
- images[i] = TasksUiImages.getImageForPriority(PriorityLevel.values()[i]);
- }
- return images;
- }
-
- public Set<AbstractTaskListFilter> getFilters() {
- return filters;
- }
-
- public static String getCurrentPriorityLevel() {
- if (TasksUiPlugin.getDefault().getPreferenceStore().contains(ITasksUiPreferenceConstants.FILTER_PRIORITY)) {
- return TasksUiPlugin.getDefault().getPreferenceStore().getString(
- ITasksUiPreferenceConstants.FILTER_PRIORITY);
- } else {
- return PriorityLevel.P5.toString();
- }
- }
-
- public TaskArchiveFilter getArchiveFilter() {
- return filterArchive;
- }
-
- private void updateFilterEnablement() {
- boolean enabled = !isFocusedMode();
- if (enabled) {
- Text textControl = filteredTree.getFilterControl();
- if (textControl != null && textControl.getText().length() > 0) {
- enabled = false;
- }
- }
- sortDialogAction.setEnabled(enabled);
- filterOnPriorityAction.setEnabled(enabled);
- filterCompleteTask.setEnabled(enabled);
- //filterArchiveCategory.setEnabled(enabled);
- }
-
- public boolean isScheduledPresentation() {
- return currentPresentation != null && ScheduledPresentation.ID.equals(currentPresentation.getId());
- }
-
- public boolean isFocusedMode() {
- return focusedMode;
- }
-
- private boolean isAutoExpandMode() {
- return TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST);
- }
-
- public void setFocusedMode(boolean focusedMode) {
- if (this.focusedMode == focusedMode) {
- return;
- }
- this.focusedMode = focusedMode;
- IToolBarManager manager = getViewSite().getActionBars().getToolBarManager();
-
- if (focusedMode && isAutoExpandMode()) {
- manager.remove(CollapseAllAction.ID);
- } else if (manager.find(CollapseAllAction.ID) == null) {
- manager.prependToGroup(ID_SEPARATOR_CONTEXT, collapseAll);
- }
- manager.update(false);
- updateFilterEnablement();
- }
-
- public void setSynchronizationOverlaid(boolean synchronizationOverlaid) {
- this.synchronizationOverlaid = synchronizationOverlaid;
- getViewer().refresh();
- }
-
- public void displayPrioritiesAbove(String priority) {
- filterPriority.displayPrioritiesAbove(priority);
- getViewer().refresh();
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)
- || IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property)) {
- if (getSite() != null && getSite().getPage() != null) {
- if (filterWorkingSet.updateWorkingSet(getSite().getPage().getAggregateWorkingSet())) {
- try {
- getViewer().getControl().setRedraw(false);
-
- if (drilledIntoCategory != null) {
- goUpToRoot();
- }
-
- getViewer().refresh();
- if (isFocusedMode() && isAutoExpandMode()) {
- getViewer().expandAll();
- }
- } finally {
- getViewer().getControl().setRedraw(true);
- }
- }
- }
-
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- filteredTree.indicateActiveTaskWorkingSet();
- }
- });
- }
- }
-
- public void setLinkWithEditor(boolean linkWithEditor) {
- this.linkWithEditor = linkWithEditor;
- linkWithEditorAction.setChecked(linkWithEditor);
- if (linkWithEditor) {
- IEditorPart activeEditor = getSite().getPage().getActiveEditor();
- if (activeEditor != null) {
- jumpToEditorTask(activeEditor);
- }
- }
- }
-
- private void jumpToEditorTask(IEditorPart editor) {
- IEditorInput input = editor.getEditorInput();
- if (input instanceof TaskEditorInput) {
- ITask task = ((TaskEditorInput) input).getTask();
- ITask selected = getSelectedTask();
- if (selected == null || !selected.equals(task)) {
- selectedAndFocusTask(task);
- }
- }
- }
-
- private void updateToolTip(boolean force) {
- if (taskListToolTip != null && taskListToolTip.isVisible()) {
- if (!force && taskListToolTip.isTriggeredByMouse()) {
- return;
- }
-
- TreeItem[] selection = getViewer().getTree().getSelection();
- if (selection != null && selection.length > 0) {
- Rectangle bounds = selection[0].getBounds();
- taskListToolTip.show(new Point(bounds.x + 1, bounds.y + 1));
- }
- }
- }
-
- public static Set<IWorkingSet> getActiveWorkingSets() {
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null) {
- Set<IWorkingSet> allSets = new HashSet<IWorkingSet>(Arrays.asList(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getActivePage()
- .getWorkingSets()));
- Set<IWorkingSet> tasksSets = new HashSet<IWorkingSet>(allSets);
- for (IWorkingSet workingSet : allSets) {
- if (workingSet.getId() == null
- || !workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- tasksSets.remove(workingSet);
- }
- }
- return tasksSets;
- } else {
- return Collections.emptySet();
- }
- }
-
- /**
- * This can be used for experimentally adding additional presentations, but note that this convention is extremely
- * likely to change in the Mylyn 3.0 cycle.
- */
- public static List<AbstractTaskListPresentation> getPresentations() {
- List<AbstractTaskListPresentation> presentations = new ArrayList<AbstractTaskListPresentation>();
- presentations.addAll(presentationsPrimary);
- presentations.addAll(presentationsSecondary);
- return presentations;
- }
-
- public static void addPresentation(AbstractTaskListPresentation presentation) {
- if (presentation.isPrimary()) {
- presentationsPrimary.add(presentation);
- } else {
- presentationsSecondary.add(presentation);
- }
- }
-
- public TaskListSorter getSorter() {
- return tableSorter;
- }
-
- public boolean show(ShowInContext context) {
- ISelection selection = context.getSelection();
- if (selection instanceof IStructuredSelection) {
- getViewer().setSelection(selection, true);
- return true;
- }
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesSorter.java
deleted file mode 100644
index 1c2482af2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesSorter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Mik Kersten
- */
-public class TaskRepositoriesSorter extends ViewerSorter {
-
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof TaskRepository && e2 instanceof TaskRepository) {
- TaskRepository t1 = (TaskRepository) e1;
- TaskRepository t2 = (TaskRepository) e2;
-
- String label1 = t1.getProperty(IRepositoryConstants.PROPERTY_LABEL);
- String label2 = t2.getProperty(IRepositoryConstants.PROPERTY_LABEL);
-
- if (LocalRepositoryConnector.REPOSITORY_LABEL.equals(label1)) {
- return -1;
- } else if (LocalRepositoryConnector.REPOSITORY_LABEL.equals(label2)) {
- return 1;
- }
-
- if (!t1.getConnectorKind().equals(t2.getConnectorKind())) {
- return (t1.getConnectorKind()).compareTo(t2.getConnectorKind());
- } else {
- if ((label1 == null || label1.equals("")) && label2 != null) { //$NON-NLS-1$
- return 1;
- } else if (label1 != null && (label2 == null || label2.equals(""))) { //$NON-NLS-1$
- return -1;
- } else if (label1 != null && label2 != null) {
- return label1.compareTo(label2);
- } else {
- return (t1.getRepositoryUrl()).compareTo(t2.getRepositoryUrl());
- }
- }
- } else {
- return super.compare(viewer, e1, e2);
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesView.java
deleted file mode 100644
index 75c19fc5b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesView.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryModelListener;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryAdapter;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.AddRepositoryAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.DeleteTaskRepositoryAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.DisconnectRepositoryAction;
-import org.eclipse.mylyn.tasks.core.IRepositoryListener;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * @author Mik Kersten
- */
-public class TaskRepositoriesView extends ViewPart {
-
- public static final String ID = "org.eclipse.mylyn.tasks.ui.views.repositories"; //$NON-NLS-1$
-
- private TableViewer viewer;
-
- private final Action addRepositoryAction = new AddRepositoryAction();
-
- private BaseSelectionListenerAction deleteRepositoryAction;
-
- private BaseSelectionListenerAction resetConfigurationAction;
-
- private DisconnectRepositoryAction offlineAction;
-
- private void asyncExec(Runnable runnable) {
- if (Display.getCurrent() != null) {
- runnable.run();
- } else {
- Display.getDefault().asyncExec(runnable);
- }
- }
-
- private final IRepositoryModelListener MODEL_LISTENER = new IRepositoryModelListener() {
-
- public void loaded() {
- asyncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
- };
-
- private final IRepositoryListener REPOSITORY_LISTENER = new TaskRepositoryAdapter() {
-
- @Override
- public void repositoryAdded(TaskRepository repository) {
- asyncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
-
- @Override
- public void repositoryRemoved(TaskRepository repository) {
- asyncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
-
- @Override
- public void repositorySettingsChanged(TaskRepository repository) {
- asyncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
- };
-
- static class ViewContentProvider implements IStructuredContentProvider {
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object parent) {
- return TasksUi.getRepositoryManager().getAllRepositories().toArray();
- }
- }
-
- public TaskRepositoriesView() {
- TasksUi.getRepositoryManager().addListener(REPOSITORY_LISTENER);
- TasksUiPlugin.getDefault().addModelListener(MODEL_LISTENER);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- TasksUiPlugin.getRepositoryManager().removeListener(REPOSITORY_LISTENER);
- TasksUiPlugin.getDefault().removeModelListener(MODEL_LISTENER);
- }
-
- public static TaskRepositoriesView getFromActivePerspective() {
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if (activePage == null) {
- return null;
- }
- IViewPart view = activePage.findView(ID);
- if (view instanceof TaskRepositoriesView) {
- return (TaskRepositoriesView) view;
- }
- }
- return null;
- }
-
- public static TaskRepositoriesView openInActivePerspective() {
- try {
- return (TaskRepositoriesView) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getActivePage()
- .showView(ID);
- } catch (Exception e) {
- return null;
- }
- }
-
- @Override
- public void createPartControl(Composite parent) {
- viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
- viewer.setContentProvider(new ViewContentProvider());
- viewer.setUseHashlookup(true);
- viewer.setLabelProvider(new DecoratingLabelProvider(new TaskRepositoryLabelProvider(),
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
-
- viewer.setSorter(new TaskRepositoriesSorter());
-
-// new ViewerSorter() {
-//
-// @Override
-// public int compare(Viewer viewer, Object e1, Object e2) {
-// if (e1 instanceof TaskRepository && e2 instanceof TaskRepository) {
-// TaskRepository t1 = (TaskRepository) e1;
-// TaskRepository t2 = (TaskRepository) e2;
-// return (t1.getKind() + t1.getUrl()).compareTo(t2.getKind() + t2.getUrl());
-// } else {
-// return super.compare(viewer, e1, e2);
-// }
-// }
-// });
- viewer.setInput(getViewSite());
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.class);
- if (service != null) {
- try {
- service.executeCommand(IWorkbenchActionDefinitionIds.PROPERTIES, null);
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Opening repository properties failed", e)); //$NON-NLS-1$
- }
- }
- }
- });
-
- // FIXME remove listener when view is disposed
- TasksUi.getRepositoryManager().addListener(new TaskRepositoryListener());
-
- makeActions();
- hookContextMenu();
- hookGlobalActions();
- contributeToActionBars();
- getSite().setSelectionProvider(getViewer());
- }
-
- private void hookGlobalActions() {
- IActionBars bars = getViewSite().getActionBars();
- bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteRepositoryAction);
- bars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), resetConfigurationAction);
- }
-
- private void makeActions() {
- deleteRepositoryAction = new DeleteTaskRepositoryAction();
- viewer.addSelectionChangedListener(deleteRepositoryAction);
-
- resetConfigurationAction = new UpdateRepositoryConfigurationAction();
- resetConfigurationAction.setActionDefinitionId("org.eclipse.ui.file.refresh"); //$NON-NLS-1$
- viewer.addSelectionChangedListener(resetConfigurationAction);
-
- offlineAction = new DisconnectRepositoryAction();
- viewer.addSelectionChangedListener(offlineAction);
- }
-
- private void hookContextMenu() {
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- TaskRepositoriesView.this.fillContextMenu(manager);
- }
- });
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
- }
-
- private void contributeToActionBars() {
- IActionBars bars = getViewSite().getActionBars();
- fillLocalPullDown(bars.getMenuManager());
- fillLocalToolBar(bars.getToolBarManager());
- }
-
- private void fillLocalPullDown(IMenuManager manager) {
- manager.add(addRepositoryAction);
- }
-
- private void fillContextMenu(IMenuManager manager) {
- manager.add(addRepositoryAction);
- manager.add(new Separator());
- manager.add(deleteRepositoryAction);
- manager.add(resetConfigurationAction);
- manager.add(new Separator());
- manager.add(offlineAction);
- manager.add(new Separator("repository")); //$NON-NLS-1$
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(new Separator());
- manager.add(new Separator("properties")); //$NON-NLS-1$
- }
-
- private void fillLocalToolBar(IToolBarManager manager) {
- manager.add(addRepositoryAction);
- }
-
- /**
- * Passing the focus request to the viewer's control.
- */
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- public void refresh() {
- if (viewer != null && !viewer.getControl().isDisposed()) {
- viewer.refresh();
- }
- }
-
- public TableViewer getViewer() {
- return viewer;
- }
-
- public class TaskRepositoryListener extends TaskRepositoryAdapter {
-
- @Override
- public void repositorySettingsChanged(TaskRepository repository) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!getViewer().getControl().isDisposed()) {
- getViewer().refresh(true);
- }
- }
- });
- }
-
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoryLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoryLabelProvider.java
deleted file mode 100644
index 916a5c4b1..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoryLabelProvider.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.DisconnectRepositoryAction;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Mik Kersten
- */
-public class TaskRepositoryLabelProvider implements ILabelProvider {
-
-//extends LabelProvider implements ITableLabelProvider {
-
- public Image getColumnImage(Object obj, int index) {
- if (index == 0) {
- return getImage(obj);
- } else {
- return null;
- }
- }
-
- public Image getImage(Object object) {
- if (object instanceof AbstractRepositoryConnector) {
- AbstractRepositoryConnector repositoryConnector = (AbstractRepositoryConnector) object;
- Image image = TasksUiPlugin.getDefault().getBrandingIcon(repositoryConnector.getConnectorKind());
- if (image != null) {
- return image;
- } else {
- return CommonImages.getImage(TasksUiImages.REPOSITORY);
- }
- } else if (object instanceof TaskRepository) {
- if (((TaskRepository) object).isOffline()) {
- return CommonImages.getImage(TasksUiImages.REPOSITORY_OFFLINE);
- } else {
- return CommonImages.getImage(TasksUiImages.REPOSITORY);
- }
- }
- return null;
- }
-
- public String getText(Object object) {
-
- if (object instanceof TaskRepository) {
- TaskRepository repository = (TaskRepository) object;
- StringBuilder label = new StringBuilder();
- label.append(repository.getRepositoryLabel());
- if (repository.isOffline()) {
- label.append(" [" + DisconnectRepositoryAction.LABEL + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return label.toString();
- } else if (object instanceof AbstractRepositoryConnector) {
- return ((AbstractRepositoryConnector) object).getLabel();
- } else {
- return null;
- }
- }
-
- public void addListener(ILabelProviderListener listener) {
- // ignore
-
- }
-
- public void dispose() {
- // ignore
-
- }
-
- public boolean isLabelProperty(Object element, String property) {
- // ignore
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // ignore
-
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
deleted file mode 100644
index e0cfdc244..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskScheduleContentProvider.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.DateRange;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.core.WeekDateRange;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Used by Scheduled task list presentation
- *
- * @author Rob Elves
- */
-public class TaskScheduleContentProvider extends TaskListContentProvider implements ITaskActivityListener {
-
- private final TaskActivityManager taskActivityManager;
-
- private final Unscheduled unscheduled;
-
- private final Calendar END_OF_TIME;
-
- private Job rolloverJob;
-
- public TaskScheduleContentProvider(TaskListView taskListView) {
- super(taskListView);
- this.taskActivityManager = TasksUiPlugin.getTaskActivityManager();
- taskActivityManager.addActivityListener(this);
- END_OF_TIME = TaskActivityUtil.getCalendar();
- END_OF_TIME.add(Calendar.YEAR, 5000);
- END_OF_TIME.getTime();
- unscheduled = new Unscheduled(taskActivityManager, new DateRange(END_OF_TIME));
- }
-
- @Override
- public Object[] getElements(Object parent) {
-
- if (parent != null && parent.equals(this.taskListView.getViewSite())) {
-
- Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
-
- WeekDateRange week = TaskActivityUtil.getCurrentWeek();
- WeekDateRange nextWeek = TaskActivityUtil.getNextWeek();
-
- synchronized (this) {
- if (rolloverJob != null) {
- rolloverJob.cancel();
- rolloverJob = null;
- }
-
- long delay = week.getToday().getEndDate().getTime().getTime() - new Date().getTime();
- rolloverJob = new RolloverCheck();
- rolloverJob.setSystem(true);
- rolloverJob.setPriority(Job.SHORT);
- rolloverJob.schedule(delay);
- }
-
- for (DateRange day : week.getRemainingDays()) {
- containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), day));
- }
- containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), week));
-
- for (DateRange day : nextWeek.getDaysOfWeek()) {
- containers.add(new ScheduledTaskContainer(TasksUiPlugin.getTaskActivityManager(), day));
- }
-
- ScheduledTaskContainer nextWeekContainer = new ScheduledTaskContainer(taskActivityManager, nextWeek);
- containers.add(nextWeekContainer);
-
- ScheduledTaskContainer twoWeeksContainer = new ScheduledTaskContainer(taskActivityManager, week.next()
- .next(), Messages.TaskScheduleContentProvider_Two_Weeks);
- containers.add(twoWeeksContainer);
-
- containers.add(unscheduled);
- Calendar startDate = TaskActivityUtil.getCalendar();
- startDate.setTimeInMillis(twoWeeksContainer.getEnd().getTimeInMillis());
- TaskActivityUtil.snapNextDay(startDate);
- Calendar endDate = TaskActivityUtil.getCalendar();
- endDate.add(Calendar.YEAR, 4999);
- DateRange future = new DateRange(startDate, endDate);
-
- ScheduledTaskContainer futureContainer = new ScheduledTaskContainer(taskActivityManager, future,
- Messages.TaskScheduleContentProvider_Future);
- containers.add(futureContainer);
-
- return applyFilter(containers).toArray();
-
- } else {
- return getChildren(parent);
- }
- }
-
- @Override
- public Object getParent(Object child) {
-// for (Object o : getElements(null)) {
-// ScheduledTaskContainer container = ((ScheduledTaskContainer) o);
-// if (container.getChildren().contains(((ITask) child).getHandleIdentifier())) {
-// return container;
-// }
-// }
- return null;
- }
-
- @Override
- public boolean hasChildren(Object parent) {
- return getChildren(parent).length > 0;
- }
-
- @Override
- public Object[] getChildren(Object parent) {
- Set<ITask> result = new HashSet<ITask>();
- if (parent instanceof ITask) {
- // flat presentation (no subtasks revealed in Scheduled mode)
- } else if (parent instanceof ScheduledTaskContainer) {
- for (ITask child : ((ScheduledTaskContainer) parent).getChildren()) {
- if (!filter(parent, child)) {
- result.add(child);
- }
- }
-
- } else if (parent instanceof ITaskContainer) {
- for (ITask child : ((ITaskContainer) parent).getChildren()) {
- result.add(child);
- }
- }
- return result.toArray();
- }
-
- private void refresh() {
- if (Platform.isRunning() && PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- taskListView.refresh();
- }
- });
- }
- }
-
- @Override
- public void dispose() {
- synchronized (this) {
- if (rolloverJob != null) {
- rolloverJob.cancel();
- }
- }
- taskActivityManager.removeActivityListener(this);
- super.dispose();
- }
-
- public void activityReset() {
- refresh();
- }
-
- public void elapsedTimeUpdated(ITask task, long newElapsedTime) {
- // ignore
- }
-
- public class Unscheduled extends ScheduledTaskContainer {
-
- private final TaskActivityManager activityManager;
-
- public Unscheduled(TaskActivityManager activityManager, DateRange range) {
- super(activityManager, range, Messages.TaskScheduleContentProvider_Unscheduled);
- this.activityManager = activityManager;
- }
-
- @Override
- public Collection<ITask> getChildren() {
- Set<ITask> all = new HashSet<ITask>();
- for (ITask task : activityManager.getUnscheduled()) {
- if (!task.isCompleted() || (task.isCompleted() && !task.getSynchronizationState().isSynchronized())) {
- all.add(task);
- }
- }
- return all;
- }
- }
-
- private class RolloverCheck extends Job {
-
- public RolloverCheck() {
- super("Calendar Rollover Job"); //$NON-NLS-1$
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- refresh();
- return Status.OK_STATUS;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
deleted file mode 100644
index 0b9629ac3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskTableLabelProvider.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITableColorProvider;
-import org.eclipse.jface.viewers.ITableFontProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Mik Kersten
- */
-public class TaskTableLabelProvider extends DecoratingLabelProvider implements ITableLabelProvider,
- ITableColorProvider, ITableFontProvider {
-
- private Color categoryBackgroundColor;
-
- /**
- * @param view
- * can be null
- */
- public TaskTableLabelProvider(ILabelProvider provider, ILabelDecorator decorator, Color parentBackground) {
- super(provider, decorator);
- this.categoryBackgroundColor = parentBackground;
- }
-
- public String getColumnText(Object obj, int columnIndex) {
- if (obj instanceof ITaskContainer) {
- switch (columnIndex) {
- case 0:
-// if (obj instanceof ScheduledTaskContainer) {
-// if (((ScheduledTaskContainer) obj).isToday()) {
-// return super.getText(obj) + " - Today";
-// }
-// }
- return super.getText(obj);
- case 1:
- return null;
- }
- }
- return null;
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (!(element instanceof ITaskContainer)) {
- return null;
- }
- if (columnIndex == 0) {
- return super.getImage(element);
- }
- return null;
- }
-
- public Font getFont(Object element, int columnIndex) {
- return super.getFont(element);
- }
-
- public Color getForeground(Object element, int columnIndex) {
- return super.getForeground(element);
- }
-
- public Color getBackground(Object element, int columnIndex) {
- if (element instanceof ITaskContainer && !(element instanceof ITask)) {
- return categoryBackgroundColor;
- } else if (element instanceof IRepositoryQuery) {
- return categoryBackgroundColor;
- }
-
- return super.getBackground(element);
- }
-
- public void setCategoryBackgroundColor(Color parentBackgroundColor) {
- this.categoryBackgroundColor = parentBackgroundColor;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java
deleted file mode 100644
index dde26d891..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import java.text.MessageFormat;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.AbstractTaskRepositoryAction;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- */
-public class UpdateRepositoryConfigurationAction extends AbstractTaskRepositoryAction {
-
- private static final String ID = "org.eclipse.mylyn.tasklist.repositories.reset"; //$NON-NLS-1$
-
- public UpdateRepositoryConfigurationAction() {
- super(Messages.UpdateRepositoryConfigurationAction_Update_Repository_Configuration);
- setId(ID);
- setEnabled(false);
- }
-
- @Override
- public void run() {
- try {
- IStructuredSelection selection = getStructuredSelection();
- for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
- final TaskRepository repository = getTaskRepository(iter.next());
- if (repository != null) {
- final AbstractRepositoryConnector connector = TasksUi.getRepositoryManager()
- .getRepositoryConnector(repository.getConnectorKind());
- if (connector != null) {
- final String jobName = MessageFormat.format(
- Messages.UpdateRepositoryConfigurationAction_Updating_repository_configuration_for_X,
- repository.getRepositoryUrl());
- Job updateJob = new Job(jobName) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(jobName, IProgressMonitor.UNKNOWN);
- try {
- performUpdate(repository, connector, monitor);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- updateJob.schedule();
- }
- }
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- }
-
- public void performUpdate(final TaskRepository repository, final AbstractRepositoryConnector connector,
- IProgressMonitor monitor) {
- try {
- connector.updateRepositoryConfiguration(repository, monitor);
- } catch (final CoreException e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.displayStatus(
- Messages.UpdateRepositoryConfigurationAction_Error_updating_repository_configuration,
- e.getStatus());
- }
- });
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java
deleted file mode 100644
index 5a225d718..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.views;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * Derived from JUnitProgressBar
- *
- * @author Mik Kersten
- */
-public class WorkweekProgressBar extends Canvas {
-
- private static final int DEFAULT_HEIGHT = 5;
-
- private int currentTickCount = 0;
-
- private int maxTickCount = 0;
-
- private int colorBarWidth = 0;
-
- private final Color completedColor;
-
- private final Composite parent;
-
- public WorkweekProgressBar(Composite parent) {
- super(parent, SWT.NONE);
- this.parent = parent;
-
- parent.addControlListener(new ControlAdapter() {
- @Override
- public void controlResized(ControlEvent e) {
- colorBarWidth = scale(currentTickCount);
- redraw();
- }
- });
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- paint(e);
- }
- });
- IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
- completedColor = themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_COMPLETED_TODAY);
- }
-
- public void setMaximum(int max) {
- maxTickCount = max;
- }
-
- public void reset() {
- currentTickCount = 0;
- maxTickCount = 0;
- colorBarWidth = 0;
- redraw();
- }
-
- public void reset(int ticksDone, int maximum) {
- currentTickCount = ticksDone;
- maxTickCount = maximum;
- colorBarWidth = scale(ticksDone);
- computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- redraw();
- }
-
- private void paintStep(int startX, int endX) {
- GC gc = new GC(this);
- setStatusColor(gc);
- Rectangle rect = getClientArea();
- startX = Math.max(1, startX);
- gc.fillRectangle(startX, 1, endX - startX, rect.height - 2);
- gc.dispose();
- }
-
- private void setStatusColor(GC gc) {
- gc.setBackground(completedColor);
- }
-
- private int scale(int value) {
- if (maxTickCount > 0) {
- // TODO: should probably get own client area, not parent's
- Rectangle r = parent.getClientArea();
- if (r.width != 0) {
- return Math.max(0, value * (r.width - 2) / maxTickCount);
- }
- }
- return value;
- }
-
- private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
- gc.setForeground(topleft);
- gc.drawLine(x, y, x + w - 1, y);
- gc.drawLine(x, y, x, y + h - 1);
-
- gc.setForeground(bottomright);
- gc.drawLine(x + w, y, x + w, y + h);
- gc.drawLine(x, y + h, x + w, y + h);
- }
-
- private void paint(PaintEvent event) {
- GC gc = event.gc;
- Display disp = getDisplay();
-
- Rectangle rect = getClientArea();
- gc.fillRectangle(rect);
- drawBevelRect(gc, rect.x, rect.y, rect.width - 1, rect.height - 1,
- disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW),
- disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
-
- setStatusColor(gc);
- colorBarWidth = Math.min(rect.width - 2, colorBarWidth);
- gc.fillRectangle(1, 1, colorBarWidth, rect.height - 2);
- }
-
- @Override
- public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- Point size = new Point(parent.getSize().x, DEFAULT_HEIGHT);//parent.getSize().y);
- if (wHint != SWT.DEFAULT) {
- size.x = wHint;
- }
- if (hHint != SWT.DEFAULT) {
- size.y = hHint;
- }
- return size;
- }
-
- public void setCount(int count) {
- currentTickCount++;
- int x = colorBarWidth;
-
- colorBarWidth = scale(currentTickCount);
-
- if (currentTickCount == maxTickCount) {
- colorBarWidth = getClientArea().width - 1;
- }
- paintStep(x, colorBarWidth);
- }
-
- public void step(int failures) {
- currentTickCount++;
- int x = colorBarWidth;
-
- colorBarWidth = scale(currentTickCount);
- if (currentTickCount == maxTickCount) {
- colorBarWidth = getClientArea().width - 1;
- }
- paintStep(x, colorBarWidth);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties
deleted file mode 100644
index d7127100b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/messages.properties
+++ /dev/null
@@ -1,46 +0,0 @@
-DisconnectRepositoryAction_Disconnected=Disconnected
-
-PriorityDropDownAction_Filter_Priority_Lower_Than=Filter Priority Lower Than
-
-TaskInputDialog_Clear=Clear
-TaskInputDialog_Description=Description:
-TaskInputDialog_Get_Description=Get Description
-TaskInputDialog_New_Task=New Task
-TaskInputDialog_Web_Link=Web Link:
-
-TaskListDropAdapter__retrieving_from_URL_=<retrieving from URL>
-
-TaskListFilteredTree_Activate=Activate...
-TaskListFilteredTree_Edit_Task_Working_Sets_=Edit Task Working Sets...
-TaskListFilteredTree_Estimated_hours=\ Estimated hours: {0} of {1} estimated
-TaskListFilteredTree__multiple_=<multiple>
-TaskListFilteredTree_Scheduled_tasks=\ Scheduled tasks: {0} of {1} scheduled
-TaskListFilteredTree_Search_repository_for_key_or_summary_=Search repository for key or summary...
-TaskListFilteredTree_Select_Active_Task=Select Active Task
-TaskListFilteredTree_Select_Working_Set=Select Working Set
-TaskListFilteredTree_Workweek_Progress=Workweek Progress
-
-TaskListToolTip_Automatic_container_for_all_local_tasks=Automatic container for all local tasks\nwith no category set
-TaskListToolTip_Automatic_container_for_repository_tasks=Automatic container for repository tasks\nnot matched by any query
-TaskListToolTip_Due=Due: {0}, {1} ({2})
-TaskListToolTip_Elapsed=Elapsed: {0}
-TaskListToolTip_Estimate=Estimate: {0} hours
-TaskListToolTip_Please_synchronize_manually_for_full_error_message=\ Please synchronize manually for full error message.
-TaskListToolTip_Scheduled=Scheduled: {0}
-TaskListToolTip_Some_incoming_elements_may_be_filtered=Some incoming elements may be filtered,\nfocus the view to see all incomings
-TaskListToolTip_Synchronized=Synchronized: {0}
-TaskListToolTip_Total_Complete_Incomplete=Total: {0} (Complete: {1}, Incomplete: {2})
-
-TaskListView_Mylyn_context_capture_paused=Mylyn context capture paused
-TaskListView__paused_=(paused)
-TaskListView_Repository=Repository
-TaskListView_Summary=Summary
-TaskListView_Task_List=Task List
-
-TaskScheduleContentProvider_Future=Future
-TaskScheduleContentProvider_Two_Weeks=Two Weeks
-TaskScheduleContentProvider_Unscheduled=Unscheduled
-
-UpdateRepositoryConfigurationAction_Error_updating_repository_configuration=Error updating repository configuration
-UpdateRepositoryConfigurationAction_Update_Repository_Configuration=Update Repository Configuration
-UpdateRepositoryConfigurationAction_Updating_repository_configuration_for_X=Updating repository configuration for {0}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage.java
deleted file mode 100644
index 9501ab43c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentPreviewPage.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jeff Pound and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jeff Pound - initial API and implementation
- * Tasktop Technologies - improvement
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Shows a preview of an attachment.
- *
- * @author Jeff Pound
- * @author Steffen Pingel
- */
-public class AttachmentPreviewPage extends WizardPage {
-
- protected static final int MAX_TEXT_SIZE = 50000;
-
- private static final String PAGE_NAME = "PreviewAttachmentPage"; //$NON-NLS-1$
-
- private final Set<String> imageTypes;
-
- private final TaskAttachmentModel model;
-
- private Button runInBackgroundButton;
-
- private ScrolledComposite scrolledComposite;
-
- private final Set<String> textTypes;
-
- private Composite contentComposite;
-
- public AttachmentPreviewPage(TaskAttachmentModel model) {
- super(PAGE_NAME);
- this.model = model;
- setTitle(Messages.AttachmentPreviewPage_Attachment_Preview);
- setDescription(Messages.AttachmentPreviewPage_Review_the_attachment_before_submitting);
-
- textTypes = new HashSet<String>();
- textTypes.add("text/plain"); //$NON-NLS-1$
- textTypes.add("text/html"); //$NON-NLS-1$
- textTypes.add("text/html"); //$NON-NLS-1$
- textTypes.add("application/xml"); //$NON-NLS-1$
-
- imageTypes = new HashSet<String>();
- imageTypes.add("image/jpeg"); //$NON-NLS-1$
- imageTypes.add("image/gif"); //$NON-NLS-1$
- imageTypes.add("image/png"); //$NON-NLS-1$
- }
-
- private void adjustScrollbars(Rectangle imgSize) {
- Rectangle clientArea = scrolledComposite.getClientArea();
-
- ScrollBar hBar = scrolledComposite.getHorizontalBar();
- hBar.setMinimum(0);
- hBar.setMaximum(imgSize.width - 1);
- hBar.setPageIncrement(clientArea.width);
- hBar.setIncrement(10);
-
- ScrollBar vBar = scrolledComposite.getVerticalBar();
- vBar.setMinimum(0);
- vBar.setMaximum(imgSize.height - 1);
- vBar.setPageIncrement(clientArea.height);
- vBar.setIncrement(10);
- }
-
- public void createControl(Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- setControl(composite);
-
- contentComposite = new Composite(composite, SWT.NONE);
- contentComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- contentComposite.setLayout(new GridLayout());
-
- runInBackgroundButton = new Button(composite, SWT.CHECK);
- runInBackgroundButton.setText(Messages.AttachmentPreviewPage_Run_in_background);
-
- Dialog.applyDialogFont(composite);
- }
-
- @Override
- public void setVisible(boolean visible) {
- if (visible) {
- Control[] children = contentComposite.getChildren();
- for (Control control : children) {
- control.dispose();
- }
- if (isTextAttachment() || isImageAttachment()) {
- Object content = getContent(contentComposite);
- if (content instanceof String) {
- createTextPreview(contentComposite, (String) content);
- } else if (content instanceof Image) {
- createImagePreview(contentComposite, (Image) content);
- }
- } else {
- createGenericPreview(contentComposite);
- }
- contentComposite.layout(true, true);
- }
- Dialog.applyDialogFont(contentComposite);
- super.setVisible(visible);
- }
-
- private void createErrorPreview(Composite composite, String message) {
- Label label = new Label(composite, SWT.NONE);
- label.setLayoutData(new GridData(GridData.FILL_BOTH));
- label.setText(message);
- }
-
- private void createGenericPreview(Composite composite) {
- Label label = new Label(composite, SWT.NONE);
- label.setLayoutData(new GridData(GridData.FILL_BOTH));
- // TODO 3.1 put filename on model
- String name = model.getSource().getName();
- TaskAttachmentMapper taskAttachment = TaskAttachmentMapper.createFrom(model.getAttribute());
- if (taskAttachment.getFileName() != null) {
- name = taskAttachment.getFileName();
- }
- label.setText(MessageFormat.format(
- Messages.AttachmentPreviewPage_A_preview_the_type_X_is_currently_not_available, name,
- model.getContentType()));
- }
-
- private void createImagePreview(Composite composite, final Image bufferedImage) {
- scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- scrolledComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
- scrolledComposite.setExpandHorizontal(true);
- scrolledComposite.setExpandVertical(true);
-
- Composite canvasComposite = new Composite(scrolledComposite, SWT.NONE);
- canvasComposite.setLayout(GridLayoutFactory.fillDefaults().create());
- Canvas canvas = new Canvas(canvasComposite, SWT.NO_BACKGROUND);
- final Rectangle imgSize = bufferedImage.getBounds();
- canvas.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).hint(
- imgSize.width, imgSize.height).create());
- canvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- event.gc.drawImage(bufferedImage, 0, 0);
- }
- });
- canvas.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- bufferedImage.dispose();
- }
- });
- canvas.setSize(imgSize.width, imgSize.height);
- scrolledComposite.setMinSize(imgSize.width, imgSize.height);
- scrolledComposite.setContent(canvasComposite);
- scrolledComposite.addControlListener(new ControlAdapter() {
- @Override
- public void controlResized(ControlEvent event) {
- adjustScrollbars(imgSize);
- }
-
- });
- adjustScrollbars(imgSize);
- }
-
- private void createTextPreview(Composite composite, String contents) {
- Text text = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = composite.getBounds().y;
- gd.widthHint = composite.getBounds().x;
- text.setLayoutData(gd);
- text.setText(contents);
- }
-
- private Object getContent(final Composite composite) {
- final Object result[] = new Object[1];
- try {
- getContainer().run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(Messages.AttachmentPreviewPage_Preparing_preview, IProgressMonitor.UNKNOWN);
- final InputStream in = model.getSource().createInputStream(monitor);
- try {
- if (isTextAttachment()) {
- StringBuilder content = new StringBuilder();
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- String line;
- while ((line = reader.readLine()) != null && content.length() < MAX_TEXT_SIZE
- && !monitor.isCanceled()) {
- content.append(line);
- content.append("\n"); //$NON-NLS-1$
- }
- result[0] = content.toString();
- } else if (isImageAttachment()) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- // Uses double buffering to paint the image; there was a weird behavior
- // with transparent images and flicker with large images
- Image originalImage = new Image(getShell().getDisplay(), in);
- final Image bufferedImage = new Image(getShell().getDisplay(),
- originalImage.getBounds());
- GC gc = new GC(bufferedImage);
- gc.setBackground(composite.getBackground());
- gc.fillRectangle(originalImage.getBounds());
- gc.drawImage(originalImage, 0, 0);
- gc.dispose();
- originalImage.dispose();
- result[0] = bufferedImage;
- }
- });
- }
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- } finally {
- try {
- in.close();
- } catch (IOException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Failed to close file", e)); //$NON-NLS-1$
- }
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InvocationTargetException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Error generating preview", e)); //$NON-NLS-1$
- createErrorPreview(composite, Messages.AttachmentPreviewPage_Could_not_create_preview);
- return null;
- } catch (InterruptedException e) {
- return null;
- }
- return result[0];
- }
-
- private boolean isImageAttachment() {
- return imageTypes.contains(model.getContentType());
- }
-
- private boolean isTextAttachment() {
- return textTypes.contains(model.getContentType());
- }
-
- public boolean runInBackground() {
- return runInBackgroundButton.getSelection();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentSourcePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentSourcePage.java
deleted file mode 100644
index 719deb43a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/AttachmentSourcePage.java
+++ /dev/null
@@ -1,640 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Sebastian Davids <sdavids@gmx.de> - layout tweaks
- * Jeff Pound - modified for attachment input
- * Chris Aniszczyk <caniszczyk@gmail.com> - bug 20957
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.io.File;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard.ClipboardTaskAttachmentSource;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceComparator;
-
-/**
- * A wizard to input the source of the attachment.
- * <p>
- * Based on org.eclipse.compare.internal.InputPatchPage.
- */
-public class AttachmentSourcePage extends WizardPage {
-
- // constants
- protected static final int SIZING_TEXT_FIELD_WIDTH = 250;
-
- protected static final int COMBO_HISTORY_LENGTH = 5;
-
- // input constants
- protected final static int CLIPBOARD = 1;
-
- protected final static int FILE = 2;
-
- protected final static int WORKSPACE = 3;
-
- protected final static int SCREENSHOT = 4;
-
- static final char SEPARATOR = System.getProperty("file.separator").charAt(0); //$NON-NLS-1$
-
- private boolean showError = false;
-
- // SWT widgets
- private Button useClipboardButton;
-
-// private Button useScreenshotButton;
-
- private Combo fileNameField;
-
- private Button fileBrowseButton;
-
- private Button useFileButton;
-
- private Button useWorkspaceButton;
-
- private Label workspaceSelectLabel;
-
- private TreeViewer treeViewer;
-
- private String clipboardContents;
-
- private boolean initUseClipboard = false;
-
- private final String DIALOG_SETTINGS = "InputAttachmentSourcePage"; //$NON-NLS-1$
-
- private final String S_LAST_SELECTION = "lastSelection"; //$NON-NLS-1$
-
- private final TaskAttachmentModel model;
-
- public AttachmentSourcePage(TaskAttachmentModel model) {
- super("InputAttachmentPage"); //$NON-NLS-1$
- this.model = model;
- setTitle(Messages.AttachmentSourcePage_Select_attachment_source);
- setDescription(Messages.AttachmentSourcePage_Clipboard_supports_text_and_image_attachments_only);
- // setMessage("Please select the source for the attachment");
- }
-
- private void initialize(IDialogSettings settings) {
- String selection = settings.get(S_LAST_SELECTION);
- if (selection != null) {
- setInputMethod(Integer.valueOf(selection).intValue());
- } else {
- updateWidgetEnablements();
- }
- }
-
- /*
- * Get a path from the supplied text widget. @return
- * org.eclipse.core.runtime.IPath
- */
- protected IPath getPathFromText(Text textField) {
- return (new Path(textField.getText())).makeAbsolute();
- }
-
- public String getAttachmentName() {
- if (getInputMethod() == CLIPBOARD) {
- return Messages.AttachmentSourcePage__Clipboard_;
- } else if (getInputMethod() == WORKSPACE) {
- return getResources(treeViewer.getSelection())[0].getFullPath().toOSString();
- }
- return getAttachmentFilePath();
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
- gd.heightHint = 800;
- composite.setLayoutData(gd);
- setControl(composite);
-
- initializeDialogUnits(parent);
-
- createAttachmentFileGroup(composite);
-
- // No error for dialog opening
- showError = false;
- clearErrorMessage();
- initialize(getDialogSettings());
-
- Dialog.applyDialogFont(composite);
- }
-
- @Override
- public IWizardPage getNextPage() {
- model.setSource(getSource());
- saveDialogSettings();
- return super.getNextPage();
- }
-
- private void saveDialogSettings() {
- IDialogSettings settings = getDialogSettings();
- settings.put(S_LAST_SELECTION, getInputMethod());
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return isPageComplete();
- }
-
- private void setEnableAttachmentFile(boolean enable) {
- fileNameField.setEnabled(enable);
- fileBrowseButton.setEnabled(enable);
- }
-
- private void setEnableWorkspaceAttachment(boolean enable) {
- workspaceSelectLabel.setEnabled(enable);
- treeViewer.getTree().setEnabled(enable);
- }
-
- /*
- * Create the group for selecting the attachment file
- */
- private void createAttachmentFileGroup(Composite parent) {
- final Composite composite = new Composite(parent, SWT.NULL);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- composite.setLayout(gridLayout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new row
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- useFileButton = new Button(composite, SWT.RADIO);
- useFileButton.setText(Messages.AttachmentSourcePage_File);
-
- fileNameField = new Combo(composite, SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.widthHint = SIZING_TEXT_FIELD_WIDTH;
- fileNameField.setLayoutData(gd);
- fileNameField.setText(""); //$NON-NLS-1$
-
- fileBrowseButton = new Button(composite, SWT.PUSH);
- fileBrowseButton.setText(Messages.AttachmentSourcePage_Browse_);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- Point minSize = fileBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- data.widthHint = Math.max(widthHint, minSize.x);
- fileBrowseButton.setLayoutData(data);
-
- // new row
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 3;
- useClipboardButton = new Button(composite, SWT.RADIO);
- useClipboardButton.setText(Messages.AttachmentSourcePage_Clipboard);
- useClipboardButton.setLayoutData(gd);
- useClipboardButton.setSelection(initUseClipboard);
-
- // new row
- useWorkspaceButton = new Button(composite, SWT.RADIO);
- useWorkspaceButton.setText(Messages.AttachmentSourcePage_Workspace);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- useWorkspaceButton.setLayoutData(gd);
-
- addWorkspaceControls(parent);
-
- // Add listeners
- useClipboardButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (!useClipboardButton.getSelection()) {
- return;
- }
-
- clearErrorMessage();
- showError = true;
- storeClipboardContents();
- updateWidgetEnablements();
- }
- });
-
- useFileButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (!useFileButton.getSelection()) {
- return;
- }
- // If there is anything typed in at all
- clearErrorMessage();
- showError = (fileNameField.getText() != ""); //$NON-NLS-1$
- updateWidgetEnablements();
- }
- });
- fileNameField.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setSourceName(fileNameField.getText());
- updateWidgetEnablements();
- }
- });
- fileNameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- clearErrorMessage();
- showError = true;
- updateWidgetEnablements();
- }
- });
- fileBrowseButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- clearErrorMessage();
- showError = true;
- /* Launch Browser */
- FileDialog fileChooser = new FileDialog(composite.getShell(), SWT.OPEN);
- String file = fileChooser.open();
-
- // Check if the dialog was canceled or an error occured
- if (file == null) {
- return;
- }
- // update UI
- fileNameField.setText(file);
- updateWidgetEnablements();
- }
- });
- useWorkspaceButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (!useWorkspaceButton.getSelection()) {
- return;
- }
- clearErrorMessage();
- // If there is anything typed in at all
- showError = (!treeViewer.getSelection().isEmpty());
- updateWidgetEnablements();
- }
- });
-
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- clearErrorMessage();
- updateWidgetEnablements();
- }
- });
-
- treeViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof TreeSelection) {
- TreeSelection treeSel = (TreeSelection) selection;
- Object res = treeSel.getFirstElement();
- if (res != null) {
- if (res instanceof IProject || res instanceof IFolder) {
- if (treeViewer.getExpandedState(res)) {
- treeViewer.collapseToLevel(res, 1);
- } else {
- treeViewer.expandToLevel(res, 1);
- }
- } else if (res instanceof IFile) {
- getContainer().showPage(getNextPage());
- }
- }
- }
- }
- });
-
- useFileButton.setSelection(!initUseClipboard);
- setEnableWorkspaceAttachment(false);
- }
-
- private void addWorkspaceControls(Composite composite) {
-
- Composite newComp = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout(1, false);
- layout.marginLeft = 16; // align w/ lable of check button
- newComp.setLayout(layout);
- newComp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- workspaceSelectLabel = new Label(newComp, SWT.LEFT);
- workspaceSelectLabel.setText(Messages.AttachmentSourcePage_Select_the_location_of_the_attachment);
-
- treeViewer = new TreeViewer(newComp, SWT.BORDER);
- treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- treeViewer.setLabelProvider(new WorkbenchLabelProvider());
- treeViewer.setContentProvider(new WorkbenchContentProvider());
- treeViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
- treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
- }
-
- /**
- * Updates the enable state of this page's controls.
- */
- private void updateWidgetEnablements() {
-
- String error = null;
-
- boolean attachmentFound = false;
- int inputMethod = getInputMethod();
- if (inputMethod == CLIPBOARD) {
- if (ClipboardTaskAttachmentSource.isSupportedType(getControl().getDisplay())) {
- attachmentFound = true;
- } else {
- error = Messages.AttachmentSourcePage_Clipboard_contains_an_unsupported_data;
- }
- } else if (inputMethod == SCREENSHOT) {
- attachmentFound = true;
- } else if (inputMethod == FILE) {
- String path = fileNameField.getText();
- if (path != null && path.length() > 0) {
- File file = new File(path);
- attachmentFound = file.exists() && file.isFile() && file.length() > 0;
- if (!attachmentFound) {
- error = Messages.AttachmentSourcePage_Cannot_locate_attachment_file;
- }
- } else {
- error = Messages.AttachmentSourcePage_No_file_name;
- }
- } else if (inputMethod == WORKSPACE) {
- // Get the selected attachment file (tree will only allow for one
- // selection)
- IResource[] resources = getResources(treeViewer.getSelection());
- if (resources == null || resources.length <= 0) {
- error = Messages.AttachmentSourcePage_No_file_name;
- } else {
- IResource attachmentFile = resources[0];
- if (attachmentFile != null && attachmentFile.getType() == IResource.FILE) {
- File actualFile = attachmentFile.getRawLocation().toFile();
- attachmentFound = actualFile.exists() && actualFile.isFile() && actualFile.length() > 0;
- if (!attachmentFound) {
- error = Messages.AttachmentSourcePage_Cannot_locate_attachment_file;
- }
- }
- }
- }
-
- setPageComplete(attachmentFound);
-
- if (showError) {
- setErrorMessage(error);
- }
-
- setEnableAttachmentFile(inputMethod == FILE);
- setEnableWorkspaceAttachment(inputMethod == WORKSPACE);
- }
-
- /**
- * Sets the source name of the import to be the supplied path. Adds the name of the path to the list of items in the
- * source combo and selects it.
- *
- * @param path
- * the path to be added
- */
- protected void setSourceName(String path) {
-
- if (path.length() > 0) {
-
- String[] currentItems = fileNameField.getItems();
- int selectionIndex = -1;
- for (int i = 0; i < currentItems.length; i++) {
- if (currentItems[i].equals(path)) {
- selectionIndex = i;
- }
- }
-
- if (selectionIndex < 0) { // not found in history
- int oldLength = currentItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength] = path;
- fileNameField.setItems(newItems);
- selectionIndex = oldLength;
- }
- fileNameField.select(selectionIndex);
-
- // resetSelection();
- }
- }
-
- /*
- * Clears the dialog message box
- */
- private void clearErrorMessage() {
- setErrorMessage(null);
- }
-
- protected int getInputMethod() {
- if (useClipboardButton == null) {
- if (initUseClipboard) {
- return CLIPBOARD;
- }
- return FILE;
- }
- if (useClipboardButton.getSelection()) {
- return CLIPBOARD;
- }
- if (useFileButton.getSelection()) {
- return FILE;
- }
- return WORKSPACE;
- }
-
- protected void setInputMethod(int input) {
- switch (input) {
- case WORKSPACE:
- useWorkspaceButton.setSelection(true);
- useClipboardButton.setSelection(false);
- useFileButton.setSelection(false);
- break;
- case CLIPBOARD:
- storeClipboardContents();
-
- useClipboardButton.setSelection(true);
- useFileButton.setSelection(false);
- useWorkspaceButton.setSelection(false);
- break;
- default:
- useFileButton.setSelection(true);
- useWorkspaceButton.setSelection(false);
- useClipboardButton.setSelection(false);
- break;
- }
- updateWidgetEnablements();
- }
-
- private String getAttachmentFilePath() {
- if (fileNameField != null) {
- return fileNameField.getText();
- }
- return null;
- }
-
- public String getAbsoluteAttachmentPath() {
- switch (getInputMethod()) {
- case CLIPBOARD:
- return Messages.AttachmentSourcePage__Clipboard_;
- case SCREENSHOT:
- return Messages.AttachmentSourcePage__Screenshot_;
- case WORKSPACE:
- IResource[] resources = getResources(treeViewer.getSelection());
- if (resources.length > 0 && resources[0].getRawLocation() != null) {
- return resources[0].getRawLocation().toOSString();
- } else {
- return null;
- }
- case FILE:
- default:
- return getAttachmentFilePath();
- }
- }
-
- /*
- * Based on .eclipse.compare.internal.Utilities
- *
- * Convenience method: extract all accessible <code>IResources</code> from
- * given selection. Never returns null.
- */
- public static IResource[] getResources(ISelection selection) {
- ArrayList<IResource> tmp = new ArrayList<IResource>();
- Class<?> type = IResource.class;
- if (selection instanceof IStructuredSelection) {
- Object[] s = ((IStructuredSelection) selection).toArray();
-
- for (Object o : s) {
- IResource resource = null;
- if (type.isInstance(o)) {
- resource = (IResource) o;
-
- } else if (o instanceof ResourceMapping) {
- try {
- ResourceTraversal[] travs = ((ResourceMapping) o).getTraversals(
- ResourceMappingContext.LOCAL_CONTEXT, null);
- if (travs != null) {
- for (ResourceTraversal trav : travs) {
- IResource[] resources = trav.getResources();
- for (IResource resource2 : resources) {
- if (type.isInstance(resource2) && resource2.isAccessible()) {
- tmp.add(resource2);
- }
- }
- }
- }
- } catch (CoreException ex) {
- // TODO handle error
- }
- } else if (o instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) o;
- Object adapter = a.getAdapter(IResource.class);
- if (type.isInstance(adapter)) {
- resource = (IResource) adapter;
- }
- }
-
- if (resource != null && resource.isAccessible()) {
- tmp.add(resource);
- }
- }
- }
-
- return tmp.toArray(new IResource[tmp.size()]);
- }
-
- private void storeClipboardContents() {
- Control c = getControl();
- if (c != null) {
- Clipboard clipboard = new Clipboard(c.getDisplay());
- Object o = clipboard.getContents(TextTransfer.getInstance());
- clipboard.dispose();
- if (o instanceof String) {
- clipboardContents = ((String) o).trim();
- }
- }
- }
-
- public String getClipboardContents() {
- return clipboardContents;
- }
-
- public void setClipboardContents(String attachContents) {
- clipboardContents = attachContents;
- }
-
- public void setUseClipboard(boolean b) {
- if (useClipboardButton != null) {
- useClipboardButton.setSelection(b);
- }
- initUseClipboard = b;
- }
-
- @Override
- protected IDialogSettings getDialogSettings() {
- TasksUiPlugin plugin = TasksUiPlugin.getDefault();
- IDialogSettings settings = plugin.getDialogSettings();
- IDialogSettings section = settings.getSection(DIALOG_SETTINGS);
- if (section == null) {
- section = settings.addNewSection(DIALOG_SETTINGS);
- }
- return section;
- }
-
- public AbstractTaskAttachmentSource getSource() {
- switch (getInputMethod()) {
- case CLIPBOARD:
- return new TaskAttachmentWizard.ClipboardTaskAttachmentSource();
- case WORKSPACE:
- IResource[] resources = getResources(treeViewer.getSelection());
- if (resources.length > 0) {
- return new FileTaskAttachmentSource(resources[0].getLocation().toFile());
- } else {
- return null;
- }
- default: // FILE
- return new FileTaskAttachmentSource(new File(getAttachmentFilePath()));
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java
deleted file mode 100644
index 04c17a240..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.ui.RefactorRepositoryUrlOperation;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * @author Mik Kersten
- */
-public class EditRepositoryWizard extends Wizard implements INewWizard {
-
- private ITaskRepositoryPage settingsPage;
-
- private final TaskRepository repository;
-
- public EditRepositoryWizard(TaskRepository repository) {
- this.repository = repository;
- setNeedsProgressMonitor(true);
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY_SETTINGS);
- setWindowTitle(Messages.EditRepositoryWizard_Properties_for_Task_Repository);
- }
-
- /**
- * Custom properties should be set on the repository object to ensure they are saved.
- */
- @Override
- public boolean performFinish() {
- if (canFinish()) {
- String oldUrl = repository.getRepositoryUrl();
- String newUrl = settingsPage.getRepositoryUrl();
- if (oldUrl != null && newUrl != null && !oldUrl.equals(newUrl)) {
- TasksUi.getTaskActivityManager().deactivateActiveTask();
-
- RefactorRepositoryUrlOperation operation = new RefactorRepositoryUrlOperation(oldUrl, newUrl);
- try {
- getContainer().run(true, false, operation);
- } catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- Messages.EditRepositoryWizard_Failed_to_refactor_repository_urls));
- return false;
- } catch (InterruptedException e) {
- // should not get here
- }
- }
-
- repository.flushAuthenticationCredentials();
-
- if (!repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND)) {
- repository.setRepositoryUrl(newUrl);
- }
- settingsPage.applyTo(repository);
- if (oldUrl != null && newUrl != null && !oldUrl.equals(newUrl)) {
- TasksUiPlugin.getRepositoryManager().notifyRepositoryUrlChanged(repository, oldUrl);
- }
- TasksUiPlugin.getRepositoryManager().notifyRepositorySettingsChanged(repository);
- TasksUiPlugin.getExternalizationManager().requestSave();
- return true;
- }
- return false;
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-
- @Override
- public void addPages() {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
- settingsPage = connectorUi.getSettingsPage(repository);
- if (settingsPage instanceof AbstractRepositorySettingsPage) {
- ((AbstractRepositorySettingsPage) settingsPage).setRepository(repository);
- ((AbstractRepositorySettingsPage) settingsPage).setVersion(repository.getVersion());
- }
- settingsPage.setWizard(this);
- addPage(settingsPage);
- }
-
- @Override
- public boolean canFinish() {
- return settingsPage.isPageComplete();
- }
-
- /** public for testing */
- public ITaskRepositoryPage getSettingsPage() {
- return settingsPage;
- }
-
- public TaskRepository getRepository() {
- return repository;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/LocalRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/LocalRepositorySettingsPage.java
deleted file mode 100644
index d498d7502..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/LocalRepositorySettingsPage.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractTaskRepositoryPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-
-/**
- * A settings page for the local repository properties dialog. Local repositories have no settings, however they may
- * have settings contributed via the taskRepositoryPageContribution.
- *
- * @author David Green
- */
-public class LocalRepositorySettingsPage extends AbstractTaskRepositoryPage {
-
- public LocalRepositorySettingsPage(TaskRepository taskRepository) {
- super(Messages.LocalRepositorySettingsPage_Local_Repository_Settings, Messages.LocalRepositorySettingsPage_Configure_the_local_repository, taskRepository);
- }
-
- @Override
- public String getConnectorKind() {
- return LocalRepositoryConnector.CONNECTOR_KIND;
- }
-
- public String getRepositoryUrl() {
- return LocalRepositoryConnector.REPOSITORY_URL;
- }
-
- @Override
- protected void createSettingControls(Composite parent) {
- // nothing to do, since the local repository has no settings
- }
-
- @Override
- protected IStatus validate() {
- // nothing to do
- return null;
- }
-
- @Override
- protected void createContributionControls(Composite parentControl) {
- super.createContributionControls(parentControl);
- // expand the first contribution since we have no other settings
- Control[] children = parentControl.getChildren();
- if (children.length > 0) {
- if (children[0] instanceof ExpandableComposite) {
- ((ExpandableComposite) children[0]).setExpanded(true);
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
deleted file mode 100644
index 618ca3e54..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.wizards.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String EditRepositoryWizard_Failed_to_refactor_repository_urls;
-
- public static String EditRepositoryWizard_Properties_for_Task_Repository;
-
- public static String AttachmentSourcePage__Clipboard_;
-
- public static String AttachmentSourcePage__Screenshot_;
-
- public static String AttachmentSourcePage_Browse_;
-
- public static String AttachmentSourcePage_Cannot_locate_attachment_file;
-
- public static String AttachmentSourcePage_Clipboard;
-
- public static String AttachmentSourcePage_Clipboard_contains_an_unsupported_data;
-
- public static String AttachmentSourcePage_Clipboard_supports_text_and_image_attachments_only;
-
- public static String AttachmentSourcePage_File;
-
- public static String AttachmentSourcePage_No_file_name;
-
- public static String AttachmentSourcePage_Select_attachment_source;
-
- public static String AttachmentSourcePage_Select_the_location_of_the_attachment;
-
- public static String AttachmentSourcePage_Workspace;
-
- public static String NewQueryWizard_New_Repository_Query;
-
- public static String NewTaskWizard_New_Task;
-
- public static String NewWebTaskPage_Create_via_Web_Browser;
-
- public static String NewWebTaskPage_New_Task;
-
- public static String NewWebTaskPage_Once_submitted_synchronize_queries_or_add_the_task_to_a_category;
-
- public static String NewWebTaskPage_This_will_open_a_web_browser_that_can_be_used_to_create_a_new_task;
-
- public static String AttachmentPreviewPage_A_preview_the_type_X_is_currently_not_available;
-
- public static String AttachmentPreviewPage_Attachment_Preview;
-
- public static String AttachmentPreviewPage_Could_not_create_preview;
-
- public static String AttachmentPreviewPage_Preparing_preview;
-
- public static String AttachmentPreviewPage_Review_the_attachment_before_submitting;
-
- public static String AttachmentPreviewPage_Run_in_background;
-
- public static String SelectRepositoryConnectorPage_Select_a_task_repository_type;
-
- public static String SelectRepositoryConnectorPage_You_can_connect_to_an_existing_account_using_one_of_the_installed_connectors;
-
- public static String SelectRepositoryPage_Add_new_repositories_using_the_X_view;
-
- public static String SelectRepositoryPage_Select_a_repository;
-
- public static String TaskAttachmentWizard_Add_Attachment;
-
- public static String TaskAttachmentWizard_Attach_Screenshot;
-
- public static String TaskAttachmentWizard_Attaching_context;
-
- public static String TaskAttachmentWizard_Attachment_Failed;
-
- public static String TaskAttachmentWizard_Screenshot;
-
- public static String TaskDataExportWizard_Export;
-
- public static String TaskDataExportWizard_export_failed;
-
- public static String TaskDataExportWizardPage_Browse_;
-
- public static String TaskDataExportWizardPage_Export_Mylyn_Task_Data;
-
- public static String TaskDataExportWizardPage_File;
-
- public static String TaskDataExportWizardPage_Folder;
-
- public static String TaskDataExportWizardPage_Folder_Selection;
-
- public static String TaskDataExportWizardPage_Please_choose_an_export_destination;
-
- public static String TaskDataExportWizardPage_Specify_the_destination_folder_for_task_data;
-
- public static String TaskDataImportWizard_confirm_overwrite;
-
- public static String TaskDataImportWizard_could_not_be_found;
-
- public static String TaskDataImportWizard_existing_task_data_about_to_be_erased_proceed;
-
- public static String TaskDataImportWizard_File_not_found;
-
- public static String TaskDataImportWizard_Import;
-
- public static String TaskDataImportWizard_Import_Error;
-
- public static String TaskDataImportWizard_Importing_Data;
-
- public static String TaskDataImportWizard_task_data_import_failed;
-
- public static String TaskDataImportWizardPage_Restore_tasks_from_history;
-
- public static String TaskDataImportWizardPage_Browse_;
-
- public static String TaskDataImportWizardPage_From_snapshot;
-
- public static String TaskDataImportWizardPage_From_zip_file;
-
- public static String TaskDataImportWizardPage_Import_method_backup;
-
- public static String TaskDataImportWizardPage_Import_method_zip;
-
- public static String TaskDataImportWizardPage_Import_Settings_saved;
-
- public static String TaskDataImportWizardPage_Import_Source_zip_file_setting;
-
- public static String TaskDataImportWizardPage_Importing_overwrites_current_tasks_and_repositories;
-
- public static String TaskDataImportWizardPage__unspecified_;
-
- public static String TaskDataImportWizardPage_Zip_File_Selection;
-
- public static String AbstractRepositoryQueryPage_A_category_with_this_name_already_exists;
-
- public static String AbstractRepositoryQueryPage_Enter_query_parameters;
-
- public static String AbstractRepositoryQueryPage_If_attributes_are_blank_or_stale_press_the_Update_button;
-
- public static String AbstractRepositoryQueryPage_Please_specify_a_title_for_the_query;
-
- public static String AbstractRepositoryQueryPage_A_query_with_this_name_already_exists;
-
- public static String AbstractRepositorySettingsPage_Additional_Settings;
-
- public static String AbstractRepositorySettingsPage_Anonymous_Access;
-
- public static String AbstractRepositorySettingsPage_Authentication_credentials_are_valid;
-
- public static String AbstractRepositorySettingsPage_Change_account_settings;
-
- public static String AbstractRepositorySettingsPage_Change_Settings;
-
- public static String AbstractRepositorySettingsPage_Character_encoding;
-
- public static String AbstractRepositorySettingsPage_Create_new_account;
-
- public static String AbstractRepositorySettingsPage_Default__;
-
- public static String AbstractRepositorySettingsPage_Disconnected;
-
- public static String AbstractRepositorySettingsPage_Enable_http_authentication;
-
- public static String AbstractRepositorySettingsPage_Enable_proxy_authentication;
-
- public static String AbstractRepositorySettingsPage_Enter_a_valid_server_url;
-
- public static String AbstractRepositorySettingsPage_Http_Authentication;
-
- public static String AbstractRepositorySettingsPage_Internal_error_validating_repository;
-
- public static String AbstractRepositorySettingsPage_Label_;
-
- public static String AbstractRepositorySettingsPage_Other;
-
- public static String AbstractRepositorySettingsPage_Password_;
-
- public static String AbstractRepositorySettingsPage_Problems_encountered_determining_available_charsets;
-
- public static String AbstractRepositorySettingsPage_Proxy_host_address_;
-
- public static String AbstractRepositorySettingsPage_Proxy_host_port_;
-
- public static String AbstractRepositorySettingsPage_Proxy_Server_Configuration;
-
- public static String AbstractRepositorySettingsPage_Repository_already_exists;
-
- public static String AbstractRepositorySettingsPage_Repository_is_valid;
-
- public static String AbstractRepositorySettingsPage_Repository_url_is_invalid;
-
- public static String AbstractRepositorySettingsPage_Repository_user_name_and_password_must_not_be_blank;
-
- public static String AbstractRepositorySettingsPage_Save_Password;
-
- public static String AbstractRepositorySettingsPage_Server_;
-
- public static String AbstractRepositorySettingsPage_Unable_to_authenticate_with_repository;
-
- public static String AbstractRepositorySettingsPage_Use_global_Network_Connections_preferences;
-
- public static String AbstractRepositorySettingsPage_User_ID_;
-
- public static String AbstractRepositorySettingsPage_Validate_Settings;
-
- public static String AbstractRepositorySettingsPage_Validating_server_settings;
-
- public static String NewTaskWizard_Create_Task;
-
- public static String NewTaskWizard_Error_creating_new_task;
-
- public static String NewTaskWizard_Failed_to_create_new_task_;
-
- public static String NewWebTaskWizard_New_Task;
-
- public static String NewWebTaskWizard_This_connector_does_not_provide_a_rich_task_editor_for_creating_tasks;
-
- public static String RepositoryQueryWizard_Edit_Repository_Query;
-
- public static String TaskAttachmentPage_ATTACHE_CONTEXT;
-
- public static String TaskAttachmentPage_Attachment_Details;
-
- public static String TaskAttachmentPage_Comment;
-
- public static String TaskAttachmentPage_Content_Type;
-
- public static String TaskAttachmentPage_Description;
-
- public static String TaskAttachmentPage_Enter_a_description;
-
- public static String TaskAttachmentPage_Enter_a_file_name;
-
- public static String TaskAttachmentPage_File;
-
- public static String TaskAttachmentPage_Patch;
-
- public static String TaskAttachmentPage_Verify_the_content_type_of_the_attachment;
-
- public static String AbstractTaskRepositoryPage_Validation_failed;
-
- public static String LocalRepositorySettingsPage_Configure_the_local_repository;
-
- public static String LocalRepositorySettingsPage_Local_Repository_Settings;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java
deleted file mode 100644
index 5b04dd860..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/MultiRepositoryAwareWizard.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Brock Janiczak - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * @author Mik Kersten
- * @author Brock Janiczak
- */
-public class MultiRepositoryAwareWizard extends Wizard implements INewWizard {
-
- private final SelectRepositoryPage selectRepositoryPage;
-
- public MultiRepositoryAwareWizard(SelectRepositoryPage page, String title) {
- selectRepositoryPage = page;
- setForcePreviousAndNextButtons(true);
- setNeedsProgressMonitor(true);
- setWindowTitle(title);
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // ignore
- }
-
- @Override
- public void addPages() {
- addPage(selectRepositoryPage);
- }
-
- @Override
- public boolean canFinish() {
- return selectRepositoryPage.canFinish();
- }
-
- @Override
- public boolean performFinish() {
- return selectRepositoryPage.performFinish();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizardDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizardDialog.java
deleted file mode 100644
index a6ddbbfee..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewAttachmentWizardDialog.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jeff Pound and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jeff Pound - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Jeff Pound
- */
-public class NewAttachmentWizardDialog extends WizardDialog {
-
- private static final String ATTACHMENT_WIZARD_SETTINGS_SECTION = "PatchWizard"; //$NON-NLS-1$
-
- public NewAttachmentWizardDialog(Shell parent, IWizard wizard, boolean modal) {
- super(parent, wizard);
-
- if (modal) {
- setShellStyle(getShellStyle() | SWT.RESIZE);
- } else {
- setShellStyle(SWT.MODELESS | SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.RESIZE);
- }
- setMinimumPageSize(600, 300);
- setPageSize(600, 300);
- setBlockOnOpen(modal);
- }
-
- @Override
- protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = TasksUiPlugin.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(ATTACHMENT_WIZARD_SETTINGS_SECTION);
- if (section == null) {
- section = settings.addNewSection(ATTACHMENT_WIZARD_SETTINGS_SECTION);
- }
- return section;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalCategoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalCategoryWizard.java
deleted file mode 100644
index 2e0289bc2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalCategoryWizard.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewCategoryAction;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * @author Mik Kersten
- */
-public class NewLocalCategoryWizard extends Wizard implements INewWizard {
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- setForcePreviousAndNextButtons(false);
- }
-
- @Override
- public boolean canFinish() {
- return true;
- }
-
- @Override
- public boolean performFinish() {
- new NewCategoryAction().run();
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalTaskWizard.java
deleted file mode 100644
index 39e54183c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewLocalTaskWizard.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class NewLocalTaskWizard extends Wizard implements INewWizard {
-
- private final ITaskMapping taskSelection;
-
- public NewLocalTaskWizard(ITaskMapping taskSelection) {
- this.taskSelection = taskSelection;
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- setNeedsProgressMonitor(true);
- }
-
- public NewLocalTaskWizard() {
- this(null);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- setForcePreviousAndNextButtons(false);
- }
-
- @Override
- public void addPages() {
- // ignore
- }
-
- @Override
- public boolean canFinish() {
- return true;
- }
-
- @Override
- public boolean performFinish() {
- LocalTask task = TasksUiInternal.createNewLocalTask(null);
- if (taskSelection != null) {
- if (taskSelection.getSummary() != null) {
- task.setSummary(taskSelection.getSummary());
- }
- if (taskSelection.getDescription() != null) {
- task.setNotes(taskSelection.getDescription());
- }
- }
- TasksUiUtil.openTask(task);
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewQueryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewQueryWizard.java
deleted file mode 100644
index 866abe6dc..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewQueryWizard.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-
-/**
- * @author Mik Kersten
- * @author Eugene Kuleshov
- */
-public class NewQueryWizard extends MultiRepositoryAwareWizard {
-
- public NewQueryWizard() {
- super(new SelectRepositoryPageForNewQuery(), Messages.NewQueryWizard_New_Repository_Query);
- }
-
- private static final class SelectRepositoryPageForNewQuery extends SelectRepositoryPage {
- public SelectRepositoryPageForNewQuery() {
- super(ITaskRepositoryFilter.CAN_QUERY);
- }
-
- @Override
- protected IWizard createWizard(TaskRepository taskRepository) {
- AbstractRepositoryConnectorUi repositoryUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
- return repositoryUi.getQueryWizard(taskRepository, null);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizard.java
deleted file mode 100644
index 2505b4688..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewRepositoryWizard.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Peter Stibrany - fix for NPE (bug 247077)
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.util.Collection;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.AddRepositoryAction;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class NewRepositoryWizard extends Wizard implements INewWizard {
-
- private AbstractRepositoryConnector connector;
-
- /**
- * If not null, indicates that the wizard will initially jump to a specific connector page
- */
- private final String connectorKind;
-
- private TaskRepository taskRepository;
-
- private SelectRepositoryConnectorPage selectConnectorPage;
-
- private ITaskRepositoryPage settingsPage;
-
- private String lastConnectorKind;
-
- public NewRepositoryWizard() {
- this(null);
- }
-
- public NewRepositoryWizard(String connectorKind) {
- this.connectorKind = connectorKind;
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- setForcePreviousAndNextButtons(true);
- setNeedsProgressMonitor(true);
- setWindowTitle(AddRepositoryAction.TITLE);
- }
-
- @Override
- public void addPages() {
- Collection<AbstractRepositoryConnector> connectors = TasksUi.getRepositoryManager().getRepositoryConnectors();
- if (connectorKind != null || connectors.size() == 1) {
- if (connectorKind != null) {
- connector = TasksUi.getRepositoryManager().getRepositoryConnector(connectorKind);
- } else {
- connector = connectors.toArray(new AbstractRepositoryConnector[1])[0];
- }
- updateSettingsPage();
- addPage(settingsPage);
- } else {
- selectConnectorPage = new SelectRepositoryConnectorPage();
- addPage(selectConnectorPage);
- }
- }
-
- @Override
- public boolean canFinish() {
- return (selectConnectorPage == null || selectConnectorPage.isPageComplete())
- && !(getContainer().getCurrentPage() == selectConnectorPage) && settingsPage != null
- && settingsPage.isPageComplete();
- }
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- if (page == selectConnectorPage) {
- connector = selectConnectorPage.getConnector();
- updateSettingsPage();
- return settingsPage;
- }
- return super.getNextPage(page);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-
- @Override
- public boolean performFinish() {
- if (canFinish()) {
- taskRepository = new TaskRepository(connector.getConnectorKind(), settingsPage.getRepositoryUrl());
- settingsPage.applyTo(taskRepository);
- TasksUi.getRepositoryManager().addRepository(taskRepository);
- return true;
- }
- return false;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- private void updateSettingsPage() {
- assert connector != null;
- if (!connector.getConnectorKind().equals(lastConnectorKind)) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(connector.getConnectorKind());
- settingsPage = connectorUi.getSettingsPage(null);
- settingsPage.setWizard(this);
- lastConnectorKind = connector.getConnectorKind();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskPage.java
deleted file mode 100644
index 4e56a55ee..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskPage.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-
-/**
- * @author Mik Kersten
- * @author Eugene Kuleshov
- */
-public class NewTaskPage extends SelectRepositoryPage {
-
- private final ITaskMapping taskSelection;
-
- public NewTaskPage(ITaskRepositoryFilter taskRepositoryFilter, ITaskMapping taskSelection) {
- super(taskRepositoryFilter);
- this.taskSelection = taskSelection;
- }
-
- @Override
- protected IWizard createWizard(TaskRepository taskRepository) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
- return connectorUi.getNewTaskWizard(taskRepository, taskSelection);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskWizard.java
deleted file mode 100644
index 2619fff08..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewTaskWizard.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.ui.INewWizard;
-
-/**
- * @author Mik Kersten
- * @author Eugene Kuleshov
- * @author Steffen Pingel
- */
-// TODO 3.1 rename this class, the name conflicts with org.eclipse.mylyn.tasks.ui.wizards.NewTaskWizard
-public class NewTaskWizard extends MultiRepositoryAwareWizard implements INewWizard {
-
- public NewTaskWizard(ITaskMapping taskSelection) {
- super(new NewTaskPage(ITaskRepositoryFilter.CAN_CREATE_NEW_TASK, taskSelection), Messages.NewTaskWizard_New_Task);
- setNeedsProgressMonitor(true);
- }
-
- /**
- * Constructs a new task wizard with an empty selection. This constructor is used by the
- * <code>org.eclipse.ui.newWizards</code> extension.
- */
- public NewTaskWizard() {
- this(null);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewWebTaskPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewWebTaskPage.java
deleted file mode 100644
index def044a58..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/NewWebTaskPage.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Wizard page for creating new tickets through a web browser.
- *
- * @author Eugene Kuleshov
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class NewWebTaskPage extends WizardPage {
-
- public NewWebTaskPage(ITaskMapping taskSelection) {
- super(Messages.NewWebTaskPage_New_Task);
-
- setTitle(Messages.NewWebTaskPage_Create_via_Web_Browser);
- setDescription(Messages.NewWebTaskPage_This_will_open_a_web_browser_that_can_be_used_to_create_a_new_task);
-
- // TODO display selection
- }
-
- public void createControl(Composite parent) {
- Text text = new Text(parent, SWT.WRAP);
- text.setEditable(false);
- text.setText(Messages.NewWebTaskPage_Once_submitted_synchronize_queries_or_add_the_task_to_a_category);
- setControl(text);
- Dialog.applyDialogFont(text);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryConnectorPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryConnectorPage.java
deleted file mode 100644
index 057e2a90c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryConnectorPage.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesSorter;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoryLabelProvider;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author Mik Kersten
- */
-public class SelectRepositoryConnectorPage extends WizardPage {
-
- private TableViewer viewer;
-
- private AbstractRepositoryConnector connector;
-
- static class RepositoryContentProvider implements IStructuredContentProvider {
-
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object parent) {
- List<AbstractRepositoryConnector> userManagedRepositories = new ArrayList<AbstractRepositoryConnector>();
- for (AbstractRepositoryConnector connector : TasksUi.getRepositoryManager().getRepositoryConnectors()) {
- if (connector.isUserManaged()) {
- userManagedRepositories.add(connector);
- }
- }
-
- return userManagedRepositories.toArray();
- }
- }
-
- public SelectRepositoryConnectorPage() {
- super(Messages.SelectRepositoryConnectorPage_Select_a_task_repository_type);
- setTitle(Messages.SelectRepositoryConnectorPage_Select_a_task_repository_type);
- setDescription(Messages.SelectRepositoryConnectorPage_You_can_connect_to_an_existing_account_using_one_of_the_installed_connectors);
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return connector != null;
- }
-
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- FillLayout layout = new FillLayout();
- container.setLayout(layout);
-
- viewer = new TableViewer(container, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new RepositoryContentProvider());
- viewer.setSorter(new TaskRepositoriesSorter());
- viewer.setLabelProvider(new TaskRepositoryLabelProvider());
- viewer.setInput(TasksUi.getRepositoryManager().getRepositoryConnectors());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection.getFirstElement() instanceof AbstractRepositoryConnector) {
- connector = (AbstractRepositoryConnector) selection.getFirstElement();
- setPageComplete(true);
- }
- }
-
- });
-
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- getContainer().showPage(getNextPage());
- }
- });
-
- Dialog.applyDialogFont(container);
- setControl(container);
- }
-
- public AbstractRepositoryConnector getConnector() {
- return connector;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryPage.java
deleted file mode 100644
index fe4ab7488..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/SelectRepositoryPage.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Brock Janiczak - improvements
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jface.wizard.WizardSelectionPage;
-import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.AddRepositoryAction;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesSorter;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoryLabelProvider;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Mik Kersten
- * @author Brock Janiczak
- * @author Steffen Pingel
- * @author Eugene Kuleshov
- */
-public abstract class SelectRepositoryPage extends WizardSelectionPage {
-
- private TableViewer viewer;
-
- protected MultiRepositoryAwareWizard wizard;
-
- private List<TaskRepository> repositories = new ArrayList<TaskRepository>();
-
- private final ITaskRepositoryFilter taskRepositoryFilter;
-
- class RepositoryContentProvider implements IStructuredContentProvider {
-
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object parent) {
- return repositories.toArray();
- }
- }
-
- public SelectRepositoryPage(ITaskRepositoryFilter taskRepositoryFilter) {
- super(Messages.SelectRepositoryPage_Select_a_repository);
-
- setTitle(Messages.SelectRepositoryPage_Select_a_repository);
- setDescription(MessageFormat.format(Messages.SelectRepositoryPage_Add_new_repositories_using_the_X_view,
- org.eclipse.mylyn.internal.tasks.ui.Messages.TasksUiPlugin_Task_Repositories));
-
- this.taskRepositoryFilter = taskRepositoryFilter;
- this.repositories = getTaskRepositories();
- }
-
- public List<TaskRepository> getTaskRepositories() {
- List<TaskRepository> repositories = new ArrayList<TaskRepository>();
- TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
- for (AbstractRepositoryConnector connector : repositoryManager.getRepositoryConnectors()) {
- Set<TaskRepository> connectorRepositories = repositoryManager.getRepositories(connector.getConnectorKind());
- for (TaskRepository repository : connectorRepositories) {
- if (taskRepositoryFilter.accept(repository, connector)) {
- repositories.add(repository);
- }
- }
- }
- return repositories;
- }
-
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout(1, true);
- container.setLayout(layout);
-
- Table table = createTableViewer(container);
- viewer.setSorter(new TaskRepositoriesSorter());
-
- GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- table.setLayoutData(gridData);
-
- final AddRepositoryAction action = new AddRepositoryAction();
- action.setPromptToAddQuery(false);
-
- Button button = new Button(container, SWT.NONE);
- button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
- button.setText(AddRepositoryAction.TITLE);
- button.setEnabled(action.isEnabled());
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- TaskRepository taskRepository = action.showWizard();
- if (taskRepository != null) {
- SelectRepositoryPage.this.repositories = getTaskRepositories();
- viewer.setInput(TasksUi.getRepositoryManager().getRepositoryConnectors());
- viewer.setSelection(new StructuredSelection(taskRepository));
- }
- }
- });
-
- Dialog.applyDialogFont(container);
- setControl(container);
- }
-
- protected Table createTableViewer(Composite container) {
- viewer = new TableViewer(container, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new RepositoryContentProvider());
- // viewer.setLabelProvider(new TaskRepositoryLabelProvider());
- viewer.setLabelProvider(new DecoratingLabelProvider(new TaskRepositoryLabelProvider(),
- PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- viewer.setInput(TasksUi.getRepositoryManager().getRepositoryConnectors());
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection.getFirstElement() instanceof TaskRepository) {
- setSelectedNode(new CustomWizardNode((TaskRepository) selection.getFirstElement()));
- setPageComplete(true);
- } else {
- setPageComplete(false);
- }
- }
- });
-
- TaskRepository selectedRepository = TasksUiUtil.getSelectedRepository(null);
- if (selectedRepository != null) {
- viewer.setSelection(new StructuredSelection(selectedRepository));
- } else {
- TaskRepository localRepository = TasksUi.getRepositoryManager().getRepository(
- LocalRepositoryConnector.CONNECTOR_KIND, LocalRepositoryConnector.REPOSITORY_URL);
- viewer.setSelection(new StructuredSelection(localRepository));
- }
-
- viewer.addOpenListener(new IOpenListener() {
-
- public void open(OpenEvent event) {
- if (canFlipToNextPage()) {
- getContainer().showPage(getNextPage());
- } else if (canFinish()) {
- if (getWizard().performFinish()) {
- ((WizardDialog) getContainer()).close();
- }
- }
- }
- });
-
- viewer.getTable().showSelection();
- viewer.getTable().setFocus();
- return viewer.getTable();
- }
-
- protected abstract IWizard createWizard(TaskRepository taskRepository);
-
- @Override
- public boolean canFlipToNextPage() {
- return getSelectedNode() != null && getNextPage() != null;
- }
-
- public boolean canFinish() {
- return getSelectedNode() != null && getNextPage() == null;
- }
-
- public boolean performFinish() {
- if (getSelectedNode() == null || getNextPage() != null) {
- // finish event will get forwarded to nested wizard
- // by container
- return false;
- }
-
- return getSelectedNode().getWizard().performFinish();
- }
-
- private class CustomWizardNode implements IWizardNode {
-
- private final TaskRepository repository;
-
- private IWizard wizard;
-
- public CustomWizardNode(TaskRepository repository) {
- this.repository = repository;
- }
-
- public void dispose() {
- if (wizard != null) {
- wizard.dispose();
- }
- }
-
- public Point getExtent() {
- return new Point(-1, -1);
- }
-
- public IWizard getWizard() {
- if (wizard == null) {
- wizard = SelectRepositoryPage.this.createWizard(repository);
- if (wizard != null) {
- wizard.setContainer(getContainer());
- }
- }
- return wizard;
- }
-
- public boolean isContentCreated() {
- return wizard != null;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof CustomWizardNode)) {
- return false;
- }
- CustomWizardNode that = (CustomWizardNode) obj;
- if (this == that) {
- return true;
- }
-
- return this.repository.getConnectorKind().equals(that.repository.getConnectorKind())
- && this.repository.getRepositoryUrl().equals(that.repository.getRepositoryUrl());
- }
-
- @Override
- public int hashCode() {
- return 31 * this.repository.getRepositoryUrl().hashCode() + this.repository.getConnectorKind().hashCode();
- }
-
- }
-
- /**
- * Public for testing.
- */
- public TableViewer getViewer() {
- return viewer;
- }
-
- /**
- * Public for testing.
- */
- public List<TaskRepository> getRepositories() {
- return repositories;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java
deleted file mode 100644
index 948ac59b3..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.ScreenshotCreationPage;
-import org.eclipse.mylyn.internal.tasks.core.sync.SubmitTaskAttachmentJob;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJobEvent;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJobListener;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageLoader;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A wizard to add a new attachment to a task report.
- *
- * @since 3.0
- * @author Steffen Pingel
- */
-public class TaskAttachmentWizard extends Wizard {
-
- static class ClipboardTaskAttachmentSource extends AbstractTaskAttachmentSource {
-
- private byte[] data;
-
- public static boolean isSupportedType(Display display) {
- Clipboard clipboard = new Clipboard(display);
- TransferData[] types = clipboard.getAvailableTypes();
- for (TransferData transferData : types) {
- List<Transfer> transfers = getTransfers();
- for (Transfer transfer : transfers) {
- if (transfer.isSupportedType(transferData)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private static List<Transfer> transfers;
-
- private static List<Transfer> getTransfers() {
- if (transfers != null) {
- return transfers;
- }
-
- transfers = new ArrayList<Transfer>();
- try {
- Class<?> clazz = Class.forName("org.eclipse.swt.dnd.ImageTransfer"); //$NON-NLS-1$
- Method method = clazz.getMethod("getInstance"); //$NON-NLS-1$
- if (method != null) {
- transfers.add((Transfer) method.invoke(null));
- }
- } catch (Exception e) {
- // ignore
- } catch (LinkageError e) {
- // ignore
- }
- transfers.add(TextTransfer.getInstance());
- return transfers;
- }
-
- private Object contents;
-
- public ClipboardTaskAttachmentSource() {
- BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), new Runnable() {
- public void run() {
- Clipboard clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
- List<Transfer> transfers = getTransfers();
- for (Transfer transfer : transfers) {
- contents = clipboard.getContents(transfer);
- if (contents != null) {
- break;
- }
- }
- clipboard.dispose();
- }
- });
- }
-
- @Override
- public InputStream createInputStream(IProgressMonitor monitor) throws CoreException {
- byte[] bytes = getData();
- if (bytes != null) {
- return new ByteArrayInputStream(data);
- }
- throw new CoreException(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Invalid content type.")); //$NON-NLS-1$
- }
-
- @Override
- public String getContentType() {
- if (contents instanceof String) {
- return "text/plain"; //$NON-NLS-1$
- } else if (contents instanceof ImageData) {
- return "image/png"; //$NON-NLS-1$
- }
- return "application/octet-stream"; //$NON-NLS-1$
- }
-
- @Override
- public String getDescription() {
- return null;
- }
-
- @Override
- public long getLength() {
- byte[] bytes = getData();
- return (bytes != null) ? bytes.length : -1;
- }
-
- private byte[] getData() {
- if (data == null) {
- if (contents instanceof String) {
- data = ((String) contents).getBytes();
- } else if (contents instanceof ImageData) {
- ImageLoader loader = new ImageLoader();
- loader.data = new ImageData[] { (ImageData) contents };
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- loader.save(out, SWT.IMAGE_PNG);
- data = out.toByteArray();
- }
- }
- return data;
- }
-
- @Override
- public String getName() {
- if (contents instanceof String) {
- return "clipboard.txt"; //$NON-NLS-1$
- } else if (contents instanceof ImageData) {
- return "clipboard.png"; //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public boolean isLocal() {
- return true;
- }
-
- };
-
- static class ImageSource extends AbstractTaskAttachmentSource {
-
- private File file;
-
- private final ScreenshotCreationPage page;
-
- public ImageSource(ScreenshotCreationPage page) {
- this.page = page;
- }
-
- @Override
- public InputStream createInputStream(IProgressMonitor monitor) throws CoreException {
- try {
- if (file == null || page.isImageDirty()) {
- Image image = page.createImage();
- page.setImageDirty(false);
- try {
- file = File.createTempFile("screenshot", ".png"); //$NON-NLS-1$ //$NON-NLS-2$
- file.deleteOnExit();
- ImageLoader loader = new ImageLoader();
- loader.data = new ImageData[] { image.getImageData() };
- // TODO create image in memory?
- FileOutputStream out = new FileOutputStream(file);
- try {
- loader.save(out, SWT.IMAGE_PNG);
- } finally {
- out.close();
- }
- } finally {
- image.dispose();
- }
- }
- return new FileInputStream(file);
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- }
-
- @Override
- public String getContentType() {
- return "image/png"; //$NON-NLS-1$
- }
-
- @Override
- public String getDescription() {
- return Messages.TaskAttachmentWizard_Screenshot;
- }
-
- @Override
- public long getLength() {
- return (file != null) ? file.length() : -1;
- }
-
- @Override
- public String getName() {
- return "screenshot.png"; //$NON-NLS-1$
- }
-
- @Override
- public boolean isLocal() {
- return true;
- }
-
- }
-
- public enum Mode {
- DEFAULT, SCREENSHOT
- }
-
- private static final String DIALOG_SETTINGS_KEY = "AttachmentWizard"; //$NON-NLS-1$
-
- private final AbstractRepositoryConnector connector;
-
- private IWizardPage editPage;
-
- private Mode mode = Mode.DEFAULT;
-
- private final TaskAttachmentModel model;
-
- private AttachmentPreviewPage previewPage;
-
- public TaskAttachmentWizard(TaskRepository taskRepository, ITask task, TaskAttribute taskAttachment) {
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(taskAttachment);
- this.model = new TaskAttachmentModel(taskRepository, task, taskAttachment);
- this.connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(taskRepository.getConnectorKind());
- setMode(Mode.DEFAULT);
- setNeedsProgressMonitor(true);
- setDialogSettings(TasksUiPlugin.getDefault().getDialogSettings().getSection(DIALOG_SETTINGS_KEY));
- }
-
- @Override
- public void addPages() {
- if (model.getSource() == null) {
- if (mode == Mode.SCREENSHOT) {
- ScreenshotCreationPage page = new ScreenshotCreationPage();
- model.setSource(new ImageSource(page));
- addPage(page);
- } else {
- addPage(new AttachmentSourcePage(model));
- }
- }
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(model.getTaskRepository()
- .getConnectorKind());
- editPage = connectorUi.getTaskAttachmentPage(model);
- addPage(editPage);
-
- previewPage = new AttachmentPreviewPage(model);
- addPage(previewPage);
- }
-
- public Mode getMode() {
- return mode;
- }
-
- public TaskAttachmentModel getModel() {
- return model;
- }
-
- public AbstractTaskAttachmentSource getSource() {
- return model.getSource();
- }
-
- private void handleDone(SubmitJob job) {
- if (job.getStatus() != null) {
- TasksUiInternal.displayStatus(Messages.TaskAttachmentWizard_Attachment_Failed, job.getStatus());
- }
- }
-
- @Override
- public boolean canFinish() {
- // InputAttachmentSourcePage relies on getNextPage() being called, do not allow wizard to finish on first page
- if (getContainer() != null && getContainer().getCurrentPage() instanceof AttachmentSourcePage) {
- return false;
- }
- return super.canFinish();
- }
-
- @Override
- public boolean performFinish() {
- SubmitJob job = TasksUiInternal.getJobFactory()
- .createSubmitTaskAttachmentJob(connector, model.getTaskRepository(), model.getTask(),
- model.getSource(), model.getComment(), model.getAttribute());
- final boolean attachContext = model.getAttachContext();
- job.addSubmitJobListener(new SubmitJobListener() {
- @Override
- public void done(SubmitJobEvent event) {
- // ignore
- }
-
- @Override
- public void taskSubmitted(SubmitJobEvent event, IProgressMonitor monitor) throws CoreException {
- if (attachContext) {
- monitor.subTask(Messages.TaskAttachmentWizard_Attaching_context);
- AttachmentUtil.postContext(connector, model.getTaskRepository(), model.getTask(), null, null,
- monitor);
- }
- }
-
- @Override
- public void taskSynchronized(SubmitJobEvent event, IProgressMonitor monitor) throws CoreException {
- // ignore
- }
- });
- if (previewPage.runInBackground()) {
- runInBackground(job);
- return false;
- } else {
- return runInWizard(job);
- }
- }
-
- private void runInBackground(final SubmitJob job) {
- getContainer().getShell().setVisible(false);
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (job.getStatus() != null) {
- getContainer().getShell().setVisible(true);
- }
- handleDone(job);
- if (job.getStatus() == null) {
- getContainer().getShell().close();
- }
- }
- });
- }
- });
- job.schedule();
- }
-
- private boolean runInWizard(final SubmitJob job) {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- if (((SubmitTaskAttachmentJob) job).run(monitor) == Status.CANCEL_STATUS) {
- throw new InterruptedException();
- }
- }
- });
- handleDone(job);
- return job.getStatus() == null;
- } catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unexpected error", e)); //$NON-NLS-1$
- return false;
- } catch (InterruptedException e) {
- // canceled
- return false;
- }
- }
-
- public void setMode(Mode mode) {
- this.mode = mode;
- if (mode == Mode.SCREENSHOT) {
- setWindowTitle(Messages.TaskAttachmentWizard_Attach_Screenshot);
- setDefaultPageImageDescriptor(CommonImages.BANNER_SCREENSHOT);
- } else {
- setWindowTitle(Messages.TaskAttachmentWizard_Add_Attachment);
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- }
- }
-
- public void setSource(AbstractTaskAttachmentSource source) {
- this.model.setSource(source);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizard.java
deleted file mode 100644
index a0284d17a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizard.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.internal.tasks.ui.TaskListBackupManager;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskDataExportOperation;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * Wizard for exporting tasklist data files to the file system. This wizard uses a single page: TaskDataExportWizardPage
- *
- * @author Wesley Coelho
- * @author Mik Kersten
- */
-public class TaskDataExportWizard extends Wizard implements IExportWizard {
-
- /**
- * The name of the dialog store's section associated with the task data export wizard
- */
- private final static String SETTINGS_SECTION = "org.eclipse.mylyn.tasklist.ui.exportWizard"; //$NON-NLS-1$
-
- private TaskDataExportWizardPage exportPage = null;
-
- public TaskDataExportWizard() {
- IDialogSettings masterSettings = TasksUiPlugin.getDefault().getDialogSettings();
- setDialogSettings(getSettingsSection(masterSettings));
- setNeedsProgressMonitor(true);
- setWindowTitle(Messages.TaskDataExportWizard_Export);
- }
-
- /**
- * Finds or creates a dialog settings section that is used to make the dialog control settings persistent
- */
- private IDialogSettings getSettingsSection(IDialogSettings master) {
- IDialogSettings settings = master.getSection(SETTINGS_SECTION);
- if (settings == null) {
- settings = master.addNewSection(SETTINGS_SECTION);
- }
- return settings;
- }
-
- @Override
- public void addPages() {
- exportPage = new TaskDataExportWizardPage();
- addPage(exportPage);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // no initialization needed
- }
-
- /**
- * Called when the user clicks finish. Saves the task data. Waits until all overwrite decisions have been made
- * before starting to save files. If any overwrite is canceled, no files are saved and the user must adjust the
- * dialog.
- */
- @Override
- public boolean performFinish() {
- String destDir = exportPage.getDestinationDirectory();
-
- final File destZipFile = new File(destDir + File.separator + TaskListBackupManager.getBackupFileName());
-
- TaskDataExportOperation job = new TaskDataExportOperation(exportPage.getDestinationDirectory(),
- destZipFile.getName());
-
- try {
- if (getContainer() != null) {
- getContainer().run(true, true, job);
- } else {
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- service.run(true, true, job);
- }
- } catch (InvocationTargetException e) {
- Status status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e);
- TasksUiInternal.logAndDisplayStatus(Messages.TaskDataExportWizard_export_failed, status);
- } catch (InterruptedException e) {
- // user canceled
- }
-
- exportPage.saveSettings();
- return true;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizardPage.java
deleted file mode 100644
index 04cf7e4f8..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataExportWizardPage.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.internal.tasks.ui.TaskListBackupManager;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Wizard Page for the Task Data Export Wizard
- *
- * @author Wesley Coelho
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class TaskDataExportWizardPage extends WizardPage {
-
- private static final String PAGE_ID = "org.eclipse.mylyn.tasklist.exportPage"; //$NON-NLS-1$
-
- private Button browseButton = null;
-
- private Text destDirText = null;
-
- // Key values for the dialog settings object
- private final static String SETTINGS_SAVED = "Settings saved"; //$NON-NLS-1$
-
- private final static String DEST_DIR_SETTING = "Destination directory setting"; //$NON-NLS-1$
-
- public TaskDataExportWizardPage() {
- super(PAGE_ID);
- setPageComplete(false);
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(TasksUiPlugin.ID_PLUGIN,
- "icons/wizban/banner-export.gif")); //$NON-NLS-1$
- setTitle(Messages.TaskDataExportWizardPage_Export_Mylyn_Task_Data);
- }
-
- /**
- * Create the widgets on the page
- */
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(1, false);
- container.setLayout(layout);
- createExportDirectoryControl(container);
-
- initSettings();
-
- Dialog.applyDialogFont(container);
- setControl(container);
- setPageComplete(validate());
- }
-
- /**
- * Create widgets for specifying the destination directory
- */
- private void createExportDirectoryControl(Composite parent) {
- parent.setLayout(new GridLayout(3, false));
- parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- new Label(parent, SWT.NONE).setText(Messages.TaskDataExportWizardPage_File);
- Label l = new Label(parent, SWT.NONE);
- l.setText(TaskListBackupManager.getBackupFileName());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- l.setLayoutData(gd);
- new Label(parent, SWT.NONE).setText(Messages.TaskDataExportWizardPage_Folder);
-
- destDirText = new Text(parent, SWT.BORDER);
- destDirText.setEditable(false);
- destDirText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- destDirText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- controlChanged();
- }
- });
-
- browseButton = new Button(parent, SWT.PUSH);
- browseButton.setText(Messages.TaskDataExportWizardPage_Browse_);
- browseButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setText(Messages.TaskDataExportWizardPage_Folder_Selection);
- dialog.setMessage(Messages.TaskDataExportWizardPage_Specify_the_destination_folder_for_task_data);
- String dir = destDirText.getText();
- dialog.setFilterPath(dir);
- dir = dialog.open();
- if (dir == null || dir.equals("")) { //$NON-NLS-1$
- return;
- }
- destDirText.setText(dir);
- controlChanged();
- }
- });
- }
-
- /**
- * Initializes controls with values from the Dialog Settings object
- */
- protected void initSettings() {
- IDialogSettings settings = getDialogSettings();
-
- if (settings.get(SETTINGS_SAVED) == null) {
- destDirText.setText(""); //$NON-NLS-1$
- } else {
- String directory = settings.get(DEST_DIR_SETTING);
- if (directory != null) {
- destDirText.setText(settings.get(DEST_DIR_SETTING));
- }
- }
- }
-
- /**
- * Saves the control values in the dialog settings to be used as defaults the next time the page is opened
- */
- public void saveSettings() {
- IDialogSettings settings = getDialogSettings();
- settings.put(DEST_DIR_SETTING, destDirText.getText());
- settings.put(SETTINGS_SAVED, SETTINGS_SAVED);
- }
-
- /** Called to indicate that a control's value has changed */
- public void controlChanged() {
- setPageComplete(validate());
- }
-
- /** Returns true if the information entered by the user is valid */
- protected boolean validate() {
- setMessage(null);
-
- // Check that a destination dir has been specified
- if (destDirText.getText().equals("")) { //$NON-NLS-1$
- setMessage(Messages.TaskDataExportWizardPage_Please_choose_an_export_destination, IStatus.WARNING);
- return false;
- }
-
- return true;
- }
-
- /** Returns the directory where data files are to be saved */
- public String getDestinationDirectory() {
- return destDirText.getText();
- }
-
- /** For testing only. Sets controls to the specified values */
- public void setDestinationDirectory(String destinationDir) {
- destDirText.setText(destinationDir);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizard.java
deleted file mode 100644
index a0273939d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizard.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.CoreUtil;
-import org.eclipse.mylyn.internal.commons.core.ZipFileUtil;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonsUiUtil;
-import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.externalization.AbstractExternalizationParticipant;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Rob Elves
- */
-@SuppressWarnings("restriction")
-public class TaskDataImportWizard extends Wizard implements IImportWizard {
-
- private TaskDataImportWizardPage importPage = null;
-
- public TaskDataImportWizard() {
- IDialogSettings masterSettings = TasksUiPlugin.getDefault().getDialogSettings();
- setDialogSettings(getSettingsSection(masterSettings));
- setNeedsProgressMonitor(true);
- setWindowTitle(Messages.TaskDataImportWizard_Import);
- }
-
- /**
- * Finds or creates a dialog settings section that is used to make the dialog control settings persistent
- */
- private IDialogSettings getSettingsSection(IDialogSettings master) {
- IDialogSettings settings = master.getSection("org.eclipse.mylyn.tasklist.ui.importWizard"); //$NON-NLS-1$
- if (settings == null) {
- settings = master.addNewSection("org.eclipse.mylyn.tasklist.ui.importWizard"); //$NON-NLS-1$
- }
- return settings;
- }
-
- @Override
- public void addPages() {
- importPage = new TaskDataImportWizardPage();
- importPage.setWizard(this);
- addPage(importPage);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // no initialization needed
- }
-
- @Override
- public boolean canFinish() {
- return importPage.isPageComplete();
- }
-
- @Override
- public boolean performFinish() {
-
- TasksUi.getTaskActivityManager().deactivateTask(TasksUi.getTaskActivityManager().getActiveTask());
-
- String sourceZip = importPage.getSourceZipFile();
- final File sourceZipFile = new File(sourceZip);
-
- if (!sourceZipFile.exists()) {
- MessageDialog.openError(getShell(), Messages.TaskDataImportWizard_File_not_found, sourceZipFile.toString()
- + Messages.TaskDataImportWizard_could_not_be_found);
- return false;
- } else if (!CoreUtil.TEST_MODE
- && !MessageDialog.openConfirm(getShell(), Messages.TaskDataImportWizard_confirm_overwrite,
- Messages.TaskDataImportWizard_existing_task_data_about_to_be_erased_proceed)) {
- return false;
- }
-
- try {
- if (getContainer() != null) {
- CommonsUiUtil.run(getContainer(), new FileCopyJob(sourceZipFile));
- } else {
- CommonsUiUtil.busyCursorWhile(new FileCopyJob(sourceZipFile));
- }
-
- importPage.saveSettings();
- } catch (CoreException e) {
- Status status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Problems encountered importing task data: {0}", e.getMessage()), e); //$NON-NLS-1$
- TasksUiInternal.logAndDisplayStatus(Messages.TaskDataImportWizard_task_data_import_failed, status);
- } catch (OperationCanceledException e) {
- // canceled
- }
-
- return true;
- }
-
- /** Job that performs the file copying and zipping */
- class FileCopyJob implements ICoreRunnable {
-
- private static final String PREFIX_BACKUP = ".backup-"; //$NON-NLS-1$
-
- private final String JOB_LABEL = Messages.TaskDataImportWizard_Importing_Data;
-
- private File sourceZipFile = null;
-
- private int numEntries = 0;
-
- private boolean restoreM2Tasklist = false;
-
- public FileCopyJob(File sourceZipFile) {
- this.sourceZipFile = sourceZipFile;
- }
-
- public void run(final IProgressMonitor monitor) throws CoreException {
-
- try {
-
- checkZipFile();
-
- if (numEntries > 0) {
-
- monitor.beginTask(JOB_LABEL, numEntries);
- Job.getJobManager().beginRule(ITasksCoreConstants.ROOT_SCHEDULING_RULE, monitor);
-
- if (monitor.isCanceled()) {
- return;
- }
-
- ZipFileUtil.unzipFiles(sourceZipFile, TasksUiPlugin.getDefault().getDataDirectory(), monitor);
-
- if (restoreM2Tasklist) {
-
- SimpleDateFormat format = new SimpleDateFormat(ITasksCoreConstants.FILENAME_TIMESTAMP_FORMAT,
- Locale.ENGLISH);
- String date = format.format(new Date());
-
- File taskListFile = new File(TasksUiPlugin.getDefault().getDataDirectory(),
- ITasksCoreConstants.DEFAULT_TASK_LIST_FILE);
- if (taskListFile.exists()) {
- taskListFile.renameTo(new File(taskListFile.getParentFile(), taskListFile.getName()
- + PREFIX_BACKUP + date));
- }
-
- File taskListFileSnapshot = new File(TasksUiPlugin.getDefault().getDataDirectory(),
- AbstractExternalizationParticipant.SNAPSHOT_PREFIX
- + ITasksCoreConstants.DEFAULT_TASK_LIST_FILE);
- if (taskListFileSnapshot.exists()) {
- taskListFileSnapshot.renameTo(new File(taskListFile.getParentFile(),
- taskListFileSnapshot.getName() + PREFIX_BACKUP + date));
- }
-
- }
- readTaskListData();
- }
- } catch (IOException e) {
- Status status = new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e);
- throw new CoreException(status);
- } finally {
- Job.getJobManager().endRule(ITasksCoreConstants.ROOT_SCHEDULING_RULE);
- monitor.done();
- }
- }
-
- private void checkZipFile() throws IOException {
- Enumeration<? extends ZipEntry> entries;
- ZipFile zipFile = new ZipFile(sourceZipFile, ZipFile.OPEN_READ);
- try {
- entries = zipFile.entries();
- while (entries.hasMoreElements()) {
- ZipEntry entry = entries.nextElement();
- if (entry.getName().startsWith(ITasksCoreConstants.OLD_TASK_LIST_FILE)) {
- restoreM2Tasklist = true;
- }
- numEntries++;
- }
- } finally {
- zipFile.close();
- }
- }
-
- }
-
- private void readTaskListData() {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- TasksUiPlugin.getDefault().reloadDataDirectory();
- } catch (CoreException e) {
- TasksUiInternal.displayStatus(Messages.TaskDataImportWizard_Import_Error, e.getStatus());
- }
- }
- });
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizardPage.java
deleted file mode 100644
index 721408dd2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskDataImportWizardPage.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.wizards;
-
-import java.io.File;
-import java.text.DateFormat;
-import java.util.SortedMap;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Wizard Page for the Task Data Import Wizard
- *
- * @author Wesley Coelho
- * @author Mik Kersten
- * @author Rob Elves (Adaption to Import wizard)
- */
-public class TaskDataImportWizardPage extends WizardPage {
-
- private Button browseButtonZip = null;
-
- private Text sourceZipText = null;
-
- private Button importViaBackupButton;
-
- private Button importViaZipButton;
-
- private Table backupFilesTable;
-
- // Key values for the dialog settings object
- private final static String SETTINGS_SAVED = Messages.TaskDataImportWizardPage_Import_Settings_saved;
-
- private final static String SOURCE_ZIP_SETTING = Messages.TaskDataImportWizardPage_Import_Source_zip_file_setting;
-
- private final static String IMPORT_ZIPMETHOD_SETTING = Messages.TaskDataImportWizardPage_Import_method_zip;
-
- private final static String IMPORT_BACKUPMETHOD_SETTING = Messages.TaskDataImportWizardPage_Import_method_backup;
-
- public TaskDataImportWizardPage() {
- super("org.eclipse.mylyn.tasklist.importPage"); //$NON-NLS-1$
- setPageComplete(false);
- setMessage(Messages.TaskDataImportWizardPage_Importing_overwrites_current_tasks_and_repositories,
- IMessageProvider.WARNING);
- setImageDescriptor(CommonImages.BANNER_IMPORT);
- setTitle(Messages.TaskDataImportWizardPage_Restore_tasks_from_history);
- }
-
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- layout.verticalSpacing = 15;
- container.setLayout(layout);
- createImportFromZipControl(container);
- createImportFromBackupControl(container);
- addRadioListeners();
- initSettings();
- Dialog.applyDialogFont(container);
- setControl(container);
- setPageComplete(validate());
- }
-
- private void addRadioListeners() {
- SelectionListener radioListener = new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- browseButtonZip.setEnabled(importViaZipButton.getSelection());
- backupFilesTable.setEnabled(importViaBackupButton.getSelection());
- sourceZipText.setEnabled(importViaZipButton.getSelection());
- controlChanged();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
-
- }
- };
-
- importViaZipButton.addSelectionListener(radioListener);
- importViaBackupButton.addSelectionListener(radioListener);
- }
-
- /**
- * Create widgets for specifying the source zip
- */
- private void createImportFromZipControl(Composite parent) {
-
- importViaZipButton = new Button(parent, SWT.RADIO);
- importViaZipButton.setText(Messages.TaskDataImportWizardPage_From_zip_file);
-
- sourceZipText = new Text(parent, SWT.BORDER);
- sourceZipText.setEditable(true);
- GridDataFactory.fillDefaults().grab(true, false).hint(250, SWT.DEFAULT).applyTo(sourceZipText);
- sourceZipText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- controlChanged();
- }
- });
-
- browseButtonZip = new Button(parent, SWT.PUSH);
- browseButtonZip.setText(Messages.TaskDataImportWizardPage_Browse_);
- browseButtonZip.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(getShell());
- dialog.setText(Messages.TaskDataImportWizardPage_Zip_File_Selection);
- String dir = sourceZipText.getText();
- dialog.setFilterPath(dir);
- dir = dialog.open();
- if (dir == null || dir.equals("")) { //$NON-NLS-1$
- return;
- }
- sourceZipText.setText(dir);
- }
- });
-
- }
-
- private void createImportFromBackupControl(Composite container) {
-
- importViaBackupButton = new Button(container, SWT.RADIO);
- importViaBackupButton.setText(Messages.TaskDataImportWizardPage_From_snapshot);
- addBackupFileView(container);
- }
-
- private void addBackupFileView(Composite composite) {
- backupFilesTable = new Table(composite, SWT.BORDER);
- GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).grab(true, true).applyTo(backupFilesTable);
-
- TableColumn filenameColumn = new TableColumn(backupFilesTable, SWT.LEFT);
- filenameColumn.setWidth(200);
-
- SortedMap<Long, File> backupFilesMap = TasksUiPlugin.getBackupManager().getBackupFiles();
-
- for (Long time : backupFilesMap.keySet()) {
- File file = backupFilesMap.get(time);
- TableItem item = new TableItem(backupFilesTable, SWT.NONE);
- item.setData(file.getAbsolutePath());
- item.setText(DateFormat.getDateTimeInstance().format(time));
- }
-
- backupFilesTable.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- controlChanged();
- }
- });
- }
-
- /**
- * Initializes controls with values from the Dialog Settings object
- */
- protected void initSettings() {
- IDialogSettings settings = getDialogSettings();
-
- if (settings.get(SETTINGS_SAVED) == null) {
- importViaZipButton.setSelection(true);
- sourceZipText.setEnabled(true);
- backupFilesTable.setEnabled(false);
-
- } else {
- // Retrieve previous values from the dialog settings
- importViaZipButton.setSelection(settings.getBoolean(IMPORT_ZIPMETHOD_SETTING));
- importViaBackupButton.setSelection(settings.getBoolean(IMPORT_BACKUPMETHOD_SETTING));
- browseButtonZip.setEnabled(importViaZipButton.getSelection());
- sourceZipText.setEnabled(importViaZipButton.getSelection());
-
- backupFilesTable.setEnabled(importViaBackupButton.getSelection());
- String zipFile = settings.get(SOURCE_ZIP_SETTING);
- if (zipFile != null) {
- sourceZipText.setText(settings.get(SOURCE_ZIP_SETTING));
- }
- }
- }
-
- /**
- * Saves the control values in the dialog settings to be used as defaults the next time the page is opened
- */
- public void saveSettings() {
- IDialogSettings settings = getDialogSettings();
-
- settings.put(IMPORT_ZIPMETHOD_SETTING, importViaZipButton.getSelection());
- settings.put(IMPORT_BACKUPMETHOD_SETTING, importViaBackupButton.getSelection());
- settings.put(SETTINGS_SAVED, SETTINGS_SAVED);
- }
-
- /** Called to indicate that a control's value has changed */
- public void controlChanged() {
- setPageComplete(validate());
- }
-
- /** Returns true if the information entered by the user is valid */
- protected boolean validate() {
- if (importViaZipButton.getSelection() && sourceZipText.getText().equals("")) { //$NON-NLS-1$
- return false;
- }
- if (importViaBackupButton.getSelection() && backupFilesTable.getSelection().length == 0) {
- return false;
- }
- return true;
- }
-
- public String getSourceZipFile() {
- if (importViaZipButton.getSelection()) {
- return sourceZipText.getText();
- } else {
- if (backupFilesTable.getSelectionIndex() != -1) {
- return (String) (backupFilesTable.getSelection()[0].getData());
- }
- }
- return Messages.TaskDataImportWizardPage__unspecified_;
- }
-
- /** For testing only. Sets controls to the specified values */
- public void setSource(boolean zip, String sourceZip) {
- sourceZipText.setText(sourceZip);
- importViaZipButton.setSelection(zip);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
deleted file mode 100644
index d4b151fa7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties
+++ /dev/null
@@ -1,138 +0,0 @@
-EditRepositoryWizard_Failed_to_refactor_repository_urls=Failed to refactor repository urls
-EditRepositoryWizard_Properties_for_Task_Repository=Properties for Task Repository
-
-AttachmentSourcePage__Clipboard_=<Clipboard>
-AttachmentSourcePage__Screenshot_=<Screenshot>
-AttachmentSourcePage_Browse_=Browse...
-AttachmentSourcePage_Cannot_locate_attachment_file=Cannot locate attachment file
-AttachmentSourcePage_Clipboard=Clipboard
-AttachmentSourcePage_Clipboard_contains_an_unsupported_data=Clipboard contains an unsupported data
-AttachmentSourcePage_Clipboard_supports_text_and_image_attachments_only=Clipboard supports text and image attachments only.
-AttachmentSourcePage_File=File
-AttachmentSourcePage_No_file_name=No file name
-AttachmentSourcePage_Select_attachment_source=Select attachment source
-AttachmentSourcePage_Select_the_location_of_the_attachment=Select the location of the attachment
-AttachmentSourcePage_Workspace=Workspace
-
-NewQueryWizard_New_Repository_Query=New Repository Query
-
-NewTaskWizard_New_Task=New Task
-
-NewWebTaskPage_Create_via_Web_Browser=Create via Web Browser
-NewWebTaskPage_New_Task=New Task
-NewWebTaskPage_Once_submitted_synchronize_queries_or_add_the_task_to_a_category=Once submitted synchronize queries or add the task to a category.\n
-NewWebTaskPage_This_will_open_a_web_browser_that_can_be_used_to_create_a_new_task=This will open a web browser that can be used to create a new task.\n\
-NOTE: you may need to log in via the web UI.
-
-AttachmentPreviewPage_A_preview_the_type_X_is_currently_not_available=Attaching File {0}\n\
-A preview the type {1} is currently not available
-AttachmentPreviewPage_Attachment_Preview=Attachment Preview
-AttachmentPreviewPage_Could_not_create_preview=Could not create preview
-AttachmentPreviewPage_Preparing_preview=Preparing preview
-AttachmentPreviewPage_Review_the_attachment_before_submitting=Review the attachment before submitting
-AttachmentPreviewPage_Run_in_background=Run in background
-
-SelectRepositoryConnectorPage_Select_a_task_repository_type=Select a task repository type
-SelectRepositoryConnectorPage_You_can_connect_to_an_existing_account_using_one_of_the_installed_connectors=You can connect to an existing account using one of the installed connectors.
-
-SelectRepositoryPage_Add_new_repositories_using_the_X_view=Add new repositories using the {0} view.\n\
-If a repository is missing it does not support the requested operation.
-SelectRepositoryPage_Select_a_repository=Select a repository
-
-TaskAttachmentWizard_Add_Attachment=Add Attachment
-TaskAttachmentWizard_Attach_Screenshot=Attach Screenshot
-TaskAttachmentWizard_Attaching_context=Attaching context
-TaskAttachmentWizard_Attachment_Failed=Attachment Failed
-TaskAttachmentWizard_Screenshot=Screenshot
-
-TaskDataExportWizard_Export=Export
-TaskDataExportWizard_export_failed=Export Failed
-TaskDataExportWizardPage_Browse_=Browse...
-TaskDataExportWizardPage_Export_Mylyn_Task_Data=Export Mylyn Task Data
-TaskDataExportWizardPage_File=File:
-TaskDataExportWizardPage_Folder=Folder:
-TaskDataExportWizardPage_Folder_Selection=Folder Selection
-TaskDataExportWizardPage_Please_choose_an_export_destination=Please choose an export destination
-TaskDataExportWizardPage_Specify_the_destination_folder_for_task_data=Specify the destination folder for task data
-
-TaskDataImportWizard_confirm_overwrite=Confirm Overwrite
-TaskDataImportWizard_could_not_be_found=\ could not be found.
-TaskDataImportWizard_existing_task_data_about_to_be_erased_proceed=Existing Task Data is about to be overwritten with data from selected source.\n\nProceed?
-TaskDataImportWizard_File_not_found=File not found
-TaskDataImportWizard_Import=Import
-TaskDataImportWizard_Import_Error=Import Error: Please retry importing or use alternate source
-TaskDataImportWizard_Importing_Data=Importing Data
-TaskDataImportWizard_task_data_import_failed=Task Data import failed
-
-TaskDataImportWizardPage_Browse_=Browse...
-TaskDataImportWizardPage_From_snapshot=From snapshot
-TaskDataImportWizardPage_From_zip_file=From zip file
-TaskDataImportWizardPage_Import_method_backup=Import method backup
-TaskDataImportWizardPage_Import_method_zip=Import method zip
-TaskDataImportWizardPage_Import_Settings_saved=Import Settings saved
-TaskDataImportWizardPage_Import_Source_zip_file_setting=Import Source zip file setting
-TaskDataImportWizardPage_Importing_overwrites_current_tasks_and_repositories=Importing overwrites current tasks and repositories. Consider exporting first.
-TaskDataImportWizardPage_Restore_tasks_from_history=Restore tasks from history
-TaskDataImportWizardPage__unspecified_=<unspecified>
-TaskDataImportWizardPage_Zip_File_Selection=Zip File Selection
-
-AbstractRepositoryQueryPage_A_category_with_this_name_already_exists=A category with this name already exists, please choose another name.
-AbstractRepositoryQueryPage_Enter_query_parameters=Enter query parameters
-AbstractRepositoryQueryPage_If_attributes_are_blank_or_stale_press_the_Update_button=If attributes are blank or stale press the Update button.
-AbstractRepositoryQueryPage_Please_specify_a_title_for_the_query=Please specify a title for the query.
-AbstractRepositoryQueryPage_A_query_with_this_name_already_exists=A query with this name already exists, please choose another name.
-AbstractRepositorySettingsPage_Additional_Settings=Additional Settings
-AbstractRepositorySettingsPage_Anonymous_Access=Anonymous
-AbstractRepositorySettingsPage_Authentication_credentials_are_valid=Authentication credentials are valid.
-AbstractRepositorySettingsPage_Change_account_settings=Change account settings
-AbstractRepositorySettingsPage_Change_Settings=Change Settings
-AbstractRepositorySettingsPage_Character_encoding=Character encoding\:
-AbstractRepositorySettingsPage_Create_new_account=Create new account
-AbstractRepositorySettingsPage_Default__=Default (
-AbstractRepositorySettingsPage_Disconnected=Disconnected
-AbstractRepositorySettingsPage_Enable_http_authentication=Enable Http Authentication
-AbstractRepositorySettingsPage_Enable_proxy_authentication=Enable Proxy Authentication
-AbstractRepositorySettingsPage_Enter_a_valid_server_url=Enter a valid server url
-AbstractRepositorySettingsPage_Http_Authentication=Http Authentication
-AbstractRepositorySettingsPage_Internal_error_validating_repository=Internal error validating repository
-AbstractRepositorySettingsPage_Label_=Label\:\
-AbstractRepositorySettingsPage_Other=Other\:
-AbstractRepositorySettingsPage_Password_=Password\:\
-AbstractRepositorySettingsPage_Problems_encountered_determining_available_charsets=Problems encountered determining available charsets
-AbstractRepositorySettingsPage_Proxy_host_address_=Proxy host address\:\
-AbstractRepositorySettingsPage_Proxy_host_port_=Proxy host port\:\
-AbstractRepositorySettingsPage_Proxy_Server_Configuration=Proxy Server Configuration
-AbstractRepositorySettingsPage_Repository_already_exists=Repository already exists.
-AbstractRepositorySettingsPage_Repository_is_valid=Repository is valid.
-AbstractRepositorySettingsPage_Repository_url_is_invalid=Repository url is invalid.
-AbstractRepositorySettingsPage_Repository_user_name_and_password_must_not_be_blank=Repository user name and password must not be blank
-AbstractRepositorySettingsPage_Save_Password=Save Password
-AbstractRepositorySettingsPage_Server_=Server\:\
-AbstractRepositorySettingsPage_Unable_to_authenticate_with_repository=Unable to authenticate with repository. Login credentials invalid.
-AbstractRepositorySettingsPage_Use_global_Network_Connections_preferences=Use global Network Connections preferences
-AbstractRepositorySettingsPage_User_ID_=User ID\:\
-AbstractRepositorySettingsPage_Validate_Settings=Validate Settings
-AbstractRepositorySettingsPage_Validating_server_settings=Validating server settings
-
-NewTaskWizard_Create_Task=Create Task
-NewTaskWizard_Error_creating_new_task=Error creating new task
-NewTaskWizard_Failed_to_create_new_task_=Failed to create new task:
-NewWebTaskWizard_New_Task=New Task
-NewWebTaskWizard_This_connector_does_not_provide_a_rich_task_editor_for_creating_tasks=This connector does not provide a rich task editor for creating tasks.\n\nThe error contents have been placed in the clipboard so that you can paste them into the entry form.
-RepositoryQueryWizard_Edit_Repository_Query=Edit Repository Query
-
-TaskAttachmentPage_ATTACHE_CONTEXT=Attach Context
-TaskAttachmentPage_Attachment_Details=Attachment Details
-TaskAttachmentPage_Comment=Comment
-TaskAttachmentPage_Content_Type=Content Type
-TaskAttachmentPage_Description=Description
-TaskAttachmentPage_Enter_a_description=Enter a description
-TaskAttachmentPage_Enter_a_file_name=Enter a file name
-TaskAttachmentPage_File=File
-TaskAttachmentPage_Patch=Patch
-TaskAttachmentPage_Verify_the_content_type_of_the_attachment=Verify the content type of the attachment
-
-AbstractTaskRepositoryPage_Validation_failed=Validation failed
-
-LocalRepositorySettingsPage_Configure_the_local_repository=Configure the local repository
-LocalRepositorySettingsPage_Local_Repository_Settings=Local Repository Settings
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/Messages.java
deleted file mode 100644
index 02b1ae0c0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/Messages.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.workingsets;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.tasks.ui.workingsets.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String TaskWorkingSetPage_The_name_must_not_be_empty;
-
- public static String TaskWorkingSetPage_The_name_must_not_have_a_leading_or_trailing_whitespace;
-
- public static String TaskWorkingSetPage_No_categories_queries_selected;
-
- public static String TaskWorkingSetPage_Resources;
-
- public static String TaskWorkingSetPage_Select_Working_Set_Elements;
-
- public static String TaskWorkingSetPage_Tasks;
-
- public static String TaskWorkingSetPage_Page_Description;
-
- public static String TaskWorkingSetPage_A_working_set_with_the_same_name_already_exists;
-
- public static String TaskWorkingSetPage_Select_All;
-
- public static String TaskWorkingSetPage_Deselect_All;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetAdapterFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetAdapterFactory.java
deleted file mode 100644
index 322add9c7..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetAdapterFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.workingsets;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * Adapter factory used to adapt AbstractTaskContainer to IPersistableElement
- *
- * @author Eugene Kuleshov
- */
-public class TaskWorkingSetAdapterFactory implements IAdapterFactory {
-
- private static final String TASK_ELEMENT_FACTORY_ID = "org.eclipse.mylyn.tasks.ui.workingSets.elementFactory"; //$NON-NLS-1$
-
- @SuppressWarnings("unchecked")
- private static final Class[] ADAPTER_TYPES = new Class[] { IPersistableElement.class };
-
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList() {
- return ADAPTER_TYPES;
- }
-
- public Object getAdapter(final Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
- if (adapterType == IPersistableElement.class && adaptableObject instanceof AbstractTaskContainer) {
- return new IPersistableElement() {
- public void saveState(IMemento memento) {
- IRepositoryElement container = (IRepositoryElement) adaptableObject;
- memento.putString(TaskWorkingSetElementFactory.HANDLE_TASK, container.getHandleIdentifier());
- }
-
- public String getFactoryId() {
- return TASK_ELEMENT_FACTORY_ID;
- }
- };
- } else if (adapterType == IPersistableElement.class && adaptableObject instanceof IProject) {
- return new IPersistableElement() {
- public void saveState(IMemento memento) {
- IProject project = (IProject) adaptableObject;
- memento.putString(TaskWorkingSetElementFactory.HANDLE_PROJECT, project.getName());
- }
-
- public String getFactoryId() {
- return TASK_ELEMENT_FACTORY_ID;
- }
- };
- }
- return null;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementAdapter.java
deleted file mode 100644
index ea0f3d395..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementAdapter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.workingsets;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetElementAdapter;
-
-/**
- * @author Eugene Kuleshov
- * @author Mik Kersten
- */
-public class TaskWorkingSetElementAdapter implements IWorkingSetElementAdapter {
-
- public IAdaptable[] adaptElements(IWorkingSet workingSet, IAdaptable[] elements) {
- for (IAdaptable adaptable : elements) {
- if (!(adaptable instanceof AbstractTaskContainer)) {
- return selectContainers(elements);
- }
- }
- return elements;
- }
-
- private IAdaptable[] selectContainers(IAdaptable[] elements) {
- List<IAdaptable> containers = new ArrayList<IAdaptable>(elements.length);
- for (IAdaptable adaptable : elements) {
- if (adaptable instanceof AbstractTaskContainer) {
- containers.add(adaptable);
- } else if (adaptable instanceof IProject) {
- containers.add(adaptable);
- }
- }
- return containers.toArray(new IAdaptable[containers.size()]);
- }
-
- public void dispose() {
- // ignore
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementFactory.java
deleted file mode 100644
index 49e664f75..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetElementFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.workingsets;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-
-/**
- * Element factory used to restore task containers and projects for Task+Resource working sets.
- *
- * @author Eugene Kuleshov
- * @author Mik Kersten
- */
-public class TaskWorkingSetElementFactory implements IElementFactory {
-
- static final String HANDLE_TASK = "handle.task"; //$NON-NLS-1$
-
- static final String HANDLE_PROJECT = "handle.project"; //$NON-NLS-1$
-
- public IAdaptable createElement(IMemento memento) {
- String taskHandle = memento.getString(HANDLE_TASK);
- if (taskHandle != null) {
- // TOOD: this does not support projects and categories/queries have the same name
- TaskList taskList = TasksUiPlugin.getTaskList();
- for (AbstractTaskContainer element : taskList.getRootElements()) {
- if (element.getHandleIdentifier().equals(taskHandle)) {
- return element;
- }
- }
- }
- String projectHandle = memento.getString(HANDLE_PROJECT);
- if (projectHandle != null) {
- try {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectHandle);
- if (project != null) {
- return project;
- }
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not not determine project for handle: " + projectHandle, t)); //$NON-NLS-1$
- }
- }
- // prior to mylyn 3.0.2 task handles and project handles were identical
- if (taskHandle != null) {
- try {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(taskHandle);
- if (project != null) {
- return project;
- }
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not not determine project for handle: " + taskHandle, t)); //$NON-NLS-1$
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetPage.java
deleted file mode 100644
index a46f9acde..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetPage.java
+++ /dev/null
@@ -1,579 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.workingsets;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoryLabelProvider;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TaskElementLabelProvider;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Adapted from org.eclipse.ui.internal.ide.dialogs.ResourceWorkingSetPage
- *
- * @author Eugene Kuleshov
- * @author Mik Kersten
- */
-public class TaskWorkingSetPage extends WizardPage implements IWorkingSetPage {
-
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 50;
-
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
-
- private Text text;
-
- private CheckboxTreeViewer treeViewer;
-
- private IWorkingSet workingSet;
-
- private final WorkingSetPageContentProvider workingSetPageContentProvider = new WorkingSetPageContentProvider();
-
- private boolean firstCheck = false;
-
- private final class WorkingSetPageContentProvider implements ITreeContentProvider {
-
- private ElementCategory tasksContainer;
-
- private ElementCategory resourcesContainer;
-
- private final Map<IRepositoryQuery, TaskRepository> queryMap = new HashMap<IRepositoryQuery, TaskRepository>();
-
- private final Map<IProject, TaskRepositoryProjectMapping> projectMap = new HashMap<IProject, TaskRepositoryProjectMapping>();
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof List) {
- List<IAdaptable> taskRepositoriesContainers = new ArrayList<IAdaptable>();
- List<IAdaptable> resourcesRepositoriesContainers = new ArrayList<IAdaptable>();
-
- for (AbstractTaskContainer category : TasksUiInternal.getTaskList().getCategories()) {
- taskRepositoriesContainers.add(category);
- }
-
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- Set<IProject> unmappedProjects = new HashSet<IProject>();
- for (Object container : (List<?>) parentElement) {
- if (container instanceof TaskRepository) {
- // NOTE: looking down, high complexity
- if (hasChildren(container)) {
- taskRepositoriesContainers.add((TaskRepository) container);
- }
-
- // NOTE: O(n^2) complexity, could fix
- Set<IProject> mappedProjects = new HashSet<IProject>();
-
- for (IProject project : projects) {
- TaskRepository taskRepository = TasksUiPlugin.getDefault()
- .getRepositoryForResource(project);
- if (container.equals(taskRepository)) {
- mappedProjects.add(project);
- } else if (taskRepository == null) {
- unmappedProjects.add(project);
- }
- }
- if (!mappedProjects.isEmpty()) {
- TaskRepositoryProjectMapping projectMapping = new TaskRepositoryProjectMapping(
- (TaskRepository) container, mappedProjects);
- resourcesRepositoriesContainers.add(projectMapping);
- for (IProject mappedProject : mappedProjects) {
- projectMap.put(mappedProject, projectMapping);
- }
- }
- }
- }
- resourcesRepositoriesContainers.addAll(unmappedProjects);
- tasksContainer = new ElementCategory(Messages.TaskWorkingSetPage_Tasks, taskRepositoriesContainers);
- resourcesContainer = new ElementCategory(Messages.TaskWorkingSetPage_Resources,
- resourcesRepositoriesContainers);
- return new Object[] { tasksContainer, resourcesContainer };
- } else if (parentElement instanceof TaskRepository) {
- List<IAdaptable> taskContainers = new ArrayList<IAdaptable>();
- for (AbstractTaskContainer element : TasksUiPlugin.getTaskList().getRepositoryQueries(
- ((TaskRepository) parentElement).getRepositoryUrl())) {
- if (element instanceof IRepositoryQuery) {
- taskContainers.add(element);
- queryMap.put((IRepositoryQuery) element, (TaskRepository) parentElement);
- }
- }
-
- return taskContainers.toArray();
- } else if (parentElement instanceof TaskRepositoryProjectMapping) {
- return ((TaskRepositoryProjectMapping) parentElement).getProjects().toArray();
- } else if (parentElement instanceof ElementCategory) {
- return ((ElementCategory) parentElement).getChildren(parentElement);
- } else {
- return new Object[0];
- }
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- public Object[] getElements(Object element) {
- return getChildren(element);
- }
-
- public Object getParent(Object element) {
- if (element instanceof AbstractTaskCategory || element instanceof TaskRepository) {
- return tasksContainer;
- } else if (element instanceof IRepositoryQuery) {
- return queryMap.get(element);
- } else if (element instanceof TaskRepositoryProjectMapping) {
- return resourcesContainer;
- } else if (element instanceof IProject) {
- Object repository = projectMap.get(element);
- if (repository != null) {
- return repository;
- } else {
- return resourcesContainer;
- }
- } else {
- return null;
- }
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- private class TaskRepositoryProjectMapping extends PlatformObject {
-
- private final TaskRepository taskRepository;
-
- private final Set<IProject> projects;
-
- public TaskRepositoryProjectMapping(TaskRepository taskRepository, Set<IProject> mappedProjects) {
- this.taskRepository = taskRepository;
- this.projects = mappedProjects;
- }
-
- public Set<IProject> getProjects() {
- return projects;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
- }
-
- class ElementCategory extends PlatformObject implements IWorkbenchAdapter {
-
- private final String label;
-
- private final List<IAdaptable> children;
-
- public ElementCategory(String label, List<IAdaptable> children) {
- this.label = label;
- this.children = children;
- }
-
- public Object[] getChildren(Object o) {
- return children.toArray();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJ_WORKING_SETS);
- }
-
- public String getLabel(Object o) {
- return label;
- }
-
- public Object getParent(Object o) {
- return null;
- }
-
- }
-
- class AggregateLabelProvider implements ILabelProvider {
-
- private final TaskElementLabelProvider taskLabelProvider = new TaskElementLabelProvider(false);
-
- private final TaskRepositoryLabelProvider taskRepositoryLabelProvider = new TaskRepositoryLabelProvider();
-
- private final WorkbenchLabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
-
- public Image getImage(Object element) {
- if (element instanceof AbstractTaskContainer) {
- return taskLabelProvider.getImage(element);
- } else if (element instanceof TaskRepository) {
- return taskRepositoryLabelProvider.getImage(element);
- } else if (element instanceof TaskRepositoryProjectMapping) {
- return getImage(((TaskRepositoryProjectMapping) element).getTaskRepository());
- } else {
- return workbenchLabelProvider.getImage(element);
- }
- }
-
- public String getText(Object element) {
- if (element instanceof AbstractTaskContainer) {
- return taskLabelProvider.getText(element);
- } else if (element instanceof TaskRepository) {
- return taskRepositoryLabelProvider.getText(element);
- } else if (element instanceof TaskRepositoryProjectMapping) {
- return getText(((TaskRepositoryProjectMapping) element).getTaskRepository());
- } else {
- return workbenchLabelProvider.getText(element);
- }
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- }
-
- class CustomSorter extends ViewerSorter {
-
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof TaskRepository || e1 instanceof TaskRepositoryProjectMapping) {
- return -1;
- } else if (e2 instanceof TaskRepository || e2 instanceof TaskRepositoryProjectMapping) {
- return 1;
- } else if (e1 instanceof ElementCategory
- && ((ElementCategory) e1).getLabel(e1).equals(Messages.TaskWorkingSetPage_Tasks)) {
- return -1;
- } else if (e2 instanceof ElementCategory
- && ((ElementCategory) e1).getLabel(e1).equals(Messages.TaskWorkingSetPage_Tasks)) {
- return 1;
- } else {
- return super.compare(viewer, e1, e2);
- }
- }
- }
-
- public TaskWorkingSetPage() {
- super("taskWorkingSetPage", Messages.TaskWorkingSetPage_Select_Working_Set_Elements, null); //$NON-NLS-1$
- setDescription(Messages.TaskWorkingSetPage_Page_Description);
- setImageDescriptor(TasksUiImages.BANNER_WORKING_SET);
- }
-
- public void finish() {
- Object[] elements = treeViewer.getCheckedElements();
- Set<IAdaptable> validElements = new HashSet<IAdaptable>();
- for (Object element : elements) {
- if (element instanceof AbstractTaskContainer || element instanceof IProject) {
- validElements.add((IAdaptable) element);
- }
- }
-
- addSpecialContainers(validElements);
-
- if (workingSet == null) {
- IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
- workingSet = workingSetManager.createWorkingSet(getWorkingSetName(),
- validElements.toArray(new IAdaptable[validElements.size()]));
- } else {
- workingSet.setName(getWorkingSetName());
- workingSet.setElements(validElements.toArray(new IAdaptable[validElements.size()]));
- }
- }
-
- private void addSpecialContainers(Set<IAdaptable> validElements) {
- HashSet<AbstractTaskContainer> specialContainers = new HashSet<AbstractTaskContainer>();
- for (IAdaptable element : validElements) {
- if (element instanceof IRepositoryQuery) {
- IRepositoryQuery query = (IRepositoryQuery) element;
- if (query.getRepositoryUrl() != null) {
- // Add Unmatched
- AbstractTaskContainer orphansContainer = TasksUiPlugin.getTaskList().getUnmatchedContainer(
- query.getRepositoryUrl());
- if (orphansContainer != null) {
- specialContainers.add(orphansContainer);
- }
-
- // Add Unsubmitted
- AbstractTaskContainer unsubmittedContainer = TasksUiPlugin.getTaskList().getUnsubmittedContainer(
- query.getRepositoryUrl());
- if (unsubmittedContainer != null) {
- specialContainers.add(unsubmittedContainer);
- }
- }
- }
- }
- validElements.addAll(specialContainers);
- }
-
- public IWorkingSet getSelection() {
- return workingSet;
- }
-
- public void setSelection(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- if (getShell() != null && text != null) {
- firstCheck = true;
- initializeCheckedState();
- text.setText(workingSet.getName());
- }
- }
-
- private String getWorkingSetName() {
- return text.getText();
- }
-
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NULL);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
-
- // PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IIDEHelpContextIds.WORKING_SET_RESOURCE_PAGE);
- Label label = new Label(composite, SWT.WRAP);
- label.setText(""); //$NON-NLS-1$
- label.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER));
-
- text = new Text(composite, SWT.SINGLE | SWT.BORDER);
- text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- });
- text.setFocus();
- // text.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(text));
-
- label = new Label(composite, SWT.WRAP);
- label.setText(""); //$NON-NLS-1$
- label.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER));
-
- treeViewer = new CheckboxTreeViewer(composite);
- treeViewer.setUseHashlookup(true);
- treeViewer.setContentProvider(workingSetPageContentProvider);
-
- treeViewer.setLabelProvider(new DecoratingLabelProvider(new AggregateLabelProvider(), PlatformUI.getWorkbench()
- .getDecoratorManager()
- .getLabelDecorator()));
- treeViewer.setSorter(new CustomSorter());
-
- ArrayList<Object> containers = new ArrayList<Object>();
- for (TaskRepository repository : TasksUi.getRepositoryManager().getAllRepositories()) {
- containers.add(repository);
- }
-
- containers.addAll(Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects()));
-
- treeViewer.setInput(containers);
-
- // tree.setComparator(new ResourceComparator(ResourceComparator.NAME));
-
- GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- treeViewer.getControl().setLayoutData(data);
-
- treeViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleCheckStateChange(event);
- }
- });
-
- // Add select / deselect all buttons for bug 46669
- Composite buttonComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
- selectAllButton.setText(Messages.TaskWorkingSetPage_Select_All);
- selectAllButton.setToolTipText(""); //$NON-NLS-1$
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent selectionEvent) {
- treeViewer.setCheckedElements(workingSetPageContentProvider.getElements(treeViewer.getInput()));
- validateInput();
- }
- });
- setButtonLayoutData(selectAllButton);
-
- Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
- deselectAllButton.setText(Messages.TaskWorkingSetPage_Deselect_All);
- deselectAllButton.setToolTipText(""); //$NON-NLS-1$
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent selectionEvent) {
- treeViewer.setCheckedElements(new Object[0]);
- validateInput();
- }
- });
- setButtonLayoutData(deselectAllButton);
-
- if (workingSet != null) {
- for (Object object : workingSet.getElements()) {
- treeViewer.expandToLevel(object, 1);
- }
- } else {
- treeViewer.expandToLevel(2);
- }
- initializeCheckedState();
-
- if (workingSet != null) {
- text.setText(workingSet.getName());
- }
-
- setPageComplete(false);
- Dialog.applyDialogFont(composite);
- }
-
- private void initializeCheckedState() {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- Object[] items = null;
- if (workingSet != null) {
- items = workingSet.getElements();
- if (items != null) {
- // see bug 191342
- treeViewer.setCheckedElements(new Object[] {});
- for (Object item : items) {
- if (item != null) {
- treeViewer.setChecked(item, true);
- }
- }
- }
- }
- }
- });
- }
-
- protected void handleCheckStateChange(final CheckStateChangedEvent event) {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- IAdaptable element = (IAdaptable) event.getElement();
- handleCheckStateChangeHelper(event, element);
- validateInput();
- }
-
- private void handleCheckStateChangeHelper(final CheckStateChangedEvent event, IAdaptable element) {
- if (element instanceof AbstractTaskContainer || element instanceof IProject) {
- treeViewer.setGrayed(element, false);
- } else if (element instanceof ElementCategory) {
- for (Object child : ((ElementCategory) element).getChildren(null)) {
- treeViewer.setChecked(child, event.getChecked());
- if (child instanceof IAdaptable) {
- handleCheckStateChangeHelper(event, (IAdaptable) child);
- }
- }
- } else if (element instanceof TaskRepository || element instanceof TaskRepositoryProjectMapping) {
- for (Object child : workingSetPageContentProvider.getChildren(element)) {
- treeViewer.setChecked(child, event.getChecked());
- }
- }
- }
- });
- }
-
- protected void validateInput() {
- String errorMessage = null;
- String infoMessage = null;
- String newText = text.getText();
-
- if (!newText.equals(newText.trim())) {
- errorMessage = Messages.TaskWorkingSetPage_The_name_must_not_have_a_leading_or_trailing_whitespace;
- } else if (firstCheck) {
- firstCheck = false;
- return;
- }
- if ("".equals(newText)) { //$NON-NLS-1$
- errorMessage = Messages.TaskWorkingSetPage_The_name_must_not_be_empty;
- }
- if (errorMessage == null && (workingSet == null || !newText.equals(workingSet.getName()))) {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
- for (IWorkingSet workingSet2 : workingSets) {
- if (newText.equals(workingSet2.getName())) {
- errorMessage = Messages.TaskWorkingSetPage_A_working_set_with_the_same_name_already_exists;
- }
- }
- }
- if (treeViewer.getCheckedElements().length == 0) {
- infoMessage = Messages.TaskWorkingSetPage_No_categories_queries_selected;
- }
- setMessage(infoMessage, INFORMATION);
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage == null);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java
deleted file mode 100644
index d65e85f11..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.workingsets;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetUpdater;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Eugene Kuleshov
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class TaskWorkingSetUpdater implements IWorkingSetUpdater, ITaskListChangeListener, IResourceChangeListener {
-
- public static String ID_TASK_WORKING_SET = "org.eclipse.mylyn.tasks.ui.workingSet"; //$NON-NLS-1$
-
- private final List<IWorkingSet> workingSets = new CopyOnWriteArrayList<IWorkingSet>();
-
- private static class TaskWorkingSetDelta {
-
- private final IWorkingSet workingSet;
-
- private final List<Object> elements;
-
- private boolean changed;
-
- public TaskWorkingSetDelta(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- this.elements = new ArrayList<Object>(Arrays.asList(workingSet.getElements()));
- }
-
- public int indexOf(Object element) {
- return elements.indexOf(element);
- }
-
- public void set(int index, Object element) {
- elements.set(index, element);
- changed = true;
- }
-
- public void remove(int index) {
- if (elements.remove(index) != null) {
- changed = true;
- }
- }
-
- public void process() {
- if (changed) {
- workingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
- }
- }
- }
-
- public TaskWorkingSetUpdater() {
- TasksUiInternal.getTaskList().addChangeListener(this);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
- }
-
- public void dispose() {
- TasksUiInternal.getTaskList().removeChangeListener(this);
- }
-
- public void add(IWorkingSet workingSet) {
- checkElementExistence(workingSet);
- synchronized (workingSets) {
- workingSets.add(workingSet);
- }
- }
-
- private void checkElementExistence(IWorkingSet workingSet) {
- ArrayList<IAdaptable> list = new ArrayList<IAdaptable>();
- for (IAdaptable adaptable : workingSet.getElements()) {
- if (adaptable instanceof AbstractTaskContainer) {
- String handle = ((AbstractTaskContainer) adaptable).getHandleIdentifier();
- for (IRepositoryElement element : TasksUiPlugin.getTaskList().getRootElements()) {
- if (element != null && element.getHandleIdentifier().equals(handle)) {
- list.add(adaptable);
- }
- }
- } else if (adaptable instanceof IProject) {
- IProject project = ResourcesPlugin.getWorkspace()
- .getRoot()
- .getProject(((IProject) adaptable).getName());
- if (project != null && project.exists()) {
- list.add(project);
- }
- }
- }
- workingSet.setElements(list.toArray(new IAdaptable[list.size()]));
- }
-
- public boolean contains(IWorkingSet workingSet) {
- synchronized (workingSets) {
- return workingSets.contains(workingSet);
- }
- }
-
- public boolean remove(IWorkingSet workingSet) {
- synchronized (workingSets) {
- return workingSets.remove(workingSet);
- }
- }
-
- public void containersChanged(Set<TaskContainerDelta> delta) {
- for (TaskContainerDelta taskContainerDelta : delta) {
- if (taskContainerDelta.getElement() instanceof TaskCategory
- || taskContainerDelta.getElement() instanceof IRepositoryQuery) {
- synchronized (workingSets) {
- switch (taskContainerDelta.getKind()) {
- case REMOVED:
- // Remove from all
- for (IWorkingSet workingSet : workingSets) {
- ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(
- Arrays.asList(workingSet.getElements()));
- elements.remove(taskContainerDelta.getElement());
- workingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
- }
- break;
- case ADDED:
- // Add to the active working set
- for (IWorkingSet workingSet : TaskWorkingSetUpdater.getEnabledSets()) {
- ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(
- Arrays.asList(workingSet.getElements()));
- elements.add(taskContainerDelta.getElement());
- workingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
- }
- break;
- }
- }
- }
- }
- }
-
- // TODO: consider putting back, but evaluate policy and note bug 197257
-// public void taskActivated(AbstractTask task) {
-// Set<AbstractTaskContainer> taskContainers = new HashSet<AbstractTaskContainer>(
-// TasksUiPlugin.getTaskList().getQueriesForHandle(task.getHandleIdentifier()));
-// taskContainers.addAll(task.getParentContainers());
-//
-// Set<AbstractTaskContainer> allActiveWorkingSetContainers = new HashSet<AbstractTaskContainer>();
-// for (IWorkingSet workingSet : PlatformUI.getWorkbench()
-// .getActiveWorkbenchWindow()
-// .getActivePage()
-// .getWorkingSets()) {
-// ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements()));
-// for (IAdaptable adaptable : elements) {
-// if (adaptable instanceof AbstractTaskContainer) {
-// allActiveWorkingSetContainers.add((AbstractTaskContainer) adaptable);
-// }
-// }
-// }
-// boolean isContained = false;
-// for (AbstractTaskContainer taskContainer : allActiveWorkingSetContainers) {
-// if (taskContainers.contains(taskContainer)) {
-// isContained = true;
-// break;
-// }
-// }
-//
-// ;
-// if (!isContained) {
-// IWorkingSet matchingWorkingSet = null;
-// for (IWorkingSet workingSet : PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets()) {
-// ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements()));
-// for (IAdaptable adaptable : elements) {
-// if (adaptable instanceof AbstractTaskContainer) {
-// if (((AbstractTaskContainer)adaptable).contains(task.getHandleIdentifier())) {
-// matchingWorkingSet = workingSet;
-// }
-// }
-// }
-// }
-//
-// if (matchingWorkingSet != null) {
-// new ToggleWorkingSetAction(matchingWorkingSet).run();
-// } else {
-// new ToggleAllWorkingSetsAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
-// }
-// }
-// }
-
- public static IWorkingSet[] getEnabledSets() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- return page.getWorkingSets();
- }
- }
- return new IWorkingSet[0];
- }
-
- /**
- * TODO: move
- */
- public static boolean areNoTaskWorkingSetsEnabled() {
- IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
- for (IWorkingSet workingSet : workingSets) {
- if (workingSet != null && workingSet.getId().equalsIgnoreCase(ID_TASK_WORKING_SET)) {
- if (isWorkingSetEnabled(workingSet)) {
- return false;
- }
- }
- }
- return true;
- }
-
- public static boolean isWorkingSetEnabled(IWorkingSet set) {
- IWorkingSet[] enabledSets = TaskWorkingSetUpdater.getEnabledSets();
- for (IWorkingSet enabledSet : enabledSets) {
- if (enabledSet.equals(set)) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean isOnlyTaskWorkingSetEnabled(IWorkingSet set) {
- if (!TaskWorkingSetUpdater.isWorkingSetEnabled(set)) {
- return false;
- }
-
- IWorkingSet[] enabledSets = TaskWorkingSetUpdater.getEnabledSets();
- for (int i = 0; i < enabledSets.length; i++) {
- if (!enabledSets[i].equals(set)
- && enabledSets[i].getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) {
- return false;
- }
- }
- return true;
- }
-
- private void processResourceDelta(TaskWorkingSetDelta result, IResourceDelta delta) {
- IResource resource = delta.getResource();
- int type = resource.getType();
- int index = result.indexOf(resource);
- int kind = delta.getKind();
- int flags = delta.getFlags();
- if (kind == IResourceDelta.CHANGED && type == IResource.PROJECT && index != -1) {
- if ((flags & IResourceDelta.OPEN) != 0) {
- result.set(index, resource);
- }
- }
- if (index != -1 && kind == IResourceDelta.REMOVED) {
- if ((flags & IResourceDelta.MOVED_TO) != 0) {
- result.set(index, ResourcesPlugin.getWorkspace().getRoot().findMember(delta.getMovedToPath()));
- } else {
- result.remove(index);
- }
- }
-
- // Don't dive into closed or opened projects
- if (projectGotClosedOrOpened(resource, kind, flags)) {
- return;
- }
-
- IResourceDelta[] children = delta.getAffectedChildren();
- for (IResourceDelta element : children) {
- processResourceDelta(result, element);
- }
- }
-
- private boolean projectGotClosedOrOpened(IResource resource, int kind, int flags) {
- return resource.getType() == IResource.PROJECT && kind == IResourceDelta.CHANGED
- && (flags & IResourceDelta.OPEN) != 0;
- }
-
- public void resourceChanged(IResourceChangeEvent event) {
- for (IWorkingSet workingSet : workingSets) {
- TaskWorkingSetDelta workingSetDelta = new TaskWorkingSetDelta(workingSet);
- if (event.getDelta() != null) {
- processResourceDelta(workingSetDelta, event.getDelta());
- }
- workingSetDelta.process();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/WorkingSetLabelComparator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/WorkingSetLabelComparator.java
deleted file mode 100644
index 4af6c3c79..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/WorkingSetLabelComparator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Willian Mitsuda and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Willian Mitsuda - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.tasks.ui.workingsets;
-
-import java.text.Collator;
-import java.util.Comparator;
-
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * @author Willian Mitsuda
- */
-public class WorkingSetLabelComparator implements Comparator<IWorkingSet> {
-
- public int compare(IWorkingSet ws1, IWorkingSet ws2) {
- return Collator.getInstance().compare(ws1.getLabel(), ws2.getLabel());
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/messages.properties
deleted file mode 100644
index 3f82c779e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/messages.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-TaskWorkingSetPage_The_name_must_not_be_empty=The name must not be empty.
-TaskWorkingSetPage_The_name_must_not_have_a_leading_or_trailing_whitespace=The name must not have a leading or trailing whitespace.
-TaskWorkingSetPage_No_categories_queries_selected=No categories/queries selected.
-TaskWorkingSetPage_Resources=Resources
-TaskWorkingSetPage_Select_Working_Set_Elements=Select Working Set Elements
-TaskWorkingSetPage_Tasks=Tasks
-TaskWorkingSetPage_Page_Description=When this Working Set is selected views will be filtered just to show only these elements if the Window Working Set is enabled in the view.
-TaskWorkingSetPage_A_working_set_with_the_same_name_already_exists=A working set with the same name already exists.
-TaskWorkingSetPage_Select_All=Select All
-TaskWorkingSetPage_Deselect_All=Deselect All
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
deleted file mode 100644
index bc0b45ed9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eugene Kuleshov - improvements
- * David Green - fix for bug 244442
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.mylyn.internal.tasks.ui.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPage;
-import org.eclipse.mylyn.tasks.ui.wizards.TaskAttachmentPage;
-
-/**
- * Extend to provide connector-specific UI extensions.
- *
- * TODO: consider refactoring into extension points
- *
- * @author Mik Kersten
- * @since 2.0
- */
-public abstract class AbstractRepositoryConnectorUi {
-
- private static final String LABEL_TASK_DEFAULT = Messages.AbstractRepositoryConnectorUi_Task;
-
- private final boolean customNotificationHandling = false;
-
- /**
- * @return the unique type of the repository, e.g. "bugzilla"
- */
- public abstract String getConnectorKind();
-
- /**
- * @since 3.0
- */
- public abstract ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository);
-
- /**
- * @param repository
- * @param queryToEdit
- * can be null
- * @since 3.0
- */
- public abstract IWizard getQueryWizard(TaskRepository taskRepository, IRepositoryQuery queryToEdit);
-
- /**
- * @since 3.0
- */
- public abstract IWizard getNewTaskWizard(TaskRepository taskRepository, ITaskMapping selection);
-
- /**
- * Override to return a custom task editor ID. If overriding this method the connector becomes responsible for
- * showing the additional pages handled by the default task editor. As of Mylyn 2.0M2 these are the Planning and
- * Context pages.
- *
- * @since 3.0
- */
- public String getTaskEditorId(ITask repositoryTask) {
- return TaskEditor.ID_EDITOR;
- }
-
- public abstract boolean hasSearchPage();
-
- /**
- * Contributions to the UI legend.
- *
- * @deprecated use {@link #getLegendElements()} instead
- */
- @Deprecated
- public List<ITask> getLegendItems() {
- return Collections.emptyList();
- }
-
- /**
- * Contributions to the UI legend.
- *
- * @since 3.0
- */
- public List<LegendElement> getLegendElements() {
- return Collections.emptyList();
- }
-
- /**
- * @param repositoryTask
- * can be null
- * @since 3.0
- */
- public String getTaskKindLabel(ITask task) {
- return LABEL_TASK_DEFAULT;
- }
-
- /**
- * Connector-specific task icons. Not recommended to override unless providing custom icons and kind overlays.
- *
- * For connectors that have a decorator that they want to reuse, the connector can maintain a reference to the label
- * provider and get the descriptor from the images it returns.
- *
- * @since 3.0
- */
- public ImageDescriptor getImageDescriptor(IRepositoryElement element) {
- if (element instanceof IRepositoryQuery) {
- return TasksUiImages.QUERY;
- } else if (element instanceof ITask) {
- return TasksUiImages.TASK;
- } else {
- return null;
- }
- }
-
- /**
- * Task kind overlay, recommended to override with connector-specific overlay.
- *
- * @since 3.0
- */
- public ImageDescriptor getTaskKindOverlay(ITask task) {
- return null;
- }
-
- /**
- * Connector-specific priority icons. Not recommended to override since priority icons are used elsewhere in the
- * Task List UI (e.g. filter selection in view menu).
- *
- * @since 3.0
- */
- public ImageDescriptor getTaskPriorityOverlay(ITask task) {
- return TasksUiInternal.getPriorityImage(task);
- }
-
- /**
- * This method is not used anymore.
- *
- * @return returns null
- */
- @Deprecated
- public IWizard getAddExistingTaskWizard(TaskRepository repository) {
- return null;
- }
-
- /**
- * @since 3.0
- */
- public ITaskSearchPage getSearchPage(TaskRepository repository, IStructuredSelection selection) {
- return null;
- }
-
- /**
- * Override to return a URL that provides the user with an account creation page for the repository
- *
- * @param taskRepository
- * TODO
- */
- public String getAccountCreationUrl(TaskRepository taskRepository) {
- return null;
- }
-
- /**
- * Override to return a URL that provides the user with an account management page for the repository
- *
- * @param taskRepository
- * TODO
- */
- public String getAccountManagementUrl(TaskRepository taskRepository) {
- return null;
- }
-
- /**
- * Override to return a URL that provides the user with a history page for the task.
- *
- * @return a url of a page for the history of the task; null, if no history url is available
- * @since 3.0
- */
- public String getTaskHistoryUrl(TaskRepository taskRepository, ITask task) {
- return null;
- }
-
- /**
- * Override to return a textual reference to a comment, e.g. for Bugzilla this method returns <code>#12</code> for
- * comment 12. This reference is used when generating replies to comments
- *
- * @return a reference to <code>comment</code>; null, if no reference is available
- * @since 3.0
- */
- public String getReplyText(TaskRepository taskRepository, ITask task, ITaskComment taskComment, boolean includeTask) {
- return null;
- }
-
- /**
- * Returns an array of hyperlinks that link to tasks within <code>text</code>. If <code>index</code> is != -1
- * clients may limit the results to hyperlinks found at <code>index</code>. It is legal for clients to always return
- * all results.
- *
- * @param repository
- * the task repository, never <code>null</code>
- * @param text
- * the line of text
- * @param index
- * the index within <code>text</code>, if -1 return all hyperlinks found in text
- * @param textOffset
- * the offset of <code>text</code>
- * @return an array of hyperlinks, or null if no hyperlinks were found
- * @since 2.0
- */
- public IHyperlink[] findHyperlinks(TaskRepository repository, String text, int index, int textOffset) {
- return null;
- }
-
- /**
- * @since 3.0
- */
- public boolean hasCustomNotifications() {
- return customNotificationHandling;
- }
-
- /**
- * @since 3.0
- * @return true if connector doesn't support non-grouping (flattening) of subtasks
- */
- public boolean hasStrictSubtaskHierarchy() {
- return false;
- }
-
- /**
- * @since 3.0
- */
- public IWizardPage getTaskAttachmentPage(TaskAttachmentModel model) {
- return new TaskAttachmentPage(model);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskHyperlinkDetector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskHyperlinkDetector.java
deleted file mode 100644
index 3a2f3e241..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskHyperlinkDetector.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eugene Kuleshov - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Base class for hyperlink detectors that provides methods for extracting text from an {@link ITextViewer}.
- *
- * @author Rob Elves
- * @author Steffen Pingel
- * @author Eugene Kuleshov
- * @author Terry Hon
- * @since 3.1
- */
-public abstract class AbstractTaskHyperlinkDetector extends AbstractHyperlinkDetector {
-
- /**
- * @since 3.1
- */
- public AbstractTaskHyperlinkDetector() {
- }
-
- /**
- * @since 3.1
- */
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) {
- IDocument document = textViewer.getDocument();
- if (document == null || document.getLength() == 0) {
- return null;
- }
-
- String content;
- int contentOffset;
- int index;
- try {
- if (region.getLength() == 0) {
- // expand the region to include the whole line
- IRegion lineInfo = document.getLineInformationOfOffset(region.getOffset());
- int lineLength = lineInfo.getLength();
- int lineOffset = lineInfo.getOffset();
- int lineEnd = lineOffset + lineLength;
- int regionEnd = region.getOffset() + region.getLength();
- if (lineOffset < region.getOffset()) {
- int regionLength = Math.max(regionEnd, lineEnd) - lineOffset;
- contentOffset = lineOffset;
- content = document.get(lineOffset, regionLength);
- index = region.getOffset() - lineOffset;
- } else {
- // the line starts after region, may never happen
- int regionLength = Math.max(regionEnd, lineEnd) - region.getOffset();
- contentOffset = region.getOffset();
- content = document.get(contentOffset, regionLength);
- index = 0;
- }
- } else {
- content = document.get(region.getOffset(), region.getLength());
- contentOffset = region.getOffset();
- index = -1;
- }
- } catch (BadLocationException ex) {
- return null;
- }
-
- List<IHyperlink> hyperlinks = detectHyperlinks(textViewer, content, index, contentOffset);
- if (hyperlinks == null) {
- return null;
- }
-
- // filter hyperlinks that do not match original region
- if (region.getLength() == 0) {
- for (Iterator<IHyperlink> it = hyperlinks.iterator(); it.hasNext();) {
- IHyperlink hyperlink = it.next();
- IRegion hyperlinkRegion = hyperlink.getHyperlinkRegion();
- if (!isInRegion(region, hyperlinkRegion)) {
- it.remove();
- }
- }
- }
- if (hyperlinks.isEmpty()) {
- return null;
- }
- return hyperlinks.toArray(new IHyperlink[hyperlinks.size()]);
- }
-
- /**
- * @since 3.1
- */
- protected abstract List<IHyperlink> detectHyperlinks(ITextViewer textViewer, String content, int index,
- int contentOffset);
-
- private boolean isInRegion(IRegion detectInRegion, IRegion hyperlinkRegion) {
- return detectInRegion.getOffset() >= hyperlinkRegion.getOffset()
- && detectInRegion.getOffset() <= hyperlinkRegion.getOffset() + hyperlinkRegion.getLength();
- }
-
- /**
- * @since 3.1
- */
- protected List<TaskRepository> getTaskRepositories(ITextViewer textViewer) {
- List<TaskRepository> repositories = new ArrayList<TaskRepository>();
- TaskRepository selectedRepository = getTaskRepository(textViewer);
- if (selectedRepository != null) {
- repositories.add(selectedRepository);
- } else {
- repositories.addAll(TasksUi.getRepositoryManager().getAllRepositories());
- }
- return repositories;
- }
-
- /**
- * @since 3.1
- */
- protected TaskRepository getTaskRepository(ITextViewer textViewer) {
- TaskRepository repository = (TaskRepository) getAdapter(TaskRepository.class);
- if (repository != null) {
- return repository;
- }
-
- IResource resource = (IResource) getAdapter(IResource.class);
- if (resource == null) {
- // use currently active editor (if any)
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage activePage = window.getActivePage();
- if (activePage != null) {
- IWorkbenchPart part = activePage.getActivePart();
- if (part instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart) part).getEditorInput();
- if (input != null) {
- resource = (IResource) input.getAdapter(IResource.class);
- }
- }
- }
- }
- }
- if (resource != null) {
- return TasksUiPlugin.getDefault().getRepositoryForResource(resource);
- }
- return null;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskRepositoryLinkProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskRepositoryLinkProvider.java
deleted file mode 100644
index 3f773803b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractTaskRepositoryLinkProvider.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Extend to provide linking between repositories and tasks.
- *
- * @author Eugene Kuleshov
- * @since 2.0
- */
-public abstract class AbstractTaskRepositoryLinkProvider implements IExecutableExtension {
-
- private static final int DEFAULT_ORDER = 1000;
-
- private String id;
-
- private String name;
-
- private int order;
-
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
- id = config.getAttribute("id"); //$NON-NLS-1$
- name = config.getAttribute("name"); //$NON-NLS-1$
- try {
- order = Integer.parseInt(config.getAttribute("order")); //$NON-NLS-1$
- } catch (NumberFormatException ex) {
- order = DEFAULT_ORDER;
- }
- }
-
- /**
- * This operation is invoked frequently by hyperlink detectors and needs to be fast (i.e. cannot do network access
- * or invoke long-running refreshes). Return null if the repository cannot be resolved without excessive file
- * I/O.@since 3.0
- *
- * @since 3.0
- */
- public abstract TaskRepository getTaskRepository(IResource resource, IRepositoryManager repositoryManager);
-
- public boolean canSetTaskRepository(IResource resource) {
- return false;
- }
-
- public boolean setTaskRepository(IResource resource, TaskRepository repository) {
- return false;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public int getOrder() {
- return order;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/IHighlightingHyperlink.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/IHighlightingHyperlink.java
deleted file mode 100644
index cd5cd34be..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/IHighlightingHyperlink.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import org.eclipse.jface.text.IRegion;
-
-/**
- * @author Steffen Pingel
- * @since 3.1
- */
-public interface IHighlightingHyperlink {
-
- public IRegion getHighlightingRegion();
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiConstants.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiConstants.java
deleted file mode 100644
index e927daed0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-/**
- * @author Mik Kersten
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- */
-public interface ITasksUiConstants {
-
- public static final String ID_COMMAND_MARK_TASK_UNREAD = "org.eclipse.mylyn.tasks.ui.command.markTaskUnread"; //$NON-NLS-1$
-
- public static final String ID_COMMAND_MARK_TASK_READ = "org.eclipse.mylyn.tasks.ui.command.markTaskRead"; //$NON-NLS-1$
-
- public static final String ID_PAGE_PLANNING = "org.eclipse.mylyn.tasks.ui.pageFactory.Planning"; //$NON-NLS-1$
-
- public static final String ID_PERSPECTIVE_PLANNING = "org.eclipse.mylyn.tasks.ui.perspectives.planning"; //$NON-NLS-1$
-
- public static final String ID_PREFERENCES_COLORS_AND_FONTS = "org.eclipse.ui.preferencePages.ColorsAndFonts"; //$NON-NLS-1$
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiFactory.java
deleted file mode 100644
index 113b6134b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/ITasksUiFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * A factory for creating instances of reusable UI components.
- *
- * @author Steffen Pingel
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- * @since 3.1
- */
-public interface ITasksUiFactory {
-
- /**
- * Returns a content assist processor for references to tasks.
- *
- * @since 3.1
- */
- public abstract IContentAssistProcessor createTaskContentAssistProcessor(TaskRepository repository);
-
- /**
- * Returns a content proposal provider for repository users.
- *
- * @since 3.1
- * @see #createPersonContentProposalLabelProvider(TaskRepository)
- */
- public abstract IContentProposalProvider createPersonContentProposalProvider(TaskRepository repository);
-
- /**
- * Returns a label provider for repository users content proposals.
- *
- * @since 3.1
- * @see #createPersonContentProposalProvider(TaskRepository)
- */
- public abstract ILabelProvider createPersonContentProposalLabelProvider(TaskRepository repository);
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/LegendElement.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/LegendElement.java
deleted file mode 100644
index 2b0d02d14..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/LegendElement.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class LegendElement {
-
- /**
- * @since 3.0
- */
- public static LegendElement createTask(String label, ImageDescriptor overlay) {
- return new LegendElement(label, CommonImages.getCompositeTaskImage(TasksUiImages.TASK, overlay, false));
- }
-
- private final Image image;
-
- private final String label;
-
- private LegendElement(String label, Image image) {
- this.label = label;
- this.image = image;
- }
-
- /**
- * @since 3.0
- */
- public void dispose() {
- }
-
- /**
- * @since 3.0
- */
- public Image getImage() {
- return image;
- }
-
- /**
- * @since 3.0
- */
- public String getLabel() {
- return label;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskElementLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskElementLabelProvider.java
deleted file mode 100644
index 4e6989435..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskElementLabelProvider.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonColors;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFonts;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AutomaticRepositoryTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.DayDateRange;
-import org.eclipse.mylyn.internal.tasks.core.Person;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskGroup;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.WeekDateRange;
-import org.eclipse.mylyn.internal.tasks.ui.ITaskHighlighter;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * @author Mik Kersten
- * @since 3.0
- */
-public class TaskElementLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
-
- private static final String NO_SUMMARY_AVAILABLE = Messages.TaskElementLabelProvider__no_summary_available_;
-
- private final IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
-
- private static final Pattern pattern = Pattern.compile("\\d*: .*"); //$NON-NLS-1$
-
- private boolean wideImages = false;
-
- private class CompositeImageDescriptor {
-
- ImageDescriptor icon;
-
- ImageDescriptor overlayKind;
-
- };
-
- public TaskElementLabelProvider() {
- this(false);
- }
-
- public TaskElementLabelProvider(boolean wideImages) {
- super();
- this.wideImages = wideImages;
- }
-
- @Override
- public Image getImage(Object element) {
- CompositeImageDescriptor compositeDescriptor = getImageDescriptor(element);
- if (element instanceof ITask) {
- if (compositeDescriptor.overlayKind == null) {
- compositeDescriptor.overlayKind = CommonImages.OVERLAY_CLEAR;
- }
- return CommonImages.getCompositeTaskImage(compositeDescriptor.icon, compositeDescriptor.overlayKind,
- wideImages);
- } else if (element instanceof ITaskContainer) {
- return CommonImages.getCompositeTaskImage(compositeDescriptor.icon, CommonImages.OVERLAY_CLEAR, wideImages);
- } else {
- return CommonImages.getCompositeTaskImage(compositeDescriptor.icon, null, wideImages);
- }
- }
-
- private CompositeImageDescriptor getImageDescriptor(Object object) {
- CompositeImageDescriptor compositeDescriptor = new CompositeImageDescriptor();
- if (object instanceof UncategorizedTaskContainer) {
- compositeDescriptor.icon = TasksUiImages.CATEGORY_UNCATEGORIZED;
- return compositeDescriptor;
- } else if (object instanceof UnsubmittedTaskContainer) {
- compositeDescriptor.icon = TasksUiImages.CATEGORY_UNCATEGORIZED;
- return compositeDescriptor;
- } else if (object instanceof TaskCategory) {
- compositeDescriptor.icon = TasksUiImages.CATEGORY;
- } else if (object instanceof TaskGroup) {
- compositeDescriptor.icon = CommonImages.GROUPING;
- }
-
- if (object instanceof ITaskContainer) {
- IRepositoryElement element = (IRepositoryElement) object;
-
- AbstractRepositoryConnectorUi connectorUi = null;
- if (element instanceof ITask) {
- ITask repositoryTask = (ITask) element;
- connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind());
- if (connectorUi != null) {
- compositeDescriptor.overlayKind = connectorUi.getTaskKindOverlay(repositoryTask);
- }
- } else if (element instanceof IRepositoryQuery) {
- connectorUi = TasksUiPlugin.getConnectorUi(((IRepositoryQuery) element).getConnectorKind());
- }
-
- if (connectorUi != null) {
- compositeDescriptor.icon = connectorUi.getImageDescriptor(element);
- return compositeDescriptor;
- } else {
- if (element instanceof UnmatchedTaskContainer) {
- compositeDescriptor.icon = TasksUiImages.QUERY_UNMATCHED;
- } else if (element instanceof IRepositoryQuery || object instanceof UnmatchedTaskContainer) {
- compositeDescriptor.icon = TasksUiImages.QUERY;
- } else if (element instanceof ITask) {
- compositeDescriptor.icon = TasksUiImages.TASK;
- } else if (element instanceof ScheduledTaskContainer) {
- ScheduledTaskContainer scheduledTaskContainer = (ScheduledTaskContainer) element;
- if (scheduledTaskContainer.getDateRange() instanceof DayDateRange) {
- compositeDescriptor.icon = CommonImages.SCHEDULE_DAY;
- } else if (scheduledTaskContainer.getDateRange() instanceof WeekDateRange) {
- compositeDescriptor.icon = CommonImages.SCHEDULE_WEEK;
- } else {
- compositeDescriptor.icon = TasksUiImages.QUERY_UNMATCHED;
- }
- } else if (element instanceof Person) {
- compositeDescriptor.icon = CommonImages.PERSON;
- Person person = (Person) element;
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(person.getConnectorKind(),
- person.getRepositoryUrl());
-
- if (repository != null
- && !repository.isAnonymous()
- && (repository.getUserName() != null && repository.getUserName().equalsIgnoreCase(
- element.getHandleIdentifier()))) {
- compositeDescriptor.icon = CommonImages.PERSON_ME;
- }
- }
- return compositeDescriptor;
- }
- }
- return compositeDescriptor;
- }
-
- @Override
- public String getText(Object object) {
- if (object instanceof ITask) {
- ITask task = (ITask) object;
- if (task.getSummary() == null) {
- if (task.getTaskKey() != null) {
- return task.getTaskKey() + NO_SUMMARY_AVAILABLE;
- } else {
- return task.getTaskId() + NO_SUMMARY_AVAILABLE;
- }
- } else if (!pattern.matcher(task.getSummary()).matches()) {
- if (task.getTaskKey() != null) {
- return task.getTaskKey() + ": " + task.getSummary(); //$NON-NLS-1$
- } else {
- return task.getSummary();
- }
- } else {
- return task.getSummary();
- }
- } else if (object instanceof TaskGroup) {
- TaskGroup element = (TaskGroup) object;
- return element.getSummary();// + " / " + element.getChildren().size();
- } else if (object instanceof AutomaticRepositoryTaskContainer) {
- AutomaticRepositoryTaskContainer container = (AutomaticRepositoryTaskContainer) object;
-
- String result = container.getSummary();
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(container.getConnectorKind(),
- container.getRepositoryUrl());
- if (repository != null) {
- result = container.getSummaryLabel() + " [" + repository.getRepositoryLabel() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return result;
-
- } else if (object instanceof ITaskContainer) {
- IRepositoryElement element = (IRepositoryElement) object;
- return element.getSummary();
- } else {
- return super.getText(object);
- }
- }
-
- public Color getForeground(Object object) {
- if (object instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) object;
- if (task != null) {
- if (TasksUiPlugin.getTaskActivityManager().isCompletedToday(task)) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_COMPLETED_TODAY);
- } else if (task.isCompleted()) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_COMPLETED);
- } else if (TasksUi.getTaskActivityManager().isActive(task)) {
- return CommonColors.CONTEXT_ACTIVE;
- } else if (TasksUiPlugin.getTaskActivityManager().isOverdue(task)) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_OVERDUE);
- } else if (TasksUiPlugin.getTaskActivityManager().isDueToday(task)) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_SCHEDULED_TODAY);
- } else if (task.getScheduledForDate() != null
- && TasksUiPlugin.getTaskActivityManager().isPastReminder(task)) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_SCHEDULED_PAST);
- } else if (TasksUiPlugin.getTaskActivityManager().isScheduledForToday(task)) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_SCHEDULED_TODAY);
- } else if (TasksUiPlugin.getTaskActivityManager().isScheduledForThisWeek(task)) {
- return themeManager.getCurrentTheme()
- .getColorRegistry()
- .get(CommonThemes.COLOR_SCHEDULED_THIS_WEEK);
- }
- }
- } else if (object instanceof ITaskContainer) {
- for (ITask child : ((ITaskContainer) object).getChildren()) {
- if (child.isActive() || (child instanceof ITaskContainer && showHasActiveChild((ITaskContainer) child))) {
- return CommonColors.CONTEXT_ACTIVE;
- } else if (TasksUiPlugin.getTaskActivityManager().isOverdue(child)) {
-// } else if ((child.isPastReminder() && !child.isCompleted()) || showHasChildrenPastDue(child)) {
- return themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_OVERDUE);
- }
- }
- }
- return null;
- }
-
- public Color getBackground(Object element) {
- if (element instanceof ITask) {
- ITask task = (ITask) element;
- ITaskHighlighter highlighter = TasksUiPlugin.getDefault().getHighlighter();
- if (highlighter != null) {
- return highlighter.getHighlightColor(task);
- }
- }
- return null;
- }
-
- public Font getFont(Object element) {
- if (element instanceof AbstractTask) {
- if (((AbstractTask) element).isSynchronizing()) {
- if (((AbstractTask) element).isActive()) {
- return CommonFonts.BOLD_ITALIC;
- } else {
- return CommonFonts.ITALIC;
- }
- }
- }
-
- if (element instanceof IRepositoryQuery) {
- if (((RepositoryQuery) element).isSynchronizing()) {
- return CommonFonts.ITALIC;
- }
- }
-
- if (element instanceof ITaskContainer) {
- for (ITask child : ((ITaskContainer) element).getChildren()) {
- if (child.isActive() || (child instanceof ITaskContainer && showHasActiveChild((ITaskContainer) child))) {
- return CommonFonts.BOLD;
- }
- }
- }
-
- if (element instanceof AbstractTask) {
- if (((AbstractTask) element).isActive()) {
- return CommonFonts.BOLD;
- } else if (((AbstractTask) element).isCompleted()) {
- if (CommonFonts.HAS_STRIKETHROUGH
- && TasksUiPlugin.getDefault().getPluginPreferences().getBoolean(
- ITasksUiPreferenceConstants.USE_STRIKETHROUGH_FOR_COMPLETED)) {
- return CommonFonts.STRIKETHROUGH;
- } else {
- return null;
- }
- }
- for (ITask child : ((ITaskContainer) element).getChildren()) {
- if (child.isActive() || (child instanceof ITaskContainer && showHasActiveChild((ITaskContainer) child))) {
- return CommonFonts.BOLD;
- }
- }
- }
- return null;
- }
-
- private boolean showHasActiveChild(ITaskContainer container) {
- if (!TasksUiPlugin.getDefault().groupSubtasks(container)) {
- return false;
- }
-
- return showHasActiveChildHelper(container, new HashSet<IRepositoryElement>());
- }
-
- private boolean showHasActiveChildHelper(ITaskContainer container, Set<IRepositoryElement> visitedContainers) {
- for (IRepositoryElement child : container.getChildren()) {
- if (visitedContainers.contains(child)) {
- continue;
- }
- visitedContainers.add(child);
- if (child instanceof ITask && ((AbstractTask) child).isActive()) {
- return true;
- } else if (child instanceof ITaskContainer) {
- if (showHasActiveChildHelper((ITaskContainer) child, visitedContainers)) {
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlink.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlink.java
deleted file mode 100644
index d0294886b..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlink.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.internal.tasks.ui.Messages;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Immutable. Encapsulates information for linking to tasks from text.
- *
- * @author Eugene Kuleshov
- * @author Steffen Pingel
- * @noextend This class is not intended to be subclassed by clients.
- */
-public final class TaskHyperlink implements IHyperlink {
-
- private final IRegion region;
-
- private final TaskRepository repository;
-
- private final String taskId;
-
- public TaskHyperlink(IRegion region, TaskRepository repository, String taskId) {
- this.region = region;
- this.repository = repository;
- this.taskId = taskId;
- }
-
- public IRegion getHyperlinkRegion() {
- return region;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public String getTypeLabel() {
- return null;
- }
-
- /**
- * @Since 2.1
- * @return
- */
- public TaskRepository getRepository() {
- return repository;
- }
-
- public String getHyperlinkText() {
- return MessageFormat.format(Messages.TaskHyperlink_Open_Task_X_in_X, taskId, repository.getRepositoryLabel());
- }
-
- public void open() {
- if (repository != null) {
- TasksUiUtil.openTask(repository, taskId);
- } else {
- MessageDialog.openError(null, "Mylyn", Messages.TaskHyperlink_Could_not_determine_repository_for_report); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
deleted file mode 100644
index db56f9af9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import java.lang.reflect.Constructor;
-import java.util.Iterator;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.RGB;
-
-/**
- * A hyperlink presenter that displays a tooltip when hovering over a {@link TaskHyperlink}.
- *
- * @author Steffen Pingel
- * @author Frank Becker
- * @since 3.1
- */
-public final class TaskHyperlinkPresenter extends DefaultHyperlinkPresenter {
-
- private IRegion activeRegion;
-
- /**
- * Stores which task a tooltip is being displayed for. It is used to avoid having the same tooltip being set
- * multiple times while you move the mouse over a task hyperlink (bug#209409)
- */
- private ITask currentTaskHyperlink;
-
- private ITextViewer textViewer;
-
- private IHyperlinkPresenter multiplePresenter;
-
- /**
- * @see DefaultHyperlinkPresenter#DefaultHyperlinkPresenter(IPreferenceStore)
- */
- public TaskHyperlinkPresenter(IPreferenceStore store) {
- super(store);
- initMultipleHyperlinkSupport(IPreferenceStore.class, store);
- }
-
- /**
- * @see DefaultHyperlinkPresenter#DefaultHyperlinkPresenter(RGB)
- */
- public TaskHyperlinkPresenter(RGB color) {
- super(color);
- initMultipleHyperlinkSupport(RGB.class, color);
- }
-
- @Override
- public boolean canShowMultipleHyperlinks() {
- return multiplePresenter != null;
- }
-
- @SuppressWarnings("unchecked")
- private <T> void initMultipleHyperlinkSupport(Class<T> argClass, T arg) {
- try {
- Class<IHyperlinkPresenter> clazz = (Class<IHyperlinkPresenter>) Class.forName("org.eclipse.jface.text.hyperlink.MultipleHyperlinkPresenter");
- Constructor<IHyperlinkPresenter> constructor = clazz.getDeclaredConstructor(argClass);
- multiplePresenter = constructor.newInstance(arg);
- } catch (Throwable t) {
- // ignore
- }
- }
-
- @Override
- public void install(ITextViewer textViewer) {
- this.textViewer = textViewer;
- super.install(textViewer);
- if (multiplePresenter != null) {
- multiplePresenter.install(textViewer);
- }
- }
-
- @Override
- public void uninstall() {
- hideHyperlinks();
- this.textViewer = null;
- super.uninstall();
- if (multiplePresenter != null) {
- multiplePresenter.uninstall();
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void applyTextPresentation(TextPresentation textPresentation) {
- super.applyTextPresentation(textPresentation);
- // decorate hyperlink as strike-through if task is completed, this is now also handled by TaskHyperlinkTextPresentationManager
- if (activeRegion != null && currentTaskHyperlink != null && currentTaskHyperlink.isCompleted()) {
- Iterator<StyleRange> styleRangeIterator = textPresentation.getAllStyleRangeIterator();
- while (styleRangeIterator.hasNext()) {
- StyleRange styleRange = styleRangeIterator.next();
- if (activeRegion.getOffset() == styleRange.start && activeRegion.getLength() == styleRange.length) {
- styleRange.strikeout = true;
- break;
- }
- }
- }
- }
-
- @Override
- public void showHyperlinks(IHyperlink[] hyperlinks) {
- if (hyperlinks.length > 1 && multiplePresenter != null) {
- multiplePresenter.showHyperlinks(hyperlinks);
- } else {
- activeRegion = null;
- if (hyperlinks.length > 0 && hyperlinks[0] instanceof TaskHyperlink) {
- TaskHyperlink hyperlink = (TaskHyperlink) hyperlinks[0];
-
- TaskList taskList = TasksUiPlugin.getTaskList();
- String repositoryUrl = hyperlink.getRepository().getRepositoryUrl();
-
- ITask task = taskList.getTask(repositoryUrl, hyperlink.getTaskId());
- if (task == null) {
- task = taskList.getTaskByKey(repositoryUrl, hyperlink.getTaskId());
- }
-
- if (task != null && task != currentTaskHyperlink) {
- currentTaskHyperlink = task;
- activeRegion = hyperlink.getHyperlinkRegion();
- if (textViewer != null && textViewer.getTextWidget() != null
- && !textViewer.getTextWidget().isDisposed()) {
- if (task.getTaskKey() == null) {
- textViewer.getTextWidget().setToolTipText(task.getSummary());
- } else {
- textViewer.getTextWidget().setToolTipText(task.getTaskKey() + ": " + task.getSummary());
- }
- }
- }
- }
- super.showHyperlinks(hyperlinks);
- }
- }
-
- @Override
- public void hideHyperlinks() {
- if (currentTaskHyperlink != null) {
- if (textViewer != null && textViewer.getTextWidget() != null && !textViewer.getTextWidget().isDisposed()) {
- textViewer.getTextWidget().setToolTipText(null);
- }
- currentTaskHyperlink = null;
- }
- if (multiplePresenter != null) {
- multiplePresenter.hideHyperlinks();
- }
- super.hideHyperlinks();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskRepositoryLocationUiFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskRepositoryLocationUiFactory.java
deleted file mode 100644
index e9ad53058..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskRepositoryLocationUiFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import org.eclipse.mylyn.commons.net.AbstractWebLocation;
-import org.eclipse.mylyn.internal.tasks.ui.TaskRepositoryLocationUi;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory;
-
-/**
- * @since 2.2
- * @author Steffen Pingel
- */
-public class TaskRepositoryLocationUiFactory extends TaskRepositoryLocationFactory {
-
- /**
- * @since 3.0
- */
- @Override
- public AbstractWebLocation createWebLocation(TaskRepository taskRepository) {
- return new TaskRepositoryLocationUi(taskRepository);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUi.java
deleted file mode 100644
index ec4bcb4b2..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUi.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.IRepositoryModel;
-import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
-
-/**
- * @noextend This class is not intended to be subclassed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @author Steffen Pingel
- * @author Mik Kersten
- * @since 3.0
- */
-public class TasksUi {
-
- /**
- * @since 3.0
- */
- public static AbstractRepositoryConnector getRepositoryConnector(String kind) {
- return getRepositoryManager().getRepositoryConnector(kind);
- }
-
- /**
- * @since 3.0
- */
- public static AbstractRepositoryConnectorUi getRepositoryConnectorUi(String kind) {
- return TasksUiPlugin.getConnectorUi(kind);
- }
-
- /**
- * @since 3.0
- */
- public static IRepositoryManager getRepositoryManager() {
- return TasksUiPlugin.getRepositoryManager();
- }
-
- /**
- * @since 3.0
- */
- public static ITaskActivityManager getTaskActivityManager() {
- return TasksUiPlugin.getTaskActivityManager();
- }
-
- /**
- * @since 3.0
- */
- public static ITaskDataManager getTaskDataManager() {
- return TasksUiPlugin.getTaskDataManager();
- }
-
- /**
- * @since 3.0
- */
- public static IRepositoryModel getRepositoryModel() {
- return TasksUiPlugin.getRepositoryModel();
- }
-
- /**
- * @since 3.1
- */
- public static ITasksUiFactory getUiFactory() {
- return TasksUiPlugin.getUiFactory();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java
deleted file mode 100644
index 0792d79b0..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @noextend This class is not intended to be subclassed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @author Mik Kersten
- * @since 3.0
- */
-public class TasksUiImages {
-
- private static final URL baseURL = TasksUiPlugin.getDefault().getBundle().getEntry("/icons/"); //$NON-NLS-1$
-
- private static final String VIEW = "eview16"; //$NON-NLS-1$
-
- private static final String TOOL = "etool16"; //$NON-NLS-1$
-
- private static final String TOOL_SMALL = "etool12"; //$NON-NLS-1$
-
- private static final String OBJ = "obj16"; //$NON-NLS-1$
-
- private static final String WIZBAN = "wizban"; //$NON-NLS-1$
-
- // Tasks and Task List elements
-
- public static final ImageDescriptor TASK = create(TOOL, "task.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_COMPLETE = create(TOOL, "task-complete.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_INCOMPLETE = create(TOOL, "task-incomplete.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_COMPLETED = create(TOOL, "task-completed.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_NOTES = create(TOOL, "task-notes.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_NEW = create(TOOL, "task-new.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_NEW_SUB = create(TOOL, "sub-task-new.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_REPOSITORY_HISTORY = create(TOOL, "task-repository-history.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_REMOTE = create(TOOL, "task-remote.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_WORKING_SET = create(TOOL, "open-task.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASKS_VIEW = create("eview16", "task-list.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- public static final ImageDescriptor TASK_ATTACHMENT_PATCH = create(OBJ, "attachment-patch.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_RETRIEVE = create(TOOL, "task-retrieve.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_REPOSITORY = create(TOOL, "task-repository.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor TASK_REPOSITORY_NEW = create(TOOL, "task-repository-new.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CATEGORY = create(TOOL, "category.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CATEGORY_NEW = create(TOOL, "category-new.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CATEGORY_UNCATEGORIZED = create(TOOL, "category-archive.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor QUERY = create(TOOL, "query.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor QUERY_NEW = create(TOOL, "query-new.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor QUERY_UNMATCHED = create(TOOL, "query-unmatched.png"); //$NON-NLS-1$
-
- public static final ImageDescriptor REPOSITORY = create("eview16", "repository.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- public static final ImageDescriptor REPOSITORY_OFFLINE = ImageDescriptor.createWithFlags(TasksUiImages.REPOSITORY,
- SWT.IMAGE_GRAY);
-
- public static final ImageDescriptor REPOSITORY_SYNCHRONIZE_SMALL = create(TOOL_SMALL,
- "repository-synchronize-small.png"); //$NON-NLS-1$
-
- public static final ImageDescriptor REPOSITORY_SYNCHRONIZE = create(TOOL, "repository-synchronize.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor REPOSITORY_SUBMIT = create(TOOL, "repository-submit.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor REPOSITORY_SMALL = create(OBJ, "repository-small.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor REPOSITORY_NEW = create("etool16", "repository-new.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * @since 3.1
- */
- public static final ImageDescriptor REPOSITORY_VALIDATE = create("obj16", "resource_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- public static final ImageDescriptor REPOSITORIES_VIEW = create("eview16", "repositories.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Context and activation
-
- public static final ImageDescriptor CONTEXT_ACTIVE = create(TOOL, "task-active.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_ACTIVE_CENTERED = create(TOOL, "task-active-centered.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_INACTIVE_EMPTY = create(TOOL, "task-inactive.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_INACTIVE = create(TOOL, "task-context.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_FOCUS = create(VIEW, "focus.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_ATTACH = create(TOOL, "context-attach.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_RETRIEVE = create(TOOL, "context-retrieve.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_TRANSFER = create(TOOL, "context-transfer.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_CLEAR = create(TOOL, "context-clear.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS = create(TOOL, "navigate-previous.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS_PAUSE = create(TOOL, "navigate-previous-pause.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS_ACTIVE = create(TOOL, "navigate-previous-active.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_HISTORY_NEXT = create(TOOL, "navigate-next.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_CAPTURE_PAUSE = create(TOOL, "capture-pause.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_ADD = create(TOOL, "context-add.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor CONTEXT_COPY = create(TOOL, "context-transfer.gif"); //$NON-NLS-1$
-
- // Comments and collaboration
-
- public static final ImageDescriptor COMMENT = create(TOOL, "comment.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor COMMENT_SORT_DOWN = create(TOOL, "sort-down.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor COMMENT_SORT_UP = create(TOOL, "sort-up.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor COMMENT_SORT_DOWN_GRAY = create(TOOL, "sort-down-gray.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor COMMENT_SORT_UP_GRAY = create(TOOL, "sort-up-gray.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor COMMENT_REPLY = create(TOOL, "reply.gif"); //$NON-NLS-1$
-
- /**
- * @since 3.1
- */
- public static final ImageDescriptor COMMENT_REPLY_SMALL = create(TOOL_SMALL, "reply.gif"); //$NON-NLS-1$
-
- // Wizard banners
-
- public static final ImageDescriptor BANNER_REPOSITORY = create(WIZBAN, "banner-repository.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor BANNER_REPOSITORY_SETTINGS = create(WIZBAN, "banner-repository-settings.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor BANNER_REPOSITORY_CONTEXT = create(WIZBAN, "banner-repository-context.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor BANNER_WORKING_SET = create(WIZBAN, "workset_wiz.png"); //$NON-NLS-1$
-
- public static Image getImageForPriority(PriorityLevel priorityLevel) {
- if (priorityLevel == null) {
- return null;
- } else {
- ImageDescriptor imageDescriptor = getImageDescriptorForPriority(priorityLevel);
- if (imageDescriptor != null) {
- return CommonImages.getImage(imageDescriptor);
- }
- }
- return null;
- }
-
- public static ImageDescriptor getImageDescriptorForPriority(PriorityLevel priorityLevel) {
- if (priorityLevel == null) {
- return null;
- }
- switch (priorityLevel) {
- case P1:
- return CommonImages.PRIORITY_1;
- case P2:
- return CommonImages.PRIORITY_2;
- case P3:
- return CommonImages.PRIORITY_3;
- case P4:
- return CommonImages.PRIORITY_4;
- case P5:
- return CommonImages.PRIORITY_5;
- default:
- return null;
- }
- }
-
- public static ImageDescriptor create(String prefix, String name) {
- try {
- return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
- } catch (MalformedURLException e) {
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
-
- private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
- if (baseURL == null) {
- throw new MalformedURLException();
- }
-
- StringBuffer buffer = new StringBuffer(prefix);
- buffer.append('/');
- buffer.append(name);
- return new URL(baseURL, buffer.toString());
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
deleted file mode 100644
index eddebe82a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Calendar;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiMessages;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
-import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.MultiRepositoryAwareWizard;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewLocalTaskWizard;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.mylyn.tasks.ui.wizards.TaskRepositoryWizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.browser.IWebBrowser;
-import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-import org.eclipse.ui.internal.browser.WebBrowserPreference;
-import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
-
-/**
- * @noextend This class is not intended to be subclassed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @since 2.0
- * @author Mik Kersten
- * @author Steffen Pingel
- * @author Shawn Minto
- */
-public class TasksUiUtil {
-
- /**
- * Flag that is passed along to the workbench browser support when a task is opened in a browser because no rich
- * editor was available.
- *
- * @see #openTask(String)
- */
- public static final int FLAG_NO_RICH_EDITOR = 1 << 17;
-
- /**
- * @since 3.0
- */
- public static ITask createOutgoingNewTask(String connectorKind, String repositoryUrl) {
- Assert.isNotNull(connectorKind);
- LocalTask task = TasksUiInternal.createNewLocalTask(null);
- task.setAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_CONNECTOR_KIND, connectorKind);
- task.setAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_REPOSITORY_URL, repositoryUrl);
- task.setSynchronizationState(SynchronizationState.OUTGOING_NEW);
- return task;
- }
-
- /**
- * @since 3.0
- */
- public static boolean isOutgoingNewTask(ITask task, String connectorKind) {
- Assert.isNotNull(task);
- Assert.isNotNull(connectorKind);
- return connectorKind.equals(task.getAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_CONNECTOR_KIND));
- }
-
- /**
- * @since 3.1
- */
- public static TaskRepository getOutgoingNewTaskRepository(ITask task) {
- Assert.isNotNull(task);
- String connectorKind = task.getAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_CONNECTOR_KIND);
- String repositoryUrl = task.getAttribute(ITasksCoreConstants.ATTRIBUTE_OUTGOING_NEW_REPOSITORY_URL);
- if (connectorKind != null && repositoryUrl != null) {
- return TasksUi.getRepositoryManager().getRepository(connectorKind, repositoryUrl);
- }
- return null;
- }
-
- public static TaskRepository getSelectedRepository() {
- return getSelectedRepository(null);
- }
-
- /**
- * Will use the workbench window's selection if viewer's selection is null
- */
- public static TaskRepository getSelectedRepository(StructuredViewer viewer) {
- IStructuredSelection selection = null;
- if (viewer != null) {
- selection = (IStructuredSelection) viewer.getSelection();
- }
- if (selection == null || selection.isEmpty()) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- ISelection windowSelection = window.getSelectionService().getSelection();
- if (windowSelection instanceof IStructuredSelection) {
- selection = (IStructuredSelection) windowSelection;
- }
- }
-
- if (selection == null) {
- return null;
- }
-
- Object element = selection.getFirstElement();
- if (element instanceof TaskRepository) {
- return (TaskRepository) selection.getFirstElement();
- } else if (element instanceof IRepositoryQuery) {
- IRepositoryQuery query = (IRepositoryQuery) element;
- return TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(), query.getRepositoryUrl());
- } else if (element instanceof ITask) {
- ITask task = (ITask) element;
- return TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(), task.getRepositoryUrl());
- } else if (element instanceof IResource) {
- IResource resource = (IResource) element;
- return TasksUiPlugin.getDefault().getRepositoryForResource(resource);
- } else if (element instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) element;
- IResource resource = (IResource) adaptable.getAdapter(IResource.class);
- if (resource != null) {
- return TasksUiPlugin.getDefault().getRepositoryForResource(resource);
- } else {
- ITask task = (ITask) adaptable.getAdapter(AbstractTask.class);
- if (task != null) {
- ITask rtask = task;
- return TasksUi.getRepositoryManager().getRepository(rtask.getConnectorKind(),
- rtask.getRepositoryUrl());
- }
- }
- }
-
- // TODO mapping between LogEntry.pliginId and repositories
- // TODO handle other selection types
- return null;
- }
-
- private static String getTaskEditorId(final ITask task) {
- String taskEditorId = TaskEditor.ID_EDITOR;
- if (task != null) {
- ITask repositoryTask = task;
- AbstractRepositoryConnectorUi repositoryUi = TasksUiPlugin.getConnectorUi(repositoryTask.getConnectorKind());
- String customTaskEditorId = repositoryUi.getTaskEditorId(repositoryTask);
- if (customTaskEditorId != null) {
- taskEditorId = customTaskEditorId;
- }
- }
- return taskEditorId;
- }
-
- public static IEditorPart openEditor(IEditorInput input, String editorId, IWorkbenchPage page) {
- if (page == null) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- page = window.getActivePage();
- }
- }
- if (page == null) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unable to open editor for \"" + input //$NON-NLS-1$
- + "\": no active workbench window")); //$NON-NLS-1$
- return null;
- }
- try {
- return page.openEditor(input, editorId);
- } catch (PartInitException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Open for editor failed: " + input //$NON-NLS-1$
- + ", taskId: " + editorId, e)); //$NON-NLS-1$
- }
- return null;
- }
-
- public static int openEditRepositoryWizard(TaskRepository repository) {
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- repository.getConnectorKind());
- if (connector == null || !connector.isUserManaged()) {
- return Window.CANCEL;
- }
-
- try {
- EditRepositoryWizard wizard = new EditRepositoryWizard(repository);
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null && !shell.isDisposed()) {
- WizardDialog dialog = new TaskRepositoryWizardDialog(shell, wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.CANCEL) {
- dialog.close();
- return Window.CANCEL;
- }
- }
-
- if (TaskRepositoriesView.getFromActivePerspective() != null) {
- TaskRepositoriesView.getFromActivePerspective().getViewer().refresh();
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
- return Window.OK;
- }
-
- /**
- * @since 3.0
- */
- public static boolean openNewLocalTaskEditor(Shell shell, ITaskMapping taskSelection) {
- return openNewTaskEditor(shell, new NewLocalTaskWizard(taskSelection), taskSelection);
- }
-
- private static boolean openNewTaskEditor(Shell shell, IWizard wizard, ITaskMapping taskSelection) {
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.setBlockOnOpen(true);
-
- // make sure the wizard has created its pages
- dialog.create();
- if (!(wizard instanceof MultiRepositoryAwareWizard) && wizard.canFinish()) {
- wizard.performFinish();
- return true;
- }
-
- int result = dialog.open();
- return result == Window.OK;
- }
-
- /**
- * @since 3.0
- */
- public static boolean openNewTaskEditor(Shell shell, ITaskMapping taskSelection, TaskRepository taskRepository) {
- final IWizard wizard;
- List<TaskRepository> repositories = TasksUi.getRepositoryManager().getAllRepositories();
- if (taskRepository == null && repositories.size() == 1) {
- // only the Local repository connector is available
- taskRepository = repositories.get(0);
- }
-
- if (taskRepository != null) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskRepository.getConnectorKind());
- wizard = connectorUi.getNewTaskWizard(taskRepository, taskSelection);
- } else {
- wizard = TasksUiInternal.createNewTaskWizard(taskSelection);
- }
-
- return openNewTaskEditor(shell, wizard, taskSelection);
- }
-
- /**
- * Either pass in a repository and taskId, or fullUrl, or all of them
- *
- * @deprecated Use {@link #openTask(String,String,String)} instead
- */
- @Deprecated
- public static boolean openRepositoryTask(String repositoryUrl, String taskId, String fullUrl) {
- return openTask(repositoryUrl, taskId, fullUrl);
- }
-
- /**
- * @deprecated Use {@link #openTask(TaskRepository,String)} instead
- */
- @Deprecated
- public static boolean openRepositoryTask(TaskRepository repository, String taskId) {
- return openTask(repository, taskId);
- }
-
- /**
- * @since 3.0
- */
- public static boolean openTask(ITask task) {
- Assert.isNotNull(task);
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- boolean openWithBrowser = !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.EDITOR_TASKS_RICH);
- if (openWithBrowser) {
- openUrl(task.getUrl());
- return true;
- } else {
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- IEditorInput editorInput = new TaskEditorInput(taskRepository, task);
- boolean wasOpen = refreshEditorContentsIfOpen(task, editorInput);
- if (wasOpen) {
- synchronizeTask(taskRepository, task);
- return true;
- } else {
- IWorkbenchPage page = window.getActivePage();
- IEditorPart editor = openEditor(editorInput, getTaskEditorId(task), page);
- if (editor != null) {
- synchronizeTask(taskRepository, task);
- return true;
- }
- }
- }
- } else {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unable to open editor for \"" //$NON-NLS-1$
- + task.getSummary() + "\": no active workbench window")); //$NON-NLS-1$
- }
- return false;
- }
-
- private static void synchronizeTask(TaskRepository taskRepository, ITask task) {
- if (task instanceof LocalTask) {
- return;
- }
-
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- task.getConnectorKind());
- if (connector.canSynchronizeTask(taskRepository, task)) {
- TasksUiInternal.synchronizeTask(connector, task, false, null);
- }
- }
-
- /**
- * Resolves a rich editor for the task if available.
- *
- * @since 3.0
- */
- public static void openTask(String url) {
- AbstractTask task = TasksUiInternal.getTaskByUrl(url);
- if (task != null && !(task instanceof LocalTask)) {
- openTask(task);
- } else {
- boolean opened = false;
- if (url != null) {
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
- .getConnectorForRepositoryTaskUrl(url);
- if (connector != null) {
- String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(url);
- if (repositoryUrl != null) {
- String id = connector.getTaskIdFromTaskUrl(url);
- if (id != null) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(
- connector.getConnectorKind(), repositoryUrl);
- if (repository != null) {
- opened = openTask(repository, id);
- }
- }
- }
- }
- }
- if (!opened) {
- openUrl(url, 0);
- }
- }
- }
-
- /**
- * Either pass in a repository and taskId, or fullUrl, or all of them
- *
- * @since 3.0
- */
- public static boolean openTask(String repositoryUrl, String taskId, String fullUrl) {
- AbstractTask task = TasksUiInternal.getTask(repositoryUrl, taskId, fullUrl);
-
- if (task != null) {
- return TasksUiUtil.openTask(task);
- }
-
- boolean opened = false;
-
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getConnectorForRepositoryTaskUrl(
- fullUrl);
- if (connector != null) {
- if (repositoryUrl != null && taskId != null) {
- opened = TasksUiInternal.openRepositoryTask(connector.getConnectorKind(), repositoryUrl, taskId);
- } else {
- repositoryUrl = connector.getRepositoryUrlFromTaskUrl(fullUrl);
- taskId = connector.getTaskIdFromTaskUrl(fullUrl);
- if (repositoryUrl != null && taskId != null) {
- opened = TasksUiInternal.openRepositoryTask(connector.getConnectorKind(), repositoryUrl, taskId);
- }
- }
- }
-
- if (!opened) {
- TasksUiUtil.openUrl(fullUrl);
- }
-
- return true;
- }
-
- /**
- * @since 3.0
- */
- public static boolean openTask(TaskRepository repository, String taskId) {
- Assert.isNotNull(repository);
- Assert.isNotNull(taskId);
-
- AbstractTask task = (AbstractTask) TasksUiInternal.getTaskList().getTask(repository.getRepositoryUrl(), taskId);
- if (task == null) {
- task = TasksUiPlugin.getTaskList().getTaskByKey(repository.getRepositoryUrl(), taskId);
- }
- if (task != null) {
- return TasksUiUtil.openTask(task);
- } else {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind());
- if (connectorUi != null) {
- try {
- return TasksUiInternal.openRepositoryTask(connectorUi.getConnectorKind(),
- repository.getRepositoryUrl(), taskId);
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Internal error while opening repository task", e)); //$NON-NLS-1$
- }
- }
- }
- return false;
- }
-
- /**
- * @since 3.0
- *
- * TODO: move to commons
- */
- public static void openUrl(String location) {
- openUrl(location, FLAG_NO_RICH_EDITOR);
- }
-
- private static void openUrl(String location, int customFlags) {
- try {
- URL url = null;
-
- if (location != null) {
- url = new URL(location);
- }
- if (WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.EXTERNAL) {
- try {
- IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
- support.getExternalBrowser().openURL(url);
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not open task url", e)); //$NON-NLS-1$
- }
- } else {
- IWebBrowser browser = null;
- int flags = customFlags;
- if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
- flags |= IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR
- | IWorkbenchBrowserSupport.NAVIGATION_BAR;
- } else {
- flags |= IWorkbenchBrowserSupport.AS_EXTERNAL | IWorkbenchBrowserSupport.LOCATION_BAR
- | IWorkbenchBrowserSupport.NAVIGATION_BAR;
- }
-
- String generatedId = "org.eclipse.mylyn.web.browser-" + Calendar.getInstance().getTimeInMillis(); //$NON-NLS-1$
- browser = WorkbenchBrowserSupport.getInstance().createBrowser(flags, generatedId, null, null);
- browser.openURL(url);
- }
- } catch (PartInitException e) {
- MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.TasksUiUtil_Browser_init_error,
- Messages.TasksUiUtil_Browser_could_not_be_initiated);
- } catch (MalformedURLException e) {
- if (location != null && location.trim().equals("")) { //$NON-NLS-1$
- MessageDialog.openInformation(Display.getDefault().getActiveShell(), TasksUiMessages.DIALOG_EDITOR,
- Messages.TasksUiUtil_No_URL_to_open + location);
- } else {
- MessageDialog.openInformation(Display.getDefault().getActiveShell(), TasksUiMessages.DIALOG_EDITOR,
- Messages.TasksUiUtil_Could_not_open_URL_ + location);
- }
- }
- }
-
- /**
- * If task is already open and has incoming, must force refresh in place
- */
- private static boolean refreshEditorContentsIfOpen(ITask task, IEditorInput editorInput) {
- if (task != null) {
- if (task.getSynchronizationState() == SynchronizationState.INCOMING
- || task.getSynchronizationState() == SynchronizationState.CONFLICT) {
- for (TaskEditor editor : TasksUiInternal.getActiveRepositoryTaskEditors()) {
- if (editor.getEditorInput().equals(editorInput)) {
- editor.refreshPages();
- editor.getEditorSite().getPage().activate(editor);
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * @since 3.0
- */
- public static IViewPart openTasksViewInActivePerspective() {
- try {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(TaskListView.ID);
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not show Task List view", e)); //$NON-NLS-1$
- return null;
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java
deleted file mode 100644
index b2b369c20..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractAttributeEditor {
-
- private Control control;
-
- private boolean decorationEnabled;
-
- private Label labelControl;
-
- private LayoutHint layoutHint;
-
- private final TaskDataModel manager;
-
- private final TaskAttribute taskAttribute;
-
- private boolean readOnly;
-
- /**
- * @since 3.0
- */
- public AbstractAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- Assert.isNotNull(manager);
- Assert.isNotNull(taskAttribute);
- this.manager = manager;
- this.taskAttribute = taskAttribute;
- setDecorationEnabled(true);
- setReadOnly(taskAttribute.getMetaData().isReadOnly());
- }
-
- /**
- * @since 3.0
- */
- protected void attributeChanged() {
- getModel().attributeChanged(getTaskAttribute());
- }
-
- /**
- * @since 3.0
- */
- public abstract void createControl(Composite parent, FormToolkit toolkit);
-
- /**
- * @since 3.0
- */
- public void createLabelControl(Composite composite, FormToolkit toolkit) {
- labelControl = toolkit.createLabel(composite, getLabel());
- labelControl.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- }
-
- /**
- * @since 3.0
- */
- public void dispose() {
- }
-
- /**
- * @since 3.0
- */
- public TaskDataModel getModel() {
- return manager;
- }
-
- /**
- * @since 3.0
- */
- protected TaskAttributeMapper getAttributeMapper() {
- return getModel().getTaskData().getAttributeMapper();
- }
-
- /**
- * @since 3.0
- */
- public Control getControl() {
- return control;
- }
-
- /**
- * @since 3.0
- */
- public String getLabel() {
- String label = getAttributeMapper().getLabel(getTaskAttribute());
- return TasksUiInternal.escapeLabelText(label);
- }
-
- /**
- * @since 3.0
- */
- public Label getLabelControl() {
- return labelControl;
- }
-
- /**
- * @since 3.0
- */
- public LayoutHint getLayoutHint() {
- return layoutHint;
- }
-
- /**
- * @since 3.0
- */
- public TaskAttribute getTaskAttribute() {
- return taskAttribute;
- }
-
- /**
- * @since 3.0
- */
- public boolean hasLabel() {
- // TODO EDITOR
- return true;
- }
-
- /**
- * @since 3.0
- */
- public boolean isDecorationEnabled() {
- return decorationEnabled;
- }
-
- /**
- * @since 3.0
- */
- protected void setControl(Control control) {
- this.control = control;
- }
-
- /**
- * @since 3.0
- */
- public void setDecorationEnabled(boolean decorationEnabled) {
- this.decorationEnabled = decorationEnabled;
- }
-
- /**
- * @since 3.1
- */
- public void setLayoutHint(LayoutHint layoutHint) {
- this.layoutHint = layoutHint;
- }
-
- /**
- * @since 3.0
- */
- public void decorate(Color color) {
- if (isDecorationEnabled()) {
- if (manager.hasBeenRead() && manager.hasIncomingChanges(getTaskAttribute())) {
- decorateIncoming(color);
- }
- if (manager.hasOutgoingChanges(getTaskAttribute())) {
- decorateOutgoing(color);
- }
- }
- }
-
- /**
- * @since 3.0
- */
- protected void decorateOutgoing(Color color) {
- if (labelControl != null) {
- labelControl.setText("*" + labelControl.getText()); //$NON-NLS-1$
- }
- }
-
- /**
- * @since 3.0
- */
- protected void decorateIncoming(Color color) {
- if (getControl() != null) {
- getControl().setBackground(color);
- }
- }
-
- /**
- * @since 3.0
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /**
- * @since 3.0
- */
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- /**
- * Refreshes the state of the widget from the data model. The default implementation throws
- * <code>UnsupportedOperationException</code>.
- *
- * <p>
- * Subclasses should overwrite this method.
- *
- * @since 3.1
- * @throws UnsupportedOperationException
- * if this method is not supported by the editor
- */
- public void refresh() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRenderingEngine.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRenderingEngine.java
deleted file mode 100644
index ba5e2991e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRenderingEngine.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xiaoyang Guan - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Extend to provide HTML preview for ticket description and comments
- *
- * @author Xiaoyang Guan
- * @since 2.1
- */
-// TODO 4.0 move to core?
-public abstract class AbstractRenderingEngine {
-
- /**
- * generate HTML preview page for <code>text</code>
- */
- public abstract String renderAsHtml(TaskRepository repository, String text, IProgressMonitor monitor)
- throws CoreException;
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorExtension.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorExtension.java
deleted file mode 100644
index 3858f8c3c..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorExtension.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.contexts.IContextService;
-
-/**
- * An extension that provides task editor capabilities beyond the default, oriented towards providing markup-aware
- * editing and viewing
- *
- * @author David Green
- * @since 3.1
- */
-public abstract class AbstractTaskEditorExtension {
-
- /**
- * The key to access the {@link TaskRepository} property that stores the URL of an associated wiki.
- */
- public static final String INTERNAL_WIKI_LINK_PATTERN = "wikiLinkPattern"; //$NON-NLS-1$
-
- /**
- * Creates a source viewer that can be used to view content in the task editor. The source viewer should be
- * configured with a source viewer configuration prior to returning.
- *
- * @param taskRepository
- * the task repository for which the viewer is created
- * @param parent
- * the control parent of the source viewer
- * @param style
- * the styles to use
- */
- public abstract SourceViewer createViewer(TaskRepository taskRepository, Composite parent, int style);
-
- /**
- * Creates a source viewer that can be used to edit content in the task editor. The source viewer should be
- * configured with a source viewer configuration prior to returning.
- *
- * @param taskRepository
- * the task repository for which the viewer is created
- * @param parent
- * the control parent of the source viewer
- * @param style
- * the styles to use
- */
- public abstract SourceViewer createEditor(TaskRepository taskRepository, Composite parent, int style);
-
- /**
- * Returns the editor context id, to be passed to the {@link IContextService} when the editor is in focus.
- */
- public abstract String getEditorContextId();
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
deleted file mode 100644
index 354791723..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
+++ /dev/null
@@ -1,1435 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * David Green - fixes for bug 237503
- * Frank Becker - fixes for bug 252300
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.DateRange;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
-import org.eclipse.mylyn.internal.tasks.core.data.ITaskDataManagerListener;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManagerEvent;
-import org.eclipse.mylyn.internal.tasks.ui.ChangeActivityHandleOperation;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.DeleteTaskEditorAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.NewSubTaskAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeEditorAction;
-import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
-import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskAttachmentDropListener;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionPart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorAttachmentPart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorAttributePart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorCommentPart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorDescriptionPart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorNewCommentPart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorOutlineNode;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorOutlinePage;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPeoplePart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRichTextPart;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart;
-import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModelListener;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJobEvent;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJobListener;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FilteredTree;
-import org.eclipse.ui.forms.IFormPart;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * Extend to provide a task editor page.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISelectionProvider,
- ISelectionChangedListener {
-
- /**
- * Causes the form page to reflow on resize.
- */
- private final class ParentResizeHandler implements Listener {
- private int generation;
-
- public void handleEvent(Event event) {
- ++generation;
-
- Display.getCurrent().timerExec(300, new Runnable() {
- int scheduledGeneration = generation;
-
- public void run() {
- if (getManagedForm().getForm().isDisposed()) {
- return;
- }
-
- // only reflow if this is the latest generation to prevent
- // unnecessary reflows while the form is being resized
- if (scheduledGeneration == generation) {
- getManagedForm().reflow(true);
- }
- }
- });
- }
- }
-
- private class SubmitTaskJobListener extends SubmitJobListener {
-
- private final boolean attachContext;
-
- public SubmitTaskJobListener(boolean attachContext) {
- this.attachContext = attachContext;
- }
-
- @Override
- public void done(SubmitJobEvent event) {
- final SubmitJob job = event.getJob();
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-
- private void openNewTask(ITask newTask) {
- AbstractTaskContainer parent = null;
- AbstractTaskEditorPart actionPart = getPart(ID_PART_ACTIONS);
- if (actionPart instanceof TaskEditorActionPart) {
- parent = ((TaskEditorActionPart) actionPart).getCategory();
- }
- TasksUiInternal.getTaskList().addTask(newTask, parent);
- ITask oldTask = getTask();
-
- // migrate task details
- if (oldTask instanceof AbstractTask && newTask instanceof AbstractTask) {
- ((AbstractTask) newTask).setNotes(((AbstractTask) oldTask).getNotes());
- DateRange scheduledDate = ((AbstractTask) oldTask).getScheduledForDate();
- TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) newTask, scheduledDate);
- Date dueDate = ((AbstractTask) oldTask).getDueDate();
- TasksUiPlugin.getTaskActivityManager().setDueDate(newTask, dueDate);
- ((AbstractTask) newTask).setEstimatedTimeHours(((AbstractTask) oldTask).getEstimatedTimeHours());
- }
-
- // migrate context
- ContextCorePlugin.getContextStore().saveActiveContext();
- ContextCore.getContextStore().cloneContext(oldTask.getHandleIdentifier(),
- newTask.getHandleIdentifier());
-
- // migrate task activity
- ChangeActivityHandleOperation operation = new ChangeActivityHandleOperation(
- oldTask.getHandleIdentifier(), newTask.getHandleIdentifier());
- try {
- operation.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- "Failed to migrate activity to new task", e.getCause())); //$NON-NLS-1$
- } catch (InterruptedException e) {
- // ignore
- }
-
- boolean active = oldTask.isActive();
- if (active) {
- TasksUi.getTaskActivityManager().deactivateTask(oldTask);
- }
-
- boolean editorIsActive = false;
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage activePage = window.getActivePage();
- if (activePage != null) {
- if (activePage.getActiveEditor() == getTaskEditor()) {
- editorIsActive = true;
- }
- }
- }
- close();
-
- // delete old task details
- TasksUiInternal.getTaskList().deleteTask(oldTask);
- ContextCore.getContextManager().deleteContext(oldTask.getHandleIdentifier());
- try {
- TasksUiPlugin.getTaskDataManager().deleteTaskData(oldTask);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Failed to delete task data", e)); //$NON-NLS-1$
- }
-
- if (active) {
- TasksUi.getTaskActivityManager().activateTask(newTask);
- }
-
- if (editorIsActive) {
- TasksUiUtil.openTask(newTask);
- } else {
- TasksUiInternal.openTaskInBackground(newTask, false);
- }
- }
-
- public void run() {
- try {
- if (job.getStatus() == null) {
- TasksUiInternal.synchronizeRepository(getTaskRepository(), false);
- if (job.getTask().equals(getTask())) {
- refreshFormContent();
- } else {
- openNewTask(job.getTask());
- }
- } else {
- handleSubmitError(job);
- }
- } finally {
- showEditorBusy(false);
- }
- }
- });
- }
-
- @Override
- public void taskSubmitted(SubmitJobEvent event, IProgressMonitor monitor) throws CoreException {
- if (!getModel().getTaskData().isNew() && attachContext) {
- AttachmentUtil.postContext(connector, getModel().getTaskRepository(), task, "", null, monitor); //$NON-NLS-1$
- }
- }
-
- @Override
- public void taskSynchronized(SubmitJobEvent event, IProgressMonitor monitor) {
- }
-
- }
-
-// private class TaskListChangeListener extends TaskListChangeAdapter {
-// @Override
-// public void containersChanged(Set<TaskContainerDelta> containers) {
-// if (refreshDisabled) {
-// return;
-// }
-// ITask taskToRefresh = null;
-// for (TaskContainerDelta taskContainerDelta : containers) {
-// if (task.equals(taskContainerDelta.getElement())) {
-// if (taskContainerDelta.getKind().equals(TaskContainerDelta.Kind.CONTENT)
-// && !taskContainerDelta.isTransient()) {
-// taskToRefresh = (ITask) taskContainerDelta.getElement();
-// break;
-// }
-// }
-// }
-// if (taskToRefresh != null) {
-// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// if (!isDirty() && task.getSynchronizationState() == SynchronizationState.SYNCHRONIZED) {
-// // automatically refresh if the user has not made any changes and there is no chance of missing incomings
-// refreshFormContent();
-// } else {
-// getTaskEditor().setMessage("Task has incoming changes", IMessageProvider.WARNING,
-// new HyperlinkAdapter() {
-// @Override
-// public void linkActivated(HyperlinkEvent e) {
-// refreshFormContent();
-// }
-// });
-// setSubmitEnabled(false);
-// }
-// }
-// });
-// }
-// }
-// }
-
- private final ITaskDataManagerListener TASK_DATA_LISTENER = new ITaskDataManagerListener() {
-
- public void taskDataUpdated(final TaskDataManagerEvent event) {
- ITask task = event.getTask();
- if (task.equals(AbstractTaskEditorPage.this.getTask()) && event.getTaskDataUpdated()) {
- refresh(task);
- }
- }
-
- private void refresh(final ITask task) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (refreshDisabled) {
- return;
- }
-
- if (!isDirty() && task.getSynchronizationState() == SynchronizationState.SYNCHRONIZED) {
- // automatically refresh if the user has not made any changes and there is no chance of missing incomings
- refreshFormContent();
- } else {
- getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Task_has_incoming_changes,
- IMessageProvider.WARNING, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- refreshFormContent();
- }
- });
- setSubmitEnabled(false);
- }
- }
- });
- }
-
- public void editsDiscarded(TaskDataManagerEvent event) {
- if (event.getTask().equals(AbstractTaskEditorPage.this.getTask())) {
- refresh(event.getTask());
- }
- }
- };
-
- private static final String ERROR_NOCONNECTIVITY = Messages.AbstractTaskEditorPage_Unable_to_submit_at_this_time;
-
- public static final String ID_PART_ACTIONS = "org.eclipse.mylyn.tasks.ui.editors.parts.actions"; //$NON-NLS-1$
-
- public static final String ID_PART_ATTACHMENTS = "org.eclipse.mylyn.tasks.ui.editors.parts.attachments"; //$NON-NLS-1$
-
- public static final String ID_PART_ATTRIBUTES = "org.eclipse.mylyn.tasks.ui.editors.parts.attributes"; //$NON-NLS-1$
-
- public static final String ID_PART_COMMENTS = "org.eclipse.mylyn.tasks.ui.editors.parts.comments"; //$NON-NLS-1$
-
- public static final String ID_PART_DESCRIPTION = "org.eclipse.mylyn.tasks.ui.editors.parts.descriptions"; //$NON-NLS-1$
-
- public static final String ID_PART_NEW_COMMENT = "org.eclipse.mylyn.tasks.ui.editors.parts.newComment"; //$NON-NLS-1$
-
- public static final String ID_PART_PEOPLE = "org.eclipse.mylyn.tasks.ui.editors.parts.people"; //$NON-NLS-1$
-
- public static final String ID_PART_PLANNING = "org.eclipse.mylyn.tasks.ui.editors.parts.planning"; //$NON-NLS-1$
-
- public static final String ID_PART_SUMMARY = "org.eclipse.mylyn.tasks.ui.editors.parts.summary"; //$NON-NLS-1$
-
- public static final String PATH_ACTIONS = "actions"; //$NON-NLS-1$
-
- public static final String PATH_ATTACHMENTS = "attachments"; //$NON-NLS-1$
-
- public static final String PATH_ATTRIBUTES = "attributes"; //$NON-NLS-1$
-
- public static final String PATH_COMMENTS = "comments"; //$NON-NLS-1$
-
- public static final String PATH_HEADER = "header"; //$NON-NLS-1$
-
- public static final String PATH_PEOPLE = "people"; //$NON-NLS-1$
-
- public static final String PATH_PLANNING = "planning"; //$NON-NLS-1$
-
-// private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.page";
-
- private AttributeEditorFactory attributeEditorFactory;
-
- private AttributeEditorToolkit attributeEditorToolkit;
-
- private AbstractRepositoryConnector connector;
-
- private final String connectorKind;
-
- private StructuredSelection defaultSelection;
-
- private Composite editorComposite;
-
- private ScrolledForm form;
-
- private boolean formBusy;
-
- private Control lastFocusControl;
-
- private ISelection lastSelection;
-
- private TaskDataModel model;
-
- private boolean needsAddToCategory;
-
- private boolean reflow;
-
- private volatile boolean refreshDisabled;
-
- private final ListenerList selectionChangedListeners;
-
- private SynchronizeEditorAction synchronizeEditorAction;
-
- private ITask task;
-
- private TaskData taskData;
-
-// private ITaskListChangeListener taskListChangeListener;
-
- private FormToolkit toolkit;
-
- private TaskEditorOutlinePage outlinePage;
-
- private TaskAttachmentDropListener defaultDropListener;
-
- private CommonTextSupport textSupport;
-
- /**
- * @since 3.1
- */
- public AbstractTaskEditorPage(TaskEditor editor, String id, String label, String connectorKind) {
- super(editor, id, label);
- Assert.isNotNull(connectorKind);
- this.connectorKind = connectorKind;
- this.reflow = true;
- this.selectionChangedListeners = new ListenerList();
- }
-
- public AbstractTaskEditorPage(TaskEditor editor, String connectorKind) {
- this(editor, "id", "label", connectorKind); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @since 3.1
- * @see FormPage#getEditor()
- */
- @Override
- public TaskEditor getEditor() {
- return (TaskEditor) super.getEditor();
- }
-
- private void addFocusListener(Composite composite, FocusListener listener) {
- Control[] children = composite.getChildren();
- for (Control control : children) {
- if ((control instanceof Text) || (control instanceof Button) || (control instanceof Combo)
- || (control instanceof CCombo) || (control instanceof Tree) || (control instanceof Table)
- || (control instanceof Spinner) || (control instanceof Link)
- || (control instanceof org.eclipse.swt.widgets.List) || (control instanceof TabFolder)
- || (control instanceof CTabFolder) || (control instanceof Hyperlink)
- || (control instanceof FilteredTree) || (control instanceof StyledText)) {
- control.addFocusListener(listener);
- }
- if (control instanceof Composite) {
- addFocusListener((Composite) control, listener);
- }
- }
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.add(listener);
- }
-
- public void appendTextToNewComment(String text) {
- AbstractTaskEditorPart newCommentPart = getPart(ID_PART_NEW_COMMENT);
- if (newCommentPart instanceof TaskEditorRichTextPart) {
- ((TaskEditorRichTextPart) newCommentPart).appendText(text);
- newCommentPart.setFocus();
- }
- }
-
- public boolean canPerformAction(String actionId) {
- return CommonTextSupport.canPerformAction(actionId, EditorUtil.getFocusControl(this));
- }
-
- public void close() {
- if (Display.getCurrent() != null) {
- getSite().getPage().closeEditor(getTaskEditor(), false);
- } else {
- // TODO consider removing asyncExec()
- Display activeDisplay = getSite().getShell().getDisplay();
- activeDisplay.asyncExec(new Runnable() {
- public void run() {
- if (getSite() != null && getSite().getPage() != null && !getManagedForm().getForm().isDisposed()) {
- if (getTaskEditor() != null) {
- getSite().getPage().closeEditor(getTaskEditor(), false);
- } else {
- getSite().getPage().closeEditor(AbstractTaskEditorPage.this, false);
- }
- }
- }
- });
- }
- }
-
- protected AttributeEditorFactory createAttributeEditorFactory() {
- return new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite());
- }
-
- AttributeEditorToolkit createAttributeEditorToolkit() {
- return new AttributeEditorToolkit(textSupport);
- }
-
- @Override
- public void createPartControl(Composite parent) {
- parent.addListener(SWT.Resize, new ParentResizeHandler());
- super.createPartControl(parent);
- }
-
- @Override
- protected void createFormContent(final IManagedForm managedForm) {
- form = managedForm.getForm();
-
- toolkit = managedForm.getToolkit();
- registerDefaultDropListener(form);
- EditorUtil.disableScrollingOnFocus(form);
-
- try {
- setReflow(false);
-
- editorComposite = form.getBody();
- // TODO consider using TableWrapLayout, it makes resizing much faster
- GridLayout editorLayout = new GridLayout();
- editorComposite.setLayout(editorLayout);
- editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- //form.setData("focusScrolling", Boolean.FALSE);
-
-// menuManager = new MenuManager();
-// menuManager.setRemoveAllWhenShown(true);
-// getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, this, true);
-// editorComposite.setMenu(menuManager.createContextMenu(editorComposite));
- editorComposite.setMenu(getTaskEditor().getMenu());
-
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(getConnectorKind());
- if (connectorUi == null) {
- getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Synchronize_to_update_editor_contents,
- IMessageProvider.INFORMATION, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- refreshFormContent();
- }
- });
- }
-
- if (taskData != null) {
- createFormContentInternal();
- }
- updateHeaderMessage();
- } finally {
- setReflow(true);
-
- // if the editor is restored as part of workbench startup then we must reflow() asynchronously
- // otherwise the editor layout is incorrect
- boolean reflowRequired = calculateReflowRequired(form);
-
- if (reflowRequired) {
- Display.getCurrent().asyncExec(new Runnable() {
- public void run() {
- // this fixes a problem with layout that occurs when an editor
- // is restored before the workbench is fully initialized
- reflow();
- }
- });
- }
- }
- }
-
- private boolean calculateReflowRequired(ScrolledForm form) {
- Composite stopComposite = getEditor().getEditorParent().getParent().getParent();
- Composite composite = form.getParent();
- while (composite != null) {
- Rectangle clientArea = composite.getClientArea();
- if (clientArea.width > 1) {
- return false;
- }
- if (composite == stopComposite) {
- return true;
- }
- composite = composite.getParent();
- }
- return true;
- }
-
- private void createFormContentInternal() {
- // end life-cycle of previous editor controls
- if (attributeEditorToolkit != null) {
- attributeEditorToolkit.dispose();
- }
-
- // start life-cycle of previous editor controls
- if (attributeEditorFactory == null) {
- attributeEditorFactory = createAttributeEditorFactory();
- Assert.isNotNull(attributeEditorFactory);
- }
- attributeEditorToolkit = createAttributeEditorToolkit();
- Assert.isNotNull(attributeEditorToolkit);
- attributeEditorToolkit.setMenu(editorComposite.getMenu());
- attributeEditorFactory.setEditorToolkit(attributeEditorToolkit);
-
- createParts();
-
- FocusListener listener = new FocusAdapter() {
- @Override
- public void focusGained(FocusEvent e) {
- lastFocusControl = (Control) e.widget;
- }
- };
- addFocusListener(editorComposite, listener);
- AbstractTaskEditorPart summaryPart = getPart(ID_PART_SUMMARY);
- if (summaryPart != null) {
- lastFocusControl = summaryPart.getControl();
- }
- }
-
- protected TaskDataModel createModel(TaskEditorInput input) throws CoreException {
- ITaskDataWorkingCopy taskDataState;
- try {
- taskDataState = TasksUi.getTaskDataManager().getWorkingCopy(task);
- } catch (OperationCanceledException e) {
- // XXX retry once to work around bug 235479
- taskDataState = TasksUi.getTaskDataManager().getWorkingCopy(task);
- }
- TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(taskDataState.getConnectorKind(),
- taskDataState.getRepositoryUrl());
- return new TaskDataModel(taskRepository, input.getTask(), taskDataState);
- }
-
- /**
- * To suppress a section, just remove its descriptor from the list. To add your own section in a specific order on
- * the page, use the path value for where you want it to appear (your descriptor will appear after previously added
- * descriptors with the same path), and add it to the descriptors list in your override of this method.
- */
- protected Set<TaskEditorPartDescriptor> createPartDescriptors() {
- Set<TaskEditorPartDescriptor> descriptors = new LinkedHashSet<TaskEditorPartDescriptor>();
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_SUMMARY) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorSummaryPart();
- }
- }.setPath(PATH_HEADER));
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_ATTRIBUTES) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorAttributePart();
- }
- }.setPath(PATH_ATTRIBUTES));
- if (!taskData.isNew()) {
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_ATTACHMENTS) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorAttachmentPart();
- }
- }.setPath(PATH_ATTACHMENTS));
- }
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_DESCRIPTION) {
- @Override
- public AbstractTaskEditorPart createPart() {
- TaskEditorDescriptionPart part = new TaskEditorDescriptionPart();
- if (getModel().getTaskData().isNew()) {
- part.setExpandVertically(true);
- part.setSectionStyle(ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
- }
- return part;
- }
- }.setPath(PATH_COMMENTS));
- if (!taskData.isNew()) {
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_COMMENTS) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorCommentPart();
- }
- }.setPath(PATH_COMMENTS));
- }
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_NEW_COMMENT) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorNewCommentPart();
- }
- }.setPath(PATH_COMMENTS));
- if (taskData.isNew()) {
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_PLANNING) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorPlanningPart();
- }
- }.setPath(PATH_PLANNING));
- }
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_ACTIONS) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorActionPart();
- }
- }.setPath(PATH_ACTIONS));
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TaskEditorPeoplePart();
- }
- }.setPath(PATH_PEOPLE));
- return descriptors;
- }
-
- protected void createParts() {
- List<TaskEditorPartDescriptor> descriptors = new LinkedList<TaskEditorPartDescriptor>(createPartDescriptors());
- // single column
- createParts(PATH_HEADER, editorComposite, descriptors);
- createParts(PATH_ATTRIBUTES, editorComposite, descriptors);
- createParts(PATH_ATTACHMENTS, editorComposite, descriptors);
- createParts(PATH_COMMENTS, editorComposite, descriptors);
- createParts(PATH_PLANNING, editorComposite, descriptors);
- // two column
- Composite bottomComposite = toolkit.createComposite(editorComposite);
- bottomComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
- GridDataFactory.fillDefaults().grab(true, false).applyTo(bottomComposite);
- createParts(PATH_ACTIONS, bottomComposite, descriptors);
- createParts(PATH_PEOPLE, bottomComposite, descriptors);
- bottomComposite.pack(true);
- }
-
- private void createParts(String path, final Composite parent, Collection<TaskEditorPartDescriptor> descriptors) {
- for (Iterator<TaskEditorPartDescriptor> it = descriptors.iterator(); it.hasNext();) {
- final TaskEditorPartDescriptor descriptor = it.next();
- if (path == null || path.equals(descriptor.getPath())) {
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Error creating task editor part: \"" + descriptor.getId() + "\"", e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void run() throws Exception {
- AbstractTaskEditorPart part = descriptor.createPart();
- part.setPartId(descriptor.getId());
- initializePart(parent, part);
- }
- });
- it.remove();
- }
- }
- }
-
- @Override
- public void dispose() {
- if (textSupport != null) {
- textSupport.dispose();
- }
- if (attributeEditorToolkit != null) {
- attributeEditorToolkit.dispose();
- }
- TasksUiPlugin.getTaskDataManager().removeListener(TASK_DATA_LISTENER);
- super.dispose();
- }
-
- public void doAction(String actionId) {
- CommonTextSupport.doAction(actionId, EditorUtil.getFocusControl(this));
- }
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- if (!isDirty()) {
- return;
- }
-
- getManagedForm().commit(true);
-
- try {
- model.save(monitor);
- } catch (final CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Error saving task", e)); //$NON-NLS-1$
- getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Could_not_save_task, IMessageProvider.ERROR,
- new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent event) {
- TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Save_failed, e.getStatus());
- }
- });
- }
-
- // update the summary of unsubmitted repository tasks
- if (getTask().getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
- final String summary = connector.getTaskMapping(model.getTaskData()).getSummary();
- try {
- TasksUiPlugin.getTaskList().run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- task.setSummary(summary);
- }
- });
- TasksUiPlugin.getTaskList().notifyElementChanged(task);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Failed to set summary for task \"" + task + "\"", e)); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- updateHeaderMessage();
- getManagedForm().dirtyStateChanged();
- getTaskEditor().updateHeaderToolBar();
- }
-
- @Override
- public void doSaveAs() {
- throw new UnsupportedOperationException();
- }
-
- public void doSubmit() {
- showEditorBusy(true);
-
- doSave(new NullProgressMonitor());
-
- SubmitJob submitJob = TasksUiInternal.getJobFactory().createSubmitTaskJob(connector,
- getModel().getTaskRepository(), task, getModel().getTaskData(), getModel().getChangedOldAttributes());
- submitJob.addSubmitJobListener(new SubmitTaskJobListener(getAttachContext()));
- submitJob.schedule();
- }
-
- /**
- * Override for customizing the tool bar.
- */
- @Override
- public void fillToolBar(IToolBarManager toolBarManager) {
- final TaskRepository taskRepository = (model != null) ? getModel().getTaskRepository() : null;
-
- if (taskData == null) {
- synchronizeEditorAction = new SynchronizeEditorAction();
- synchronizeEditorAction.selectionChanged(new StructuredSelection(getTaskEditor()));
- toolBarManager.add(synchronizeEditorAction);
- } else {
- if (taskData.isNew()) {
- DeleteTaskEditorAction deleteAction = new DeleteTaskEditorAction(getTask());
- toolBarManager.add(deleteAction);
- } else if (taskRepository != null) {
- ClearOutgoingAction clearOutgoingAction = new ClearOutgoingAction(
- Collections.singletonList((IRepositoryElement) task));
- (clearOutgoingAction).setTaskEditorPage(this);
- if (clearOutgoingAction.isEnabled()) {
- toolBarManager.add(clearOutgoingAction);
- }
-
- if (task.getSynchronizationState() != SynchronizationState.OUTGOING_NEW) {
- synchronizeEditorAction = new SynchronizeEditorAction();
- synchronizeEditorAction.selectionChanged(new StructuredSelection(getTaskEditor()));
- toolBarManager.add(synchronizeEditorAction);
- }
-
- NewSubTaskAction newSubTaskAction = new NewSubTaskAction();
- newSubTaskAction.selectionChanged(newSubTaskAction, new StructuredSelection(task));
- if (newSubTaskAction.isEnabled()) {
- toolBarManager.add(newSubTaskAction);
- }
-
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(taskData.getConnectorKind());
- if (connectorUi != null) {
- final String historyUrl = connectorUi.getTaskHistoryUrl(taskRepository, task);
- if (historyUrl != null) {
- Action historyAction = new Action() {
- @Override
- public void run() {
- TasksUiUtil.openUrl(historyUrl);
- }
- };
-
- historyAction.setImageDescriptor(TasksUiImages.TASK_REPOSITORY_HISTORY);
- historyAction.setToolTipText(Messages.AbstractTaskEditorPage_History);
- toolBarManager.add(historyAction);
- }
- }
- }
- }
- }
-
- protected void fireSelectionChanged(ISelection selection) {
- // create an event
- final SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
-
- // fire the event
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
- SafeRunner.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(event);
- }
- });
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter == IContentOutlinePage.class) {
- updateOutlinePage();
- return outlinePage;
- }
- // TODO m3.2 replace by getTextSupport() method
- if (adapter == CommonTextSupport.class) {
- return textSupport;
- }
- return super.getAdapter(adapter);
- }
-
- private void updateOutlinePage() {
- if (outlinePage == null) {
- outlinePage = new TaskEditorOutlinePage();
- outlinePage.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof StructuredSelection) {
- Object select = ((StructuredSelection) selection).getFirstElement();
- if (select instanceof TaskEditorOutlineNode) {
- TaskEditorOutlineNode node = (TaskEditorOutlineNode) select;
- TaskAttribute attribute = node.getData();
- if (attribute != null) {
- if (TaskAttribute.TYPE_COMMENT.equals(attribute.getMetaData().getType())) {
- AbstractTaskEditorPart actionPart = getPart(ID_PART_COMMENTS);
- if (actionPart != null && actionPart.getControl() instanceof ExpandableComposite) {
- EditorUtil.toggleExpandableComposite(true,
- (ExpandableComposite) actionPart.getControl());
- if (actionPart.getControl() instanceof Section) {
- Control client = ((Section) actionPart.getControl()).getClient();
- if (client instanceof Composite) {
- for (Control control : ((Composite) client).getChildren()) {
- // toggle subsections
- if (control instanceof Section) {
- EditorUtil.toggleExpandableComposite(true, (Section) control);
- }
- }
- }
- }
- }
- }
- EditorUtil.reveal(form, attribute.getId());
- } else {
- EditorUtil.reveal(form, node.getLabel());
- }
- getEditor().setActivePage(getId());
- }
- }
- }
- });
- }
- if (getModel() != null) {
- TaskEditorOutlineNode node = TaskEditorOutlineNode.parse(getModel().getTaskData());
- outlinePage.setInput(getTaskRepository(), node);
- } else {
- outlinePage.setInput(null, null);
- }
- }
-
- private boolean getAttachContext() {
- AbstractTaskEditorPart actionPart = getPart(ID_PART_ACTIONS);
- if (actionPart instanceof TaskEditorActionPart) {
- return ((TaskEditorActionPart) actionPart).getAttachContext();
- }
- return false;
- }
-
- public AttributeEditorFactory getAttributeEditorFactory() {
- return attributeEditorFactory;
- }
-
- public AttributeEditorToolkit getAttributeEditorToolkit() {
- return attributeEditorToolkit;
- }
-
- public AbstractRepositoryConnector getConnector() {
- return connector;
- }
-
- public String getConnectorKind() {
- return connectorKind;
- }
-
- /**
- * @return The composite for the whole editor.
- */
- public Composite getEditorComposite() {
- return editorComposite;
- }
-
- public TaskDataModel getModel() {
- return model;
- }
-
- public AbstractTaskEditorPart getPart(String partId) {
- Assert.isNotNull(partId);
- for (IFormPart part : getManagedForm().getParts()) {
- if (part instanceof AbstractTaskEditorPart) {
- AbstractTaskEditorPart taskEditorPart = (AbstractTaskEditorPart) part;
- if (partId.equals(taskEditorPart.getPartId())) {
- return taskEditorPart;
- }
- }
- }
- return null;
- }
-
- public ISelection getSelection() {
- return lastSelection;
- }
-
- public ITask getTask() {
- return task;
- }
-
- public TaskEditor getTaskEditor() {
- return getEditor();
- }
-
- public TaskRepository getTaskRepository() {
- // FIXME model can be null
- return getModel().getTaskRepository();
- }
-
- private void handleSubmitError(SubmitJob job) {
- if (form != null && !form.isDisposed()) {
- final IStatus status = job.getStatus();
- if (status.getCode() == RepositoryStatus.REPOSITORY_COMMENT_REQUIRED) {
- TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Comment_required, status);
- AbstractTaskEditorPart newCommentPart = getPart(ID_PART_NEW_COMMENT);
- if (newCommentPart != null) {
- newCommentPart.setFocus();
- }
- } else if (status.getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
- if (TasksUiUtil.openEditRepositoryWizard(getTaskRepository()) == Window.OK) {
- doSubmit();
- }
- } else {
- String message;
- if (status.getCode() == RepositoryStatus.ERROR_IO) {
- message = ERROR_NOCONNECTIVITY;
- } else if (status.getMessage().length() > 0) {
- message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage();
- } else {
- message = Messages.AbstractTaskEditorPage_Submit_failed;
- }
- getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status);
- }
- });
- }
- }
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) {
- super.init(site, input);
-
- site.setSelectionProvider(this);
-
- TaskEditorInput taskEditorInput = (TaskEditorInput) input;
- this.task = taskEditorInput.getTask();
- this.defaultSelection = new StructuredSelection(task);
- this.lastSelection = defaultSelection;
- IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
- this.textSupport = new CommonTextSupport(handlerService);
- this.textSupport.setSelectionChangedListener(this);
-
- initModel(taskEditorInput);
-
- TasksUiPlugin.getTaskDataManager().addListener(TASK_DATA_LISTENER);
- }
-
- private void initModel(TaskEditorInput input) {
- Assert.isTrue(model == null);
- try {
- this.model = createModel(input);
- this.connector = TasksUi.getRepositoryManager().getRepositoryConnector(getConnectorKind());
- setTaskData(model.getTaskData());
- model.addModelListener(new TaskDataModelListener() {
- @Override
- public void attributeChanged(TaskDataModelEvent event) {
- getManagedForm().dirtyStateChanged();
- }
- });
- setNeedsAddToCategory(model.getTaskData().isNew());
- } catch (final CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Error opening task", e)); //$NON-NLS-1$
- getTaskEditor().setStatus(Messages.AbstractTaskEditorPage_Error_opening_task,
- Messages.AbstractTaskEditorPage_Open_failed, e.getStatus());
- }
- }
-
- private void initializePart(Composite parent, AbstractTaskEditorPart part) {
- getManagedForm().addPart(part);
- part.initialize(this);
- part.createControl(parent, toolkit);
- if (part.getControl() != null) {
- if (ID_PART_ACTIONS.equals(part.getPartId())) {
- // do not expand horizontally
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(part.getControl());
- } else {
- if (part.getExpandVertically()) {
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL)
- .grab(true, true)
- .applyTo(part.getControl());
- } else {
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.TOP)
- .grab(true, false)
- .applyTo(part.getControl());
- }
- }
- // for outline
- if (ID_PART_COMMENTS.equals(part.getPartId())) {
- EditorUtil.setMarker(part.getControl(), TaskEditorOutlineNode.LABEL_COMMENTS);
- }
- }
- }
-
- @Override
- public boolean isDirty() {
- return (getModel() != null && getModel().isDirty()) || (getManagedForm() != null && getManagedForm().isDirty());
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- public boolean needsAddToCategory() {
- return needsAddToCategory;
- }
-
- /**
- * Force a re-layout of entire form.
- */
- public void reflow() {
- if (reflow) {
- // help the layout managers: ensure that the form width always matches
- // the parent client area width.
- Rectangle parentClientArea = form.getParent().getClientArea();
- Point formSize = form.getSize();
- if (formSize.x != parentClientArea.width) {
- ScrollBar verticalBar = form.getVerticalBar();
- int verticalBarWidth = verticalBar != null ? verticalBar.getSize().x : 15;
- form.setSize(parentClientArea.width - verticalBarWidth, formSize.y);
- }
-
- form.layout(true, false);
- form.reflow(true);
- }
- }
-
- /**
- * Updates the editor contents in place.
- */
- public void refreshFormContent() {
- if (getManagedForm().getForm().isDisposed()) {
- // editor possibly closed as part of submit
- return;
- }
-
- try {
- showEditorBusy(true);
-
- if (model != null) {
- doSave(new NullProgressMonitor());
- refreshInput();
- } else {
- initModel(getTaskEditor().getTaskEditorInput());
- }
-
- if (taskData != null) {
- try {
- setReflow(false);
- // prevent menu from being disposed when disposing control on the form during refresh
- Menu menu = editorComposite.getMenu();
- EditorUtil.setMenu(editorComposite, null);
-
- // clear old controls and parts
- for (Control control : editorComposite.getChildren()) {
- control.dispose();
- }
- lastFocusControl = null;
- lastSelection = null;
- for (IFormPart part : getManagedForm().getParts()) {
- part.dispose();
- getManagedForm().removePart(part);
- }
-
- // restore menu
- editorComposite.setMenu(menu);
-
- createFormContentInternal();
-
- getTaskEditor().setMessage(null, 0);
- getTaskEditor().setActivePage(getId());
-
- setSubmitEnabled(true);
- } finally {
- setReflow(true);
- }
- }
-
- updateOutlinePage();
- updateHeaderMessage();
- getManagedForm().dirtyStateChanged();
- getTaskEditor().updateHeaderToolBar();
- } finally {
- showEditorBusy(false);
- }
- reflow();
- }
-
- private void refreshInput() {
- try {
- refreshDisabled = true;
- model.refresh(null);
- } catch (CoreException e) {
- getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Failed_to_read_task_data_ + e.getMessage(),
- IMessageProvider.ERROR);
- taskData = null;
- return;
- } finally {
- refreshDisabled = false;
- }
-
- setTaskData(model.getTaskData());
- }
-
- /**
- * Registers a drop listener for <code>control</code>. The default implementation registers a listener for attaching
- * files. Does nothing if the editor is showing a new task.
- * <p>
- * Clients may override.
- * </p>
- *
- * @param control
- * the control to register the listener for
- */
- public void registerDefaultDropListener(final Control control) {
- if (getModel() == null || getModel().getTaskData().isNew()) {
- return;
- }
-
- DropTarget target = new DropTarget(control, DND.DROP_COPY | DND.DROP_DEFAULT);
- final TextTransfer textTransfer = TextTransfer.getInstance();
- final FileTransfer fileTransfer = FileTransfer.getInstance();
- Transfer[] types = new Transfer[] { textTransfer, fileTransfer };
- target.setTransfer(types);
- if (defaultDropListener == null) {
- defaultDropListener = new TaskAttachmentDropListener(this);
- }
- target.addDropListener(defaultDropListener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.remove(listener);
- }
-
- public void selectionChanged(Object element) {
- selectionChanged(new SelectionChangedEvent(this, new StructuredSelection(element)));
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof TextSelection) {
- // only update global actions
- ((TaskEditorActionContributor) getEditorSite().getActionBarContributor()).updateSelectableActions(event.getSelection());
- return;
- }
- if (selection.isEmpty()) {
- // something was unselected, reset to default selection
- selection = defaultSelection;
- // XXX a styled text widget has lost focus, re-enable all edit actions
- ((TaskEditorActionContributor) getEditorSite().getActionBarContributor()).forceActionsEnabled();
- }
- if (!selection.equals(lastSelection)) {
- this.lastSelection = selection;
- fireSelectionChanged(lastSelection);
- }
- }
-
- @Override
- public void setFocus() {
- if (lastFocusControl != null && !lastFocusControl.isDisposed()) {
- lastFocusControl.setFocus();
- }
- }
-
- public void setNeedsAddToCategory(boolean needsAddToCategory) {
- this.needsAddToCategory = needsAddToCategory;
- }
-
- public void setReflow(boolean reflow) {
- this.reflow = reflow;
- form.setRedraw(reflow);
- }
-
- public void setSelection(ISelection selection) {
- IFormPart[] parts = getManagedForm().getParts();
- for (IFormPart formPart : parts) {
- if (formPart instanceof AbstractTaskEditorPart) {
- if (((AbstractTaskEditorPart) formPart).setSelection(selection)) {
- lastSelection = selection;
- return;
- }
- }
- }
- }
-
- // TODO EDITOR this needs to be tracked somewhere else
- private void setSubmitEnabled(boolean enabled) {
- AbstractTaskEditorPart actionPart = getPart(ID_PART_ACTIONS);
- if (actionPart instanceof TaskEditorActionPart) {
- ((TaskEditorActionPart) actionPart).setSubmitEnabled(enabled);
- }
- }
-
- private void setTaskData(TaskData taskData) {
- this.taskData = taskData;
- }
-
- @Override
- public void showBusy(boolean busy) {
- if (!getManagedForm().getForm().isDisposed() && busy != formBusy) {
- // parentEditor.showBusy(busy);
-// if (synchronizeEditorAction != null) {
-// synchronizeEditorAction.setEnabled(!busy);
-// }
-//
-// if (openBrowserAction != null) {
-// openBrowserAction.setEnabled(!busy);
-// }
-//
-// if (historyAction != null) {
-// historyAction.setEnabled(!busy);
-// }
-//
-// if (actionPart != null) {
-// actionPart.setSubmitEnabled(!busy);
-// }
-//
-// if (newSubTaskAction != null) {
-// newSubTaskAction.setEnabled(!busy);
-// }
-//
-// if (clearOutgoingAction != null) {
-// clearOutgoingAction.setEnabled(!busy);
-// }
-
- EditorUtil.setEnabledState(editorComposite, !busy);
-
- formBusy = busy;
- }
- }
-
- public void showEditorBusy(boolean busy) {
- getTaskEditor().showBusy(busy);
- refreshDisabled = busy;
- }
-
- private void updateHeaderMessage() {
- if (taskData == null) {
- getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Synchronize_to_retrieve_task_data,
- IMessageProvider.WARNING, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- if (synchronizeEditorAction != null) {
- synchronizeEditorAction.run();
- }
- }
- });
- }
- if (getTaskEditor().getMessage() == null
- && TasksUiPlugin.getTaskList().getTask(task.getRepositoryUrl(), task.getTaskId()) == null) {
- getTaskEditor().setMessage(Messages.AbstractTaskEditorPage_Add_task_to_tasklist,
- IMessageProvider.INFORMATION, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- if (TasksUiPlugin.getTaskList().getTask(task.getRepositoryUrl(), task.getTaskId()) == null) {
- TasksUiPlugin.getTaskList().addTask(task,
- TasksUiPlugin.getTaskList().getDefaultCategory());
- getTaskEditor().setMessage(null, IMessageProvider.NONE, null);
-// updateHeaderMessage();
- }
- }
- });
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPageFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPageFactory.java
deleted file mode 100644
index b0aee89f4..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPageFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.forms.editor.IFormPage;
-
-/**
- * @since 3.0
- * @author Steffen Pingel
- */
-public abstract class AbstractTaskEditorPageFactory {
-
- public static final int PRIORITY_ADDITIONS = 100;
-
- public static final int PRIORITY_CONTEXT = 20;
-
- public static final int PRIORITY_PLANNING = 10;
-
- public static final int PRIORITY_TASK = 30;
-
- private String id;
-
- public abstract boolean canCreatePageFor(TaskEditorInput input);
-
- public abstract IFormPage createPage(TaskEditor parentEditor);
-
- public String[] getConflictingIds(TaskEditorInput input) {
- return null;
- }
-
- public String getId() {
- return id;
- }
-
- // TODO EDITOR life cycle of image?
- public abstract Image getPageImage();
-
- public abstract String getPageText();
-
- public int getPriority() {
- return PRIORITY_ADDITIONS;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
deleted file mode 100644
index fb2a8e762..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.AbstractFormPart;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractTaskEditorPart extends AbstractFormPart {
-
- // the default font of some controls, e.g. radio buttons, is too big; set this font explicitly on the control
- protected static final Font TEXT_FONT = JFaceResources.getDefaultFont();
-
- private Control control;
-
- private String partName;
-
- private String partId;
-
- private AbstractTaskEditorPage taskEditorPage;
-
- private boolean expandVertically;
-
- public AbstractTaskEditorPart() {
- }
-
- protected AbstractAttributeEditor createAttributeEditor(TaskAttribute attribute) {
- if (attribute == null) {
- return null;
- }
-
- String type = attribute.getMetaData().getType();
- if (type != null) {
- AttributeEditorFactory attributeEditorFactory = getTaskEditorPage().getAttributeEditorFactory();
- AbstractAttributeEditor editor = attributeEditorFactory.createEditor(type, attribute);
- if (editor instanceof RichTextAttributeEditor) {
- boolean spellChecking = getTaskEditorPage().getAttributeEditorToolkit().hasSpellChecking(attribute);
- ((RichTextAttributeEditor) editor).setSpellCheckingEnabled(spellChecking);
- }
- return editor;
- }
- return null;
- }
-
- public abstract void createControl(Composite parent, FormToolkit toolkit);
-
- protected Section createSection(Composite parent, FormToolkit toolkit, int style) {
- Section section = toolkit.createSection(parent, style);
- section.setText(getPartName());
- return section;
- }
-
- protected Section createSection(Composite parent, FormToolkit toolkit, boolean expandedState) {
- int style = ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE;
- if (expandedState) {
- style |= ExpandableComposite.EXPANDED;
- }
- return createSection(parent, toolkit, style);
- }
-
- protected void fillToolBar(ToolBarManager toolBarManager) {
- }
-
- public Control getControl() {
- return control;
- }
-
- public TaskDataModel getModel() {
- return getTaskEditorPage().getModel();
- }
-
- public String getPartId() {
- return partId;
- }
-
- public String getPartName() {
- return partName;
- }
-
- public TaskData getTaskData() {
- return getTaskEditorPage().getModel().getTaskData();
- }
-
- public AbstractTaskEditorPage getTaskEditorPage() {
- return taskEditorPage;
- }
-
- public void initialize(AbstractTaskEditorPage taskEditorPage) {
- this.taskEditorPage = taskEditorPage;
- }
-
- public void setControl(Control control) {
- this.control = control;
- }
-
- void setPartId(String partId) {
- this.partId = partId;
- }
-
- protected void setPartName(String partName) {
- this.partName = partName;
- }
-
- protected void setSection(FormToolkit toolkit, Section section) {
- if (section.getTextClient() == null) {
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- fillToolBar(toolBarManager);
-
- // TODO toolBarManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- if (toolBarManager.getSize() > 0) {
- Composite toolbarComposite = toolkit.createComposite(section);
- toolbarComposite.setBackground(null);
- RowLayout rowLayout = new RowLayout();
- rowLayout.marginTop = 0;
- rowLayout.marginBottom = 0;
- toolbarComposite.setLayout(rowLayout);
-
- toolBarManager.createControl(toolbarComposite);
- section.setTextClient(toolbarComposite);
- }
- }
- setControl(section);
- }
-
- protected boolean setSelection(ISelection selection) {
- return false;
- }
-
- public boolean getExpandVertically() {
- return expandVertically;
- }
-
- public void setExpandVertically(boolean expandVertically) {
- this.expandVertically = expandVertically;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java
deleted file mode 100644
index 13b548788..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorFactory.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.internal.tasks.ui.editors.BooleanAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.DateAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.LongTextAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.MultiSelectionAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.PersonAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.SingleSelectionAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TextAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTextViewerConfiguration.Mode;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.services.IServiceLocator;
-
-/**
- * @since 3.0
- * @author Steffen Pingel
- */
-public class AttributeEditorFactory {
-
- private final TaskDataModel model;
-
- private final TaskRepository taskRepository;
-
- private final IServiceLocator serviceLocator;
-
- private AttributeEditorToolkit editorToolkit;
-
- public AttributeEditorFactory(TaskDataModel model, TaskRepository taskRepository) {
- this(model, taskRepository, null);
- }
-
- /**
- * @since 3.1
- */
- public AttributeEditorFactory(TaskDataModel model, TaskRepository taskRepository, IServiceLocator serviceLocator) {
- Assert.isNotNull(model);
- Assert.isNotNull(taskRepository);
- this.model = model;
- this.taskRepository = taskRepository;
- this.serviceLocator = serviceLocator;
- }
-
- /**
- * @since 3.1
- */
- public AttributeEditorToolkit getEditorToolkit() {
- return editorToolkit;
- }
-
- /**
- * @since 3.1
- */
- public void setEditorToolkit(AttributeEditorToolkit editorToolkit) {
- this.editorToolkit = editorToolkit;
- }
-
- public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute) {
- Assert.isNotNull(type);
-
- if (TaskAttribute.TYPE_BOOLEAN.equals(type)) {
- return new BooleanAttributeEditor(model, taskAttribute);
- } else if (TaskAttribute.TYPE_DATE.equals(type)) {
- return new DateAttributeEditor(model, taskAttribute);
- } else if (TaskAttribute.TYPE_DATETIME.equals(type)) {
- DateAttributeEditor editor = new DateAttributeEditor(model, taskAttribute);
- editor.setShowTime(true);
- return editor;
- } else if (TaskAttribute.TYPE_PERSON.equals(type)) {
- return new PersonAttributeEditor(model, taskAttribute);
- } else if (TaskAttribute.TYPE_LONG_RICH_TEXT.equals(type)) {
- RichTextAttributeEditor editor = null;
- if (serviceLocator != null) {
- IContextService contextService = (IContextService) serviceLocator.getService(IContextService.class);
- if (contextService != null) {
- AbstractTaskEditorExtension extension = TaskEditorExtensions.getTaskEditorExtension(model.getTaskRepository());
- if (extension != null) {
- editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute, SWT.MULTI,
- contextService, extension);
- }
- }
- }
- if (editor == null) {
- editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute);
- }
- if (editorToolkit != null) {
- editor.setRenderingEngine(editorToolkit.getRenderingEngine(taskAttribute));
- }
- return editor;
- } else if (TaskAttribute.TYPE_LONG_TEXT.equals(type)) {
- return new LongTextAttributeEditor(model, taskAttribute);
- } else if (TaskAttribute.TYPE_MULTI_SELECT.equals(type)) {
- return new MultiSelectionAttributeEditor(model, taskAttribute);
- } else if (TaskAttribute.TYPE_SHORT_RICH_TEXT.equals(type)) {
- return new RichTextAttributeEditor(model, taskRepository, taskAttribute, SWT.SINGLE);
- } else if (TaskAttribute.TYPE_SHORT_TEXT.equals(type)) {
- return new TextAttributeEditor(model, taskAttribute);
- } else if (TaskAttribute.TYPE_SINGLE_SELECT.equals(type)) {
- return new SingleSelectionAttributeEditor(model, taskAttribute);
- } else if (TaskAttribute.TYPE_TASK_DEPENDENCY.equals(type)) {
- RichTextAttributeEditor editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute,
- SWT.MULTI | TasksUiInternal.SWT_NO_SCROLL) {
- @Override
- public String getValue() {
- return getAttributeMapper().getValueLabel(getTaskAttribute());
- }
- };
- editor.setMode(Mode.TASK_RELATION);
- editor.setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE) {
- @Override
- public int getPriority() {
- return DEFAULT_PRIORITY + 1;
- }
- });
- return editor;
- } else if (TaskAttribute.TYPE_URL.equals(type)) {
- RichTextAttributeEditor editor = new RichTextAttributeEditor(model, taskRepository, taskAttribute,
- SWT.SINGLE);
- editor.setMode(Mode.URL);
- return editor;
- }
-
- throw new IllegalArgumentException("Unsupported editor type: \"" + type + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java
deleted file mode 100644
index ec80c8c6a..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AttributeEditorToolkit.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.jface.fieldassist.ComboContentAdapter;
-import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.fieldassist.IControlContentAdapter;
-import org.eclipse.jface.fieldassist.TextContentAdapter;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
-import org.eclipse.mylyn.internal.tasks.ui.PersonProposalLabelProvider;
-import org.eclipse.mylyn.internal.tasks.ui.PersonProposalProvider;
-import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
-import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.RepositoryTextViewerConfiguration.Mode;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
-import org.eclipse.ui.handlers.IHandlerActivation;
-import org.eclipse.ui.keys.IBindingService;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.themes.IThemeManager;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-// TODO EDITOR rename to AttributeUiToolkit?
-public class AttributeEditorToolkit {
-
- private final Color colorIncoming;
-
- private Menu menu;
-
- private AbstractRenderingEngine renderingEngine;
-
- private final CommonTextSupport textSupport;
-
- @Deprecated
- public IHandlerActivation contentAssistHandlerActivation;
-
- AttributeEditorToolkit(CommonTextSupport textSupport) {
- this.textSupport = textSupport;
- IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
- colorIncoming = themeManager.getCurrentTheme().getColorRegistry().get(CommonThemes.COLOR_INCOMING_BACKGROUND);
- }
-
- public void adapt(AbstractAttributeEditor editor) {
- if (editor.getControl() instanceof Text || editor.getControl() instanceof CCombo) {
- Control control = editor.getControl();
- if (!editor.isReadOnly() && hasContentAssist(editor.getTaskAttribute())) {
- IContentProposalProvider contentProposalProvider = createContentProposalProvider(editor.getTaskAttribute());
- ILabelProvider labelPropsalProvider = createLabelProposalProvider(editor.getTaskAttribute());
- if (contentProposalProvider != null && labelPropsalProvider != null) {
- ContentAssistCommandAdapter adapter = new ContentAssistCommandAdapter(control,
- getContentAdapter(control), contentProposalProvider,
- ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true);
- adapter.setLabelProvider(labelPropsalProvider);
- adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
- }
- }
- } else if (editor instanceof RichTextAttributeEditor) {
- RichTextAttributeEditor richTextEditor = (RichTextAttributeEditor) editor;
- boolean spellCheck = hasSpellChecking(editor.getTaskAttribute());
- final SourceViewer viewer = richTextEditor.getViewer();
- textSupport.install(viewer, spellCheck);
- if (!editor.isReadOnly() && richTextEditor.getMode() == Mode.TASK_RELATION) {
- installContentAssistControlDecoration(viewer.getControl());
- }
- installMenu(viewer.getControl());
- } else {
- final TextViewer viewer = CommonTextSupport.getTextViewer(editor.getControl());
- if (viewer != null) {
- textSupport.install(viewer, false);
- installMenu(viewer.getControl());
- }
- }
-
- // for outline
- EditorUtil.setMarker(editor.getControl(), editor.getTaskAttribute().getId());
-
- editor.decorate(getColorIncoming());
- }
-
- private IControlContentAdapter getContentAdapter(Control control) {
- if (control instanceof Combo) {
- return new ComboContentAdapter();
- } else if (control instanceof Text) {
- return new TextContentAdapter();
- }
- return null;
- }
-
- private void installMenu(final Control control) {
- if (menu != null) {
- control.setMenu(menu);
- control.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- control.setMenu(null);
- }
- });
- }
- }
-
- /**
- * Adds content assist to the given text field.
- *
- * @param text
- * text field to decorate.
- * @param proposalProvider
- * instance providing content proposals
- * @return the ContentAssistCommandAdapter for the field.
- */
- private ControlDecoration installContentAssistControlDecoration(Control control) {
- ControlDecoration controlDecoration = new ControlDecoration(control, (SWT.TOP | SWT.LEFT));
- controlDecoration.setShowOnlyOnFocus(true);
- FieldDecoration contentProposalImage = FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
- controlDecoration.setImage(contentProposalImage.getImage());
- IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
- controlDecoration.setDescriptionText(NLS.bind(Messages.AttributeEditorToolkit_Content_Assist_Available__X_,
- bindingService.getBestActiveBindingFormattedFor(ContentAssistCommandAdapter.CONTENT_PROPOSAL_COMMAND)));
- return controlDecoration;
- }
-
- /**
- * Creates an IContentProposalProvider to provide content assist proposals for the given attribute.
- *
- * @param attribute
- * attribute for which to provide content assist.
- * @return the IContentProposalProvider.
- */
- private IContentProposalProvider createContentProposalProvider(TaskAttribute attribute) {
- return new PersonProposalProvider(null, attribute.getTaskData());
- }
-
- private ILabelProvider createLabelProposalProvider(TaskAttribute attribute) {
- return new PersonProposalLabelProvider();
- }
-
- void dispose() {
- // FIXME textSupport.deactivateHandlers();
- }
-
- public Color getColorIncoming() {
- return colorIncoming;
- }
-
- Menu getMenu() {
- return menu;
- }
-
- /**
- * Subclasses that support HTML preview of ticket description and comments override this method to return an
- * instance of AbstractRenderingEngine
- *
- * @return <code>null</code> if HTML preview is not supported for the repository (default)
- * @since 2.1
- */
- public AbstractRenderingEngine getRenderingEngine(TaskAttribute attribute) {
- return renderingEngine;
- }
-
- /**
- * Called to check if there's content assist available for the given attribute.
- *
- * @param attribute
- * the attribute
- * @return true if content assist is available for the specified attribute.
- */
- private boolean hasContentAssist(TaskAttribute taskAttribute) {
- String type = taskAttribute.getMetaData().getType();
- if (TaskAttribute.TYPE_PERSON.equals(type)) {
- return true;
- } else if (TaskAttribute.TYPE_TASK_DEPENDENCY.equals(type)) {
- return true;
- }
- return false;
- }
-
- boolean hasSpellChecking(TaskAttribute taskAttribute) {
- String type = taskAttribute.getMetaData().getType();
- if (TaskAttribute.TYPE_LONG_RICH_TEXT.equals(type) || TaskAttribute.TYPE_SHORT_RICH_TEXT.equals(type)) {
- return true;
- }
- return false;
- }
-
- void setMenu(Menu menu) {
- this.menu = menu;
- }
-
- public void setRenderingEngine(AbstractRenderingEngine renderingEngine) {
- this.renderingEngine = renderingEngine;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java
deleted file mode 100644
index d4e686102..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.internal.browser.BrowserViewer;
-import org.eclipse.ui.internal.browser.IBrowserViewerContainer;
-
-/**
- * A form page that contains a browser control.
- *
- * @since 3.0
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class BrowserFormPage extends FormPage {
-
- public static final String ID_EDITOR = "org.eclipse.mylyn.tasks.ui.editor.browser"; //$NON-NLS-1$
-
- private BrowserViewer browserViewer;
-
- public BrowserFormPage(FormEditor editor, String title) {
- super(editor, ID_EDITOR, title);
- }
-
- @Override
- protected void createFormContent(IManagedForm managedForm) {
- super.createFormContent(managedForm);
- try {
- ScrolledForm form = managedForm.getForm();
- form.getBody().setLayout(new FillLayout());
- browserViewer = new BrowserViewer(form.getBody(), SWT.NONE);
- browserViewer.setLayoutData(null);
- browserViewer.setContainer(new IBrowserViewerContainer() {
-
- public boolean close() {
- return false;
- }
-
- public IActionBars getActionBars() {
- return BrowserFormPage.this.getEditorSite().getActionBars();
- }
-
- public void openInExternalBrowser(String url) {
- // ignore
- }
-
- });
- managedForm.getForm().setContent(browserViewer);
- String url = getUrl();
- if (url != null) {
- browserViewer.setURL(url);
- }
- } catch (SWTError e) {
- // TODO review error handling
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not create browser page: " //$NON-NLS-1$
- + e.getMessage(), e));
- } catch (RuntimeException e) {
- // TODO review error handling
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not create browser page", e)); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns a reference to the browser control.
- */
- public Browser getBrowser() {
- return browserViewer.getBrowser();
- }
-
- /**
- * Returns the initial URL that is displayed in the browser control. The default implementation tries to determine
- * the URL from the editor input.
- * <p>
- * Subclasses should override this method to display a specific URL.
- *
- * @return the URL to load when the page is created; null, if no URL should be loaded
- */
- protected String getUrl() {
- IEditorInput input = getEditorInput();
- if (input instanceof TaskEditorInput) {
- return ((TaskEditorInput) input).getTask().getUrl();
- }
- return null;
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) {
- super.init(site, input);
- if (input instanceof TaskEditorInput) {
- TasksUiPlugin.getTaskDataManager().setTaskRead(((TaskEditorInput) input).getTask(), true);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/LayoutHint.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/LayoutHint.java
deleted file mode 100644
index 3a61e1f2e..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/LayoutHint.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-/**
- * A layout hint for attribute editors.
- *
- * @author Steffen Pingel
- * @since 3.0
- */
-public class LayoutHint {
-
- /**
- * @since 3.0
- */
- public final static int DEFAULT_PRIORITY = 10;
-
- /**
- * @since 3.0
- */
- public enum ColumnSpan {
- MULTIPLE, SINGLE
- };
-
- /**
- * @since 3.0
- */
- public enum RowSpan {
- MULTIPLE, SINGLE
- };
-
- /**
- * @since 3.0
- */
- public RowSpan rowSpan;
-
- /**
- * @since 3.0
- */
- public ColumnSpan columnSpan;
-
- /**
- * @since 3.0
- */
- public LayoutHint(RowSpan rowHint, ColumnSpan columnHint) {
- this.rowSpan = rowHint;
- this.columnSpan = columnHint;
- }
-
- /**
- * Clones <code>source</code>. Constructs a layout hint with a priority of {@link #DEFAULT_PRIORITY}, if
- * <code>source</code> is null.
- *
- * @param source
- * the layout hint to clone or <code>null</code>
- * @since 3.1
- */
- public LayoutHint(LayoutHint source) {
- if (source != null) {
- this.rowSpan = source.rowSpan;
- this.columnSpan = source.columnSpan;
- }
- }
-
- /**
- * Constructs a layout hint with a priority of {@link #DEFAULT_PRIORITY}.
- *
- * @since 3.1
- */
- public LayoutHint() {
- }
-
- /**
- * Returns a priority based on the size of the layout hint. The bigger the size the bigger the returned priority.
- * <p>
- * The priority is used to layout attribute editors.
- *
- * @since 3.0
- */
- public int getPriority() {
- if (columnSpan == null || columnSpan == ColumnSpan.SINGLE) {
- if (rowSpan == null || rowSpan == RowSpan.SINGLE) {
- return DEFAULT_PRIORITY;
- } else {
- return DEFAULT_PRIORITY * 2;
- }
- } else {
- if (rowSpan == null || rowSpan == RowSpan.SINGLE) {
- return DEFAULT_PRIORITY * 3;
- } else {
- return DEFAULT_PRIORITY * 4;
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
deleted file mode 100644
index a240e3a92..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ /dev/null
@@ -1,677 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eric Booth - initial prototype
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ControlContribution;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.actions.TaskEditorScheduleAction;
-import org.eclipse.mylyn.internal.tasks.ui.actions.ToggleTaskActivationAction;
-import org.eclipse.mylyn.internal.tasks.ui.editors.EditorBusyIndicator;
-import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
-import org.eclipse.mylyn.internal.tasks.ui.editors.IBusyEditor;
-import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor;
-import org.eclipse.mylyn.internal.tasks.ui.util.SelectionProviderAdapter;
-import org.eclipse.mylyn.internal.tasks.ui.util.TaskDragSourceListener;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.forms.editor.SharedHeaderFormEditor;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.part.WorkbenchPart;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- */
-public class TaskEditor extends SharedHeaderFormEditor {
-
- public static final String ID_EDITOR = "org.eclipse.mylyn.tasks.ui.editors.task"; //$NON-NLS-1$
-
- private ToggleTaskActivationAction activateAction;
-
- @Deprecated
- private final IEditorPart contentOutlineProvider = null;
-
- private EditorBusyIndicator editorBusyIndicator;
-
- private MenuManager menuManager;
-
- private IHyperlinkListener messageHyperLinkListener;
-
- private ITask task;
-
- private TaskEditorInput taskEditorInput;
-
- private TaskDragSourceListener titleDragSourceListener;
-
- private Composite editorParent;
-
- public TaskEditor() {
- }
-
- @Override
- protected Composite createPageContainer(Composite parent) {
- this.editorParent = parent;
- return super.createPageContainer(parent);
- }
-
- Composite getEditorParent() {
- return editorParent;
- }
-
- @Override
- protected void addPages() {
- initialize();
-
- // determine factories
- Set<String> conflictingIds = new HashSet<String>();
- ArrayList<AbstractTaskEditorPageFactory> pageFactories = new ArrayList<AbstractTaskEditorPageFactory>();
- for (AbstractTaskEditorPageFactory pageFactory : TasksUiPlugin.getDefault().getTaskEditorPageFactories()) {
- if (pageFactory.canCreatePageFor(getTaskEditorInput())) {
- pageFactories.add(pageFactory);
- String[] ids = pageFactory.getConflictingIds(getTaskEditorInput());
- if (ids != null) {
- conflictingIds.addAll(Arrays.asList(ids));
- }
- }
- }
- for (Iterator<AbstractTaskEditorPageFactory> it = pageFactories.iterator(); it.hasNext();) {
- if (conflictingIds.contains(it.next().getId())) {
- it.remove();
- }
- }
-
- // sort by priority
- Collections.sort(pageFactories, new Comparator<AbstractTaskEditorPageFactory>() {
- public int compare(AbstractTaskEditorPageFactory o1, AbstractTaskEditorPageFactory o2) {
- return o1.getPriority() - o2.getPriority();
- }
- });
-
- // create pages
- for (AbstractTaskEditorPageFactory factory : pageFactories) {
- try {
- IFormPage page = factory.createPage(this);
- int index = addPage(page);
- setPageImage(index, factory.getPageImage());
- setPageText(index, factory.getPageText());
- if (factory.getPriority() == AbstractTaskEditorPageFactory.PRIORITY_TASK) {
- setActivePage(index);
- }
- if (page instanceof ISelectionProvider) {
- ((ISelectionProvider) page).addSelectionChangedListener(getActionBarContributor());
- }
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Could not create editor via factory: " + factory, e)); //$NON-NLS-1$
- }
- }
-
- updateTitleImage();
- updateHeaderToolBar();
- }
-
- private void initialize() {
- editorBusyIndicator = new EditorBusyIndicator(new IBusyEditor() {
- public Image getTitleImage() {
- return TaskEditor.this.getTitleImage();
- }
-
- public void setTitleImage(Image image) {
- TaskEditor.this.setTitleImage(image);
- }
- });
-
- menuManager = new MenuManager();
- configureContextMenuManager(menuManager);
- Menu menu = menuManager.createContextMenu(getContainer());
- getContainer().setMenu(menu);
- getEditorSite().registerContextMenu(menuManager, getEditorSite().getSelectionProvider(), false);
-
- // install context menu on form heading and title
- getHeaderForm().getForm().setMenu(menu);
- Composite head = getHeaderForm().getForm().getForm().getHead();
- if (head != null) {
- EditorUtil.setMenu(head, menu);
- }
- }
-
- /**
- * @since 3.0
- */
- @Deprecated
- public void configureContextMenuManager(MenuManager manager) {
- if (manager == null) {
- return;
- }
- IMenuListener listener = new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- contextMenuAboutToShow(manager);
- }
- };
- manager.setRemoveAllWhenShown(true);
- manager.addMenuListener(listener);
- }
-
- @Deprecated
- protected void contextMenuAboutToShow(IMenuManager manager) {
- TaskEditorActionContributor contributor = getActionBarContributor();
- if (contributor != null) {
- contributor.contextMenuAboutToShow(manager);
- }
- }
-
- @Override
- protected FormToolkit createToolkit(Display display) {
- // create a toolkit that shares colors between editors.
- return new FormToolkit(TasksUiPlugin.getDefault().getFormColors(display));
- }
-
- @Override
- protected void createHeaderContents(IManagedForm headerForm) {
- getToolkit().decorateFormHeading(headerForm.getForm().getForm());
- updateHeader();
- installTitleDrag(getHeaderForm().getForm().getForm());
- }
-
- @Override
- public void dispose() {
- if (editorBusyIndicator != null) {
- editorBusyIndicator.stop();
- }
- if (activateAction != null) {
- activateAction.dispose();
- }
- super.dispose();
- }
-
- @Override
- public void doSave(IProgressMonitor monitor) {
- for (IFormPage page : getPages()) {
- if (page.isDirty()) {
- page.doSave(monitor);
- }
- }
-
- editorDirtyStateChanged();
- }
-
- @Override
- public void doSaveAs() {
- throw new UnsupportedOperationException();
- }
-
- private TaskEditorActionContributor getActionBarContributor() {
- return (TaskEditorActionContributor) getEditorSite().getActionBarContributor();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object getAdapter(Class adapter) {
- if (contentOutlineProvider != null) {
- return contentOutlineProvider.getAdapter(adapter);
- } else if (IContentOutlinePage.class.equals(adapter)) {
- IFormPage[] pages = getPages();
- for (IFormPage page : pages) {
- Object outlinePage = page.getAdapter(adapter);
- if (outlinePage != null) {
- return outlinePage;
- }
- }
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * @since 3.0
- */
- public Menu getMenu() {
- return getContainer().getMenu();
- }
-
- @SuppressWarnings("unchecked")
- IFormPage[] getPages() {
- ArrayList formPages = new ArrayList();
- if (pages != null) {
- for (int i = 0; i < pages.size(); i++) {
- Object page = pages.get(i);
- if (page instanceof IFormPage) {
- formPages.add(page);
- }
- }
- }
- return (IFormPage[]) formPages.toArray(new IFormPage[formPages.size()]);
- }
-
- @Deprecated
- protected IWorkbenchSiteProgressService getProgressService() {
- Object siteService = getEditorSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (siteService != null) {
- return (IWorkbenchSiteProgressService) siteService;
- }
- return null;
- }
-
- @Deprecated
- public ISelection getSelection() {
- if (getSite() != null && getSite().getSelectionProvider() != null) {
- return getSite().getSelectionProvider().getSelection();
- } else {
- return StructuredSelection.EMPTY;
- }
- }
-
- public TaskEditorInput getTaskEditorInput() {
- return taskEditorInput;
- }
-
- @Deprecated
- public Form getTopForm() {
- return this.getHeaderForm().getForm().getForm();
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- if (!(input instanceof TaskEditorInput)) {
- throw new PartInitException("Invalid editor input \"" + input.getClass() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- super.init(site, input);
-
- this.taskEditorInput = (TaskEditorInput) input;
- this.task = taskEditorInput.getTask();
-
- setPartName(input.getName());
-
- // activate context
- IContextService contextSupport = (IContextService) site.getService(IContextService.class);
- if (contextSupport != null) {
- contextSupport.activateContext(ID_EDITOR);
- }
- }
-
- private void installTitleDrag(Form form) {
- if (titleDragSourceListener == null) {
- Transfer[] transferTypes;
- if (null == task) {
- transferTypes = new Transfer[] { TextTransfer.getInstance() };
- } else {
- transferTypes = new Transfer[] { LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance(),
- FileTransfer.getInstance() };
- }
- titleDragSourceListener = new TaskDragSourceListener(new SelectionProviderAdapter() {
- @Override
- public ISelection getSelection() {
- return new StructuredSelection(task);
- }
- });
- form.addTitleDragSupport(DND.DROP_MOVE | DND.DROP_LINK, transferTypes, titleDragSourceListener);
- }
- }
-
- @Override
- public boolean isDirty() {
- for (IFormPage page : getPages()) {
- if (page.isDirty()) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- @Deprecated
- public void markDirty() {
- firePropertyChange(PROP_DIRTY);
- }
-
- /**
- * Refresh editor with new contents (if any)
- *
- * @since 3.0
- */
- public void refreshPages() {
- for (IFormPage page : getPages()) {
- if (page instanceof AbstractTaskEditorPage) {
- ((AbstractTaskEditorPage) page).refreshFormContent();
- } else if (page instanceof BrowserFormPage) {
- // XXX 3.1 replace by invocation of refreshFromContent();
- ((BrowserFormPage) page).init(getEditorSite(), getEditorInput());
- }
- }
- }
-
- @Override
- public void setFocus() {
- IFormPage page = getActivePageInstance();
- if (page != null) {
- page.setFocus();
- } else {
- super.setFocus();
- }
- }
-
- @Deprecated
- public void setFocusOfActivePage() {
- if (this.getActivePage() > -1) {
- IFormPage page = this.getPages()[this.getActivePage()];
- if (page != null) {
- page.setFocus();
- }
- }
- }
-
- public void setMessage(String message, int type) {
- setMessage(message, type, null);
- }
-
- /**
- * @since 2.3
- */
- public void setMessage(String message, int type, IHyperlinkListener listener) {
- if (getHeaderForm() != null && getHeaderForm().getForm() != null) {
- if (!getHeaderForm().getForm().isDisposed()) {
- Form form = getHeaderForm().getForm().getForm();
- form.setMessage(message, type);
- if (messageHyperLinkListener != null) {
- form.removeMessageHyperlinkListener(messageHyperLinkListener);
- }
- if (listener != null) {
- form.addMessageHyperlinkListener(listener);
- }
- messageHyperLinkListener = listener;
- }
- }
- }
-
- /**
- * @since 3.1
- */
- public String getMessage() {
- if (getHeaderForm() != null && getHeaderForm().getForm() != null) {
- if (!getHeaderForm().getForm().isDisposed()) {
- Form form = getHeaderForm().getForm().getForm();
- return form.getMessage();
- }
- }
- return null;
- }
-
- /**
- * @since 3.0
- */
- public void setStatus(String message, final String title, final IStatus status) {
- setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent event) {
- TasksUiInternal.displayStatus(title, status);
- }
- });
- }
-
- @Override
- public void showBusy(boolean busy) {
- if (editorBusyIndicator != null) {
- if (busy) {
- if (TasksUiInternal.isAnimationsEnabled()) {
- editorBusyIndicator.start();
- }
- } else {
- editorBusyIndicator.stop();
- }
- }
-
- if (getHeaderForm() != null && getHeaderForm().getForm() != null && !getHeaderForm().getForm().isDisposed()) {
- Form form = getHeaderForm().getForm().getForm();
- if (form != null && !form.isDisposed()) {
- // TODO consider only disabling certain actions
- IToolBarManager toolBarManager = form.getToolBarManager();
- if (toolBarManager instanceof ToolBarManager) {
- ToolBar control = ((ToolBarManager) toolBarManager).getControl();
- if (control != null) {
- control.setEnabled(!busy);
- }
- }
-
- EditorUtil.setEnabledState(form.getBody(), !busy);
- for (IFormPage page : getPages()) {
- if (page instanceof WorkbenchPart) {
- WorkbenchPart part = (WorkbenchPart) page;
- part.showBusy(busy);
- }
- }
- }
- }
- }
-
- private void updateHeader() {
- IEditorInput input = getEditorInput();
- if (input instanceof TaskEditorInput) {
- updateHeaderImage(task.getConnectorKind());
- updateHeaderLabel(task);
- }
- setTitleToolTip(input.getToolTipText());
- setPartName(input.getName());
- installTitleDrag(getHeaderForm().getForm().getForm());
- }
-
- /**
- * @since 3.0
- */
- public void updateHeaderToolBar() {
- final Form form = getHeaderForm().getForm().getForm();
- IToolBarManager toolBarManager = form.getToolBarManager();
-
- toolBarManager.removeAll();
- toolBarManager.update(true);
-
- TaskRepository outgoingNewRepository = TasksUiUtil.getOutgoingNewTaskRepository(task);
- if (!LocalRepositoryConnector.CONNECTOR_KIND.equals(taskEditorInput.getTaskRepository().getConnectorKind())
- || outgoingNewRepository != null) {
- final TaskRepository taskRepository = (outgoingNewRepository != null) ? outgoingNewRepository
- : taskEditorInput.getTaskRepository();
- ControlContribution repositoryLabelControl = new ControlContribution(Messages.AbstractTaskEditorPage_Title) {
- @Override
- protected Control createControl(Composite parent) {
- FormToolkit toolkit = getHeaderForm().getToolkit();
- Composite composite = toolkit.createComposite(parent);
- composite.setLayout(new RowLayout());
- composite.setBackground(null);
- String label = taskRepository.getRepositoryLabel();
- if (label.indexOf("//") != -1) { //$NON-NLS-1$
- label = label.substring((taskRepository.getRepositoryUrl().indexOf("//") + 2)); //$NON-NLS-1$
- }
-
- Hyperlink link = new Hyperlink(composite, SWT.NONE);
- link.setText(label);
- link.setFont(JFaceResources.getBannerFont());
- link.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- link.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiUtil.openEditRepositoryWizard(taskRepository);
- }
- });
-
- return composite;
- }
- };
- toolBarManager.add(repositoryLabelControl);
- }
-
- for (IFormPage page : getPages()) {
- if (page instanceof TaskFormPage) {
- TaskFormPage taskEditorPage = (TaskFormPage) page;
- taskEditorPage.fillToolBar(toolBarManager);
- }
- }
-
- final String taskUrl = task.getUrl();
- if (taskUrl != null && taskUrl.length() > 0) {
- Action openWithBrowserAction = new Action() {
- @Override
- public void run() {
- TasksUiUtil.openUrl(taskUrl);
- }
- };
- openWithBrowserAction.setImageDescriptor(CommonImages.BROWSER_OPEN_TASK);
- openWithBrowserAction.setToolTipText(Messages.AbstractTaskEditorPage_Open_with_Web_Browser);
- toolBarManager.add(openWithBrowserAction);
- }
-
- if (activateAction == null) {
- activateAction = new ToggleTaskActivationAction(task) {
- @Override
- public void run() {
- TaskList taskList = TasksUiPlugin.getTaskList();
- if (taskList.getTask(task.getRepositoryUrl(), task.getTaskId()) == null) {
- setMessage(Messages.TaskEditor_Task_added_to_the_Uncategorized_container,
- IMessageProvider.INFORMATION);
- }
- super.run();
- }
- };
- }
- toolBarManager.add(new Separator("planning")); //$NON-NLS-1$
- toolBarManager.add(new TaskEditorScheduleAction(task));
-
- toolBarManager.add(new Separator("activation")); //$NON-NLS-1$
- toolBarManager.add(activateAction);
-
- toolBarManager.update(true);
-
- // XXX move this call
- updateHeader();
- }
-
- private void updateHeaderImage(String connectorKind) {
- if (LocalRepositoryConnector.CONNECTOR_KIND.equals(connectorKind)) {
- getHeaderForm().getForm().setImage(CommonImages.getImage(TasksUiImages.TASK));
- } else {
- ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(connectorKind);
- Image image = CommonImages.getImageWithOverlay(TasksUiImages.REPOSITORY, overlay, false, false);
- getHeaderForm().getForm().setImage(image);
- }
- }
-
- private void updateHeaderLabel(ITask task) {
- if (task instanceof LocalTask) {
- getHeaderForm().getForm().setText(Messages.TaskEditor_Task_ + task.getSummary());
- } else {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(task.getConnectorKind());
- String kindLabel = ""; //$NON-NLS-1$
- if (connectorUi != null) {
- kindLabel = connectorUi.getTaskKindLabel(task);
- }
-
- String idLabel = task.getTaskKey();
- if (idLabel != null) {
- getHeaderForm().getForm().setText(kindLabel + " " + idLabel); //$NON-NLS-1$
- } else {
- getHeaderForm().getForm().setText(kindLabel);
- }
- }
- }
-
- /**
- * Update the title of the editor.
- *
- * @deprecated use {@link #updateHeaderToolBar()} instead
- */
- @Deprecated
- public void updateTitle(String name) {
- updateHeader();
- }
-
- private void updateTitleImage() {
- if (task != null) {
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(task.getConnectorKind());
- if (connectorUi != null) {
- ImageDescriptor overlayDescriptor = connectorUi.getTaskKindOverlay(task);
- setTitleImage(CommonImages.getCompositeTaskImage(TasksUiImages.TASK, overlayDescriptor, false));
- } else {
- setTitleImage(CommonImages.getImage(TasksUiImages.TASK));
- }
-// } else if (getEditorInput() instanceof AbstractRepositoryTaskEditorInput) {
-// setTitleImage(CommonImages.getImage(TasksUiImages.TASK_REMOTE));
- } else {
- setTitleImage(CommonImages.getImage(TasksUiImages.TASK));
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java
deleted file mode 100644
index 169415f26..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorInput.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Eric Booth - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorInputFactory;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * Input for task editors.
- *
- * @author Eric Booth
- * @author Rob Elves
- * @author Mik Kersten
- * @author Steffen Pingel
- * @since 2.0
- */
-public class TaskEditorInput implements IEditorInput, IPersistableElement {
-
- private static final int MAX_LABEL_LENGTH = 60;
-
- private final ITask task;
-
- private final TaskRepository taskRepository;
-
- private Object data;
-
- /**
- * @since 3.0
- */
- @Deprecated
- public TaskEditorInput(ITask task, boolean newTask) {
- this(TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(), task.getRepositoryUrl()), task);
- }
-
- /**
- * @since 3.0
- */
- public TaskEditorInput(TaskRepository taskRepository, ITask task) {
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(task);
- this.taskRepository = taskRepository;
- this.task = task;
- }
-
- /**
- * @since 2.0
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TaskEditorInput other = (TaskEditorInput) obj;
- return task.equals(other.task);
- }
-
- /**
- * @since 2.0
- */
- public boolean exists() {
- return task != null;
- }
-
- /**
- * @since 2.0
- */
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- if (adapter == IEditorInput.class) {
- return this;
- }
- return null;
- }
-
- /**
- * @since 2.0
- */
- public String getFactoryId() {
- return TaskEditorInputFactory.ID_FACTORY;
- }
-
- /**
- * @since 2.0
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /**
- * @deprecated use {@link #getName()}
- * @since 2.0
- */
- @Deprecated
- public String getLabel() {
- return getName();
- }
-
- /**
- * @since 2.0
- */
- public String getName() {
- String toolTipText = getToolTipText();
- if (toolTipText == null) {
- return null;
- }
-
- if (task != null) {
- String taskKey = task.getTaskKey();
- if (taskKey != null) {
- return truncate(taskKey + ": " + toolTipText); //$NON-NLS-1$
- }
- }
- return truncate(toolTipText);
- }
-
- /**
- * @since 2.0
- */
- public IPersistableElement getPersistable() {
- if (task != null && TasksUiPlugin.getTaskList().getTask(task.getHandleIdentifier()) != null) {
- return this;
- }
- return null;
- }
-
- /**
- * Returns the task if the task is in the task list; returns <code>null</code> otherwise.
- *
- * @since 3.0
- */
- public ITask getTask() {
- return task;
- }
-
- /**
- * @since 3.0
- */
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- /**
- * @since 2.0
- */
- public String getToolTipText() {
- return task.getSummary();
- }
-
- /**
- * @since 2.0
- */
- @Override
- public int hashCode() {
- return task.getTaskId().hashCode();
- }
-
- /**
- * @since 2.0
- */
- @Deprecated
- public boolean isNewTask() {
- return false;
- }
-
- /**
- * @since 2.0
- */
- public void saveState(IMemento memento) {
- TaskEditorInputFactory.saveState(memento, this);
- }
-
- private String truncate(String description) {
- if (description == null || description.length() <= MAX_LABEL_LENGTH) {
- return description;
- } else {
- return description.substring(0, MAX_LABEL_LENGTH) + "..."; //$NON-NLS-1$
- }
- }
-
- /**
- * @since 3.0
- */
- public Object getData() {
- return data;
- }
-
- /**
- * @since 3.0
- */
- public void setData(Object data) {
- this.data = data;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorPartDescriptor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorPartDescriptor.java
deleted file mode 100644
index 3619f8418..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditorPartDescriptor.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class TaskEditorPartDescriptor {
-
- private final String id;
-
- private String path;
-
-// public AbstractTaskEditorPart createPart() {
-// final AbstractTaskEditorPart[] result = new AbstractTaskEditorPart[1];
-// SafeRunnable.run(new ISafeRunnable() {
-//
-// public void handleException(Throwable exception) {
-// StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
-// "Unable to create instance of class \"" + getClassName() + "\" for task editor part \""
-// + getId() + "\""));
-// }
-//
-// public void run() throws Exception {
-// Class<?> clazz = Class.forName(getClassName());
-// result[0] = (AbstractTaskEditorPart) clazz.newInstance();
-// }
-//
-// });
-// return result[0];
-// }
-
- public TaskEditorPartDescriptor(String id) {
- Assert.isNotNull(id);
- this.id = id;
- setPath(AbstractTaskEditorPage.PATH_COMMENTS);
- }
-
- public abstract AbstractTaskEditorPart createPart();
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- TaskEditorPartDescriptor other = (TaskEditorPartDescriptor) obj;
- return id.equals(other.id);
- }
-
- public String getId() {
- return id;
- }
-
- public String getPath() {
- return path;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + id.hashCode();
- return result;
- }
-
- public TaskEditorPartDescriptor setPath(String path) {
- this.path = path;
- return this;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java
deleted file mode 100644
index 2c29d85d9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskFormPage.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.editors;
-
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
-
-/**
- * @author Steffen Pingel
- * @since 3.1
- */
-public class TaskFormPage extends FormPage {
-
- public TaskFormPage(String id, String title) {
- super(id, title);
- }
-
- public TaskFormPage(FormEditor editor, String id, String title) {
- super(editor, id, title);
- }
-
- protected void fillToolBar(IToolBarManager toolBarManager) {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage.java
deleted file mode 100644
index c4c041da9..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.ui.search.SearchHitCollector;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * Extend to provide repository-specific query page to the Workbench search dialog.
- *
- * @author Rob Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractRepositoryQueryPage extends WizardPage implements ITaskSearchPage {
-
- private ITaskSearchPageContainer searchContainer;
-
- private final TaskRepository taskRepository;
-
- private final IRepositoryQuery query;
-
- public AbstractRepositoryQueryPage(String pageName, TaskRepository taskRepository, IRepositoryQuery query) {
- super(pageName);
- Assert.isNotNull(taskRepository);
- this.taskRepository = taskRepository;
- this.query = query;
- setTitle(Messages.AbstractRepositoryQueryPage_Enter_query_parameters);
- setDescription(Messages.AbstractRepositoryQueryPage_If_attributes_are_blank_or_stale_press_the_Update_button);
- setImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- setPageComplete(false);
- }
-
- public AbstractRepositoryQueryPage(String pageName, TaskRepository taskRepository) {
- this(pageName, taskRepository, null);
- }
-
- public IRepositoryQuery getQuery() {
- return query;
- }
-
- public abstract String getQueryTitle();
-
- @Override
- public boolean isPageComplete() {
- String queryTitle = getQueryTitle();
- if (queryTitle == null || queryTitle.equals("")) { //$NON-NLS-1$
- setErrorMessage(Messages.AbstractRepositoryQueryPage_Please_specify_a_title_for_the_query);
- return false;
- } else {
- Set<RepositoryQuery> queries = TasksUiInternal.getTaskList().getQueries();
- Set<AbstractTaskCategory> categories = TasksUiInternal.getTaskList().getCategories();
- String oldSummary = null;
- if (query != null) {
- oldSummary = query.getSummary();
- }
- if (oldSummary != null && queryTitle.equals(oldSummary)) {
- setErrorMessage(null);
- return true;
- }
-
- for (AbstractTaskCategory category : categories) {
- if (queryTitle.equals(category.getSummary())) {
- setErrorMessage(Messages.AbstractRepositoryQueryPage_A_category_with_this_name_already_exists);
- return false;
- }
- }
- for (RepositoryQuery repositoryQuery : queries) {
- if (query == null || !query.equals(repositoryQuery)) {
- if (queryTitle.equals(repositoryQuery.getSummary())) {
- setErrorMessage(Messages.AbstractRepositoryQueryPage_A_query_with_this_name_already_exists);
- return false;
- }
- }
- }
- }
- setErrorMessage(null);
- return true;
- }
-
- public IRepositoryQuery createQuery() {
- IRepositoryQuery query = TasksUi.getRepositoryModel().createRepositoryQuery(getTaskRepository());
- applyTo(query);
- return query;
- }
-
- public abstract void applyTo(IRepositoryQuery query);
-
- public void saveState() {
- // empty
- }
-
- public void setContainer(ITaskSearchPageContainer container) {
- searchContainer = container;
- }
-
- public boolean inSearchContainer() {
- return searchContainer != null;
- }
-
- public boolean performSearch() {
- NewSearchUI.activateSearchResultView();
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- taskRepository.getConnectorKind());
- if (connector != null) {
- try {
- SearchHitCollector collector = new SearchHitCollector(TasksUiInternal.getTaskList(), taskRepository,
- createQuery());
- NewSearchUI.runQueryInBackground(collector);
- } catch (UnsupportedOperationException e) {
- SearchHitCollector collector = new SearchHitCollector(TasksUiInternal.getTaskList(), taskRepository,
- getQuery());
- NewSearchUI.runQueryInBackground(collector);
- }
- }
- return true;
- }
-
- /**
- * @since 2.1
- */
- public void setControlsEnabled(boolean enabled) {
- setControlsEnabled(getControl(), enabled);
- }
-
- // TODO: make reusable or find better API, task editor has similar functionality
- private void setControlsEnabled(Control control, boolean enabled) {
- if (control instanceof Composite) {
- for (Control childControl : ((Composite) control).getChildren()) {
- childControl.setEnabled(enabled);
- setControlsEnabled(childControl, enabled);
- }
- }
- setPageComplete(isPageComplete());
- }
-
- public ITaskSearchPageContainer getSearchContainer() {
- return searchContainer;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
deleted file mode 100644
index b63550620..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
+++ /dev/null
@@ -1,1687 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- * Frank Becker - improvements
- * Helen Bershadskaya - improvements for bug 242445
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-import java.nio.charset.Charset;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
-import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-
-/**
- * Extend to provide custom repository settings. This page is typically invoked by the user requesting properties via
- * the Task Repositories view.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- * @author Frank Becker
- * @author David Green
- * @author Helen Bershadskaya
- * @since 2.0
- */
-public abstract class AbstractRepositorySettingsPage extends AbstractTaskRepositoryPage implements ITaskRepositoryPage {
-
- protected static final String PREFS_PAGE_ID_NET_PROXY = "org.eclipse.ui.net.NetPreferences"; //$NON-NLS-1$
-
- protected static final String LABEL_REPOSITORY_LABEL = Messages.AbstractRepositorySettingsPage_Label_;
-
- protected static final String LABEL_SERVER = Messages.AbstractRepositorySettingsPage_Server_;
-
- protected static final String LABEL_USER = Messages.AbstractRepositorySettingsPage_User_ID_;
-
- protected static final String LABEL_PASSWORD = Messages.AbstractRepositorySettingsPage_Password_;
-
- protected static final String URL_PREFIX_HTTPS = "https://"; //$NON-NLS-1$
-
- protected static final String URL_PREFIX_HTTP = "http://"; //$NON-NLS-1$
-
- protected static final String INVALID_REPOSITORY_URL = Messages.AbstractRepositorySettingsPage_Repository_url_is_invalid;
-
- protected static final String INVALID_LOGIN = Messages.AbstractRepositorySettingsPage_Unable_to_authenticate_with_repository;
-
- protected AbstractRepositoryConnector connector;
-
- protected StringFieldEditor repositoryLabelEditor;
-
- protected Combo serverUrlCombo;
-
- private String serverVersion = TaskRepository.NO_VERSION_SPECIFIED;
-
- protected StringFieldEditor repositoryUserNameEditor;
-
- protected StringFieldEditor repositoryPasswordEditor;
-
- protected StringFieldEditor httpAuthUserNameEditor;
-
- protected StringFieldEditor httpAuthPasswordEditor;
-
- protected StringFieldEditor proxyHostnameEditor;
-
- protected StringFieldEditor proxyPortEditor;
-
- protected StringFieldEditor proxyUserNameEditor;
-
- protected StringFieldEditor proxyPasswordEditor;
-
- // FIXME shadows declaration in super
- protected TaskRepository repository;
-
- private Combo otherEncodingCombo;
-
- private Button defaultEncoding;
-
- // private Combo timeZonesCombo;
-
- protected Button anonymousButton;
-
- private String oldUsername;
-
- private String oldPassword;
-
- private String oldHttpAuthUserId;
-
- private String oldHttpAuthPassword;
-
- private boolean needsAnonymousLogin;
-
- private boolean needsTimeZone;
-
- private boolean needsEncoding;
-
- private boolean needsHttpAuth;
-
- private boolean needsValidation;
-
- private boolean needsAdvanced;
-
- protected Composite compositeContainer;
-
- private Composite advancedComp;
-
- private Composite httpAuthComp;
-
- private Composite proxyAuthComp;
-
- private Set<String> repositoryUrls;
-
- private String originalUrl;
-
- private Button otherEncoding;
-
- private Button httpAuthButton;
-
- private boolean needsProxy;
-
- private Button systemProxyButton;
-
- private String oldProxyUsername = ""; //$NON-NLS-1$
-
- private String oldProxyPassword = ""; //$NON-NLS-1$
-
- // private Button proxyAuthButton;
-
- private String oldProxyHostname = ""; //$NON-NLS-1$
-
- private String oldProxyPort = ""; //$NON-NLS-1$
-
- private Button proxyAuthButton;
-
- private Hyperlink createAccountHyperlink;
-
- private Hyperlink manageAccountHyperlink;
-
- /**
- * @since 3.1
- */
- protected Button savePasswordButton;
-
- private Button saveHttpPasswordButton;
-
- private Button saveProxyPasswordButton;
-
- private Button disconnectedButton;
-
- /**
- * @since 3.0
- */
- public AbstractRepositorySettingsPage(String title, String description, TaskRepository taskRepository) {
- super(title, description, taskRepository);
- repository = taskRepository;
- this.connector = TasksUi.getRepositoryManager().getRepositoryConnector(getConnectorKind());
- setNeedsAnonymousLogin(false);
- setNeedsEncoding(true);
- setNeedsTimeZone(true);
- setNeedsProxy(true);
- setNeedsValidation(true);
- setNeedsAdvanced(true);
- }
-
- /**
- * @since 3.0
- */
- @Override
- public abstract String getConnectorKind();
-
- @Override
- public void dispose() {
- super.dispose();
- }
-
-// /**
-// * @since 2.0
-// */
-// @Override
-// protected Control createContents(Composite parent) {
-// compositeContainer = new Composite(parent, SWT.NONE);
-// GridLayout layout = new GridLayout(3, false);
-// compositeContainer.setLayout(layout);
-//
-// createSettingControls(parent);
-// }
-
- @Override
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
-
- Composite compositeContainer = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- compositeContainer.setLayout(layout);
-
- createSettingControls(compositeContainer);
-
- setControl(compositeContainer);
- }
-
- /**
- * @since 2.0
- */
- @Override
- protected void createSettingControls(Composite parent) {
- compositeContainer = parent;
-
- initializeOldValues();
-
- Label serverLabel = new Label(compositeContainer, SWT.NONE);
- serverLabel.setText(LABEL_SERVER);
- serverUrlCombo = new Combo(compositeContainer, SWT.DROP_DOWN);
- serverUrlCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
- });
- serverUrlCombo.addFocusListener(new FocusAdapter() {
-
- @Override
- public void focusLost(FocusEvent e) {
- updateHyperlinks();
- }
- });
- serverUrlCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
- });
-
- GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).grab(true, false).span(2, SWT.DEFAULT).applyTo(
- serverUrlCombo);
-
- repositoryLabelEditor = new StringFieldEditor("", LABEL_REPOSITORY_LABEL, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
- compositeContainer) {
-
- @Override
- protected boolean doCheckState() {
- return true;
- // return isValidUrl(getStringValue());
- }
-
- @Override
- protected void valueChanged() {
- super.valueChanged();
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- return 2;
- }
- };
- disconnectedButton = new Button(compositeContainer, SWT.CHECK);
- disconnectedButton.setText(Messages.AbstractRepositorySettingsPage_Disconnected);
- disconnectedButton.setSelection(repository != null ? repository.isOffline() : false);
-
- repositoryUserNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
- compositeContainer) {
-
- @Override
- protected boolean doCheckState() {
- return true;
- }
-
- @Override
- protected void valueChanged() {
- super.valueChanged();
- isPageComplete();
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- // always 2 columns -- if no anonymous checkbox, just leave 3rd column empty
- return 2;
- }
- };
- if (needsAnonymousLogin()) {
- // need to increase column number here, because above string editor will use them if declared beforehand
- //((GridLayout) (compositeContainer.getLayout())).numColumns++;
- anonymousButton = new Button(compositeContainer, SWT.CHECK);
-
- anonymousButton.setText(Messages.AbstractRepositorySettingsPage_Anonymous_Access);
- anonymousButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setAnonymous(anonymousButton.getSelection());
- isPageComplete();
- }
- });
- } else {
- Label dummyLabel = new Label(compositeContainer, SWT.NONE); // dummy control to fill 3rd column when no anonymous login
- GridDataFactory.fillDefaults().applyTo(dummyLabel); // not really necessary, but to be on the safe side
- }
-
- repositoryPasswordEditor = new RepositoryStringFieldEditor("", LABEL_PASSWORD, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
- compositeContainer) {
-
- @Override
- protected boolean doCheckState() {
- return true;
- }
-
- @Override
- protected void valueChanged() {
- super.valueChanged();
- isPageComplete();
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- return 2;
- }
- };
-
- savePasswordButton = new Button(compositeContainer, SWT.CHECK);
- savePasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);
-
- if (repository != null) {
- try {
- String repositoryLabel = repository.getProperty(IRepositoryConstants.PROPERTY_LABEL);
- if (repositoryLabel != null && repositoryLabel.length() > 0) {
- // repositoryLabelCombo.add(repositoryLabel);
- // repositoryLabelCombo.select(0);
- repositoryLabelEditor.setStringValue(repositoryLabel);
- }
- serverUrlCombo.setText(repository.getRepositoryUrl());
- AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
- if (credentials != null) {
- repositoryUserNameEditor.setStringValue(credentials.getUserName());
- repositoryPasswordEditor.setStringValue(credentials.getPassword());
- } else {
- repositoryUserNameEditor.setStringValue(""); //$NON-NLS-1$
- repositoryPasswordEditor.setStringValue(""); //$NON-NLS-1$
- }
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set field value", t)); //$NON-NLS-1$
- }
- }
-
- if (needsAnonymousLogin()) {
- if (repository != null) {
- setAnonymous(repository.getCredentials(AuthenticationType.REPOSITORY) == null);
- } else {
- setAnonymous(true);
- }
- }
-
- if (repository != null) {
- savePasswordButton.setSelection(repository.getSavePassword(AuthenticationType.REPOSITORY));
- } else {
- savePasswordButton.setSelection(false);
- }
-
- // TODO: put this back if we can't get the info from all connectors
- // if (needsTimeZone()) {
- // Label timeZoneLabel = new Label(container, SWT.NONE);
- // timeZoneLabel.setText("Repository time zone: ");
- // timeZonesCombo = new Combo(container, SWT.READ_ONLY);
- // String[] timeZoneIds = TimeZone.getAvailableIDs();
- // Arrays.sort(timeZoneIds);
- // for (String zone : timeZoneIds) {
- // timeZonesCombo.add(zone);
- // }
- // boolean setZone = false;
- // if (repository != null) {
- // if (timeZonesCombo.indexOf(repository.getTimeZoneId()) > -1) {
- // timeZonesCombo.select(timeZonesCombo.indexOf(repository.getTimeZoneId()));
- // setZone = true;
- // }
- // }
- // if (!setZone) {
- // timeZonesCombo.select(timeZonesCombo.indexOf(TimeZone.getDefault().getID()));
- // }
- // }
-
- if (needsAdvanced() || needsEncoding()) {
- createAdvancedSection();
- }
-
- if (needsHttpAuth()) {
- createHttpAuthSection();
- }
-
- if (needsProxy()) {
- createProxySection();
- }
-
- createContributionControls(parent);
-
- Composite managementComposite = new Composite(compositeContainer, SWT.NULL);
- GridLayout managementLayout = new GridLayout(4, false);
- managementLayout.marginHeight = 0;
- managementLayout.marginWidth = 0;
- managementLayout.horizontalSpacing = 10;
- managementComposite.setLayout(managementLayout);
- managementComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 2, 1));
-
- createAccountHyperlink = toolkit.createHyperlink(managementComposite,
- Messages.AbstractRepositorySettingsPage_Create_new_account, SWT.NONE);
- createAccountHyperlink.setBackground(managementComposite.getBackground());
- createAccountHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
-// TaskRepository repository = getRepository();
- TaskRepository repository = createTaskRepository();
-// if (repository == null && getServerUrl() != null && getServerUrl().length() > 0) {
-// repository = createTaskRepository();
-// }
- if (repository != null) {
- String accountCreationUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
- .getAccountCreationUrl(repository);
- if (accountCreationUrl != null) {
- TasksUiUtil.openUrl(accountCreationUrl);
- }
- }
- }
- });
-
- manageAccountHyperlink = toolkit.createHyperlink(managementComposite,
- Messages.AbstractRepositorySettingsPage_Change_account_settings, SWT.NONE);
- manageAccountHyperlink.setBackground(managementComposite.getBackground());
- manageAccountHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TaskRepository repository = getRepository();
- if (repository == null && getRepositoryUrl() != null && getRepositoryUrl().length() > 0) {
- repository = createTaskRepository();
- }
- if (repository != null) {
- String accountManagementUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
- .getAccountManagementUrl(repository);
- if (accountManagementUrl != null) {
- TasksUiUtil.openUrl(accountManagementUrl);
- }
- }
- }
- });
-
- // bug 131656: must set echo char after setting value on Mac
- ((RepositoryStringFieldEditor) repositoryPasswordEditor).getTextControl().setEchoChar('*');
-
- if (needsAnonymousLogin()) {
- // do this after username and password widgets have been intialized
- if (repository != null) {
- setAnonymous(isAnonymousAccess());
- }
- }
-
- updateHyperlinks();
-
- GridLayout layout = new GridLayout(3, false);
- compositeContainer.setLayout(layout);
-
- Dialog.applyDialogFont(compositeContainer);
- }
-
- private void createAdvancedSection() {
- ExpandableComposite section = createSection(compositeContainer,
- Messages.AbstractRepositorySettingsPage_Additional_Settings);
-
- advancedComp = toolkit.createComposite(section, SWT.NONE);
- GridLayout gridLayout2 = new GridLayout();
- gridLayout2.numColumns = 2;
- gridLayout2.verticalSpacing = 5;
- gridLayout2.marginWidth = 0;
- advancedComp.setLayout(gridLayout2);
- advancedComp.setBackground(compositeContainer.getBackground());
- section.setClient(advancedComp);
-
- createAdditionalControls(advancedComp);
-
- if (needsEncoding()) {
- Label encodingLabel = new Label(advancedComp, SWT.HORIZONTAL);
- encodingLabel.setText(Messages.AbstractRepositorySettingsPage_Character_encoding);
- GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.TOP).applyTo(encodingLabel);
-
- Composite encodingContainer = new Composite(advancedComp, SWT.NONE);
- GridLayout gridLayout = new GridLayout(2, false);
- gridLayout.marginWidth = 0;
- gridLayout.marginHeight = 0;
- encodingContainer.setLayout(gridLayout);
-
- defaultEncoding = new Button(encodingContainer, SWT.RADIO);
- defaultEncoding.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
- defaultEncoding.setText(Messages.AbstractRepositorySettingsPage_Default__
- + TaskRepository.DEFAULT_CHARACTER_ENCODING + ")"); //$NON-NLS-1$
- defaultEncoding.setSelection(true);
-
- otherEncoding = new Button(encodingContainer, SWT.RADIO);
- otherEncoding.setText(Messages.AbstractRepositorySettingsPage_Other);
- otherEncodingCombo = new Combo(encodingContainer, SWT.READ_ONLY);
- try {
- for (String encoding : Charset.availableCharsets().keySet()) {
- if (!encoding.equals(TaskRepository.DEFAULT_CHARACTER_ENCODING)) {
- otherEncodingCombo.add(encoding);
- }
- }
- } catch (LinkageError e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.AbstractRepositorySettingsPage_Problems_encountered_determining_available_charsets, e));
- // bug 237972: 3rd party encodings can cause availableCharsets() to fail
- otherEncoding.setEnabled(false);
- otherEncodingCombo.setEnabled(false);
- }
-
- setDefaultEncoding();
-
- otherEncoding.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (otherEncoding.getSelection()) {
- defaultEncoding.setSelection(false);
- otherEncodingCombo.setEnabled(true);
- } else {
- defaultEncoding.setSelection(true);
- otherEncodingCombo.setEnabled(false);
- }
- }
- });
-
- if (repository != null) {
- try {
- String repositoryEncoding = repository.getCharacterEncoding();
- if (repositoryEncoding != null) {// &&
- // !repositoryEncoding.equals(defaultEncoding))
- // {
- if (otherEncodingCombo.getItemCount() > 0
- && otherEncodingCombo.indexOf(repositoryEncoding) > -1) {
- otherEncodingCombo.setEnabled(true);
- otherEncoding.setSelection(true);
- defaultEncoding.setSelection(false);
- otherEncodingCombo.select(otherEncodingCombo.indexOf(repositoryEncoding));
- } else {
- setDefaultEncoding();
- }
- }
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set field value", t)); //$NON-NLS-1$
- }
- }
- }
- }
-
- private void createHttpAuthSection() {
- ExpandableComposite section = createSection(compositeContainer,
- Messages.AbstractRepositorySettingsPage_Http_Authentication);
-
- httpAuthComp = toolkit.createComposite(section, SWT.NONE);
- httpAuthComp.setBackground(compositeContainer.getBackground());
- section.setClient(httpAuthComp);
-
- httpAuthButton = new Button(httpAuthComp, SWT.CHECK);
- GridDataFactory.fillDefaults().indent(0, 5).align(SWT.LEFT, SWT.TOP).span(3, SWT.DEFAULT).applyTo(
- httpAuthButton);
-
- httpAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_http_authentication);
-
- httpAuthButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- setHttpAuth(httpAuthButton.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- });
-
- httpAuthUserNameEditor = new StringFieldEditor(
- "", Messages.AbstractRepositorySettingsPage_User_ID_, StringFieldEditor.UNLIMITED, httpAuthComp) { //$NON-NLS-1$
-
- @Override
- protected boolean doCheckState() {
- return true;
- }
-
- @Override
- protected void valueChanged() {
- super.valueChanged();
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- return 3;
- }
- };
-
- httpAuthPasswordEditor = new RepositoryStringFieldEditor(
- "", Messages.AbstractRepositorySettingsPage_Password_, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
- httpAuthComp) {
- @Override
- public int getNumberOfControls() {
- return 2;
- }
- };
- ((RepositoryStringFieldEditor) httpAuthPasswordEditor).getTextControl().setEchoChar('*');
-
- saveHttpPasswordButton = new Button(httpAuthComp, SWT.CHECK);
- saveHttpPasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);
-
- httpAuthUserNameEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
- httpAuthPasswordEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
- saveHttpPasswordButton.setEnabled(httpAuthButton.getSelection());
-
- if (repository != null) {
- saveHttpPasswordButton.setSelection(repository.getSavePassword(AuthenticationType.HTTP));
- } else {
- saveHttpPasswordButton.setSelection(false);
- }
- setHttpAuth(oldHttpAuthPassword != null || oldHttpAuthUserId != null);
- section.setExpanded(httpAuthButton.getSelection());
-
- GridLayout gridLayout2 = new GridLayout();
- gridLayout2.numColumns = 3;
- gridLayout2.marginWidth = 0;
- httpAuthComp.setLayout(gridLayout2);
- }
-
- private void initializeOldValues() {
- if (repository != null) {
- originalUrl = repository.getRepositoryUrl();
- AuthenticationCredentials oldCredentials = repository.getCredentials(AuthenticationType.REPOSITORY);
- if (oldCredentials != null) {
- oldUsername = oldCredentials.getUserName();
- oldPassword = oldCredentials.getPassword();
- } else {
- oldUsername = ""; //$NON-NLS-1$
- oldPassword = ""; //$NON-NLS-1$
- }
-
- AuthenticationCredentials oldHttpCredentials = repository.getCredentials(AuthenticationType.HTTP);
- if (oldHttpCredentials != null) {
- oldHttpAuthUserId = oldHttpCredentials.getUserName();
- oldHttpAuthPassword = oldHttpCredentials.getPassword();
- } else {
- oldHttpAuthPassword = null;
- oldHttpAuthUserId = null;
- }
-
- oldProxyHostname = repository.getProperty(TaskRepository.PROXY_HOSTNAME);
- oldProxyPort = repository.getProperty(TaskRepository.PROXY_PORT);
- if (oldProxyHostname == null) {
- oldProxyHostname = ""; //$NON-NLS-1$
- }
- if (oldProxyPort == null) {
- oldProxyPort = ""; //$NON-NLS-1$
- }
-
- AuthenticationCredentials oldProxyCredentials = repository.getCredentials(AuthenticationType.PROXY);
- if (oldProxyCredentials != null) {
- oldProxyUsername = oldProxyCredentials.getUserName();
- oldProxyPassword = oldProxyCredentials.getPassword();
- } else {
- oldProxyUsername = null;
- oldProxyPassword = null;
- }
-
- } else {
- oldUsername = ""; //$NON-NLS-1$
- oldPassword = ""; //$NON-NLS-1$
- oldHttpAuthPassword = null;
- oldHttpAuthUserId = null;
- }
- }
-
- private void createProxySection() {
- ExpandableComposite section = createSection(compositeContainer,
- Messages.AbstractRepositorySettingsPage_Proxy_Server_Configuration);
-
- proxyAuthComp = toolkit.createComposite(section, SWT.NONE);
- GridLayout gridLayout2 = new GridLayout();
- gridLayout2.verticalSpacing = 0;
- gridLayout2.numColumns = 3;
- proxyAuthComp.setLayout(gridLayout2);
- proxyAuthComp.setBackground(compositeContainer.getBackground());
- section.setClient(proxyAuthComp);
-
- Composite systemSettingsComposite = new Composite(proxyAuthComp, SWT.NULL);
- GridLayout gridLayout3 = new GridLayout();
- gridLayout3.verticalSpacing = 0;
- gridLayout3.numColumns = 2;
- gridLayout3.marginWidth = 0;
- systemSettingsComposite.setLayout(gridLayout3);
-
- systemProxyButton = new Button(systemSettingsComposite, SWT.CHECK);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).span(3, SWT.DEFAULT).applyTo(systemSettingsComposite);
-
- systemProxyButton.setText(Messages.AbstractRepositorySettingsPage_Use_global_Network_Connections_preferences);
-
- systemProxyButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- setUseDefaultProxy(systemProxyButton.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- });
-
- Hyperlink changeProxySettingsLink = toolkit.createHyperlink(systemSettingsComposite,
- Messages.AbstractRepositorySettingsPage_Change_Settings, SWT.NULL);
- changeProxySettingsLink.setBackground(compositeContainer.getBackground());
- changeProxySettingsLink.addHyperlinkListener(new IHyperlinkListener() {
-
- public void linkActivated(HyperlinkEvent e) {
- PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), PREFS_PAGE_ID_NET_PROXY,
- new String[] { PREFS_PAGE_ID_NET_PROXY }, null);
- dlg.open();
- }
-
- public void linkEntered(HyperlinkEvent e) {
- // ignore
- }
-
- public void linkExited(HyperlinkEvent e) {
- // ignore
- }
- });
-
- proxyHostnameEditor = new StringFieldEditor(
- "", Messages.AbstractRepositorySettingsPage_Proxy_host_address_, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
- proxyAuthComp) {
-
- @Override
- protected boolean doCheckState() {
- return true;
- }
-
- @Override
- protected void valueChanged() {
- super.valueChanged();
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- return 3;
- }
- };
- proxyHostnameEditor.setStringValue(oldProxyHostname);
-
- proxyPortEditor = new RepositoryStringFieldEditor(
- "", Messages.AbstractRepositorySettingsPage_Proxy_host_port_, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
- proxyAuthComp) {
-
- @Override
- public int getNumberOfControls() {
- return 3;
- }
- };
-
- proxyPortEditor.setStringValue(oldProxyPort);
-
- proxyHostnameEditor.setEnabled(systemProxyButton.getSelection(), proxyAuthComp);
- proxyPortEditor.setEnabled(systemProxyButton.getSelection(), proxyAuthComp);
-
- // ************* PROXY AUTHENTICATION **************
-
- proxyAuthButton = new Button(proxyAuthComp, SWT.CHECK);
- GridDataFactory.fillDefaults().span(3, SWT.DEFAULT).applyTo(proxyAuthButton);
- proxyAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_proxy_authentication);
- proxyAuthButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- setProxyAuth(proxyAuthButton.getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- });
-
- proxyUserNameEditor = new StringFieldEditor(
- "", Messages.AbstractRepositorySettingsPage_User_ID_, StringFieldEditor.UNLIMITED, proxyAuthComp) { //$NON-NLS-1$
-
- @Override
- protected boolean doCheckState() {
- return true;
- }
-
- @Override
- protected void valueChanged() {
- super.valueChanged();
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- return 3;
- }
- };
-
- proxyPasswordEditor = new RepositoryStringFieldEditor(
- "", Messages.AbstractRepositorySettingsPage_Password_, StringFieldEditor.UNLIMITED, //$NON-NLS-1$
- proxyAuthComp) {
- @Override
- public int getNumberOfControls() {
- return 2;
- }
- };
- ((RepositoryStringFieldEditor) proxyPasswordEditor).getTextControl().setEchoChar('*');
-
- // proxyPasswordEditor.setEnabled(httpAuthButton.getSelection(),
- // advancedComp);
- // ((StringFieldEditor)
- // httpAuthPasswordEditor).setEnabled(httpAuthButton.getSelection(),
- // advancedComp);
-
- // need to increase column number here, because above string editor will use them if declared beforehand
- ((GridLayout) (proxyAuthComp.getLayout())).numColumns++;
- saveProxyPasswordButton = new Button(proxyAuthComp, SWT.CHECK);
- saveProxyPasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);
- saveProxyPasswordButton.setEnabled(proxyAuthButton.getSelection());
-
- if (repository != null) {
- saveProxyPasswordButton.setSelection(repository.getSavePassword(AuthenticationType.PROXY));
- } else {
- saveProxyPasswordButton.setSelection(false);
- }
-
- setProxyAuth(oldProxyUsername != null || oldProxyPassword != null);
-
- setUseDefaultProxy(repository != null ? repository.isDefaultProxyEnabled() : true);
- section.setExpanded(!systemProxyButton.getSelection());
- }
-
-// private void addContributionSection() {
-// Composite composite = toolkit.createComposite(compositeContainer);
-// GridDataFactory.fillDefaults().grab(true, false).span(3, SWT.DEFAULT).applyTo(composite);
-//
-// GridLayout layout = new GridLayout(1, false);
-// layout.marginWidth = 0;
-// layout.marginTop = -5;
-// composite.setLayout(layout);
-//
-// composite.setBackground(compositeContainer.getBackground());
-//
-// createContributionControls(composite);
-// }
-
- protected void setEncoding(String encoding) {
- if (encoding.equals(TaskRepository.DEFAULT_CHARACTER_ENCODING)) {
- setDefaultEncoding();
- } else {
- if (otherEncodingCombo.indexOf(encoding) != -1) {
- defaultEncoding.setSelection(false);
- otherEncodingCombo.setEnabled(true);
- otherEncoding.setSelection(true);
- otherEncodingCombo.select(otherEncodingCombo.indexOf(encoding));
- } else {
- setDefaultEncoding();
- }
- }
- }
-
- private void setDefaultEncoding() {
- defaultEncoding.setSelection(true);
- otherEncoding.setSelection(false);
- otherEncodingCombo.setEnabled(false);
- if (otherEncodingCombo.getItemCount() > 0) {
- otherEncodingCombo.select(0);
- }
- }
-
- /**
- * @since 2.0
- */
- public void setAnonymous(boolean selected) {
- if (!needsAnonymousLogin) {
- return;
- }
-
- anonymousButton.setSelection(selected);
-
- if (selected) {
- oldUsername = repositoryUserNameEditor.getStringValue();
- oldPassword = (repositoryPasswordEditor).getStringValue();
- repositoryUserNameEditor.setStringValue(""); //$NON-NLS-1$
- repositoryPasswordEditor.setStringValue(""); //$NON-NLS-1$
- } else {
- repositoryUserNameEditor.setStringValue(oldUsername);
- repositoryPasswordEditor.setStringValue(oldPassword);
- }
-
- repositoryUserNameEditor.setEnabled(!selected, compositeContainer);
- repositoryPasswordEditor.setEnabled(!selected, compositeContainer);
- savePasswordButton.setEnabled(!selected);
- if (getWizard() != null) {
- getWizard().getContainer().updateButtons();
- }
- }
-
- /**
- * @since 2.0
- */
- public void setHttpAuth(boolean selected) {
- if (!needsHttpAuth) {
- return;
- }
- httpAuthButton.setSelection(selected);
- if (!selected) {
- oldHttpAuthUserId = httpAuthUserNameEditor.getStringValue();
- oldHttpAuthPassword = httpAuthPasswordEditor.getStringValue();
- httpAuthUserNameEditor.setStringValue(null);
- httpAuthPasswordEditor.setStringValue(null);
- } else {
- httpAuthUserNameEditor.setStringValue(oldHttpAuthUserId);
- httpAuthPasswordEditor.setStringValue(oldHttpAuthPassword);
- }
- httpAuthUserNameEditor.setEnabled(selected, httpAuthComp);
- httpAuthPasswordEditor.setEnabled(selected, httpAuthComp);
- saveHttpPasswordButton.setEnabled(selected);
- }
-
- /**
- * @since 2.2
- */
- public boolean getHttpAuth() {
- return httpAuthButton.getSelection();
- }
-
- /**
- * @since 2.0
- */
- public void setUseDefaultProxy(boolean selected) {
- if (!needsProxy) {
- return;
- }
-
- systemProxyButton.setSelection(selected);
-
- if (selected) {
- oldProxyHostname = proxyHostnameEditor.getStringValue();
- oldProxyPort = proxyPortEditor.getStringValue();
- // proxyHostnameEditor.setStringValue(null);
- // proxyPortEditor.setStringValue(null);
- } else {
- proxyHostnameEditor.setStringValue(oldProxyHostname);
- proxyPortEditor.setStringValue(oldProxyPort);
- }
- proxyHostnameEditor.setEnabled(!selected, proxyAuthComp);
- proxyPortEditor.setEnabled(!selected, proxyAuthComp);
- proxyAuthButton.setEnabled(!selected);
- setProxyAuth(proxyAuthButton.getSelection());
- }
-
- /**
- * @since 2.0
- */
- public void setProxyAuth(boolean selected) {
- proxyAuthButton.setSelection(selected);
- proxyAuthButton.setEnabled(!systemProxyButton.getSelection());
- if (!selected) {
- oldProxyUsername = proxyUserNameEditor.getStringValue();
- oldProxyPassword = proxyPasswordEditor.getStringValue();
- proxyUserNameEditor.setStringValue(null);
- proxyPasswordEditor.setStringValue(null);
- } else {
- proxyUserNameEditor.setStringValue(oldProxyUsername);
- proxyPasswordEditor.setStringValue(oldProxyPassword);
- }
-
- proxyUserNameEditor.setEnabled(selected && !systemProxyButton.getSelection(), proxyAuthComp);
- proxyPasswordEditor.setEnabled(selected && !systemProxyButton.getSelection(), proxyAuthComp);
- saveProxyPasswordButton.setEnabled(selected && !systemProxyButton.getSelection());
- }
-
- /**
- * @since 2.2
- */
- public boolean getProxyAuth() {
- return proxyAuthButton.getSelection();
- }
-
- /**
- * @since 3.0
- */
- protected void addRepositoryTemplatesToServerUrlCombo() {
- final RepositoryTemplateManager templateManager = TasksUiPlugin.getRepositoryTemplateManager();
- for (RepositoryTemplate template : templateManager.getTemplates(connector.getConnectorKind())) {
- serverUrlCombo.add(template.label);
- }
- serverUrlCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String text = serverUrlCombo.getText();
- RepositoryTemplate template = templateManager.getTemplate(connector.getConnectorKind(), text);
- if (template != null) {
- repositoryTemplateSelected(template);
- return;
- }
- }
-
- });
- }
-
- /**
- * @since 3.0
- */
- protected void repositoryTemplateSelected(RepositoryTemplate template) {
- }
-
- /**
- * @since 2.0
- */
- protected abstract void createAdditionalControls(Composite parent);
-
- /**
- * @since 2.0
- */
- protected abstract boolean isValidUrl(String url);
-
- private void updateHyperlinks() {
- if (getRepositoryUrl() != null && getRepositoryUrl().length() > 0) {
- TaskRepository repository = new TaskRepository(connector.getConnectorKind(), getRepositoryUrl());
-
- String accountCreationUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
- .getAccountCreationUrl(repository);
- createAccountHyperlink.setEnabled(accountCreationUrl != null);
- createAccountHyperlink.setVisible(accountCreationUrl != null);
-
- String accountManagementUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
- .getAccountManagementUrl(repository);
- manageAccountHyperlink.setEnabled(accountManagementUrl != null);
- manageAccountHyperlink.setVisible(accountManagementUrl != null);
- } else {
- createAccountHyperlink.setEnabled(false);
- createAccountHyperlink.setVisible(false);
- manageAccountHyperlink.setEnabled(false);
- manageAccountHyperlink.setVisible(false);
- }
- }
-
- /**
- * @since 2.0
- */
- public String getRepositoryLabel() {
- return repositoryLabelEditor.getStringValue();
- }
-
- /**
- * @since 3.0
- */
- public String getRepositoryUrl() {
- return TaskRepositoryManager.stripSlashes(serverUrlCombo.getText());
- }
-
- /**
- * @since 2.0
- */
- public String getUserName() {
- return repositoryUserNameEditor.getStringValue();
- }
-
- /**
- * @since 2.0
- */
- public String getPassword() {
- return repositoryPasswordEditor.getStringValue();
- }
-
- /**
- * @since 2.0
- */
- public String getHttpAuthUserId() {
- if (needsHttpAuth()) {
- return httpAuthUserNameEditor.getStringValue();
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @since 2.0
- */
- public String getHttpAuthPassword() {
- if (needsHttpAuth()) {
- return httpAuthPasswordEditor.getStringValue();
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @since 2.0
- */
- public String getProxyHostname() {
- if (needsProxy()) {
- return proxyHostnameEditor.getStringValue();
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @since 2.0
- */
- public String getProxyPort() {
- if (needsProxy()) {
- return proxyPortEditor.getStringValue();
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @since 2.0
- */
- public Boolean getUseDefaultProxy() {
- if (needsProxy()) {
- return systemProxyButton.getSelection();
- } else {
- return true;
- }
- }
-
- /**
- * @since 2.0
- */
- public String getProxyUserName() {
- if (needsProxy()) {
- return proxyUserNameEditor.getStringValue();
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @since 2.0
- */
- public String getProxyPassword() {
- if (needsProxy()) {
- return proxyPasswordEditor.getStringValue();
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * @since 2.0
- */
- public void init(IWorkbench workbench) {
- // ignore
- }
-
- /**
- * @since 2.0
- */
- public boolean isAnonymousAccess() {
- if (anonymousButton != null) {
- return anonymousButton.getSelection();
- } else {
- return false;
- }
- }
-
- /**
- * Exposes StringFieldEditor.refreshValidState()
- *
- * TODO: is there a better way?
- */
- private static class RepositoryStringFieldEditor extends StringFieldEditor {
- public RepositoryStringFieldEditor(String name, String labelText, int style, Composite parent) {
- super(name, labelText, style, parent);
- }
-
- @Override
- public void refreshValidState() {
- try {
- super.refreshValidState();
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Problem refreshing password field", e)); //$NON-NLS-1$
- }
- }
-
- @Override
- public Text getTextControl() {
- return super.getTextControl();
- }
-
- }
-
- @Override
- public boolean isPageComplete() {
- String errorMessage = null;
- String url = getRepositoryUrl();
- errorMessage = isUniqueUrl(url);
- if (errorMessage == null && !isValidUrl(url)) {
- errorMessage = Messages.AbstractRepositorySettingsPage_Enter_a_valid_server_url;
- }
- if (errorMessage == null) {
- errorMessage = credentialsComplete();
- }
-
- setErrorMessage(errorMessage);
- return errorMessage == null && super.isPageComplete();
- }
-
- private String credentialsComplete() {
- if ((!needsAnonymousLogin() || !anonymousButton.getSelection()) && isMissingCredentials()) {
- return Messages.AbstractRepositorySettingsPage_Repository_user_name_and_password_must_not_be_blank;
- }
- return null;
- }
-
- private boolean isMissingCredentials() {
- return repositoryUserNameEditor.getStringValue().trim().equals("") //$NON-NLS-1$
- || repositoryPasswordEditor.getStringValue().trim().equals(""); //$NON-NLS-1$
- }
-
- /**
- * @since 2.0
- */
- protected String isUniqueUrl(String urlString) {
- if (!urlString.equals(originalUrl)) {
- if (repositoryUrls == null) {
- List<TaskRepository> repositories = TasksUi.getRepositoryManager().getAllRepositories();
- repositoryUrls = new HashSet<String>(repositories.size());
- for (TaskRepository repository : repositories) {
- repositoryUrls.add(repository.getRepositoryUrl());
- }
- }
-
- if (repositoryUrls.contains(urlString)) {
- return Messages.AbstractRepositorySettingsPage_Repository_already_exists;
- }
- }
- return null;
- }
-
- /**
- * @since 2.0
- */
- @Deprecated
- public void setRepository(TaskRepository repository) {
- this.repository = repository;
- }
-
- /**
- * @since 2.0
- */
- public void setVersion(String previousVersion) {
- if (previousVersion == null) {
- serverVersion = TaskRepository.NO_VERSION_SPECIFIED;
- } else {
- serverVersion = previousVersion;
- }
- }
-
- /**
- * @since 2.0
- */
- public String getVersion() {
- return serverVersion;
- }
-
- /**
- * @since 2.0
- */
- public TaskRepository getRepository() {
- return repository;
- }
-
- /**
- * @since 2.0
- */
- public String getCharacterEncoding() {
- if (defaultEncoding == null) {
- return null;
- }
-
- if (defaultEncoding.getSelection()) {
- return TaskRepository.DEFAULT_CHARACTER_ENCODING;
- } else {
- if (otherEncodingCombo.getSelectionIndex() > -1) {
- return otherEncodingCombo.getItem(otherEncodingCombo.getSelectionIndex());
- } else {
- return TaskRepository.DEFAULT_CHARACTER_ENCODING;
- }
- }
- }
-
- /**
- * @since 2.0
- */
- public TaskRepository createTaskRepository() {
- TaskRepository repository = new TaskRepository(connector.getConnectorKind(), getRepositoryUrl());
- applyTo(repository);
- return repository;
- }
-
- /**
- * @since 2.2
- */
- @Override
- public void applyTo(TaskRepository repository) {
- repository.setVersion(getVersion());
- if (needsEncoding()) {
- repository.setCharacterEncoding(getCharacterEncoding());
- }
-
- if (isAnonymousAccess()) {
- repository.setCredentials(AuthenticationType.REPOSITORY, null, getSavePassword());
- } else {
- AuthenticationCredentials credentials = new AuthenticationCredentials(getUserName(), getPassword());
- repository.setCredentials(AuthenticationType.REPOSITORY, credentials, getSavePassword());
- }
- repository.setRepositoryLabel(getRepositoryLabel());
-
- if (needsHttpAuth()) {
- if (getHttpAuth()) {
- AuthenticationCredentials webCredentials = new AuthenticationCredentials(getHttpAuthUserId(),
- getHttpAuthPassword());
- repository.setCredentials(AuthenticationType.HTTP, webCredentials, getSaveHttpPassword());
- } else {
- repository.setCredentials(AuthenticationType.HTTP, null, getSaveHttpPassword());
- }
- }
-
- if (needsProxy()) {
- repository.setDefaultProxyEnabled(getUseDefaultProxy());
- repository.setProperty(TaskRepository.PROXY_HOSTNAME, getProxyHostname());
- repository.setProperty(TaskRepository.PROXY_PORT, getProxyPort());
- if (getProxyAuth()) {
- AuthenticationCredentials webCredentials = new AuthenticationCredentials(getProxyUserName(),
- getProxyPassword());
- repository.setCredentials(AuthenticationType.PROXY, webCredentials, getSaveProxyPassword());
- } else {
- repository.setCredentials(AuthenticationType.PROXY, null, getSaveProxyPassword());
- }
- }
-
- if (disconnectedButton != null) {
- repository.setOffline(disconnectedButton.getSelection());
- }
-
- super.applyTo(repository);
- }
-
- /**
- * @since 2.0
- */
- public AbstractRepositoryConnector getConnector() {
- return connector;
- }
-
- /**
- * @since 2.0
- */
- public boolean needsEncoding() {
- return needsEncoding;
- }
-
- /**
- * @since 2.0
- */
- public boolean needsTimeZone() {
- return needsTimeZone;
- }
-
- /**
- * @since 2.0
- */
- public boolean needsAnonymousLogin() {
- return needsAnonymousLogin;
- }
-
- /**
- * @since 2.0
- */
- public boolean needsAdvanced() {
- return needsAdvanced;
- }
-
- /**
- * @since 2.0
- */
- public void setNeedsEncoding(boolean needsEncoding) {
- this.needsEncoding = needsEncoding;
- }
-
- /**
- * @since 2.0
- */
- public void setNeedsTimeZone(boolean needsTimeZone) {
- this.needsTimeZone = needsTimeZone;
- }
-
- /**
- * @since 2.0
- */
- public void setNeedsAdvanced(boolean needsAdvanced) {
- this.needsAdvanced = needsAdvanced;
- }
-
- /**
- * @since 2.0
- */
- public boolean needsHttpAuth() {
- return this.needsHttpAuth;
- }
-
- /**
- * @since 2.0
- */
- public void setNeedsHttpAuth(boolean needsHttpAuth) {
- this.needsHttpAuth = needsHttpAuth;
- }
-
- /**
- * @since 2.0
- */
- public void setNeedsProxy(boolean needsProxy) {
- this.needsProxy = needsProxy;
- }
-
- /**
- * @since 2.0
- */
- public boolean needsProxy() {
- return this.needsProxy;
- }
-
- /**
- * @since 2.0
- */
- public void setNeedsAnonymousLogin(boolean needsAnonymousLogin) {
- this.needsAnonymousLogin = needsAnonymousLogin;
- }
-
- public void setNeedsValidation(boolean needsValidation) {
- this.needsValidation = needsValidation;
- }
-
- /**
- * @since 2.0
- */
- public boolean needsValidation() {
- return needsValidation;
- }
-
- /**
- * Public for testing.
- *
- * @since 2.0
- */
- public void setUrl(String url) {
- serverUrlCombo.setText(url);
- }
-
- /**
- * Public for testing.
- *
- * @since 2.0
- */
- public void setUserId(String id) {
- repositoryUserNameEditor.setStringValue(id);
- }
-
- /**
- * Public for testing.
- *
- * @since 2.0
- */
- public void setPassword(String pass) {
- repositoryPasswordEditor.setStringValue(pass);
- }
-
- /**
- * @since 2.2
- */
- public Boolean getSavePassword() {
- return savePasswordButton.getSelection();
- }
-
- /**
- * @since 2.2
- */
- public Boolean getSaveProxyPassword() {
- if (needsProxy()) {
- return saveProxyPasswordButton.getSelection();
- } else {
- return false;
- }
- }
-
- /**
- * @since 2.2
- */
- public Boolean getSaveHttpPassword() {
- if (needsHttpAuth()) {
- return saveHttpPasswordButton.getSelection();
- } else {
- return false;
- }
- }
-
- /**
- * Validate settings provided by the {@link #getValidator(TaskRepository) validator}, typically the server settings.
- *
- * @since 2.0
- */
- protected void validateSettings() {
- final Validator validator = getValidator(createTaskRepository());
- if (validator == null) {
- return;
- }
-
- try {
- getWizard().getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(Messages.AbstractRepositorySettingsPage_Validating_server_settings,
- IProgressMonitor.UNKNOWN);
- try {
- validator.run(monitor);
- if (validator.getStatus() == null) {
- validator.setStatus(Status.OK_STATUS);
- }
- } catch (CoreException e) {
- validator.setStatus(e.getStatus());
- } catch (OperationCanceledException e) {
- validator.setStatus(Status.CANCEL_STATUS);
- throw new InterruptedException();
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.AbstractRepositorySettingsPage_Internal_error_validating_repository, e.getCause()));
- return;
- } catch (InterruptedException e) {
- // canceled
- return;
- }
-
- applyValidatorResult(validator);
- getWizard().getContainer().updateButtons();
- }
-
- /**
- * @since 3.1
- */
- @Override
- protected IStatus validate() {
- return null;
- }
-
- /**
- * @since 2.0
- */
- protected void applyValidatorResult(Validator validator) {
- IStatus status = validator.getStatus();
- String message = status.getMessage();
- if (message == null || message.length() == 0) {
- message = null;
- }
- switch (status.getSeverity()) {
- case IStatus.OK:
- if (status == Status.OK_STATUS) {
- if (getUserName().length() > 0) {
- message = Messages.AbstractRepositorySettingsPage_Authentication_credentials_are_valid;
- } else {
- message = Messages.AbstractRepositorySettingsPage_Repository_is_valid;
- }
- }
- setMessage(message, IMessageProvider.INFORMATION);
- break;
- case IStatus.INFO:
- setMessage(message, IMessageProvider.INFORMATION);
- break;
- case IStatus.WARNING:
- setMessage(message, IMessageProvider.WARNING);
- break;
- default:
- setMessage(message, IMessageProvider.ERROR);
- break;
- }
- setErrorMessage(null);
- }
-
- /**
- * @since 2.0
- */
- protected abstract Validator getValidator(TaskRepository repository);
-
- /**
- * Public for testing.
- *
- * @since 2.0
- */
- public abstract class Validator {
-
- private IStatus status;
-
- public abstract void run(IProgressMonitor monitor) throws CoreException;
-
- public IStatus getStatus() {
- return status;
- }
-
- public void setStatus(IStatus status) {
- this.status = status;
- }
-
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPage.java
deleted file mode 100644
index 650384f63..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPage.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- * Tasktop Technologies - improvements
- * Helen Bershadskaya - improvements for bug 242445
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * An abstract base class for repository settings page that supports the <code>taskRepositoryPageContribution</code>
- * extension point.
- *
- * {@link ITaskRepositoryPage} implementations are encouraged to extend {@link AbstractRepositorySettingsPage} if
- * possible as it provides a standard UI for managing server settings.
- *
- * @see AbstractRepositorySettingsPage
- * @author David Green
- * @author Steffen Pingel
- * @since 3.1
- */
-public abstract class AbstractTaskRepositoryPage extends WizardPage implements ITaskRepositoryPage {
-
- private static final String CLASS = "class"; //$NON-NLS-1$
-
- private static final String ID = "id"; //$NON-NLS-1$
-
- private static final String KIND = "connectorKind"; //$NON-NLS-1$
-
- private static final String TASK_REPOSITORY_PAGE_CONTRIBUTION = "taskRepositoryPageContribution"; //$NON-NLS-1$
-
- private static final String TASK_REPOSITORY_PAGE_CONTRIBUTION_EXTENSION = "org.eclipse.mylyn.tasks.ui.taskRepositoryPageContribution"; //$NON-NLS-1$
-
- private static final Comparator<AbstractTaskRepositoryPageContribution> CONTRIBUTION_COMPARATOR = new ContributionComparator();
-
- private final TaskRepository repository;
-
- private final List<AbstractTaskRepositoryPageContribution> contributions;
-
- FormToolkit toolkit;
-
- private final AbstractTaskRepositoryPageContribution.Listener contributionListener = new AbstractTaskRepositoryPageContribution.Listener() {
- public void validationRequired(AbstractTaskRepositoryPageContribution contribution) {
- validatePageSettings();
- }
- };
-
- /**
- * @since 3.1
- */
- public AbstractTaskRepositoryPage(String title, String description, TaskRepository repository) {
- super(title);
- if (repository != null && !repository.getConnectorKind().equals(getConnectorKind())) {
- throw new IllegalArgumentException(
- "connectorKind of repository does not match connectorKind of page, expected '" + getConnectorKind() + "', got '" + repository.getConnectorKind() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- this.repository = repository;
- this.contributions = new ArrayList<AbstractTaskRepositoryPageContribution>();
- setTitle(title);
- setDescription(description);
- }
-
- /**
- * Get the kind of connector supported by this page.
- *
- * @return the kind of connector, never null
- * @since 3.1
- */
- public abstract String getConnectorKind();
-
- @Override
- public void dispose() {
- if (toolkit != null) {
- toolkit.dispose();
- toolkit = null;
- }
- super.dispose();
- }
-
- /**
- * Creates the contents of the page. Subclasses may override this method to change where the contributions are
- * added.
- *
- * @since 2.0
- */
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
-
- Composite compositeContainer = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(3, false);
- compositeContainer.setLayout(layout);
-
-// Composite compositeContainer = new Composite(parent, SWT.NULL);
-// Layout layout = new FillLayout();
-// compositeContainer.setLayout(layout);
-
- createSettingControls(compositeContainer);
- createContributionControls(compositeContainer);
-
- setControl(compositeContainer);
- //getControl().getShell().pack();
- }
-
- /**
- * Creates the controls of this page.
- *
- * @since 3.1
- */
- protected abstract void createSettingControls(Composite parent);
-
- @Override
- public boolean isPageComplete() {
- return super.isPageComplete() && conributionsIsPageComplete();
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return super.canFlipToNextPage() && contributionsCanFlipToNextPage();
- }
-
- private boolean contributionsCanFlipToNextPage() {
- for (AbstractTaskRepositoryPageContribution contribution : contributions) {
- if (!contribution.canFlipToNextPage()) {
- return false;
- }
- }
- return true;
- }
-
- private boolean conributionsIsPageComplete() {
- for (AbstractTaskRepositoryPageContribution contribution : contributions) {
- if (!contribution.isPageComplete()) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Subclasses should only call this method if they override {@link #createContents(Composite)}.
- *
- * @param parentControl
- * the container into which the contributions will create their UI
- * @since 3.1
- */
- protected void createContributionControls(final Composite parentControl) {
- contributions.clear();
- contributions.addAll(findApplicableContributors());
-
- if (!contributions.isEmpty()) {
- final List<AbstractTaskRepositoryPageContribution> badContributions = new ArrayList<AbstractTaskRepositoryPageContribution>();
- for (final AbstractTaskRepositoryPageContribution contribution : contributions) {
- SafeRunnable.run(new SafeRunnable() {
- public void run() throws Exception {
- contribution.init(getConnectorKind(), repository);
- contribution.addListener(contributionListener);
- }
-
- @Override
- public void handleException(Throwable e) {
- badContributions.add(contribution);
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Problems occured when initializing contribution \"{0}\"", contribution.getId()), e)); //$NON-NLS-1$
- }
- });
- }
- contributions.removeAll(badContributions);
-
- Collections.sort(contributions, CONTRIBUTION_COMPARATOR);
-
- for (final AbstractTaskRepositoryPageContribution contribution : contributions) {
- final ExpandableComposite section = createSection(parentControl, contribution.getTitle());
- section.setToolTipText(contribution.getDescription());
-
- SafeRunnable.run(new SafeRunnable() {
- public void run() throws Exception {
- Control control = contribution.createControl(section);
- section.setClient(control);
- }
-
- @Override
- public void handleException(Throwable e) {
- section.dispose();
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Problems occured when creating control for contribution \"{0}\"", //$NON-NLS-1$
- contribution.getId()), e));
- }
- });
- }
- }
- }
-
- /**
- * @since 3.1
- */
- protected ExpandableComposite createSection(final Composite parentControl, String title) {
- final ExpandableComposite section = toolkit.createExpandableComposite(parentControl,
- ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
- section.clientVerticalSpacing = 0;
- section.setBackground(parentControl.getBackground());
- section.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
- section.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent e) {
- parentControl.layout(true);
- getControl().getShell().pack();
- }
- });
- section.setText(title);
- GridDataFactory.fillDefaults().indent(0, 5).grab(true, false).span(3, SWT.DEFAULT).applyTo(section);
- return section;
- }
-
- /**
- * Validate the settings of this page, not including contributions. This method should not be called directly by
- * page implementations. Always run on a UI thread.
- *
- * @return the status, or null if there are no messages.
- * @see #validatePageSettings()
- * @since 3.1
- */
- protected abstract IStatus validate();
-
- /**
- * Overriding methods should call <code>super.applyTo(repository)</code>
- *
- * @since 3.1
- */
- public void applyTo(TaskRepository repository) {
- applyContributionSettingsTo(repository);
- }
-
- private void applyContributionSettingsTo(TaskRepository repository) {
- for (AbstractTaskRepositoryPageContribution contribution : contributions) {
- contribution.applyTo(repository);
- }
- }
-
- /**
- * Returns a status if there is a message to display, otherwise null.
- */
- private IStatus computeValidation() {
- final MultiStatus cumulativeResult = new MultiStatus(TasksUiPlugin.ID_PLUGIN, IStatus.OK,
- Messages.AbstractTaskRepositoryPage_Validation_failed, null);
-
- // validate the page
- IStatus result = validate();
- if (result != null) {
- cumulativeResult.add(result);
- }
-
- // validate contributions
- for (final AbstractTaskRepositoryPageContribution contribution : contributions) {
- SafeRunnable.run(new SafeRunnable() {
- public void run() throws Exception {
- IStatus result = contribution.validate();
- if (result != null) {
- cumulativeResult.add(result);
- }
- }
-
- @Override
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "Problems occured when validating contribution \"{0}\"", contribution.getId()), e)); //$NON-NLS-1$
- }
- });
- }
-
- return cumulativeResult;
- }
-
- /**
- * Validate all settings in the page including contributions. This method should be called whenever a setting is
- * changed on the page.
- *
- * The results of validation are applied and the buttons of the page are updated.
- *
- * @see #validate(IProgressMonitor)
- * @see #applyValidationResult(IStatus[])
- */
- private void validatePageSettings() {
- IStatus validationStatus = computeValidation();
- applyValidationResult(validationStatus);
- getWizard().getContainer().updateButtons();
- }
-
- /**
- * Apply the results of validation to the page. The implementation finds the most {@link IStatus#getSeverity()
- * severe} status and {@link #setMessage(String, int) applies the message} to the page.
- *
- * @param status
- * the status of the validation, or null
- */
- private void applyValidationResult(IStatus status) {
- if (status == null || status.isOK()) {
- setMessage(null, IMessageProvider.INFORMATION);
- setErrorMessage(null);
- } else {
- // find the most severe status
- int messageType;
- switch (status.getSeverity()) {
- case IStatus.OK:
- case IStatus.INFO:
- messageType = IMessageProvider.INFORMATION;
- break;
- case IStatus.WARNING:
- messageType = IMessageProvider.WARNING;
- break;
- case IStatus.ERROR:
- default:
- messageType = IMessageProvider.ERROR;
- break;
- }
- setErrorMessage(null);
- setMessage(status.getMessage(), messageType);
- }
- }
-
- private List<AbstractTaskRepositoryPageContribution> findApplicableContributors() {
- List<AbstractTaskRepositoryPageContribution> contributors = new ArrayList<AbstractTaskRepositoryPageContribution>();
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- IExtensionPoint editorExtensionPoint = registry.getExtensionPoint(TASK_REPOSITORY_PAGE_CONTRIBUTION_EXTENSION);
- IExtension[] editorExtensions = editorExtensionPoint.getExtensions();
- for (IExtension extension : editorExtensions) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (IConfigurationElement element : elements) {
- if (element.getName().equals(TASK_REPOSITORY_PAGE_CONTRIBUTION)) {
- String kind = element.getAttribute(KIND);
- if (kind == null || kind.length() == 0 || kind.equals(getConnectorKind())) {
- String id = element.getAttribute(ID);
- try {
- if (id == null || id.length() == 0) {
- throw new IllegalStateException(TASK_REPOSITORY_PAGE_CONTRIBUTION + "/@" + ID //$NON-NLS-1$
- + " is required"); //$NON-NLS-1$
- }
- Object contributor = element.createExecutableExtension(CLASS);
- AbstractTaskRepositoryPageContribution pageContributor = (AbstractTaskRepositoryPageContribution) contributor;
- pageContributor.setId(id);
- if (pageContributor.isEnabled()) {
- contributors.add(pageContributor);
- }
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load " //$NON-NLS-1$
- + TASK_REPOSITORY_PAGE_CONTRIBUTION + " '" + id + "' from plug-in " //$NON-NLS-1$//$NON-NLS-2$
- + element.getContributor().getName(), e));
- }
- }
- }
- }
- }
-
- return contributors;
- }
-
- private static class ContributionComparator implements Comparator<AbstractTaskRepositoryPageContribution> {
-
- public int compare(AbstractTaskRepositoryPageContribution o1, AbstractTaskRepositoryPageContribution o2) {
- if (o1 == o2) {
- return 0;
- }
- String s1 = o1.getTitle();
- String s2 = o2.getTitle();
- int i = s1.compareTo(s2);
- if (i == 0) {
- i = o1.getId().compareTo(o2.getId());
- }
- return i;
- }
-
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPageContribution.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPageContribution.java
deleted file mode 100644
index a6a77430d..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPageContribution.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 David Green and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Green - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * A contribution to a {@link ITaskRepositoryPage}, which enables plug-ins to contribute UI to the task repository
- * settings.
- *
- * subclasses must have a default public constructor.
- *
- * @author David Green
- * @since 3.1
- */
-public abstract class AbstractTaskRepositoryPageContribution {
-
- /**
- * A listener interface that should be implemented by classes wishing to be notified of changes that occur within
- * the contribution.
- *
- * @since 3.1
- */
- public interface Listener {
-
- /**
- * Called when the state of the contribution changes such that validation should be performed
- *
- * @param contribution
- * the contribution that changed
- *
- * @see ITaskRepositoryPageContribution#validate(IProgressMonitor)
- */
- public void validationRequired(AbstractTaskRepositoryPageContribution contribution);
-
- }
-
- private final List<Listener> listeners = new CopyOnWriteArrayList<Listener>();
-
- private final String title;
-
- private final String description;
-
- private TaskRepository repository;
-
- private String connectorKind;
-
- private String id;
-
- /**
- *
- * @param title
- * the title of the contribution, as displayed to the user, usually used as a section heading
- * @param description
- * the description of the contribution, as displayed to the user, typically as a tool-tip
- * @since 3.1
- */
- protected AbstractTaskRepositoryPageContribution(String title, String description) {
- this.title = title;
- this.description = description;
- this.id = ""; //$NON-NLS-1$
- }
-
- /**
- * Initialize the contribution
- *
- * @param connectorKind
- * the kind of connector for which this is a contribution
- * @param repository
- * the repository for which this contribution was created, or null if the repository is not yet available
- * @since 3.1
- */
- public void init(String connectorKind, TaskRepository repository) {
- this.connectorKind = connectorKind;
- this.repository = repository;
- }
-
- /**
- * Add a listener to this contribution. The contribution must notify the listener at the appropriate times, for
- * example when a setting has changed in the UI.
- *
- * @see #removeListener(Listener)
- * @since 3.1
- */
- public void addListener(Listener listener) {
- listeners.add(listener);
- }
-
- /**
- * Remove a listener from this contribution.
- *
- * @see #addListener(Listener)
- * @since 3.1
- */
- public void removeListener(Listener listener) {
- listeners.remove(listener);
- }
-
- /**
- * @see IDialogPage#createControl(Composite)
- * @since 3.1
- */
- public abstract Control createControl(Composite parent);
-
- /**
- * @see IDialogPage#getTitle()
- * @since 3.1
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * @see IDialogPage#getDescription()
- * @since 3.1
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see IWizardPage#isPageComplete()
- * @since 3.1
- */
- public abstract boolean isPageComplete();
-
- /**
- * @see IWizardPage#canFlipToNextPage()
- * @since 3.1
- */
- public abstract boolean canFlipToNextPage();
-
- /**
- * Validate the settings of the contribution. Contributions should expect this method to be called often and should
- * thus return quickly. Always called on the UI thread.
- *
- * @return the status (errors) on the contribution, or null if there are none. A MultiStatus should be used to
- * return multiple error messages or warnings.
- * @since 3.1
- */
- public abstract IStatus validate();
-
- /**
- * Apply the settings in the contribution to the given repository.
- *
- * @param repository
- * the repository to which settings should be applied
- *
- * @see ITaskRepositoryPage#applyTo(TaskRepository)
- * @since 3.1
- */
- public abstract void applyTo(TaskRepository repository);
-
- /**
- * Requests a validation.
- *
- * @see #validate()
- * @since 3.1
- */
- protected void fireValidationRequired() {
- for (Listener l : listeners) {
- l.validationRequired(this);
- }
- }
-
- /**
- * Returns the repository for which this contribution was created, or null if it was created for a new repository.
- *
- * @since 3.1
- */
- protected final TaskRepository getRepository() {
- return repository;
- }
-
- /**
- * Returns the kind of connector for which this contribution was created.
- *
- * @since 3.1
- */
- protected final String getConnectorKind() {
- return connectorKind;
- }
-
- void setId(String id) {
- Assert.isNotNull(id);
- this.id = id;
- }
-
- /**
- * Returns the id as it is declared in the contribution extension point.
- */
- public final String getId() {
- return id;
- }
-
- /**
- * Indicate if this contribution is enabled. Subclasses may override to programatically disable the contribution
- * when needed. This method is called early in the contributor's lifecycle, before any controls are created.
- *
- * the default implementation returns true.
- */
- public boolean isEnabled() {
- return true;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskRepositoryPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskRepositoryPage.java
deleted file mode 100644
index 252c47a8f..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskRepositoryPage.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface ITaskRepositoryPage extends IWizardPage {
-
- public abstract void applyTo(TaskRepository repository);
-
- public abstract String getRepositoryUrl();
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPage.java
deleted file mode 100644
index c114f8efe..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPage.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-
-/**
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface ITaskSearchPage extends IDialogPage {
-
- public abstract void setContainer(ITaskSearchPageContainer container);
-
- public abstract boolean performSearch();
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPageContainer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPageContainer.java
deleted file mode 100644
index dd6c4e961..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/ITaskSearchPageContainer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import org.eclipse.jface.operation.IRunnableContext;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface ITaskSearchPageContainer {
-
- public abstract IRunnableContext getRunnableContext();
-
- public abstract void setPerformActionEnabled(boolean enabled);
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java
deleted file mode 100644
index 614c7b1ca..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Extend for customizing how new tasks editors are created.
- *
- * @author Steffen Pingel
- * @since 2.0
- */
-public class NewTaskWizard extends Wizard implements INewWizard {
-
- private final TaskRepository taskRepository;
-
- private ITaskMapping taskSelection;
-
- /**
- * @since 3.0
- */
- public NewTaskWizard(TaskRepository taskRepository, ITaskMapping taskSelection) {
- Assert.isNotNull(taskRepository);
- this.taskRepository = taskRepository;
- this.taskSelection = taskSelection;
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- setNeedsProgressMonitor(true);
- }
-
- @Deprecated
- public NewTaskWizard(TaskRepository taskRepository) {
- this.taskRepository = taskRepository;
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-
- @Override
- public void addPages() {
- }
-
- /**
- * @since 3.0
- */
- protected ITaskMapping getInitializationData() {
- return null;
- }
-
- /**
- * @since 3.0
- */
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- /**
- * @since 3.0
- */
- public ITaskMapping getTaskSelection() {
- return taskSelection;
- }
-
- @Override
- public boolean performFinish() {
- final TaskData[] taskData = new TaskData[1];
- final ITaskMapping initializationData = getInitializationData();
- final ITaskMapping selectionData = getTaskSelection();
- try {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- taskData[0] = TasksUiInternal.createTaskData(taskRepository, initializationData, selectionData,
- monitor);
- } catch (OperationCanceledException e) {
- throw new InterruptedException();
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- if (getContainer().getShell().isVisible()) {
- getContainer().run(true, true, runnable);
- } else {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runnable);
- }
- } catch (InvocationTargetException e) {
- if (e.getCause() instanceof CoreException) {
- TasksUiInternal.displayStatus(Messages.NewTaskWizard_Error_creating_new_task,
- ((CoreException) e.getCause()).getStatus());
- } else {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.NewTaskWizard_Error_creating_new_task, e.getCause()));
- }
- return false;
- } catch (InterruptedException e) {
- return false;
- }
-
- try {
- TasksUiInternal.createAndOpenNewTask(taskData[0]);
- return true;
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to open new task", e)); //$NON-NLS-1$
- TasksUiInternal.displayStatus(Messages.NewTaskWizard_Create_Task, new Status(IStatus.ERROR,
- TasksUiPlugin.ID_PLUGIN, Messages.NewTaskWizard_Failed_to_create_new_task_ + e.getMessage()));
- return false;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewWebTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewWebTaskWizard.java
deleted file mode 100644
index e413e3fa5..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewWebTaskWizard.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Eugene Kuleshov and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eugene Kuleshov - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.NewWebTaskPage;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * Wizard for creating new tickets through a web browser.
- *
- * @author Eugene Kuleshov
- * @author Mik Kersten
- * @author Steffen Pingel
- * @since 2.0
- */
-public class NewWebTaskWizard extends Wizard implements INewWizard {
-
- protected TaskRepository taskRepository;
-
- protected String newTaskUrl;
-
- private final ITaskMapping taskSelection;
-
- /**
- * @since 3.0
- */
- public NewWebTaskWizard(TaskRepository taskRepository, String newTaskUrl, ITaskMapping taskSelection) {
- this.taskRepository = taskRepository;
- this.newTaskUrl = newTaskUrl;
- this.taskSelection = taskSelection;
-
- setWindowTitle(Messages.NewWebTaskWizard_New_Task);
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-
- @Override
- public void addPages() {
- addPage(new NewWebTaskPage(taskSelection));
- }
-
- @Override
- public boolean canFinish() {
- return true;
- }
-
- @Override
- public boolean performFinish() {
- handleSelection(taskSelection);
- TasksUiUtil.openUrl(newTaskUrl);
- return true;
- }
-
- private void handleSelection(final ITaskMapping taskSelection) {
- if (taskSelection == null) {
- return;
- }
-
- String summary = taskSelection.getSummary();
- String description = taskSelection.getDescription();
-
- Clipboard clipboard = new Clipboard(getShell().getDisplay());
- clipboard.setContents(new Object[] { summary + "\n" + description }, //$NON-NLS-1$
- new Transfer[] { TextTransfer.getInstance() });
-
- MessageDialog.openInformation(getShell(), Messages.NewWebTaskWizard_New_Task,
- Messages.NewWebTaskWizard_This_connector_does_not_provide_a_rich_task_editor_for_creating_tasks);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java
deleted file mode 100644
index a3e08b0ea..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-
-/**
- * Extend to provide a custom edit query dialog, typically invoked by the user requesting properties on a query node in
- * the Task List.
- *
- * @author Mik Kersten
- * @author Steffen Pingel
- * @since 3.0
- */
-public class RepositoryQueryWizard extends Wizard {
-
- private final TaskRepository repository;
-
- /**
- * @since 3.0
- */
- public RepositoryQueryWizard(TaskRepository repository) {
- Assert.isNotNull(repository);
- this.repository = repository;
- setNeedsProgressMonitor(true);
- setWindowTitle(Messages.RepositoryQueryWizard_Edit_Repository_Query);
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- }
-
- @Override
- public boolean canFinish() {
- IWizardPage currentPage = getContainer().getCurrentPage();
- if (currentPage instanceof AbstractRepositoryQueryPage) {
- return currentPage.isPageComplete();
- }
- return false;
- }
-
- @Override
- public boolean performFinish() {
- IWizardPage currentPage = getContainer().getCurrentPage();
- if (!(currentPage instanceof AbstractRepositoryQueryPage)) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Current wizard page does not extends AbstractRepositoryQueryPage")); //$NON-NLS-1$
- return false;
- }
-
- AbstractRepositoryQueryPage page = (AbstractRepositoryQueryPage) currentPage;
- IRepositoryQuery query = page.getQuery();
- if (query != null) {
- page.applyTo(query);
- if (query instanceof RepositoryQuery) {
- TasksUiPlugin.getTaskList().notifyElementChanged((RepositoryQuery) query);
- }
- } else {
- query = page.createQuery();
- TasksUiInternal.getTaskList().addQuery((RepositoryQuery) query);
- }
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- getTaskRepository().getConnectorKind());
- TasksUiInternal.synchronizeQuery(connector, (RepositoryQuery) query, null, true);
- return true;
- }
-
- public TaskRepository getTaskRepository() {
- return repository;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
deleted file mode 100644
index 17ea9a924..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Jeff Pound and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Jeff Pound - initial API and implementation
- * Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * A wizard page to enter details of a new attachment.
- *
- * @author Jeff Pound
- * @author Mik Kersten
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskAttachmentPage extends WizardPage {
-
- private static List<String> contentTypes;
-
- static {
- contentTypes = new LinkedList<String>();
- contentTypes.add("text/plain"); //$NON-NLS-1$
- contentTypes.add("text/html"); //$NON-NLS-1$
- contentTypes.add("application/xml"); //$NON-NLS-1$
- contentTypes.add("image/gif"); //$NON-NLS-1$
- contentTypes.add("image/jpeg"); //$NON-NLS-1$
- contentTypes.add("image/png"); //$NON-NLS-1$
- contentTypes.add(FileTaskAttachmentSource.APPLICATION_OCTET_STREAM);
- }
-
- private Button attachContextButton;
-
- private Text commentText;
-
- private Text descriptionText;
-
- private Combo contentTypeList;
-
- private Text fileNameText;
-
- private Button isPatchButton;
-
- private final TaskAttachmentModel model;
-
- private boolean needsDescription;
-
- private final TaskAttachmentMapper taskAttachment;
-
- private boolean first = true;
-
- public TaskAttachmentPage(TaskAttachmentModel model) {
- super("AttachmentDetails"); //$NON-NLS-1$
- this.model = model;
- this.taskAttachment = TaskAttachmentMapper.createFrom(model.getAttribute());
- setTitle(Messages.TaskAttachmentPage_Attachment_Details);
- setNeedsDescription(true);
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- composite.setLayout(gridLayout);
- setControl(composite);
-
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- composite.setLayout(new GridLayout(3, false));
-
- new Label(composite, SWT.NONE).setText(Messages.TaskAttachmentPage_File);
- fileNameText = new Text(composite, SWT.BORDER);
- fileNameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
-
- if (needsDescription) {
- new Label(composite, SWT.NONE).setText(Messages.TaskAttachmentPage_Description);
- descriptionText = new Text(composite, SWT.BORDER);
- descriptionText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
- descriptionText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- taskAttachment.setDescription(descriptionText.getText().trim());
- validate();
- }
-
- });
- }
-
- Label label = new Label(composite, SWT.NONE);
- label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
- label.setText(Messages.TaskAttachmentPage_Comment);
- commentText = new Text(composite, SWT.V_SCROLL | SWT.BORDER | SWT.WRAP);
- commentText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
- commentText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- apply();
- }
-
- });
-
- new Label(composite, SWT.NONE).setText(Messages.TaskAttachmentPage_Content_Type);// .setBackground(parent.getBackground());
-
- contentTypeList = new Combo(composite, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
- contentTypeList.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
- Iterator<String> iter = contentTypes.iterator();
- int i = 0;
- while (iter.hasNext()) {
- String next = iter.next();
- contentTypeList.add(next);
- i++;
- }
-
- /* Update attachment on select content type */
- contentTypeList.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- taskAttachment.setContentType(contentTypeList.getItem(contentTypeList.getSelectionIndex()));
- validate();
- }
- });
- contentTypeList.select(0);
- taskAttachment.setContentType(contentTypeList.getItem(0));
-
- // TODO: is there a better way to pad?
- new Label(composite, SWT.NONE);
-
- isPatchButton = new Button(composite, SWT.CHECK);
- isPatchButton.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
- isPatchButton.setText(Messages.TaskAttachmentPage_Patch);
-
- // TODO: is there a better way to pad?
- new Label(composite, SWT.NONE);
-
- attachContextButton = new Button(composite, SWT.CHECK);
- attachContextButton.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
- attachContextButton.setText(Messages.TaskAttachmentPage_ATTACHE_CONTEXT);
- attachContextButton.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_ATTACH));
- attachContextButton.setEnabled(ContextCore.getContextManager()
- .hasContext(model.getTask().getHandleIdentifier()));
-
- /*
- * Attachment file name listener, update the local attachment
- * accordingly
- */
- fileNameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- // determine type by extension
- taskAttachment.setFileName(fileNameText.getText());
- setContentTypeFromFilename(fileNameText.getText());
- validate();
- }
- });
-
- fileNameText.setText(taskAttachment.getFileName() == null ? "" : taskAttachment.getFileName()); //$NON-NLS-1$
-
- /* Listener for isPatch */
- isPatchButton.addSelectionListener(new SelectionAdapter() {
- private int lastSelected;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- taskAttachment.setPatch(isPatchButton.getSelection());
- if (isPatchButton.getSelection()) {
- lastSelected = contentTypeList.getSelectionIndex();
- contentTypeList.select(0);
- contentTypeList.setEnabled(false);
- if (attachContextButton.isEnabled()) {
- attachContextButton.setSelection(true);
- }
- } else {
- contentTypeList.setEnabled(true);
- contentTypeList.select(lastSelected);
- }
- validate();
- }
- });
- attachContextButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- validate();
- }
- });
-
- validate();
- setErrorMessage(null);
-
- if (descriptionText != null) {
- descriptionText.setFocus();
- } else {
- commentText.setFocus();
- }
-
- Dialog.applyDialogFont(composite);
- }
-
- private void validate() {
- apply();
- if (fileNameText != null && "".equals(fileNameText.getText().trim())) { //$NON-NLS-1$
- setMessage(Messages.TaskAttachmentPage_Enter_a_file_name);
- setPageComplete(false);
- } else if (descriptionText != null && "".equals(descriptionText.getText().trim())) { //$NON-NLS-1$
- setMessage(Messages.TaskAttachmentPage_Enter_a_description);
- setPageComplete(false);
- } else {
- setMessage(Messages.TaskAttachmentPage_Verify_the_content_type_of_the_attachment);
- setPageComplete(true);
- }
- }
-
- public TaskAttachmentModel getModel() {
- return model;
- }
-
- private void apply() {
- taskAttachment.applyTo(model.getAttribute());
- model.setComment(commentText.getText());
- model.setAttachContext(attachContextButton.getSelection());
- model.setContentType(taskAttachment.getContentType());
- }
-
- private void setContentType(String contentType) {
- String[] typeList = contentTypeList.getItems();
- for (int i = 0; i < typeList.length; i++) {
- if (typeList[i].equals(contentType)) {
- contentTypeList.select(i);
- taskAttachment.setContentType(contentType);
- validate();
- break;
- }
- }
- }
-
- private void setContentTypeFromFilename(String fileName) {
- setContentType(FileTaskAttachmentSource.getContentTypeFromFilename(fileName));
- }
-
- private void setFilePath(String path) {
- fileNameText.setText(path);
- taskAttachment.setFileName(path);
- if (path.endsWith(".patch")) { //$NON-NLS-1$
- isPatchButton.setSelection(true);
- taskAttachment.setPatch(true);
- if (attachContextButton.isEnabled()) {
- attachContextButton.setSelection(true);
- }
- }
- validate();
- }
-
- public void setNeedsDescription(boolean supportsDescription) {
- this.needsDescription = supportsDescription;
- }
-
- public boolean supportsDescription() {
- return needsDescription;
- }
-
- @Override
- public void setVisible(boolean visible) {
- if (visible) {
- if (fileNameText.getText().length() == 0) {
- setFilePath(getModel().getSource().getName());
- setContentType(getModel().getSource().getContentType());
- }
- }
- super.setVisible(visible);
- if (first) {
- if (descriptionText != null) {
- descriptionText.setFocus();
- } else {
- commentText.setFocus();
- }
- first = false;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java
deleted file mode 100644
index 41ba0a715..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskRepositoryWizardDialog.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Helen Bershadskaya and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Helen Bershadskaya - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.ui.wizards;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Wizard dialog for displaying repository settings page. Necessary so we can add a validate button in the button bar.
- *
- * @author Helen Bershadskaya
- * @since 3.1
- */
-public class TaskRepositoryWizardDialog extends WizardDialog {
-
- private static final String VALIDATE_BUTTON_KEY = "validate"; //$NON-NLS-1$
-
- private Button validateServerButton;
-
- private static final int VALIDATE_BUTTON_ID = 2000;
-
- /**
- * @see WizardDialog#WizardDialog(Shell, IWizard)
- * @since 3.1
- */
- public TaskRepositoryWizardDialog(Shell parentShell, IWizard newWizard) {
- super(parentShell, newWizard);
- }
-
- /**
- * Overridden so we can add a validate button to the wizard button bar, if a repository settings page requires it.
- * Validate button is added left justified at button bar bottom (next to help image).
- *
- * @since 3.1
- */
- @Override
- protected Control createButtonBar(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 0; // create
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
-
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // create help control if needed
- if (isHelpAvailable()) {
- createHelpControl(composite);
- }
-
- validateServerButton = createButton(composite, VALIDATE_BUTTON_ID,
- Messages.AbstractRepositorySettingsPage_Validate_Settings, false);
- validateServerButton.setImage(CommonImages.getImage(TasksUiImages.REPOSITORY_VALIDATE));
- validateServerButton.setVisible(false);
- setButtonLayoutData(validateServerButton);
- Label filler = new Label(composite, SWT.NONE);
- filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- ((GridLayout) composite.getLayout()).numColumns++;
-
- super.createButtonsForButtonBar(composite);
-
- return composite;
- }
-
- @Override
- public void updateButtons() {
- if (getCurrentPage() instanceof AbstractRepositorySettingsPage
- && ((AbstractRepositorySettingsPage) getCurrentPage()).needsValidation()) {
-
- if (!validateServerButton.isVisible()) {
- validateServerButton.setVisible(true);
- }
- } else {
- if (validateServerButton != null && validateServerButton.isVisible()) {
- validateServerButton.setVisible(false);
- }
- }
- super.updateButtons();
- }
-
- /**
- * Overridden so we can react to the validate button being pressed. This could have been done with a straight
- * selection listener in the creation method above, but this is more consistent with how the other buttons work in
- * the wizard dialog.
- *
- * @since 3.1
- */
- @Override
- protected void buttonPressed(int buttonId) {
- if (buttonId == VALIDATE_BUTTON_ID) {
- if (getCurrentPage() instanceof AbstractRepositorySettingsPage) {
- ((AbstractRepositorySettingsPage) getCurrentPage()).validateSettings();
- }
- } else {
- super.buttonPressed(buttonId);
- }
- }
-
- /**
- * Overridden to be able to set proper state for our validate button
- */
- @Override
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
-
- HashMap<String, Boolean> savedEnabledState = null;
- try {
- savedEnabledState = saveAndSetEnabledStateMylyn();
- super.run(fork, cancelable, runnable);
- } finally {
- if (savedEnabledState != null) {
- restoreEnabledStateMylyn(savedEnabledState);
- }
- }
- }
-
- /**
- * Modeled after super.saveAndSetEnabledState(), but that one is private, so create our own
- */
- private HashMap<String, Boolean> saveAndSetEnabledStateMylyn() {
- HashMap<String, Boolean> savedEnabledState = null;
- if (getShell() != null) {
- savedEnabledState = new HashMap<String, Boolean>();
- if (validateServerButton != null && getShell().getDisplay().getFocusControl() == validateServerButton
- && validateServerButton.getShell() == getShell()) {
- savedEnabledState.put(VALIDATE_BUTTON_KEY, validateServerButton.getEnabled());
- validateServerButton.setEnabled(false);
- }
- }
- return savedEnabledState;
- }
-
- /**
- * Modeled after super.restoreEnabledState() and super.restoreUIState() -- couldn't override those since they are
- * private, so create our own. Currently only single button to work with, so don't create two separate methods
- */
- private void restoreEnabledStateMylyn(HashMap<String, Boolean> savedEnabledState) {
- if (savedEnabledState != null) {
- Boolean savedValidateEnabledState = savedEnabledState.get(VALIDATE_BUTTON_KEY);
- if (validateServerButton != null && savedValidateEnabledState != null) {
- validateServerButton.setEnabled(savedValidateEnabledState);
- }
- }
- }
-}

Back to the top