Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.core.prefs340
-rw-r--r--org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.ui.prefs63
-rw-r--r--org.eclipse.mylyn.tasks.core/.settings/org.eclipse.mylyn.tasklist.prefs4
-rw-r--r--org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF19
-rw-r--r--org.eclipse.mylyn.tasks.core/about.html27
-rw-r--r--org.eclipse.mylyn.tasks.core/build.properties15
-rw-r--r--org.eclipse.mylyn.tasks.core/plugin.xml31
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractSearchHandler.java25
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java530
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskCategory.java23
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java179
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/CommentQuoter.java95
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java235
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java37
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryModelListener.java20
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java51
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java47
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskList.java82
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListChangeListener.java24
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListRunnable.java20
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskRepositoryFilter.java55
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITasksCoreConstants.java80
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IdentityAttributeFactory.java58
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalAttachment.java125
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java115
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java53
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTaskListFactory.java36
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java68
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/Person.java34
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryExternalizationParticipant.java115
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java63
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryQuery.java141
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTaskHandleUtil.java54
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTemplateManager.java57
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesContentHandler.java55
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java190
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java209
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivationHistory.java112
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java796
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java257
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskAttachment.java160
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskCategory.java52
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java112
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskContainerDelta.java108
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java127
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataStorageManager.java354
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskExternalizationException.java25
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskGroup.java43
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskList.java653
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java130
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryAdapter.java36
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryLocation.java75
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java389
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskTask.java39
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TasksModel.java121
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UncategorizedTaskContainer.java48
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UnmatchedTaskContainer.java65
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java100
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ElementHandler.java120
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java89
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataConstants.java99
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataManagerListener.java18
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataExternalizer.java124
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManager.java684
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManagerEvent.java64
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataState.java181
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateReader.java614
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateWriter.java121
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStore.java157
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TextTaskAttachmentSource.java56
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttachmentHandler.java94
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttributeFactory.java47
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyDuplicateDetector.java92
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyRepositoryConnector.java435
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskDataHandler.java177
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskListFactory.java187
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AttributeContainer.java180
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/DefaultTaskSchema.java232
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/FileAttachment.java89
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskAttachment.java38
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskCollector.java33
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskFactory.java34
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/LegacyTaskDataCollector.java28
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/QueryHitCollector.java75
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryAttachment.java134
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryOperation.java221
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskAttribute.java396
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskData.java406
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskComment.java108
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskFactory.java193
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskSelection.java236
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java118
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java752
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java263
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationContext.java23
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java28
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizationParticipant.java129
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizer.java417
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java102
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java128
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizationSession.java129
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java346
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java138
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java402
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractDuplicateDetector.java51
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java249
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskListMigrator.java37
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttributeContainer.java26
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryElement.java38
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryListener.java47
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryManager.java37
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryModel.java32
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryPerson.java29
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryQuery.java31
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java331
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivationListener.java37
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityListener.java34
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java79
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskAttachment.java138
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java51
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskContainer.java29
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskMapping.java64
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryResponse.java42
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java195
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTemplate.java71
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivationAdapter.java29
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivityAdapter.java23
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskMapping.java122
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java836
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryLocationFactory.java27
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentHandler.java36
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentSource.java34
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskDataHandler.java93
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataManager.java34
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataWorkingCopy.java44
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java268
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentModel.java87
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java531
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java270
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java138
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java180
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskData.java88
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataCollector.java26
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java162
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelEvent.java45
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java19
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java402
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java129
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskRelation.java66
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/ISynchronizationSession.java49
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java90
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobEvent.java27
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobListener.java26
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SynchronizationJob.java43
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/TaskJob.java26
155 files changed, 0 insertions, 21512 deletions
diff --git a/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index a398f671e..000000000
--- a/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,340 +0,0 @@
-#Wed May 28 17:24:58 PDT 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
-org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,NORMAL
-org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,API
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=80
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=1
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=120
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 5e70d0848..000000000
--- a/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,63 +0,0 @@
-#Sat Mar 01 03:38:47 PST 2008
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Mylyn based on Eclipse
-formatter_settings_version=11
-internal.default.compliance=default
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.javadoc=false
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\n * Copyright (c) 2004, 2007 Mylyn project committers and others.\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *******************************************************************************/\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=true
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.mylyn.tasklist.prefs b/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.mylyn.tasklist.prefs
deleted file mode 100644
index 0a2cc0b30..000000000
--- a/org.eclipse.mylyn.tasks.core/.settings/org.eclipse.mylyn.tasklist.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Mon Jun 18 17:14:59 PDT 2007
-eclipse.preferences.version=1
-project.repository.kind=bugzilla
-project.repository.url=https\://bugs.eclipse.org/bugs
diff --git a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
deleted file mode 100644
index 15bbd9ed9..000000000
--- a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Mylyn Tasks Core
-Bundle-SymbolicName: org.eclipse.mylyn.tasks.core;singleton:=true
-Bundle-Version: 3.0.0.qualifier
-Bundle-Vendor: Eclipse.org
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.net,
- org.eclipse.mylyn.commons.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.mylyn.commons.net;bundle-version="[3.0.0,4.0.0)"
-Export-Package: org.eclipse.mylyn.internal.tasks.core;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
- org.eclipse.mylyn.internal.tasks.core.data;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
- org.eclipse.mylyn.internal.tasks.core.deprecated;x-internal:=true,
- org.eclipse.mylyn.internal.tasks.core.externalization;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
- org.eclipse.mylyn.internal.tasks.core.sync;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
- org.eclipse.mylyn.tasks.core,
- org.eclipse.mylyn.tasks.core.data,
- org.eclipse.mylyn.tasks.core.sync
diff --git a/org.eclipse.mylyn.tasks.core/about.html b/org.eclipse.mylyn.tasks.core/about.html
deleted file mode 100644
index 0dd939c09..000000000
--- a/org.eclipse.mylyn.tasks.core/about.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 7, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/build.properties b/org.eclipse.mylyn.tasks.core/build.properties
deleted file mode 100644
index 812285c52..000000000
--- a/org.eclipse.mylyn.tasks.core/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2006 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
-###############################################################################
-bin.includes = META-INF/,\
- plugin.xml,\
- .,\
- about.html
-src.includes = about.html,\
- schema/
-jre.compilation.profile = J2SE-1.5
-source.. = src/
diff --git a/org.eclipse.mylyn.tasks.core/plugin.xml b/org.eclipse.mylyn.tasks.core/plugin.xml
deleted file mode 100644
index 523691648..000000000
--- a/org.eclipse.mylyn.tasks.core/plugin.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension-point id="templates" name="templates" schema="schema/templates.exsd"/>
-
- <!--
- <extension
- point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
- <hyperlinkDetector class="org.eclipse.mylyn.internal.bugs.java.BugzillaHyperLinkDetector"/>
- </extension>
- -->
-
-<!--
- <extension
- point="org.eclipse.mylyn.core.context">
- <structureBridge
- activeSearchIcon="icons/elcl16/edge-ref-bug.gif"
- activeSearchLabel="Bugzilla References"
- class="org.eclipse.mylyn.bugs.BugzillaStructureBridge"
- name="Bugzilla Structure Bridge"/>
- </extension>
-
- <extension
- point="org.eclipse.mylyn.ui.context">
- <uiBridge
- class="org.eclipse.mylyn.bugs.BugzillaUiBridge"
- contentType="bugzilla"/>
- </extension>
--->
-</plugin>
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractSearchHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractSearchHandler.java
deleted file mode 100644
index bb9dd7ff3..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractSearchHandler.java
+++ /dev/null
@@ -1,25 +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.core;
-
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- */
-public abstract class AbstractSearchHandler {
-
- public abstract String getConnectorKind();
-
- public abstract boolean queryForText(TaskRepository taskRepository, IRepositoryQuery query, TaskData taskData,
- String searchString);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
deleted file mode 100644
index a9cc5a438..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTask.java
+++ /dev/null
@@ -1,530 +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.core;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * Encapsulates tasks that reside on a repository or local computer and participate in synchronization with the source
- * that contains their data.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @since 2.0
- */
-public abstract class AbstractTask extends AbstractTaskContainer implements ITask {
-
- public static final String DEFAULT_TASK_KIND = "task";
-
- private String repositoryUrl;
-
- private String taskKind = DEFAULT_TASK_KIND;
-
- private final String taskId;
-
- private String owner;
-
- private boolean active = false;
-
- private String summary;
-
- private String priority = PriorityLevel.getDefault().toString();
-
- private boolean isNotifiedIncoming = false;
-
- private boolean reminded = false;
-
- private final Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
-
- // ************ Synch ****************
-
- /** The last time this task's bug report was in a synchronized (read?) state. */
- private String lastReadTimeStamp;
-
- private boolean synchronizing;
-
- private boolean submitting;
-
- private SynchronizationState synchronizationState = SynchronizationState.SYNCHRONIZED;
-
- // transient
- private IStatus errorStatus = null;
-
- private boolean stale = false;
-
- private Date completionDate = null;
-
- private Date creationDate = null;
-
- private Date modificationDate = null;
-
- private DateRange scheduledForDate = null;
-
- private Date dueDate = null;
-
- private String notes = "";
-
- private int estimatedTimeHours = 1;
-
- private boolean markReadPending;
-
- // TODO 3.0 make private
- protected String taskKey;
-
- private Map<String, String> attributes;
-
- private boolean changed;
-
- public AbstractTask(String repositoryUrl, String taskId, String summary) {
- super(RepositoryTaskHandleUtil.getHandle(repositoryUrl, taskId));
- this.repositoryUrl = repositoryUrl;
- this.taskId = taskId;
- this.summary = summary;
- }
-
- /**
- * Final to preserve the handle identifier format required by the framework.
- */
- @Override
- public final String getHandleIdentifier() {
- return super.getHandleIdentifier();
- }
-
- /**
- * True for tasks that can be modified without a round-trip to a server. For example, such a task can be marked
- * completed via the Task List.
- *
- * @deprecated use <code>task instanceof LocalTask</code> instead
- */
- @Deprecated
- public abstract boolean isLocal();
-
- public abstract String getConnectorKind();
-
- @Deprecated
- public String getLastReadTimeStamp() {
- return lastReadTimeStamp;
- }
-
- @Deprecated
- public void setLastReadTimeStamp(String lastReadTimeStamp) {
- this.lastReadTimeStamp = lastReadTimeStamp;
- }
-
- /**
- * @since 3.0
- */
- public void setSynchronizationState(SynchronizationState syncState) {
- Assert.isNotNull(syncState);
- this.synchronizationState = syncState;
- }
-
- /**
- * @since 3.0
- */
- public SynchronizationState getSynchronizationState() {
- return synchronizationState;
- }
-
- public boolean isSynchronizing() {
- return synchronizing;
- }
-
- public void setSynchronizing(boolean sychronizing) {
- this.synchronizing = sychronizing;
- }
-
- public boolean isNotified() {
- return isNotifiedIncoming;
- }
-
- public void setNotified(boolean notified) {
- isNotifiedIncoming = notified;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- if (!areEqual(this.owner, owner)) {
- String oldValue = this.owner;
- this.owner = owner;
- firePropertyChange("owner", oldValue, owner);
- }
- }
-
- /**
- * Return the status, such as an error or warning, associated with this task.
- */
- public IStatus getStatus() {
- return errorStatus;
- }
-
- public void setErrorStatus(IStatus status) {
- this.errorStatus = status;
- }
-
- public final String getTaskId() {
- return taskId;
- }
-
- public final String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- @Override
- public final void setHandleIdentifier(String handleIdentifier) {
- throw new RuntimeException("Cannot set the handle identifier of a task, set repository URL instead.");
- }
-
- public final void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- super.setHandleIdentifier(RepositoryTaskHandleUtil.getHandle(repositoryUrl, taskId));
- }
-
- /**
- * User identifiable key for the task to be used in UI facilities such as label displays and hyperlinked references.
- * Can return the same as the ID (e.g. in the case of Bugzilla). Can return null if no such label exists.
- */
- public String getTaskKey() {
- return (taskKey == null) ? taskId : taskKey;
- }
-
- public boolean isSubmitting() {
- return submitting;
- }
-
- public void setSubmitting(boolean submitting) {
- this.submitting = submitting;
- }
-
- @Override
- public String toString() {
- return summary;
- }
-
- public void setActive(boolean active) {
- this.active = active;
- }
-
- public boolean isActive() {
- return active;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof AbstractTask) {
- return this.getHandleIdentifier().equals(((ITask) obj).getHandleIdentifier());
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return taskId.hashCode();
- }
-
- public boolean isCompleted() {
- return completionDate != null;
- }
-
- /**
- * @deprecated use setCompletionDate()
- */
- @Deprecated
- public void setCompleted(boolean completed) {
- if (completed) {
- completionDate = new Date();
- } else {
- completionDate = null;
- }
- }
-
- @Override
- public String getPriority() {
- return priority;
- }
-
- public void setPriority(String priority) {
- if (!areEqual(this.priority, priority)) {
- String oldValue = this.priority;
- this.priority = priority;
- firePropertyChange("priority", oldValue, priority);
- }
- }
-
- public String getNotes() {
- // TODO: removed check for null once xml updated.
- if (notes == null) {
- notes = "";
- }
- return notes;
- }
-
- public void setNotes(String notes) {
- this.notes = notes;
- }
-
- /**
- * @deprecated Use {@link #getEstimatedTimeHours()} instead
- */
- @Deprecated
- public int getEstimateTimeHours() {
- return getEstimatedTimeHours();
- }
-
- /**
- * @since 3.0
- */
- public int getEstimatedTimeHours() {
- return estimatedTimeHours;
- }
-
- public void setEstimatedTimeHours(int estimated) {
- this.estimatedTimeHours = estimated;
- }
-
- /**
- * @API 3.0: Rename to internalAddParentContainer
- */
- public void addParentContainer(AbstractTaskContainer container) {
- containers.add(container);
- }
-
- /**
- * @API 3.0: Rename to internalremoveParentContainer
- * @since 3.0
- */
- public void removeParentContainer(AbstractTaskContainer container) {
- containers.remove(container);
- }
-
- public Set<AbstractTaskContainer> getParentContainers() {
- return new HashSet<AbstractTaskContainer>(containers);
- }
-
- @Override
- public String getSummary() {
- return summary;
- }
-
- public Date getCompletionDate() {
- return completionDate;
- }
-
- public void setScheduledForDate(DateRange reminderDate) {
- scheduledForDate = reminderDate;
- }
-
- public DateRange getScheduledForDate() {
- return scheduledForDate;
- }
-
- public boolean isReminded() {
- return reminded;
- }
-
- public void setReminded(boolean reminded) {
- this.reminded = reminded;
- }
-
- public Date getCreationDate() {
- if (creationDate == null) {
- creationDate = new Date();
- }
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- if (!areEqual(this.creationDate, creationDate)) {
- Date oldValue = this.creationDate;
- this.creationDate = creationDate;
- firePropertyChange("creationDate", oldValue, creationDate);
- }
- }
-
- public void setSummary(String summary) {
- Assert.isNotNull(summary);
- if (!areEqual(this.summary, summary)) {
- String oldValue = this.summary;
- this.summary = summary;
- firePropertyChange("summary", oldValue, summary);
- }
- }
-
- public void setCompletionDate(Date completionDate) {
- if (!areEqual(this.completionDate, completionDate)) {
- Date oldValue = this.completionDate;
- this.completionDate = completionDate;
- firePropertyChange("completionDate", oldValue, completionDate);
- }
- }
-
- private boolean areEqual(Object oldValue, Object newValue) {
- return (oldValue != null) ? oldValue.equals(newValue) : oldValue == newValue;
- }
-
- private void firePropertyChange(String key, Object oldValue, Object newValue) {
-// PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue);
-// for (PropertyChangeListener listener : propertyChangeListeners) {
-// listener.propertyChange(event);
-// }
- changed = true;
- }
-
- public boolean isChanged() {
- return changed;
- }
-
- public void setChanged(boolean changed) {
- this.changed = changed;
- }
-
- /**
- * @deprecated use {@link TaskActivityManager#isPastReminder(AbstractTask)} instead
- */
- @Deprecated
- public boolean isPastReminder() {
- if (isCompleted() || scheduledForDate == null) {
- return false;
- } else {
- if (/*!internalIsFloatingScheduledDate() && */scheduledForDate.getEndDate().compareTo(
- TaskActivityUtil.getCalendar()) < 0) {
- return true;
- } else {
- return false;
- }
- }
- }
-
- public String getTaskKind() {
- return taskKind;
- }
-
- public void setTaskKind(String taskKind) {
- if (!areEqual(this.taskKind, taskKind)) {
- String oldValue = this.taskKind;
- this.taskKind = taskKind;
- firePropertyChange("taskKind", oldValue, taskKind);
- }
- }
-
- @Override
- public int compareTo(IRepositoryElement taskListElement) {
- return summary.compareTo(((AbstractTask) taskListElement).summary);
- }
-
- public Date getDueDate() {
- return dueDate;
- }
-
- public void setDueDate(Date date) {
- if (!areEqual(this.dueDate, date)) {
- Date oldValue = this.dueDate;
- this.dueDate = date;
- firePropertyChange("dueDate", oldValue, date);
- }
- }
-
- @Deprecated
- public boolean isStale() {
- return stale;
- }
-
- @Deprecated
- public void setStale(boolean stale) {
- this.stale = stale;
- }
-
- /**
- * @since 3.0
- */
- public Date getModificationDate() {
- return modificationDate;
- }
-
- /**
- * @since 3.0
- */
- public void setModificationDate(Date modificationDate) {
- if (!areEqual(this.modificationDate, modificationDate)) {
- Date oldValue = this.modificationDate;
- this.modificationDate = modificationDate;
- firePropertyChange("modificationDate", oldValue, modificationDate);
- }
- }
-
- /**
- * @since 3.0
- */
- public boolean isMarkReadPending() {
- return markReadPending;
- }
-
- /**
- * @since 3.0
- */
- public void setMarkReadPending(boolean markReadPending) {
- this.markReadPending = markReadPending;
- }
-
- public void setTaskKey(String taskKey) {
- if (!areEqual(this.taskKey, taskKey)) {
- String oldValue = this.taskKey;
- this.taskKey = taskKey;
- firePropertyChange("taskKey", oldValue, taskKey);
- }
- }
-
- public synchronized String getAttribute(String key) {
- return (attributes != null) ? attributes.get(key) : null;
- }
-
- public synchronized Map<String, String> getAttributes() {
- if (attributes != null) {
- return new HashMap<String, String>(attributes);
- } else {
- return Collections.emptyMap();
- }
- }
-
- public synchronized void setAttribute(String key, String value) {
- Assert.isNotNull(key);
- if (attributes == null) {
- attributes = new HashMap<String, String>();
- }
- String oldValue = attributes.get(key);
- if (!areEqual(oldValue, value)) {
- attributes.put(key, value);
- firePropertyChange(key, oldValue, value);
- }
- }
-
- @Override
- public void setUrl(String url) {
- String oldValue = getUrl();
- if (!areEqual(oldValue, url)) {
- super.setUrl(url);
- firePropertyChange("url", oldValue, url);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskCategory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskCategory.java
deleted file mode 100644
index 7dea4ce32..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskCategory.java
+++ /dev/null
@@ -1,23 +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.core;
-
-/**
- * A container that stores tasks from any repository. A task can only have a single AbstractTaskCategory parent (only be
- * in one category at a time).
- *
- * @author Mik Kersten
- */
-public abstract class AbstractTaskCategory extends AbstractTaskContainer {
-
- public AbstractTaskCategory(String handleAndDescription) {
- super(handleAndDescription);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java
deleted file mode 100644
index 3e349271b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/AbstractTaskContainer.java
+++ /dev/null
@@ -1,179 +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.core;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-
-/**
- * Top-level Task List element that can contain other Task List elements.
- *
- * @author Mik Kersten
- */
-public abstract class AbstractTaskContainer extends PlatformObject implements IRepositoryElement, ITaskContainer {
-
- private String handleIdentifier = "";
-
- private final Collection<ITask> children = new CopyOnWriteArrayList<ITask>();
-
- /**
- * Optional URL corresponding to the web resource associated with this container.
- */
- private String url;
-
- public AbstractTaskContainer(String handleAndDescription) {
- Assert.isNotNull(handleAndDescription);
- this.handleIdentifier = handleAndDescription;
- }
-
- /**
- * Use {@link TaskList} methods instead.
- */
- public void internalAddChild(AbstractTask task) {
- Assert.isNotNull(task);
- children.add(task);
- }
-
- /**
- * Use {@link TaskList} methods instead.
- *
- * @return
- * @since 3.0
- */
- public boolean internalRemoveChild(ITask task) {
- return children.remove(task);
- }
-
- /**
- * Removes any cyclic dependencies in children.
- *
- * TODO: review to make sure that this is too expensive, or move to creation.
- *
- * @since 3.0
- */
- public Collection<ITask> getChildren() {
- return Collections.unmodifiableCollection(children);
- }
-
- /**
- * Maxes out at a depth of 10.
- *
- * TODO: review policy
- */
- public boolean contains(String handle) {
- Assert.isNotNull(handle);
- return containsHelper(children, handle, new HashSet<IRepositoryElement>());
- }
-
- private boolean containsHelper(Collection<ITask> children, String handle, Set<IRepositoryElement> visitedContainers) {
- for (ITask child : children) {
- if (visitedContainers.contains(child)) {
- continue;
- }
- visitedContainers.add(child);
- if (child instanceof ITaskContainer) {
- if (handle.equals(child.getHandleIdentifier())
- || containsHelper(((ITaskContainer) child).getChildren(), handle, visitedContainers)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public String getSummary() {
- return handleIdentifier;
- }
-
- public boolean isEmpty() {
- return children.isEmpty();
- }
-
- public String getHandleIdentifier() {
- return handleIdentifier;
- }
-
- public void setHandleIdentifier(String handleIdentifier) {
- this.handleIdentifier = handleIdentifier;
- }
-
- @Override
- public int hashCode() {
- return handleIdentifier.hashCode();
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- /**
- * @return can be null
- */
- public String getUrl() {
- return url;
- }
-
- @Override
- public boolean equals(Object object) {
- if (object == null) {
- return false;
- }
- if (object instanceof AbstractTaskContainer) {
- IRepositoryElement compare = (IRepositoryElement) object;
- return this.getHandleIdentifier().equals(compare.getHandleIdentifier());
- } else {
- return false;
- }
- }
-
- @Override
- public String toString() {
- return "container: " + handleIdentifier;
- }
-
- public String getPriority() {
- String highestPriority = PriorityLevel.P5.toString();
- Collection<ITask> tasks = getChildren();
- if (tasks.isEmpty()) {
- return PriorityLevel.P1.toString();
- }
- for (ITask task : tasks) {
- if (highestPriority.compareTo(task.getPriority()) > 0) {
- highestPriority = task.getPriority();
- }
- }
- return highestPriority;
- }
-
- /**
- * The handle for most containers is their summary. Override to specify a different natural ordering.
- */
- public int compareTo(IRepositoryElement taskListElement) {
- return getHandleIdentifier().compareTo(taskListElement.getHandleIdentifier());
- }
-
- /**
- * If false, user is unable to manipulate (i.e. rename/delete), no preferences are available.
- *
- * @since 2.3
- */
- public boolean isUserManaged() {
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/CommentQuoter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/CommentQuoter.java
deleted file mode 100644
index d887d821d..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/CommentQuoter.java
+++ /dev/null
@@ -1,95 +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.core;
-
-/**
- * Utility class to handle many text quoting scenarios
- * <p>
- * Each line of text is quoted individually and wrapped, according to the {@link lineSize} attribute
- * <p>
- * The wrapping policy is the following:
- * <p>
- * <ol>
- * <li>A substring of {@link lineSize} characters is extracted and examined
- * <li>If the next character after the substring is a blank space, the substring is quoted
- * <li>If don't, the substring is searched backwards for a blank space; if one is found, the substring until the blank
- * space is quoted
- * <li>If no blank space is found, the entire substring is quoted
- * <li>The remaining of substring + line are reevaluated on step 1
- * </ol>
- *
- * @author Willian Mitsuda
- */
-public class CommentQuoter {
-
- public static final int DEFAULT_WRAP_SIZE = 80;
-
- private final int lineSize;
-
- public CommentQuoter() {
- this(DEFAULT_WRAP_SIZE);
- }
-
- public CommentQuoter(int lineSize) {
- this.lineSize = lineSize;
- }
-
- /**
- * Quote a text, wrapping if necessary
- */
- public String quote(String text) {
- StringBuilder sb = new StringBuilder(text.length() + text.length() / lineSize);
-
- String[] lines = text.split("\n");
- for (String line : lines) {
- if (line.trim().equals("")) {
- sb.append("> \n");
- continue;
- }
-
- int pos = 0;
- while (pos < line.length()) {
- int wrapPos = pos + lineSize;
- if (wrapPos < line.length()) {
- // Try to find a space to wrap the line
- while (wrapPos > pos) {
- char wrapChar = line.charAt(wrapPos);
- if (Character.isSpaceChar(wrapChar)) {
- break;
- }
- wrapPos--;
- }
- if (wrapPos == pos) {
- // There is no space; don't break the line and find the
- // next space after the limit...
- wrapPos = pos + lineSize;
- while (wrapPos < line.length()) {
- if (Character.isSpaceChar(line.charAt(wrapPos))) {
- break;
- }
- wrapPos++;
- }
- }
-
- // Extract the substring and recalculate the next search
- // start point
- String wrappedLine = line.substring(pos, wrapPos).trim();
- sb.append("> " + wrappedLine + "\n");
- pos = wrapPos + 1;
- } else {
- sb.append("> " + line.substring(pos).trim() + "\n");
- break;
- }
- }
- }
-
- return sb.toString();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
deleted file mode 100644
index a126d14b9..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/DateRange.java
+++ /dev/null
@@ -1,235 +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.core;
-
-import java.text.DateFormat;
-import java.util.Calendar;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public class DateRange implements Comparable<DateRange> {
-
- private static final long DAY = 1000 * 60 * 60 * 24;
-
- private static final String DESCRIPTION_PREVIOUS_WEEK = "Previous Week";
-
- private static final String DESCRIPTION_THIS_WEEK = "This Week";
-
- private static final String DESCRIPTION_NEXT_WEEK = "Next Week";
-
- private final Calendar startDate;
-
- private final Calendar endDate;
-
- /**
- * create an instance of a date range that represents a finite point in time
- */
- public DateRange(Calendar time) {
- startDate = time;
- endDate = time;
- }
-
- public DateRange(Calendar startDate, Calendar endDate) {
- Assert.isNotNull(startDate);
- Assert.isNotNull(endDate);
- this.startDate = startDate;
- this.endDate = endDate;
- }
-
- public boolean includes(DateRange range) {
- return (startDate.getTimeInMillis() <= range.getStartDate().getTimeInMillis())
- && (endDate.getTimeInMillis() >= range.getEndDate().getTimeInMillis());
- }
-
- public boolean includes(Calendar cal) {
- return (startDate.getTimeInMillis() <= cal.getTimeInMillis())
- && (endDate.getTimeInMillis() >= cal.getTimeInMillis());
- }
-
- public Calendar getStartDate() {
- return startDate;
- }
-
- public Calendar getEndDate() {
- return endDate;
- }
-
- /**
- * TODO: Move into label provider
- */
- @Override
- public String toString() {
- boolean isThisWeek = TaskActivityUtil.getCurrentWeek().includes(this);
- boolean isNextWeek = TaskActivityUtil.getNextWeek().includes(this);
- if (isDay() && (isThisWeek || isNextWeek)) {
- String day = "";
- switch (getStartDate().get(Calendar.DAY_OF_WEEK)) {
- case Calendar.MONDAY:
- day = "Monday";
- break;
- case Calendar.TUESDAY:
- day = "Tuesday";
- break;
- case Calendar.WEDNESDAY:
- day = "Wednesday";
- break;
- case Calendar.THURSDAY:
- day = "Thursday";
- break;
- case Calendar.FRIDAY:
- day = "Friday";
- break;
- case Calendar.SATURDAY:
- day = "Saturday";
- break;
- case Calendar.SUNDAY:
- day = "Sunday";
- break;
- }
- if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == getStartDate().get(Calendar.DAY_OF_WEEK)) {
- return day + " - Today";
- } else {
- return day;
- }
- } else if (isThisWeek()) {
- return DESCRIPTION_THIS_WEEK;
- } else if (isNextWeek()) {
- return DESCRIPTION_NEXT_WEEK;
- } else if (isPreviousWeek()) {
- return DESCRIPTION_PREVIOUS_WEEK;
- }
- return DateFormat.getDateInstance(DateFormat.MEDIUM).format(startDate.getTime());
- /* + " to "+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(endDate.getTime());*/
- }
-
- public DateRange next() {
- if (isDay()) {
- return create(Calendar.DAY_OF_YEAR, 1);
- } else if (isWeek()) {
- return create(Calendar.WEEK_OF_YEAR, 1);
- }
- return null;
- }
-
- public DateRange previous() {
- if (isDay()) {
- return create(Calendar.DAY_OF_YEAR, -1);
- } else if (isWeek()) {
- return create(Calendar.WEEK_OF_YEAR, -1);
- }
- return null;
- }
-
- private DateRange create(int field, int multiplier) {
- Calendar previousStart = (Calendar) getStartDate().clone();
- Calendar previousEnd = (Calendar) getEndDate().clone();
- previousStart.add(field, 1 * multiplier);
- previousEnd.add(field, 1 * multiplier);
- return new DateRange(previousStart, previousEnd);
- }
-
- private boolean isNextWeek() {
- return TaskActivityUtil.getCurrentWeek().next().compareTo(this) == 0;
- }
-
- private boolean isThisWeek() {
- if (isWeek()) {
- return this.includes(Calendar.getInstance());
- }
- return false;
- }
-
- private boolean isPreviousWeek() {
- if (isWeek()) {
- Calendar cal = Calendar.getInstance();
- cal.add(Calendar.WEEK_OF_YEAR, -1);
- return this.includes(cal);
- }
- return false;
- }
-
- public boolean isDay() {
- return ((getEndDate().getTimeInMillis() - getStartDate().getTimeInMillis()) == DAY - 1);
- }
-
- public boolean isWeek() {
- return ((getEndDate().getTimeInMillis() - getStartDate().getTimeInMillis()) == (DAY * 7) - 1);
- }
-
- public boolean isPast() {
- return getEndDate().compareTo(Calendar.getInstance()) < 0;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((endDate == null) ? 0 : endDate.hashCode());
- result = prime * result + ((startDate == null) ? 0 : startDate.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof DateRange)) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
-// if (getClass() != obj.getClass()) {
-// return false;
-// }
- DateRange other = (DateRange) obj;
- if (endDate == null) {
- if (other.endDate != null) {
- return false;
- }
- } else if (!endDate.equals(other.endDate)) {
- return false;
- }
- if (startDate == null) {
- if (other.startDate != null) {
- return false;
- }
- } else if (!startDate.equals(other.startDate)) {
- return false;
- }
- return true;
- }
-
- public boolean before(Calendar cal) {
- return getEndDate().before(cal);
- }
-
- public boolean after(Calendar cal) {
- return cal.before(getEndDate());
- }
-
- public int compareTo(DateRange range) {
- if (range.getStartDate().equals(startDate) && range.getEndDate().equals(endDate)) {
- return 0;
- } else if (includes(range)) {
- return 1;
- } else if (before(range.getStartDate())) {
- return -1;
- } else if (after(range.getEndDate())) {
- return 1;
- }
- return -1;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java
deleted file mode 100644
index b411e436e..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java
+++ /dev/null
@@ -1,37 +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.core;
-
-/**
- * @author Mik Kersten
- * @since 2.0
- */
-public interface IRepositoryConstants {
-
- public static final String OLD_PROPERTY_SYNCTIME = "synctime";
-
- public static final String PROPERTY_SYNCTIMESTAMP = "lastsynctimestamp";
-
- public static final String PROPERTY_TIMEZONE = "timezone";
-
- public static final String PROPERTY_ENCODING = "encoding";
-
- public static final String PROPERTY_VERSION = "version";
-
- public static final String PROPERTY_CONNECTOR_KIND = "kind";
-
- public static final String PROPERTY_URL = "url";
-
- public static final String PROPERTY_LABEL = "label";
-
- public static final String PROPERTY_DELIM = ":";
-
- public static final String KIND_UNKNOWN = "<unknown>";
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryModelListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryModelListener.java
deleted file mode 100644
index 62f9e64e0..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryModelListener.java
+++ /dev/null
@@ -1,20 +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.core;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IRepositoryModelListener {
-
- public void loaded();
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java
deleted file mode 100644
index 6e74f685a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java
+++ /dev/null
@@ -1,51 +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.core;
-
-/**
- * @author Rob Elves
- */
-public interface ITaskDataStorage {
-
- /**
- * Perform any initialization necessary storage
- *
- * @throws Exception
- */
- public void start() throws Exception;
-
- public void stop() throws Exception;
-
- public void put(TaskDataState taskDataState);
-
- public TaskDataState get(String repositoryUrl, String id);
-
- /**
- * if last id remove folder (i.e. in case of refactoring urls)
- */
- public void remove(String repositoryUrl, String id);
-
- /**
- * persist any unsaved data
- */
- public void flush();
-
- /**
- * DESTROY ALL OFFLINE DATA
- */
- public void clear();
-
- // Methods for NEW unsubmitted task data, currently not used
-
-// public void putNew(TaskDataState newTaskDataState);
-//
-// public Set<TaskDataState> getNew(String repositoryUrl);
-//
-// public removeNew(id);
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java
deleted file mode 100644
index 1471435aa..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskJobFactory.java
+++ /dev/null
@@ -1,47 +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.core;
-
-import java.util.Set;
-
-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.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;
-
-/**
- * @author Steffen Pingel
- * @author Mik Kersten
- */
-public interface ITaskJobFactory {
-
- public abstract SynchronizationJob createSynchronizeTasksJob(AbstractRepositoryConnector connector,
- TaskRepository taskRepository, Set<ITask> tasks);
-
- public abstract SynchronizationJob createSynchronizeQueriesJob(AbstractRepositoryConnector connector,
- TaskRepository repository, Set<RepositoryQuery> queries);
-
- public abstract SynchronizationJob createSynchronizeRepositoriesJob(Set<TaskRepository> repositories);
-
- public abstract SubmitJob createSubmitTaskJob(AbstractRepositoryConnector connector, TaskRepository taskRepository,
- ITask task, TaskData taskData, Set<TaskAttribute> changedAttributes);
-
- public abstract TaskJob createUpdateRepositoryConfigurationJob(AbstractRepositoryConnector connector,
- TaskRepository taskRepository);
-
- public abstract SubmitJob createSubmitTaskAttachmentJob(AbstractRepositoryConnector connector,
- TaskRepository taskRepository, ITask task, AbstractTaskAttachmentSource source, String comment,
- TaskAttribute attachmentAttribute);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskList.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskList.java
deleted file mode 100644
index 3cef26e37..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskList.java
+++ /dev/null
@@ -1,82 +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.core;
-
-import java.util.Set;
-
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-
-/**
- * @author Steffen Pingel
- * @author Robert Elves
- * @author Mik Kersten
- * @since 3.0
- */
-public interface ITaskList {
-
- public abstract void addChangeListener(ITaskListChangeListener listener);
-
- public abstract void addQuery(RepositoryQuery query) throws IllegalArgumentException;
-
- /**
- * Add orphaned task to the task list
- */
- public abstract void addTask(ITask task) throws IllegalArgumentException;
-
- /**
- * Precondition: {@code container} already exists in tasklist (be it a parent task, category, or query) If the
- * parentContainer is null the task is considered an orphan and added to the appropriate repository's orphaned tasks
- * container.
- *
- * @param task
- * to be added
- * @param container
- * task container, query or parent task must not be null
- */
- public abstract boolean addTask(ITask task, AbstractTaskContainer parentContainer);
-
- public abstract void deleteCategory(AbstractTaskCategory category);
-
- public abstract void deleteQuery(RepositoryQuery query);
-
- /**
- * TODO: refactor around querying containers for their tasks
- *
- * Task is removed from all containers: root, archive, category, and orphan bin
- *
- * Currently subtasks are not deleted but rather are rather potentially orphaned
- */
- public abstract void deleteTask(ITask task);
-
- public abstract Set<AbstractTaskCategory> getCategories();
-
- public abstract Set<RepositoryQuery> getQueries();
-
- /**
- * @since 2.0
- */
- public abstract ITask getTask(String repositoryUrl, String taskId);
-
- /**
- * @param task
- * list element
- */
- public abstract void notifyElementChanged(IRepositoryElement element);
-
- public abstract void notifySynchronizationStateChanged(IRepositoryElement element);
-
- public abstract void removeChangeListener(ITaskListChangeListener listener);
-
- /**
- * @since 3.0
- */
- public abstract void removeFromContainer(AbstractTaskContainer container, ITask task);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListChangeListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListChangeListener.java
deleted file mode 100644
index dc8147397..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListChangeListener.java
+++ /dev/null
@@ -1,24 +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.core;
-
-import java.util.Set;
-
-
-/**
- * Listener for task list modifications and task content modifications.
- *
- * @author Mik Kersten
- * @since 2.0
- */
-public interface ITaskListChangeListener {
-
- public abstract void containersChanged(Set<TaskContainerDelta> containers);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListRunnable.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListRunnable.java
deleted file mode 100644
index 9f13114d3..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskListRunnable.java
+++ /dev/null
@@ -1,20 +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.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Rob Elves
- */
-public interface ITaskListRunnable {
-
- public void execute(IProgressMonitor monitor) throws CoreException;
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskRepositoryFilter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskRepositoryFilter.java
deleted file mode 100644
index a3a8b6693..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITaskRepositoryFilter.java
+++ /dev/null
@@ -1,55 +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.core;
-
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Task repository filter to build list of repositories with required capabilities.
- *
- * @author Eugene Kleshov
- * @since 2.0
- */
-public interface ITaskRepositoryFilter {
-
- public static ITaskRepositoryFilter ALL = new ITaskRepositoryFilter() {
- public boolean accept(TaskRepository repository, AbstractRepositoryConnector connector) {
- return true;
- }
- };
-
- public static ITaskRepositoryFilter CAN_QUERY = new ITaskRepositoryFilter() {
- public boolean accept(TaskRepository repository, AbstractRepositoryConnector connector) {
- return !(connector instanceof LocalRepositoryConnector) && !repository.isOffline()
- && connector.canQuery(repository);
- }
- };
-
- public static ITaskRepositoryFilter CAN_CREATE_NEW_TASK = new ITaskRepositoryFilter() {
- public boolean accept(TaskRepository repository, AbstractRepositoryConnector connector) {
- return connector.canCreateNewTask(repository) && !repository.isOffline();
- }
- };
-
- public static ITaskRepositoryFilter CAN_CREATE_TASK_FROM_KEY = new ITaskRepositoryFilter() {
- public boolean accept(TaskRepository repository, AbstractRepositoryConnector connector) {
- return connector.canCreateTaskFromKey(repository) && !repository.isOffline();
- }
- };
-
- public static ITaskRepositoryFilter IS_USER_MANAGED = new ITaskRepositoryFilter() {
- public boolean accept(TaskRepository repository, AbstractRepositoryConnector connector) {
- return connector.isUserManaged();
- }
- };
-
- public abstract boolean accept(TaskRepository repository, AbstractRepositoryConnector connector);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITasksCoreConstants.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITasksCoreConstants.java
deleted file mode 100644
index 4a45ef451..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ITasksCoreConstants.java
+++ /dev/null
@@ -1,80 +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.core;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * @author Rob Elves
- */
-public interface ITasksCoreConstants {
-
- public static final int MAX_SUBTASK_DEPTH = 10;
-
- public static final String ID_PLUGIN = "org.eclipse.mylyn.tasks.core";
-
- public static final String OLD_TASK_LIST_FILE = "tasklist.xml";
-
- public static final String FILENAME_ENCODING = "UTF-8";
-
- public static final String PREFIX_TASKLIST = "tasklist";
-
- public static final String DEFAULT_BACKUP_FOLDER_NAME = "backup";
-
- public static final String FILE_EXTENSION = ".xml.zip";
-
- public static final String FILENAME_TIMESTAMP_FORMAT = "yyyy-MM-dd-HHmmss";
-
- public static final String DEFAULT_TASK_LIST_FILE = PREFIX_TASKLIST + FILE_EXTENSION;
-
- public static final String CONTEXTS_DIRECTORY = "contexts";
-
- public static final TaskListSchedulingRule ACTIVITY_SCHEDULING_RULE = new TaskListSchedulingRule();
-
- public static final TaskListSchedulingRule TASKLIST_SCHEDULING_RULE = new TaskListSchedulingRule();
-
- public static final ISchedulingRule ROOT_SCHEDULING_RULE = new RootSchedulingRule();
-
- static class ActivityContextSchedulingRule extends RootSchedulingRule {
- @Override
- public boolean contains(ISchedulingRule rule) {
- return rule instanceof ActivityContextSchedulingRule;
- }
-
- @Override
- public boolean isConflicting(ISchedulingRule rule) {
- return rule instanceof ActivityContextSchedulingRule;
- }
- }
-
- static class TaskListSchedulingRule extends RootSchedulingRule {
-
- @Override
- public boolean contains(ISchedulingRule rule) {
- return rule instanceof TaskListSchedulingRule;
- }
-
- @Override
- public boolean isConflicting(ISchedulingRule rule) {
- return rule instanceof TaskListSchedulingRule;
- }
- }
-
- static class RootSchedulingRule implements ISchedulingRule {
-
- public boolean contains(ISchedulingRule rule) {
- return rule instanceof RootSchedulingRule;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- return rule instanceof RootSchedulingRule;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IdentityAttributeFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IdentityAttributeFactory.java
deleted file mode 100644
index 6eb365db0..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IdentityAttributeFactory.java
+++ /dev/null
@@ -1,58 +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.core;
-
-import java.util.Date;
-
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractAttributeFactory;
-
-/**
- * @since 3.0
- * @author Steffen Pingel
- */
-@Deprecated
-public class IdentityAttributeFactory extends AbstractAttributeFactory {
-
- private static final IdentityAttributeFactory INSTANCE = new IdentityAttributeFactory();
-
- private static final long serialVersionUID = 1L;
-
- public static AbstractAttributeFactory getInstance() {
- return INSTANCE;
- }
-
- private IdentityAttributeFactory() {
- }
-
- @Override
- public Date getDateForAttributeType(String attributeKey, String dateString) {
- return null;
- }
-
- @Override
- public String getName(String key) {
- return null;
- }
-
- @Override
- public boolean isHidden(String key) {
- return false;
- }
-
- @Override
- public boolean isReadOnly(String key) {
- return false;
- }
-
- @Override
- public String mapCommonAttributeKey(String key) {
- return key;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalAttachment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalAttachment.java
deleted file mode 100644
index c8305a44c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalAttachment.java
+++ /dev/null
@@ -1,125 +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.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-
-import org.eclipse.mylyn.internal.tasks.core.deprecated.ITaskAttachment;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-
-/**
- * A class representing a local attachment.
- *
- * @author Jeff Pound
- * @since 2.0
- */
-@Deprecated
-public class LocalAttachment implements Serializable, ITaskAttachment {
-
- private static final long serialVersionUID = -4477699536552617389L;
-
- /** The report to which this attachment will be attached */
- private RepositoryTaskData repositoryTaskData;
-
- private String filePath;
-
- private String comment = "";
-
- private String description = "";
-
- private String contentType = "";
-
- private boolean isPatch = false;
-
- private String filename;
-
- private byte[] content;
-
- private File file;
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean isPatch() {
- return isPatch;
- }
-
- public void setPatch(boolean isPatch) {
- this.isPatch = isPatch;
- }
-
- public RepositoryTaskData getReport() {
- return repositoryTaskData;
- }
-
- public void setReport(RepositoryTaskData report) {
- this.repositoryTaskData = report;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public void setFilePath(String filePath) {
- this.filePath = filePath;
- }
-
- public String getFilename() {
- return this.filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public InputStream createInputStream() throws IOException {
- assert file != null || content != null;
- return (file != null) ? new FileInputStream(file) : new ByteArrayInputStream(content);
- }
-
- public long getLength() {
- assert file != null || content != null;
- return (file != null) ? file.length() : content.length;
- }
-
- public void setFile(File file) {
- this.file = file;
- }
-
- public void setContent(byte[] content) {
- this.content = content;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java
deleted file mode 100644
index ecb097e39..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java
+++ /dev/null
@@ -1,115 +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.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-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.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
-
-/**
- * @author Rob Elves
- */
-public class LocalRepositoryConnector extends AbstractRepositoryConnector {
-
- public static final String REPOSITORY_LABEL = "Local";
-
- public static final String CONNECTOR_KIND = "local";
-
- public static final String REPOSITORY_URL = "local";
-
- public static final String REPOSITORY_VERSION = "1";
-
- public static final String DEFAULT_SUMMARY = "New Task";
-
- @Override
- public boolean canCreateNewTask(TaskRepository repository) {
- return true;
- }
-
- @Override
- public boolean canCreateTaskFromKey(TaskRepository repository) {
- return false;
- }
-
- @Override
- public String getLabel() {
- return "Local Task Repository";
- }
-
- @Override
- public String getConnectorKind() {
- return CONNECTOR_KIND;
- }
-
- @Override
- public String getRepositoryUrlFromTaskUrl(String taskFullUrl) {
- // ignore
- return null;
- }
-
- @Override
- public String getTaskIdFromTaskUrl(String taskFullUrl) {
- // ignore
- return null;
- }
-
- @Override
- public String getTaskUrl(String repositoryUrl, String taskId) {
- // ignore
- return null;
- }
-
- @Override
- public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, TaskDataCollector resultCollector,
- ISynchronizationSession event, IProgressMonitor monitor) {
- // ignore
- return null;
- }
-
- @Override
- public void updateRepositoryConfiguration(TaskRepository repository, IProgressMonitor monitor) throws CoreException {
- // ignore
- }
-
- @Override
- public boolean isUserManaged() {
- return false;
- }
-
- @Override
- public TaskData getTaskData(TaskRepository taskRepository, String taskId, IProgressMonitor monitor)
- throws CoreException {
- // ignore
- return null;
- }
-
- @Override
- public boolean hasChanged(TaskRepository taskRepository, ITask task, TaskData taskData) {
- // ignore
- return false;
- }
-
- @Override
- public void updateTaskFromTaskData(TaskRepository repository, ITask task, TaskData taskData) {
- // ignore
- }
-
- @Override
- public boolean hasLocalCompletionState(TaskRepository taskRepository, ITask task) {
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
deleted file mode 100644
index cf32a94d1..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
+++ /dev/null
@@ -1,53 +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.core;
-
-
-/**
- * @author Rob Elves
- */
-public class LocalTask extends AbstractTask {
-
- public static final String SYNC_DATE_NOW = "now";
-
- public LocalTask(String taskId, String summary) {
- super(LocalRepositoryConnector.REPOSITORY_URL, taskId, summary);
- }
-
- @Override
- public boolean isLocal() {
- return true;
- }
-
- @Override
- public String getConnectorKind() {
- return LocalRepositoryConnector.CONNECTOR_KIND;
- }
-
- @Override
- public boolean isNotified() {
- return true;
- }
-
- @Override
- public String getLastReadTimeStamp() {
- return SYNC_DATE_NOW;
- }
-
- @Override
- public String getOwner() {
- return LocalRepositoryConnector.CONNECTOR_KIND;
- }
-
- @Override
- public String getTaskKey() {
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTaskListFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTaskListFactory.java
deleted file mode 100644
index 0acf48978..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTaskListFactory.java
+++ /dev/null
@@ -1,36 +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.core;
-
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractTaskListFactory;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.w3c.dom.Element;
-
-/**
- * @author Rob Elves
- */
-public class LocalTaskListFactory extends AbstractTaskListFactory {
-
- @Override
- public boolean canCreate(ITask task) {
- return task instanceof LocalTask;
- }
-
- @Override
- public AbstractTask createTask(String repositoryUrl, String taskId, String summary, Element element) {
- LocalTask task = new LocalTask(taskId, summary);
- return task;
- }
-
- @Override
- public String getTaskElementName() {
- return AbstractTaskListFactory.KEY_TASK;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java
deleted file mode 100644
index 03b0ed4f2..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/OfflineDataStore.java
+++ /dev/null
@@ -1,68 +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.core;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-
-/**
- * This object holds RepositoryTaskData and is serialized to disk for offline storage.
- *
- * @author Rob Elves
- */
-@Deprecated
-class OfflineDataStore implements Serializable {
-
- private static final long serialVersionUID = -3909632088254980426L;
-
- /** Last new repository task taskId */
- private int lastNewRepositoryTaskId = 0;
-
- // Local changes to existing reports
- private final Map<String, Set<RepositoryTaskAttribute>> localEdits = new ConcurrentHashMap<String, Set<RepositoryTaskAttribute>>();
-
- /** Older version of Task Data */
- private final Map<String, RepositoryTaskData> oldTaskDataMap = new ConcurrentHashMap<String, RepositoryTaskData>();
-
- /** Newest version of the task data */
- private final Map<String, RepositoryTaskData> newTaskDataMap = new ConcurrentHashMap<String, RepositoryTaskData>();
-
- /** New unsubmitted repository task data */
- private final Map<String, RepositoryTaskData> unsubmittedTaskData = new ConcurrentHashMap<String, RepositoryTaskData>();
-
- public void setLastNewTaskId(int lastNumber) {
- lastNewRepositoryTaskId = new Integer(lastNumber);
- }
-
- public int getNextTaskId() {
- lastNewRepositoryTaskId++;
- return lastNewRepositoryTaskId;
- }
-
- public Map<String, RepositoryTaskData> getOldDataMap() {
- return oldTaskDataMap;
- }
-
- public Map<String, RepositoryTaskData> getNewDataMap() {
- return newTaskDataMap;
- }
-
- public Map<String, RepositoryTaskData> getUnsubmittedTaskData() {
- return unsubmittedTaskData;
- }
-
- public Map<String, Set<RepositoryTaskAttribute>> getLocalEdits() {
- return localEdits;
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/Person.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/Person.java
deleted file mode 100644
index 92f80669d..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/Person.java
+++ /dev/null
@@ -1,34 +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.core;
-
-
-/**
- * @author Rob Elves
- */
-public class Person extends AbstractTaskContainer {
-
- private final String connectorKind;
-
- private final String repositoryUrl;
-
- public Person(String email, String connectorKind, String repositoryUrl) {
- super(email);
- this.connectorKind = connectorKind;
- this.repositoryUrl = repositoryUrl;
- }
-
- public String getConnectorKind() {
- return connectorKind;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryExternalizationParticipant.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryExternalizationParticipant.java
deleted file mode 100644
index f0bc39e81..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryExternalizationParticipant.java
+++ /dev/null
@@ -1,115 +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.core;
-
-import java.io.File;
-
-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.ISchedulingRule;
-import org.eclipse.mylyn.internal.tasks.core.externalization.AbstractExternalizationParticipant;
-import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager;
-import org.eclipse.mylyn.tasks.core.IRepositoryListener;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public class RepositoryExternalizationParticipant extends AbstractExternalizationParticipant implements
- IRepositoryListener {
-
- private static final String DESCRIPTION = "Task Repositories";
-
- private final TaskRepositoryManager repositoryManager;
-
- private final ExternalizationManager externalizationManager;
-
- private boolean dirty = false;
-
- public RepositoryExternalizationParticipant(ExternalizationManager exManager, TaskRepositoryManager manager) {
- this.repositoryManager = manager;
- this.externalizationManager = exManager;
- this.repositoryManager.addListener(this);
- }
-
- @Override
- public String getDescription() {
- return DESCRIPTION;
- }
-
- @Override
- public ISchedulingRule getSchedulingRule() {
- return ITasksCoreConstants.TASKLIST_SCHEDULING_RULE;
- }
-
- @Override
- public boolean isDirty() {
- return dirty;
- }
-
- private void requestSave() {
- synchronized (RepositoryExternalizationParticipant.this) {
- dirty = true;
- }
- externalizationManager.requestSave();
- }
-
- @Override
- public void load(String rootPath, IProgressMonitor monitor) throws CoreException {
- File repositoriesFile = getFile(rootPath);
- try {
- repositoryManager.readRepositories(repositoriesFile.getAbsolutePath());
- } catch (Exception e) {
- if (restoreSnapshot(repositoriesFile)) {
- repositoryManager.readRepositories(repositoriesFile.getAbsolutePath());
- } else {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Failed to load repositories", e));
- }
- }
- }
-
- @Override
- public void save(String rootPath, IProgressMonitor monitor) throws CoreException {
- File repositoriesFile = getFile(rootPath);
- repositoryManager.saveRepositories(repositoriesFile.getAbsolutePath());
- synchronized (RepositoryExternalizationParticipant.this) {
- dirty = false;
- }
- }
-
- @Override
- public String getFileName() {
- return TaskRepositoryManager.DEFAULT_REPOSITORIES_FILE;
- }
-
- public void repositoryUrlChanged(TaskRepository repository, String oldUrl) {
- requestSave();
- }
-
- public void repositoriesRead() {
- // ignore
- }
-
- public void repositoryAdded(TaskRepository repository) {
- requestSave();
- }
-
- public void repositoryRemoved(TaskRepository repository) {
- requestSave();
- }
-
- public void repositorySettingsChanged(TaskRepository repository) {
- requestSave();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java
deleted file mode 100644
index 8c4e2393d..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java
+++ /dev/null
@@ -1,63 +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.core;
-
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Steffen Pingel
- */
-public class RepositoryPerson implements IRepositoryPerson {
-
- private String name;
-
- private final String personId;
-
- private final TaskRepository taskRepository;
-
- public RepositoryPerson(TaskRepository taskRepository, String personId) {
- this.taskRepository = taskRepository;
- this.personId = personId;
- }
-
- public String getConnectorKind() {
- return taskRepository.getConnectorKind();
- }
-
- public String getName() {
- return name;
- }
-
- public String getPersonId() {
- return personId;
- }
-
- public String getRepositoryUrl() {
- return taskRepository.getRepositoryUrl();
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- if (getName() == null) {
- return getPersonId();
- } else {
- return getName() + " <" + getPersonId() + ">";
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryQuery.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryQuery.java
deleted file mode 100644
index a14d8e3f5..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryQuery.java
+++ /dev/null
@@ -1,141 +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.core;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-
-/**
- * @author Mik Kersten
- * @author Eugene Kuleshov
- * @author Rob Elves
- */
-public class RepositoryQuery extends AbstractTaskContainer implements IRepositoryQuery {
-
- private final String connectorKind;
-
- protected String lastSynchronizedStamp = "<never>";
-
- protected String repositoryUrl;
-
- protected IStatus status;
-
- private boolean synchronizing;
-
- private String summary;
-
- private Map<String, String> attributes;
-
- @Deprecated
- public RepositoryQuery(String description) {
- this("", description);
- }
-
- public RepositoryQuery(String connectorKind, String handle) {
- super(handle);
- this.connectorKind = connectorKind;
- setSummary(handle);
- }
-
- /**
- * @since 3.0
- */
- public String getConnectorKind() {
- return connectorKind;
- }
-
- // TODO: should be a date
- public String getLastSynchronizedTimeStamp() {
- return lastSynchronizedStamp;
- }
-
- @Override
- public String getPriority() {
- if (super.isEmpty()) {
- return PriorityLevel.P1.toString();
- }
- String highestPriority = PriorityLevel.P5.toString();
- for (ITask hit : getChildren()) {
- if (highestPriority.compareTo(hit.getPriority()) > 0) {
- highestPriority = hit.getPriority();
- }
- }
- return highestPriority;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public IStatus getStatus() {
- return status;
- }
-
- // TODO: move higher up and merge with AbstractTask
- public boolean isSynchronizing() {
- return synchronizing;
- }
-
- public void setLastSynchronizedStamp(String lastRefreshTimeStamp) {
- this.lastSynchronizedStamp = lastRefreshTimeStamp;
- }
-
- public void setRepositoryUrl(String newRepositoryUrl) {
- String url = getUrl();
- if (repositoryUrl != null && url != null && url.startsWith(repositoryUrl)) {
- // change corresponding part of the query URL
- setUrl(newRepositoryUrl + url.substring(repositoryUrl.length()));
- }
- this.repositoryUrl = newRepositoryUrl;
- }
-
- public void setStatus(IStatus status) {
- this.status = status;
- }
-
- public void setSynchronizing(boolean synchronizing) {
- this.synchronizing = synchronizing;
- }
-
- @Override
- public String getSummary() {
- return summary;
- }
-
- public void setSummary(String summary) {
- this.summary = summary;
- }
-
- public synchronized String getAttribute(String key) {
- return (attributes != null) ? attributes.get(key) : null;
- }
-
- public synchronized Map<String, String> getAttributes() {
- if (attributes != null) {
- return new HashMap<String, String>(attributes);
- } else {
- return Collections.emptyMap();
- }
- }
-
- public synchronized void setAttribute(String key, String value) {
- Assert.isNotNull(key);
- if (attributes == null) {
- attributes = new HashMap<String, String>();
- }
- attributes.put(key, value);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTaskHandleUtil.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTaskHandleUtil.java
deleted file mode 100644
index 9006728a5..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTaskHandleUtil.java
+++ /dev/null
@@ -1,54 +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.core;
-
-/**
- * @author Mik Kersten
- */
-public class RepositoryTaskHandleUtil {
-
- public static final String HANDLE_DELIM = "-";
-
- private static final String MISSING_REPOSITORY = "norepository";
-
- public static String getHandle(String repositoryUrl, String taskId) {
- if (!isValidTaskId(taskId)) {
- throw new RuntimeException("invalid handle for task, can not contain: " + HANDLE_DELIM + ", was: " + taskId);
- }
-
- if (repositoryUrl == null) {
- return MISSING_REPOSITORY + HANDLE_DELIM + taskId;
- } else {
- return repositoryUrl + HANDLE_DELIM + taskId;
- }
- }
-
- public static String getRepositoryUrl(String taskHandle) {
- int index = taskHandle.lastIndexOf(RepositoryTaskHandleUtil.HANDLE_DELIM);
- String url = null;
- if (index != -1) {
- url = taskHandle.substring(0, index);
- }
- return url;
- }
-
- public static String getTaskId(String taskHandle) {
- int index = taskHandle.lastIndexOf(HANDLE_DELIM);
- if (index != -1) {
- String id = taskHandle.substring(index + 1);
- return id;
- }
- return null;
- }
-
- public static boolean isValidTaskId(String taskId) {
- return !taskId.contains(HANDLE_DELIM);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTemplateManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTemplateManager.java
deleted file mode 100644
index 13f53d18a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryTemplateManager.java
+++ /dev/null
@@ -1,57 +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.core;
-
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
-
-/**
- * @author Steffen Pingel
- */
-public class RepositoryTemplateManager {
-
- private Map<String, Set<RepositoryTemplate>> templateByConnectorKind;
-
- public synchronized void addTemplate(String connectorKind, RepositoryTemplate template) {
- getTemplates(connectorKind).add(template);
- }
-
- public synchronized Set<RepositoryTemplate> getTemplates(String connectorKind) {
- if (templateByConnectorKind == null) {
- templateByConnectorKind = new HashMap<String, Set<RepositoryTemplate>>();
- }
- Set<RepositoryTemplate> templates = templateByConnectorKind.get(connectorKind);
- if (templates == null) {
- templates = new LinkedHashSet<RepositoryTemplate>();
- templateByConnectorKind.put(connectorKind, templates);
- }
- return templates;
- }
-
- public synchronized void removeTemplate(String connectorKind, RepositoryTemplate template) {
- getTemplates(connectorKind).remove(template);
- }
-
- /**
- * Returns null if template not found.
- */
- public synchronized RepositoryTemplate getTemplate(String connectorKind, String label) {
- for (RepositoryTemplate template : getTemplates(connectorKind)) {
- if (template.label.equals(label)) {
- return template;
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesContentHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesContentHandler.java
deleted file mode 100644
index 37e415f86..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesContentHandler.java
+++ /dev/null
@@ -1,55 +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.core;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Adapted from SaxContextContentHandler
- *
- * @author Rob Elves
- */
-public class SaxRepositoriesContentHandler extends DefaultHandler {
-
- static final String ATTRIBUTE_INTERACTION_EVENT = "InteractionEvent";
-
- private final Set<TaskRepository> taskRepositories = new HashSet<TaskRepository>();
-
- @SuppressWarnings( { "deprecation", "restriction" })
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- try {
- if (localName.equals(TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY) && attributes != null) {
- String kind = org.eclipse.mylyn.internal.commons.core.XmlStringConverter.convertXmlToString(attributes.getValue(IRepositoryConstants.PROPERTY_CONNECTOR_KIND));
- String url = org.eclipse.mylyn.internal.commons.core.XmlStringConverter.convertXmlToString(attributes.getValue(IRepositoryConstants.PROPERTY_URL));
- if (kind != null && kind.length() > 0 && url != null && url.length() > 0) {
- TaskRepository repository = new TaskRepository(kind, url);
- for (int index = 0; index < attributes.getLength(); index++) {
- String key = org.eclipse.mylyn.internal.commons.core.XmlStringConverter.convertXmlToString(attributes.getLocalName(index));
- String value = org.eclipse.mylyn.internal.commons.core.XmlStringConverter.convertXmlToString(attributes.getValue(index));
- repository.setProperty(key, value);
- }
- taskRepositories.add(repository);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- public Set<TaskRepository> getRepositories() {
- return taskRepositories;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java
deleted file mode 100644
index 38a5c5590..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java
+++ /dev/null
@@ -1,190 +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.core;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * Adapted from SaxContextWriter
- *
- * @author Rob Elves
- */
-public class SaxRepositoriesWriter {
-
- private OutputStream outputStream;
-
- public void setOutputStream(OutputStream outputStream) {
- this.outputStream = outputStream;
- }
-
- public void writeRepositoriesToStream(Collection<TaskRepository> repositories) throws IOException {
- if (outputStream == null) {
- IOException ioe = new IOException("OutputStream not set");
- throw ioe;
- }
-
- try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.transform(
- new SAXSource(new RepositoriesWriter(), new TaskRepositoriesInputSource(repositories)),
- new StreamResult(outputStream));
- } catch (TransformerException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Could not write repositories",
- e));
- throw new IOException(e.getMessage());
- }
-
- }
-
- private static class TaskRepositoriesInputSource extends InputSource {
- private final Collection<TaskRepository> repositories;
-
- public TaskRepositoriesInputSource(Collection<TaskRepository> repositories) {
- this.repositories = repositories;
- }
-
- public Collection<TaskRepository> getRepositories() {
- return this.repositories;
- }
-
- }
-
- private static class RepositoriesWriter implements XMLReader {
-
-// private static final String ELEMENT_TASK_REPOSITORIES = "TaskRepositories";
-//
-// public static final String ELEMENT_TASK_REPOSITORY = "TaskRepository";
-//
-// private static final String ATTRIBUTE_VERSION = "xmlVersion";
-
-// private static final String ATTRIBUTE_URL = "Url";
-//
-// private static final String ATTRIBUTE_KIND = "Kind";
-
- private ContentHandler handler;
-
- private ErrorHandler errorHandler;
-
- public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
- return false;
- }
-
- public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
-
- }
-
- public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
- return null;
- }
-
- public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public EntityResolver getEntityResolver() {
- return null;
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public DTDHandler getDTDHandler() {
- return null;
- }
-
- public void setContentHandler(ContentHandler handler) {
- this.handler = handler;
-
- }
-
- public ContentHandler getContentHandler() {
- return handler;
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- this.errorHandler = handler;
-
- }
-
- public ErrorHandler getErrorHandler() {
- return errorHandler;
- }
-
- @SuppressWarnings( { "deprecation", "restriction" })
- public void parse(InputSource input) throws IOException, SAXException {
- if (!(input instanceof TaskRepositoriesInputSource)) {
- throw new SAXException("Can only parse writable input sources");
- }
-
- Collection<TaskRepository> repositories = ((TaskRepositoriesInputSource) input).getRepositories();
-
- handler.startDocument();
- AttributesImpl rootAttributes = new AttributesImpl();
- rootAttributes.addAttribute("", TaskRepositoriesExternalizer.ATTRIBUTE_VERSION,
- TaskRepositoriesExternalizer.ATTRIBUTE_VERSION, "", "1");
-
- handler.startElement("", TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORIES,
- TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORIES, rootAttributes);
-
- for (TaskRepository repository : new ArrayList<TaskRepository>(repositories)) {
-
- AttributesImpl ieAttributes = new AttributesImpl();
- for (String key : repository.getProperties().keySet()) {
- ieAttributes.addAttribute(
- "",
- key,
- key,
- "",
- org.eclipse.mylyn.internal.commons.core.XmlStringConverter.convertToXmlString(repository.getProperties()
- .get(key)));
- }
-
- handler.startElement("", TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY,
- TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY, ieAttributes);
- handler.endElement("", TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY,
- TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORY);
- }
- handler.endElement("", TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORIES,
- TaskRepositoriesExternalizer.ELEMENT_TASK_REPOSITORIES);
-
- handler.endDocument();
- }
-
- public void parse(String systemId) throws IOException, SAXException {
- throw new SAXException("Can only parse writable input sources");
- }
-
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
deleted file mode 100644
index 702881a80..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskContainer.java
+++ /dev/null
@@ -1,209 +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.core;
-
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-
-/**
- * @author Rob Elves
- * @author Mik Kersten
- */
-public class ScheduledTaskContainer extends AbstractTaskContainer {
-
- private final TaskActivityManager activityManager;
-
- private final String summary;
-
- private final DateRange range;
-
- public ScheduledTaskContainer(TaskActivityManager activityManager, DateRange range, String summary) {
- super(summary == null ? range.toString() : summary);
- this.activityManager = activityManager;
- this.range = range;
- if (summary == null) {
- this.summary = range.toString();
- } else {
- this.summary = summary;
- }
- }
-
- public ScheduledTaskContainer(TaskActivityManager taskActivityManager, DateRange day) {
- this(taskActivityManager, day, null);
- }
-
- public boolean isFuture() {
- return !isPresent() && range.getStartDate().after(Calendar.getInstance());
- }
-
- public boolean isPresent() {
- return range.getStartDate().before(Calendar.getInstance()) && range.getEndDate().after(Calendar.getInstance());
- }
-
- public boolean isWeekDay() {
- return TaskActivityUtil.getCurrentWeek().isCurrentWeekDay(range);
- }
-
- public boolean isToday() {
- return isPresent()
- && range.getStartDate().get(Calendar.DAY_OF_YEAR) == range.getEndDate().get(Calendar.DAY_OF_YEAR);
- }
-
-// public Collection<ITask> getChildren() {
-// Set<ITask> children = new HashSet<ITask>();
-// Calendar beginning = TaskActivityUtil.getCalendar();
-// beginning.setTimeInMillis(0);
-// if (isFloating() && !isFuture()) {
-// for (ITask task : activityManager.getScheduledTasks(rangebeginning, getEndDate())) {
-// if (task.internalIsFloatingScheduledDate()) {
-// children.add(task);
-// }
-// }
-// } else if (isPresent()) {
-// // add all due/overdue
-// Calendar end = TaskActivityUtil.getCalendar();
-// end.set(5000, 12, 1);
-// for (ITask task : activityManager.getDueTasks(beginning, getEndDate())) {
-// if (activityManager.isOwnedByUser(task)) {
-// children.add(task);
-// }
-// }
-//
-// // add all scheduled/overscheduled
-// for (ITask task : activityManager.getScheduledTasks(beginning, getEndDate())) {
-// if (!task.internalIsFloatingScheduledDate() && !task.isCompleted()) {
-// children.add(task);
-// }
-// }
-//
-// // if not scheduled or due in future, and is active, place in today bin
-// ITask activeTask = activityManager.getActiveTask();
-// if (activeTask != null && !children.contains(activeTask)) {
-// Set<ITask> futureScheduled = activityManager.getScheduledTasks(getStartDate(), end);
-// for (ITask task : activityManager.getDueTasks(getStartDate(), end)) {
-// if (activityManager.isOwnedByUser(task)) {
-// futureScheduled.add(task);
-// }
-// }
-// if (!futureScheduled.contains(activeTask)) {
-// children.add(activeTask);
-// }
-// }
-// } else if (isFuture()) {
-// children.addAll(activityManager.getScheduledTasks(getStartDate(), getEndDate()));
-// for (ITask task : activityManager.getDueTasks(getStartDate(), getEndDate())) {
-// if (activityManager.isOwnedByUser(task)) {
-// children.add(task);
-// }
-// }
-// } else {
-// children.addAll(activityManager.getActiveTasks(range.getStartDate(), range.getEndDate()));
-// }
-// return children;
-// }
-
- @Override
- public Collection<ITask> getChildren() {
-
- // TODO: Cache this information until the next modificaiton to pertinent data
-
- Set<ITask> children = new HashSet<ITask>();
-
- // All tasks scheduled for this date range
- for (ITask task : activityManager.getScheduledTasks(range)) {
- if (!task.isCompleted()) {
- children.add(task);
- }
- }
-
- // Add due tasks if not the This Week container
- if (!(range instanceof WeekDateRange && isPresent())) {
- for (ITask task : activityManager.getDueTasks(range.getStartDate(), range.getEndDate())) {
- if (activityManager.isOwnedByUser(task)) {
- children.add(task);
- }
- }
- }
-
- // All over due/scheduled tasks are present in the Today folder
- if (isToday()) {
- children.addAll(activityManager.getOverScheduledTasks());
- children.addAll(activityManager.getOverDueTasks());
-
- // if not scheduled or due in future, and is active, place in today bin
- ITask activeTask = activityManager.getActiveTask();
- if (activeTask != null && !children.contains(activeTask)) {
- children.add(activeTask);
- }
-
- }
-
- return children;
- }
-
- @Override
- public String getSummary() {
- if (summary != null) {
- return summary;
- }
- return range.toString();
- }
-
- @Override
- public String getHandleIdentifier() {
- return summary;
- }
-
- @Override
- public String getPriority() {
- return "";
- }
-
- @Override
- public String getUrl() {
- return "";
- }
-
- @Override
- public int compareTo(IRepositoryElement element) {
- if (element instanceof ScheduledTaskContainer) {
- ScheduledTaskContainer container = ((ScheduledTaskContainer) element);
- return range.compareTo(container.getDateRange());
- }
- return 0;
- }
-
- public DateRange getDateRange() {
- return range;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public Calendar getEnd() {
- return range.getEndDate();
- }
-
- public Calendar getStart() {
- return range.getStartDate();
- }
-
- public boolean includes(Calendar pastWeeksTaskStart) {
- return range.includes(pastWeeksTaskStart);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivationHistory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivationHistory.java
deleted file mode 100644
index de6d78417..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivationHistory.java
+++ /dev/null
@@ -1,112 +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.core;
-
-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 org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * @author Ken Sueda (original prototype)
- * @author Wesley Coelho (Added persistent tasks)
- * @author Mik Kersten (hardening)
- * @author Rob Elves
- */
-public class TaskActivationHistory {
-
- private final List<AbstractTask> history = new ArrayList<AbstractTask>();
-
- private int currentIndex = -1;
-
- public void addTask(AbstractTask task) {
- history.remove(task);
- history.add(task);
- currentIndex = history.size() - 1;
- }
-
- public boolean containsTask(ITask task) {
- return history.contains(task);
- }
-
- public boolean removeTask(ITask task) {
- return history.remove(task);
- }
-
- public AbstractTask getPreviousTask() {
- boolean active = false;
- for (AbstractTask task : history) {
- if (task.isActive()) {
- active = true;
- break;
- }
- }
-
- if (hasPrevious()) {
- if (!active) {
- return history.get(currentIndex);
- }
-
- if (currentIndex < history.size() - 1 && ((currentIndex == 0 && !history.get(currentIndex).isActive()))) {
- return history.get(currentIndex);
- } else if (currentIndex > 0 && currentIndex < history.size()) {
- return history.get(--currentIndex);
- }
- }
- return null;
- }
-
- public List<AbstractTask> getPreviousTasks() {
- return Collections.unmodifiableList(new ArrayList<AbstractTask>(history));
- }
-
- /**
- * Returns task activation history for tasks present in <code>containers</code>
- */
- public List<AbstractTask> getPreviousTasks(Set<AbstractTaskContainer> containers) {
- if (containers.isEmpty()) {
- return getPreviousTasks();
- }
- Set<ITask> allWorkingSetTasks = new HashSet<ITask>();
- for (ITaskContainer container : containers) {
- allWorkingSetTasks.addAll(container.getChildren());
- }
- List<AbstractTask> allScopedTasks = new ArrayList<AbstractTask>(getPreviousTasks());
- for (Iterator<AbstractTask> it = allScopedTasks.iterator(); it.hasNext();) {
- AbstractTask task = it.next();
- if (!allWorkingSetTasks.contains(task)) {
- it.remove();
- }
- }
- return Collections.unmodifiableList(allScopedTasks);
- }
-
- public boolean hasPrevious() {
- return (currentIndex == 0 && !history.get(currentIndex).isActive()) || currentIndex > 0;
- }
-
- public void clear() {
- history.clear();
- currentIndex = -1;
- }
-
- public int indexOf(ITask task) {
- return history.indexOf(task);
-
- }
-
- public int getSize() {
- return history.size();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
deleted file mode 100644
index d2b06124b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityManager.java
+++ /dev/null
@@ -1,796 +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.core;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-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.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivationListener;
-import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
-import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
-
-/**
- * Manages task elapsed time, scheduling, due dates, and the date ranges
- *
- * @since 2.1
- * @author Rob Elves
- */
-public class TaskActivityManager implements ITaskActivityManager {
-
- // From ActivityContextManager (not visible)
- private static final char WORKINGSET_DELIMETER = '\u200B'; // unicode zero width space
-
- private final TaskActivationHistory taskActivationHistory = new TaskActivationHistory();
-
- private final List<ITaskActivityListener> activityListeners = new ArrayList<ITaskActivityListener>();
-
- private final List<ITaskActivationListener> activationListeners = new ArrayList<ITaskActivationListener>();
-
- private final Set<ITask> allScheduledTasks = new HashSet<ITask>();
-
- private final Set<ITask> allDueTasks = new HashSet<ITask>();
-
- private final SortedMap<DateRange, Set<ITask>> scheduledTasks = Collections.synchronizedSortedMap(new TreeMap<DateRange, Set<ITask>>());
-
- private final SortedMap<Calendar, Set<ITask>> dueTasks = Collections.synchronizedSortedMap(new TreeMap<Calendar, Set<ITask>>());
-
- // Map of Calendar (hour) to Tasks active during that hour
- private final SortedMap<Calendar, Set<AbstractTask>> activeTasks = Collections.synchronizedSortedMap(new TreeMap<Calendar, Set<AbstractTask>>());
-
- // For a given task maps Calendar Hour to duration of time spent (milliseconds) with task active
- private final Map<AbstractTask, SortedMap<Calendar, Long>> taskElapsedTimeMap = new ConcurrentHashMap<AbstractTask, SortedMap<Calendar, Long>>();
-
- private final SortedMap<Calendar, Long> noTaskActiveMap = Collections.synchronizedSortedMap(new TreeMap<Calendar, Long>());
-
- private final TaskList taskList;
-
- private final TaskRepositoryManager repositoryManager;
-
- private ITask activeTask;
-
- private int startDay = Calendar.MONDAY;
-
- private final ITaskListChangeListener TASKLIST_CHANGE_LISTENER = new ITaskListChangeListener() {
-
- public void containersChanged(Set<TaskContainerDelta> containers) {
- for (TaskContainerDelta taskContainerDelta : containers) {
- if (taskContainerDelta.getKind() == TaskContainerDelta.Kind.ROOT) {
- reloadPlanningData();
- }
- }
- }
- };
-
- public TaskActivityManager(TaskRepositoryManager repositoryManager, TaskList taskList) {
- this.taskList = taskList;
- this.repositoryManager = repositoryManager;
- this.taskList.addChangeListener(TASKLIST_CHANGE_LISTENER);
- clear();
- }
-
- /**
- * Get the user specified first day of the week (Calendar.SUNDAY | Calendar.MONDAY)
- *
- * @see http://en.wikipedia.org/wiki/Days_of_the_week#First_day_of_the_week
- */
- public int getWeekStartDay() {
- return startDay;
- }
-
- /**
- * Set the first day of the week (Calendar.SUNDAY | Calendar.MONDAY)
- *
- * @see http://en.wikipedia.org/wiki/Days_of_the_week#First_day_of_the_week
- *
- * @param startDay
- * (Calendar.SUNDAY | Calendar.MONDAY)
- */
- public void setWeekStartDay(int startDay) {
- TaskActivityUtil.setStartDay(startDay);
- this.startDay = startDay;
- for (ITaskActivityListener listener : activityListeners) {
- listener.activityReset();
- }
- }
-
- public void addActivityListener(ITaskActivityListener listener) {
- activityListeners.add(listener);
- }
-
- public void removeActivityListener(ITaskActivityListener listener) {
- activityListeners.remove(listener);
- }
-
- public void addActivationListener(ITaskActivationListener listener) {
- activationListeners.add(listener);
- }
-
- public void removeActivationListener(ITaskActivationListener listener) {
- activationListeners.remove(listener);
- }
-
- public void clear() {
- dueTasks.clear();
- allDueTasks.clear();
- scheduledTasks.clear();
- allScheduledTasks.clear();
- clearActivity();
- }
-
- public void clearActivity() {
- activeTasks.clear();
- taskActivationHistory.clear();
- taskElapsedTimeMap.clear();
- noTaskActiveMap.clear();
- }
-
- public void reloadPlanningData() {
- reloadScheduledData();
- for (ITaskActivityListener listener : activityListeners) {
- listener.activityReset();
- }
- }
-
- public void removeElapsedTime(ITask task, Date startDate, Date endDate) {
- Assert.isNotNull(task);
- Assert.isNotNull(startDate);
- Assert.isNotNull(endDate);
- // remove any time that has already accumulated in data structures
- SortedMap<Calendar, Long> activityMap = taskElapsedTimeMap.get(task);
- if (activityMap != null) {
- Calendar start = TaskActivityUtil.getCalendar();
- start.setTime(startDate);
- TaskActivityUtil.snapStartOfHour(start);
- Calendar end = TaskActivityUtil.getCalendar();
- end.setTime(endDate);
- TaskActivityUtil.snapEndOfHour(end);
- activityMap = activityMap.subMap(start, end);
- for (Calendar cal : new HashSet<Calendar>(activityMap.keySet())) {
- activityMap.remove(cal);
- }
- for (ITaskActivityListener listener : new ArrayList<ITaskActivityListener>(activityListeners)) {
- try {
- listener.elapsedTimeUpdated(task, getElapsedTime(task));
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Task activity listener failed: \"" + listener + "\"", t));
- }
- }
- }
-
- }
-
- public void addElapsedNoTaskActive(String handle, Date startDate, Date endDate) {
-
- // 3.0 TODO: break out working set ids and store time per working set
-// if (handle != null && !handle.equals("none")) {
-// String[] parts = handle.split("" + WORKINGSET_DELIMETER);
-// }
-
- long attentionSpan = endDate.getTime() - startDate.getTime();
-
- // Ignore any potential negative or zero times
- if (attentionSpan <= 0) {
- return;
- }
-
- // granularity to the hour
- Calendar hourOfDay = TaskActivityUtil.getCalendar();
- hourOfDay.setTime(startDate);
- snapToStartOfHour(hourOfDay);
- Long daysActivity = noTaskActiveMap.get(hourOfDay);
- if (daysActivity == null) {
- daysActivity = new Long(0);
- }
-
- daysActivity = daysActivity.longValue() + attentionSpan;
-
- noTaskActiveMap.put(hourOfDay, daysActivity);
- }
-
- public long getElapsedNoTaskActive(Calendar startDate, Calendar endDate) {
-
- Calendar startRange = snapToStartOfHour(getNewInstance(startDate));
-
- Calendar endRange = snapToEndOfHour(getNewInstance(endDate));
- long result = 0;
- Map<Calendar, Long> subMap = noTaskActiveMap.subMap(startRange, endRange);
- for (Long time : subMap.values()) {
- if (time != null && time > 0) {
- result += time.longValue();
- }
- }
- return result;
- }
-
- public void addElapsedTime(AbstractTask task, Date startDate, Date endDate) {
- Assert.isNotNull(task);
- Assert.isNotNull(startDate);
- Assert.isNotNull(endDate);
-
- SortedMap<Calendar, Long> activityMap = taskElapsedTimeMap.get(task);
- if (activityMap == null) {
- activityMap = Collections.synchronizedSortedMap(new TreeMap<Calendar, Long>());
- taskElapsedTimeMap.put(task, activityMap);
- }
-
- long attentionSpan = endDate.getTime() - startDate.getTime();
-
- // Ignore any potential negative or zero times
- if (attentionSpan <= 0) {
- return;
- }
-
- // granularity to the hour
- Calendar hourOfDay = TaskActivityUtil.getCalendar();
- hourOfDay.setTime(startDate);
- snapToStartOfHour(hourOfDay);
- Long daysActivity = activityMap.get(hourOfDay);
- if (daysActivity == null) {
- daysActivity = new Long(0);
- }
-
- daysActivity = daysActivity.longValue() + attentionSpan;
-
- activityMap.put(hourOfDay, daysActivity);
-
- Set<AbstractTask> active = activeTasks.get(hourOfDay);
- if (active == null) {
- active = new HashSet<AbstractTask>();
- activeTasks.put(hourOfDay, active);
- }
- active.add(task);
-
- long totalElapsed = getElapsedTime(activityMap);
-
- for (ITaskActivityListener listener : new ArrayList<ITaskActivityListener>(activityListeners)) {
- try {
- listener.elapsedTimeUpdated(task, totalElapsed);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Task activity listener failed: \"" + listener + "\"", t));
- }
- }
- }
-
- private Calendar getNewInstance(Calendar cal) {
- Calendar newCal = TaskActivityUtil.getCalendar();
- newCal.setTimeInMillis(cal.getTimeInMillis());
- return newCal;
- }
-
- public void addScheduledTask(AbstractTask task) {
- DateRange range = task.getScheduledForDate();
- if (range != null) {
- Set<ITask> tasks = scheduledTasks.get(range);
- if (tasks == null) {
- tasks = new CopyOnWriteArraySet<ITask>();
- scheduledTasks.put(range, tasks);
- }
- tasks.add(task);
- allScheduledTasks.add(task);
- } else {
- removeScheduledTask(task);
- }
- }
-
- public void removeScheduledTask(ITask task) {
- synchronized (scheduledTasks) {
- for (Set<ITask> setOfTasks : scheduledTasks.values()) {
- setOfTasks.remove(task);
- }
- allScheduledTasks.remove(task);
- }
- }
-
- public Set<ITask> getScheduledTasks(DateRange range) {
- Set<ITask> resultingTasks = new HashSet<ITask>();
- synchronized (scheduledTasks) {
- Set<ITask> result = scheduledTasks.get(range);
- if (result != null && !result.isEmpty()) {
- resultingTasks.addAll(result);
- }
- }
- return resultingTasks;
- }
-
- public Set<ITask> getScheduledTasks(Calendar start, Calendar end) {
- Set<ITask> resultingTasks = new HashSet<ITask>();
- synchronized (scheduledTasks) {
- DateRange startRange = new DateRange(start);
- DateRange endRange = new DateRange(end);
- SortedMap<DateRange, Set<ITask>> result = scheduledTasks.subMap(startRange, endRange);
- for (Set<ITask> set : result.values()) {
- resultingTasks.addAll(set);
- }
- }
- return resultingTasks;
- }
-
- public void addDueTask(ITask task) {
- if (task.getDueDate() == null) {
- removeDueTask(task);
- return;
- }
- Calendar time = TaskActivityUtil.getCalendar();
- time.setTime(task.getDueDate());
- snapToStartOfHour(time);
- synchronized (dueTasks) {
- Set<ITask> tasks = dueTasks.get(time);
- if (tasks == null) {
- tasks = new CopyOnWriteArraySet<ITask>();
- dueTasks.put(time, tasks);
- }
- tasks.add(task);
- allDueTasks.add(task);
- }
-
- }
-
- public void removeDueTask(ITask task) {
- synchronized (dueTasks) {
- for (Set<ITask> setOfTasks : dueTasks.values()) {
- setOfTasks.remove(task);
- }
- allDueTasks.remove(task);
- }
- }
-
- public Set<ITask> getDueTasks(Calendar start, Calendar end) {
- Set<ITask> resultingTasks = new HashSet<ITask>();
- SortedMap<Calendar, Set<ITask>> result = dueTasks.subMap(start, end);
- synchronized (dueTasks) {
- for (Set<ITask> set : result.values()) {
- resultingTasks.addAll(set);
- }
- }
- return resultingTasks;
- }
-
- public void activateTask(ITask task) {
- deactivateActiveTask();
-
- // notify that a task is about to be activated
- for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) {
- try {
- listener.preTaskActivated(task);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Task activity listener failed: " + listener, t));
- }
- }
-
- activeTask = task;
- ((AbstractTask) activeTask).setActive(true);
-
- for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) {
- try {
- listener.taskActivated(task);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Task activity listener failed: " + listener, t));
- }
- }
- }
-
- public void deactivateActiveTask() {
- if (activeTask != null) {
- deactivateTask(activeTask);
- }
- }
-
- public void deactivateTask(ITask task) {
- if (task == null) {
- return;
- }
-
- if (task.isActive() && task == activeTask) {
- // notify that a task is about to be deactivated
- for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) {
- try {
- listener.preTaskDeactivated(task);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Notification failed for: " + listener, t));
- }
- }
-
- ((AbstractTask) activeTask).setActive(false);
- activeTask = null;
-
- for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) {
- try {
- listener.taskDeactivated(task);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Notification failed for: " + listener, t));
- }
- }
- }
- }
-
- /**
- * returns active tasks from start to end (exclusive) where both are snapped to the beginning of the hour
- */
- public Set<AbstractTask> getActiveTasks(Calendar start, Calendar end) {
- Set<AbstractTask> resultingTasks = new HashSet<AbstractTask>();
- Calendar startInternal = TaskActivityUtil.getCalendar();
- startInternal.setTimeInMillis(start.getTimeInMillis());
- TaskActivityUtil.snapStartOfHour(startInternal);
-
- Calendar endInternal = TaskActivityUtil.getCalendar();
- endInternal.setTimeInMillis(end.getTimeInMillis());
- TaskActivityUtil.snapStartOfHour(endInternal);
-
- synchronized (activeTasks) {
- SortedMap<Calendar, Set<AbstractTask>> result = activeTasks.subMap(startInternal, endInternal);
- for (Set<AbstractTask> set : result.values()) {
- resultingTasks.addAll(set);
- }
- }
- return resultingTasks;
- }
-
- /** total elapsed time based on activation history */
- public long getElapsedTime(ITask task) {
- SortedMap<Calendar, Long> activityMap = taskElapsedTimeMap.get(task);
- return getElapsedTime(activityMap);
- }
-
- private long getElapsedTime(SortedMap<Calendar, Long> activityMap) {
- // TODO: Keep a running total instead of recalculating all the time
- long result = 0;
- if (activityMap != null) {
- synchronized (activityMap) {
- for (Long time : activityMap.values()) {
- if (time != null) {
- result += time.longValue();
- }
- }
- }
- }
- return result;
- }
-
- /**
- * total elapsed time based on activation history passing null for the task will return all active time with no task
- * active
- */
- public long getElapsedTime(ITask task, Calendar start, Calendar end) {
-
- if (task == null) {
- return getElapsedNoTaskActive(start, end);
- }
-
- long result = 0;
-
- Calendar startRange = snapToStartOfHour(getNewInstance(start));
-
- Calendar endRange = snapToEndOfHour(getNewInstance(end));
-
- SortedMap<Calendar, Long> activityMap = taskElapsedTimeMap.get(task);
- if (activityMap != null) {
- synchronized (activityMap) {
- activityMap = activityMap.subMap(startRange, endRange);
- for (Long time : activityMap.values()) {
- if (time != null) {
- result += time.longValue();
- }
- }
- }
- }
- return result;
- }
-
- /** total elapsed time based on activation history */
- public long getElapsedTime(ITask task, DateRange range) {
- return getElapsedTime(task, range.getStartDate(), range.getEndDate());
- }
-
- // TODO: remove, copied from TaskListManager
- private Calendar snapToStartOfHour(Calendar cal) {
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.MILLISECOND, 0);
- cal.getTime();
- return cal;
- }
-
- // TODO: remove, copied from TaskListManager
- private Calendar snapToEndOfHour(Calendar cal) {
- cal.set(Calendar.MINUTE, cal.getMaximum(Calendar.MINUTE));
- cal.set(Calendar.SECOND, cal.getMaximum(Calendar.SECOND));
- cal.set(Calendar.MILLISECOND, cal.getMaximum(Calendar.MILLISECOND));
- cal.getTime();
- return cal;
- }
-
- public ITask getActiveTask() {
- return activeTask;
- }
-
- private void reloadScheduledData() {
- for (AbstractTask task : taskList.getAllTasks()) {
- if (task.getScheduledForDate() != null) {
- addScheduledTask(task);
- }
- if (task.getDueDate() != null) {
- addDueTask(task);
- }
- }
- }
-
- public void setScheduledFor(AbstractTask task, DateRange reminderDate) {
- Assert.isNotNull(task);
- if (reminderDate != null && !reminderDate.equals(task.getScheduledForDate())) {
- (task).setReminded(false);
- }
-
- (task).setScheduledForDate(reminderDate);
- if (reminderDate == null) {
- removeScheduledTask(task);
- } else {
- removeScheduledTask(task);
- addScheduledTask(task);
- }
- taskList.notifyElementChanged(task);
- }
-
- public void setDueDate(ITask task, Date dueDate) {
- task.setDueDate(dueDate);
- if (dueDate == null) {
- removeDueTask(task);
- } else {
- removeDueTask(task);
- addDueTask(task);
- }
- taskList.notifyElementChanged(task);
- }
-
- /**
- * @return if a repository task, will only return true if the user is a
- */
- public boolean isCompletedToday(ITask task) {
- if (task != null) {
- boolean isOwnedByUser = repositoryManager.isOwnedByUser(task);
- if (!isOwnedByUser) {
- return false;
- } else {
-
- Date completionDate = task.getCompletionDate();
- if (completionDate != null) {
- Calendar completedTime = TaskActivityUtil.getCalendar();
- completedTime.setTime(completionDate);
- return TaskActivityUtil.isToday(completedTime);
- }
- }
- }
- return false;
- }
-
- public boolean isPastReminder(AbstractTask task) {
- if (task == null || task.isCompleted() || task.getScheduledForDate() == null) {
- return false;
- } else {
- return isPastReminder(task.getScheduledForDate(), task.isCompleted());
- }
- }
-
- public boolean isPastReminder(DateRange date, boolean isComplete) {
- if (date == null || isComplete) {
- return false;
- } else {
- if (date.getEndDate().compareTo(TaskActivityUtil.getCalendar()) < 0) {
- return true;
- } else {
- return false;
- }
- }
- }
-
- public boolean isDueToday(ITask task) {
- if (repositoryManager.isOwnedByUser(task) && !task.isCompleted() && task.getDueDate() != null) {
- Calendar cal = TaskActivityUtil.getCalendar();
- cal.setTimeInMillis(task.getDueDate().getTime());
- if (TaskActivityUtil.isToday(cal)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isOverdue(ITask task) {
- return (!task.isCompleted() && task.getDueDate() != null && new Date().after(task.getDueDate()))
- && repositoryManager.isOwnedByUser(task);
- }
-
- public boolean isOwnedByUser(ITask task) {
- return repositoryManager.isOwnedByUser(task);
- }
-
- public boolean isActiveThisWeek(ITask task) {
- Calendar calStart = TaskActivityUtil.getCalendar();
- TaskActivityUtil.snapStartOfWorkWeek(calStart);
- Calendar calEnd = TaskActivityUtil.getCalendar();
- TaskActivityUtil.snapEndOfWeek(calEnd);
- return getElapsedTime(task, calStart, calEnd) > 0;
- }
-
- public boolean isScheduledForToday(AbstractTask task) {
- if (task != null && task.getScheduledForDate() != null) {
- return isScheduledForToday(task.getScheduledForDate());
- }
- return false;
- }
-
- public boolean isScheduledForToday(DateRange range) {
- if (range != null) {
- return TaskActivityUtil.getCurrentWeek().getToday().compareTo(range) == 0;
- }
- return false;
- }
-
- public boolean isScheduledAfterThisWeek(AbstractTask task) {
- if (task != null && task.getScheduledForDate() != null) {
- return isScheduledAfterThisWeek(task.getScheduledForDate());
- }
-
- return false;
- }
-
- public boolean isScheduledAfterThisWeek(DateRange range) {
- if (range != null) {
- return TaskActivityUtil.isAfterCurrentWeek(range.getStartDate());
- }
- return false;
- }
-
- public boolean isScheduledForFuture(AbstractTask task) {
- if (task != null && task.getScheduledForDate() != null) {
- return isScheduledForFuture(task.getScheduledForDate());
- }
- return false;
- }
-
- public boolean isScheduledForFuture(DateRange reminder) {
- if (reminder != null) {
- return TaskActivityUtil.isFuture(reminder.getStartDate());
- }
- return false;
- }
-
- public boolean isScheduledForThisWeek(AbstractTask task) {
- boolean result = false;
- if (task != null && task.getScheduledForDate() != null) {
- result = isScheduledForThisWeek(task.getScheduledForDate());
- }
- return result;
- }
-
- public boolean isScheduledForThisWeek(DateRange range) {
- if (range != null) {
-
- return TaskActivityUtil.getCurrentWeek().isCurrentWeekDay(range)
- || TaskActivityUtil.getCurrentWeek().compareTo(range) == 0;
- }
- return false;
- }
-
- public boolean isScheduledForNextWeek(AbstractTask task) {
- if (task != null) {
- DateRange range = task.getScheduledForDate();
- if (range != null) {
- return TaskActivityUtil.isNextWeek(range.getStartDate());
- }
- }
- return false;
- }
-
- public void scheduleNewTask(AbstractTask newTask) {
- newTask.setCreationDate(new Date());
- // TODO: set based on preference? see bug#158461
- setScheduledFor(newTask, TaskActivityUtil.getCurrentWeek());
- }
-
- public boolean isDueThisWeek(ITask task) {
- Date due = task.getDueDate();
- if (due != null && repositoryManager.isOwnedByUser(task)) {
- Calendar cal = TaskActivityUtil.getCalendar();
- cal.setTime(due);
- return TaskActivityUtil.isThisWeek(cal);
- }
- return false;
- }
-
- public Set<ITask> getScheduledForThisWeek() {
- return getScheduledTasks(TaskActivityUtil.getCurrentWeek());
- }
-
- public TaskActivationHistory getTaskActivationHistory() {
- return taskActivationHistory;
- }
-
- public Set<ITask> getAllScheduledTasks() {
- return new HashSet<ITask>(allScheduledTasks);
- }
-
- public Set<AbstractTask> getAllScheduledTasksInternal() {
- Set<AbstractTask> tasks = new HashSet<AbstractTask>();
- synchronized (scheduledTasks) {
- for (ITask task : allScheduledTasks) {
- if (task instanceof AbstractTask) {
- tasks.add((AbstractTask) task);
- }
- }
- }
- return tasks;
- }
-
- public Set<ITask> getAllDueTasks() {
- return new HashSet<ITask>(allDueTasks);
- }
-
- public Set<ITask> getOverScheduledTasks() {
- Set<ITask> children = new HashSet<ITask>();
- Calendar start = TaskActivityUtil.getCalendar();
- start.setTimeInMillis(0);
- Calendar end = TaskActivityUtil.getCalendar();
- TaskActivityUtil.snapStartOfDay(end);
- for (ITask task : getScheduledTasks(start, end)) {
- if (!task.isCompleted()) {
- children.add(task);
- }
- }
- return children;
-
- }
-
- public Collection<? extends ITask> getOverDueTasks() {
- Set<ITask> children = new HashSet<ITask>();
- Calendar start = TaskActivityUtil.getCalendar();
- start.setTimeInMillis(0);
- Calendar end = TaskActivityUtil.getCalendar();
- TaskActivityUtil.snapStartOfHour(end);
- for (ITask task : getDueTasks(start, end)) {
- if (!task.isCompleted() && repositoryManager.isOwnedByUser(task)) {
- children.add(task);
- }
- }
- return children;
- }
-
- public Collection<AbstractTask> getUnscheduled() {
- Set<AbstractTask> allTasks = new HashSet<AbstractTask>(taskList.getAllTasks());
- for (ITask abstractTask : getAllScheduledTasks()) {
- allTasks.remove(abstractTask);
- }
- return allTasks;
- }
-
- public boolean isActive(ITask task) {
- Assert.isNotNull(task);
- return task.equals(getActiveTask());
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
deleted file mode 100644
index f3208cd02..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskActivityUtil.java
+++ /dev/null
@@ -1,257 +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.core;
-
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * @author Rob Elves
- */
-public class TaskActivityUtil {
-
- private static int startDay = Calendar.MONDAY;
-
- private static int endHour = 17;
-
- public static Calendar snapStartOfDay(Calendar cal) {
- cal.set(Calendar.HOUR_OF_DAY, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.MILLISECOND, 0);
- cal.getTime();
- return cal;
- }
-
- public static Calendar snapStartOfHour(Calendar cal) {
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.MILLISECOND, 0);
- cal.getTime();
- return cal;
- }
-
- public static Calendar snapEndOfHour(Calendar cal) {
- cal.set(Calendar.MINUTE, cal.getActualMaximum(Calendar.MINUTE));
- cal.set(Calendar.SECOND, cal.getActualMaximum(Calendar.SECOND));
- cal.set(Calendar.MILLISECOND, cal.getActualMaximum(Calendar.MILLISECOND));
- cal.getTime();
- return cal;
- }
-
- public static Calendar snapEndOfDay(Calendar cal) {
- cal.set(Calendar.HOUR_OF_DAY, cal.getActualMaximum(Calendar.HOUR_OF_DAY));
- cal.set(Calendar.MINUTE, cal.getActualMaximum(Calendar.MINUTE));
- cal.set(Calendar.SECOND, cal.getActualMaximum(Calendar.SECOND));
- cal.set(Calendar.MILLISECOND, cal.getActualMaximum(Calendar.MILLISECOND));
- cal.getTime();
- return cal;
- }
-
- public static void snapToNextDay(Calendar cal) {
- cal.add(Calendar.DAY_OF_MONTH, 1);
- TaskActivityUtil.snapStartOfDay(cal);
- }
-
- public static Calendar snapNextDay(Calendar cal) {
- cal.add(Calendar.DAY_OF_MONTH, 1);
- snapStartOfDay(cal);
- return cal;
- }
-
- public static Calendar snapStartOfWorkWeek(Calendar cal) {
- cal.set(Calendar.DAY_OF_WEEK, startDay);
- snapStartOfDay(cal);
- return cal;
- }
-
- public static Calendar snapEndOfWeek(Calendar cal) {
- if (cal.getFirstDayOfWeek() == Calendar.MONDAY) {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
- } else {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
- }
- snapEndOfDay(cal);
- return cal;
- }
-
- public static Calendar snapEndOfNextWeek(Calendar cal) {
- if (cal.getFirstDayOfWeek() == Calendar.MONDAY) {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
- } else {
- cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
- }
- snapEndOfWeek(cal);
- cal.add(Calendar.WEEK_OF_MONTH, 1);
- return cal;
- }
-
- public static Calendar snapForwardNumDays(Calendar calendar, int days) {
- calendar.add(Calendar.DAY_OF_MONTH, days);
- calendar.set(Calendar.HOUR_OF_DAY, endHour);
- calendar.set(Calendar.MINUTE, 0);
- calendar.set(Calendar.SECOND, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- return calendar;
- }
-
- public static Calendar snapEndOfWorkDay(Calendar calendar) {
- calendar.set(Calendar.HOUR_OF_DAY, endHour);
- calendar.set(Calendar.MINUTE, 0);
- calendar.set(Calendar.SECOND, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- return calendar;
- }
-
- public static Calendar snapNextWorkWeek(Calendar calendar) {
- calendar.add(Calendar.WEEK_OF_MONTH, 1);
- snapStartOfWorkWeek(calendar);
- return calendar;
- }
-
- public static boolean isAfterCurrentWeek(Calendar time) {
- if (time != null) {
- Calendar cal = getCalendar();
- return time.compareTo(snapNextWorkWeek(cal)) > -1;
- }
- return false;
- }
-
- /**
- * @return true if time is in or past Future bin
- */
- public static boolean isFuture(Calendar time) {
- if (time != null) {
- Calendar cal = getCalendar();
- cal.add(Calendar.WEEK_OF_MONTH, 2);
- snapStartOfWorkWeek(cal);
- return time.compareTo(cal) > -1;
- }
- return false;
- }
-
- public static boolean isThisWeek(Calendar time) {
- if (time != null) {
- Calendar weekStart = getCalendar();
- snapStartOfWorkWeek(weekStart);
- Calendar weekEnd = getCalendar();
- snapEndOfWeek(weekEnd);
- return (time.compareTo(weekStart) >= 0 && time.compareTo(weekEnd) <= 0);
- }
- return false;
- }
-
- public static boolean isNextWeek(Calendar time) {
- if (time != null) {
- Calendar weekStart = getCalendar();
- snapNextWorkWeek(weekStart);
- Calendar weekEnd = getCalendar();
- snapNextWorkWeek(weekEnd);
- snapEndOfWeek(weekEnd);
- return (time.compareTo(weekStart) >= 0 && time.compareTo(weekEnd) <= 0);
- }
- return false;
- }
-
- public static boolean isToday(Calendar time) {
- if (time != null) {
- Calendar dayStart = getCalendar();
- snapStartOfDay(dayStart);
- Calendar midnight = getCalendar();
- snapEndOfDay(midnight);
- return (time.compareTo(dayStart) >= 0 && time.compareTo(midnight) <= 0);
- }
- return false;
- }
-
- public static boolean isToday(DateRange time) {
- if (time != null) {
- return getCurrentWeek().getToday().compareTo(time) == 0;
- }
- return false;
- }
-
- public static Calendar getCalendar() {
- Calendar cal = Calendar.getInstance();
- cal.setFirstDayOfWeek(startDay);
- cal.getTime();
- return cal;
- }
-
- public static Calendar getStartOfCurrentWeek() {
- Calendar cal = getCalendar();
- return snapStartOfWorkWeek(cal);
- }
-
- public static Calendar getStartOfNextWeek() {
- Calendar cal = getCalendar();
- snapNextWorkWeek(cal);
- return snapStartOfWorkWeek(cal);
- }
-
- public static Calendar getEndOfCurrentWeek() {
- Calendar cal = getCalendar();
- return snapEndOfWeek(cal);
- }
-
- public static boolean isBetween(Calendar time, Calendar start, Calendar end) {
- return (time.compareTo(start) >= 0 && time.compareTo(end) <= 0);
- }
-
- protected static void setStartDay(int startDay) {
- TaskActivityUtil.startDay = startDay;
- }
-
- protected static int getStartDay() {
- return TaskActivityUtil.startDay;
- }
-
- public static void setEndHour(int endHour) {
- TaskActivityUtil.endHour = endHour;
- }
-
- public static WeekDateRange getCurrentWeek() {
- Calendar weekStart = getCalendar();
- snapStartOfWorkWeek(weekStart);
- Calendar weekEnd = getCalendar();
- snapEndOfWeek(weekEnd);
- return new WeekDateRange(weekStart, weekEnd);
- }
-
- public static WeekDateRange getNextWeek() {
- Calendar weekStart = getCalendar();
- snapNextWorkWeek(weekStart);
- Calendar weekEnd = getCalendar();
- weekEnd.setTimeInMillis(weekStart.getTimeInMillis());
- snapEndOfWeek(weekEnd);
- return new WeekDateRange(weekStart, weekEnd);
- }
-
- public static DateRange getWeekOf(Date date) {
- Calendar weekStart = getCalendar();
- weekStart.setTime(date);
- Calendar weekEnd = getCalendar();
- weekEnd.setTime(date);
-
- snapStartOfWorkWeek(weekStart);
- snapEndOfWeek(weekEnd);
- return new WeekDateRange(weekStart, weekEnd);
- }
-
- public static DateRange getDayOf(Date date) {
- Calendar dayStart = getCalendar();
- dayStart.setTime(date);
- Calendar dayEnd = getCalendar();
- dayEnd.setTime(date);
-
- snapStartOfDay(dayStart);
- snapEndOfDay(dayEnd);
- return new DateRange(dayStart, dayEnd);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskAttachment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskAttachment.java
deleted file mode 100644
index 61257e177..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskAttachment.java
+++ /dev/null
@@ -1,160 +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.core;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-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.TaskAttribute;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskAttachment implements ITaskAttachment {
-
- private IRepositoryPerson author;
-
- private String comment;
-
- private String contentType;
-
- private Date creationDate;
-
- private boolean deprecated;
-
- private String description;
-
- private String fileName;
-
- private long length;
-
- private boolean patch;
-
- private final ITask task;
-
- private final TaskAttribute taskAttribute;
-
- private final TaskRepository taskRepository;
-
- private String url;
-
- public TaskAttachment(TaskRepository taskRepository, ITask task, TaskAttribute taskAttribute) {
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(task);
- Assert.isNotNull(taskAttribute);
- this.taskRepository = taskRepository;
- this.task = task;
- this.taskAttribute = taskAttribute;
- }
-
- public IRepositoryPerson getAuthor() {
- return author;
- }
-
- public String getComment() {
- return comment;
- }
-
- public String getConnectorKind() {
- return taskRepository.getConnectorKind();
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getFileName() {
- return fileName;
- }
-
- public long getLength() {
- return length;
- }
-
- public String getRepositoryUrl() {
- return taskRepository.getRepositoryUrl();
- }
-
- public ITask getTask() {
- return task;
- }
-
- public TaskAttribute getTaskAttribute() {
- return taskAttribute;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public String getUrl() {
- return url;
- }
-
- public boolean isDeprecated() {
- return deprecated;
- }
-
- public boolean isPatch() {
- return patch;
- }
-
- public void setAuthor(IRepositoryPerson author) {
- this.author = author;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public void setDeprecated(boolean deprecated) {
- this.deprecated = deprecated;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public void setLength(long length) {
- this.length = length;
- }
-
- public void setPatch(boolean patch) {
- this.patch = patch;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskCategory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskCategory.java
deleted file mode 100644
index 026b88abe..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskCategory.java
+++ /dev/null
@@ -1,52 +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
- *******************************************************************************/
-/*
- * Created on Dec 26, 2004
- */
-package org.eclipse.mylyn.internal.tasks.core;
-
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-
-/**
- * @author Mik Kersten
- */
-public final class TaskCategory extends AbstractTaskCategory {
-
- private String summary;
-
- public TaskCategory(String handleAndDescription) {
- super(handleAndDescription);
- setSummary(handleAndDescription);
- }
-
- /**
- * null if no parent category
- */
- public static AbstractTaskCategory getParentTaskCategory(ITask task) {
- AbstractTaskCategory category = null;
- if (task != null) {
- for (ITaskContainer container : ((AbstractTask) task).getParentContainers()) {
- if (container instanceof AbstractTaskCategory) {
- category = (AbstractTaskCategory) container;
- }
- }
- }
- return category;
- }
-
- @Override
- public String getSummary() {
- return summary;
- }
-
- public void setSummary(String summary) {
- this.summary = summary;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java
deleted file mode 100644
index 322c47be8..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskComment.java
+++ /dev/null
@@ -1,112 +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.core;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * A comment posted by a user on a task.
- *
- * @author Steffen Pingel
- */
-public class TaskComment implements ITaskComment {
-
- private IRepositoryPerson author;
-
- private Date creationDate;
-
- private int number;
-
- private final ITask task;
-
- private final TaskAttribute taskAttribute;
-
- private final TaskRepository taskRepository;
-
- private String text;
-
- private String url;
-
- public TaskComment(TaskRepository taskRepository, ITask task, TaskAttribute taskAttribute) {
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(task);
- Assert.isNotNull(taskAttribute);
- this.taskRepository = taskRepository;
- this.task = task;
- this.taskAttribute = taskAttribute;
- }
-
- public IRepositoryPerson getAuthor() {
- return author;
- }
-
- public String getConnectorKind() {
- return taskRepository.getConnectorKind();
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public int getNumber() {
- return number;
- }
-
- public String getRepositoryUrl() {
- return taskRepository.getRepositoryUrl();
- }
-
- public ITask getTask() {
- return task;
- }
-
- public TaskAttribute getTaskAttribute() {
- return taskAttribute;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public String getText() {
- return text;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setAuthor(IRepositoryPerson author) {
- this.author = author;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public void setNumber(int number) {
- this.number = number;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskContainerDelta.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskContainerDelta.java
deleted file mode 100644
index 15030f604..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskContainerDelta.java
+++ /dev/null
@@ -1,108 +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.core;
-
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-
-/**
- * Immutable. Defines changes to Task List elements.
- *
- * @author Mik Kersten
- * @since 2.0
- */
-public final class TaskContainerDelta {
-
- public enum Kind {
- /**
- * One container (source) added to another (target)
- */
- ADDED,
-
- /**
- * One container (source) removed from another (target)
- */
- REMOVED,
-
- /**
- * The internal state of the container (target) has changed, e.g. attributes, summary, priority, etc
- */
- CONTENT,
-
- /**
- * The root of the data structure has changed.
- */
- ROOT
- }
-
- private final ITaskContainer parent;
-
- private final IRepositoryElement element;
-
- private final Kind kind;
-
- private boolean isTransient;
-
- /**
- * @param element
- * - object being moved/added/removed, source assumed to be root
- * @since 3.0
- */
- public TaskContainerDelta(IRepositoryElement element, Kind kind) {
- this.element = element;
- this.parent = null;
- this.kind = kind;
- }
-
- /**
- * @since 3.0
- */
- public TaskContainerDelta(IRepositoryElement element, ITaskContainer parent, Kind kind) {
- this.element = element;
- this.parent = parent;
- this.kind = kind;
- }
-
- /**
- * The <code>target</code> is the container that the <code>source</code> is being moved from/to
- *
- * @since 3.0
- */
- public ITaskContainer getParent() {
- return parent;
- }
-
- /**
- * The element being ADDED or REMOVED wrt the <code>target</code>
- *
- * @since 3.0
- */
- public IRepositoryElement getElement() {
- return element;
- }
-
- public Kind getKind() {
- return kind;
- }
-
- /**
- * @since 3.0
- */
- public void setTransient(boolean isTransient) {
- this.isTransient = isTransient;
- }
-
- /**
- * @since 3.0
- */
- public boolean isTransient() {
- return isTransient;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java
deleted file mode 100644
index 5b2bfa882..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java
+++ /dev/null
@@ -1,127 +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.core;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-
-/**
- * @author Rob Elves
- */
-public class TaskDataState {
-
- private RepositoryTaskData newTaskData;
-
- private RepositoryTaskData oldTaskData;
-
- private Set<RepositoryTaskAttribute> edits = new CopyOnWriteArraySet<RepositoryTaskAttribute>();
-
- private final String url;
-
- private final String id;
-
- public TaskDataState(String repositoryUrl, String id) {
- this.url = repositoryUrl;
- this.id = id;
- }
-
- public RepositoryTaskData getNewTaskData() {
- return newTaskData;
- }
-
- public void setNewTaskData(RepositoryTaskData newTaskData) {
- this.newTaskData = newTaskData;
- }
-
- public RepositoryTaskData getOldTaskData() {
- return oldTaskData;
- }
-
- public void setOldTaskData(RepositoryTaskData oldTaskData) {
- this.oldTaskData = oldTaskData;
- }
-
- public Set<RepositoryTaskAttribute> getEdits() {
- return edits;
- }
-
- public void setEdits(Set<RepositoryTaskAttribute> edits) {
- if (edits == null) {
- edits = new HashSet<RepositoryTaskAttribute>();
- } else {
- this.edits = edits;
- }
- }
-
- public void discardEdits() {
- if (edits != null) {
- this.edits.clear();
- } else {
- setEdits(null);
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((url == null) ? 0 : url.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;
- }
- final TaskDataState other = (TaskDataState) obj;
- if (id == null) {
- if (other.id != null) {
- return false;
- }
- } else if (!id.equals(other.id)) {
- return false;
- }
- if (url == null) {
- if (other.url != null) {
- return false;
- }
- } else if (!url.equals(other.url)) {
- return false;
- }
- return true;
- }
-
- public String getUrl() {
- return url;
- }
-
- public String getId() {
- return id;
- }
-
-// void discardEdits();
-// Set<RepositoryTaskAttribute> getChanged();
-// isStateModified();
-// hasIncomingChanges();
-// hasChanged(RepositoryTaskAttribute attribute);
-// public init(); // Perform constructor specific initialization (i.e. calc changed attributes etc)
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataStorageManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataStorageManager.java
deleted file mode 100644
index 128af1568..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataStorageManager.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.core;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-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.deprecated.AbstractAttributeFactory;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractLegacyRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-
-/**
- * Manager for persisting RepositoryTaskData offline
- *
- * @author Rob Elves
- */
-public class TaskDataStorageManager {
-
- private final IRepositoryManager taskRepositoryManager;
-
- private final ITaskDataStorage storage;
-
- private int nextNewId = 1;
-
- public TaskDataStorageManager(IRepositoryManager taskRepositoryManager, ITaskDataStorage storage) {
- this.taskRepositoryManager = taskRepositoryManager;
- this.storage = storage;
- }
-
- /**
- * Add a RepositoryTaskData to the offline reports file.
- */
- public void setNewTaskData(RepositoryTaskData data) {
- if (data == null || data.getRepositoryUrl() == null || data.getTaskId() == null) {
- return;
- }
-
- TaskDataState state = retrieveState(data);
- if (state != null) {
- state.setNewTaskData(data);
- } else {
- state = new TaskDataState(data.getRepositoryUrl(), data.getTaskId());
- state.setNewTaskData(data);
- }
- saveState(state);
- }
-
- /**
- * @since 2.3
- */
- public void setNewTaskData(String repositoryUrl, String taskId, RepositoryTaskData data) {
- TaskDataState state = retrieveState(repositoryUrl, taskId);
- if (state != null) {
- state.setNewTaskData(data);
- } else {
- state = new TaskDataState(repositoryUrl, taskId);
- state.setNewTaskData(data);
- }
- saveState(state);
- }
-
- public void setOldTaskData(RepositoryTaskData data) {
- if (data == null || data.getRepositoryUrl() == null || data.getTaskId() == null) {
- return;
- }
- TaskDataState state = retrieveState(data);
- if (state != null) {
- state.setOldTaskData(data);
- } else {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
- "Attempt to save old data when no new data exists", new Exception()));
- }
- saveState(state);
- }
-
- /**
- * Returns the most recent copy of the task data.
- *
- * @return offline task data, null if no data found
- */
- public RepositoryTaskData getNewTaskData(String repositoryUrl, String id) {
- if (repositoryUrl == null || id == null) {
- return null;
- }
- TaskDataState state = retrieveState(repositoryUrl, id);
- if (state != null) {
- return state.getNewTaskData();
- }
- return null;
- }
-
- /**
- * Returns the old copy if exists, null otherwise.
- */
- public RepositoryTaskData getOldTaskData(String repositoryUrl, String id) {
- if (repositoryUrl == null || id == null) {
- return null;
- }
- TaskDataState state = retrieveState(repositoryUrl, id);
- if (state != null) {
- return state.getOldTaskData();
- }
- return null;
- }
-
- /**
- * @return Get the next available temporary taskId. This taskId is given to new unsubmitted repository tasks.
- * Incremented each time this method is called.
- */
- public synchronized String getNewRepositoryTaskId() {
- // TODO: generate based on values of unsubmitted offline report ids
- nextNewId++;
- if (nextNewId == Integer.MAX_VALUE) {
- nextNewId = 1;
- }
- return "" + nextNewId;
- }
-
- /**
- *
- * @return editable copy of task data with any edits applied
- */
- public RepositoryTaskData getEditableCopy(String repositoryUrl, String id) {
- if (repositoryUrl == null || id == null) {
- return null;
- }
- TaskDataState state = retrieveState(repositoryUrl, id);
- RepositoryTaskData clone = null;
- if (state != null) {
- if (state.getNewTaskData() != null) {
- try {
- clone = (RepositoryTaskData) ObjectCloner.deepCopy(state.getNewTaskData());
- updateAttributeFactory(clone);
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Error constructing modifiable task", e));
- return null;
- }
- }
- if (clone != null) {
- for (RepositoryTaskAttribute attribute : state.getEdits()) {
- if (attribute == null) {
- continue;
- }
- RepositoryTaskAttribute existing = clone.getAttribute(attribute.getId());
- if (existing != null) {
- existing.clearValues();
- List<String> options = existing.getOptions();
-
- for (String value : attribute.getValues()) {
- if (options.size() > 0) {
- if (options.contains(value)) {
- existing.addValue(value);
- }
- } else {
- existing.addValue(value);
- }
- }
-
- } else {
- clone.addAttribute(attribute.getId(), attribute);
- }
- }
- }
- }
- return clone;
-
- }
-
- // API 3.0 review: the state of the elements of changedAttribues could change between this call and the time state is written to disk, might need to make a full copy
- public void saveEdits(String repositoryUrl, String id, Set<RepositoryTaskAttribute> changedAttributes) {
- TaskDataState state = retrieveState(repositoryUrl, id);
- if (state != null) {
- Set<RepositoryTaskAttribute> edits = state.getEdits();
- if (edits == null) {
- // Copy here?
- state.setEdits(changedAttributes);
- } else {
- edits.removeAll(changedAttributes);
- edits.addAll(changedAttributes);
- }
- try {
- storage.put(state);
- } catch (Exception e) {
- // FIXME what exception is caught here?
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Error saving edits", e));
- }
- }
-
- }
-
- public Set<RepositoryTaskAttribute> getEdits(String repositoryUrl, String id) {
- if (repositoryUrl == null || id == null) {
- return Collections.emptySet();
- }
- TaskDataState state = retrieveState(repositoryUrl, id);
- if (state != null) {
- if (state.getEdits() != null) {
- return Collections.unmodifiableSet(state.getEdits());
- }
- }
- return Collections.emptySet();
- }
-
- public void discardEdits(String repositoryUrl, String id) {
- if (repositoryUrl == null || id == null) {
- return;
- }
- TaskDataState state = retrieveState(repositoryUrl, id);
- if (state != null) {
- state.discardEdits();
- try {
- storage.put(state);
- } catch (Exception e) {
- // FIXME what exception is caught here?
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Error discarding edits", e));
- }
- }
- }
-
- public void remove(String repositoryUrl, String id) {
- if (repositoryUrl == null || id == null) {
- return;
- }
- storage.remove(repositoryUrl, id);
- }
-
- /**
- * DESTROY ALL OFFLINE TASK DATA Public for testing only Forces a reset of all data maps Does not signal data
- * changed (doesn't request save)
- */
- public void clear() {
- nextNewId = 0;
- storage.clear();
- }
-
- /**
- * After deserialization process the attributeFactory needs to be reset on each RepositoryTaskData.
- */
- private void updateAttributeFactory(RepositoryTaskData taskData) {
- if (taskData == null) {
- return;
- }
- taskData.refresh();
- AbstractLegacyRepositoryConnector connector = (AbstractLegacyRepositoryConnector) taskRepositoryManager.getRepositoryConnector(taskData.getConnectorKind());
- if (connector != null && connector.getLegacyTaskDataHandler() != null) {
- AbstractAttributeFactory factory = connector.getLegacyTaskDataHandler().getAttributeFactory(taskData);
- if (factory != null) {
- taskData.setAttributeFactory(factory);
- }
- }
- }
-
- // XXX: review if task data cloning can be done without using serialization
- // Reference:
- // http://www.javaworld.com/javaworld/javatips/jw-javatip76.html?page=2
- public static class ObjectCloner {
-
- private ObjectCloner() {
- // can not instantiate
- }
-
- static public Object deepCopy(Object oldObj) throws Exception {
- ObjectOutputStream outputStream = null;
- ObjectInputStream inputStream = null;
- try {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- outputStream = new ObjectOutputStream(byteArrayOutputStream);
-
- outputStream.writeObject(oldObj);
- outputStream.flush();
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- inputStream = new ObjectInputStream(byteArrayInputStream);
- return inputStream.readObject();
- } catch (Exception e) {
- throw (e);
- } finally {
- if (outputStream != null) {
- outputStream.close();
- }
- if (inputStream != null) {
- inputStream.close();
- }
- }
- }
-
- }
-
- public void start() {
- try {
- storage.start();
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Offline storage start failed",
- e));
- }
- }
-
- public void stop() {
- try {
- storage.stop();
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Offline storage stop failed", e));
- }
- }
-
- public void saveNow() {
- storage.flush();
- }
-
- private TaskDataState retrieveState(RepositoryTaskData data) {
- return retrieveState(data.getRepositoryUrl(), data.getTaskId());
- }
-
- private TaskDataState retrieveState(String repositoryUrl, String id) {
- TaskDataState state = null;
- try {
- state = storage.get(repositoryUrl, id);
- if (state != null) {
- // TODO: Get rid of attribute factory on containers!!!
- if (state.getNewTaskData() != null) {
- updateAttributeFactory(state.getNewTaskData());
- }
- if (state.getOldTaskData() != null) {
- updateAttributeFactory(state.getOldTaskData());
- }
- }
- } catch (Exception e) {
- // FIXME what Exception is caught here?
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Error saving offline data", e));
- }
- return state;
- }
-
- private void saveState(TaskDataState state) {
- storage.put(state);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskExternalizationException.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskExternalizationException.java
deleted file mode 100644
index bd67c0ed6..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskExternalizationException.java
+++ /dev/null
@@ -1,25 +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.core;
-
-/**
- * @author Mik Kersten
- * @author Ken Sueda
- */
-public class TaskExternalizationException extends Exception {
-
- private static final long serialVersionUID = 5804522104992031907L;
-
- public TaskExternalizationException() {
- super();
- }
-
- public TaskExternalizationException(String detailMessage) {
- super(detailMessage);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskGroup.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskGroup.java
deleted file mode 100644
index a87c46fdd..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskGroup.java
+++ /dev/null
@@ -1,43 +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.core;
-
-
-/**
- * NOTE: this class is likely to change or become API for 3.0
- *
- * @author Eugene Kuleshov
- * @since 2.1
- */
-public class TaskGroup extends AbstractTaskContainer {
-
- private final String summary;
-
- private final String groupBy;
-
- public TaskGroup(String parentHandle, String summary, String groupBy) {
- super(parentHandle + summary);
- this.summary = summary;
- this.groupBy = groupBy;
- }
-
- @Override
- public String getSummary() {
- return summary;
- }
-
- @Override
- public boolean isUserManaged() {
- return false;
- }
-
- public String getGroupBy() {
- return groupBy;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskList.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskList.java
deleted file mode 100644
index 04f592b8d..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskList.java
+++ /dev/null
@@ -1,653 +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.core;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-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.core.runtime.jobs.ILock;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.tasks.core.IRepositoryElement;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * Stores and manages task list elements and their containment hierarchy.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @since 3.0
- */
-public class TaskList implements ITaskList {
-
- private static ILock lock = Job.getJobManager().newLock();
-
- private Map<String, AbstractTaskCategory> categories;
-
- private final Set<ITaskListChangeListener> changeListeners = new CopyOnWriteArraySet<ITaskListChangeListener>();
-
- private UncategorizedTaskContainer defaultCategory;
-
- private int maxLocalTaskId;
-
- private Map<String, RepositoryQuery> queries;
-
- private Map<String, UnmatchedTaskContainer> repositoryOrphansMap;
-
- private Map<String, AbstractTask> tasks;
-
- private Set<TaskContainerDelta> delta;
-
- public TaskList() {
- reset();
- }
-
- public void addCategory(TaskCategory category) throws IllegalArgumentException {
- Assert.isNotNull(category);
- try {
- lock();
- categories.put(category.getHandleIdentifier(), category);
- delta.add(new TaskContainerDelta(category, TaskContainerDelta.Kind.ADDED));
- } finally {
- unlock();
- }
- }
-
- public void addChangeListener(ITaskListChangeListener listener) {
- changeListeners.add(listener);
- }
-
- /**
- * precondition: task must not be null and must exist in the task list
- */
- private void addOrphan(AbstractTask task, Set<TaskContainerDelta> delta) {
- if (!task.getParentContainers().isEmpty()) {
- // Current policy is not to archive/orphan if the task exists in some other container
- return;
- }
-
- AbstractTaskContainer orphans = getUnmatchedContainer(task.getRepositoryUrl());
- if (orphans != null) {
- task.addParentContainer(orphans);
- orphans.internalAddChild(task);
- delta.add(new TaskContainerDelta(task, orphans, TaskContainerDelta.Kind.ADDED));
- }
- }
-
- public void addQuery(RepositoryQuery query) throws IllegalArgumentException {
- Assert.isNotNull(query);
- try {
- lock();
- queries.put(query.getHandleIdentifier(), query);
- delta.add(new TaskContainerDelta(query, TaskContainerDelta.Kind.ADDED));
- } finally {
- unlock();
- }
- }
-
- /**
- * Add orphaned task to the task list
- */
- public void addTask(ITask task) {
- addTask(task, null);
- }
-
- public boolean addTask(ITask itask, AbstractTaskContainer container) {
- AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- Assert.isLegal(!(container instanceof UnmatchedTaskContainer));
-
- try {
- lock();
- task = getOrCreateTask(task);
- if (container == null) {
- container = getUnmatchedContainer(task.getRepositoryUrl());
- } else {
- container = getValidElement(container);
- }
-
- // ensure parent is valid and does not contain task already
- if (container == null || task.equals(container) || task.getParentContainers().contains(container)) {
- return false;
- }
-
- // ensure that we don't create cycles
- if ((task).contains(container.getHandleIdentifier())) {
- return false;
- }
-
- if (task instanceof LocalTask && task.getParentContainers().size() > 0) {
- // local tasks should only have 1 parent
- for (AbstractTaskContainer parent : task.getParentContainers()) {
- removeFromContainerInternal(parent, task, delta);
- }
- } else if (container instanceof AbstractTaskCategory) {
- // tasks can only be in one task category at a time
- AbstractTaskCategory tempCat = TaskCategory.getParentTaskCategory(task);
- if (tempCat != null) {
- removeFromContainerInternal(tempCat, task, delta);
- }
- }
-
- removeOrphan(task, delta);
-
- (task).addParentContainer(container);
- container.internalAddChild(task);
- delta.add(new TaskContainerDelta(task, container, TaskContainerDelta.Kind.ADDED));
- } finally {
- unlock();
- }
-
- return true;
- }
-
- public void addUnmatchedContainer(UnmatchedTaskContainer orphanedTasksContainer) {
- repositoryOrphansMap.put(orphanedTasksContainer.getRepositoryUrl(), orphanedTasksContainer);
- }
-
- public void deleteCategory(AbstractTaskCategory category) {
- try {
- lock();
- categories.remove(category.getHandleIdentifier());
- for (ITask task : category.getChildren()) {
- ((AbstractTask) task).removeParentContainer(category);
- addOrphan((AbstractTask) task, delta);
- }
- delta.add(new TaskContainerDelta(category, TaskContainerDelta.Kind.REMOVED));
- } finally {
- unlock();
- }
- }
-
- public void deleteQuery(RepositoryQuery query) {
- try {
- lock();
- queries.remove(query.getHandleIdentifier());
- for (ITask task : query.getChildren()) {
- ((AbstractTask) task).removeParentContainer(query);
- addOrphan((AbstractTask) task, delta);
- }
- delta.add(new TaskContainerDelta(query, TaskContainerDelta.Kind.REMOVED));
- } finally {
- unlock();
- }
- }
-
- /**
- * Task is removed from all containers. Currently subtasks are not deleted but rather are rather potentially
- * orphaned.
- */
- public void deleteTask(ITask itask) {
- Assert.isNotNull(itask);
- AbstractTask task = (AbstractTask) itask;
- try {
- lock();
-
- // remove task from all parent containers
- for (AbstractTaskContainer container : task.getParentContainers()) {
- removeFromContainerInternal(container, task, delta);
- }
-
- // remove this task as a parent for all subtasks
- for (ITask child : task.getChildren()) {
- removeFromContainerInternal(task, child, delta);
- addOrphan((AbstractTask) child, delta);
- }
-
- tasks.remove(task.getHandleIdentifier());
- delta.add(new TaskContainerDelta(task, TaskContainerDelta.Kind.REMOVED));
- } finally {
- unlock();
- }
- }
-
- private void fireDelta(HashSet<TaskContainerDelta> deltasToFire) {
- for (ITaskListChangeListener listener : changeListeners) {
- try {
- listener.containersChanged(Collections.unmodifiableSet(deltasToFire));
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Notification failed for: "
- + listener, t));
- }
- }
- }
-
- public Collection<AbstractTask> getAllTasks() {
- return Collections.unmodifiableCollection(tasks.values());
- }
-
- public Set<AbstractTaskCategory> getCategories() {
- return Collections.unmodifiableSet(new HashSet<AbstractTaskCategory>(categories.values()));
- }
-
- /**
- * Exposed for unit testing
- *
- * @return unmodifiable collection of ITaskActivityListeners
- */
- public Set<ITaskListChangeListener> getChangeListeners() {
- return Collections.unmodifiableSet(changeListeners);
- }
-
- public AbstractTaskCategory getContainerForHandle(String categoryHandle) {
- Assert.isNotNull(categoryHandle);
-
- for (AbstractTaskCategory cat : categories.values()) {
- if (cat.getHandleIdentifier().equals(categoryHandle)) {
- return cat;
- }
- }
- return null;
- }
-
- public AbstractTaskCategory getDefaultCategory() {
- return defaultCategory;
- }
-
- public int getLastLocalTaskId() {
- return maxLocalTaskId;
- }
-
- public int getNextLocalTaskId() {
- try {
- lock();
- return ++maxLocalTaskId;
- } finally {
- unlock();
- }
- }
-
- private AbstractTask getOrCreateTask(AbstractTask taskListElement) {
- AbstractTask task = tasks.get(taskListElement.getHandleIdentifier());
- if (task == null) {
- tasks.put(taskListElement.getHandleIdentifier(), taskListElement);
- task = taskListElement;
- if (task instanceof LocalTask) {
- try {
- int taskId = Integer.parseInt(task.getTaskId());
- maxLocalTaskId = Math.max(maxLocalTaskId, taskId);
- } catch (NumberFormatException e) {
- // ignore
- }
- }
- }
- return task;
- }
-
- public Set<RepositoryQuery> getQueries() {
- return Collections.unmodifiableSet(new HashSet<RepositoryQuery>(queries.values()));
- }
-
- /**
- * return all queries for the given repository url
- */
- public Set<RepositoryQuery> getRepositoryQueries(String repositoryUrl) {
- Assert.isNotNull(repositoryUrl);
-
- Set<RepositoryQuery> repositoryQueries = new HashSet<RepositoryQuery>();
- for (RepositoryQuery query : queries.values()) {
- if (query.getRepositoryUrl().equals(repositoryUrl)) {
- repositoryQueries.add(query);
- }
- }
- return repositoryQueries;
- }
-
- public Set<AbstractTaskContainer> getRootElements() {
- Set<AbstractTaskContainer> roots = new HashSet<AbstractTaskContainer>();
- roots.add(defaultCategory);
- for (AbstractTaskCategory cat : categories.values()) {
- roots.add(cat);
- }
- for (RepositoryQuery query : queries.values()) {
- roots.add(query);
- }
- for (UnmatchedTaskContainer orphanContainer : repositoryOrphansMap.values()) {
- roots.add(orphanContainer);
- }
- return roots;
- }
-
- /**
- * TODO: consider removing, if everything becomes a repository task
- *
- * @return null if no such task.
- */
- public AbstractTask getTask(String handleIdentifier) {
- if (handleIdentifier == null) {
- return null;
- } else {
- return tasks.get(handleIdentifier);
- }
- }
-
- public ITask getTask(String repositoryUrl, String taskId) {
- if (!RepositoryTaskHandleUtil.isValidTaskId(taskId)) {
- return null;
- }
-
- String handle = RepositoryTaskHandleUtil.getHandle(repositoryUrl, taskId);
- return getTask(handle);
- }
-
- public AbstractTask getTaskByKey(String repositoryUrl, String taskKey) {
- for (AbstractTask task : tasks.values()) {
- String currentTaskKey = task.getTaskKey();
- if (currentTaskKey != null && currentTaskKey.equals(taskKey)
- && task.getRepositoryUrl().equals(repositoryUrl)) {
- return task;
- }
- }
- return null;
- }
-
- public Set<AbstractTaskCategory> getTaskCategories() {
- Set<AbstractTaskCategory> containers = new HashSet<AbstractTaskCategory>();
- for (AbstractTaskCategory container : categories.values()) {
- if (container instanceof TaskCategory) {
- containers.add(container);
- }
- }
- return containers;
- }
-
- /**
- * Returns all tasks for the given repository url.
- */
- public Set<ITask> getTasks(String repositoryUrl) {
- Set<ITask> repositoryTasks = new HashSet<ITask>();
- if (repositoryUrl != null) {
- for (ITask task : tasks.values()) {
- if (task.getRepositoryUrl().equals(repositoryUrl)) {
- repositoryTasks.add(task);
- }
- }
- }
- return repositoryTasks;
- }
-
- public AbstractTaskContainer getUnmatchedContainer(String repositoryUrl) {
- if (LocalRepositoryConnector.REPOSITORY_URL.equals(repositoryUrl)) {
- return defaultCategory;
- } else {
- UnmatchedTaskContainer orphans = repositoryOrphansMap.get(repositoryUrl);
- if (orphans == null) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Failed to find unmatched container for repository \"" + repositoryUrl + "\""));
- }
- return orphans;
- }
- }
-
- public Set<UnmatchedTaskContainer> getUnmatchedContainers() {
- return Collections.unmodifiableSet(new HashSet<UnmatchedTaskContainer>(repositoryOrphansMap.values()));
- }
-
- /**
- * Task added if does not exist already. Ensures the element exists in the task list
- *
- * @throws IllegalAgumentException
- * if null argument passed or element does not exist in task list
- * @return element as passed in or instance from task list with same handle if exists
- */
- private AbstractTaskContainer getValidElement(IRepositoryElement taskListElement) {
- AbstractTaskContainer result = null;
- if (taskListElement instanceof ITask) {
- result = tasks.get(taskListElement.getHandleIdentifier());
- } else if (taskListElement instanceof UncategorizedTaskContainer) {
- result = defaultCategory;
- } else if (taskListElement instanceof UnmatchedTaskContainer) {
- result = repositoryOrphansMap.get(((UnmatchedTaskContainer) taskListElement).getRepositoryUrl());
- } else if (taskListElement instanceof TaskCategory) {
- result = categories.get(taskListElement.getHandleIdentifier());
- } else if (taskListElement instanceof IRepositoryQuery) {
- result = queries.get(taskListElement.getHandleIdentifier());
- }
-
- if (result == null) {
- throw new IllegalArgumentException("Element " + taskListElement.getHandleIdentifier()
- + " does not exist in the task list.");
- } else {
- return result;
- }
- }
-
- public void notifyElementsChanged(Set<? extends IRepositoryElement> elements) {
- HashSet<TaskContainerDelta> deltas = new HashSet<TaskContainerDelta>();
- if (elements == null) {
- deltas.add(new TaskContainerDelta(null, TaskContainerDelta.Kind.ROOT));
- } else {
- for (IRepositoryElement element : elements) {
- deltas.add(new TaskContainerDelta(element, TaskContainerDelta.Kind.CONTENT));
- }
- }
-
- fireDelta(deltas);
- }
-
- public void notifySynchronizationStateChanged(Set<? extends IRepositoryElement> elements) {
- HashSet<TaskContainerDelta> taskChangeDeltas = new HashSet<TaskContainerDelta>();
- for (IRepositoryElement abstractTaskContainer : elements) {
- TaskContainerDelta delta = new TaskContainerDelta(abstractTaskContainer, TaskContainerDelta.Kind.CONTENT);
- delta.setTransient(true);
- taskChangeDeltas.add(delta);
- }
-
- fireDelta(taskChangeDeltas);
- }
-
- public void notifySynchronizationStateChanged(IRepositoryElement element) {
- notifySynchronizationStateChanged(Collections.singleton(element));
- }
-
- public void notifyElementChanged(IRepositoryElement element) {
- notifyElementsChanged(Collections.singleton(element));
- }
-
- public void refactorRepositoryUrl(String oldRepositoryUrl, String newRepositoryUrl) {
- Assert.isNotNull(oldRepositoryUrl);
- Assert.isNotNull(newRepositoryUrl);
-
- try {
- lock();
- for (AbstractTask task : tasks.values()) {
- if (oldRepositoryUrl.equals(RepositoryTaskHandleUtil.getRepositoryUrl(task.getHandleIdentifier()))) {
- tasks.remove(task.getHandleIdentifier());
- task.setRepositoryUrl(newRepositoryUrl);
- tasks.put(task.getHandleIdentifier(), task);
- String taskUrl = task.getUrl();
- if (taskUrl != null && taskUrl.startsWith(oldRepositoryUrl)) {
- task.setUrl(newRepositoryUrl + taskUrl.substring(oldRepositoryUrl.length()));
- }
- }
- }
-
- for (RepositoryQuery query : queries.values()) {
- if (query.getRepositoryUrl().equals(oldRepositoryUrl)) {
- query.setRepositoryUrl(newRepositoryUrl);
- delta.add(new TaskContainerDelta(query, TaskContainerDelta.Kind.CONTENT));
- }
- }
-
- for (UnmatchedTaskContainer orphans : repositoryOrphansMap.values()) {
- if (orphans.getRepositoryUrl().equals(oldRepositoryUrl)) {
- repositoryOrphansMap.remove(oldRepositoryUrl);
- //categories.remove(orphans.getHandleIdentifier());
- orphans.setRepositoryUrl(newRepositoryUrl);
- repositoryOrphansMap.put(newRepositoryUrl, orphans);
- //categories.put(orphans.getHandleIdentifier(), orphans);
- delta.add(new TaskContainerDelta(orphans, TaskContainerDelta.Kind.CONTENT));
- }
- }
- } finally {
- unlock();
- }
- }
-
- public void removeChangeListener(ITaskListChangeListener listener) {
- changeListeners.remove(listener);
- }
-
- public void removeFromContainer(AbstractTaskContainer container, ITask task) {
- Assert.isNotNull(container);
- Assert.isNotNull(task);
-
- removeFromContainer(container, Collections.singleton(task));
- }
-
- public void removeFromContainer(AbstractTaskContainer container, Set<ITask> tasks) {
- Assert.isNotNull(container);
- Assert.isNotNull(tasks);
- try {
- lock();
- for (ITask task : tasks) {
- removeFromContainerInternal(container, task, delta);
- addOrphan((AbstractTask) task, delta);
- }
- } finally {
- unlock();
- }
- }
-
- /**
- * Note: does not add <code>task</code> to the unmatched container.
- */
- private void removeFromContainerInternal(AbstractTaskContainer container, ITask task, Set<TaskContainerDelta> delta) {
- assert container.getChildren().contains(task);
-
- container.internalRemoveChild(task);
- ((AbstractTask) task).removeParentContainer(container);
-
- delta.add(new TaskContainerDelta(task, container, TaskContainerDelta.Kind.REMOVED));
- }
-
- private void removeOrphan(AbstractTask task, Set<TaskContainerDelta> delta) {
- AbstractTaskContainer orphans = getUnmatchedContainer(task.getRepositoryUrl());
- if (orphans != null) {
- if (orphans.internalRemoveChild(task)) {
- delta.add(new TaskContainerDelta(task, orphans, TaskContainerDelta.Kind.REMOVED));
- task.removeParentContainer(orphans);
- }
- }
- }
-
- /**
- * TODO separate category/query handle from name
- *
- * @deprecated
- */
- @Deprecated
- public void renameContainer(AbstractTaskContainer container, String newDescription) {
- Assert.isLegal(!(container instanceof ITask));
- Assert.isLegal(!(container instanceof UnmatchedTaskContainer));
- try {
- lock();
- if (container instanceof TaskCategory) {
- ((TaskCategory) container).setSummary(newDescription);
- } else if (container instanceof RepositoryQuery) {
- ((RepositoryQuery) container).setSummary(newDescription);
- }
- delta.add(new TaskContainerDelta(container, TaskContainerDelta.Kind.CONTENT));
- } finally {
- unlock();
- }
- }
-
- /**
- * Public for testing.
- */
- public void reset() {
- try {
- lock();
- tasks = new ConcurrentHashMap<String, AbstractTask>();
-
- repositoryOrphansMap = new ConcurrentHashMap<String, UnmatchedTaskContainer>();
-
- categories = new ConcurrentHashMap<String, AbstractTaskCategory>();
- queries = new ConcurrentHashMap<String, RepositoryQuery>();
-
- defaultCategory = new UncategorizedTaskContainer();
-
- maxLocalTaskId = 0;
- categories.put(defaultCategory.getHandleIdentifier(), defaultCategory);
- } finally {
- unlock();
- }
- }
-
- public void run(ITaskListRunnable runnable) throws CoreException {
- run(runnable, null);
- }
-
- public void run(ITaskListRunnable runnable, IProgressMonitor monitor) throws CoreException {
- monitor = Policy.monitorFor(monitor);
- try {
- lock(monitor);
-
- runnable.execute(monitor);
-
- } finally {
- unlock();
- }
-
- }
-
- private void lock() {
- lock.acquire();
- if (lock.getDepth() == 1) {
- delta = new HashSet<TaskContainerDelta>();
- }
- }
-
- private void lock(IProgressMonitor monitor) throws CoreException {
- while (!monitor.isCanceled()) {
- try {
- if (lock.acquire(3000)) {
- if (lock.getDepth() == 1) {
- delta = new HashSet<TaskContainerDelta>();
- }
- return;
- }
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
- throw new OperationCanceledException();
- }
-
- private void unlock() {
- HashSet<TaskContainerDelta> toFire = null;
- if (lock.getDepth() == 1) {
- toFire = new HashSet<TaskContainerDelta>(delta);
- }
- lock.release();
- if (toFire != null && toFire.size() > 0) {
- fireDelta(toFire);
- }
- }
-
- public static ISchedulingRule getSchedulingRule() {
- return ITasksCoreConstants.TASKLIST_SCHEDULING_RULE;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java
deleted file mode 100644
index c7de378b8..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java
+++ /dev/null
@@ -1,130 +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.core;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * @author Rob Elves
- * @author Jevgeni Holodkov
- */
-public class TaskRepositoriesExternalizer {
-
- private final SaxRepositoriesWriter writer = new SaxRepositoriesWriter();
-
- public static final String ELEMENT_TASK_REPOSITORIES = "TaskRepositories";
-
- public static final String ELEMENT_TASK_REPOSITORY = "TaskRepository";
-
- public static final String ATTRIBUTE_VERSION = "OutputVersion";
-
- public void writeRepositoriesToXML(Collection<TaskRepository> repositories, File file) {
- ZipOutputStream outputStream = null;
- try {
- if (!file.exists()) {
- file.createNewFile();
- }
-
- outputStream = new ZipOutputStream(new FileOutputStream(file));
- writeRepositories(repositories, outputStream);
- outputStream.close();
-
- } catch (IOException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Could not write: "
- + file.getAbsolutePath(), e));
- } finally {
- if (outputStream != null) {
- try {
- outputStream.close();
- } catch (IOException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Could not close: "
- + file.getAbsolutePath(), e));
- }
- }
- }
- }
-
- /**
- * @param repositories
- * @param outputStream
- * @throws IOException
- */
- public void writeRepositories(Collection<TaskRepository> repositories, ZipOutputStream outputStream)
- throws IOException {
- ZipEntry zipEntry = new ZipEntry(TaskRepositoryManager.OLD_REPOSITORIES_FILE);
- outputStream.putNextEntry(zipEntry);
- outputStream.setMethod(ZipOutputStream.DEFLATED);
-
- // OutputStream stream = new FileOutputStream(file);
- writer.setOutputStream(outputStream);
- writer.writeRepositoriesToStream(repositories);
- outputStream.flush();
- outputStream.closeEntry();
- }
-
- public Set<TaskRepository> readRepositoriesFromXML(File file) {
-
- if (!file.exists()) {
- return null;
- }
- InputStream inputStream = null;
- try {
- inputStream = new ZipInputStream(new FileInputStream(file));
-
- // search for REPOSITORIES entry
- ZipEntry entry = ((ZipInputStream) inputStream).getNextEntry();
- while (entry != null) {
- if (TaskRepositoryManager.OLD_REPOSITORIES_FILE.equals(entry.getName())) {
- break;
- }
- entry = ((ZipInputStream) inputStream).getNextEntry();
- }
-
- if (entry == null) {
- return null;
- }
-
- SaxRepositoriesContentHandler contentHandler = new SaxRepositoriesContentHandler();
- XMLReader reader = XMLReaderFactory.createXMLReader();
- reader.setContentHandler(contentHandler);
- reader.parse(new InputSource(inputStream));
- return contentHandler.getRepositories();
- } catch (Throwable e) {
- file.renameTo(new File(file.getAbsolutePath() + "-save"));
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Error reading context file", e));
- return null;
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Error closing context file", e));
- }
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryAdapter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryAdapter.java
deleted file mode 100644
index d86a377e4..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryAdapter.java
+++ /dev/null
@@ -1,36 +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.core;
-
-import org.eclipse.mylyn.tasks.core.IRepositoryListener;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public class TaskRepositoryAdapter implements IRepositoryListener {
-
- public void repositoryAdded(TaskRepository repository) {
- // ignore
- }
-
- public void repositoryRemoved(TaskRepository repository) {
- // ignore
- }
-
- public void repositorySettingsChanged(TaskRepository repository) {
- // ignore
- }
-
- public void repositoryUrlChanged(TaskRepository repository, String oldUrl) {
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryLocation.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryLocation.java
deleted file mode 100644
index ce4c23188..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryLocation.java
+++ /dev/null
@@ -1,75 +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.core;
-
-import java.net.InetSocketAddress;
-import java.net.Proxy;
-import java.net.Proxy.Type;
-
-import org.eclipse.core.net.proxy.IProxyData;
-import org.eclipse.core.net.proxy.IProxyService;
-import org.eclipse.mylyn.commons.net.AbstractWebLocation;
-import org.eclipse.mylyn.commons.net.AuthenticatedProxy;
-import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
-import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.internal.commons.net.CommonsNetPlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskRepositoryLocation extends AbstractWebLocation {
-
- protected final TaskRepository taskRepository;
-
- public TaskRepositoryLocation(TaskRepository taskRepository) {
- super(taskRepository.getRepositoryUrl());
-
- this.taskRepository = taskRepository;
- }
-
- @Override
- public Proxy getProxyForHost(String host, String proxyType) {
- if (!taskRepository.isDefaultProxyEnabled()) {
- return taskRepository.getProxy();
- }
-
- IProxyService service = CommonsNetPlugin.getProxyService();
- if (service != null && service.isProxiesEnabled()) {
- IProxyData data = service.getProxyDataForHost(host, proxyType);
- if (data != null && data.getHost() != null) {
- String proxyHost = data.getHost();
- int proxyPort = data.getPort();
- // change the IProxyData default port to the Java default port
- if (proxyPort == -1) {
- proxyPort = 0;
- }
-
- InetSocketAddress sockAddr = new InetSocketAddress(proxyHost, proxyPort);
- if (data.isRequiresAuthentication()) {
- return new AuthenticatedProxy(getJavaProxyType(proxyType), sockAddr, data.getUserId(),
- data.getPassword());
- } else {
- return new Proxy(getJavaProxyType(proxyType), sockAddr);
- }
- }
- }
- return null;
- }
-
- private Type getJavaProxyType(String type) {
- return (IProxyData.SOCKS_PROXY_TYPE.equals(type)) ? Proxy.Type.SOCKS : Proxy.Type.HTTP;
- }
-
- @Override
- public AuthenticationCredentials getCredentials(AuthenticationType type) {
- return taskRepository.getCredentials(type);
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
deleted file mode 100644
index f62137ff9..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
+++ /dev/null
@@ -1,389 +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.core;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-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.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryListener;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Provides facilities for managing the lifecycle of and access to task repositories.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Jevgeni Holodkov
- * @since 3.0
- */
-public class TaskRepositoryManager implements IRepositoryManager {
-
- public static final String OLD_REPOSITORIES_FILE = "repositories.xml";
-
- public static final String DEFAULT_REPOSITORIES_FILE = "repositories.xml.zip";
-
- public static final String PREF_REPOSITORIES = "org.eclipse.mylyn.tasklist.repositories.";
-
- private final Map<String, AbstractRepositoryConnector> repositoryConnectors = new HashMap<String, AbstractRepositoryConnector>();
-
- private final Map<String, Set<TaskRepository>> repositoryMap = new HashMap<String, Set<TaskRepository>>();
-
- private final Set<IRepositoryListener> listeners = new HashSet<IRepositoryListener>();
-
- private final Set<TaskRepository> orphanedRepositories = new HashSet<TaskRepository>();
-
- public static final String MESSAGE_NO_REPOSITORY = "No repository available, please add one using the Task Repositories view.";
-
- public static final String PREFIX_LOCAL = "local-";
-
- private final PropertyChangeListener PROPERTY_CHANGE_LISTENER = new PropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent evt) {
- TaskRepositoryManager.this.notifyRepositorySettingsChanged((TaskRepository) evt.getSource());
- }
- };
-
- private final TaskRepositoriesExternalizer externalizer = new TaskRepositoriesExternalizer();
-
- public TaskRepositoryManager() {
- }
-
- public Collection<AbstractRepositoryConnector> getRepositoryConnectors() {
- return Collections.unmodifiableCollection(repositoryConnectors.values());
- }
-
- public AbstractRepositoryConnector getRepositoryConnector(String connectorKind) {
- return repositoryConnectors.get(connectorKind);
- }
-
- public void addRepositoryConnector(AbstractRepositoryConnector repositoryConnector) {
- if (!repositoryConnectors.values().contains(repositoryConnector)) {
- repositoryConnectors.put(repositoryConnector.getConnectorKind(), repositoryConnector);
- }
- }
-
- public boolean hasUserManagedRepositoryConnectors() {
- for (AbstractRepositoryConnector connector : repositoryConnectors.values()) {
- if (connector.isUserManaged()) {
- return true;
- }
- }
- return false;
- }
-
- public void addRepository(TaskRepository repository) {
- Set<TaskRepository> repositories;
- if (!repositoryMap.containsKey(repository.getConnectorKind())) {
- repositories = new HashSet<TaskRepository>();
- repositoryMap.put(repository.getConnectorKind(), repositories);
- } else {
- repositories = repositoryMap.get(repository.getConnectorKind());
- }
- repositories.add(repository);
- repository.addChangeListener(PROPERTY_CHANGE_LISTENER);
- for (IRepositoryListener listener : listeners) {
- listener.repositoryAdded(repository);
- }
- }
-
- public void removeRepository(TaskRepository repository, String repositoryFilePath) {
- Set<TaskRepository> repositories = repositoryMap.get(repository.getConnectorKind());
- if (repositories != null) {
- repository.flushAuthenticationCredentials();
- repositories.remove(repository);
- }
- repository.removeChangeListener(PROPERTY_CHANGE_LISTENER);
- saveRepositories(repositoryFilePath);
- for (IRepositoryListener listener : listeners) {
- listener.repositoryRemoved(repository);
- }
- }
-
- public void addListener(IRepositoryListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(IRepositoryListener listener) {
- listeners.remove(listener);
- }
-
- /* Public for testing. */
- public static String stripSlashes(String url) {
- Assert.isNotNull(url);
- StringBuilder sb = new StringBuilder(url.trim());
- while (sb.length() > 0 && sb.charAt(sb.length() - 1) == '/') {
- sb.deleteCharAt(sb.length() - 1);
- }
- return sb.toString();
- }
-
- public TaskRepository getRepository(String kind, String urlString) {
- Assert.isNotNull(kind);
- Assert.isNotNull(urlString);
- urlString = stripSlashes(urlString);
- if (repositoryMap.containsKey(kind)) {
- for (TaskRepository repository : repositoryMap.get(kind)) {
- if (stripSlashes(repository.getRepositoryUrl()).equals(urlString)) {
- return repository;
- }
- }
- }
- return null;
- }
-
- /**
- * @return first repository that matches the given url
- */
- public TaskRepository getRepository(String urlString) {
- Assert.isNotNull(urlString);
- urlString = stripSlashes(urlString);
- for (String kind : repositoryMap.keySet()) {
- for (TaskRepository repository : repositoryMap.get(kind)) {
- if (stripSlashes(repository.getRepositoryUrl()).equals(urlString)) {
- return repository;
- }
- }
- }
- return null;
- }
-
- /**
- * @return the first connector to accept the URL
- */
- public AbstractRepositoryConnector getConnectorForRepositoryTaskUrl(String url) {
- Assert.isNotNull(url);
- for (AbstractRepositoryConnector connector : getRepositoryConnectors()) {
- if (connector.getRepositoryUrlFromTaskUrl(url) != null) {
- for (TaskRepository repository : getRepositories(connector.getConnectorKind())) {
- if (url.startsWith(repository.getRepositoryUrl())) {
- return connector;
- }
- }
- }
- }
- return null;
- }
-
- public Set<TaskRepository> getRepositories(String kind) {
- Assert.isNotNull(kind);
- if (repositoryMap.containsKey(kind)) {
- return repositoryMap.get(kind);
- } else {
- return Collections.emptySet();
- }
- }
-
- public List<TaskRepository> getAllRepositories() {
- List<TaskRepository> repositories = new ArrayList<TaskRepository>();
- for (AbstractRepositoryConnector repositoryConnector : repositoryConnectors.values()) {
- if (repositoryMap.containsKey(repositoryConnector.getConnectorKind())) {
- repositories.addAll(repositoryMap.get(repositoryConnector.getConnectorKind()));
- }
- }
- return repositories;
- }
-
- /**
- * TODO: implement default support, this just returns first found
- */
- public TaskRepository getDefaultRepository(String kind) {
- // HACK: returns first repository found
- if (repositoryMap.containsKey(kind)) {
- for (TaskRepository repository : repositoryMap.get(kind)) {
- return repository;
- }
- } else {
- Collection<Set<TaskRepository>> values = repositoryMap.values();
- if (!values.isEmpty()) {
- Set<TaskRepository> repoistorySet = values.iterator().next();
- return repoistorySet.iterator().next();
- }
- }
- return null;
- }
-
- Map<String, Set<TaskRepository>> readRepositories(String repositoriesFilePath) {
-
- repositoryMap.clear();
- orphanedRepositories.clear();
-
- loadRepositories(repositoriesFilePath);
-
-// for (IRepositoryListener listener : listeners) {
-// try {
-// listener.repositoriesRead();
-// } catch (Throwable t) {
-// StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
-// "Repository listener failed", t));
-// }
-// }
- return repositoryMap;
- }
-
- private void loadRepositories(String repositoriesFilePath) {
- boolean migration = false;
- // String dataDirectory =
- // TasksUiPlugin.getDefault().getDataDirectory();
- File repositoriesFile = new File(repositoriesFilePath);
-
- // Will only load repositories for which a connector exists
- for (AbstractRepositoryConnector repositoryConnector : repositoryConnectors.values()) {
- repositoryMap.put(repositoryConnector.getConnectorKind(), new HashSet<TaskRepository>());
- }
- if (repositoriesFile.exists()) {
- Set<TaskRepository> repositories = externalizer.readRepositoriesFromXML(repositoriesFile);
- if (repositories != null && repositories.size() > 0) {
- for (TaskRepository repository : repositories) {
-
- if (removeHttpAuthMigration(repository)) {
- migration = true;
- }
-
- if (migrateAnonymousRepository(repository)) {
- migration = true;
- }
-
- if (repositoryMap.containsKey(repository.getConnectorKind())) {
- repositoryMap.get(repository.getConnectorKind()).add(repository);
- repository.addChangeListener(PROPERTY_CHANGE_LISTENER);
- } else {
- orphanedRepositories.add(repository);
- }
- }
- }
- if (migration) {
- saveRepositories(repositoriesFilePath);
- }
- }
- }
-
- @SuppressWarnings("deprecation")
- private boolean removeHttpAuthMigration(TaskRepository repository) {
- String httpusername = repository.getProperty(TaskRepository.AUTH_HTTP_USERNAME);
- String httppassword = repository.getProperty(TaskRepository.AUTH_HTTP_PASSWORD);
- if (httpusername != null && httppassword != null) {
- repository.removeProperty(TaskRepository.AUTH_HTTP_USERNAME);
- repository.removeProperty(TaskRepository.AUTH_HTTP_PASSWORD);
- if (httpusername.length() > 0 && httppassword.length() > 0) {
- repository.setHttpAuthenticationCredentials(httpusername, httppassword);
- }
- return true;
- }
- return false;
- }
-
- // Migration 2.0M1 - 2.0M2
- private boolean migrateAnonymousRepository(TaskRepository repository) {
- if (repository.getProperty(TaskRepository.ANONYMOUS_LOGIN) == null) {
- if ((repository.getUserName() == null || repository.getPassword() == null)
- || ("".equals(repository.getUserName()) && "".equals(repository.getPassword()))) {
- repository.setAnonymous(true);
- } else {
- repository.setAnonymous(false);
- }
- return true;
- }
- return false;
- }
-
- @Deprecated
- public void setSynchronizationTime(TaskRepository repository, String syncTime, String repositoriesFilePath) {
- repository.setSynchronizationTimeStamp(syncTime);
- saveRepositories(repositoriesFilePath);
- }
-
- protected synchronized boolean saveRepositories(String destinationPath) {
-// if (!Platform.isRunning()) {// || TasksUiPlugin.getDefault() == null) {
-// return false;
-// }
- Set<TaskRepository> repositoriesToWrite = new HashSet<TaskRepository>(getAllRepositories());
- // if for some reason a repository is added/changed to equal one in the
- // orphaned set the orphan is discarded
- for (TaskRepository repository : orphanedRepositories) {
- if (!repositoriesToWrite.contains(repository)) {
- repositoriesToWrite.add(repository);
- }
- }
-
- try {
- File repositoriesFile = new File(destinationPath);
- externalizer.writeRepositoriesToXML(repositoriesToWrite, repositoriesFile);
- } catch (Throwable t) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Could not save repositories", t));
- return false;
- }
- return true;
- }
-
- /**
- * For testing.
- */
- public void clearRepositories(String repositoriesFilePath) {
- repositoryMap.clear();
- orphanedRepositories.clear();
- saveRepositories(repositoriesFilePath);
- }
-
- public void notifyRepositorySettingsChanged(TaskRepository repository) {
- for (IRepositoryListener listener : listeners) {
- listener.repositorySettingsChanged(repository);
- }
- }
-
- public void insertRepositories(Set<TaskRepository> repositories, String repositoryFilePath) {
- for (TaskRepository repository : repositories) {
- if (getRepository(repository.getConnectorKind(), repository.getRepositoryUrl()) == null) {
- addRepository(repository);
- }
- }
- }
-
- public boolean isOwnedByUser(ITask task) {
- if (task instanceof LocalTask) {
- return true;
- }
-
- ITask repositoryTask = task;
- TaskRepository repository = getRepository(repositoryTask.getConnectorKind(), repositoryTask.getRepositoryUrl());
- if (repository != null && repositoryTask.getOwner() != null) {
- return repositoryTask.getOwner().equals(repository.getUserName());
- }
-
- return false;
- }
-
- /**
- * @param repository
- * with new url
- * @param oldUrl
- * previous url for this repository
- */
- public void notifyRepositoryUrlChanged(TaskRepository repository, String oldUrl) {
- for (IRepositoryListener listener : listeners) {
- listener.repositoryUrlChanged(repository, oldUrl);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskTask.java
deleted file mode 100644
index 972df31aa..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskTask.java
+++ /dev/null
@@ -1,39 +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.core;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskTask extends AbstractTask {
-
- private final String connectorKind;
-
- public TaskTask(String connectorKind, String repositoryUrl, String taskId) {
- super(repositoryUrl, taskId, "");
- this.connectorKind = connectorKind;
- this.taskKey = taskId;
- }
-
- @Override
- public String getConnectorKind() {
- return connectorKind;
- }
-
- @Override
- public String getTaskKey() {
- return taskKey;
- }
-
- @Override
- public boolean isLocal() {
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TasksModel.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TasksModel.java
deleted file mode 100644
index 8e367ca1e..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TasksModel.java
+++ /dev/null
@@ -1,121 +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.core;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.IRepositoryModel;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- */
-public class TasksModel implements IRepositoryModel {
-
- private int queryCount;
-
- private final IRepositoryManager repositoryManager;
-
- private final Map<String, ITask> taskByHandle = new WeakHashMap<String, ITask>();
-
- private final TaskList taskList;
-
- public TasksModel(TaskList taskList, IRepositoryManager repositoryManager) {
- this.taskList = taskList;
- this.repositoryManager = repositoryManager;
- initialize();
- }
-
- private void initialize() {
- repositoryManager.addListener(new TaskRepositoryAdapter() {
- @Override
- public void repositoryAdded(TaskRepository repository) {
- taskList.addUnmatchedContainer(new UnmatchedTaskContainer(repository.getConnectorKind(),
- repository.getRepositoryUrl()));
- }
-
- @Override
- public void repositoryRemoved(TaskRepository repository) {
- // TODO
- //taskList.removeUnmatchedContainer(taskList.getUnmatchedContainer(repository.getRepositoryUrl()));
- }
- });
- }
-
- public IRepositoryQuery createQuery(TaskRepository taskRepository) {
- String handle = "query-" + ++queryCount;
- RepositoryQuery query = new RepositoryQuery(taskRepository.getConnectorKind(), handle);
- query.setRepositoryUrl(taskRepository.getRepositoryUrl());
- return query;
- }
-
- public synchronized ITask createTask(TaskRepository taskRepository, String taskId) {
- String handle = getTaskHandle(taskRepository, taskId);
- ITask task = taskByHandle.get(handle);
- if (task == null) {
- task = new TaskTask(taskRepository.getConnectorKind(), taskRepository.getRepositoryUrl(), taskId);
- taskByHandle.put(handle, task);
- }
- return task;
- }
-
- public ITaskAttachment createTaskAttachment(TaskAttribute taskAttribute) {
- TaskData taskData = taskAttribute.getTaskData();
- TaskRepository taskRepository = repositoryManager.getRepository(taskData.getConnectorKind(),
- taskData.getRepositoryUrl());
- ITask task = getTask(taskRepository, taskData.getTaskId());
- TaskAttachment taskAttachment = new TaskAttachment(taskRepository, task, taskAttribute);
- taskData.getAttributeMapper().updateTaskAttachment(taskAttachment, taskAttribute);
- return taskAttachment;
- }
-
- public ITaskComment createTaskComment(TaskAttribute taskAttribute) {
- TaskData taskData = taskAttribute.getTaskData();
- TaskRepository taskRepository = repositoryManager.getRepository(taskData.getConnectorKind(),
- taskData.getRepositoryUrl());
- ITask task = getTask(taskRepository, taskData.getTaskId());
- TaskComment taskComment = new TaskComment(taskRepository, task, taskAttribute);
- taskData.getAttributeMapper().updateTaskComment(taskComment, taskAttribute);
- return taskComment;
- }
-
- public synchronized ITask getTask(String handleIdentifier) {
- ITask task = taskByHandle.get(handleIdentifier);
- if (task == null) {
- task = taskList.getTask(handleIdentifier);
- }
- return task;
- }
-
- public synchronized ITask getTask(TaskRepository taskRepository, String taskId) {
- return getTask(getTaskHandle(taskRepository, taskId));
- }
-
- private String getTaskHandle(TaskRepository taskRepository, String taskId) {
- return RepositoryTaskHandleUtil.getHandle(taskRepository.getRepositoryUrl(), taskId);
- }
-
- public TaskRepository getTaskRepository(String connectorKind, String repositoryUrl) {
- TaskRepository taskRepository = repositoryManager.getRepository(connectorKind, repositoryUrl);
- if (taskRepository == null) {
- taskRepository = new TaskRepository(connectorKind, repositoryUrl);
- repositoryManager.addRepository(taskRepository);
- }
- return taskRepository;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UncategorizedTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UncategorizedTaskContainer.java
deleted file mode 100644
index 9ddf63baf..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UncategorizedTaskContainer.java
+++ /dev/null
@@ -1,48 +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.core;
-
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-
-/**
- * Category created for the user to hold uncategorized tasks.
- *
- * @author Rob Elves
- */
-public class UncategorizedTaskContainer extends AbstractTaskCategory {
-
- public static final String LABEL = "Uncategorized";
-
- public static final String HANDLE = LABEL;
-
- public UncategorizedTaskContainer() {
- super(HANDLE);
- }
-
- @Override
- public String getPriority() {
- return PriorityLevel.P1.toString();
- }
-
- @Override
- public String getHandleIdentifier() {
- return HANDLE;
- }
-
- @Override
- public String getSummary() {
- return LABEL;
- }
-
- @Override
- public boolean isUserManaged() {
- return false;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UnmatchedTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UnmatchedTaskContainer.java
deleted file mode 100644
index 184dbbb29..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/UnmatchedTaskContainer.java
+++ /dev/null
@@ -1,65 +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.core;
-
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-
-/**
- * Holds orphaned or uncategorized tasks for a given repository
- *
- * @author Rob Elves
- */
-public class UnmatchedTaskContainer extends AbstractTaskCategory {
-
- public static final String LABEL = "Uncategorized";
-
- public static final String HANDLE = "orphans";
-
- private String repositoryUrl;
-
- private final String connectorKind;
-
- public UnmatchedTaskContainer(String connectorKind, String repositoryUrl) {
- super(repositoryUrl + "-" + HANDLE);
- this.repositoryUrl = repositoryUrl;
- this.connectorKind = connectorKind;
- }
-
- @Override
- public String getPriority() {
- return PriorityLevel.P1.toString();
- }
-
- @Override
- public String getSummary() {
- return "Unmatched [" + getRepositoryUrl() + "]";
- }
-
- @Override
- public boolean isUserManaged() {
- return false;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public String getConnectorKind() {
- return connectorKind;
- }
-
- /**
- * setting will also refactor handle
- */
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- this.setHandleIdentifier(repositoryUrl + "-" + HANDLE);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
deleted file mode 100644
index e56a29f1e..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WeekDateRange.java
+++ /dev/null
@@ -1,100 +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.core;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-/**
- * @author Rob Elves
- */
-public class WeekDateRange extends DateRange {
-
- private final List<DateRange> days = new ArrayList<DateRange>();
-
- public WeekDateRange(Calendar startDate, Calendar endDate) {
- super(startDate, endDate);
- }
-
- public List<DateRange> getRemainingDays() {
- List<DateRange> remainingDays = new ArrayList<DateRange>();
- for (DateRange dayDateRange : getDaysOfWeek()) {
- if (!dayDateRange.isPast()) {
- remainingDays.add(dayDateRange);
- }
- }
- return remainingDays;
- }
-
- public List<DateRange> getDaysOfWeek() {
- if (days.isEmpty()) {
- for (int x = TaskActivityUtil.getStartDay(); x < (TaskActivityUtil.getStartDay() + 7); x++) {
- Calendar dayStart = TaskActivityUtil.getCalendar();
- dayStart.setTime(getStartDate().getTime());
- TaskActivityUtil.snapStartOfDay(dayStart);
-
- Calendar dayEnd = TaskActivityUtil.getCalendar();
- dayEnd.setTime(getStartDate().getTime());
- TaskActivityUtil.snapEndOfDay(dayEnd);
-
- if (x > 7) {
- dayStart.set(Calendar.DAY_OF_WEEK, x % 7);
- dayEnd.set(Calendar.DAY_OF_WEEK, x % 7);
- } else {
- dayStart.set(Calendar.DAY_OF_WEEK, x);
- dayEnd.set(Calendar.DAY_OF_WEEK, x);
- }
-
- days.add(new DateRange(dayStart, dayEnd));
- }
- }
- return days;
- }
-
- /**
- * @return today's DayDateRange, null if does not exist (now > endDate)
- */
- public DateRange getToday() {
- DateRange today = null;
- Calendar now = TaskActivityUtil.getCalendar();
- for (DateRange range : getDaysOfWeek()) {
- if (range.includes(now)) {
- today = range;
- break;
- }
- }
- if (today == null) {
- Calendar todayStart = TaskActivityUtil.getCalendar();
- TaskActivityUtil.snapStartOfDay(todayStart);
- Calendar todayEnd = TaskActivityUtil.getCalendar();
- TaskActivityUtil.snapEndOfDay(todayEnd);
- today = new DateRange(todayStart, todayEnd);
- }
- return today;
- }
-
- public boolean isCurrentWeekDay(DateRange range) {
- if (range == null) {
- return false;
- }
- return getDaysOfWeek().contains(range);
- }
-
- public DateRange getDayOfWeek(int dayNum) {
- if (dayNum > 0 && dayNum <= 7) {
- for (DateRange day : getDaysOfWeek()) {
- if (day.getStartDate().get(Calendar.DAY_OF_WEEK) == dayNum) {
- return day;
- }
- }
- }
- return null;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ElementHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ElementHandler.java
deleted file mode 100644
index 15ac6d455..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ElementHandler.java
+++ /dev/null
@@ -1,120 +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.core.data;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-class ElementHandler extends DefaultHandler {
-
- protected final StringBuilder currentElementText;
-
- private ElementHandler currentHandler;
-
- private final String elementName;
-
- private final Map<String, ElementHandler> handlers;
-
- private final ElementHandler parent;
-
- public ElementHandler(ElementHandler parent, String elementName) {
- this.parent = parent;
- this.elementName = elementName;
- this.handlers = new HashMap<String, ElementHandler>();
- this.currentElementText = new StringBuilder();
- }
-
- public void addElementHandler(ElementHandler handler) {
- handlers.put(handler.getElementName(), handler);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) throws SAXException {
- if (currentHandler != null) {
- currentHandler.characters(ch, start, length);
- } else {
- currentElementText.append(ch, start, length);
- }
- }
-
- protected void done(ElementHandler elementHandler) {
- currentHandler = null;
- }
-
- protected void end(String uri, String localName, String name) {
- }
-
- @Override
- public void endElement(String uri, String localName, String name) throws SAXException {
- if (currentHandler != null) {
- currentHandler.endElement(uri, localName, name);
- } else if (elementName.equals(localName)) {
- end(uri, localName, name);
- if (parent != null) {
- parent.done(this);
- }
- }
- }
-
- protected void clearCurrentElementText() {
- currentElementText.setLength(0);
- }
-
- protected String getCurrentElementText() {
- return currentElementText.toString();
- }
-
- public String getElementName() {
- return elementName;
- }
-
- protected String getOptionalValue(Attributes attributes, String name) throws SAXException {
- String value = attributes.getValue(name);
- if (value == null) {
- return "";
- }
- return value;
- }
-
- public ElementHandler getParent() {
- return parent;
- }
-
- protected String getValue(Attributes attributes, String name) throws SAXException {
- String value = attributes.getValue(name);
- if (value == null) {
- throw new SAXException("Missing required attribute \"" + name + "\"");
- }
- return value;
- }
-
- public void removeElementHandler(ElementHandler handler) {
- handlers.remove(handler.getElementName());
- }
-
- protected void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- }
-
- @Override
- public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
- if (currentHandler == null) {
- ElementHandler handler = handlers.get(name);
- if (handler != null) {
- currentHandler = handler;
- currentHandler.start(uri, localName, name, attributes);
- }
- } else if (currentHandler != null) {
- currentHandler.startElement(uri, localName, name, attributes);
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java
deleted file mode 100644
index a6c9dab1b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/FileTaskAttachmentSource.java
+++ /dev/null
@@ -1,89 +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.core.data;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-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.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-
-/**
- * @author Steffen Pingel
- */
-public class FileTaskAttachmentSource extends AbstractTaskAttachmentSource {
-
- private static final String CONTENT_TYPE_BINARY = "application/octet-stream";
-
- private String contentType = CONTENT_TYPE_BINARY;
-
- private String description;
-
- private final File file;
-
- private String name;
-
- public FileTaskAttachmentSource(File file) {
- this.file = file;
- this.name = file.getName();
- }
-
- @Override
- public InputStream createInputStream(IProgressMonitor monitor) throws CoreException {
- try {
- return new FileInputStream(file);
- } catch (FileNotFoundException e) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, e.getMessage(), e));
- }
- }
-
- @Override
- public String getContentType() {
- return contentType;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public long getLength() {
- return file.length();
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public boolean isLocal() {
- return true;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataConstants.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataConstants.java
deleted file mode 100644
index 40230cf98..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataConstants.java
+++ /dev/null
@@ -1,99 +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.core.data;
-
-public interface ITaskDataConstants {
-
- static final String ATTRIBUTE_TASK_KIND = "taskKind";
-
- static final String ATTRIBUTE_IS_PATCH = "isPatch";
-
- static final String ATTRIBUTE_IS_OBSOLETE = "isObsolete";
-
- static final String ATTRIBUTE_CREATOR = "creator";
-
- static final String ATTRIBUTE_NUMBER = "number";
-
- static final String ATTRIBUTE_HAS_ATTACHMENT = "hasAttachment";
-
- static final String ATTRIBUTE_ATTACHMENT_ID = "attachmentId";
-
- static final String ATTRIBUTE_KNOB_NAME = "knob_name";
-
- static final String ATTRIBUTE_OPERATION_NAME = "operationName";
-
- static final String ATTRIBUTE_OPTION_NAME = "optionName";
-
- static final String ATTRIBUTE_OPTION_SELECTION = "optionSelection";
-
- static final String ATTRIBUTE_IS_CHECKED = "isChecked";
-
- static final String ATTRIBUTE_INPUT_NAME = "inputName";
-
- static final String ATTRIBUTE_INPUT_VALUE = "inputValue";
-
- static final String ATTRIBUTE_READONLY = "readonly";
-
- static final String ATTRIBUTE_HIDDEN = "hidden";
-
- static final String ATTRIBUTE_PARAMETER = "parameter";
-
- static final String ATTRIBUTE_VALUE = "value";
-
- static final String ELEMENT_META = "meta";
-
- static final String ELEMENT_OPTION = "option";
-
- static final String ELEMENT_VALUE = "value";
-
- static final String ELEMENT_ATTRIBUTE = "Attribute";
-
- static final String ELEMENT_NAME = "name";
-
- static final String ELEMENT_VALUES = "values";
-
- static final String ELEMENT_OPTIONS = "options";
-
- static final String ELEMENT_META_DATA = "MetaData";
-
- static final String ELEMENT_OPERATION = "Operation";
-
- static final String ELEMENT_COMMENT = "Comment";
-
- static final String ELEMENT_ATTACHMENT = "Attachment";
-
- static final String ATTRIBUTE_REPOSITORY_KIND = "repositoryKind";
-
- static final String ATTRIBUTE_CONNECTOR_KIND = "connectorKind";
-
- static final String ATTRIBUTE_REPOSITORY_URL = "repositoryUrl";
-
- static final String ATTRIBUTE_KEY = "key";
-
- static final String ATTRIBUTE_ID = "id";
-
- static final String ATTRIBUTE_NAME = "name";
-
- static final String ELEMENT_EDITS_DATA = "EditsData";
-
- static final String ELEMENT_OLD_DATA = "OldData";
-
- static final String ELEMENT_NEW_DATA = "NewData";
-
- static final String ATTRIBUTE_VERSION = "version";
-
- static final String ELEMENT_TASK_STATE = "TaskState";
-
- static final String ELEMENT_KEY = "key";
-
- static final String ATTRIBUTE_TASK_ID = "taskId";
-
- static final String ELEMENT_ATTRIBUTES = "Attributes";
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataManagerListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataManagerListener.java
deleted file mode 100644
index 246655289..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/ITaskDataManagerListener.java
+++ /dev/null
@@ -1,18 +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.core.data;
-
-/**
- * @author Steffen Pingel
- */
-public interface ITaskDataManagerListener {
-
- public abstract void taskDataUpdated(TaskDataManagerEvent event);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataExternalizer.java
deleted file mode 100644
index 068c2558e..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataExternalizer.java
+++ /dev/null
@@ -1,124 +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.core.data;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskDataExternalizer {
-
- private final IRepositoryManager taskRepositoryManager;
-
- public TaskDataExternalizer(IRepositoryManager taskRepositoryManager) {
- this.taskRepositoryManager = taskRepositoryManager;
- }
-
- private void migrate(final TaskDataState taskDataState) throws IOException {
- // for testing
- if (taskRepositoryManager == null) {
- return;
- }
-
- String connectorKind = taskDataState.getConnectorKind();
- AbstractRepositoryConnector connector = taskRepositoryManager.getRepositoryConnector(connectorKind);
- if (connector == null) {
- throw new IOException("No repository connector for kind \"" + connectorKind + "\" found");
- }
-
- String repositoryUrl = taskDataState.getRepositoryUrl();
- final TaskRepository taskRepository = taskRepositoryManager.getRepository(connectorKind, repositoryUrl);
- if (taskRepository == null) {
- throw new IOException("Repository \"" + repositoryUrl + "\" not found for kind \"" + connectorKind + "\"");
- }
-
- final AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- if (taskDataHandler != null) {
- migrate(taskDataState.getLastReadData(), taskRepository, taskDataHandler);
- migrate(taskDataState.getRepositoryData(), taskRepository, taskDataHandler);
- migrate(taskDataState.getEditsData(), taskRepository, taskDataHandler);
- }
- }
-
- private void migrate(final TaskData taskData, final TaskRepository taskRepository,
- final AbstractTaskDataHandler taskDataHandler) {
- if (taskData != null) {
- SafeRunner.run(new ISafeRunnable() {
-
- public void handleException(Throwable exception) {
- // ignore
- }
-
- public void run() throws Exception {
- taskDataHandler.migrateTaskData(taskRepository, taskData);
- }
-
- });
- }
- }
-
- public TaskDataState readState(InputStream in) throws IOException {
- try {
- XMLReader parser = XMLReaderFactory.createXMLReader();
- TaskDataStateReader handler = new TaskDataStateReader(taskRepositoryManager);
- parser.setContentHandler(handler);
- parser.parse(new InputSource(in));
- TaskDataState taskDataState = handler.getTaskDataState();
- if (taskDataState != null) {
- migrate(taskDataState);
- }
- return taskDataState;
- } catch (SAXException e) {
- e.printStackTrace();
- throw new IOException("Error parsing task data: " + e.getMessage());
- }
- }
-
- public void writeState(OutputStream out, ITaskDataWorkingCopy state) throws IOException {
- try {
- SAXTransformerFactory transformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
- TransformerHandler handler = transformerFactory.newTransformerHandler();
- Transformer serializer = handler.getTransformer();
- serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- serializer.setOutputProperty(OutputKeys.INDENT, "yes");
- handler.setResult(new StreamResult(out));
- TaskDataStateWriter writer = new TaskDataStateWriter(handler);
- writer.write(state);
- } catch (TransformerException e) {
- throw new IOException("Error writing task data" + e.getMessageAndLocation());
- } catch (SAXException e) {
- throw new IOException("Error writing task data" + e.getMessage());
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManager.java
deleted file mode 100644
index 4b835b7fb..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManager.java
+++ /dev/null
@@ -1,684 +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.core.data;
-
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-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.SafeRunner;
-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.ITaskListRunnable;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
-import org.eclipse.mylyn.internal.tasks.core.TaskDataStorageManager;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.TaskTask;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-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.core.data.ITaskDataManager;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * Encapsulates synchronization policy.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class TaskDataManager implements ITaskDataManager {
-
- private static final String ENCODING_UTF_8 = "UTF-8";
-
- private static final String EXTENSION = ".zip";
-
- private static final String FOLDER_TASKS = "tasks";
-
- private static final String FOLDER_DATA = "offline";
-
- private static final String FOLDER_TASKS_1_0 = "offline";
-
- private String dataPath;
-
- private final IRepositoryManager repositoryManager;
-
- @Deprecated
- private final TaskDataStorageManager taskDataStorageManager;
-
- private final TaskDataStore taskDataStore;
-
- private final TaskList taskList;
-
- private final TaskActivityManager taskActivityManager;
-
- private final List<ITaskDataManagerListener> listeners = new CopyOnWriteArrayList<ITaskDataManagerListener>();
-
- public TaskDataManager(TaskDataStorageManager taskDataManager, TaskDataStore taskDataStore,
- IRepositoryManager repositoryManager, TaskList taskList, TaskActivityManager taskActivityManager) {
- this.taskDataStorageManager = taskDataManager;
- this.taskDataStore = taskDataStore;
- this.repositoryManager = repositoryManager;
- this.taskList = taskList;
- this.taskActivityManager = taskActivityManager;
- }
-
- public void addListener(ITaskDataManagerListener listener) {
- listeners.add(listener);
- }
-
- public void removeListener(ITaskDataManagerListener listener) {
- listeners.remove(listener);
- }
-
- /** public for testing purposes */
- @Deprecated
- public boolean checkHasIncoming(ITask repositoryTask,
- org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData newData) {
- if (repositoryTask.getSynchronizationState() == SynchronizationState.INCOMING) {
- return true;
- }
-
- String lastModified = ((AbstractTask) repositoryTask).getLastReadTimeStamp();
- org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute modifiedDateAttribute = newData.getAttribute(org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute.DATE_MODIFIED);
- if (lastModified != null && modifiedDateAttribute != null && modifiedDateAttribute.getValue() != null) {
- if (lastModified.trim().compareTo(modifiedDateAttribute.getValue().trim()) == 0) {
- // Only set to synchronized state if not in incoming state.
- // Case of incoming->sync handled by markRead upon opening
- // or a forced synchronization on the task only.
- return false;
- }
-
- Date modifiedDate = newData.getAttributeFactory().getDateForAttributeType(
- org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute.DATE_MODIFIED,
- modifiedDateAttribute.getValue());
- Date lastModifiedDate = newData.getAttributeFactory().getDateForAttributeType(
- org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute.DATE_MODIFIED,
- lastModified);
- if (modifiedDate != null && lastModifiedDate != null && modifiedDate.equals(lastModifiedDate)) {
- return false;
- }
- }
-
- return true;
- }
-
- public ITaskDataWorkingCopy createWorkingCopy(final ITask task, final TaskData taskData) {
- Assert.isNotNull(task);
- final TaskDataState state = new TaskDataState(taskData.getConnectorKind(), taskData.getRepositoryUrl(),
- taskData.getTaskId());
- state.setRepositoryData(taskData);
- state.setLastReadData(taskData);
- state.init(TaskDataManager.this, task);
- state.setSaved(false);
- state.revert();
- return state;
- }
-
- public ITaskDataWorkingCopy getWorkingCopy(final ITask itask) throws CoreException {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- final String kind = task.getConnectorKind();
- final TaskDataState[] result = new TaskDataState[1];
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- final File file = getMigratedFile(task, kind);
- final TaskDataState state = taskDataStore.getTaskDataState(file);
- if (state == null) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Task data at \""
- + file + "\" not found"));
- }
- if (task.isMarkReadPending()) {
- state.setLastReadData(state.getRepositoryData());
- }
- state.init(TaskDataManager.this, task);
- state.revert();
- switch (task.getSynchronizationState()) {
- case INCOMING:
- case INCOMING_NEW:
- task.setSynchronizationState(SynchronizationState.SYNCHRONIZED);
- // XXX legacy support for showing correct synchronization decoration in task list
- task.setLastReadTimeStamp(new Date().toString());
- break;
- case CONFLICT:
- task.setSynchronizationState(SynchronizationState.OUTGOING);
- break;
- }
- task.setMarkReadPending(true);
- result[0] = state;
- }
- });
- taskList.notifyElementChanged(task);
- return result[0];
- }
-
- public void saveWorkingCopy(final ITask itask, final TaskDataState state) throws CoreException {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- final String kind = task.getConnectorKind();
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- final File file = getFile(task, kind);
- taskDataStore.putTaskData(ensurePathExists(file), state);
- switch (task.getSynchronizationState()) {
- case SYNCHRONIZED:
- task.setSynchronizationState(SynchronizationState.OUTGOING);
- }
- taskList.addTask(task);
- }
- });
- taskList.notifyElementChanged(task);
- }
-
- public void putUpdatedTaskData(final ITask itask, final TaskData taskData, final boolean user) throws CoreException {
- putUpdatedTaskData(itask, taskData, user, null);
- }
-
- public void putUpdatedTaskData(final ITask itask, final TaskData taskData, final boolean user, Object token)
- throws CoreException {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- Assert.isNotNull(taskData);
- final AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(task.getConnectorKind());
- final TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- final boolean taskDataChanged = connector.hasTaskChanged(repository, task, taskData);
- final boolean taskChanged[] = new boolean[1];
- final boolean synchronizationStateChanged[] = new boolean[1];
- if (taskDataChanged || user) {
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- boolean newTask = false;
- if (!taskData.isPartial()) {
- File file = getMigratedFile(task, task.getConnectorKind());
- newTask = !file.exists();
- taskDataStore.putTaskData(ensurePathExists(file), taskData, task.isMarkReadPending(), user);
- task.setMarkReadPending(false);
- }
-
- taskChanged[0] = updateTaskFromTaskData(taskData, task, connector, repository);
-
- if (taskDataChanged) {
- switch (task.getSynchronizationState()) {
- case OUTGOING:
- task.setSynchronizationState(SynchronizationState.CONFLICT);
- break;
- case SYNCHRONIZED:
- if (newTask) {
- // FIXME this won't work for tasks that have partial task data
- task.setSynchronizationState(SynchronizationState.INCOMING_NEW);
- // XXX legacy support for showing correct synchronization decoration in task list
- task.setLastReadTimeStamp(null);
- } else {
- task.setSynchronizationState(SynchronizationState.INCOMING);
- }
- break;
- }
- }
- if (task.isSynchronizing()) {
- task.setSynchronizing(false);
- synchronizationStateChanged[0] = true;
- }
- }
- });
- } else {
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- if (task.isSynchronizing()) {
- task.setSynchronizing(false);
- synchronizationStateChanged[0] = true;
- }
- }
- });
- }
- if (taskChanged[0] || taskDataChanged) {
- taskList.notifyElementChanged(task);
- fireTaskDataUpdated(task, taskChanged[0], taskData, taskDataChanged, token);
- } else if (synchronizationStateChanged[0]) {
- taskList.notifySynchronizationStateChanged(task);
- }
- }
-
- private boolean updateTaskFromTaskData(final TaskData taskData, final AbstractTask task,
- final AbstractRepositoryConnector connector, final TaskRepository repository) {
- task.setChanged(false);
- Date oldDueDate = task.getDueDate();
- connector.updateTaskFromTaskData(repository, task, taskData);
- // XXX move this to AbstractTask or use model listener to notify task activity
- // manager of due date changes
- Date newDueDate = task.getDueDate();
- if (oldDueDate != null && !oldDueDate.equals(newDueDate) || newDueDate != oldDueDate) {
- taskActivityManager.setDueDate(task, newDueDate);
- }
- return task.isChanged();
- }
-
- private File ensurePathExists(File file) {
- if (!file.getParentFile().exists()) {
- file.getParentFile().mkdirs();
- }
- return file;
- }
-
- private File getMigratedFile(ITask task, String kind) throws CoreException {
- Assert.isNotNull(task);
- Assert.isNotNull(kind);
- File file = getFile(task, kind);
- if (!file.exists()) {
- File oldFile = getFile10(task, kind);
- if (oldFile.exists()) {
- TaskDataState state = taskDataStore.getTaskDataState(oldFile);
- // save migrated task data right away
- taskDataStore.putTaskData(ensurePathExists(file), state);
- }
- }
- return file;
- }
-
- public void discardEdits(final ITask itask) throws CoreException {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- final String kind = task.getConnectorKind();
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- File dataFile = getFile(task, kind);
- if (dataFile.exists()) {
- taskDataStore.discardEdits(dataFile);
- }
- switch (task.getSynchronizationState()) {
- case OUTGOING:
- task.setSynchronizationState(SynchronizationState.SYNCHRONIZED);
- break;
- case CONFLICT:
- task.setSynchronizationState(SynchronizationState.INCOMING);
- break;
- }
- }
- });
- taskList.notifyElementChanged(task);
- }
-
- @Deprecated
- public void discardOutgoing(AbstractTask repositoryTask) {
- taskDataStorageManager.discardEdits(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId());
- repositoryTask.setSynchronizationState(SynchronizationState.SYNCHRONIZED);
- //taskList.notifyElementChanged(repositoryTask);
- }
-
- private File findFile(ITask task, String kind) {
- File file = getFile(task, kind);
- if (file.exists()) {
- return file;
- }
- return getFile10(task, kind);
- }
-
- public String getDataPath() {
- return dataPath;
- }
-
- private File getFile(ITask task, String kind) {
- try {
-// String pathName = task.getConnectorKind() + "-"
-// + URLEncoder.encode(task.getRepositoryUrl(), ENCODING_UTF_8);
-// String fileName = kind + "-" + URLEncoder.encode(task.getTaskId(), ENCODING_UTF_8) + EXTENSION;
- String repositoryPath = task.getConnectorKind() + "-" + encode(task.getRepositoryUrl());
- String fileName = encode(task.getTaskId()) + EXTENSION;
- File path = new File(dataPath + File.separator + FOLDER_TASKS + File.separator + repositoryPath
- + File.separator + FOLDER_DATA);
- return new File(path, fileName);
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
-
- private String encode(String text) throws UnsupportedEncodingException {
- StringBuffer sb = new StringBuffer(text.length());
- char[] chars = text.toCharArray();
- for (char c : chars) {
- if (c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '.') {
- sb.append(c);
- } else {
- sb.append("%" + Integer.toHexString(c).toUpperCase());
- }
- }
- return sb.toString();
- }
-
- private File getFile10(ITask task, String kind) {
- try {
- String pathName = URLEncoder.encode(task.getRepositoryUrl(), ENCODING_UTF_8);
- String fileName = task.getTaskId() + EXTENSION;
- File path = new File(dataPath + File.separator + FOLDER_TASKS_1_0, pathName);
- return new File(path, fileName);
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- public TaskData getTaskData(ITask task) throws CoreException {
- Assert.isNotNull(task);
- final String kind = task.getConnectorKind();
- TaskDataState state = taskDataStore.getTaskDataState(findFile(task, kind));
- if (state == null) {
- return null;
- }
- return state.getRepositoryData();
- }
-
- public TaskDataState getTaskDataState(ITask task) throws CoreException {
- Assert.isNotNull(task);
- final String kind = task.getConnectorKind();
- return taskDataStore.getTaskDataState(findFile(task, kind));
- }
-
- public TaskData getTaskData(TaskRepository taskRepository, String taskId) throws CoreException {
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(taskId);
- TaskDataState state = taskDataStore.getTaskDataState(findFile(new TaskTask(taskRepository.getConnectorKind(),
- taskRepository.getRepositoryUrl(), taskId), taskRepository.getConnectorKind()));
- if (state == null) {
- return null;
- }
- return state.getRepositoryData();
- }
-
- public boolean hasTaskData(ITask task) {
- Assert.isNotNull(task);
- final String kind = task.getConnectorKind();
- return getFile(task, kind).exists();
- }
-
- public void putSubmittedTaskData(final ITask itask, final TaskData taskData) throws CoreException {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- Assert.isNotNull(taskData);
- final AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(task.getConnectorKind());
- final TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- if (!taskData.isPartial()) {
- File file = getMigratedFile(task, task.getConnectorKind());
- taskDataStore.setTaskData(ensurePathExists(file), taskData);
- task.setMarkReadPending(false);
- }
-
- updateTaskFromTaskData(taskData, task, connector, repository);
-
- task.setSynchronizationState(SynchronizationState.SYNCHRONIZED);
- task.setSynchronizing(false);
- task.setSubmitting(false);
- }
- });
- taskList.notifyElementChanged(task);
- }
-
- /**
- * Saves incoming data and updates task sync state appropriately
- *
- * @return true if call results in change of sync state
- */
- @Deprecated
- public synchronized boolean saveIncoming(final ITask itask,
- final org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData newTaskData, boolean forceSync) {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(newTaskData);
- final SynchronizationState startState = task.getSynchronizationState();
- SynchronizationState status = task.getSynchronizationState();
-
- org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData previousTaskData = taskDataStorageManager.getNewTaskData(
- task.getRepositoryUrl(), task.getTaskId());
-
- if (task.isSubmitting()) {
- status = SynchronizationState.SYNCHRONIZED;
- task.setSubmitting(false);
- TaskDataStorageManager dataManager = taskDataStorageManager;
- dataManager.discardEdits(task.getRepositoryUrl(), task.getTaskId());
-
- taskDataStorageManager.setNewTaskData(newTaskData);
- /**
- * If we set both so we don't see our own changes
- *
- * @see RepositorySynchronizationManager.setTaskRead(AbstractTask, boolean)
- */
- // taskDataManager.setOldTaskData(repositoryTask.getHandleIdentifier(),
- // newTaskData);
- } else {
-
- switch (status) {
- case OUTGOING:
- if (checkHasIncoming(task, newTaskData)) {
- status = SynchronizationState.CONFLICT;
- }
- taskDataStorageManager.setNewTaskData(newTaskData);
- break;
-
- case CONFLICT:
- // fall through to INCOMING (conflict implies incoming)
- case INCOMING:
- // only most recent incoming will be displayed if two
- // sequential incoming's /conflicts happen
-
- taskDataStorageManager.setNewTaskData(newTaskData);
- break;
- case SYNCHRONIZED:
- boolean hasIncoming = checkHasIncoming(task, newTaskData);
- if (hasIncoming) {
- status = SynchronizationState.INCOMING;
- task.setNotified(false);
- }
- if (hasIncoming || previousTaskData == null || forceSync) {
- taskDataStorageManager.setNewTaskData(newTaskData);
- }
- break;
- }
- }
- task.setSynchronizationState(status);
- return startState != task.getSynchronizationState();
- }
-
- @Deprecated
- public void saveOffline(ITask task, org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData taskData) {
- taskDataStorageManager.setNewTaskData(taskData);
- }
-
- /**
- * @param repositoryTask
- * task that changed
- * @param modifiedAttributes
- * attributes that have changed during edit session
- */
- @Deprecated
- public synchronized void saveOutgoing(AbstractTask repositoryTask,
- Set<org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute> modifiedAttributes) {
- repositoryTask.setSynchronizationState(SynchronizationState.OUTGOING);
- taskDataStorageManager.saveEdits(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId(),
- Collections.unmodifiableSet(modifiedAttributes));
- taskList.notifyElementChanged(repositoryTask);
- }
-
- public void setDataPath(String dataPath) {
- this.dataPath = dataPath;
- }
-
- /**
- * @param task
- * repository task to mark as read or unread
- * @param read
- * true to mark as read, false to mark as unread
- */
- public void setTaskRead(final ITask itask, final boolean read) {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- // legacy support
- if (!getFile(task, task.getConnectorKind()).exists()) {
- setTaskReadDeprecated(task, read);
- return;
- }
- // current api
- try {
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- if (read) {
- switch (task.getSynchronizationState()) {
- case INCOMING:
- case INCOMING_NEW:
- task.setSynchronizationState(SynchronizationState.SYNCHRONIZED);
- task.setMarkReadPending(true);
- break;
- case CONFLICT:
- task.setSynchronizationState(SynchronizationState.OUTGOING);
- task.setMarkReadPending(true);
- break;
- }
- } else {
- switch (task.getSynchronizationState()) {
- case SYNCHRONIZED:
- task.setSynchronizationState(SynchronizationState.INCOMING);
- task.setMarkReadPending(false);
- break;
- }
- }
- }
- });
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Unexpected error while marking task read", e));
- }
- taskList.notifyElementChanged(task);
- }
-
- @Deprecated
- private void setTaskReadDeprecated(ITask itask, boolean read) {
- final AbstractTask task = (AbstractTask) itask;
- org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData taskData = taskDataStorageManager.getNewTaskData(
- task.getRepositoryUrl(), task.getTaskId());
- if (read && task.getSynchronizationState().equals(SynchronizationState.INCOMING)) {
- if (taskData != null && taskData.getLastModified() != null) {
- task.setLastReadTimeStamp(taskData.getLastModified());
- taskDataStorageManager.setOldTaskData(taskData);
- }
- task.setSynchronizationState(SynchronizationState.SYNCHRONIZED);
- taskList.notifyElementChanged(task);
- } else if (read && task.getSynchronizationState().equals(SynchronizationState.CONFLICT)) {
- if (taskData != null && taskData.getLastModified() != null) {
- task.setLastReadTimeStamp(taskData.getLastModified());
- }
- task.setSynchronizationState(SynchronizationState.OUTGOING);
- taskList.notifyElementChanged(task);
- } else if (read && task.getSynchronizationState().equals(SynchronizationState.SYNCHRONIZED)) {
- if (taskData != null && taskData.getLastModified() != null) {
- task.setLastReadTimeStamp(taskData.getLastModified());
- // By setting old every time (and not setting upon submission)
- // we see our changes
- // If condition is enabled and we save old in OUTGOING handler
- // our own changes
- // will not be displayed after submission.
- // if
- // (dataManager.getOldTaskData(repositoryTask.getHandleIdentifier())
- // == null) {
- taskDataStorageManager.setOldTaskData(taskData);
- // }
- }
-// else if (repositoryTask.getLastReadTimeStamp() == null && repositoryTask.isLocal()) {
-// // fall back for cases where the stamp is missing, set bogus date
-// repositoryTask.setLastReadTimeStamp(LocalTask.SYNC_DATE_NOW);
-// }
-
- } else if (!read && task.getSynchronizationState().equals(SynchronizationState.SYNCHRONIZED)) {
- task.setSynchronizationState(SynchronizationState.INCOMING);
- taskList.notifyElementChanged(task);
- }
-
- // for connectors that don't support task data set read date to now (bug#204741)
- if (read && taskData == null && task.isLocal()) {
- task.setLastReadTimeStamp((new Date()).toString());
- }
- }
-
- void putEdits(final ITask itask, final TaskData editsData) throws CoreException {
- final AbstractTask task = (AbstractTask) itask;
- Assert.isNotNull(task);
- final String kind = task.getConnectorKind();
- Assert.isNotNull(editsData);
- taskList.run(new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- taskDataStore.putEdits(getFile(task, kind), editsData);
- switch (task.getSynchronizationState()) {
- case INCOMING:
- case INCOMING_NEW:
- // TODO throw exception instead?
- task.setSynchronizationState(SynchronizationState.CONFLICT);
- break;
- case SYNCHRONIZED:
- task.setSynchronizationState(SynchronizationState.OUTGOING);
- break;
- }
- }
- });
- taskList.notifySynchronizationStateChanged(task);
- }
-
- @Deprecated
- public org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData getNewTaskData(String repositoryUrl,
- String taskId) {
- return taskDataStorageManager.getNewTaskData(repositoryUrl, taskId);
- }
-
- @Deprecated
- public void setNewTaskData(org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData taskData) {
- taskDataStorageManager.setNewTaskData(taskData);
- }
-
- @Deprecated
- public TaskDataStorageManager getTaskDataStorageManager() {
- return taskDataStorageManager;
- }
-
- private void fireTaskDataUpdated(ITask task, boolean taskChanged, TaskData taskData, boolean taskDataChanged,
- Object token) {
- ITaskDataManagerListener[] array = listeners.toArray(new ITaskDataManagerListener[0]);
- if (array.length > 0) {
- final TaskDataManagerEvent event = new TaskDataManagerEvent(this, task, taskChanged, taskData,
- taskDataChanged, token);
- for (final ITaskDataManagerListener listener : array) {
- SafeRunner.run(new ISafeRunnable() {
-
- public void handleException(Throwable exception) {
- // ignore
-
- }
-
- public void run() throws Exception {
- listener.taskDataUpdated(event);
- }
-
- });
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManagerEvent.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManagerEvent.java
deleted file mode 100644
index f6973b12b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataManagerEvent.java
+++ /dev/null
@@ -1,64 +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.core.data;
-
-import java.util.EventObject;
-
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskDataManagerEvent extends EventObject {
-
- private static final long serialVersionUID = 1L;
-
- private final ITask task;
-
- private final boolean taskChanged;
-
- private final TaskData taskData;
-
- private final boolean taskDataChanged;
-
- private final Object token;
-
- public TaskDataManagerEvent(ITaskDataManager source, ITask task, boolean taskChanged, TaskData taskData,
- boolean taskDataChanged, Object token) {
- super(source);
- this.task = task;
- this.taskChanged = taskChanged;
- this.taskData = taskData;
- this.taskDataChanged = taskDataChanged;
- this.token = token;
- }
-
- public ITask getTask() {
- return task;
- }
-
- public boolean getTaskChanged() {
- return taskChanged;
- }
-
- public TaskData getTaskData() {
- return taskData;
- }
-
- public boolean getTaskDataChanged() {
- return taskDataChanged;
- }
-
- public Object getToken() {
- return token;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataState.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataState.java
deleted file mode 100644
index 99f7830e2..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataState.java
+++ /dev/null
@@ -1,181 +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.core.data;
-
-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.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class TaskDataState implements ITaskDataWorkingCopy {
-
- private final String connectorKind;
-
- private TaskData editsTaskData;
-
- private TaskData lastReadTaskData;
-
- private TaskData localTaskData;
-
- private boolean saved;
-
- private TaskData repositoryTaskData;
-
- private final String repositoryUrl;
-
- private ITask task;
-
- private final String taskId;
-
- private TaskDataManager taskDataManager;
-
- public TaskDataState(String connectorKind, String repositoryUrl, String taskId) {
- Assert.isNotNull(connectorKind);
- Assert.isNotNull(repositoryUrl);
- Assert.isNotNull(taskId);
- this.connectorKind = connectorKind;
- this.repositoryUrl = repositoryUrl;
- this.taskId = taskId;
- this.saved = true;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TaskDataState other = (TaskDataState) obj;
- return connectorKind.equals(other.connectorKind) && repositoryUrl.equals(other.repositoryUrl)
- && taskId.equals(other.taskId);
- }
-
- public String getConnectorKind() {
- return connectorKind;
- }
-
- public TaskData getEditsData() {
- return editsTaskData;
- }
-
- public TaskData getLastReadData() {
- return lastReadTaskData;
- }
-
- public TaskData getLocalData() {
- return localTaskData;
- }
-
- public TaskData getRepositoryData() {
- return repositoryTaskData;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + connectorKind.hashCode();
- result = prime * result + taskId.hashCode();
- result = prime * result + repositoryUrl.hashCode();
- return result;
- }
-
- void init(TaskDataManager taskSynchronizationManager, ITask task) {
- this.taskDataManager = taskSynchronizationManager;
- this.task = task;
- }
-
- public boolean isSaved() {
- return saved;
- }
-
- public void refresh(IProgressMonitor monitor) throws CoreException {
- ITaskDataWorkingCopy state = taskDataManager.getWorkingCopy(task);
- setRepositoryData(state.getRepositoryData());
- setEditsData(state.getEditsData());
- setLastReadData(state.getLastReadData());
- revert();
- }
-
- public void revert() {
- localTaskData = new TaskData(repositoryTaskData.getAttributeMapper(), repositoryTaskData.getConnectorKind(),
- repositoryTaskData.getRepositoryUrl(), repositoryTaskData.getTaskId());
- deepCopyChildren(repositoryTaskData.getRoot(), localTaskData.getRoot());
- if (editsTaskData != null) {
- deepCopyChildren(editsTaskData.getRoot(), localTaskData.getRoot());
- } else {
- editsTaskData = new TaskData(repositoryTaskData.getAttributeMapper(),
- repositoryTaskData.getConnectorKind(), repositoryTaskData.getRepositoryUrl(),
- repositoryTaskData.getTaskId());
- }
- }
-
- private void deepCopyChildren(TaskAttribute source, TaskAttribute target) {
- for (TaskAttribute child : source.getAttributes().values()) {
- target.deepAddCopy(child);
- }
- }
-
- public void save(Set<TaskAttribute> edits, IProgressMonitor monitor) throws CoreException {
- if (edits != null) {
- for (TaskAttribute edit : edits) {
- editsTaskData.getRoot().deepAddCopy(edit);
- }
- }
- if (saved) {
- taskDataManager.putEdits(task, editsTaskData);
- } else {
- taskDataManager.saveWorkingCopy(task, this);
- setSaved(true);
- }
- }
-
- public void setEditsData(TaskData editsTaskData) {
- this.editsTaskData = editsTaskData;
- }
-
- public void setLastReadData(TaskData oldTaskData) {
- this.lastReadTaskData = oldTaskData;
- }
-
- public void setLocalTaskData(TaskData localTaskData) {
- this.localTaskData = localTaskData;
- }
-
- void setSaved(boolean saved) {
- this.saved = saved;
- }
-
- public void setRepositoryData(TaskData newTaskData) {
- this.repositoryTaskData = newTaskData;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateReader.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateReader.java
deleted file mode 100644
index 5e4bc0ecf..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateReader.java
+++ /dev/null
@@ -1,614 +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.core.data;
-
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
-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.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskDataStateReader extends DefaultHandler {
-
- private class AttachmentHandler10 extends ElementHandler {
-
- private int id;
-
- private TaskAttribute attribute;
-
- private final TaskAttribute parentAttribute;
-
- public AttachmentHandler10(ElementHandler parent, TaskAttribute parentAttribute) {
- super(parent, ITaskDataConstants.ELEMENT_ATTACHMENT);
- this.parentAttribute = parentAttribute;
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- // create a unique id for each attachment since the actual id is in a child attribute
- attribute = createAttribute(parentAttribute, TaskAttribute.PREFIX_ATTACHMENT + ++id);
- attribute.getMetaData().defaults().setReadOnly(true).setType(TaskAttribute.TYPE_ATTACHMENT);
- attribute.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_ID) + "");
-
- TaskAttribute child = createAttribute(attribute, TaskAttribute.ATTACHMENT_AUTHOR);
- child.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_CREATOR));
- child.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_PERSON);
-
- child = createAttribute(attribute, TaskAttribute.ATTACHMENT_IS_DEPRECATED);
- child.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_IS_OBSOLETE));
- child.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_BOOLEAN);
-
- child = createAttribute(attribute, TaskAttribute.ATTACHMENT_IS_PATCH);
- child.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_IS_PATCH));
- child.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_BOOLEAN);
-
- addElementHandler(new AttributeHandler10(this, attribute) {
- @Override
- protected String mapId(String value) {
- // migrate key for description
- if (TaskAttribute.DESCRIPTION.equals(value)) {
- return TaskAttribute.ATTACHMENT_DESCRIPTION;
- }
- return super.mapId(value);
- }
- });
- }
-
- }
-
- private class AttributeHandler10 extends ElementHandler {
-
- private TaskAttribute attribute;
-
- private final TaskAttribute parentAttribute;
-
- public AttributeHandler10(ElementHandler parent, TaskAttribute parentAttribute) {
- super(parent, ITaskDataConstants.ELEMENT_ATTRIBUTE);
- this.parentAttribute = parentAttribute;
- }
-
- @Override
- protected void end(String uri, String localName, String name) {
- // detect type
- if (attribute.getOptions().size() > 0) {
- if (attribute.getValues().size() > 1) {
- attribute.getMetaData()
- .putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_MULTI_SELECT);
- } else {
- attribute.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE,
- TaskAttribute.TYPE_SINGLE_SELECT);
- }
- }
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- String id = mapId(getValue(attributes, ITaskDataConstants.ATTRIBUTE_ID));
- String label = getValue(attributes, ITaskDataConstants.ATTRIBUTE_NAME);
- boolean hidden = Boolean.parseBoolean(getValue(attributes, ITaskDataConstants.ATTRIBUTE_HIDDEN));
- boolean readOnly = Boolean.parseBoolean(getValue(attributes, ITaskDataConstants.ATTRIBUTE_READONLY));
- attribute = parentAttribute.createAttribute(id);
- String kind = (hidden) ? null : TaskAttribute.KIND_DEFAULT;
- attribute.getMetaData().defaults().setLabel(label).setReadOnly(readOnly).setKind(kind);
-
- addElementHandler(new OptionHandler10(this, attribute));
- addElementHandler(new ValueHandler10(this, attribute));
- addElementHandler(new MetaDataHandler10(this, attribute));
- }
-
- protected String mapId(String value) {
- return value;
- }
-
- }
-
- private class AttributeHandler20 extends ElementHandler {
-
- private TaskAttribute attribute;
-
- private final TaskAttribute parentAttribute;
-
- public AttributeHandler20(ElementHandler parent, TaskAttribute parentAttribute) {
- super(parent, ITaskDataConstants.ELEMENT_ATTRIBUTE);
- this.parentAttribute = parentAttribute;
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- String id = getValue(attributes, ITaskDataConstants.ATTRIBUTE_ID);
- attribute = parentAttribute.createAttribute(id);
-
- addElementHandler(new ValueHandler20(this, attribute));
- addElementHandler(new MapHandler20(this, attribute, ITaskDataConstants.ELEMENT_OPTION));
- addElementHandler(new MapHandler20(this, attribute, ITaskDataConstants.ELEMENT_META));
- addElementHandler(new AttributeHandler20(this, attribute));
- }
-
- }
-
- private class CommentHandler10 extends ElementHandler {
-
- private int id;
-
- private TaskAttribute attribute;
-
- private final TaskAttribute parentAttribute;
-
- public CommentHandler10(ElementHandler parent, TaskAttribute parentAttribute) {
- super(parent, ITaskDataConstants.ELEMENT_COMMENT);
- this.parentAttribute = parentAttribute;
- }
-
- @Override
- protected void end(String uri, String localName, String name) {
- TaskAttribute child = attribute.getMappedAttribute(TaskAttribute.COMMENT_TEXT);
- if (child != null) {
- child.getMetaData().putValue(TaskAttribute.META_READ_ONLY, Boolean.toString(true));
- child.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_LONG_RICH_TEXT);
- }
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- attribute = createAttribute(parentAttribute, TaskAttribute.PREFIX_COMMENT + ++id);
- attribute.getMetaData().defaults().setReadOnly(true).setType(TaskAttribute.TYPE_COMMENT);
- attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, TaskAttribute.COMMENT_TEXT);
- attribute.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_NUMBER));
-
- TaskAttribute child = createAttribute(attribute, TaskAttribute.COMMENT_ATTACHMENT_ID);
- child.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_ATTACHMENT_ID));
-
- child = createAttribute(attribute, TaskAttribute.COMMENT_HAS_ATTACHMENT);
- child.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_HAS_ATTACHMENT));
- child.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_BOOLEAN);
-
- child = createAttribute(attribute, TaskAttribute.COMMENT_NUMBER);
- child.setValue(getValue(attributes, ITaskDataConstants.ATTRIBUTE_NUMBER));
- child.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_INTEGER);
-
- addElementHandler(new AttributeHandler10(this, attribute));
- }
-
- }
-
- private class MetaDataHandler10 extends ElementHandler {
-
- private final TaskAttribute attribute;
-
- private String key;
-
- public MetaDataHandler10(ElementHandler parent, TaskAttribute attribute) {
- super(parent, ITaskDataConstants.ELEMENT_META);
- this.attribute = attribute;
- }
-
- @Override
- public void end(String uri, String localName, String name) {
- attribute.getMetaData().putValue(key, getCurrentElementText());
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- key = getValue(attributes, ITaskDataConstants.ATTRIBUTE_KEY);
- clearCurrentElementText();
- }
-
- }
-
- private class NameHandler extends ElementHandler {
-
- private final TaskAttribute attribute;
-
- private String value;
-
- public NameHandler(ElementHandler parent, TaskAttribute attribute) {
- super(parent, ITaskDataConstants.ELEMENT_NAME);
- this.attribute = attribute;
- }
-
- @Override
- public void end(String uri, String localName, String name) {
- attribute.putOption(value, getCurrentElementText());
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- value = getValue(attributes, ITaskDataConstants.ATTRIBUTE_VALUE);
- clearCurrentElementText();
- }
-
- }
-
- private class OperationHandler10 extends ElementHandler {
-
- private TaskAttribute attribute;
-
- private final TaskAttribute operationAttribute;
-
- private final TaskAttribute parentAttribute;
-
- private int id;
-
- public OperationHandler10(ElementHandler parent, TaskAttribute parentAttribute) {
- super(parent, ITaskDataConstants.ELEMENT_OPERATION);
- this.parentAttribute = parentAttribute;
- this.operationAttribute = createAttribute(parentAttribute, TaskAttribute.OPERATION);
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- attribute = createAttribute(parentAttribute, TaskAttribute.PREFIX_OPERATION + ++id);
- attribute.getMetaData().putValue(TaskAttribute.META_ATTRIBUTE_TYPE, TaskAttribute.TYPE_CONTAINER);
- attribute.getMetaData().putValue(TaskAttribute.META_LABEL,
- getValue(attributes, ITaskDataConstants.ATTRIBUTE_OPERATION_NAME));
- String operationId = getValue(attributes, ITaskDataConstants.ATTRIBUTE_KNOB_NAME);
- attribute.setValue(operationId);
-
- if (Boolean.parseBoolean(getValue(attributes, ITaskDataConstants.ATTRIBUTE_IS_CHECKED))) {
- operationAttribute.setValue(operationId);
- }
-
- String value = getOptionalValue(attributes, ITaskDataConstants.ATTRIBUTE_OPTION_NAME);
- TaskAttribute child;
- if (value.length() > 0) {
- attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, value);
- child = createAttribute(attribute, value);
- child.setValue(getOptionalValue(attributes, ITaskDataConstants.ATTRIBUTE_OPTION_SELECTION));
- attribute.getMetaData().defaults().setReadOnly(false).setType(TaskAttribute.TYPE_SINGLE_SELECT);
- addElementHandler(new NameHandler(this, child));
- } else {
- value = getOptionalValue(attributes, ITaskDataConstants.ATTRIBUTE_INPUT_NAME);
- if (value.length() > 0) {
- attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, value);
- child = createAttribute(attribute, value);
- child.setValue(getOptionalValue(attributes, ITaskDataConstants.ATTRIBUTE_INPUT_VALUE));
- attribute.getMetaData().defaults().setReadOnly(false).setType(TaskAttribute.TYPE_SHORT_TEXT);
- }
- }
- }
-
- }
-
- private class OptionHandler10 extends ElementHandler {
-
- private final TaskAttribute attribute;
-
- private String parameter;
-
- public OptionHandler10(ElementHandler parent, TaskAttribute attribute) {
- super(parent, ITaskDataConstants.ELEMENT_OPTION);
- this.attribute = attribute;
- }
-
- @Override
- public void end(String uri, String localName, String name) {
- attribute.putOption(parameter, getCurrentElementText());
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- parameter = getValue(attributes, ITaskDataConstants.ATTRIBUTE_PARAMETER);
- clearCurrentElementText();
- }
-
- }
-
- private class TaskDataHandler10 extends ElementHandler {
-
- private TaskData taskData;
-
- public TaskDataHandler10(TaskStateHandler parent, String elementName) {
- super(parent, elementName);
- }
-
- public TaskData getTaskData() {
- return taskData;
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- taskData = ((TaskStateHandler) getParent()).createTaskData(attributes);
- String taskKind = getOptionalValue(attributes, ITaskDataConstants.ATTRIBUTE_TASK_KIND);
- if (taskKind != null) {
- createAttribute(taskData.getRoot(), TaskAttribute.TASK_KIND).setValue(taskKind);
- }
-
- addElementHandler(new AttributeHandler10(this, taskData.getRoot()));
- addElementHandler(new CommentHandler10(this, taskData.getRoot()));
- addElementHandler(new AttachmentHandler10(this, taskData.getRoot()));
- addElementHandler(new OperationHandler10(this, taskData.getRoot()));
- // the selected operation was never serialized, no need to read it
- }
-
- }
-
- private class TaskDataHandler20 extends ElementHandler {
-
- private TaskData taskData;
-
- public TaskDataHandler20(TaskStateHandler parent, String elementName) {
- super(parent, elementName);
- }
-
- public TaskData getTaskData() {
- return taskData;
- }
-
- @Override
- public void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- taskData = ((TaskStateHandler) getParent()).createTaskData(attributes);
-
- // skip the root node
- ElementHandler handler = new ElementHandler(this, ITaskDataConstants.ELEMENT_ATTRIBUTE);
- handler.addElementHandler(new AttributeHandler20(handler, taskData.getRoot()));
- addElementHandler(handler);
- }
-
- }
-
- private class TaskStateHandler extends ElementHandler {
-
- private TaskAttributeMapper attributeMapper;
-
- private TaskDataState state;
-
- private final String version;
-
- public TaskStateHandler(String version) {
- super(null, ITaskDataConstants.ELEMENT_TASK_STATE);
- this.version = version;
-
- if ("1.0".equals(version)) {
- addElementHandler(new TaskDataHandler10(this, ITaskDataConstants.ELEMENT_NEW_DATA));
- addElementHandler(new TaskDataHandler10(this, ITaskDataConstants.ELEMENT_OLD_DATA));
- addElementHandler(new TaskDataHandler10(this, ITaskDataConstants.ELEMENT_EDITS_DATA));
- } else if ("2.0".equals(version)) {
- addElementHandler(new TaskDataHandler20(this, ITaskDataConstants.ELEMENT_NEW_DATA));
- addElementHandler(new TaskDataHandler20(this, ITaskDataConstants.ELEMENT_OLD_DATA));
- addElementHandler(new TaskDataHandler20(this, ITaskDataConstants.ELEMENT_EDITS_DATA));
- }
- }
-
- public TaskData createTaskData(Attributes attributes) throws SAXException {
- TaskData taskData;
- if (state == null) {
- String connectorKind = getValue(attributes, ITaskDataConstants.ATTRIBUTE_REPOSITORY_KIND);
- String repositoryUrl = getValue(attributes, ITaskDataConstants.ATTRIBUTE_REPOSITORY_URL);
- String taskId = getValue(attributes, ITaskDataConstants.ATTRIBUTE_ID);
- attributeMapper = getAttributeMapper(connectorKind, repositoryUrl);
- taskData = new TaskData(attributeMapper, connectorKind, repositoryUrl, taskId);
- } else {
- taskData = new TaskData(attributeMapper, state.getConnectorKind(), state.getRepositoryUrl(),
- state.getTaskId());
- }
- String taskDataVersion = getOptionalValue(attributes, ITaskDataConstants.ATTRIBUTE_VERSION);
- if (taskDataVersion.length() > 0) {
- taskData.setVersion(taskDataVersion);
- }
- return taskData;
- }
-
- @Override
- public void done(ElementHandler elementHandler) {
- TaskData taskData;
- if (elementHandler instanceof TaskDataHandler10) {
- TaskDataHandler10 taskDataHandler = (TaskDataHandler10) elementHandler;
- TaskData data = taskDataHandler.getTaskData();
- if (state == null) {
- state = new TaskDataState(data.getConnectorKind(), data.getRepositoryUrl(), data.getTaskId());
- }
- taskData = taskDataHandler.getTaskData();
- } else {
- TaskDataHandler20 taskDataHandler = (TaskDataHandler20) elementHandler;
- taskData = taskDataHandler.getTaskData();
- }
-
- if (ITaskDataConstants.ELEMENT_NEW_DATA.equals(elementHandler.getElementName())) {
- state.setRepositoryData(taskData);
- } else if (ITaskDataConstants.ELEMENT_OLD_DATA.equals(elementHandler.getElementName())) {
- state.setLastReadData(taskData);
- } else if (ITaskDataConstants.ELEMENT_EDITS_DATA.equals(elementHandler.getElementName())) {
- state.setEditsData(taskData);
- }
- super.done(elementHandler);
- }
-
- public TaskDataState getState() {
- return state;
- }
-
- @Override
- protected void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- if ("2.0".equals(version)) {
- String connectorKind = getValue(attributes, ITaskDataConstants.ATTRIBUTE_CONNECTOR_KIND);
- String repositoryUrl = getValue(attributes, ITaskDataConstants.ATTRIBUTE_REPOSITORY_URL);
- String taskId = getValue(attributes, ITaskDataConstants.ATTRIBUTE_TASK_ID);
- attributeMapper = getAttributeMapper(connectorKind, repositoryUrl);
- state = new TaskDataState(connectorKind, repositoryUrl, taskId);
- }
- }
- }
-
- private class ValueHandler10 extends ElementHandler {
-
- private final TaskAttribute attribute;
-
- public ValueHandler10(ElementHandler parent, TaskAttribute attribute) {
- super(parent, ITaskDataConstants.ELEMENT_VALUE);
- this.attribute = attribute;
- }
-
- @Override
- public void end(String uri, String localName, String name) {
- attribute.addValue(getCurrentElementText());
- }
-
- @Override
- protected void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- clearCurrentElementText();
- }
-
- }
-
- private class ValueHandler20 extends ElementHandler {
-
- private final TaskAttribute attribute;
-
- public ValueHandler20(ElementHandler parent, TaskAttribute attribute) {
- super(parent, ITaskDataConstants.ELEMENT_VALUE);
- this.attribute = attribute;
- }
-
- @Override
- public void end(String uri, String localName, String name) {
- attribute.addValue(getCurrentElementText());
- }
-
- @Override
- protected void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- clearCurrentElementText();
- }
-
- }
-
- private class MapHandler20 extends ElementHandler {
-
- private final TaskAttribute attribute;
-
- private String key = "";
-
- private String value = "";
-
- public MapHandler20(ElementHandler parent, TaskAttribute attribute, String elementName) {
- super(parent, elementName);
- this.attribute = attribute;
- }
-
- @Override
- public void end(String uri, String localName, String name) {
- if (ITaskDataConstants.ELEMENT_OPTION.equals(getElementName())) {
- attribute.putOption(key, value);
- } else if (ITaskDataConstants.ELEMENT_META.equals(getElementName())) {
- attribute.getMetaData().putValue(key, value);
- }
- key = "";
- value = "";
- }
-
- @Override
- protected void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- addElementHandler(new TextHandler20(this, ITaskDataConstants.ELEMENT_KEY));
- addElementHandler(new TextHandler20(this, ITaskDataConstants.ELEMENT_VALUE));
- }
-
- @Override
- protected void done(ElementHandler handler) {
- if (ITaskDataConstants.ELEMENT_KEY.equals(handler.getElementName())) {
- key = handler.getCurrentElementText();
- } else if (ITaskDataConstants.ELEMENT_VALUE.equals(handler.getElementName())) {
- value = handler.getCurrentElementText();
- }
- super.done(handler);
- }
-
- }
-
- private class TextHandler20 extends ElementHandler {
-
- public TextHandler20(ElementHandler parent, String elementName) {
- super(parent, elementName);
- }
-
- @Override
- protected void start(String uri, String localName, String name, Attributes attributes) throws SAXException {
- clearCurrentElementText();
- }
-
- }
-
- private TaskStateHandler handler;
-
- private final IRepositoryManager repositoryManager;
-
- private TaskDataState result;
-
- public TaskDataStateReader(IRepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
- }
-
- @Override
- public void characters(char[] ch, int start, int length) throws SAXException {
- if (handler != null) {
- handler.characters(ch, start, length);
- }
- }
-
- private TaskAttribute createAttribute(TaskAttribute parent, String id) {
- TaskAttribute attribute = parent.createAttribute(id);
- attribute.getMetaData().defaults();
- return attribute;
- }
-
- @Override
- public void endElement(String uri, String localName, String name) throws SAXException {
- if (handler != null) {
- handler.endElement(uri, localName, name);
- if (ITaskDataConstants.ELEMENT_TASK_STATE.equals(name)) {
- result = handler.getState();
- handler = null;
- }
- }
- }
-
- private TaskAttributeMapper getAttributeMapper(String connectorKind, String repositoryUrl) throws SAXException {
- AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(connectorKind);
- if (connector == null) {
- throw new SAXException("No repository connector for kind \"" + connectorKind + "\" found");
- }
-
- TaskRepository taskRepository = repositoryManager.getRepository(connectorKind, repositoryUrl);
- if (taskRepository == null) {
- throw new SAXException("Repository \"" + repositoryUrl + "\" not found for kind \"" + connectorKind + "\"");
- }
-
- final TaskAttributeMapper attributeMapper;
- AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- if (taskDataHandler != null) {
- attributeMapper = taskDataHandler.getAttributeMapper(taskRepository);
- } else {
- attributeMapper = new TaskAttributeMapper(taskRepository);
- }
- return attributeMapper;
- }
-
- public TaskDataState getTaskDataState() {
- return result;
- }
-
- @Override
- public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
- if (handler != null) {
- handler.startElement(uri, localName, name, attributes);
- }
- if (ITaskDataConstants.ELEMENT_TASK_STATE.equals(name)) {
- String version = attributes.getValue(ITaskDataConstants.ATTRIBUTE_VERSION);
- handler = new TaskStateHandler(version);
- handler.start(uri, localName, name, attributes);
- }
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateWriter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateWriter.java
deleted file mode 100644
index c8da51699..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStateWriter.java
+++ /dev/null
@@ -1,121 +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.core.data;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.transform.sax.TransformerHandler;
-
-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.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskDataStateWriter {
-
- private static final String TASK_DATA_STATE_VERSION = "2.0";
-
- private static final String CDATA = "CDATA";
-
- private final TransformerHandler handler;
-
- public TaskDataStateWriter(TransformerHandler handler) {
- this.handler = handler;
- }
-
- public void write(ITaskDataWorkingCopy state) throws SAXException {
- handler.startDocument();
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_CONNECTOR_KIND, CDATA, state.getConnectorKind());
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_REPOSITORY_URL, CDATA, state.getRepositoryUrl());
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_TASK_ID, CDATA, state.getTaskId());
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_VERSION, CDATA, TASK_DATA_STATE_VERSION);
- handler.startElement("", "", ITaskDataConstants.ELEMENT_TASK_STATE, atts);
- if (state.getRepositoryData() != null) {
- writeTaskData(state.getRepositoryData(), ITaskDataConstants.ELEMENT_NEW_DATA);
- }
- if (state.getLastReadData() != null) {
- writeTaskData(state.getLastReadData(), ITaskDataConstants.ELEMENT_OLD_DATA);
- }
- if (state.getEditsData() != null) {
- writeTaskData(state.getEditsData(), ITaskDataConstants.ELEMENT_EDITS_DATA);
- }
- handler.endElement("", "", ITaskDataConstants.ELEMENT_TASK_STATE);
- handler.endDocument();
- }
-
- private void writeTaskData(TaskData taskData, String elementName) throws SAXException {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_CONNECTOR_KIND, CDATA, taskData.getConnectorKind());
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_REPOSITORY_URL, CDATA, taskData.getRepositoryUrl());
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_TASK_ID, CDATA, taskData.getTaskId());
- if (taskData.getVersion() != null) {
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_VERSION, CDATA, taskData.getVersion());
- }
- handler.startElement("", "", elementName, atts);
- atts.clear();
- handler.startElement("", "", ITaskDataConstants.ELEMENT_ATTRIBUTES, atts);
- writeTaskAttribute(taskData.getRoot());
- handler.endElement("", "", ITaskDataConstants.ELEMENT_ATTRIBUTES);
- handler.endElement("", "", elementName);
- }
-
- private void writeTaskAttribute(TaskAttribute attribute) throws SAXException {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "", ITaskDataConstants.ATTRIBUTE_ID, CDATA, attribute.getId());
- handler.startElement("", "", ITaskDataConstants.ELEMENT_ATTRIBUTE, atts);
- atts.clear();
-
- handler.startElement("", "", ITaskDataConstants.ELEMENT_VALUES, atts);
- List<String> values = attribute.getValues();
- for (String value : values) {
- handler.startElement("", "", ITaskDataConstants.ELEMENT_VALUE, atts);
- handler.characters(value.toCharArray(), 0, value.length());
- handler.endElement("", "", ITaskDataConstants.ELEMENT_VALUE);
- }
- handler.endElement("", "", ITaskDataConstants.ELEMENT_VALUES);
-
- handler.startElement("", "", ITaskDataConstants.ELEMENT_OPTIONS, atts);
- writeMap(atts, attribute.getOptions(), ITaskDataConstants.ELEMENT_OPTION);
- handler.endElement("", "", ITaskDataConstants.ELEMENT_OPTIONS);
-
- handler.startElement("", "", ITaskDataConstants.ELEMENT_META_DATA, atts);
- writeMap(atts, attribute.getMetaData().getValues(), ITaskDataConstants.ELEMENT_META);
- handler.endElement("", "", ITaskDataConstants.ELEMENT_META_DATA);
-
- handler.startElement("", "", ITaskDataConstants.ELEMENT_ATTRIBUTES, atts);
- Map<String, TaskAttribute> children = attribute.getAttributes();
- for (TaskAttribute child : children.values()) {
- writeTaskAttribute(child);
- }
- handler.endElement("", "", ITaskDataConstants.ELEMENT_ATTRIBUTES);
-
- handler.endElement("", "", ITaskDataConstants.ELEMENT_ATTRIBUTE);
- }
-
- private void writeMap(AttributesImpl atts, Map<String, String> options, String elementName) throws SAXException {
- for (String key : options.keySet()) {
- String value = options.get(key);
- handler.startElement("", "", elementName, atts);
- handler.startElement("", "", ITaskDataConstants.ELEMENT_KEY, atts);
- handler.characters(key.toCharArray(), 0, key.length());
- handler.endElement("", "", ITaskDataConstants.ELEMENT_KEY);
- handler.startElement("", "", ITaskDataConstants.ELEMENT_VALUE, atts);
- handler.characters(value.toCharArray(), 0, value.length());
- handler.endElement("", "", ITaskDataConstants.ELEMENT_VALUE);
- handler.endElement("", "", elementName);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStore.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStore.java
deleted file mode 100644
index ff1fcbdf5..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TaskDataStore.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.core.data;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.core.runtime.Assert;
-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.ITasksCoreConstants;
-import org.eclipse.mylyn.tasks.core.IRepositoryManager;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- */
-public class TaskDataStore {
-
- private static final String FILE_NAME_INTERNAL = "data.xml";
-
- private final TaskDataExternalizer externalizer;
-
- public TaskDataStore(IRepositoryManager taskRepositoryManager) {
- this.externalizer = new TaskDataExternalizer(taskRepositoryManager);
- }
-
- public void discardEdits(File file) throws CoreException {
- TaskDataState state = readState(file);
- if (state != null) {
- state.setEditsData(null);
- }
- writeState(file, state);
- }
-
- public TaskDataState getTaskDataState(File file) throws CoreException {
- return readState(file);
- }
-
- public synchronized void putEdits(File file, TaskData data) throws CoreException {
- Assert.isNotNull(file);
- Assert.isNotNull(data);
- TaskDataState state = readState(file);
- if (state == null) {
- state = new TaskDataState(data.getConnectorKind(), data.getRepositoryUrl(), data.getTaskId());
- }
- state.setEditsData(data);
- writeState(file, state);
- }
-
- public synchronized void putTaskData(File file, TaskData data, boolean setLastRead, boolean user)
- throws CoreException {
- Assert.isNotNull(file);
- Assert.isNotNull(data);
- TaskDataState state = null;
- try {
- state = readState(file);
- } catch (CoreException e) {
- if (!user) {
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- ITasksCoreConstants.ID_PLUGIN,
- "Reading of existing task data failed. Forcing synchronization will override outgoing changes.",
- e));
- }
- }
- if (state == null) {
- state = new TaskDataState(data.getConnectorKind(), data.getRepositoryUrl(), data.getTaskId());
- }
- if (setLastRead) {
- state.setLastReadData(state.getRepositoryData());
- }
- state.setRepositoryData(data);
- writeState(file, state);
- }
-
- public synchronized void setTaskData(File file, TaskData data) throws CoreException {
- Assert.isNotNull(file);
- Assert.isNotNull(data);
-
- // TODO consider reading old task data and compare submitted results to check if all outgoing changes were accepted by repository
-
- TaskDataState state = new TaskDataState(data.getConnectorKind(), data.getRepositoryUrl(), data.getTaskId());
- state.setRepositoryData(data);
- state.setEditsData(null);
- state.setLastReadData(data);
- writeState(file, state);
- }
-
- private TaskDataState readState(File file) throws CoreException {
- try {
- if (file.exists()) {
- ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(file)));
- try {
- in.getNextEntry();
- return externalizer.readState(in);
- } finally {
- in.close();
- }
- }
- return null;
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Error reading task data",
- e));
- }
- }
-
- private void writeState(File file, TaskDataState state) throws CoreException {
- try {
- ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
- try {
- out.setMethod(ZipOutputStream.DEFLATED);
-
- ZipEntry entry = new ZipEntry(FILE_NAME_INTERNAL);
- out.putNextEntry(entry);
-
- externalizer.writeState(out, state);
- } finally {
- out.close();
- }
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Error writing task data",
- e));
- }
- }
-
-// public synchronized void putLastRead(File file, TaskData data) throws CoreException {
-// Assert.isNotNull(file);
-// Assert.isNotNull(data);
-//
-// TaskDataState state = readState(file);
-// if (state == null) {
-// state = new TaskDataState(data.getConnectorKind(), data.getRepositoryUrl(), data.getTaskId());
-// }
-// state.setLastReadData(data);
-// writeState(file, state);
-// }
-
- public void putTaskData(File file, TaskDataState state) throws CoreException {
- writeState(file, state);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TextTaskAttachmentSource.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TextTaskAttachmentSource.java
deleted file mode 100644
index d6ced41e4..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/data/TextTaskAttachmentSource.java
+++ /dev/null
@@ -1,56 +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.core.data;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-
-public class TextTaskAttachmentSource extends AbstractTaskAttachmentSource {
-
- private final String contents;
-
- public TextTaskAttachmentSource(String contents) {
- this.contents = contents;
- }
-
- @Override
- public InputStream createInputStream(IProgressMonitor monitor) throws CoreException {
- return new ByteArrayInputStream(contents.getBytes());
- }
-
- @Override
- public String getContentType() {
- return "text/plain";
- }
-
- @Override
- public String getDescription() {
- return "";
- }
-
- @Override
- public long getLength() {
- return contents.getBytes().length;
- }
-
- @Override
- public String getName() {
- return "clipboard.txt";
- }
-
- @Override
- public boolean isLocal() {
- return true;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttachmentHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttachmentHandler.java
deleted file mode 100644
index ddac65584..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttachmentHandler.java
+++ /dev/null
@@ -1,94 +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.core.deprecated;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-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.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Extend to provide facility for downloading files from the task repository.
- *
- * @author Steffen Pingel
- * @since 2.0
- */
-@Deprecated
-public abstract class AbstractAttachmentHandler {
-
- protected static final int BUFFER_SIZE = 1024;
-
- public abstract void uploadAttachment(TaskRepository repository, ITask task, ITaskAttachment attachment,
- String comment, IProgressMonitor monitor) throws CoreException;
-
- public abstract InputStream getAttachmentAsStream(TaskRepository repository, RepositoryAttachment attachment,
- IProgressMonitor monitor) throws CoreException;
-
- public abstract boolean canUploadAttachment(TaskRepository repository, ITask task);
-
- public abstract boolean canDownloadAttachment(TaskRepository repository, ITask task);
-
- public abstract boolean canDeprecate(TaskRepository repository, RepositoryAttachment attachment);
-
- /**
- * To deprecate, change the attribute on the RepositoryAttachment and pass to this method
- */
- public abstract void updateAttachment(TaskRepository repository, RepositoryAttachment attachment)
- throws CoreException;
-
- public void downloadAttachment(TaskRepository repository, RepositoryAttachment attachment, OutputStream out,
- IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Downloading attachment", IProgressMonitor.UNKNOWN);
- try {
- InputStream in = new BufferedInputStream(getAttachmentAsStream(repository, attachment,
- new SubProgressMonitor(monitor, 1)));
- try {
- byte[] buffer = new byte[BUFFER_SIZE];
- while (true) {
- int count = in.read(buffer);
- if (count == -1) {
- return;
- }
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- out.write(buffer, 0, count);
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
- } catch (IOException e) {
- throw new CoreException(RepositoryStatus.createStatus(repository, IStatus.ERROR,
- "org.eclipse.mylyn.tasks.core", "IO error reading attachment: " + e.getMessage()));
- } finally {
- try {
- in.close();
- } catch (IOException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Error closing attachment stream", e));
- }
- }
- } finally {
- monitor.done();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttributeFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttributeFactory.java
deleted file mode 100644
index eab62f36a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractAttributeFactory.java
+++ /dev/null
@@ -1,47 +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.core.deprecated;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-
-/**
- * Extend to provide mapping between repository task attribute IDs and native repository IDs.
- *
- * @author Rob Elves
- * @since 2.0
- * @deprecated use {@link TaskAttributeMapper} instead
- */
-@SuppressWarnings("serial")
-@Deprecated
-public abstract class AbstractAttributeFactory implements Serializable {
-
- public RepositoryTaskAttribute createAttribute(String key) {
- String mapped = mapCommonAttributeKey(key);
- RepositoryTaskAttribute attribute = new RepositoryTaskAttribute(mapped, getName(mapped), isHidden(mapped));
- attribute.setReadOnly(isReadOnly(mapped));
- return attribute;
- }
-
- public abstract String mapCommonAttributeKey(String key);
-
- public abstract String getName(String key);
-
- public abstract boolean isReadOnly(String key);
-
- public abstract boolean isHidden(String key);
-
- /**
- * @return null if date cannot be parsed
- */
- public abstract Date getDateForAttributeType(String attributeKey, String dateString);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyDuplicateDetector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyDuplicateDetector.java
deleted file mode 100644
index 55eeee2fa..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyDuplicateDetector.java
+++ /dev/null
@@ -1,92 +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.core.deprecated;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-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.TaskData;
-
-/**
- * Extend to provide task duplicate detection facilities to the task editor (e.g. Java stack trace matching).
- *
- * @author Gail Murphy
- * @since 3.0
- */
-@Deprecated
-public abstract class AbstractLegacyDuplicateDetector extends AbstractDuplicateDetector {
-
- public abstract RepositoryQuery getDuplicatesQuery(TaskRepository repository, RepositoryTaskData taskData);
-
- public void setKind(String kind) {
- setConnectorKind(kind);
- }
-
- public String getKind() {
- return getConnectorKind();
- }
-
- @Override
- public IRepositoryQuery getDuplicatesQuery(TaskRepository repository, TaskData taskData) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * TODO: Move to a core utility class
- */
- public static String getStackTraceFromDescription(String description) {
- String stackTrace = null;
-
- if (description == null) {
- return null;
- }
-
- String punct = "!\"#$%&'\\(\\)*+,-./:;\\<=\\>?@\\[\\]^_`\\{|\\}~\n";
- String lineRegex = " *at\\s+[\\w" + punct + "]+ ?\\(.*\\) *\n?";
- 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");
- stackStart = (stackStart == -1) ? 0 : stackStart + 1;
-
- stackTrace = description.substring(stackStart, lastEnd);
- }
-
- return stackTrace;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyRepositoryConnector.java
deleted file mode 100644
index 50767c2c7..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractLegacyRepositoryConnector.java
+++ /dev/null
@@ -1,435 +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.core.deprecated;
-
-import java.util.Date;
-import java.util.LinkedHashSet;
-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.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
-import org.eclipse.mylyn.internal.tasks.core.ITaskList;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.internal.tasks.core.sync.SynchronizationSession;
-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.RepositoryTemplate;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-
-/**
- * Encapsulates common operations that can be performed on a task repository. Extend to connect with a Java API or WS
- * API for accessing the repository.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Shawn Minto
- * @since 2.0
- */
-@Deprecated
-public abstract class AbstractLegacyRepositoryConnector extends AbstractRepositoryConnector {
-
- @Deprecated
- protected Set<RepositoryTemplate> templates = new LinkedHashSet<RepositoryTemplate>();
-
- @Deprecated
- private static final long HOUR = 1000L * 3600L;
-
- @Deprecated
- private static final long DAY = HOUR * 24L;
-
- @Deprecated
- protected ITaskList taskList;
-
- private ITaskDataManager taskDataManager;
-
- private boolean userManaged = true;
-
- /**
- * @since 3.0
- */
- @Deprecated
- public void init(ITaskList taskList) {
- this.taskList = taskList;
- }
-
- /**
- * Set upon construction
- *
- * @since 3.0
- */
- public void init(ITaskDataManager taskDataManager) {
- this.taskDataManager = taskDataManager;
- }
-
- /**
- * @return null if not supported
- */
- @Deprecated
- public abstract AbstractAttachmentHandler getAttachmentHandler();
-
- /**
- * @return null if not supported
- */
- @Deprecated
- public abstract AbstractTaskDataHandler getLegacyTaskDataHandler();
-
- /**
- * create task and necessary subtasks (1 level nesting)
- *
- * @deprecated use {@link TasksUiUtil#createTask(TaskRepository, String, IProgressMonitor)} instead
- */
- @Deprecated
- public ITask createTaskFromExistingId(TaskRepository repository, String id, IProgressMonitor monitor)
- throws CoreException {
- return createTaskFromExistingId(repository, id, true, monitor);
- }
-
- /**
- * Create new repository task, adding result to tasklist
- *
- * @deprecated use {@link TasksUiUtil#createTask(TaskRepository, String, IProgressMonitor)} instead
- */
- @Deprecated
- public AbstractTask createTaskFromExistingId(TaskRepository repository, String id, boolean retrieveSubTasks,
- IProgressMonitor monitor) throws CoreException {
- AbstractTask repositoryTask = (AbstractTask) taskList.getTask(repository.getRepositoryUrl(), id);
- if (repositoryTask == null && getLegacyTaskDataHandler() != null) {
- RepositoryTaskData taskData = null;
- taskData = getLegacyTaskDataHandler().getTaskData(repository, id, new SubProgressMonitor(monitor, 1));
- if (taskData != null) {
- repositoryTask = createTaskFromTaskData(repository, taskData, retrieveSubTasks, new SubProgressMonitor(
- monitor, 1));
- if (repositoryTask != null) {
- repositoryTask.setSynchronizationState(SynchronizationState.INCOMING);
- taskList.addTask(repositoryTask);
- }
- }
- } // TODO: Handle case similar to web tasks (no taskDataHandler but
- // have tasks)
-
- return repositoryTask;
- }
-
- /**
- * Creates a new task from the given task data. Does NOT add resulting task to the tasklist
- *
- * @deprecated use {@link TasksUiUtil#createTask(TaskRepository, String, IProgressMonitor)} instead
- */
- @Deprecated
- public AbstractTask createTaskFromTaskData(TaskRepository repository, RepositoryTaskData taskData,
- boolean retrieveSubTasks, IProgressMonitor monitor) throws CoreException {
- AbstractTask repositoryTask = null;
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- try {
- if (taskData != null && getTaskDataManager() != null) {
- // Use connector task factory
- repositoryTask = createTask(repository.getRepositoryUrl(), taskData.getTaskId(), taskData.getTaskId()
- + ": " + taskData.getDescription());
- updateTaskFromTaskData(repository, repositoryTask, taskData);
- ((TaskDataManager) getTaskDataManager()).setNewTaskData(taskData);
-
- if (retrieveSubTasks) {
- monitor.beginTask("Creating task", getLegacyTaskDataHandler().getSubTaskIds(taskData).size());
- for (String subId : getLegacyTaskDataHandler().getSubTaskIds(taskData)) {
- if (subId == null || subId.trim().equals("")) {
- continue;
- }
- AbstractTask subTask = createTaskFromExistingId(repository, subId, false,
- new SubProgressMonitor(monitor, 1));
- if (subTask != null) {
- taskList.addTask(subTask, repositoryTask);
- }
- }
- }
- }
- } finally {
- monitor.done();
- }
- return repositoryTask;
- }
-
- /**
- * Utility method for construction of connector specific task object.
- *
- * @return instance of AbstractTask
- */
- @Deprecated
- public abstract AbstractTask createTask(String repositoryUrl, String id, String summary);
-
- /**
- * @since 2.0
- * @deprecated use {@link #performQuery(TaskRepository, RepositoryQuery, TaskDataCollector,
- * SynchronizationSession, IProgressMonitor)} instead
- */
- @Deprecated
- public IStatus performQuery(IRepositoryQuery query, TaskRepository repository, IProgressMonitor monitor,
- final ITaskCollector resultCollector) {
- return null;
- }
-
- /**
- * Updates the properties of <code>repositoryTask</code>. Invoked when on task synchronization if
- * {@link #getLegacyTaskDataHandler()} returns <code>null</code> or
- * {@link AbstractTaskDataHandler#getTaskData(TaskRepository, String)} returns <code>null</code>.
- *
- * <p>
- * Connectors that provide {@link RepositoryTaskData} objects for all tasks do not need to implement this method.
- *
- * @param repository
- * the repository
- * @param repositoryTask
- * the task that is synchronized
- * @throws CoreException
- * thrown in case of error while synchronizing
- * @see {@link #getLegacyTaskDataHandler()}
- */
- @Deprecated
- public void updateTaskFromRepository(TaskRepository repository, ITask repositoryTask, IProgressMonitor monitor)
- throws CoreException {
- }
-
- /**
- * Updates task with latest information from <code>taskData</code>.
- *
- * @return true, if properties of <code>task</code> were changed
- * @since 3.0
- */
- @Deprecated
- public abstract boolean updateTaskFromTaskData(TaskRepository repository, ITask task, RepositoryTaskData taskData);
-
- /**
- * Updates <code>existingTask</code> with latest information from <code>queryHit</code>.
- *
- * @return true, if properties of <code>existingTask</code> were changed
- * @since 2.0
- * @deprecated use {@link #updateTaskFromTaskData(TaskRepository, AbstractTask, RepositoryTaskData)} instead
- */
- @Deprecated
- public boolean updateTaskFromQueryHit(TaskRepository repository, ITask existingTask, AbstractTask queryHit) {
- boolean changed = false;
- if (existingTask.isCompleted() != queryHit.isCompleted()) {
- ((AbstractTask) existingTask).setCompleted(queryHit.isCompleted());
- changed = true;
- }
- if (hasTaskPropertyChanged(existingTask.getSummary(), queryHit.getSummary())) {
- existingTask.setSummary(queryHit.getSummary());
- changed = true;
- }
- if (hasTaskPropertyChanged(existingTask.getDueDate(), queryHit.getDueDate())) {
- existingTask.setDueDate(queryHit.getDueDate());
- changed = true;
- }
- if (hasTaskPropertyChanged(existingTask.getOwner(), queryHit.getOwner())) {
- existingTask.setOwner(queryHit.getOwner());
- changed = true;
- }
- if (hasTaskPropertyChanged(existingTask.getPriority(), queryHit.getPriority())) {
- existingTask.setPriority(queryHit.getPriority());
- changed = true;
- }
- if (hasTaskPropertyChanged(existingTask.getUrl(), queryHit.getUrl())) {
- existingTask.setUrl(queryHit.getUrl());
- changed = true;
- }
-
- return changed;
- }
-
- @Deprecated
- protected final boolean hasTaskPropertyChanged(Object existingProperty, Object newProperty) {
- // the query hit does not have this property
- if (newProperty == null) {
- return false;
- }
- return (existingProperty == null) ? true : !existingProperty.equals(newProperty);
- }
-
- @Deprecated
- public String[] getPepositoryPropertyNames() {
- return new String[] { IRepositoryConstants.PROPERTY_VERSION, IRepositoryConstants.PROPERTY_TIMEZONE,
- IRepositoryConstants.PROPERTY_ENCODING };
- }
-
- /**
- * Of <code>tasks</code> provided, return all that have changed since last synchronization of
- * <code>repository</code>.
- *
- * Tasks that need to be synchronized (i.e. task data updated) should be passed to
- * <code>collector.accept(Task)</code> method, or if repository connector can update task data, it can use
- * <code>collector.accept(RepositoryTaskData)</code> call.
- *
- * All errors should be thrown as <code>CoreException</code> for the framework to handle, since background
- * synchronizations fail silently when disconnected.
- *
- * @return false if there was no tasks changed in the repository, otherwise collection of updated tasks (within
- * <code>tasks</code> collection), so empty collection means that there are some other tasks changed
- *
- * @throws CoreException
- * @deprecated use {@link #preQuerySynchronization(TaskRepository, SynchronizationSession, IProgressMonitor)}
- * instead
- */
- @Deprecated
- public boolean markStaleTasks(TaskRepository repository, Set<AbstractTask> tasks, IProgressMonitor monitor)
- throws CoreException {
- return false;
- }
-
- /**
- * @deprecated use {@link RepositoryTemplateManager#addTemplate(String, RepositoryTemplate)} instead
- */
- @Deprecated
- public void addTemplate(RepositoryTemplate template) {
- this.templates.add(template);
- }
-
- /**
- * @deprecated use {@link RepositoryTemplateManager#getTemplates(String)} instead
- */
- @Deprecated
- public Set<RepositoryTemplate> getTemplates() {
- return templates;
- }
-
- /**
- * @deprecated use {@link RepositoryTemplateManager#removeTemplate(String, RepositoryTemplate)} instead
- */
- @Deprecated
- public void removeTemplate(RepositoryTemplate template) {
- this.templates.remove(template);
- }
-
- /**
- * @deprecated use {@link RepositoryTemplateManager#getTemplate(String, String)} instead
- */
- @Deprecated
- public RepositoryTemplate getTemplate(String label) {
- for (RepositoryTemplate template : getTemplates()) {
- if (template.label.equals(label)) {
- return template;
- }
- }
- return null;
- }
-
- /**
- * Reset and update the repository attributes from the server (e.g. products, components)
- *
- * API-3.0: Rename to updateRepositoryConfiguration()
- *
- * @deprecated Use {@link #updateRepositoryConfiguration(TaskRepository,IProgressMonitor)} instead
- */
- @Deprecated
- public void updateAttributes(TaskRepository repository, IProgressMonitor monitor) throws CoreException {
- }
-
- /**
- * Following synchronization, the timestamp needs to be recorded. This provides a default implementation for
- * determining the last synchronization timestamp. Override to return actual timestamp from repository.
- *
- * @deprecated
- */
- // API 3.0 move to utility class
- @Deprecated
- public String getSynchronizationTimestamp(TaskRepository repository, Set<ITask> changedTasks) {
- Date mostRecent = new Date(0);
- String mostRecentTimeStamp = repository.getSynchronizationTimeStamp();
- for (ITask task : changedTasks) {
- Date taskModifiedDate;
- RepositoryTaskData taskData = getTaskData(task);
- if (taskData != null && getLegacyTaskDataHandler() != null && taskData.getLastModified() != null) {
- taskModifiedDate = taskData.getAttributeFactory().getDateForAttributeType(
- RepositoryTaskAttribute.DATE_MODIFIED, taskData.getLastModified());
- } else {
- continue;
- }
-
- if (taskModifiedDate != null && taskModifiedDate.after(mostRecent)) {
- mostRecent = taskModifiedDate;
- mostRecentTimeStamp = taskData.getLastModified();
- }
- }
- return mostRecentTimeStamp;
- }
-
- @Deprecated
- private RepositoryTaskData getTaskData(ITask task) {
- if (getTaskDataManager() != null) {
- return ((TaskDataManager) getTaskDataManager()).getNewTaskData(task.getRepositoryUrl(), task.getTaskId());
- }
- return null;
- }
-
- @Deprecated
- public RepositoryTaskData getLegacyTaskData(TaskRepository repository, String taskId, IProgressMonitor monitor)
- throws CoreException {
- if (getLegacyTaskDataHandler() != null) {
- return getLegacyTaskDataHandler().getTaskData(repository, taskId, monitor);
- }
- throw new UnsupportedOperationException();
- }
-
- public void setUserManaged(boolean userManaged) {
- this.userManaged = userManaged;
- }
-
- /**
- * If false, user is unable to manipulate (i.e. rename/delete), no preferences are available.
- */
- @Override
- public boolean isUserManaged() {
- return userManaged;
- }
-
- /**
- * @since 3.0
- */
- @Override
- public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @since 3.0
- */
- @Override
- public void updateTaskFromTaskData(TaskRepository repository, ITask task, TaskData taskData) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @since 3.0
- */
- @Override
- public TaskData getTaskData(TaskRepository taskRepository, String taskId, IProgressMonitor monitor)
- throws CoreException {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @since 3.0
- */
- protected ITaskDataManager getTaskDataManager() {
- return taskDataManager;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskDataHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskDataHandler.java
deleted file mode 100644
index 5bb9ebacd..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskDataHandler.java
+++ /dev/null
@@ -1,177 +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.core.deprecated;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-
-/**
- * Responsible for retrieving and posting task data to a repository.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- * @author Frank Becker
- * @since 2.0
- */
-@Deprecated
-public abstract class AbstractTaskDataHandler {
-
- /**
- * Download copy of task data from repository
- *
- * @throws CoreException
- */
- public abstract RepositoryTaskData getTaskData(TaskRepository repository, String taskId, IProgressMonitor monitor)
- throws CoreException;
-
- /**
- * Download task data for each id provided
- *
- * Override getMultiTaskData() to return true and implement this method if connector supports download of multiple
- * task data in one request.
- *
- * @since 3.0
- */
- public void getMultiTaskData(TaskRepository repository, Set<String> taskIds, TaskDataCollector collector,
- IProgressMonitor monitor) throws CoreException {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Return a reference to the newly created report in the case of new task submission, null otherwise
- */
- public abstract String postTaskData(TaskRepository repository, RepositoryTaskData taskData, IProgressMonitor monitor)
- throws CoreException;
-
- /**
- * @param repositoryUrl
- * @param repositoryKind
- * @param taskKind
- * AbstractTask.DEFAULT_KIND or connector specific task kind string
- * @return
- */
- public abstract AbstractAttributeFactory getAttributeFactory(String repositoryUrl, String repositoryKind,
- String taskKind);
-
- /**
- * Initialize a new task data object with default attributes and values
- */
- public abstract boolean initializeTaskData(TaskRepository repository, RepositoryTaskData data,
- IProgressMonitor monitor) throws CoreException;
-
- /**
- * @since 2.2
- * @return false if this operation is not supported by the connector, true if initialized
- */
- public boolean initializeSubTaskData(TaskRepository repository, RepositoryTaskData taskData,
- RepositoryTaskData parentTaskData, IProgressMonitor monitor) throws CoreException {
- return false;
- }
-
- /**
- * @param task
- * the parent task, may be null
- * @param task
- * the parent task data, may be null
- * @since 2.2
- */
- public boolean canInitializeSubTaskData(ITask task, RepositoryTaskData parentTaskData) {
- return false;
- }
-
- public abstract AbstractAttributeFactory getAttributeFactory(RepositoryTaskData taskData);
-
- /**
- * @return Task id for any sub tasks referenced by the provided task data
- */
- public Set<String> getSubTaskIds(RepositoryTaskData taskData) {
- return Collections.emptySet();
- }
-
- /**
- * @return true if connector support downloading multiple task data in single request, false otherwise. If true,
- * override and implement getMultiTaskData
- */
- public boolean canGetMultiTaskData() {
- return false;
- }
-
- /**
- * Sets attribute values from <code>sourceTaskData</code> on <code>targetTaskData</code>. Sets the following
- * attributes:
- * <ul>
- * <li>summary
- * <li>description
- * </ul>
- * Other attribute values are only set if they exist on <code>sourceTaskData</code> and <code>targetTaskData</code>.
- *
- * @param sourceTaskData
- * the source task data values are copied from, the connector kind of repository of <code>sourceTaskData</code>
- * can be different from <code>targetTaskData</code>
- * @param targetTaskData
- * the target task data values are copied to, the connector kind matches the one of this task data handler
- * @since 2.2
- */
- public void cloneTaskData(RepositoryTaskData sourceTaskData, RepositoryTaskData targetTaskData) {
- targetTaskData.setSummary(sourceTaskData.getSummary());
- targetTaskData.setDescription(sourceTaskData.getDescription());
- if (sourceTaskData.getConnectorKind().equals(targetTaskData.getConnectorKind())
- && sourceTaskData.getTaskKind().equals(targetTaskData.getTaskKind())) {
- // task data objects are from the same connector, copy all attributes
- for (RepositoryTaskAttribute sourceAttribute : sourceTaskData.getAttributes()) {
- copyAttributeValue(sourceAttribute, targetTaskData.getAttribute(sourceAttribute.getId()));
- }
- } else {
- // map attributes from common schema
- String[] commonAttributeKeys = new String[] { RepositoryTaskAttribute.KEYWORDS,
- RepositoryTaskAttribute.PRIORITY, RepositoryTaskAttribute.PRODUCT,
- RepositoryTaskAttribute.COMPONENT, RepositoryTaskAttribute.RESOLUTION,
- RepositoryTaskAttribute.USER_ASSIGNED, RepositoryTaskAttribute.USER_CC, };
- for (String key : commonAttributeKeys) {
- RepositoryTaskAttribute sourceAttribute = sourceTaskData.getAttribute(key);
- if (sourceAttribute != null) {
- copyAttributeValue(sourceAttribute, targetTaskData.getAttribute(key));
- }
- }
- }
- }
-
- private void copyAttributeValue(RepositoryTaskAttribute sourceAttribute, RepositoryTaskAttribute targetAttribute) {
- if (targetAttribute == null) {
- return;
- }
-
- if (!sourceAttribute.isReadOnly() && !sourceAttribute.isHidden() && !targetAttribute.isHidden()
- && !targetAttribute.isReadOnly()) {
- targetAttribute.clearValues();
- if (targetAttribute.getOptions().size() > 0) {
- List<String> values = sourceAttribute.getValues();
- for (String value : values) {
- if (targetAttribute.getOptions().contains(value)) {
- targetAttribute.addValue(value);
- }
- }
- } else {
- List<String> values = sourceAttribute.getValues();
- for (String value : values) {
- targetAttribute.addValue(value);
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskListFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskListFactory.java
deleted file mode 100644
index b06ac6ea4..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AbstractTaskListFactory.java
+++ /dev/null
@@ -1,187 +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.core.deprecated;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.w3c.dom.Element;
-
-/**
- * Responsible for storing and creating task list elements.
- *
- * When overriding these methods be sure not to perform network access since the Task List is read and written
- * frequently.
- *
- * @author Mik Kersten
- * @author Ken Sueda
- * @since 2.0
- */
-public abstract class AbstractTaskListFactory {
-
- public static final String KEY_QUERY = "Query";
-
- public static final String KEY_QUERY_STRING = "QueryString";
-
- public static final String KEY_TASK = "Task";
-
- /**
- * Returns true if factory can create an XML element to store given {@link AbstractTask}.
- * <p>
- * The name of the XML element is taken from the {@link #getTaskElementName()} method and additional task attributes
- * can be stored in {@link #setAdditionalAttributes(AbstractTask, Element)} method.
- *
- * @param task
- * a task instance to create XML element for
- *
- * @return true if factory can create XML element to store given {@link AbstractTask}.
- *
- * @see #getTaskElementName()
- * @see #setAdditionalAttributes(AbstractTask, Element)
- * @since 3.0
- */
- public abstract boolean canCreate(ITask task);
-
- /**
- * Returns true if factory can create an XML element to store given {@link RepositoryQuery}.
- * <p>
- * The name of the XML element is taken from the {@link #getQueryElementName(RepositoryQuery)} method and additional
- * query attributes can be stored in {@link #setAdditionalAttributes(RepositoryQuery, Element)}.
- *
- * @param query
- * a query instance to create an XML element for
- *
- * @return true if factory can create XML element to store given {@link AbstractTask}.
- *
- * @see #getQueryElementName(RepositoryQuery)
- * @see #setAdditionalAttributes(RepositoryQuery, Element)
- * @since 3.0
- */
- public boolean canCreate(IRepositoryQuery query) {
- return false;
- }
-
- /**
- * Creates an {@link RepositoryQuery} instance from given XML element matching one of the names returned by {@link
- * #getQueryElementNames()}.
- * <p>
- * Concrete implementation should populate required query configuration using method parameters and content of the
- * passed XML element. Children tasks for this query instance will be created by the caller of this method.
- *
- * @param repositoryUrl
- * an url for the corresponding task repository
- * @param queryString
- * a query string, e.g. connector-specific url used for query request
- * @param label
- * a query label or name
- * @param element
- * an XML element containing query data
- * @return instance of the {@link RepositoryQuery}
- *
- * @see #getQueryElementNames()
- * @since 3.0
- */
- public RepositoryQuery createQuery(String repositoryUrl, String queryString, String label, Element element) {
- return null;
- }
-
- /**
- * Creates an {@link AbstractTask} instance from given XML element matching name returned by {@link
- * #getTaskElementName()}.
- * <p>
- * Concrete implementation should populate required task data using method parameters and content of the passed XML
- * element. Children tasks of this task instance will be created by the caller of this method.
- *
- * @param repositoryUrl
- * an url for the corresponding task repository
- * @param queryString
- * a query string, e.g. connector-specific url used for query request
- * @param label
- * a query label or name
- * @param element
- * an XML element containing query data
- * @return instance of the {@link RepositoryQuery}
- *
- * @see #getTaskElementName()
- * @since 3.0
- */
- public abstract AbstractTask createTask(String repositoryUrl, String taskId, String label, Element element);
-
- /**
- * Returns name of the XML element used to store given query instance if {@link #canCreate(RepositoryQuery)} return
- * true for given query instance.
- *
- * @param query
- * a query instance to get the name for
- *
- * @return name for the XML element to store given query instance or null if factory doesn't support given {@link
- * RepositoryQuery} instance.
- *
- * @see #canCreate(RepositoryQuery)
- * @since 3.0
- */
- public String getQueryElementName(IRepositoryQuery query) {
- return "";
- }
-
- /**
- * Returns names for all query elements.
- * <p>
- * This collection is used to determine if this factory can create {@link RepositoryQuery} instance from the XML
- * element using {@link #createQuery(String, String, String, Element)} method.
- *
- * @return a <code>Set</code> of query element names
- *
- * @see #createQuery(String, String, String, Element)
- */
- public Set<String> getQueryElementNames() {
- return Collections.emptySet();
- }
-
- /**
- * Returns name for the XML element used to store subclass of the {@link AbstractTask} used by this factory. This
- * value is used to create an XML element when storing given {@link AbstractTask} as well as to determine if this
- * factory can read XML element with content of the task.
- *
- * @return name of the task element
- *
- * @see #canCreate(AbstractTask)
- */
- public abstract String getTaskElementName();
-
- /**
- * Adds additional attributes to an XML element used to store given {@link RepositoryQuery}.
- *
- * @param query
- * a query instance being stored
- * @param node
- * an XML element used to store given query instance
- * @since 3.0
- */
- public void setAdditionalAttributes(IRepositoryQuery query, Element node) {
- // ignore
- }
-
- /**
- * Adds additional attributes to an XML element used to store given {@link AbstractTask}
- *
- * @param task
- * a task instance being stored
- * @param node
- * an XML element used to store given task instance
- * @since 3.0
- */
- public void setAdditionalAttributes(ITask task, Element element) {
- // ignore
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AttributeContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AttributeContainer.java
deleted file mode 100644
index 01ca0b925..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/AttributeContainer.java
+++ /dev/null
@@ -1,180 +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.core.deprecated;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-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.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * Encapsulates attributes for task data.
- *
- * @author Rob Elves
- * @since 2.0
- * @use {@link TaskAttribute} instead
- */
-@Deprecated
-public class AttributeContainer implements Serializable {
-
- public static final String ERROR_NO_ATTRIBUTE_FACTORY = "Attribute factory not available.";
-
- private static final long serialVersionUID = 3538078709450471836L;
-
- /** The keys for the report attributes */
- private final ArrayList<String> attributeKeys;
-
- /** report attributes (status, resolution, etc.) */
- private final HashMap<String, RepositoryTaskAttribute> attributes;
-
- private transient AbstractAttributeFactory attributeFactory;
-
- private transient RepositoryTaskData taskData;
-
- public AttributeContainer(AbstractAttributeFactory attributeFactory) {
- this.attributeFactory = attributeFactory;
- attributeKeys = new ArrayList<String>();
- attributes = new HashMap<String, RepositoryTaskAttribute>();
- }
-
- public void setAttributeFactory(AbstractAttributeFactory factory) {
- this.attributeFactory = factory;
- }
-
- public void addAttribute(String key, RepositoryTaskAttribute attribute) {
- if (attributeFactory == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, ERROR_NO_ATTRIBUTE_FACTORY));
- return;
- }
- String mapped = attributeFactory.mapCommonAttributeKey(key);
- if (mapped == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, "Mapped value for " + key
- + " returned null."));
- return;
- }
- if (!attributes.containsKey(mapped)) {
- attributeKeys.add(mapped);
- }
- attributes.put(mapped, attribute);
- }
-
- public RepositoryTaskAttribute getAttribute(String key) {
- if (attributeFactory == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, ERROR_NO_ATTRIBUTE_FACTORY));
- return null;
- }
- String mapped = attributeFactory.mapCommonAttributeKey(key);
- return attributes.get(mapped);
- }
-
- public void removeAttribute(Object key) {
- attributeKeys.remove(key);
- attributes.remove(key);
- }
-
- public List<RepositoryTaskAttribute> getAttributes() {
- ArrayList<RepositoryTaskAttribute> attributeEntries = new ArrayList<RepositoryTaskAttribute>(
- attributeKeys.size());
- for (String key : attributeKeys) {
- RepositoryTaskAttribute attribute = attributes.get(key);
- attributeEntries.add(attribute);
- }
- return attributeEntries;
- }
-
- public void removeAllAttributes() {
- attributeKeys.clear();
- attributes.clear();
- }
-
- public void addAttributeValue(String key, String value) {
- if (attributeFactory == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, ERROR_NO_ATTRIBUTE_FACTORY));
- return;
- }
- RepositoryTaskAttribute attrib = getAttribute(key);
- if (attrib != null) {
- attrib.addValue(value);
- } else {
- attrib = attributeFactory.createAttribute(key);
- attrib.addValue(value);
- addAttribute(key, attrib);
- }
- }
-
- /**
- * sets a value on an attribute, if attribute doesn't exist, appropriate attribute is created
- */
- public void setAttributeValue(String key, String value) {
- if (attributeFactory == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, ERROR_NO_ATTRIBUTE_FACTORY));
- return;
- }
- RepositoryTaskAttribute attrib = getAttribute(key);
- if (attrib == null) {
- attrib = attributeFactory.createAttribute(key);
- addAttribute(key, attrib);
- }
- attrib.setValue(value);
- }
-
- public String getAttributeValue(String key) {
- if (attributeFactory == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, ERROR_NO_ATTRIBUTE_FACTORY));
- return "";
- }
- String returnValue = "";
- RepositoryTaskAttribute attrib = getAttribute(key);
- if (attrib != null) {
- returnValue = attrib.getValue();
- }
- return returnValue;
- }
-
- public List<String> getAttributeValues(String key) {
- List<String> returnValue = new ArrayList<String>();
- if (attributeFactory == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, ERROR_NO_ATTRIBUTE_FACTORY));
- return returnValue;
- }
- RepositoryTaskAttribute attrib = getAttribute(key);
- if (attrib != null) {
- returnValue = attrib.getValues();
- }
- return returnValue;
- }
-
- public AbstractAttributeFactory getAttributeFactory() {
- return attributeFactory;
- }
-
- /**
- * @since 2.3
- */
- void setTaskData(RepositoryTaskData taskData) {
- this.taskData = taskData;
- for (RepositoryTaskAttribute attribute : attributes.values()) {
- attribute.setTaskData(taskData);
- }
- }
-
- /**
- * @since 2.3
- */
- public RepositoryTaskData getTaskData() {
- return taskData;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/DefaultTaskSchema.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/DefaultTaskSchema.java
deleted file mode 100644
index f07a70a0d..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/DefaultTaskSchema.java
+++ /dev/null
@@ -1,232 +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.core.deprecated;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-@Deprecated
-public class DefaultTaskSchema {
-
- private final RepositoryTaskData taskData;
-
- public DefaultTaskSchema(RepositoryTaskData taskData) {
- Assert.isNotNull(taskData);
-
- this.taskData = taskData;
- }
-
- public boolean applyTo(ITask task) {
- boolean changed = false;
- if (hasTaskPropertyChanged(task.getCompletionDate(), getCompletionDate())) {
- task.setCompletionDate(getCompletionDate());
- changed = true;
- }
- if (hasTaskPropertyChanged(task.getSummary(), getSummary())) {
- task.setSummary(getSummary());
- changed = true;
- }
- if (hasTaskPropertyChanged(task.getDueDate(), getDueDate())) {
- task.setDueDate(getDueDate());
- changed = true;
- }
- if (hasTaskPropertyChanged(task.getOwner(), getOwner())) {
- task.setOwner(getOwner());
- changed = true;
- }
- if (getPriority() != null && hasTaskPropertyChanged(task.getPriority(), getPriority().toString())) {
- task.setPriority(getPriority().toString());
- changed = true;
- }
- if (hasTaskPropertyChanged(task.getUrl(), getTaskUrl())) {
- task.setUrl(getTaskUrl());
- changed = true;
- }
- if (hasTaskPropertyChanged(task.getTaskKind(), getTaskKind())) {
- task.setTaskKind(getTaskKind());
- changed = true;
- }
- return changed;
- }
-
- public boolean getBooleanValue(String attributeKey) {
- RepositoryTaskAttribute attribute = taskData.getAttribute(attributeKey);
- if (attribute != null) {
- return Boolean.parseBoolean(attribute.getValue());
- }
- return false;
- }
-
- public String getComponent() {
- return getValue(RepositoryTaskAttribute.COMPONENT);
- }
-
- public Date getCreationDate() {
- return getDateValue(RepositoryTaskAttribute.DATE_CREATION);
- }
-
- public Date getCompletionDate() {
- return getDateValue(RepositoryTaskAttribute.DATE_COMPLETION);
- }
-
- public Date getModificationDate() {
- return getDateValue(RepositoryTaskAttribute.DATE_MODIFIED);
- }
-
- private Date getDateValue(String attributeKey) {
- RepositoryTaskAttribute attribute = taskData.getAttribute(attributeKey);
- if (attribute != null) {
- return taskData.getAttributeFactory().getDateForAttributeType(attributeKey, attribute.getValue());
- }
- return null;
- }
-
- public String getDescription() {
- return getValue(RepositoryTaskAttribute.DESCRIPTION);
- }
-
- public Date getDueDate() {
- return getDateValue(RepositoryTaskAttribute.DATE_DUE);
- }
-
- public String getOwner() {
- return getValue(RepositoryTaskAttribute.USER_ASSIGNED);
- }
-
- public PriorityLevel getPriority() {
- String value = getValue(RepositoryTaskAttribute.PRIORITY);
- return (value != null) ? PriorityLevel.fromString(value) : null;
- }
-
- public String getProduct() {
- return getValue(RepositoryTaskAttribute.PRODUCT);
- }
-
- public String getSummary() {
- return getValue(RepositoryTaskAttribute.SUMMARY);
- }
-
- public String getTaskKind() {
- return taskData.getTaskKind();
- }
-
- public String getTaskUrl() {
- return getValue(RepositoryTaskAttribute.TASK_URL);
- }
-
- public String getValue(String attributeKey) {
- RepositoryTaskAttribute attribute = taskData.getAttribute(attributeKey);
- if (attribute != null) {
- return attribute.getValue();
- }
- return null;
- }
-
- protected final boolean hasTaskPropertyChanged(Object existingProperty, Object newProperty) {
- // the query hit does not have this property
- if (newProperty == null) {
- return false;
- }
- return (existingProperty == null) ? true : !existingProperty.equals(newProperty);
- }
-
- public RepositoryTaskAttribute setBooleanValue(String attributeKey, boolean value) {
- RepositoryTaskAttribute attribute = taskData.getAttribute(attributeKey);
- if (attribute == null) {
- attribute = new RepositoryTaskAttribute(attributeKey, null, false);
- taskData.addAttribute(attributeKey, attribute);
- }
-
- attribute.setValue(value + "");
- return attribute;
- }
-
- public void setComponent(String component) {
- setValue(RepositoryTaskAttribute.COMPONENT, component);
- }
-
- public void setCreationDate(Date dateCreated) {
- setDateValue(RepositoryTaskAttribute.DATE_CREATION, dateCreated);
- }
-
- public void setCompletionDate(Date dateCompleted) {
- setDateValue(RepositoryTaskAttribute.DATE_COMPLETION, dateCompleted);
- }
-
- public void setModificationDate(Date dateModified) {
- setDateValue(RepositoryTaskAttribute.DATE_MODIFIED, dateModified);
- }
-
- private RepositoryTaskAttribute setDateValue(String attributeKey, Date value) {
- RepositoryTaskAttribute attribute = taskData.getAttribute(attributeKey);
- if (attribute == null) {
- attribute = new RepositoryTaskAttribute(attributeKey, null, false);
- taskData.addAttribute(attributeKey, attribute);
- }
- attribute.setValue(value.toString());
- return attribute;
- }
-
- public void setDescription(String description) {
- setValue(RepositoryTaskAttribute.DESCRIPTION, description);
- }
-
- public void setDueDate(Date value) {
- setDateValue(RepositoryTaskAttribute.DATE_DUE, value);
- }
-
- // TODO use Person class?
- public void setOwner(String owner) {
- setValue(RepositoryTaskAttribute.USER_ASSIGNED, owner);
- }
-
- public void setPriority(PriorityLevel priority) {
- setValue(RepositoryTaskAttribute.PRIORITY, priority.toString());
- }
-
- public void setProduct(String product) {
- setValue(RepositoryTaskAttribute.PRODUCT, product);
- }
-
- // TODO use Person class?
- public void setReporter(String reporter) {
- setValue(RepositoryTaskAttribute.USER_REPORTER, reporter);
- }
-
- public void setSummary(String summary) {
- setValue(RepositoryTaskAttribute.SUMMARY, summary);
- }
-
- public void setTaskKind(String taskKind) {
- taskData.setTaskKind(taskKind);
- }
-
- public void setTaskUrl(String taskUrl) {
- setValue(RepositoryTaskAttribute.TASK_URL, taskUrl);
- }
-
- public RepositoryTaskAttribute setValue(String attributeKey, String value) {
- RepositoryTaskAttribute attribute = taskData.getAttribute(attributeKey);
- if (attribute == null) {
- attribute = new RepositoryTaskAttribute(attributeKey, null, false);
- taskData.addAttribute(attributeKey, attribute);
- }
-
- attribute.setValue(value);
- return attribute;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/FileAttachment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/FileAttachment.java
deleted file mode 100644
index b624fb9d2..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/FileAttachment.java
+++ /dev/null
@@ -1,89 +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.core.deprecated;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
-
-/**
- * Proxy for a file attachment.
- *
- * @author Steffen Pingel
- * @since 2.0
- * @deprecated use {@link TaskAttachmentMapper} instead
- */
-@Deprecated
-public class FileAttachment implements ITaskAttachment {
-
- private static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
-
- private String contentType = APPLICATION_OCTET_STREAM;
-
- private String filename;
-
- private String description;
-
- private boolean patch;
-
- private final File file;
-
- public FileAttachment(File file) {
- if (file == null) {
- throw new IllegalArgumentException();
- }
-
- this.file = file;
- this.filename = file.getName();
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean isPatch() {
- return patch;
- }
-
- public void setPatch(boolean patch) {
- this.patch = patch;
- }
-
- public InputStream createInputStream() throws IOException {
- return new FileInputStream(file);
- }
-
- public long getLength() {
- return file.length();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskAttachment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskAttachment.java
deleted file mode 100644
index b9deb7583..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskAttachment.java
+++ /dev/null
@@ -1,38 +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.core.deprecated;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
-
-/**
- * Encapsualtes resources that can be attached to a task.
- *
- * @author Steffen Pingel
- * @since 2.0
- * @deprecated use {@link TaskAttachmentMapper} instead
- */
-@Deprecated
-public interface ITaskAttachment {
-
- public InputStream createInputStream() throws IOException;
-
- public String getContentType();
-
- public String getDescription();
-
- public String getFilename();
-
- public long getLength();
-
- public boolean isPatch();
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskCollector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskCollector.java
deleted file mode 100644
index b1ac6e7ca..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskCollector.java
+++ /dev/null
@@ -1,33 +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.core.deprecated;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-
-/**
- * Abstraction used for collecting tasks, e.g. when performing queries on the repository.
- *
- * @author Rob Elves
- * @since 2.0
- * @deprecated use {@link TaskDataCollector} instead
- */
-@Deprecated
-public interface ITaskCollector {
-
- public void accept(ITask task);
-
- public void accept(RepositoryTaskData taskData) throws CoreException;
-
- public Set<AbstractTask> getTasks();
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskFactory.java
deleted file mode 100644
index 36ed53a7a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/ITaskFactory.java
+++ /dev/null
@@ -1,34 +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.core.deprecated;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-
-/**
- * Used for creating tasks from repository task data.
- *
- * NOTE: likely to change for 3.0.
- *
- * @author Rob Elves
- * @since 2.0
- */
-@Deprecated
-public interface ITaskFactory {
-
- /**
- * @param synchData
- * - synchronize task with the provided taskData
- * @param forced
- * - user requested synchronization
- */
- public abstract AbstractTask createTask(RepositoryTaskData taskData, IProgressMonitor monitor) throws CoreException;
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/LegacyTaskDataCollector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/LegacyTaskDataCollector.java
deleted file mode 100644
index 0752b5d85..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/LegacyTaskDataCollector.java
+++ /dev/null
@@ -1,28 +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.core.deprecated;
-
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-
-/**
- * @author Steffen Pingel
- */
-@Deprecated
-public abstract class LegacyTaskDataCollector extends TaskDataCollector {
-
- @Deprecated
- public abstract void accept(RepositoryTaskData taskData);
-
- @Override
- public void accept(TaskData taskData) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/QueryHitCollector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/QueryHitCollector.java
deleted file mode 100644
index ec8316596..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/QueryHitCollector.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.core.deprecated;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-
-/**
- * Collects QueryHits resulting from repository search.
- *
- * @author Shawn Minto
- * @author Rob Elves (generalized from bugzilla)
- * @author Steffen Pingel
- * @since 2.0
- * @deprecated
- */
-@Deprecated
-public class QueryHitCollector extends LegacyTaskDataCollector {
-
- /**
- * @deprecated Use {@link TaskDataCollector#MAX_HITS} instead
- */
- @Deprecated
- public static final int MAX_HITS = TaskDataCollector.MAX_HITS;
-
- private final Set<AbstractTask> taskResults = new HashSet<AbstractTask>();
-
- private final ITaskFactory taskFactory;
-
- public QueryHitCollector(ITaskFactory taskFactory) {
- this.taskFactory = taskFactory;
- }
-
-// public void accept(AbstractTask task) {
-// if (task == null) {
-// throw new IllegalArgumentException();
-// }
-// if (taskResults.size() < MAX_HITS) {
-// taskResults.add(task);
-// }
-// }
-
- @Override
- public void accept(RepositoryTaskData taskData) {
- if (taskData == null) {
- throw new IllegalArgumentException();
- }
-
- AbstractTask task;
- try {
- task = taskFactory.createTask(taskData, new NullProgressMonitor());
- if (taskResults.size() < TaskDataCollector.MAX_HITS) {
- taskResults.add(task);
- }
- } catch (CoreException e) {
- // FIXMEx
- e.printStackTrace();
- }
- }
-
- public Set<AbstractTask> getTasks() {
- return taskResults;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryAttachment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryAttachment.java
deleted file mode 100644
index b1df118a6..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryAttachment.java
+++ /dev/null
@@ -1,134 +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.core.deprecated;
-
-import java.io.Serializable;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
-
-/**
- * Encapsulates a file or other resource attached to a task.
- *
- * @author Rob Elves
- * @author Mik Kersten
- * @since 2.0
- * @use {@link TaskAttachmentMapper} instead
- */
-@Deprecated
-public final class RepositoryAttachment extends AttributeContainer implements Serializable {
-
- private static final long serialVersionUID = 2663237137799050826L;
-
- private boolean isPatch = false;
-
- private boolean isObsolete = false;
-
- private String creator = "";
-
- private String repositoryUrl;
-
- private String repositoryKind;
-
- private String taskId;
-
- public RepositoryAttachment(AbstractAttributeFactory attributeFactory) {
- super(attributeFactory);
- }
-
- public boolean isObsolete() {
- return isObsolete;
- }
-
- public void setObsolete(boolean isObsolete) {
- this.isObsolete = isObsolete;
- }
-
- /**
- * Get the time that this attachment was posted
- *
- * @return The attachment's creation timestamp
- */
- public String getDateCreated() {
- return getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_DATE);
- }
-
- public String getCreator() {
- return creator;
- }
-
- public void setCreator(String creator) {
- this.creator = creator;
- }
-
- /**
- * @since 2.2
- * @return The name of the file, e.g. screenshot.jpg.
- */
- public String getFilename() {
- return getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_FILENAME);
- }
-
- public String getDescription() {
- return getAttributeValue(RepositoryTaskAttribute.DESCRIPTION);
- }
-
- public String getId() {
- return getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_ID);
- }
-
- public String getUrl() {
- return getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_URL);
- }
-
- public String getContentType() {
- // I've seen both "ctype" and "type" occur for this, investigate
- if (getAttribute(RepositoryTaskAttribute.ATTACHMENT_TYPE) != null) {
- return getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_TYPE);
- } else {
- return getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_CTYPE);
- }
- }
-
- public String getSize() {
- return getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_SIZE);
- }
-
- public boolean isPatch() {
- return isPatch;
- }
-
- public void setPatch(boolean b) {
- isPatch = b;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
- public String getRepositoryKind() {
- return repositoryKind;
- }
-
- public void setRepositoryKind(String repositoryKind) {
- this.repositoryKind = repositoryKind;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryOperation.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryOperation.java
deleted file mode 100644
index b981a31de..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryOperation.java
+++ /dev/null
@@ -1,221 +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.core.deprecated;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.mylyn.tasks.core.data.TaskOperation;
-
-/**
- * A representation of an operation that can be done to the bug when it is submitted
- *
- * NOTE: likely to change for 3.0
- *
- * @author Shawn Minto
- * @since 2.0
- * @deprecated use {@link TaskOperation} instead
- */
-@Deprecated
-public class RepositoryOperation implements Serializable {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 3256442508174045236L;
-
- /** The name of the value for the knob attribute */
- private final String knob_name;
-
- /** The name of the option that can be chosen */
- private String optionName;
-
- /** List of option names */
- private List<String> optionNames;
-
- /** Map of options and their names */
- private Map<String, String> options;
-
- /** Flag for if we have any options or not */
- private boolean hasOptions = false;
-
- /** The name of the operation (text that we display) */
- private final String operation_name;
-
- /** The option that is selected */
- private String op_sel;
-
- /** Whether this is to be checked or not */
- private boolean isChecked = false;
-
- private boolean isInput = false;
-
- private String inputName = null;
-
- private String inputValue = "";
-
- /**
- * Constructor
- *
- * @param knobName
- * The name of the value for the knob attribute
- * @param operationName
- * The display text for the operation
- */
- public RepositoryOperation(String knobName, String operationName) {
- knob_name = knobName;
- operation_name = operationName;
- }
-
- /**
- * Get the knob name
- *
- * @return The knob name
- */
- public String getKnobName() {
- return knob_name;
- }
-
- /**
- * Get the display name
- *
- * @return The display name
- */
- public String getOperationName() {
- return operation_name;
- }
-
- /**
- * Check if this has any options
- *
- * @return True if there are option values
- */
- public boolean hasOptions() {
- return hasOptions;
- }
-
- /**
- * Set up this operation to have options
- *
- * @param optionName
- * The name for the option attribute
- */
- public void setUpOptions(String optionName) {
- hasOptions = true;
- this.optionName = optionName;
- options = new HashMap<String, String>();
- optionNames = new ArrayList<String>();
- }
-
- /**
- * Add an option value to the operation
- *
- * @param name
- * The name of the option
- * @param value
- * The value of the option
- */
- public void addOption(String name, String value) {
- options.put(name, value);
- if (options.size() == 1) {
- op_sel = name;
- }
- optionNames.add(name);
- }
-
- /**
- * Get the list of option names for this operation
- *
- * @return The list of option names
- */
- public List<String> getOptionNames() {
- return optionNames;
- }
-
- /**
- * Get the selected option
- *
- * @return The selected option name
- */
- public String getOptionSelection() {
- return op_sel;
- }
-
- /**
- * Set the selected option
- *
- * @param string
- * The name of the selected option
- */
- public void setOptionSelection(String string) {
- op_sel = string;
- }
-
- /**
- * Check if this is to be checked or not
- *
- * @return True if this is to be checked at the start
- */
- public boolean isChecked() {
- return isChecked;
- }
-
- /**
- * Set whether this option is to be checked or not
- *
- * @param b
- * True if it is to be checked
- */
- public void setChecked(boolean b) {
- isChecked = b;
- }
-
- /**
- * Get the name for the option attribute
- *
- * @return The option name
- */
- public String getOptionName() {
- return optionName;
- }
-
- /**
- * Get the value for an option from its name
- *
- * @param option
- * The name of the option
- * @return The value of the option
- */
- public String getOptionValue(String option) {
- return options.get(option);
- }
-
- public boolean isInput() {
- return isInput;
- }
-
- public String getInputName() {
- return inputName;
- }
-
- public void setInputName(String inputName) {
- isInput = true;
- this.inputName = inputName;
- }
-
- public String getInputValue() {
- return inputValue == null ? "" : inputValue;
- }
-
- public void setInputValue(String inputValue) {
- this.inputValue = inputValue;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskAttribute.java
deleted file mode 100644
index 31e9c46d3..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskAttribute.java
+++ /dev/null
@@ -1,396 +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.core.deprecated;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Encapsulates common task attributes.
- *
- * @author Rob Elves
- * @since 2.0
- */
-@Deprecated
-public final class RepositoryTaskAttribute implements Serializable {
-
- private static final long serialVersionUID = 5548885751645139746L;
-
- /**
- * Key for the author of a comment.
- *
- * TODO remove this key: Trac uses owner to denote the assignee of a ticket and AbstractRepository has a getOwner()
- * method which is confusing
- */
- public static final String USER_OWNER = "task.common.user.owner";
-
- public static final String USER_CC = "task.common.user.cc";
-
- public static final String USER_REPORTER = "task.common.user.reporter";
-
- public static final String USER_REPORTER_NAME = "task.common.user.reporter.name";
-
- public static final String COMMENT_NEW = "task.common.comment.new";
-
- public static final String COMMENT_TEXT = "task.common.comment.text";
-
- public static final String COMMENT_DATE = "task.common.comment.date";
-
- public static final String COMMENT_AUTHOR = "task.common.comment.author";
-
- public static final String COMMENT_AUTHOR_NAME = "task.common.comment.author.name";
-
- public static final String DESCRIPTION = "task.common.description";
-
- public static final String ATTACHMENT_ID = "task.common.attachment.id";
-
- public static final String ATTACHMENT_TYPE = "task.common.attachment.type";
-
- public static final String ATTACHMENT_CTYPE = "task.common.attachment.ctype";
-
- public static final String ATTACHMENT_DATE = "task.common.attachment.date";
-
- public static final String ATTACHMENT_URL = "task.common.attachment.url";
-
- public static final String ATTACHMENT_FILENAME = "filename";
-
- public static final String ATTACHMENT_SIZE = "task.common.attachment.size";
-
- public static final String USER_ASSIGNED = "task.common.user.assigned";
-
- public static final String USER_ASSIGNED_NAME = "task.common.user.assigned.name";
-
- public static final String RESOLUTION = "task.common.resolution";
-
- public static final String STATUS = "task.common.status";
-
- public static final String PRIORITY = "task.common.priority";
-
- public static final String DATE_MODIFIED = "task.common.date.modified";
-
- public static final String SUMMARY = "task.common.summary";
-
- public static final String PRODUCT = "task.common.product";
-
- public static final String DATE_CREATION = "task.common.date.created";
-
- /**
- * @since 3.0
- */
- public static final String DATE_COMPLETION = "task.common.date.completed";
-
- public static final String KEYWORDS = "task.common.keywords";
-
- /**
- * Boolean attribute. If true, repository user needs to be added to the cc list.
- */
- public static final String ADD_SELF_CC = "task.common.addselfcc";
-
- public static final String NEW_CC = "task.common.newcc";
-
- public static final String REMOVE_CC = "task.common.removecc";
-
- public static final String TASK_KEY = "task.common.key";
-
- /**
- * String constant used to represent true for boolean attributes.
- */
- public static final String TRUE = "1";
-
- /**
- * String constant used to represent false for boolean attributes.
- */
- public static final String FALSE = "0";
-
- /**
- * @since 2.3
- */
- public static final String COMPONENT = "task.common.component";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_SHORT_TEXT = "shortText";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_LONG_TEXT = "longText";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_DATE = "date";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_BOOLEAN = "boolean";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_NUMBER = "number";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_SINGLE_SELECT = "singleSelect";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_MULTI_SELECT = "multiSelect";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_PERSON = "person";
-
- /**
- * @since 2.3
- */
- public static final String TYPE_TASK_DEPENDENCY = "taskDepenedency";
-
- /**
- * @since 3.0
- */
- public static final String TASK_URL = "task.common.url";
-
- /**
- * @since 3.0
- */
- public static final String DATE_DUE = "task.common.date.due";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_CONTAINER = "container";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_COMMENT = "comment";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_ATTACHMENT = "attachment";
-
- private boolean hidden = false;
-
- private boolean isReadOnly = false;
-
- /** Attribute pretty printing name */
- private final String name;
-
- /** ID of the option used when updating the attribute on the server */
- private final String id;
-
- /** Option parameters */
- private final Map<String, String> optionParameters;
-
- /** Ordered list of legal attribute values */
- private final List<String> options;
-
- /**
- * Attribute's values (selected or added)
- */
- private final List<String> values = new ArrayList<String>();
-
- private final Map<String, String> metaData = new HashMap<String, String>();
-
- private transient RepositoryTaskData taskData;
-
- public RepositoryTaskAttribute(String id, String name, boolean hidden) {
- this.id = id;
- this.name = name;
- this.hidden = hidden;
- this.options = new ArrayList<String>();
- optionParameters = new HashMap<String, String>();
- }
-
- public String getName() {
- return name;
- }
-
- public String getId() {
- return id;
- }
-
- public boolean isReadOnly() {
- return isReadOnly;
- }
-
- public void setReadOnly(boolean readonly) {
- this.isReadOnly = readonly;
- }
-
- public String getOptionParameter(String option) {
- return optionParameters.get(option);
- }
-
- public List<String> getOptions() {
- return options;
- }
-
- public String getValue() {
- if (values.size() > 0) {
- return values.get(0);
- } else {
- return "";
- }
- }
-
- public List<String> getValues() {
- return values;
- }
-
- public void setValue(String value) {
- if (values.size() > 0) {
- values.set(0, value);
- } else {
- values.add(value);
- }
- }
-
- public void setValues(List<String> values) {
- this.values.clear();
- this.values.addAll(values);
- }
-
- public void addValue(String value) {
- values.add(value);
- }
-
- public void removeValue(String value) {
- if (values.contains(value)) {
- values.remove(values.indexOf(value));
- }
- }
-
- public void clearValues() {
- values.clear();
- }
-
- /**
- * Adds an attribute option value
- *
- * @param readableValue
- * The value displayed on the screen
- * @param parameterValue
- * The option value used when sending the form to the server
- */
- public void addOption(String readableValue, String parameterValue) {
- options.add(readableValue);
- optionParameters.put(readableValue, parameterValue);
- }
-
- public boolean hasOptions() {
- return options.size() > 0;
- }
-
- public void clearOptions() {
- options.clear();
- optionParameters.clear();
- }
-
- /**
- * Determine if the field was hidden or not
- *
- * @return True if the field was hidden
- */
- public boolean isHidden() {
- return hidden;
- }
-
- /**
- * Set whether the field was hidden in the bug
- *
- * @param b
- * Whether the field was hidden or not
- */
- public void setHidden(boolean b) {
- hidden = b;
- }
-
- @Override
- public String toString() {
- return getId() + ":" + values;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.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;
- }
- final RepositoryTaskAttribute other = (RepositoryTaskAttribute) obj;
- if (id == null) {
- if (other.id != null) {
- return false;
- }
- } else if (!id.equals(other.id)) {
- return false;
- }
- return true;
- }
-
- public void clearMetaData() {
- metaData.clear();
- }
-
- public void putMetaDataValue(String key, String value) {
- metaData.put(key, value);
- }
-
- public String getMetaDataValue(String key) {
- return metaData.get(key);
- }
-
- public void removeMetaDataValue(String key) {
- metaData.remove(key);
- }
-
- public Map<String, String> getMetaData() {
- return Collections.unmodifiableMap(metaData);
- }
-
- /**
- * @since 2.3
- */
- void setTaskData(RepositoryTaskData taskData) {
- this.taskData = taskData;
- }
-
- /**
- * @since 2.3
- */
- public RepositoryTaskData getTaskData() {
- return taskData;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskData.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskData.java
deleted file mode 100644
index c004fdd17..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/RepositoryTaskData.java
+++ /dev/null
@@ -1,406 +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.core.deprecated;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * This data structure is not to be subclassed but rather used directly to hold repository task data (attribute key,
- * value pairs along with valid options for each attribute).
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @since 2.0
- * @deprecated use {@link TaskData} instead
- */
-@Deprecated
-public final class RepositoryTaskData extends AttributeContainer implements Serializable {
-
- private static final long serialVersionUID = 2304501248225237699L;
-
- private boolean isNew = false;
-
- private final String reportID;
-
- private String repositoryURL;
-
- private final String repositoryKind;
-
- private String taskKind;
-
- private final List<TaskComment> taskComments = new ArrayList<TaskComment>();
-
- private final List<RepositoryAttachment> attachments = new ArrayList<RepositoryAttachment>();
-
- /** The operation that was selected to do to the bug */
- private RepositoryOperation selectedOperation = null;
-
- /** The repositoryOperations that can be done on the report */
- private final List<RepositoryOperation> repositoryOperations = new ArrayList<RepositoryOperation>();
-
- private boolean partial;
-
- public RepositoryTaskData(AbstractAttributeFactory factory, String repositoryKind, String repositoryURL, String id) {
- this(factory, repositoryKind, repositoryURL, id, AbstractTask.DEFAULT_TASK_KIND);
- }
-
- public RepositoryTaskData(AbstractAttributeFactory factory, String repositoryKind, String repositoryURL, String id,
- String taskKind) {
- super(factory);
- this.reportID = id;
- this.repositoryKind = repositoryKind;
- this.repositoryURL = repositoryURL;
- this.taskKind = taskKind;
- }
-
- public String getLabel() {
- if (isNew()) {
- return "<unsubmitted> " + this.getRepositoryUrl();
- } else {
- return getSummary();
- }
- }
-
- /**
- * Get the resolution of the bug
- *
- * @return The resolution of the bug
- */
- public String getResolution() {
- return getAttributeValue(RepositoryTaskAttribute.RESOLUTION);
- }
-
- /**
- * Get the status of the bug
- *
- * @return The bugs status
- */
- public String getStatus() {
- return getAttributeValue(RepositoryTaskAttribute.STATUS);
- }
-
- public String getLastModified() {
- return getAttributeValue(RepositoryTaskAttribute.DATE_MODIFIED);
- }
-
- public void setSelectedOperation(RepositoryOperation o) {
- selectedOperation = o;
- }
-
- public RepositoryOperation getSelectedOperation() {
- return selectedOperation;
- }
-
- /**
- * Get all of the repositoryOperations that can be done to the bug
- *
- * @return The repositoryOperations that can be done to the bug
- */
- public List<RepositoryOperation> getOperations() {
- return repositoryOperations;
- }
-
- /**
- * Get the person who reported the bug
- *
- * @return The person who reported the bug
- */
- public String getReporter() {
- return getAttributeValue(RepositoryTaskAttribute.USER_REPORTER);
- }
-
- /**
- * Get an operation from the bug based on its display name
- *
- * @param displayText
- * The display text for the operation
- * @return The operation that has the display text
- */
- public RepositoryOperation getOperation(String displayText) {
- Iterator<RepositoryOperation> itr = repositoryOperations.iterator();
- while (itr.hasNext()) {
- RepositoryOperation o = itr.next();
- String opName = o.getOperationName();
- opName = opName.replaceAll("</.*>", "");
- opName = opName.replaceAll("<.*>", "");
- if (opName.equals(displayText)) {
- return o;
- }
- }
- return null;
- }
-
- /**
- * Get the summary for the bug
- *
- * @return The bugs summary
- */
- public String getSummary() {
- return getAttributeValue(RepositoryTaskAttribute.SUMMARY);
- }
-
- public void setSummary(String summary) {
- setAttributeValue(RepositoryTaskAttribute.SUMMARY, summary);
- }
-
- public String getProduct() {
- return getAttributeValue(RepositoryTaskAttribute.PRODUCT);
- }
-
- /**
- * true if this is a new, unsubmitted task false otherwise
- */
- public boolean isNew() {
- return isNew;
- }
-
- public void setNew(boolean isNew) {
- this.isNew = isNew;
- }
-
- /**
- * Get the date that the bug was created
- *
- * @return The bugs creation date
- */
- public String getCreated() {
- return getAttributeValue(RepositoryTaskAttribute.DATE_CREATION);
- }
-
- /**
- * Get the keywords for the bug
- *
- * @return The keywords for the bug
- */
- public List<String> getKeywords() {
-
- // get the selected keywords for the bug
- StringTokenizer st = new StringTokenizer(getAttributeValue(RepositoryTaskAttribute.KEYWORDS), ",", false);
- List<String> keywords = new ArrayList<String>();
- while (st.hasMoreTokens()) {
- String s = st.nextToken().trim();
- keywords.add(s);
- }
-
- return keywords;
- }
-
- /**
- * Add an operation to the bug
- *
- * @param o
- * The operation to add
- */
- public void addOperation(RepositoryOperation o) {
- repositoryOperations.add(o);
- }
-
- public List<String> getCc() {
- return getAttributeValues(RepositoryTaskAttribute.USER_CC);
- }
-
- public void removeCc(String email) {
- removeAttributeValue(RepositoryTaskAttribute.USER_CC, email);
- }
-
- public String getAssignedTo() {
- return getAttributeValue(RepositoryTaskAttribute.USER_ASSIGNED);
- }
-
- /**
- * Get the new comment that is to be added to the bug
- */
- public String getNewComment() {
- RepositoryTaskAttribute attribute = getAttribute(RepositoryTaskAttribute.COMMENT_NEW);
- return (attribute != null) ? attribute.getValue() : "";
- }
-
- /**
- * Set the new comment that will be added to the bug
- */
- public void setNewComment(String newComment) {
- setAttributeValue(RepositoryTaskAttribute.COMMENT_NEW, newComment);
- }
-
- public void addComment(TaskComment taskComment) {
- taskComments.add(taskComment);
- }
-
- public List<TaskComment> getComments() {
- return taskComments;
- }
-
- public void setDescription(String description) {
- setAttributeValue(RepositoryTaskAttribute.DESCRIPTION, description);
- }
-
- public String getDescription() {
- RepositoryTaskAttribute attribute = getDescriptionAttribute();
- return (attribute != null) ? attribute.getValue() : "";
- }
-
- public RepositoryTaskAttribute getDescriptionAttribute() {
- RepositoryTaskAttribute attribute = getAttribute(RepositoryTaskAttribute.DESCRIPTION);
- // TODO: Remove the following after 1.0 release as we now just have a
- // summary attribute
- if (attribute == null) {
- List<TaskComment> coms = this.getComments();
- if (coms != null && coms.size() > 0) {
- return coms.get(0).getAttribute(RepositoryTaskAttribute.COMMENT_TEXT);
- }
- }
- return attribute;
- }
-
- public void addAttachment(RepositoryAttachment attachment) {
- attachments.add(attachment);
- attachment.setTaskData(this);
- }
-
- public List<RepositoryAttachment> getAttachments() {
- return attachments;
- }
-
- /**
- * @deprecated Use {@link #getTaskId()} instead
- */
- @Deprecated
- public String getId() {
- return getTaskId();
- }
-
- /**
- * @since 3.0
- */
- public String getTaskId() {
- return reportID;
- }
-
- public String getTaskKey() {
- RepositoryTaskAttribute attr = getAttribute(RepositoryTaskAttribute.TASK_KEY);
- if (attr != null) {
- return attr.getValue();
- }
- return getTaskId();
- }
-
- public void setTaskKey(String key) {
- setAttributeValue(RepositoryTaskAttribute.TASK_KEY, key);
- }
-
- /**
- * @return the server for this report
- */
- public String getRepositoryUrl() {
- return repositoryURL;
- }
-
- @Override
- public List<String> getAttributeValues(String key) {
- RepositoryTaskAttribute attribute = getAttribute(key);
- if (attribute != null) {
- return attribute.getValues();
- }
- return new ArrayList<String>();
- }
-
- public void removeAttributeValue(String key, String value) {
- RepositoryTaskAttribute attrib = getAttribute(key);
- if (attrib != null) {
- attrib.removeValue(value);
- }
- }
-
- /**
- * @deprecated Use {@link #getConnectorKind()} instead
- */
- @Deprecated
- public String getRepositoryKind() {
- return getConnectorKind();
- }
-
- /**
- * @since 3.0
- */
- public String getConnectorKind() {
- return repositoryKind;
- }
-
- @Override
- public void setAttributeFactory(AbstractAttributeFactory factory) {
- super.setAttributeFactory(factory);
- for (TaskComment taskComment : taskComments) {
- taskComment.setAttributeFactory(factory);
- }
- for (RepositoryAttachment attachment : attachments) {
- attachment.setAttributeFactory(factory);
- }
- }
-
- public String getTaskKind() {
- return taskKind;
- }
-
- /**
- * @since 3.0
- */
- public void setTaskKind(String taskKind) {
- this.taskKind = taskKind;
- }
-
- public void setRepositoryURL(String repositoryURL) {
- this.repositoryURL = repositoryURL;
- for (RepositoryAttachment attachment : attachments) {
- attachment.setRepositoryUrl(repositoryURL);
- }
- }
-
- public final String getHandleIdentifier() {
- return RepositoryTaskHandleUtil.getHandle(getRepositoryUrl(), getTaskId());
- }
-
- @Override
- public void addAttribute(String key, RepositoryTaskAttribute attribute) {
- super.addAttribute(key, attribute);
- attribute.setTaskData(this);
- }
-
- public void refresh() {
- setTaskData(this);
- for (AttributeContainer container : taskComments) {
- container.setTaskData(this);
- }
- for (AttributeContainer container : attachments) {
- container.setTaskData(this);
- }
- }
-
- /**
- * @since 3.0
- */
- public void setPartial(boolean partial) {
- this.partial = partial;
- }
-
- /**
- * @since 3.0
- */
- public boolean isPartial() {
- return partial;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskComment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskComment.java
deleted file mode 100644
index 4e6145b69..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskComment.java
+++ /dev/null
@@ -1,108 +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.core.deprecated;
-
-import java.io.Serializable;
-
-
-/**
- * A comment posted by a user on a task.
- *
- * @author Rob Elves
- * @since 2.0
- * @deprecated use {@link org.eclipse.mylyn.tasks.core.data.TaskCommentMapper} instead
- */
-@Deprecated
-public final class TaskComment extends AttributeContainer implements Serializable {
-
- private static final long serialVersionUID = 1076016406335550318L;
-
- /** Comment's number */
- private int number;
-
- private boolean hasAttachment;
-
- private String attachmentId;
-
- public TaskComment(AbstractAttributeFactory attributeFactory, int num) {
- super(attributeFactory);
- this.number = num;
- }
-
- /**
- * Get this comment's number
- *
- * @return This comment's number
- */
- public int getNumber() {
- return number;
- }
-
- /**
- * Set the comment number
- *
- * @param number
- * the number of the comment
- */
- public void setNumber(int number) {
- this.number = number;
- }
-
- /**
- * Get the time that this comment was created
- *
- * @return The comments creation timestamp
- */
- public String getCreated() {
- return getAttributeValue(RepositoryTaskAttribute.COMMENT_DATE);
- }
-
- /**
- * Get the author of the comment
- *
- * @return The comments author
- */
- public String getAuthor() {
- return getAttributeValue(RepositoryTaskAttribute.COMMENT_AUTHOR);
- }
-
- /**
- * Get the authors real name
- *
- * @return Returns author's name, or an empty string
- */
- public String getAuthorName() {
- return getAttributeValue(RepositoryTaskAttribute.COMMENT_AUTHOR_NAME);
- }
-
- /**
- * Get the text contained in the comment
- *
- * @return The comments text
- */
- public String getText() {
- return getAttributeValue(RepositoryTaskAttribute.COMMENT_TEXT);
- }
-
- public void setHasAttachment(boolean b) {
- this.hasAttachment = b;
- }
-
- public boolean hasAttachment() {
- return hasAttachment;
- }
-
- public void setAttachmentId(String attachmentID) {
- this.attachmentId = attachmentID;
- }
-
- public String getAttachmentId() {
- return attachmentId;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskFactory.java
deleted file mode 100644
index a8a4f81c8..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskFactory.java
+++ /dev/null
@@ -1,193 +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.core.deprecated;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.ITaskList;
-import org.eclipse.mylyn.internal.tasks.core.TaskDataStorageManager;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-
-/**
- * Used for creating tasks from repository task data.
- *
- * NOTE: likely to change for 3.0.
- *
- * @author Rob Elves
- * @deprecated
- */
-@Deprecated
-public class TaskFactory implements ITaskFactory {
-
- private final AbstractLegacyRepositoryConnector connector;
-
- private final TaskDataManager taskDataManager;
-
- private final TaskRepository repository;
-
- private final ITaskList taskList;
-
- private final AbstractTaskDataHandler dataHandler;
-
- private final boolean updateTasklist;
-
- private final boolean forced;
-
- private final TaskDataStorageManager taskDataStorageManager;
-
- public TaskFactory(TaskRepository repository, boolean updateTasklist, boolean forced,
- AbstractLegacyRepositoryConnector connector, TaskDataManager taskDataManager, ITaskList taskList) {
- this.repository = repository;
- this.updateTasklist = updateTasklist;
- this.forced = forced;
- this.connector = connector;
- this.taskDataManager = taskDataManager;
- this.taskList = taskList;
- this.dataHandler = connector.getLegacyTaskDataHandler();
- this.taskDataStorageManager = taskDataManager.getTaskDataStorageManager();
- }
-
- /**
- * @param updateTasklist
- * - synchronize task with the provided taskData
- * @param forced
- * - user requested synchronization
- * @throws CoreException
- */
- public AbstractTask createTask(RepositoryTaskData taskData, IProgressMonitor monitor) throws CoreException {
- AbstractTask repositoryTask = (AbstractTask) taskList.getTask(taskData.getRepositoryUrl(), taskData.getTaskId());
- if (repositoryTask == null) {
- repositoryTask = createTaskFromTaskData(connector, repository, taskData, updateTasklist, monitor);
- repositoryTask.setSynchronizationState(SynchronizationState.INCOMING);
- if (!taskData.isPartial()) {
- if (updateTasklist) {
- taskList.addTask(repositoryTask);
- taskDataManager.saveIncoming(repositoryTask, taskData, forced);
- } else {
- taskDataManager.saveOffline(repositoryTask, taskData);
- }
- }
- } else {
- if (updateTasklist) {
- boolean changed;
- if (!taskData.isPartial()) {
- changed = taskDataManager.saveIncoming(repositoryTask, taskData, forced);
- connector.updateTaskFromTaskData(repository, repositoryTask, taskData);
- } else {
- changed = connector.updateTaskFromTaskData(repository, repositoryTask, taskData);
- if (changed) {
- switch (repositoryTask.getSynchronizationState()) {
- case OUTGOING:
- repositoryTask.setSynchronizationState(SynchronizationState.CONFLICT);
- case SYNCHRONIZED:
- repositoryTask.setSynchronizationState(SynchronizationState.INCOMING);
- }
- }
- }
- if (dataHandler != null) {
- for (ITask child : repositoryTask.getChildren()) {
- taskList.removeFromContainer(repositoryTask, child);
- }
- Set<String> subTaskIds = dataHandler.getSubTaskIds(taskData);
- if (subTaskIds != null) {
- for (String subId : subTaskIds) {
- if (subId == null || subId.trim().equals("")) {
- continue;
- }
- AbstractTask subTask = createTaskFromExistingId(connector, repository, subId, false,
- new SubProgressMonitor(monitor, 1));
- if (subTask != null) {
- taskList.addTask(subTask, repositoryTask);
- }
- }
- }
- }
- if (changed) {
- taskList.notifyElementChanged(repositoryTask);
- }
- }
- }
- return repositoryTask;
- }
-
- /**
- * Creates a new task from the given task data. Does NOT add resulting task to the tasklist
- */
- private AbstractTask createTaskFromTaskData(AbstractLegacyRepositoryConnector connector, TaskRepository repository,
- RepositoryTaskData taskData, boolean retrieveSubTasks, IProgressMonitor monitor) throws CoreException {
- AbstractTask repositoryTask = null;
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
- try {
- if (taskData != null) {
- // Use connector task factory
- repositoryTask = connector.createTask(repository.getRepositoryUrl(), taskData.getTaskId(),
- taskData.getTaskId() + ": " + taskData.getDescription());
- connector.updateTaskFromTaskData(repository, repositoryTask, taskData);
- if (!taskData.isPartial()) {
- taskDataStorageManager.setNewTaskData(taskData);
- }
-
- if (retrieveSubTasks) {
- monitor.beginTask("Creating task", connector.getLegacyTaskDataHandler()
- .getSubTaskIds(taskData)
- .size());
- for (String subId : connector.getLegacyTaskDataHandler().getSubTaskIds(taskData)) {
- if (subId == null || subId.trim().equals("")) {
- continue;
- }
- AbstractTask subTask = createTaskFromExistingId(connector, repository, subId, false,
- new SubProgressMonitor(monitor, 1));
- if (subTask != null) {
- taskList.addTask(subTask, repositoryTask);
- }
- }
- }
- }
- } finally {
- monitor.done();
- }
- return repositoryTask;
- }
-
- /**
- * Create new repository task, adding result to tasklist
- */
- private AbstractTask createTaskFromExistingId(AbstractLegacyRepositoryConnector connector,
- TaskRepository repository, String id, boolean retrieveSubTasks, IProgressMonitor monitor)
- throws CoreException {
- AbstractTask repositoryTask = (AbstractTask) taskList.getTask(repository.getRepositoryUrl(), id);
- if (repositoryTask == null && connector.getLegacyTaskDataHandler() != null) {
- RepositoryTaskData taskData = null;
- taskData = connector.getLegacyTaskDataHandler().getTaskData(repository, id,
- new SubProgressMonitor(monitor, 1));
- if (taskData != null) {
- repositoryTask = createTaskFromTaskData(connector, repository, taskData, retrieveSubTasks,
- new SubProgressMonitor(monitor, 1));
- if (repositoryTask != null) {
- repositoryTask.setSynchronizationState(SynchronizationState.INCOMING);
- taskList.addTask(repositoryTask);
- }
- }
- } // TODO: Handle case similar to web tasks (no taskDataHandler but
- // have tasks)
-
- return repositoryTask;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskSelection.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskSelection.java
deleted file mode 100644
index f983eb9a4..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/deprecated/TaskSelection.java
+++ /dev/null
@@ -1,236 +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.core.deprecated;
-
-import java.util.Date;
-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.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.IdentityAttributeFactory;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.TaskDataStorageManager.ObjectCloner;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- * @since 2.2
- */
-@Deprecated
-public class TaskSelection implements ITaskMapping {
-
- private final RepositoryTaskData taskData;
-
- public TaskSelection(RepositoryTaskData taskData) {
- if (taskData == null) {
- throw new IllegalArgumentException();
- }
-
- try {
- this.taskData = (RepositoryTaskData) ObjectCloner.deepCopy(taskData);
- this.taskData.setAttributeFactory(taskData.getAttributeFactory());
- this.taskData.refresh();
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Error creating a task data copy", e));
- throw new RuntimeException(e);
- }
- }
-
- public TaskSelection(ITask task) {
- RepositoryTaskData taskData = new RepositoryTaskData(IdentityAttributeFactory.getInstance(),
- task.getConnectorKind(), task.getRepositoryUrl(), task.getTaskId(), task.getTaskKind());
- taskData.setSummary(task.getSummary());
- taskData.setAttributeValue(RepositoryTaskAttribute.PRIORITY, task.getPriority());
- this.taskData = taskData;
- }
-
- public TaskSelection(String summary, String description) {
- RepositoryTaskData taskData = new RepositoryTaskData(IdentityAttributeFactory.getInstance(),
- LocalRepositoryConnector.CONNECTOR_KIND, LocalRepositoryConnector.REPOSITORY_URL, "");
- taskData.setSummary(summary);
- taskData.setDescription(description);
- this.taskData = taskData;
- }
-
- public RepositoryTaskData getLegacyTaskData() {
- return taskData;
- }
-
- public Date getCompletionDate() {
- // ignore
- return null;
- }
-
- public String getComponent() {
- // ignore
- return null;
- }
-
- public Date getCreationDate() {
- // ignore
- return null;
- }
-
- public String getDescription() {
- // ignore
- return null;
- }
-
- public Date getDueDate() {
- // ignore
- return null;
- }
-
- public Date getModificationDate() {
- // ignore
- return null;
- }
-
- public String getOwner() {
- // ignore
- return null;
- }
-
- public PriorityLevel getPriority() {
- // ignore
- return null;
- }
-
- public String getProduct() {
- // ignore
- return null;
- }
-
- public String getSummary() {
- // ignore
- return null;
- }
-
- public TaskData getTaskData() {
- // ignore
- return null;
- }
-
- public String getTaskKey() {
- // ignore
- return null;
- }
-
- public String getTaskKind() {
- // ignore
- return null;
- }
-
- public String getTaskUrl() {
- // ignore
- return null;
- }
-
- public void setCompletionDate(Date dateCompleted) {
- // ignore
-
- }
-
- public void setComponent(String component) {
- // ignore
-
- }
-
- public void setCreationDate(Date dateCreated) {
- // ignore
-
- }
-
- public void setDescription(String description) {
- // ignore
-
- }
-
- public void setDueDate(Date value) {
- // ignore
-
- }
-
- public void setModificationDate(Date dateModified) {
- // ignore
-
- }
-
- public void setOwner(String owner) {
- // ignore
-
- }
-
- public void setPriority(PriorityLevel priority) {
- // ignore
-
- }
-
- public void setProduct(String product) {
- // ignore
-
- }
-
- public void setReporter(String reporter) {
- // ignore
-
- }
-
- public void setSummary(String summary) {
- // ignore
-
- }
-
- public void setTaskKind(String taskKind) {
- // ignore
-
- }
-
- public void setTaskUrl(String taskUrl) {
- // ignore
-
- }
-
- public void copyFrom(ITaskMapping source) {
- // ignore
-
- }
-
- public List<String> getCc() {
- // ignore
- return null;
- }
-
- public List<String> getKeywords() {
- // ignore
- return null;
- }
-
- public String getReporter() {
- // ignore
- return null;
- }
-
- public String getResolution() {
- // ignore
- return null;
- }
-
- public String getTaskStatus() {
- // ignore
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java
deleted file mode 100644
index 3a59a805a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java
+++ /dev/null
@@ -1,118 +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.core.externalization;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-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.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-
-/**
- * File based externalization participant
- *
- * @author Rob Elves
- */
-public abstract class AbstractExternalizationParticipant implements IExternalizationParticipant {
-
- static final String SNAPSHOT_PREFIX = ".";
-
- public abstract void load(String rootPath, IProgressMonitor monitor) throws CoreException;
-
- public abstract void save(String rootPath, IProgressMonitor monitor) throws CoreException;
-
- public abstract String getDescription();
-
- public abstract ISchedulingRule getSchedulingRule();
-
- public abstract boolean isDirty();
-
- public abstract String getFileName();
-
- public AbstractExternalizationParticipant() {
- super();
- }
-
- protected boolean restoreSnapshot(File file) {
- File backup = new File(file.getParentFile(), SNAPSHOT_PREFIX + file.getName());
- File originalFile = file.getAbsoluteFile();
- if (originalFile.exists()) {
- SimpleDateFormat format = new SimpleDateFormat(ITasksCoreConstants.FILENAME_TIMESTAMP_FORMAT,
- Locale.ENGLISH);
- File failed = new File(file.getParentFile(), "failed-" + format.format(new Date()) + "-"
- + originalFile.getName());
- originalFile.renameTo(failed);
- }
- return backup.renameTo(originalFile);
- }
-
- protected boolean takeSnapshot(File file) {
- if (file.length() > 0) {
- File originalFile = file.getAbsoluteFile();
- File backup = new File(file.getParentFile(), SNAPSHOT_PREFIX + file.getName());
- backup.delete();
- return originalFile.renameTo(backup);
- }
- return false;
- }
-
- public void execute(IExternalizationContext context, IProgressMonitor monitor) throws CoreException {
- Assert.isNotNull(context);
- monitor = Policy.monitorFor(monitor);
- final File dataFile = getFile(context.getRootPath());
- switch (context.getKind()) {
- case SAVE:
- if (dataFile != null) {
- takeSnapshot(dataFile);
- }
- save(context.getRootPath(), monitor);
- break;
- case LOAD:
- try {
- load(context.getRootPath(), monitor);
- } catch (CoreException e) {
- restoreSnapshot(dataFile);
- load(context.getRootPath(), monitor);
- }
- break;
- case SNAPSHOT:
- break;
- }
-
- }
-
- public File getFile(String rootPath) throws CoreException {
- String fileName = getFileName();
- if (fileName != null) {
- String filePath = rootPath + File.separator + getFileName();
- return new File(filePath);
- }
-
-// if (!file.exists()) {
-// try {
-// if (!file.createNewFile()) {
-// throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, getDescription()
-// + " file not found, error creating new file."));
-// }
-// } catch (IOException e) {
-// throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, getDescription()
-// + " file not found, error creating new file.", e));
-// }
-// }
-
- return null;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
deleted file mode 100644
index ce4d11665..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
+++ /dev/null
@@ -1,752 +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.core.externalization;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-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.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.DateRange;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-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.RepositoryTaskHandleUtil;
-import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
-import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
-import org.eclipse.mylyn.internal.tasks.core.TaskExternalizationException;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.TaskTask;
-import org.eclipse.mylyn.internal.tasks.core.TasksModel;
-import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractTaskListFactory;
-import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
-import org.eclipse.mylyn.tasks.core.IAttributeContainer;
-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.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Subclass externalizers must override the get*TagName() methods for the types of externalized items they support to
- * ensure that their externalizer does not externalize tasks from other connectors incorrectly.
- *
- * These tag names uniquely identify the externalizer to be used to read the task from externalized form on disk.
- *
- * The canCreateElementFor methods specify which tasks the externalizer should write to disk.
- *
- * The TaskList is read on startup, so externalizers extending this should not perform any slow (i.e., network)
- * operations when overriding methods.
- *
- * @author Mik Kersten
- * @author Ken Sueda (XML serialization support)
- * @author Steffen Pingel
- */
-public final class DelegatingTaskExternalizer {
-
- static final String DEFAULT_PRIORITY = PriorityLevel.P3.toString();
-
- static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.S z";
-
- static final String KEY_NOTIFIED_INCOMING = "NotifiedIncoming";
-
- public static final String KEY_NAME = "Name";
-
- public static final String KEY_LABEL = "Label";
-
- static final String KEY_HANDLE = "Handle";
-
- public static final String KEY_REPOSITORY_URL = "RepositoryUrl";
-
- public static final String KEY_CATEGORY = "Category";
-
- static final String VAL_ROOT = "Root";
-
- static final String KEY_SUBTASK = "SubTask";
-
- static final String KEY_KIND = "Kind";
-
- static final String KEY_TASK_CATEGORY = "Task" + KEY_CATEGORY;
-
- static final String KEY_LINK = "Link";
-
- static final String KEY_PLAN = "Plan";
-
- static final String KEY_TIME_ESTIMATED = "Estimated";
-
- static final String KEY_ISSUEURL = "IssueURL";
-
- static final String KEY_NOTES = "Notes";
-
- static final String KEY_ACTIVE = "Active";
-
- static final String KEY_PRIORITY = "Priority";
-
- static final String KEY_PATH = "Path";
-
- static final String VAL_FALSE = "false";
-
- static final String VAL_TRUE = "true";
-
- static final String KEY_DATE_END = "EndDate";
-
- static final String KEY_QUERY_HIT = "QueryHit";
-
- static final String KEY_TASK_REFERENCE = "TaskReference";
-
- static final String KEY_DATE_CREATION = "CreationDate";
-
- static final String KEY_DATE_REMINDER = "ReminderDate";
-
- static final String KEY_DATE_SCHEDULED_START = "ScheduledStartDate";
-
- static final String KEY_DATE_SCHEDULED_END = "ScheduledEndDate";
-
- static final String KEY_DATE_MODIFICATION = "ModificationDate";
-
- static final String KEY_DATE_DUE = "DueDate";
-
- static final String KEY_REMINDED = "Reminded";
-
- static final String KEY_FLOATING = "Floating";
-
- /**
- * This element holds the date stamp recorded upon last transition to a synchronized state.
- */
- static final String KEY_LAST_MOD_DATE = "LastModified";
-
- static final String KEY_DIRTY = "Dirty";
-
- static final String KEY_SYNC_STATE = "offlineSyncState";
-
- static final String KEY_OWNER = "Owner";
-
- static final String KEY_MARK_READ_PENDING = "MarkReadPending";
-
- static final String KEY_STALE = "Stale";
-
- static final String KEY_CONNECTOR_KIND = "ConnectorKind";
-
- static final String KEY_TASK_ID = "TaskId";
-
- public static final String KEY_LAST_REFRESH = "LastRefreshTimeStamp";
-
- static final String NODE_ATTRIBUTE = "Attribute";
-
- static final String NODE_QUERY = "Query";
-
- static final String NODE_TASK = "Task";
-
- static final String KEY_KEY = "Key";
-
- private List<AbstractTaskListFactory> factories;
-
- // 2.0 -> 3.0 migration holds tasks to category handles
- private final Map<AbstractTask, String> parentCategoryMap;
-
- private final TasksModel tasksModel;
-
- private List<AbstractTaskListMigrator> migrators;
-
- private boolean taskActivated;
-
- public DelegatingTaskExternalizer(TasksModel tasksModel) {
- Assert.isNotNull(tasksModel);
- this.tasksModel = tasksModel;
- this.parentCategoryMap = new HashMap<AbstractTask, String>();
- this.factories = Collections.emptyList();
- this.migrators = Collections.emptyList();
- }
-
- public void initialize(List<AbstractTaskListFactory> externalizers, List<AbstractTaskListMigrator> migrators) {
- Assert.isNotNull(externalizers);
- Assert.isNotNull(migrators);
- this.factories = externalizers;
- this.migrators = migrators;
- }
-
- public Element createCategoryElement(AbstractTaskCategory category, Document doc, Element parent) {
- Element node = doc.createElement(getCategoryTagName());
- node.setAttribute(DelegatingTaskExternalizer.KEY_NAME, category.getSummary());
- parent.appendChild(node);
- for (ITask task : category.getChildren()) {
- createTaskReference(KEY_TASK_REFERENCE, task, doc, node);
- }
- return node;
- }
-
- public Element createTaskElement(AbstractTask task, Document doc, Element parent) {
- Element node;
- if (task.getClass() == TaskTask.class || task instanceof LocalTask) {
- node = doc.createElement(NODE_TASK);
- } else {
- AbstractTaskListFactory factory = null;
- for (AbstractTaskListFactory currentFactory : factories) {
- if (currentFactory.canCreate(task)) {
- factory = currentFactory;
- break;
- }
- }
- String taskTagName;
- if (factory != null) {
- taskTagName = factory.getTaskElementName();
- } else {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
- "No externalizer for task: " + task));
- return null;
- }
- node = doc.createElement(taskTagName);
- factory.setAdditionalAttributes(task, node);
- }
-
- node.setAttribute(KEY_CONNECTOR_KIND, task.getConnectorKind());
- node.setAttribute(KEY_REPOSITORY_URL, task.getRepositoryUrl());
- node.setAttribute(KEY_TASK_ID, task.getTaskId());
- if (task.getTaskKey() != null) {
- node.setAttribute(KEY_KEY, task.getTaskKey());
- }
- node.setAttribute(KEY_HANDLE, task.getHandleIdentifier());
- node.setAttribute(KEY_LABEL, stripControlCharacters(task.getSummary()));
-
- node.setAttribute(KEY_PRIORITY, task.getPriority());
- node.setAttribute(KEY_KIND, task.getTaskKind());
-
- if (task.isActive()) {
- node.setAttribute(KEY_ACTIVE, VAL_TRUE);
- } else {
- node.setAttribute(KEY_ACTIVE, VAL_FALSE);
- }
-
- if (task.getUrl() != null) {
- node.setAttribute(KEY_ISSUEURL, task.getUrl());
- }
- node.setAttribute(KEY_NOTES, stripControlCharacters(task.getNotes()));
- node.setAttribute(KEY_TIME_ESTIMATED, "" + task.getEstimatedTimeHours());
- node.setAttribute(KEY_DATE_END, formatExternDate(task.getCompletionDate()));
- node.setAttribute(KEY_DATE_CREATION, formatExternDate(task.getCreationDate()));
- node.setAttribute(KEY_DATE_MODIFICATION, formatExternDate(task.getModificationDate()));
- node.setAttribute(KEY_DATE_DUE, formatExternDate(task.getDueDate()));
- if (task.getScheduledForDate() != null) {
- node.setAttribute(KEY_DATE_SCHEDULED_START, formatExternCalendar(task.getScheduledForDate().getStartDate()));
- node.setAttribute(KEY_DATE_SCHEDULED_END, formatExternCalendar(task.getScheduledForDate().getEndDate()));
- }
- if (task.isReminded()) {
- node.setAttribute(KEY_REMINDED, VAL_TRUE);
- } else {
- node.setAttribute(KEY_REMINDED, VAL_FALSE);
- }
- if (task.isStale()) {
- node.setAttribute(KEY_STALE, VAL_TRUE);
- } else {
- node.setAttribute(KEY_STALE, VAL_FALSE);
- }
- if (task.isMarkReadPending()) {
- node.setAttribute(KEY_MARK_READ_PENDING, VAL_TRUE);
- } else {
- node.setAttribute(KEY_MARK_READ_PENDING, VAL_FALSE);
- }
- if (task.getLastReadTimeStamp() != null) {
- node.setAttribute(KEY_LAST_MOD_DATE, task.getLastReadTimeStamp());
- }
- if (task.isNotified()) {
- node.setAttribute(KEY_NOTIFIED_INCOMING, VAL_TRUE);
- } else {
- node.setAttribute(KEY_NOTIFIED_INCOMING, VAL_FALSE);
- }
- if (task.getSynchronizationState() != null) {
- node.setAttribute(KEY_SYNC_STATE, task.getSynchronizationState().name());
- } else {
- node.setAttribute(KEY_SYNC_STATE, SynchronizationState.SYNCHRONIZED.name());
- }
- if (task.getOwner() != null) {
- node.setAttribute(KEY_OWNER, task.getOwner());
- }
- createAttributes(task, doc, node);
- for (ITask t : task.getChildren()) {
- createTaskReference(KEY_SUBTASK, t, doc, node);
- }
-
- parent.appendChild(node);
- return node;
- }
-
- private void createAttributes(IAttributeContainer container, Document doc, Element parent) {
- Map<String, String> attributes = container.getAttributes();
- for (Map.Entry<String, String> entry : attributes.entrySet()) {
- Element node = doc.createElement(NODE_ATTRIBUTE);
- node.setAttribute(KEY_KEY, entry.getKey());
- node.setTextContent(entry.getValue());
- parent.appendChild(node);
- }
-
- }
-
- /**
- * creates nested task reference nodes named nodeName which include a handle to the task
- *
- * @return
- */
- public Element createTaskReference(String nodeName, ITask task, Document doc, Element parent) {
- Element node = doc.createElement(nodeName);
- node.setAttribute(KEY_HANDLE, task.getHandleIdentifier());
- parent.appendChild(node);
- return node;
- }
-
- /**
- * create tasks from the nodes provided and places them within the given container
- */
- public void readTaskReferences(AbstractTaskContainer task, NodeList nodes, TaskList tasklist) {
- for (int j = 0; j < nodes.getLength(); j++) {
- Node child = nodes.item(j);
- Element element = (Element) child;
- if (element.hasAttribute(KEY_HANDLE)) {
- String handle = element.getAttribute(KEY_HANDLE);
- AbstractTask subTask = tasklist.getTask(handle);
- if (subTask != null) {
- tasklist.addTask(subTask, task);
- }
- }
- }
-
- }
-
- @SuppressWarnings( { "deprecation", "restriction" })
- private String stripControlCharacters(String text) {
- if (text == null) {
- return "";
- }
- return org.eclipse.mylyn.internal.commons.core.XmlStringConverter.cleanXmlString(text);
- }
-
- private String formatExternDate(Date date) {
- if (date == null) {
- return "";
- }
- String f = DATE_FORMAT;
- SimpleDateFormat format = new SimpleDateFormat(f, Locale.ENGLISH);
- return format.format(date);
- }
-
- private String formatExternCalendar(Calendar date) {
- if (date == null) {
- return "";
- }
- String f = DATE_FORMAT;
- SimpleDateFormat format = new SimpleDateFormat(f, Locale.ENGLISH);
- return format.format(date.getTime());
- }
-
- public void readCategory(Node node, TaskList taskList) {
- Element element = (Element) node;
- AbstractTaskCategory category = null;
- if (element.hasAttribute(KEY_NAME)) {
- String handle = element.getAttribute(KEY_NAME);
- category = taskList.getContainerForHandle(handle);
- if (category == null) {
- category = new TaskCategory(element.getAttribute(KEY_NAME));
- taskList.addCategory((TaskCategory) category);
- }
- } else {
- // LEGACY: registry categories did not have names
- // category = taskList.getArchiveContainer();
- // a null category will now go into appropriate orphaned category
- }
-
- NodeList list = node.getChildNodes();
- readTaskReferences(category, list, taskList);
- }
-
- public final AbstractTask readTask(Node node, AbstractTaskCategory legacyCategory, ITask parent)
- throws CoreException {
- String handle;
- String taskId;
- String repositoryUrl;
- String summary = "";
- Element element = (Element) node;
- if (element.hasAttribute(KEY_REPOSITORY_URL) && element.hasAttribute(KEY_TASK_ID)
- && element.hasAttribute(KEY_HANDLE)) {
- handle = element.getAttribute(KEY_HANDLE);
- repositoryUrl = element.getAttribute(KEY_REPOSITORY_URL);
- taskId = element.getAttribute(KEY_TASK_ID);
- } else if (element.hasAttribute(KEY_HANDLE)) {
- handle = element.getAttribute(KEY_HANDLE);
- repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle);
- taskId = RepositoryTaskHandleUtil.getTaskId(handle);
- } else {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Handle not stored for repository task"));
- }
- if (element.hasAttribute(KEY_LABEL)) {
- summary = element.getAttribute(KEY_LABEL);
- }
-
- AbstractTask task = null;
- AbstractTaskListMigrator taskMigrator = null;
- if (NODE_TASK.equals(node.getNodeName())) {
- String connectorKind = element.getAttribute(DelegatingTaskExternalizer.KEY_CONNECTOR_KIND);
- task = readDefaultTask(connectorKind, repositoryUrl, taskId, summary, element);
- }
- // attempt migration from < 3.0 task list
- if (task == null) {
- for (AbstractTaskListMigrator migrator : migrators) {
- if (node.getNodeName().equals(migrator.getTaskElementName())) {
- task = readDefaultTask(migrator.getConnectorKind(), repositoryUrl, taskId, summary, element);
- taskMigrator = migrator;
- break;
- }
- }
- }
- // legacy support
- if (task == null) {
- for (AbstractTaskListFactory externalizer : factories) {
- if (node.getNodeName().equals(externalizer.getTaskElementName())) {
- task = externalizer.createTask(repositoryUrl, taskId, summary, element);
- break;
- }
- }
- }
- // populate common attributes
- if (task != null) {
- readTaskInfo(task, element, parent, legacyCategory);
- readAttributes(task, element);
- if (taskMigrator != null) {
- taskMigrator.migrateTask(task, element);
- }
- }
- return task;
- }
-
- private void readAttributes(IAttributeContainer container, Element parent) {
- NodeList list = parent.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- if (child instanceof Element && child.getNodeName().equals(NODE_ATTRIBUTE)) {
- Element element = (Element) child;
- String key = element.getAttribute(KEY_KEY);
- if (key.length() > 0) {
- container.setAttribute(key, element.getTextContent());
- }
- }
- }
- }
-
- private void readTaskInfo(AbstractTask task, Element element, ITask parent, AbstractTaskCategory legacyCategory) {
- if (element.hasAttribute(KEY_CATEGORY)) {
- // Migration 2.0 -> 3.0 task list. Category no longer maintained on the task element but
- // task handles held within category nodes similar to query children
- String categoryHandle = element.getAttribute(KEY_CATEGORY);
- if (categoryHandle.equals(VAL_ROOT)) {
- categoryHandle = UncategorizedTaskContainer.HANDLE;
- }
- //task.setCategoryHandle(categoryHandle);
- parentCategoryMap.put(task, categoryHandle);
- }
- if (element.hasAttribute(KEY_PRIORITY)) {
- task.setPriority(element.getAttribute(KEY_PRIORITY));
- } else {
- task.setPriority(DEFAULT_PRIORITY);
- }
- if (element.hasAttribute(KEY_KIND)) {
- task.setTaskKind(element.getAttribute(KEY_KIND));
- }
- if (!taskActivated && element.getAttribute(KEY_ACTIVE).compareTo(VAL_TRUE) == 0) {
- task.setActive(true);
- taskActivated = true;
- } else {
- task.setActive(false);
- }
- if (element.hasAttribute(KEY_ISSUEURL)) {
- task.setUrl(element.getAttribute(KEY_ISSUEURL));
- } else {
- task.setUrl("");
- }
- if (element.hasAttribute(KEY_NOTES)) {
- task.setNotes(element.getAttribute(KEY_NOTES));
- } else {
- task.setNotes("");
- }
- if (element.hasAttribute(KEY_TIME_ESTIMATED)) {
- String est = element.getAttribute(KEY_TIME_ESTIMATED);
- try {
- int estimate = Integer.parseInt(est);
- task.setEstimatedTimeHours(estimate);
- } catch (Exception e) {
- task.setEstimatedTimeHours(0);
- }
- } else {
- task.setEstimatedTimeHours(0);
- }
- if (element.hasAttribute(KEY_DATE_END)) {
- task.setCompletionDate(getDateFromString(element.getAttribute(KEY_DATE_END)));
- } else {
- task.setCompletionDate(null);
- }
- if (element.hasAttribute(KEY_DATE_CREATION)) {
- task.setCreationDate(getDateFromString(element.getAttribute(KEY_DATE_CREATION)));
- } else {
- task.setCreationDate(Calendar.getInstance().getTime());
- }
- if (element.hasAttribute(KEY_DATE_MODIFICATION)) {
- task.setModificationDate(getDateFromString(element.getAttribute(KEY_DATE_MODIFICATION)));
- } else {
- task.setModificationDate(null);
- }
- if (element.hasAttribute(KEY_DATE_DUE)) {
- task.setDueDate(getDateFromString(element.getAttribute(KEY_DATE_DUE)));
- } else {
- task.setDueDate(null);
- }
- // Legacy 2.3.2 -> 3.0 migration of scheduled date
- boolean isFloating = false;
- if (element.hasAttribute(KEY_FLOATING) && element.getAttribute(KEY_FLOATING).compareTo(VAL_TRUE) == 0) {
- isFloating = true;
- } else {
- isFloating = false;
- }
- if (element.hasAttribute(KEY_DATE_REMINDER)) {
- Date date = getDateFromString(element.getAttribute(KEY_DATE_REMINDER));
- if (date != null) {
- if (isFloating) {
- task.setScheduledForDate(TaskActivityUtil.getWeekOf(date));
- } else {
- task.setScheduledForDate(TaskActivityUtil.getDayOf(date));
- }
- }
- }
- // Scheduled date range (3.0)
- if (element.hasAttribute(KEY_DATE_SCHEDULED_START) && element.hasAttribute(KEY_DATE_SCHEDULED_END)) {
- Date startDate = getDateFromString(element.getAttribute(KEY_DATE_SCHEDULED_START));
- Date endDate = getDateFromString(element.getAttribute(KEY_DATE_SCHEDULED_END));
- if (startDate != null && endDate != null && startDate.compareTo(endDate) <= 0) {
- Calendar calStart = TaskActivityUtil.getCalendar();
- calStart.setTime(startDate);
- Calendar calEnd = TaskActivityUtil.getCalendar();
- calEnd.setTime(endDate);
- task.setScheduledForDate(new DateRange(calStart, calEnd));
- }
- }
- if (element.hasAttribute(KEY_REMINDED) && element.getAttribute(KEY_REMINDED).compareTo(VAL_TRUE) == 0) {
- task.setReminded(true);
- } else {
- task.setReminded(false);
- }
- if (element.hasAttribute(KEY_STALE) && element.getAttribute(KEY_STALE).compareTo(VAL_TRUE) == 0) {
- task.setStale(true);
- } else {
- task.setStale(false);
- }
- if (element.hasAttribute(KEY_MARK_READ_PENDING)
- && element.getAttribute(KEY_MARK_READ_PENDING).compareTo(VAL_TRUE) == 0) {
- task.setMarkReadPending(true);
- } else {
- task.setMarkReadPending(false);
- }
- task.setSynchronizing(false);
- if (element.hasAttribute(KEY_REPOSITORY_URL)) {
- task.setRepositoryUrl(element.getAttribute(KEY_REPOSITORY_URL));
- }
- if (element.hasAttribute(KEY_LAST_MOD_DATE) && !element.getAttribute(KEY_LAST_MOD_DATE).equals("")) {
- task.setLastReadTimeStamp(element.getAttribute(KEY_LAST_MOD_DATE));
- }
- if (element.hasAttribute(KEY_OWNER)) {
- task.setOwner(element.getAttribute(KEY_OWNER));
- }
- if (VAL_TRUE.equals(element.getAttribute(KEY_NOTIFIED_INCOMING))) {
- task.setNotified(true);
- } else {
- task.setNotified(false);
- }
- if (element.hasAttribute(KEY_SYNC_STATE)) {
- try {
- SynchronizationState state = SynchronizationState.valueOf(element.getAttribute(KEY_SYNC_STATE));
- task.setSynchronizationState(state);
- } catch (IllegalArgumentException e) {
- // invalid sync state, ignore
- // TODO log this to a multi-status
- }
- }
- if (element.hasAttribute(KEY_KEY)) {
- task.setTaskKey(element.getAttribute(KEY_KEY));
- } else {
- task.setTaskKey(null);
- }
- }
-
- private Date getDateFromString(String dateString) {
- Date date = null;
- if ("".equals(dateString)) {
- return null;
- }
- String formatString = DATE_FORMAT;
- SimpleDateFormat format = new SimpleDateFormat(formatString, Locale.ENGLISH);
- try {
- date = format.parse(dateString);
- } catch (ParseException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Could not parse end date", e));
- }
- return date;
- }
-
- private String getCategoryTagName() {
- return KEY_TASK_CATEGORY;
- }
-
- public Element createQueryElement(RepositoryQuery query, Document doc, Element parent) {
- Element node;
- if (query.getClass() == RepositoryQuery.class) {
- node = doc.createElement(NODE_QUERY);
- } else {
- String queryTagName = null;
- AbstractTaskListFactory factory = null;
- for (AbstractTaskListFactory currentFactory : factories) {
- if (currentFactory.canCreate(query)) {
- factory = currentFactory;
- queryTagName = factory.getQueryElementName(query);
- break;
- }
- }
- if (factory == null || queryTagName == null) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
- "Could not externalize query: " + query));
- return null;
- }
- node = doc.createElement(queryTagName);
- factory.setAdditionalAttributes(query, node);
- }
-
- node.setAttribute(KEY_HANDLE, query.getHandleIdentifier());
- node.setAttribute(KEY_CONNECTOR_KIND, query.getConnectorKind());
- node.setAttribute(KEY_NAME, query.getSummary());
- node.setAttribute(AbstractTaskListFactory.KEY_QUERY_STRING, query.getUrl());
- node.setAttribute(KEY_REPOSITORY_URL, query.getRepositoryUrl());
- if (query.getLastSynchronizedTimeStamp() != null) {
- node.setAttribute(KEY_LAST_REFRESH, query.getLastSynchronizedTimeStamp());
- }
- createAttributes(query, doc, node);
- for (ITask hit : query.getChildren()) {
- createTaskReference(KEY_QUERY_HIT, hit, doc, node);
- }
-
- parent.appendChild(node);
- return node;
- }
-
- public List<AbstractTaskListFactory> getDelegateExternalizers() {
- return factories;
- }
-
- public Map<AbstractTask, String> getLegacyParentCategoryMap() {
- return parentCategoryMap;
- }
-
- /**
- * Reads the Query from the specified Node. If taskList is not null, then also adds this query to the TaskList
- *
- * @throws TaskExternalizationException
- */
- public RepositoryQuery readQuery(Node node, TaskList taskList) {
- Element element = (Element) node;
- String repositoryUrl = element.getAttribute(DelegatingTaskExternalizer.KEY_REPOSITORY_URL);
- String queryString = element.getAttribute(AbstractTaskListFactory.KEY_QUERY_STRING);
- if (queryString.length() == 0) { // fallback for legacy
- queryString = element.getAttribute(AbstractTaskListFactory.KEY_QUERY);
- }
- String label = element.getAttribute(DelegatingTaskExternalizer.KEY_NAME);
- if (label.length() == 0) { // fallback for legacy
- label = element.getAttribute(DelegatingTaskExternalizer.KEY_LABEL);
- }
-
- AbstractTaskListMigrator queryMigrator = null;
- RepositoryQuery query = null;
- if (NODE_QUERY.equals(node.getNodeName())) {
- String connectorKind = element.getAttribute(DelegatingTaskExternalizer.KEY_CONNECTOR_KIND);
- query = readDefaultQuery(connectorKind, repositoryUrl, queryString, label, element);
- }
- // attempt migration from < 3.0 task list
- if (query == null) {
- for (AbstractTaskListMigrator migrator : migrators) {
- Set<String> queryTagNames = migrator.getQueryElementNames();
- if (queryTagNames != null && queryTagNames.contains(node.getNodeName())) {
- query = readDefaultQuery(migrator.getConnectorKind(), repositoryUrl, queryString, label, element);
- queryMigrator = migrator;
- break;
- }
- }
- }
- // legacy support
- if (query == null) {
- for (AbstractTaskListFactory externalizer : factories) {
- Set<String> queryTagNames = externalizer.getQueryElementNames();
- if (queryTagNames != null && queryTagNames.contains(node.getNodeName())) {
- query = externalizer.createQuery(repositoryUrl, queryString, label, element);
- break;
- }
- }
- }
- // populate common attributes
- if (query != null) {
- if (element.getAttribute(DelegatingTaskExternalizer.KEY_LAST_REFRESH) != null
- && !element.getAttribute(DelegatingTaskExternalizer.KEY_LAST_REFRESH).equals("")) {
- query.setLastSynchronizedStamp(element.getAttribute(DelegatingTaskExternalizer.KEY_LAST_REFRESH));
- }
- String handle = element.getAttribute(DelegatingTaskExternalizer.KEY_HANDLE);
- if (handle.length() > 0) {
- query.setHandleIdentifier(handle);
- }
- readAttributes(query, element);
- if (queryMigrator != null) {
- queryMigrator.migrateQuery(query, element);
- }
- }
- return query;
- }
-
- private RepositoryQuery readDefaultQuery(String connectorKind, String repositoryUrl, String queryString,
- String label, Element childElement) {
- TaskRepository taskRepository = tasksModel.getTaskRepository(connectorKind, repositoryUrl);
- IRepositoryQuery query = tasksModel.createQuery(taskRepository);
- query.setSummary(label);
- query.setUrl(queryString);
- return (RepositoryQuery) query;
- }
-
- private AbstractTask readDefaultTask(String connectorKind, String repositoryUrl, String taskId, String summary,
- Element element) {
- TaskRepository taskRepository = tasksModel.getTaskRepository(connectorKind, repositoryUrl);
- if (repositoryUrl.equals(LocalRepositoryConnector.REPOSITORY_URL)) {
- LocalTask task = new LocalTask(taskId, summary);
- return task;
- }
- ITask task = tasksModel.createTask(taskRepository, taskId);
- task.setSummary(summary);
- return (AbstractTask) task;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
deleted file mode 100644
index 8306a1b6b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
+++ /dev/null
@@ -1,263 +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.core.externalization;
-
-import java.util.ArrayList;
-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.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.commons.core.CoreUtil;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.externalization.IExternalizationContext.KIND;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public class ExternalizationManager {
-
- private ExternalizationJob saveJob;
-
- private IStatus loadStatus;
-
- private String rootFolderPath;
-
- private static boolean saveDisabled = false;
-
- private final List<IExternalizationParticipant> externalizationParticipants = new ArrayList<IExternalizationParticipant>();
-
- private boolean forceSave = false;
-
- public ExternalizationManager(String rootFolderPath) {
- this.rootFolderPath = rootFolderPath;
- }
-
- private ExternalizationJob createJob(String jobName, IExternalizationContext context) {
- //create save job
- ExternalizationJob job = new ExternalizationJob(jobName, context);
- job.setUser(false);
- job.setSystem(true);
- return job;
- }
-
- public void addParticipant(IExternalizationParticipant participant) {
- externalizationParticipants.add(participant);
- }
-
- public void reLoad() {
- reset();
- for (IExternalizationParticipant participant : externalizationParticipants) {
- load(participant);
- }
- }
-
- private void load(IExternalizationParticipant participant) {
- try {
- saveDisabled = true;
- IExternalizationContext loadContext = new LoadContext(rootFolderPath, participant);
- ExternalizationJob job = createJob("Loading participant " + participant.getDescription(), loadContext);
- job.setContext(loadContext);
- // TODO: run async
- job.run(new NullProgressMonitor());
- //reschedule(job, loadContext);
- } finally {
- saveDisabled = false;
- }
- }
-
- public void setRootFolderPath(String rootFolderPath) {
- this.rootFolderPath = rootFolderPath;
- }
-
- public synchronized void requestSave() {
-
- ExternalizationContext saveContext = new ExternalizationContext(KIND.SAVE, rootFolderPath);
-
- if (saveJob == null) {
- saveJob = createJob("Saving participants", saveContext);
- }
-
- reschedule(saveJob, saveContext);
- }
-
- public void stop() {
-// requestSave();
-//
-// if (saveJob != null) {
-// try {
-// saveJob.join();
-// saveJob = null;
-// } catch (InterruptedException e) {
-// StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
-// "Task List save on shutdown canceled."));
-// }
-// }
- }
-
- public synchronized void saveNow(IProgressMonitor monitor) {
- monitor = Policy.monitorFor(monitor);
- if (saveJob != null) {
- saveJob.cancel();
- saveJob = null;
- }
- try {
- forceSave = true;
- ExternalizationJob job = createJob("Save Now", new ExternalizationContext(KIND.SAVE, rootFolderPath));
- job.run(monitor);
- } finally {
- forceSave = false;
- }
- }
-
- private void reschedule(ExternalizationJob job, IExternalizationContext context) {
- if (!saveDisabled) {
- if (!CoreUtil.TEST_MODE) {
- job.setContext(context);
- job.schedule(3000);
- } else {
- job.run(new NullProgressMonitor());
- }
- }
- }
-
- protected void setStatus(MultiStatus status) {
- this.loadStatus = status;
- }
-
- public IStatus getLoadStatus() {
- return loadStatus;
- }
-
- private void reset() {
- saveDisabled = false;
- loadStatus = null;
- if (saveJob != null) {
- saveJob.cancel();
- saveJob = null;
- }
- }
-
- class ExternalizationJob extends Job {
-
- IExternalizationContext context;
-
- public ExternalizationJob(String jobTitle, IExternalizationContext context) {
- super(jobTitle);
- this.context = context;
- }
-
- public void setContext(IExternalizationContext saveContext) {
- this.context = saveContext;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- switch (context.getKind()) {
- case SAVE:
- try {
- monitor.beginTask("Saving...", externalizationParticipants.size());
- for (IExternalizationParticipant participant : externalizationParticipants) {
- ISchedulingRule rule = participant.getSchedulingRule();
- if (forceSave || participant.isDirty()) {
- try {
- Job.getJobManager().beginRule(rule, monitor);
- monitor.setTaskName("Saving " + participant.getDescription());
- participant.execute(context, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN,
- "Save failed for " + participant.getDescription(), e));
- } finally {
- Job.getJobManager().endRule(rule);
- }
- }
- monitor.worked(1);
- }
- } finally {
- monitor.done();
- }
- break;
- case SNAPSHOT:
-
- break;
- case LOAD:
- if (context instanceof LoadContext) {
- LoadContext loadContext = ((LoadContext) context);
- IExternalizationParticipant participant = loadContext.getParticipant();
- ISchedulingRule rule = participant.getSchedulingRule();
- try {
- Job.getJobManager().beginRule(rule, monitor);
- try {
- participant.execute(context, monitor);
- } catch (CoreException e) {
- if (loadStatus == null) {
- loadStatus = e.getStatus();
- } else {
- IStatus[] stati = { loadStatus, e.getStatus() };
- loadStatus = new MultiStatus(ITasksCoreConstants.ID_PLUGIN, IStatus.ERROR, stati,
- "Externalization Failure", null);
- }
- saveDisabled = true;
- }
- } finally {
- Job.getJobManager().endRule(rule);
- }
- }
-
- break;
- }
- return Status.OK_STATUS;
- }
- }
-
- class LoadContext extends ExternalizationContext {
-
- private final IExternalizationParticipant participant;
-
- public LoadContext(String rootPath, IExternalizationParticipant participant) {
- super(IExternalizationContext.KIND.LOAD, rootPath);
- this.participant = participant;
- }
-
- public IExternalizationParticipant getParticipant() {
- return participant;
- }
-
- }
-
- class ExternalizationContext implements IExternalizationContext {
-
- private final KIND kind;
-
- private final String rootPath;
-
- public ExternalizationContext(IExternalizationContext.KIND kind, String rootPath) {
- this.kind = kind;
- this.rootPath = rootPath;
- }
-
- public KIND getKind() {
- return kind;
- }
-
- public String getRootPath() {
- return rootPath;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationContext.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationContext.java
deleted file mode 100644
index 8520f834c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationContext.java
+++ /dev/null
@@ -1,23 +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.core.externalization;
-
-/**
- * @author Rob Elves
- */
-public interface IExternalizationContext {
-
- public enum KIND {
- SAVE, SNAPSHOT, LOAD;
- }
-
- public abstract KIND getKind();
-
- public abstract String getRootPath();
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java
deleted file mode 100644
index 4b9748cf9..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java
+++ /dev/null
@@ -1,28 +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.core.externalization;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * @author Rob Elves
- */
-public interface IExternalizationParticipant {
-
- public abstract boolean isDirty();
-
- public abstract ISchedulingRule getSchedulingRule();
-
- public abstract void execute(IExternalizationContext context, IProgressMonitor monitor) throws CoreException;
-
- public abstract String getDescription();
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizationParticipant.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizationParticipant.java
deleted file mode 100644
index 537a0f014..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizationParticipant.java
+++ /dev/null
@@ -1,129 +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.core.externalization;
-
-import java.io.File;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.internal.tasks.core.UnmatchedTaskContainer;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Rob Elves
- */
-public class TaskListExternalizationParticipant extends AbstractExternalizationParticipant implements
- IExternalizationParticipant, ITaskListChangeListener {
-
- private static final String DESCRIPTION = "Task List";
-
- private final ExternalizationManager manager;
-
- private final TaskListExternalizer taskListWriter;
-
- private final TaskList taskList;
-
- private boolean dirty;
-
- private final TaskRepositoryManager taskRepositoryManager;
-
- public TaskListExternalizationParticipant(TaskList taskList, TaskListExternalizer taskListExternalizer,
- ExternalizationManager manager, TaskRepositoryManager repositoryManager) {
- this.manager = manager;
- this.taskList = taskList;
- this.taskListWriter = taskListExternalizer;
- this.taskRepositoryManager = repositoryManager;
- }
-
- @Override
- public ISchedulingRule getSchedulingRule() {
- return TaskList.getSchedulingRule();
- }
-
- @Override
- public boolean isDirty() {
- return dirty;
- }
-
- @Override
- public void load(String rootPath, IProgressMonitor monitor) throws CoreException {
- final File taskListFile = getFile(rootPath);
- ITaskListRunnable loadRunnable = new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- resetTaskList();
- taskListWriter.readTaskList(taskList, taskListFile);
- }
- };
-
- taskList.run(loadRunnable, monitor);
- }
-
- /**
- * public for tests
- */
- public void resetTaskList() {
- taskList.reset();
- prepareOrphanContainers();
- }
-
- private void prepareOrphanContainers() {
- for (TaskRepository repository : taskRepositoryManager.getAllRepositories()) {
- if (!repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND)) {
- taskList.addUnmatchedContainer(new UnmatchedTaskContainer(repository.getConnectorKind(),
- repository.getRepositoryUrl()));
- }
- }
- }
-
- @Override
- public void save(String rootPath, IProgressMonitor monitor) throws CoreException {
- final File taskListFile = getFile(rootPath);
- ITaskListRunnable saveRunnable = new ITaskListRunnable() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- taskListWriter.writeTaskList(taskList, taskListFile);
- synchronized (TaskListExternalizationParticipant.this) {
- dirty = false;
- }
- }
- };
-
- taskList.run(saveRunnable, monitor);
- }
-
- @Override
- public String getDescription() {
- return DESCRIPTION;
- }
-
- @Override
- public String getFileName() {
- return ITasksCoreConstants.DEFAULT_TASK_LIST_FILE;
- }
-
- public void containersChanged(Set<TaskContainerDelta> containers) {
- for (TaskContainerDelta taskContainerDelta : containers) {
- if (!taskContainerDelta.isTransient()) {
- synchronized (TaskListExternalizationParticipant.this) {
- dirty = true;
- }
- manager.requestSave();
- return;
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizer.java
deleted file mode 100644
index f61072b3c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/TaskListExternalizer.java
+++ /dev/null
@@ -1,417 +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.core.externalization;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-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.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.LocalTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.TaskList;
-import org.eclipse.mylyn.internal.tasks.core.TasksModel;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractTaskListFactory;
-import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author Mik Kersten
- * @author Ken Sueda
- * @author Rob Elves
- * @author Jevgeni Holodkov
- */
-public class TaskListExternalizer {
-
- private static final String ERROR_TASKLIST_READ = "Failed to load Task List";
-
- private static final String TRANSFORM_PROPERTY_VERSION = "version";
-
- // May 2007: There was a bug when reading in 1.1
- // Result was an infinite loop within the parser
- private static final String XML_VERSION = "1.0";
-
- public static final String ATTRIBUTE_VERSION = "Version";
-
- public static final String ELEMENT_TASK_LIST = "TaskList";
-
- private static final String VALUE_VERSION = "1.0.1";
-
- private static final String VALUE_VERSION_1_0_0 = "1.0.0";
-
- private final DelegatingTaskExternalizer delagatingExternalizer;
-
- private final List<Node> orphanedTaskNodes = new ArrayList<Node>();
-
- private final List<Node> orphanedQueryNodes = new ArrayList<Node>();
-
- private String readVersion = "";
-
- public TaskListExternalizer(TasksModel tasksModel) {
- this.delagatingExternalizer = new DelegatingTaskExternalizer(tasksModel);
- }
-
- public void initialize(List<AbstractTaskListFactory> externalizers, List<AbstractTaskListMigrator> migrators) {
- this.delagatingExternalizer.initialize(externalizers, migrators);
- }
-
- public void writeTaskList(TaskList taskList, File outFile) throws CoreException {
- try {
- FileOutputStream outStream = new FileOutputStream(outFile);
- try {
- writeTaskList(taskList, outStream);
- } finally {
- outStream.close();
- }
- } catch (Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Saving Task List failed",
- e));
- }
- }
-
- private void writeTaskList(TaskList taskList, OutputStream outputStream) throws IOException {
- Document doc = createTaskListDocument();
- if (doc == null) {
- return;
- }
-
- Element root = createTaskListRoot(doc);
-
- // create task nodes...
- for (AbstractTask task : taskList.getAllTasks()) {
- delagatingExternalizer.createTaskElement(task, doc, root);
- }
-
- // create the category nodes...
- for (AbstractTaskCategory category : taskList.getCategories()) {
- delagatingExternalizer.createCategoryElement(category, doc, root);
- }
-
- // create query nodes...
- for (RepositoryQuery query : taskList.getQueries()) {
- try {
- delagatingExternalizer.createQueryElement(query, doc, root);
- } catch (Throwable t) {
- // FIXME use log?
- StatusHandler.fail(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Did not externalize: "
- + query.getSummary(), t));
- }
- }
-
- // Persist orphaned tasks...
- for (Node orphanedTaskNode : orphanedTaskNodes) {
- Node tempNode = doc.importNode(orphanedTaskNode, true);
- if (tempNode != null) {
- root.appendChild(tempNode);
- }
- }
-
- // Persist orphaned queries....
- for (Node orphanedQueryNode : orphanedQueryNodes) {
- Node tempNode = doc.importNode(orphanedQueryNode, true);
- if (tempNode != null) {
- root.appendChild(tempNode);
- }
- }
-
- ZipOutputStream zipOutStream = new ZipOutputStream(outputStream);
- writeTaskList(doc, zipOutStream);
- zipOutStream.finish();
- }
-
- /**
- * @param doc
- * @param outputStream
- * @throws IOException
- */
- private void writeTaskList(Document doc, ZipOutputStream outputStream) throws IOException {
- ZipEntry zipEntry = new ZipEntry(ITasksCoreConstants.OLD_TASK_LIST_FILE);
- outputStream.putNextEntry(zipEntry);
- outputStream.setMethod(ZipOutputStream.DEFLATED);
- writeDOMtoStream(doc, outputStream);
- outputStream.flush();
- outputStream.closeEntry();
- }
-
- /**
- * Writes the provided XML document out to the specified output stream.
- *
- * doc - the document to be written outputStream - the stream to which the document is to be written
- */
- private void writeDOMtoStream(Document doc, OutputStream outputStream) {
- // Prepare the DOM document for writing
- // DOMSource - Acts as a holder for a transformation Source tree in the
- // form of a Document Object Model (DOM) tree
- Source source = new DOMSource(doc);
-
- // StreamResult - Acts as an holder for a XML transformation result
- // Prepare the output stream
- Result result = new StreamResult(outputStream);
-
- // An instance of this class can be obtained with the
- // TransformerFactory.newTransformer method. This instance may
- // then be used to process XML from a variety of sources and write
- // the transformation output to a variety of sinks
-
- Transformer xformer = null;
- try {
- xformer = TransformerFactory.newInstance().newTransformer();
- xformer.setOutputProperty(TRANSFORM_PROPERTY_VERSION, XML_VERSION);
- xformer.transform(source, result);
- } catch (TransformerConfigurationException e) {
- e.printStackTrace();
- } catch (TransformerFactoryConfigurationError e) {
- e.printStackTrace();
- } catch (TransformerException e1) {
- e1.printStackTrace();
- }
- }
-
- private Document createTaskListDocument() {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db;
- Document doc = null;
-
- try {
- db = dbf.newDocumentBuilder();
- doc = db.newDocument();
- } catch (ParserConfigurationException e) {
- // FIXME propagate exception?
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Could not create document", e));
- return doc;
- }
-
- return doc;
- }
-
- private Element createTaskListRoot(Document doc) {
- Element root = doc.createElement(ELEMENT_TASK_LIST);
- root.setAttribute(ATTRIBUTE_VERSION, VALUE_VERSION);
- doc.appendChild(root);
- return root;
- }
-
-// /**
-// * Reads the Query from the specified Node. If taskList is not null, then also adds this query to the TaskList
-// *
-// * @throws TaskExternalizationException
-// */
-// private IRepositoryQuery readQuery(TaskList taskList, Node child) {
-// RepositoryQuery query = null;
-// for (AbstractTaskListFactory externalizer : externalizers) {
-// Set<String> queryTagNames = externalizer.getQueryElementNames();
-// if (queryTagNames != null && queryTagNames.contains(child.getNodeName())) {
-// Element childElement = (Element) child;
-// // TODO: move this stuff into externalizer
-// String repositoryUrl = childElement.getAttribute(DelegatingTaskExternalizer.KEY_REPOSITORY_URL);
-// String queryString = childElement.getAttribute(AbstractTaskListFactory.KEY_QUERY_STRING);
-// if (queryString.length() == 0) { // fallback for legacy
-// queryString = childElement.getAttribute(AbstractTaskListFactory.KEY_QUERY);
-// }
-// String label = childElement.getAttribute(DelegatingTaskExternalizer.KEY_NAME);
-// if (label.length() == 0) { // fallback for legacy
-// label = childElement.getAttribute(DelegatingTaskExternalizer.KEY_LABEL);
-// }
-//
-// query = externalizer.createQuery(repositoryUrl, queryString, label, childElement);
-// if (query != null) {
-// if (childElement.getAttribute(DelegatingTaskExternalizer.KEY_LAST_REFRESH) != null
-// && !childElement.getAttribute(DelegatingTaskExternalizer.KEY_LAST_REFRESH).equals("")) {
-// query.setLastSynchronizedStamp(childElement.getAttribute(DelegatingTaskExternalizer.KEY_LAST_REFRESH));
-// }
-//
-// String handle = childElement.getAttribute(DelegatingTaskExternalizer.KEY_HANDLE);
-// if (handle.length() > 0) {
-// query.setHandleIdentifier(handle);
-// }
-// }
-//
-// // add created Query to the TaskList and read QueryHits (Tasks related to the Query)
-// if (taskList != null) {
-// if (query != null) {
-// taskList.addQuery(query);
-// }
-//
-// NodeList queryChildren = child.getChildNodes();
-// delagatingExternalizer.readTaskReferences(query, queryChildren, taskList);
-// }
-//
-// break;
-// }
-// }
-// if (query == null) {
-// orphanedQueryNodes.add(child);
-// }
-//
-// return query;
-// }
-
- public void readTaskList(TaskList taskList, File inFile) throws CoreException {
- delagatingExternalizer.getLegacyParentCategoryMap().clear();
- Map<AbstractTask, NodeList> tasksWithSubtasks = new HashMap<AbstractTask, NodeList>();
- if (!inFile.exists()) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Task list file not found \"" + inFile.getAbsolutePath() + "\""));
- }
-
- if (inFile.length() == 0) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Task list file contains no data \"" + inFile.getAbsolutePath() + "\""));
- }
-
- Document doc;
- doc = openAsDOM(inFile);
-
- if (doc == null) {
- //StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, "Empty TaskList"));
- return;
- }
-
- Element root = doc.getDocumentElement();
- readVersion = root.getAttribute(ATTRIBUTE_VERSION);
-
- if (readVersion.equals(VALUE_VERSION_1_0_0)) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Task list version \""
- + readVersion + "\" not supported"));
- } else {
- NodeList list = root.getChildNodes();
-
- // Read Tasks
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- if (!child.getNodeName().endsWith(DelegatingTaskExternalizer.KEY_CATEGORY)
- && !child.getNodeName().endsWith(AbstractTaskListFactory.KEY_QUERY)) {
- AbstractTask task = delagatingExternalizer.readTask(child, null, null);
- if (task != null) {
- taskList.addTask(task);
- if (child.getChildNodes() != null && child.getChildNodes().getLength() > 0) {
- tasksWithSubtasks.put(task, child.getChildNodes());
- }
- } else {
- orphanedTaskNodes.add(child);
- }
- }
- }
-
- for (AbstractTask task : tasksWithSubtasks.keySet()) {
- NodeList nodes = tasksWithSubtasks.get(task);
- delagatingExternalizer.readTaskReferences(task, nodes, taskList);
- }
-
- // Read Queries
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- if (child.getNodeName().endsWith(AbstractTaskListFactory.KEY_QUERY)) {
- RepositoryQuery query = delagatingExternalizer.readQuery(child, taskList);
- if (query != null) {
- taskList.addQuery(query);
- if (child.getChildNodes() != null && child.getChildNodes().getLength() > 0) {
- delagatingExternalizer.readTaskReferences(query, child.getChildNodes(), taskList);
- }
- } else {
- orphanedTaskNodes.add(child);
- }
- }
- }
-
- // Read Categories
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- if (child.getNodeName().endsWith(DelegatingTaskExternalizer.KEY_CATEGORY)) {
- delagatingExternalizer.readCategory(child, taskList);
- }
- }
-
- // Legacy migration for task nodes that have the old Category handle on the element
- if (delagatingExternalizer.getLegacyParentCategoryMap().size() > 0) {
- for (AbstractTask task : delagatingExternalizer.getLegacyParentCategoryMap().keySet()) {
- AbstractTaskCategory category = taskList.getContainerForHandle(delagatingExternalizer.getLegacyParentCategoryMap()
- .get(task));
- if (category != null) {
- if (task instanceof LocalTask && !task.getParentContainers().isEmpty()) {
- continue;
- }
- taskList.addTask(task, category);
- }
- }
- }
- }
- }
-
- /**
- * Opens the specified XML file and parses it into a DOM Document.
- *
- * Filename - the name of the file to open Return - the Document built from the XML file Throws - XMLException if
- * the file cannot be parsed as XML - IOException if the file cannot be opened
- *
- * @throws CoreException
- *
- */
- private Document openAsDOM(File inputFile) throws CoreException {
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = null;
- Document document = null;
- try {
- builder = factory.newDocumentBuilder();
- InputStream inputStream = null;
- if (inputFile.getName().endsWith(ITasksCoreConstants.FILE_EXTENSION)) {
- inputStream = new ZipInputStream(new FileInputStream(inputFile));
- ZipEntry entry = ((ZipInputStream) inputStream).getNextEntry();
- while (entry != null) {
- if (ITasksCoreConstants.OLD_TASK_LIST_FILE.equals(entry.getName())) {
- break;
- }
- entry = ((ZipInputStream) inputStream).getNextEntry();
- }
- if (entry == null) {
- return null;
- }
- } else {
- inputStream = new FileInputStream(inputFile);
- }
- document = builder.parse(inputStream);
- } catch (Exception se) {
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, ERROR_TASKLIST_READ, se));
- }
- return document;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java
deleted file mode 100644
index bd63fa02b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskAttachmentJob.java
+++ /dev/null
@@ -1,102 +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.core.sync;
-
-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.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-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.AbstractTaskAttachmentHandler;
-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;
-
-/**
- * @author Steffen Pingel
- */
-public class SubmitTaskAttachmentJob extends SubmitJob {
-
- private final TaskAttribute attachmentAttribute;
-
- private final String comment;
-
- private final AbstractRepositoryConnector connector;
-
- private IStatus error;
-
- private final AbstractTaskAttachmentSource source;
-
- private final ITask task;
-
- private final TaskRepository taskRepository;
-
- private final TaskDataManager taskDataManager;
-
- public SubmitTaskAttachmentJob(TaskDataManager taskDataManager, AbstractRepositoryConnector connector,
- TaskRepository taskRepository, ITask task, AbstractTaskAttachmentSource source, String comment,
- TaskAttribute attachmentAttribute) {
- super("Submitting Attachment");
- this.taskDataManager = taskDataManager;
- this.connector = connector;
- this.taskRepository = taskRepository;
- this.task = task;
- this.source = source;
- this.comment = comment;
- this.attachmentAttribute = attachmentAttribute;
- }
-
- @Override
- public IStatus getStatus() {
- return error;
- }
-
- @Override
- public ITask getTask() {
- return task;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- final AbstractTaskAttachmentHandler attachmentHandler = connector.getTaskAttachmentHandler();
- if (attachmentHandler == null) {
- error = new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "The task repository does not support attachments.");
- return Status.OK_STATUS;
- }
- try {
- monitor.beginTask("Submitting attachment", 2 * (1 + getSubmitJobListeners().length) * 100);
- monitor.subTask("Sending data");
- attachmentHandler.postContent(taskRepository, task, source, comment, attachmentAttribute,
- Policy.subMonitorFor(monitor, 100));
- fireTaskSubmitted(monitor);
- monitor.subTask("Updating task");
- TaskData taskData = connector.getTaskData(taskRepository, task.getTaskId(), Policy.subMonitorFor(monitor,
- 100));
- taskDataManager.putUpdatedTaskData(task, taskData, true);
- fireTaskSynchronized(monitor);
- } catch (CoreException e) {
- error = e.getStatus();
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- } finally {
- monitor.done();
- }
- fireDone();
- return Status.OK_STATUS;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java
deleted file mode 100644
index bde88c0d4..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SubmitTaskJob.java
+++ /dev/null
@@ -1,128 +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.core.sync;
-
-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.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.TaskTask;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractLegacyRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.RepositoryResponse;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
-
-/**
- * @author Steffen Pingel
- */
-public class SubmitTaskJob extends SubmitJob {
-
- private final TaskRepository taskRepository;
-
- private final TaskData taskData;
-
- private final AbstractRepositoryConnector connector;
-
- private IStatus errorStatus;
-
- private ITask task;
-
- private final Set<TaskAttribute> oldAttributes;
-
- private final TaskDataManager taskDataManager;
-
- private RepositoryResponse response;
-
- public SubmitTaskJob(TaskDataManager taskDataManager, AbstractRepositoryConnector connector,
- TaskRepository taskRepository, ITask task, TaskData taskData, Set<TaskAttribute> oldAttributes) {
- super("Submitting Task");
- this.taskDataManager = taskDataManager;
- this.connector = connector;
- this.taskRepository = taskRepository;
- this.task = task;
- this.taskData = taskData;
- this.oldAttributes = oldAttributes;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Submitting task", 2 * (1 + getSubmitJobListeners().length) * 100);
-
- // post task data
- AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- monitor.subTask("Sending data");
- response = taskDataHandler.postTaskData(taskRepository, taskData, oldAttributes, Policy.subMonitorFor(
- monitor, 100));
- if (response == null || response.getTaskId() == null) {
- throw new CoreException(new RepositoryStatus(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- RepositoryStatus.ERROR_INTERNAL,
- "Task could not be created. No additional information was provided by the connector."));
- }
- fireTaskSubmitted(monitor);
-
- // update task in task list
- String taskId = response.getTaskId();
- monitor.subTask("Receiving data");
- TaskData updatedTaskData = connector.getTaskData(taskRepository, taskId, Policy.subMonitorFor(monitor, 100));
- task = createTask(monitor, updatedTaskData);
- taskDataManager.putSubmittedTaskData(task, updatedTaskData);
- fireTaskSynchronized(monitor);
- } catch (CoreException e) {
- errorStatus = e.getStatus();
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Unexpected error during task submission", e));
- errorStatus = new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Unexpected error: "
- + e.getMessage(), e);
- } finally {
- monitor.done();
- }
- fireDone();
- return Status.OK_STATUS;
- }
-
- private ITask createTask(IProgressMonitor monitor, TaskData updatedTaskData) throws CoreException {
- if (taskData.isNew()) {
- if (connector instanceof AbstractLegacyRepositoryConnector) {
- task = ((AbstractLegacyRepositoryConnector) connector).createTask(taskRepository.getRepositoryUrl(),
- updatedTaskData.getTaskId(), "");
- } else {
- task = new TaskTask(connector.getConnectorKind(), taskRepository.getRepositoryUrl(),
- updatedTaskData.getTaskId());
- }
- }
- return task;
- }
-
- @Override
- public IStatus getStatus() {
- return errorStatus;
- }
-
- @Override
- public ITask getTask() {
- return task;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizationSession.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizationSession.java
deleted file mode 100644
index 0cdda75a0..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizationSession.java
+++ /dev/null
@@ -1,129 +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.core.sync;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-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.core.sync.ISynchronizationSession;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class SynchronizationSession implements ISynchronizationSession {
-
- private Set<ITask> changedTasks;
-
- private Object data;
-
- private boolean fullSynchronization;
-
- private boolean performQueries;
-
- private Set<ITask> staleTasks;
-
- private TaskDataManager taskDataManager;
-
- private TaskRepository taskRepository;
-
- private Set<ITask> tasks;
-
- private boolean user;
-
- public SynchronizationSession() {
- }
-
- public SynchronizationSession(TaskDataManager taskDataManager) {
- this.taskDataManager = taskDataManager;
- }
-
- public Set<ITask> getChangedTasks() {
- return changedTasks;
- }
-
- public Object getData() {
- return data;
- }
-
- public Set<ITask> getStaleTasks() {
- return staleTasks;
- }
-
- public TaskDataManager getTaskDataManager() {
- return taskDataManager;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public Set<ITask> getTasks() {
- return tasks;
- }
-
- public boolean isFullSynchronization() {
- return fullSynchronization;
- }
-
- public boolean isUser() {
- return user;
- }
-
- public void markStale(ITask task) {
- if (staleTasks == null) {
- staleTasks = new HashSet<ITask>();
- }
- staleTasks.add(task);
- }
-
- public boolean needsPerformQueries() {
- return performQueries;
- }
-
- public void putTaskData(ITask task, TaskData taskData) throws CoreException {
- if (taskDataManager != null) {
- taskDataManager.putUpdatedTaskData(task, taskData, false);
- }
- }
-
- public void setChangedTasks(Set<ITask> changedTasks) {
- this.changedTasks = changedTasks;
- }
-
- public void setData(Object data) {
- this.data = data;
- }
-
- public void setFullSynchronization(boolean fullSynchronization) {
- this.fullSynchronization = fullSynchronization;
- }
-
- public void setNeedsPerformQueries(boolean performQueries) {
- this.performQueries = performQueries;
- }
-
- public void setTaskRepository(TaskRepository taskRepository) {
- this.taskRepository = taskRepository;
- }
-
- public void setTasks(Set<ITask> tasks) {
- this.tasks = tasks;
- }
-
- public void setUser(boolean user) {
- this.user = user;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java
deleted file mode 100644
index ccaed66c5..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeQueriesJob.java
+++ /dev/null
@@ -1,346 +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.core.sync;
-
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-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.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-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.data.TaskDataManager;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractLegacyRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.LegacyTaskDataCollector;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-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.ITask.SynchronizationState;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-import org.eclipse.mylyn.tasks.core.data.TaskRelation;
-import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
-import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class SynchronizeQueriesJob extends SynchronizationJob {
-
- private static class MutexRule implements ISchedulingRule {
-
- private final Object object;
-
- public MutexRule(Object object) {
- this.object = object;
- }
-
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- if (rule instanceof MutexRule) {
- return object.equals(((MutexRule) rule).object);
- }
- return false;
- }
- }
-
- @SuppressWarnings("deprecation")
- private class TaskCollector extends LegacyTaskDataCollector {
-
- private final Set<ITask> removedQueryResults;
-
- private final RepositoryQuery repositoryQuery;
-
- private int resultCount;
-
- private final SynchronizationSession session;
-
- public TaskCollector(RepositoryQuery repositoryQuery, SynchronizationSession session) {
- this.repositoryQuery = repositoryQuery;
- this.session = session;
- this.removedQueryResults = new HashSet<ITask>(repositoryQuery.getChildren());
- }
-
- @Override
- public void accept(TaskData taskData) {
- ITask task = taskList.getTask(taskData.getRepositoryUrl(), taskData.getTaskId());
- if (task == null) {
- task = tasksModel.createTask(repository, taskData.getTaskId());
- if (taskData.isPartial()) {
- session.markStale(task);
- }
- } else {
- removedQueryResults.remove(task);
- }
- try {
- session.putTaskData(task, taskData);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Failed to save task", e));
- }
- taskList.addTask(task, repositoryQuery);
- resultCount++;
- }
-
- @Override
- @Deprecated
- public void accept(RepositoryTaskData taskData) {
- boolean changed;
- AbstractTask task = (AbstractTask) taskList.getTask(taskData.getRepositoryUrl(), taskData.getTaskId());
- if (task == null) {
- task = ((AbstractLegacyRepositoryConnector) connector).createTask(taskData.getRepositoryUrl(),
- taskData.getTaskId(), "");
- task.setStale(true);
- changed = ((AbstractLegacyRepositoryConnector) connector).updateTaskFromTaskData(repository, task,
- taskData);
- } else {
- changed = ((AbstractLegacyRepositoryConnector) connector).updateTaskFromTaskData(repository, task,
- taskData);
- removedQueryResults.remove(task);
- }
- taskList.addTask(task, repositoryQuery);
- if (!taskData.isPartial()) {
- (taskDataManager).saveIncoming(task, taskData, isUser());
- } else if (changed && !task.isStale()
- && task.getSynchronizationState() == SynchronizationState.SYNCHRONIZED) {
- // TODO move to synchronizationManager
- // set incoming marker for web tasks
- task.setSynchronizationState(SynchronizationState.INCOMING);
- }
- if (task.isStale()) {
- session.markStale(task);
- task.setSynchronizing(true);
- }
- resultCount++;
- }
-
- public Set<ITask> getRemovedChildren() {
- return removedQueryResults;
- }
-
- public int getResultCount() {
- return resultCount;
- }
-
- }
-
- public static final String MAX_HITS_REACHED = "Max allowed number of hits returned exceeded. Some hits may not be displayed. Please narrow query scope.";
-
- private final AbstractRepositoryConnector connector;
-
- private final Set<RepositoryQuery> queries;
-
- private final TaskRepository repository;
-
- private final TaskDataManager taskDataManager;
-
- private final TaskList taskList;
-
- private final IRepositoryModel tasksModel;
-
- public SynchronizeQueriesJob(TaskList taskList, TaskDataManager taskDataManager, IRepositoryModel tasksModel,
- AbstractRepositoryConnector connector, TaskRepository repository, Set<RepositoryQuery> queries) {
- super("Synchronizing Queries (" + repository.getRepositoryLabel() + ")");
- this.taskList = taskList;
- this.taskDataManager = taskDataManager;
- this.tasksModel = tasksModel;
- this.connector = connector;
- this.repository = repository;
- this.queries = queries;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Processing", 20 + queries.size() * 20 + 40 + 10);
-
- Set<ITask> allTasks;
- if (!isFullSynchronization()) {
- allTasks = new HashSet<ITask>();
- for (RepositoryQuery query : queries) {
- allTasks.addAll(query.getChildren());
- }
- } else {
- allTasks = taskList.getTasks(repository.getRepositoryUrl());
- }
-
- MutexRule rule = new MutexRule(repository);
- try {
- Job.getJobManager().beginRule(rule, monitor);
-
- final Map<String, TaskRelation[]> relationsByTaskId = new HashMap<String, TaskRelation[]>();
- SynchronizationSession session = new SynchronizationSession(taskDataManager) {
- @Override
- public void putTaskData(ITask task, TaskData taskData) throws CoreException {
- taskDataManager.putUpdatedTaskData(task, taskData, isUser(), this);
- if (!taskData.isPartial()) {
- Collection<TaskRelation> relations = connector.getTaskRelations(taskData);
- if (relations != null) {
- relationsByTaskId.put(task.getTaskId(), relations.toArray(new TaskRelation[0]));
- }
- }
- }
- };
- session.setTaskRepository(repository);
- session.setFullSynchronization(isFullSynchronization());
- session.setTasks(Collections.unmodifiableSet(allTasks));
- session.setNeedsPerformQueries(true);
- session.setUser(isUser());
-
- preSynchronization(session, new SubProgressMonitor(monitor, 20));
-
- if (session.needsPerformQueries()) {
- // synchronize queries, tasks changed within query are added to set of tasks to be synchronized
- synchronizeQueries(monitor, session);
- } else {
- monitor.worked(queries.size() * 20);
- }
-
- Set<ITask> tasksToBeSynchronized = new HashSet<ITask>();
- if (session.getStaleTasks() != null) {
- for (ITask task : session.getStaleTasks()) {
- tasksToBeSynchronized.add(task);
- ((AbstractTask) task).setSynchronizing(true);
- }
- }
-
- // synchronize tasks that were marked by the connector
- SynchronizeTasksJob job = new SynchronizeTasksJob(taskList, taskDataManager, tasksModel, connector,
- repository, tasksToBeSynchronized);
- job.setUser(isUser());
- job.setSession(session);
- if (!tasksToBeSynchronized.isEmpty()) {
- Policy.checkCanceled(monitor);
- job.run(new SubProgressMonitor(monitor, 30));
- }
- monitor.subTask("Receiving related tasks");
- job.synchronizedTaskRelations(monitor, relationsByTaskId);
- monitor.worked(10);
-
- session.setChangedTasks(tasksToBeSynchronized);
-
- // hook into the connector for synchronization time stamp management
- postSynchronization(session, new SubProgressMonitor(monitor, 10));
- } finally {
- Job.getJobManager().endRule(rule);
- }
- return Status.OK_STATUS;
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- } finally {
- monitor.done();
- }
- }
-
- private void synchronizeQueries(IProgressMonitor monitor, SynchronizationSession session) {
- for (RepositoryQuery repositoryQuery : queries) {
- Policy.checkCanceled(monitor);
- repositoryQuery.setStatus(null);
-
- monitor.subTask("Synchronizing query " + repositoryQuery.getSummary());
- synchronizeQuery(repositoryQuery, session, new SubProgressMonitor(monitor, 20));
-
- repositoryQuery.setSynchronizing(false);
- taskList.notifySynchronizationStateChanged(Collections.singleton(repositoryQuery));
- }
- }
-
- private boolean postSynchronization(SynchronizationSession event, IProgressMonitor monitor) {
- try {
- Policy.checkCanceled(monitor);
- monitor.subTask("Updating repository state");
- if (!isUser()) {
- monitor = Policy.backgroundMonitorFor(monitor);
- }
- connector.postSynchronization(event, monitor);
- return true;
- } catch (CoreException e) {
- updateQueryStatus(e.getStatus());
- return false;
- }
- }
-
- private boolean preSynchronization(ISynchronizationSession event, IProgressMonitor monitor) {
- try {
- Policy.checkCanceled(monitor);
- monitor.subTask("Querying repository");
- if (!isUser()) {
- monitor = Policy.backgroundMonitorFor(monitor);
- }
- connector.preSynchronization(event, monitor);
- if (!event.needsPerformQueries() && !isUser()) {
- updateQueryStatus(null);
- return false;
- }
- return true;
- } catch (CoreException e) {
- // synchronization is unlikely to succeed, inform user and exit
- updateQueryStatus(e.getStatus());
- return false;
- }
- }
-
- private void synchronizeQuery(RepositoryQuery repositoryQuery, SynchronizationSession event,
- IProgressMonitor monitor) {
- TaskCollector collector = new TaskCollector(repositoryQuery, event);
-
- if (!isUser()) {
- monitor = Policy.backgroundMonitorFor(monitor);
- }
- IStatus result = connector.performQuery(repository, repositoryQuery, collector, event, monitor);
- if (result.getSeverity() == IStatus.CANCEL) {
- // do nothing
- } else if (result.isOK()) {
- if (collector.getResultCount() >= TaskDataCollector.MAX_HITS) {
- StatusHandler.log(new Status(IStatus.WARNING, ITasksCoreConstants.ID_PLUGIN, MAX_HITS_REACHED + "\n"
- + repositoryQuery.getSummary()));
- }
-
- Set<ITask> removedChildren = collector.getRemovedChildren();
- if (!removedChildren.isEmpty()) {
- taskList.removeFromContainer(repositoryQuery, removedChildren);
- }
-
- repositoryQuery.setLastSynchronizedStamp(new SimpleDateFormat("MMM d, H:mm:ss").format(new Date()));
- } else {
- repositoryQuery.setStatus(result);
- }
- }
-
- private void updateQueryStatus(final IStatus status) {
- for (RepositoryQuery repositoryQuery : queries) {
- repositoryQuery.setStatus(status);
- repositoryQuery.setSynchronizing(false);
- taskList.notifyElementChanged(repositoryQuery);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
deleted file mode 100644
index d33c8b4a3..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeRepositoriesJob.java
+++ /dev/null
@@ -1,138 +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.core.sync;
-
-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.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-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.data.TaskDataManager;
-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.TaskRepository;
-import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
-
-/**
- * @author Steffen Pingel
- */
-public class SynchronizeRepositoriesJob extends SynchronizationJob {
-
- private final TaskList taskList;
-
- private final TaskDataManager taskDataManager;
-
- private final IRepositoryManager repositoryManager;
-
- private final Set<TaskRepository> repositories;
-
- private final Object family = new Object();
-
- private final IRepositoryModel tasksModel;
-
- public SynchronizeRepositoriesJob(TaskList taskList, TaskDataManager taskDataManager, IRepositoryModel tasksModel,
- IRepositoryManager repositoryManager, Set<TaskRepository> repositories) {
- super("Synchronizing Task List");
- this.taskList = taskList;
- this.taskDataManager = taskDataManager;
- this.tasksModel = tasksModel;
- this.repositoryManager = repositoryManager;
- this.repositories = repositories;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask("Processing", repositories.size() * 100);
-
- for (TaskRepository repository : repositories) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
-
- if (repository.isOffline()) {
- monitor.worked(100);
- continue;
- }
-
- monitor.setTaskName("Processing " + repository.getRepositoryLabel());
-
- final AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(repository.getConnectorKind());
- Set<RepositoryQuery> queries = taskList.getRepositoryQueries(repository.getRepositoryUrl());
-
- if (isUser() || queries.isEmpty()) {
- monitor.worked(20);
- } else {
- // occasionally request update of repository configuration attributes
- updateRepositoryConfiguration(repository, connector, new SubProgressMonitor(monitor, 20));
- }
-
- SynchronizeQueriesJob job = new SynchronizeQueriesJob(taskList, taskDataManager, tasksModel, connector,
- repository, queries) {
- @Override
- public boolean belongsTo(Object family) {
- return SynchronizeRepositoriesJob.this.family == family;
- }
- };
- job.setUser(isUser());
- job.setFullSynchronization(true);
- job.setPriority(Job.DECORATE);
- if (isUser()) {
- job.schedule();
- } else {
- job.run(new SubProgressMonitor(monitor, 80));
- }
- }
-
- // it's better to remove the job from the progress view instead of having it blocked until all child jobs finish
-// if (isUser()) {
-// Job.getJobManager().join(family, monitor);
-// }
- } catch (InterruptedException e) {
- return Status.CANCEL_STATUS;
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
-
- public Object getFamily() {
- return family;
- }
-
- private void updateRepositoryConfiguration(TaskRepository repository, AbstractRepositoryConnector connector,
- IProgressMonitor monitor) throws InterruptedException {
- try {
- if (!isUser()) {
- monitor = Policy.backgroundMonitorFor(monitor);
- }
- monitor.beginTask("Updating repository configuration for " + repository.getRepositoryUrl(), 100);
- if (connector.isRepositoryConfigurationStale(repository, monitor)) {
- connector.updateRepositoryConfiguration(repository, monitor);
- repository.setConfigurationDate(new Date());
- // FIXME save repositories
- }
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Updating of repository configuration failed", e));
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java
deleted file mode 100644
index 2aaf143c9..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/SynchronizeTasksJob.java
+++ /dev/null
@@ -1,402 +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.core.sync;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-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.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
-import org.eclipse.mylyn.internal.tasks.core.ITaskList;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractLegacyRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractTaskDataHandler;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.LegacyTaskDataCollector;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.TaskFactory;
-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.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskRelation;
-import org.eclipse.mylyn.tasks.core.data.TaskRelation.Direction;
-import org.eclipse.mylyn.tasks.core.data.TaskRelation.Kind;
-import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public class SynchronizeTasksJob extends SynchronizationJob {
-
- private final AbstractRepositoryConnector connector;
-
- private final TaskDataManager taskDataManager;
-
- private final ITaskList taskList;
-
- private final Set<ITask> allTasks;
-
- private final IRepositoryManager repositoryManager;
-
- private TaskRepository taskRepository;
-
- private Map<String, TaskRelation[]> relationsByTaskId;
-
- private boolean updateRelations;
-
- private final IRepositoryModel tasksModel;
-
- private SynchronizationSession session;
-
- public SynchronizeTasksJob(ITaskList taskList, TaskDataManager synchronizationManager, IRepositoryModel tasksModel,
- AbstractRepositoryConnector connector, TaskRepository taskRepository, Set<ITask> tasks) {
- super("Synchronizing Tasks (" + tasks.size() + " tasks)");
- this.taskList = taskList;
- this.taskDataManager = synchronizationManager;
- this.tasksModel = tasksModel;
- this.connector = connector;
- this.taskRepository = taskRepository;
- this.allTasks = tasks;
- this.repositoryManager = null;
- }
-
- public SynchronizeTasksJob(ITaskList taskList, TaskDataManager synchronizationManager, IRepositoryModel tasksModel,
- AbstractRepositoryConnector connector, IRepositoryManager repositoryManager, Set<ITask> tasks) {
- super("Synchronizing Tasks (" + tasks.size() + " tasks)");
- this.taskList = taskList;
- this.taskDataManager = synchronizationManager;
- this.tasksModel = tasksModel;
- this.connector = connector;
- this.repositoryManager = repositoryManager;
- this.allTasks = tasks;
- }
-
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- if (taskRepository == null) {
- try {
- monitor.beginTask("Processing", allTasks.size() * 100);
- // group tasks by repository
- Map<TaskRepository, Set<ITask>> tasksByRepository = new HashMap<TaskRepository, Set<ITask>>();
- for (ITask task : allTasks) {
- TaskRepository repository = repositoryManager.getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
- Set<ITask> tasks = tasksByRepository.get(repository);
- if (tasks == null) {
- tasks = new HashSet<ITask>();
- tasksByRepository.put(repository, tasks);
- }
- tasks.add(task);
- }
- // synchronize tasks for each repositories
- for (TaskRepository taskRepository : tasksByRepository.keySet()) {
- setName("Synchronizing Tasks (" + taskRepository.getRepositoryLabel() + ")");
- this.taskRepository = taskRepository;
- Set<ITask> repositoryTasks = tasksByRepository.get(taskRepository);
- run(repositoryTasks, new SubProgressMonitor(monitor, repositoryTasks.size() * 100));
- }
- } finally {
- monitor.done();
- }
- } else {
- run(allTasks, monitor);
- }
- } catch (OperationCanceledException e) {
- for (ITask task : allTasks) {
- ((AbstractTask) task).setSynchronizing(false);
- taskList.notifyElementChanged(task);
- }
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
-
- private void run(Set<ITask> tasks, IProgressMonitor monitor) {
- relationsByTaskId = new HashMap<String, TaskRelation[]>();
- updateRelations = true;
- runInternal(tasks, monitor);
- synchronizedTaskRelations(monitor, relationsByTaskId);
- }
-
- public void synchronizedTaskRelations(IProgressMonitor monitor, Map<String, TaskRelation[]> relationsByTaskId) {
- updateRelations = false;
- for (String taskId : relationsByTaskId.keySet()) {
- ITask parentTask = taskList.getTask(taskRepository.getRepositoryUrl(), taskId);
- if (parentTask instanceof ITaskContainer) {
- Set<ITask> removedChildTasks = new HashSet<ITask>(((ITaskContainer) parentTask).getChildren());
-
- TaskRelation[] relations = relationsByTaskId.get(taskId);
- for (TaskRelation relation : relations) {
- if (relation.getDirection() == Direction.OUTWARD && relation.getKind() == Kind.CONTAINMENT) {
- ITask task = taskList.getTask(taskRepository.getRepositoryUrl(), relation.getTaskId());
- if (task == null) {
- try {
- task = synchronizeTask(monitor, relation.getTaskId());
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Synchronization failed", e));
- }
- } else {
- removedChildTasks.remove(task);
- }
-
- if (task != null) {
- taskList.addTask(task, (AbstractTaskContainer) parentTask);
- }
- }
- }
-
- for (ITask task : removedChildTasks) {
- taskList.removeFromContainer((AbstractTaskContainer) parentTask, task);
- }
- }
- }
- }
-
- private void runInternal(Set<ITask> tasks, IProgressMonitor monitor) {
- try {
- monitor.beginTask("Processing", tasks.size() * 100);
- if (canGetMultiTaskData(taskRepository)) {
- try {
- for (ITask task : tasks) {
- resetStatus(task);
- }
- synchronizeTasks(new SubProgressMonitor(monitor, tasks.size() * 100), taskRepository, tasks);
- } catch (CoreException e) {
- for (ITask task : tasks) {
- updateStatus(taskRepository, task, e.getStatus());
- }
- }
- } else {
- for (ITask task : tasks) {
- Policy.checkCanceled(monitor);
- resetStatus(task);
- try {
- synchronizeTask(new SubProgressMonitor(monitor, 100), task);
- } catch (CoreException e) {
- updateStatus(taskRepository, task, e.getStatus());
- }
- }
- }
- } catch (OperationCanceledException e) {
- throw e;
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Synchronization failed", e));
- } finally {
- monitor.done();
- }
- }
-
- @SuppressWarnings("deprecation")
- private boolean canGetMultiTaskData(TaskRepository taskRepository) {
- if (connector instanceof AbstractLegacyRepositoryConnector) {
- AbstractTaskDataHandler taskDataHandler = ((AbstractLegacyRepositoryConnector) connector).getLegacyTaskDataHandler();
- return taskDataHandler != null && taskDataHandler.canGetMultiTaskData();
- } else {
- org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
- return taskDataHandler != null && taskDataHandler.canGetMultiTaskData(taskRepository);
- }
- }
-
- @SuppressWarnings("deprecation")
- private void synchronizeTask(IProgressMonitor monitor, ITask task) throws CoreException {
- monitor.subTask("Receiving task " + task.getSummary());
- resetStatus(task);
- if (!isUser()) {
- monitor = Policy.backgroundMonitorFor(monitor);
- }
- String taskId = task.getTaskId();
- if (connector instanceof AbstractLegacyRepositoryConnector) {
- RepositoryTaskData downloadedTaskData = ((AbstractLegacyRepositoryConnector) connector).getLegacyTaskData(
- taskRepository, taskId, monitor);
- if (downloadedTaskData != null) {
- try {
- updateFromTaskData(taskRepository, task, downloadedTaskData);
- } catch (CoreException e) {
- updateStatus(taskRepository, task, e.getStatus());
- }
- return;
- }
- } else {
- TaskData taskData = connector.getTaskData(taskRepository, taskId, monitor);
- if (taskData != null) {
- updateFromTaskData(taskRepository, task, taskData);
- return;
- }
- }
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Connector failed to return task data for task \"" + task + "\""));
- }
-
- private ITask synchronizeTask(IProgressMonitor monitor, String taskId) throws CoreException {
- monitor.subTask("Receiving task " + taskId);
- if (!isUser()) {
- monitor = Policy.backgroundMonitorFor(monitor);
- }
- if (connector instanceof AbstractLegacyRepositoryConnector) {
- RepositoryTaskData downloadedTaskData = ((AbstractLegacyRepositoryConnector) connector).getLegacyTaskData(
- taskRepository, taskId, monitor);
- if (downloadedTaskData != null) {
- return updateFromTaskData(taskRepository, null, downloadedTaskData);
- }
- } else {
- TaskData taskData = connector.getTaskData(taskRepository, taskId, monitor);
- if (taskData != null) {
- return createFromTaskData(taskRepository, taskId, taskData);
- }
- }
- throw new CoreException(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Connector failed to return task data for task \"" + taskId + "\""));
- }
-
- private void resetStatus(ITask task) {
- ((AbstractTask) task).setErrorStatus(null);
- taskList.notifySynchronizationStateChanged(task);
- }
-
- @SuppressWarnings("deprecation")
- private void synchronizeTasks(IProgressMonitor monitor, final TaskRepository repository, Set<ITask> tasks)
- throws CoreException {
- monitor.subTask("Receiving " + tasks.size() + " tasks from " + repository.getRepositoryLabel());
-
- final Map<String, ITask> idToTask = new HashMap<String, ITask>();
- for (ITask task : tasks) {
- idToTask.put(task.getTaskId(), task);
- }
-
- LegacyTaskDataCollector collector = new LegacyTaskDataCollector() {
- @Override
- public void accept(RepositoryTaskData taskData) {
- ITask task = idToTask.remove(taskData.getTaskId());
- if (task != null) {
- try {
- updateFromTaskData(repository, task, taskData);
- } catch (CoreException e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Synchronization failed", e));
- }
- }
- }
-
- @Override
- public void accept(TaskData taskData) {
- ITask task = idToTask.remove(taskData.getTaskId());
- if (task != null) {
- updateFromTaskData(repository, task, taskData);
- }
- }
- };
-
- if (!isUser()) {
- monitor = Policy.backgroundMonitorFor(monitor);
- }
- Set<String> taskIds = Collections.unmodifiableSet(new HashSet<String>(idToTask.keySet()));
- if (connector instanceof AbstractLegacyRepositoryConnector) {
- ((AbstractLegacyRepositoryConnector) connector).getLegacyTaskDataHandler().getMultiTaskData(repository,
- taskIds, collector, monitor);
- } else {
- connector.getTaskDataHandler().getMultiTaskData(repository, taskIds, collector, monitor);
- }
-
- }
-
- @SuppressWarnings("deprecation")
- private ITask updateFromTaskData(TaskRepository repository, ITask task, RepositoryTaskData taskData)
- throws CoreException {
- // HACK: part of hack below
- //Date oldDueDate = repositoryTask.getDueDate();
-
-// boolean changed = ((AbstractLegacyRepositoryConnector) connector).updateTaskFromTaskData(repository, task,
-// taskData);
-// if (!taskData.isPartial()) {
-// ((TaskDataManager) taskDataManager).saveIncoming(task, taskData, isUser());
-// } else if (changed && !task.isStale() && task.getSynchronizationState() == SynchronizationState.SYNCHRONIZED) {
-// // TODO move to synchronizationManager
-// // set incoming marker for web tasks
-// ((AbstractTask) task).setSynchronizationState(SynchronizationState.INCOMING);
-// }
-
- TaskFactory factory = new TaskFactory(repository, true, isUser(),
- (AbstractLegacyRepositoryConnector) connector, taskDataManager, taskList);
- task = factory.createTask(taskData, new NullProgressMonitor());
-
- // HACK: Remove once connectors can get access to
- // TaskDataManager and do this themselves
-// if ((oldDueDate == null && repositoryTask.getDueDate() != null)
-// || (oldDueDate != null && repositoryTask.getDueDate() == null)) {
-// TasksUiPlugin.getTaskActivityManager().setDueDate(repositoryTask, repositoryTask.getDueDate());
-// } else if (oldDueDate != null && repositoryTask.getDueDate() != null
-// && oldDueDate.compareTo(repositoryTask.getDueDate()) != 0) {
-// TasksUiPlugin.getTaskActivityManager().setDueDate(repositoryTask, repositoryTask.getDueDate());
-// }
-
- ((AbstractTask) task).setSynchronizing(false);
- taskList.notifySynchronizationStateChanged(task);
-
- return task;
- }
-
- private void updateFromTaskData(TaskRepository taskRepository, ITask task, TaskData taskData) {
- try {
- taskDataManager.putUpdatedTaskData(task, taskData, isUser(), getSession());
- if (updateRelations) {
- Collection<TaskRelation> relations = connector.getTaskRelations(taskData);
- if (relations != null) {
- relationsByTaskId.put(task.getTaskId(), relations.toArray(new TaskRelation[0]));
- }
- }
- } catch (CoreException e) {
- updateStatus(taskRepository, task, e.getStatus());
- }
- }
-
- private ITask createFromTaskData(TaskRepository taskRepository, String taskId, TaskData taskData)
- throws CoreException {
- ITask task = tasksModel.createTask(taskRepository, taskData.getTaskId());
- taskDataManager.putUpdatedTaskData(task, taskData, isUser(), getSession());
- return task;
- }
-
- private void updateStatus(TaskRepository repository, ITask task, IStatus status) {
- ((AbstractTask) task).setErrorStatus(status);
- if (!isUser()) {
- ((AbstractTask) task).setSynchronizing(false);
- }
- taskList.notifyElementChanged(task);
- }
-
- public SynchronizationSession getSession() {
- return session;
- }
-
- public void setSession(SynchronizationSession session) {
- this.session = session;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractDuplicateDetector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractDuplicateDetector.java
deleted file mode 100644
index 41f2f1e51..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractDuplicateDetector.java
+++ /dev/null
@@ -1,51 +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.tasks.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * Extend to provide task duplicate detection facilities to the task editor (e.g. Java stack trace matching).
- *
- * @author Gail Murphy
- * @author Robert Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractDuplicateDetector {
-
- private String name;
-
- private String connectorKind;
-
- public abstract IRepositoryQuery getDuplicatesQuery(TaskRepository repository, TaskData taskData)
- throws CoreException;
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setConnectorKind(String kind) {
- this.connectorKind = kind;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getConnectorKind() {
- return this.connectorKind;
- }
-
- public boolean canQuery(TaskData taskData) {
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
deleted file mode 100644
index e6b49a7ba..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
+++ /dev/null
@@ -1,249 +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.tasks.core;
-
-import java.util.Collection;
-import java.util.Date;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
-import org.eclipse.mylyn.tasks.core.data.TaskMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskRelation;
-import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
-
-/**
- * Encapsulates common operations that can be performed on a task repository. Extend to connect with a Java API or WS
- * API for accessing the repository.
- *
- * Only methods that take a progress monitor can do network I/O.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Shawn Minto
- * @since 2.0
- */
-public abstract class AbstractRepositoryConnector {
-
- private static final long REPOSITORY_CONFIGURATION_UPDATE_INTERVAL = 24 * 60 * 60 * 1000;
-
- /**
- * @since 2.0
- */
- public abstract boolean canCreateNewTask(TaskRepository repository);
-
- /**
- * @since 2.0
- */
- public abstract boolean canCreateTaskFromKey(TaskRepository repository);
-
- /**
- * @since 3.0
- */
- public boolean canQuery(TaskRepository repository) {
- return true;
- }
-
- /**
- * @return the unique kind of the repository, e.g. "bugzilla"
- * @since 2.0
- */
- public abstract String getConnectorKind();
-
- /**
- * The connector's summary i.e. "JIRA (supports 3.3.1 and later)"
- *
- * @since 2.0
- */
- public abstract String getLabel();
-
- /**
- * Can return null if URLs are not used to identify tasks.
- */
- public abstract String getRepositoryUrlFromTaskUrl(String taskFullUrl);
-
- /**
- * Returns a short label for the connector, e.g. Bugzilla.
- *
- * @since 2.3
- */
- public String getShortLabel() {
- String label = getLabel();
- if (label == null) {
- return null;
- }
-
- int i = label.indexOf("(");
- if (i != -1) {
- return label.substring(0, i).trim();
- }
-
- i = label.indexOf(" ");
- if (i != -1) {
- return label.substring(0, i).trim();
- }
-
- return label;
- }
-
- /**
- * @since 3.0
- */
- public AbstractTaskAttachmentHandler getTaskAttachmentHandler() {
- return null;
- }
-
- /**
- * @since 3.0
- */
- public abstract TaskData getTaskData(TaskRepository taskRepository, String taskId, IProgressMonitor monitor)
- throws CoreException;
-
- /**
- * @since 3.0
- */
- public AbstractTaskDataHandler getTaskDataHandler() {
- return null;
- }
-
- /**
- * @since 2.0
- */
- public abstract String getTaskIdFromTaskUrl(String taskFullUrl);
-
- /**
- * Used for referring to the task in the UI.
- */
- public String getTaskIdPrefix() {
- return "task";
- }
-
- /**
- * @since 2.0
- */
- public String[] getTaskIdsFromComment(TaskRepository repository, String comment) {
- return null;
- }
-
- /**
- * @since 3.0
- */
- public ITaskMapping getTaskMapping(TaskData taskData) {
- return new TaskMapper(taskData);
- }
-
- /**
- * Connectors can override to return other tasks associated with this task.
- *
- * @since 3.0
- */
- public Collection<TaskRelation> getTaskRelations(TaskData taskData) {
- return null;
- }
-
- /**
- * @since 2.0
- */
- public abstract String getTaskUrl(String repositoryUrl, String taskId);
-
- /**
- * @since 3.0
- */
- public abstract boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData);
-
- /**
- * @since 3.0
- */
- public boolean hasLocalCompletionState(TaskRepository taskRepository, ITask task) {
- return false;
- }
-
- /**
- * @since 3.0
- */
- public boolean hasRepositoryDueDate(TaskRepository taskRepository, ITask task, TaskData taskData) {
- return false;
- }
-
- /**
- * Default implementation returns true every 24hrs.
- *
- * @return true to indicate that the repository configuration is stale and requires update
- * @since 3.0
- */
- public boolean isRepositoryConfigurationStale(TaskRepository repository, IProgressMonitor monitor)
- throws CoreException {
- boolean isStale = true;
- Date configDate = repository.getConfigurationDate();
- if (configDate != null) {
- isStale = (new Date().getTime() - configDate.getTime()) > REPOSITORY_CONFIGURATION_UPDATE_INTERVAL;
- }
-
- return isStale;
- }
-
- /**
- * @since 2.0
- */
- public boolean isUserManaged() {
- return true;
- }
-
- /**
- * Implementors must execute query synchronously.
- *
- * @since 3.0
- */
- public abstract IStatus performQuery(TaskRepository repository, IRepositoryQuery query,
- TaskDataCollector resultCollector, ISynchronizationSession event, IProgressMonitor monitor);
-
- /**
- * Hook into the synchronization process.
- *
- * @since 3.0
- */
- public void postSynchronization(ISynchronizationSession event, IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask("", 1);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Hook into the synchronization process.
- *
- * @since 3.0
- */
- public void preSynchronization(ISynchronizationSession event, IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask("", 1);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Reset and update the repository attributes from the server (e.g. products, components)
- *
- * @since 3.0
- */
- public abstract void updateRepositoryConfiguration(TaskRepository repository, IProgressMonitor monitor)
- throws CoreException;
-
- /**
- * @since 3.0
- */
- public abstract void updateTaskFromTaskData(TaskRepository repository, ITask task, TaskData taskData);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskListMigrator.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskListMigrator.java
deleted file mode 100644
index 3b40f404c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskListMigrator.java
+++ /dev/null
@@ -1,37 +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.tasks.core;
-
-import java.util.Set;
-
-import org.w3c.dom.Element;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractTaskListMigrator {
-
- public static final String KEY_QUERY = "Query";
-
- public static final String KEY_TASK = "Task";
-
- public static final String KEY_LAST_MOD_DATE = "LastModified";
-
- public abstract String getTaskElementName();
-
- public abstract Set<String> getQueryElementNames();
-
- public abstract void migrateQuery(IRepositoryQuery query, Element element);
-
- public abstract void migrateTask(ITask task, Element element);
-
- public abstract String getConnectorKind();
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttributeContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttributeContainer.java
deleted file mode 100644
index 39cf0433d..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttributeContainer.java
+++ /dev/null
@@ -1,26 +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.tasks.core;
-
-import java.util.Map;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IAttributeContainer {
-
- public abstract String getAttribute(String key);
-
- public abstract void setAttribute(String key, String value);
-
- public abstract Map<String, String> getAttributes();
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryElement.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryElement.java
deleted file mode 100644
index 45c64770a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryElement.java
+++ /dev/null
@@ -1,38 +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.tasks.core;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * @author Mik Kersten
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IRepositoryElement extends Comparable<IRepositoryElement>, IAdaptable {
-
- /**
- * Returns a readable description of the element.
- */
- public abstract String getSummary();
-
- /**
- * Returns an identifier for unique to where it resides. For tasks this is an identifier unique to the repository in
- * which the tasks resides, such as the local machine or a web service. For elements in the Task List such as
- * queries or categories, this identifier may only be unique to that Task List.
- */
- public abstract String getHandleIdentifier();
-
- /**
- * Used for elements that reside in web services and can be used for URL-based access to resources on the local
- * machine. Optional, can be null.
- */
- public abstract String getUrl();
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryListener.java
deleted file mode 100644
index 0ae937ce1..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryListener.java
+++ /dev/null
@@ -1,47 +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.tasks.core;
-
-/**
- * Notified of change to the lifecycle of task repositories.
- *
- * @author Mik Kersten
- * @since 3.0
- */
-public interface IRepositoryListener {
-
- /**
- * A task repository has been added.
- *
- * @since 3.0
- */
- public abstract void repositoryAdded(TaskRepository repository);
-
- /**
- * A task repository has been removed.
- *
- * @since 3.0
- */
- public abstract void repositoryRemoved(TaskRepository repository);
-
- /**
- * The settings of a repository have been updated.
- *
- * @since 3.0
- */
- public abstract void repositorySettingsChanged(TaskRepository repository);
-
- /**
- * TODO: Refactor into general delta notification
- *
- * @since 3.0
- */
- public abstract void repositoryUrlChanged(TaskRepository repository, String oldUrl);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryManager.java
deleted file mode 100644
index 67c6e4934..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryManager.java
+++ /dev/null
@@ -1,37 +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.tasks.core;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface IRepositoryManager {
-
- public abstract void addListener(IRepositoryListener listener);
-
- public abstract void addRepository(TaskRepository repository);
-
- public abstract List<TaskRepository> getAllRepositories();
-
- public abstract Set<TaskRepository> getRepositories(String connectorKind);
-
- public abstract TaskRepository getRepository(String connectorKind, String repositoryUrl);
-
- public abstract AbstractRepositoryConnector getRepositoryConnector(String connectorKind);
-
- public abstract Collection<AbstractRepositoryConnector> getRepositoryConnectors();
-
- public abstract void removeListener(IRepositoryListener listener);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryModel.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryModel.java
deleted file mode 100644
index 1a69fb8be..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryModel.java
+++ /dev/null
@@ -1,32 +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.tasks.core;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * @since 3.0
- * @author Steffen Pingel
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IRepositoryModel {
-
- public abstract IRepositoryQuery createQuery(TaskRepository taskRepository);
-
- public abstract ITask createTask(TaskRepository taskRepository, String taskId);
-
- public abstract ITaskAttachment createTaskAttachment(TaskAttribute taskAttribute);
-
- public abstract ITaskComment createTaskComment(TaskAttribute taskAttribute);
-
- public abstract ITask getTask(TaskRepository taskRepository, String taskId);
-
- public abstract ITask getTask(String handle);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryPerson.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryPerson.java
deleted file mode 100644
index 58ea2391f..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryPerson.java
+++ /dev/null
@@ -1,29 +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.tasks.core;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface IRepositoryPerson {
-
- public abstract String getConnectorKind();
-
- public abstract String getName();
-
- public abstract String getPersonId();
-
- public abstract String getRepositoryUrl();
-
- public abstract TaskRepository getTaskRepository();
-
- public abstract void setName(String name);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryQuery.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryQuery.java
deleted file mode 100644
index e3bb5b66a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IRepositoryQuery.java
+++ /dev/null
@@ -1,31 +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.tasks.core;
-
-/**
- * @since 3.0
- */
-public interface IRepositoryQuery extends IAttributeContainer {
-
- /**
- * @since 3.0
- */
- public abstract String getConnectorKind();
-
- public abstract String getRepositoryUrl();
-
- public abstract String getUrl();
-
- public abstract void setUrl(String url);
-
- public abstract String getSummary();
-
- public abstract void setSummary(String summary);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
deleted file mode 100644
index 0077c0dd5..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
+++ /dev/null
@@ -1,331 +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.tasks.core;
-
-import java.util.Date;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface ITask extends IRepositoryElement, IAttributeContainer {
-
- /**
- * @since 3.0
- */
- public enum SynchronizationState {
- CONFLICT, INCOMING, INCOMING_NEW, OUTGOING, OUTGOING_NEW, SYNCHRONIZED;
-
- /**
- * @since 3.0
- */
- public boolean isIncoming() {
- switch (this) {
- case INCOMING:
- case INCOMING_NEW:
- case CONFLICT:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * @since 3.0
- */
- public boolean isOutgoing() {
- switch (this) {
- case OUTGOING:
- case OUTGOING_NEW:
- case CONFLICT:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * @since 3.0
- */
- public boolean isSynchronized() {
- switch (this) {
- case SYNCHRONIZED:
- return true;
- default:
- return false;
- }
- }
- }
-
- /**
- * @since 3.0
- */
- public enum PriorityLevel {
- P1, P2, P3, P4, P5;
-
- @Override
- public String toString() {
- switch (this) {
- case P1:
- return "P1";
- case P2:
- return "P2";
- case P3:
- return "P3";
- case P4:
- return "P4";
- case P5:
- return "P5";
- default:
- return "P3";
- }
- }
-
- /**
- * @since 3.0
- */
- public String getDescription() {
- switch (this) {
- case P1:
- return "Very High";
- case P2:
- return "High";
- case P3:
- return "Normal";
- case P4:
- return "Low";
- case P5:
- return "Very Low";
- default:
- return "";
- }
- }
-
- /**
- * @since 3.0
- */
- public static PriorityLevel fromLevel(int level) {
- if (level <= 1) {
- return P1;
- }
- if (level == 2) {
- return P2;
- }
- if (level == 3) {
- return P3;
- }
- if (level == 4) {
- return P4;
- }
- if (level >= 5) {
- return P5;
- }
- return getDefault();
- }
-
- /**
- * @since 3.0
- */
- public static PriorityLevel fromString(String string) {
- if (string.equals("P1")) {
- return P1;
- }
- if (string.equals("P2")) {
- return P2;
- }
- if (string.equals("P3")) {
- return P3;
- }
- if (string.equals("P4")) {
- return P4;
- }
- if (string.equals("P5")) {
- return P5;
- }
- return getDefault();
- }
-
- /**
- * @since 3.0
- */
- public static PriorityLevel fromDescription(String string) {
- if (string == null) {
- return null;
- }
- if (string.equals("Very High")) {
- return P1;
- }
- if (string.equals("High")) {
- return P2;
- }
- if (string.equals("Normal")) {
- return P3;
- }
- if (string.equals("Low")) {
- return P4;
- }
- if (string.equals("Very Low")) {
- return P5;
- }
- return getDefault();
- }
-
- /**
- * @since 3.0
- */
- public static PriorityLevel getDefault() {
- return P3;
- }
- }
-
- /**
- * Returns the date that the task was completed.
- *
- * @since 3.0
- */
- public abstract Date getCompletionDate();
-
- /**
- * Returns the identifier that uniquely distinguishes the repository connector associated with this task.
- *
- * @since 3.0
- */
- public abstract String getConnectorKind();
-
- /**
- * Returns the date that this task was created.
- *
- * @since 3.0
- */
- public abstract Date getCreationDate();
-
- /**
- * Returns the date after which this task will become overdue.
- *
- * @since 3.0
- */
- public abstract Date getDueDate();
-
- /**
- * @since 3.0
- */
- public abstract String getHandleIdentifier();
-
- /**
- * Returns the date that the repository contents of this task were last modified.
- *
- * @since 3.0
- */
- public abstract Date getModificationDate();
-
- /**
- * @since 3.0
- */
- public abstract String getOwner();
-
- /**
- * @since 3.0
- */
- public abstract String getPriority();
-
- /**
- * @since 3.0
- */
- public abstract String getRepositoryUrl();
-
- /**
- * @since 3.0
- */
- public abstract String getSummary();
-
- /**
- * @since 3.0
- */
- public abstract SynchronizationState getSynchronizationState();
-
- /**
- * @since 3.0
- */
- public abstract String getTaskId();
-
- /**
- * User identifiable key for the task to be used in UI facilities such as label displays and hyperlinked references.
- * Can return the same as the ID (e.g. in the case of Bugzilla). Can return null if no such label exists.
- *
- * @since 3.0
- */
- public abstract String getTaskKey();
-
- /**
- * @since 3.0
- */
- public abstract String getTaskKind();
-
- /**
- * @since 3.0
- */
- public abstract boolean isActive();
-
- /**
- * @since 3.0
- */
- public abstract boolean isCompleted();
-
- /**
- * @since 3.0
- */
- public abstract void setCompletionDate(Date completionDate);
-
- /**
- * @since 3.0
- */
- public abstract void setCreationDate(Date date);
-
- /**
- * @since 3.0
- */
- public abstract void setDueDate(Date date);
-
- /**
- * @since 3.0
- */
- public abstract void setModificationDate(Date modificationDate);
-
- /**
- * @since 3.0
- */
- public abstract void setOwner(String owner);
-
- /**
- * @since 3.0
- */
- public abstract void setPriority(String priority);
-
- /**
- * @since 3.0
- */
- public abstract void setSummary(String summary);
-
- /**
- * @since 3.0
- */
- public abstract void setTaskKind(String kind);
-
- /**
- * @since 3.0
- */
- public abstract void setUrl(String taskUrl);
-
- /**
- * @since 3.0
- */
- public abstract void setTaskKey(String taskKey);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivationListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivationListener.java
deleted file mode 100644
index e23a1bc22..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivationListener.java
+++ /dev/null
@@ -1,37 +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.tasks.core;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public interface ITaskActivationListener {
-
- /**
- * @since 3.0
- */
- public abstract void preTaskActivated(ITask task);
-
- /**
- * @since 3.0
- */
- public abstract void preTaskDeactivated(ITask task);
-
- /**
- * @since 3.0
- */
- public abstract void taskActivated(ITask task);
-
- /**
- * @since 3.0
- */
- public abstract void taskDeactivated(ITask task);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityListener.java
deleted file mode 100644
index 27237582b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityListener.java
+++ /dev/null
@@ -1,34 +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.tasks.core;
-
-/**
- * Notified of task activity changes.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Shawn Minto
- * @since 2.0
- */
-public interface ITaskActivityListener {
-
- /**
- * @since 3.0
- */
- public abstract void activityReset();
-
- /**
- * Warning: This is called frequently (i.e. every 15s) Implementers are responsible for launching jobs for long
- * running activity.
- *
- * @since 3.0
- */
- public abstract void elapsedTimeUpdated(ITask task, long newElapsedTime);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java
deleted file mode 100644
index 0d53e678b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskActivityManager.java
+++ /dev/null
@@ -1,79 +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.tasks.core;
-
-import java.util.Calendar;
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public interface ITaskActivityManager {
-
- /**
- * activate the given <code>task</code>
- */
- public abstract void activateTask(ITask task);
-
- /**
- * deactivate the currently active task (if any). There are no negative side effects if this method is called when
- * no task is active
- */
- public abstract void deactivateActiveTask();
-
- /**
- * deactivate the given task
- */
- public abstract void deactivateTask(ITask task);
-
- /**
- * returns all tasks that where active between <code>start</code> and <code>end</end> (exclusive)
- * both ranges are floored to the hour
- */
- public abstract Set<AbstractTask> getActiveTasks(Calendar start, Calendar end);
-
- /**
- * @return the currently active task if any
- */
- public abstract ITask getActiveTask();
-
- /**
- * returns all tasks with a due date set
- */
- public abstract Set<ITask> getAllDueTasks();
-
- /**
- * returns all tasks due between the given dates
- */
- public abstract Set<ITask> getDueTasks(Calendar start, Calendar end);
-
- /** total elapsed time based on activation history */
- public abstract long getElapsedTime(ITask task);
-
- /** total elapsed time based on activation history between <code>start</code> and <code>end</code> */
- public abstract long getElapsedTime(ITask task, Calendar start, Calendar end);
-
- public abstract void addActivityListener(ITaskActivityListener listener);
-
- public abstract void removeActivityListener(ITaskActivityListener listener);
-
- public abstract void addActivationListener(ITaskActivationListener listener);
-
- public abstract void removeActivationListener(ITaskActivationListener listener);
-
- /**
- * @param task
- * cannot be null
- * @return whether the task is the single currently active task
- */
- public abstract boolean isActive(ITask task);
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskAttachment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskAttachment.java
deleted file mode 100644
index cabf4d0a4..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskAttachment.java
+++ /dev/null
@@ -1,138 +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.tasks.core;
-
-import java.util.Date;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface ITaskAttachment {
-
- /**
- * @since 3.0
- */
- public abstract IRepositoryPerson getAuthor();
-
- /**
- * @since 3.0
- */
- public abstract String getComment();
-
- /**
- * @since 3.0
- */
- public abstract String getConnectorKind();
-
- /**
- * @since 3.0
- */
- public abstract String getContentType();
-
- /**
- * @since 3.0
- */
- public abstract Date getCreationDate();
-
- /**
- * @since 3.0
- */
- public abstract String getDescription();
-
- /**
- * @since 3.0
- */
- public abstract String getFileName();
-
- /**
- * @since 3.0
- */
- public abstract long getLength();
-
- /**
- * @since 3.0
- */
- public abstract String getRepositoryUrl();
-
- /**
- * @since 3.0
- */
- public abstract ITask getTask();
-
- /**
- * @since 3.0
- */
- public abstract TaskAttribute getTaskAttribute();
-
- /**
- * @since 3.0
- */
- public abstract TaskRepository getTaskRepository();
-
- /**
- * @since 3.0
- */
- public abstract String getUrl();
-
- /**
- * @since 3.0
- */
- public abstract boolean isDeprecated();
-
- public abstract boolean isPatch();
-
- /**
- * @since 3.0
- */
- public abstract void setAuthor(IRepositoryPerson author);
-
- /**
- * @since 3.0
- */
- public abstract void setContentType(String contentType);
-
- /**
- * @since 3.0
- */
- public abstract void setCreationDate(Date creationDate);
-
- /**
- * @since 3.0
- */
- public abstract void setDeprecated(boolean deprecated);
-
- /**
- * @since 3.0
- */
- public abstract void setDescription(String description);
-
- /**
- * @since 3.0
- */
- public abstract void setFileName(String fileName);
-
- /**
- * @since 3.0
- */
- public abstract void setLength(long length);
-
- /**
- * @since 3.0
- */
- public abstract void setPatch(boolean patch);
-
- /**
- * @since 3.0
- */
- public abstract void setUrl(String url);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java
deleted file mode 100644
index 554c144cc..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskComment.java
+++ /dev/null
@@ -1,51 +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.tasks.core;
-
-import java.util.Date;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface ITaskComment {
-
- public abstract IRepositoryPerson getAuthor();
-
- public abstract String getConnectorKind();
-
- public abstract Date getCreationDate();
-
- public abstract int getNumber();
-
- public abstract String getRepositoryUrl();
-
- public abstract ITask getTask();
-
- public abstract TaskAttribute getTaskAttribute();
-
- public abstract TaskRepository getTaskRepository();
-
- public abstract String getText();
-
- public abstract String getUrl();
-
- public abstract void setAuthor(IRepositoryPerson author);
-
- public abstract void setCreationDate(Date creationDate);
-
- public abstract void setNumber(int number);
-
- public abstract void setText(String text);
-
- public abstract void setUrl(String url);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskContainer.java
deleted file mode 100644
index 68a18925b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskContainer.java
+++ /dev/null
@@ -1,29 +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.tasks.core;
-
-import java.util.Collection;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface ITaskContainer {
-
- /**
- * Returns the children of this task, as defined by a containment hierarchy such as the Task List's categories,
- * queries and substasks. Never returns null.
- *
- * @since 3.0
- */
- public abstract Collection<ITask> getChildren();
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskMapping.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskMapping.java
deleted file mode 100644
index e0e27e81a..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskMapping.java
+++ /dev/null
@@ -1,64 +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.tasks.core;
-
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients. Extend {@link TaskMapping} instead.
- */
-public interface ITaskMapping {
-
- public void copyFrom(ITaskMapping source);
-
- public abstract List<String> getCc();
-
- public abstract Date getCompletionDate();
-
- public abstract String getComponent();
-
- public abstract Date getCreationDate();
-
- public abstract String getDescription();
-
- public abstract Date getDueDate();
-
- public abstract List<String> getKeywords();
-
- public abstract Date getModificationDate();
-
- public abstract String getOwner();
-
- public abstract PriorityLevel getPriority();
-
- public abstract String getProduct();
-
- public abstract String getReporter();
-
- public abstract String getResolution();
-
- public abstract String getSummary();
-
- public abstract TaskData getTaskData();
-
- public abstract String getTaskKey();
-
- public abstract String getTaskKind();
-
- public abstract String getTaskStatus();
-
- public abstract String getTaskUrl();
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryResponse.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryResponse.java
deleted file mode 100644
index 46ac789d0..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryResponse.java
+++ /dev/null
@@ -1,42 +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.tasks.core;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class RepositoryResponse {
-
- public enum ResponseKind {
- TASK_CREATED, TASK_UPDATED;
- };
-
- private final String taskId;
-
- private final ResponseKind reposonseKind;
-
- public RepositoryResponse(ResponseKind reposonseKind, String taskId) {
- this.reposonseKind = reposonseKind;
- this.taskId = taskId;
- }
-
- public RepositoryResponse() {
- this(null, null);
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public ResponseKind getReposonseKind() {
- return reposonseKind;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
deleted file mode 100644
index c83dcde9e..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
+++ /dev/null
@@ -1,195 +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.tasks.core;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Utility for working and capturing status specific to repository connections.
- *
- * @author Rob Elves
- * @author Steffen Pingel
- * @since 2.0
- */
-public class RepositoryStatus extends Status {
-
- public final static int ERROR_IO = 5;
-
- public final static int ERROR_NETWORK = 11;
-
- public final static int ERROR_PERMISSION_DENIED = 12;
-
- /**
- * requires construction with repositoryUrl and error message
- */
- public final static int ERROR_REPOSITORY = 1;
-
- public final static int ERROR_REPOSITORY_LOGIN = 3;
-
- public final static int ERROR_REPOSITORY_NOT_FOUND = 4;
-
- public final static int OPERATION_CANCELLED = 8;
-
- public final static int REPOSITORY_COLLISION = 6;
-
- public final static int REPOSITORY_COMMENT_REQUIRED = 9;
-
- public final static int REPOSITORY_LOGGED_OUT = 10;
-
- public final static int ERROR_INTERNAL = 7;
-
- private String htmlMessage;
-
- protected String repositoryUrl;
-
- public RepositoryStatus(TaskRepository repository, int severity, String pluginId, int code, String message) {
- this(repository.getRepositoryUrl(), severity, pluginId, code, message, null);
- }
-
- public RepositoryStatus(TaskRepository repository, int severity, String pluginId, int code, String message,
- Throwable e) {
- this(repository.getRepositoryUrl(), severity, pluginId, code, message, e);
- }
-
- public RepositoryStatus(String repositoryUrl, int severity, String pluginId, int code, String message) {
- this(repositoryUrl, severity, pluginId, code, message, null);
- }
-
- public RepositoryStatus(String repositoryUrl, int severity, String pluginId, int code, String message, Throwable e) {
- super(severity, pluginId, code, message, e);
-
- if (repositoryUrl == null) {
- throw new IllegalArgumentException("repositoryUrl must not be null");
- }
-
- this.repositoryUrl = repositoryUrl;
- }
-
- /**
- * Constructs a status object with a message.
- */
- public RepositoryStatus(int severity, String pluginId, int code, String message) {
- super(severity, pluginId, code, message, null);
- }
-
- /**
- * Constructs a status object with a message and an exception. that caused the error.
- */
- public RepositoryStatus(int severity, String pluginId, int code, String message, Throwable e) {
- super(severity, pluginId, code, message, e);
- }
-
- /**
- * Returns the message that is relevant to the code of this status.
- */
- @Override
- public String getMessage() {
- String message = super.getMessage();
- if (message != null && !"".equals(message)) {
- return message;
- }
-
- Throwable exception = getException();
- if (exception != null) {
- if (exception.getMessage() != null) {
- return exception.getMessage();
- }
- return exception.toString();
- }
-
- return "";
- }
-
- @Override
- protected void setMessage(String message) {
- super.setMessage((message != null) ? message : "");
- }
-
- protected void setHtmlMessage(String htmlMessage) {
- this.htmlMessage = htmlMessage;
- }
-
- public String getHtmlMessage() {
- return htmlMessage;
- }
-
- public boolean isHtmlMessage() {
- return htmlMessage != null;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public static RepositoryStatus createInternalError(String pluginId, String message, Throwable t) {
- return new RepositoryStatus(IStatus.ERROR, pluginId, RepositoryStatus.ERROR_INTERNAL, message, t);
- }
-
- public static RepositoryStatus createHtmlStatus(int severity, String pluginId, int code, String message,
- String htmlMessage) {
- if (htmlMessage == null) {
- throw new IllegalArgumentException("htmlMessage must not be null");
- }
-
- RepositoryStatus status = new RepositoryStatus(severity, pluginId, code, message);
- status.setHtmlMessage(htmlMessage);
- return status;
- }
-
- public static RepositoryStatus createStatus(TaskRepository repository, int severity, String pluginId, String message) {
- return createStatus(repository.getRepositoryUrl(), severity, pluginId, message);
- }
-
- public static RepositoryStatus createStatus(String repositoryUrl, int severity, String pluginId, String message) {
- return new RepositoryStatus(repositoryUrl, severity, pluginId, RepositoryStatus.ERROR_REPOSITORY, message);
- }
-
- public static RepositoryStatus createLoginError(String repositoryUrl, String pluginId) {
- return new RepositoryStatus(repositoryUrl, IStatus.ERROR, pluginId, RepositoryStatus.ERROR_REPOSITORY_LOGIN,
- NLS.bind("Unable to login to {0}. Please validate credentials via Task Repositories view.",
- repositoryUrl));
- }
-
- public static RepositoryStatus createNotFoundError(String repositoryUrl, String pluginId) {
- return new RepositoryStatus(repositoryUrl, IStatus.ERROR, pluginId,
- RepositoryStatus.ERROR_REPOSITORY_NOT_FOUND, NLS.bind("Repository {0} could not be found.",
- repositoryUrl));
- }
-
- public static RepositoryStatus createCollisionError(String repositoryUrl, String pluginId) {
- return new RepositoryStatus(
- repositoryUrl,
- IStatus.ERROR,
- pluginId,
- RepositoryStatus.REPOSITORY_COLLISION,
- NLS.bind(
- "Mid-air collision occurred while submitting to {0}.\n\nSynchronize task and re-submit changes.",
- repositoryUrl));
- }
-
- public static RepositoryStatus createCommentRequiredError(String repositoryUrl, String pluginId) {
- return new RepositoryStatus(repositoryUrl, IStatus.ERROR, pluginId,
- RepositoryStatus.REPOSITORY_COMMENT_REQUIRED,
- "You have to specify a new comment when making this change. Please comment on the reason for this change.");
- }
-
- public static RepositoryStatus createHtmlStatus(String repositoryUrl, int severity, String pluginId, int code,
- String message, String htmlMessage) {
- if (htmlMessage == null) {
- throw new IllegalArgumentException("htmlMessage must not be null");
- }
-
- RepositoryStatus status = new RepositoryStatus(repositoryUrl, severity, pluginId, code, message);
- status.setHtmlMessage(htmlMessage);
- return status;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTemplate.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTemplate.java
deleted file mode 100644
index 5a759ce3c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTemplate.java
+++ /dev/null
@@ -1,71 +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.tasks.core;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Specifies attributes for a task repository.
- *
- * @author Eugene Kuleshov
- * @author Steffen Pingel
- * @since 2.0
- */
-public final class RepositoryTemplate {
-
- public final Map<String, String> genericAttributes = new LinkedHashMap<String, String>();
-
- public final String label;
-
- public final String repositoryUrl;
-
- public final String newTaskUrl;
-
- public final String taskPrefixUrl;
-
- public final String taskQueryUrl;
-
- public final String newAccountUrl;
-
- public final boolean anonymous;
-
- public final String version;
-
- public final boolean addAutomatically;
-
- public final String characterEncoding;
-
- public RepositoryTemplate(String label, String repositoryUrl, String characterEncoding, String version,
- String newTaskUrl, String taskPrefix, String taskQuery, String newAccountUrl, boolean anonymous,
- boolean addAutomatically) {
- this.label = label;
- this.repositoryUrl = repositoryUrl;
- this.newTaskUrl = newTaskUrl;
- this.taskPrefixUrl = taskPrefix;
- this.taskQueryUrl = taskQuery;
- this.newAccountUrl = newAccountUrl;
- this.version = version;
- this.anonymous = anonymous;
- this.characterEncoding = characterEncoding;
- this.addAutomatically = addAutomatically;
- }
-
- public void addAttribute(String name, String value) {
- genericAttributes.put(name, value);
- }
-
- public String getAttribute(String name) {
- return genericAttributes.get(name);
- }
-
- public Map<String, String> getAttributes() {
- return this.genericAttributes;
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivationAdapter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivationAdapter.java
deleted file mode 100644
index 5bbb96397..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivationAdapter.java
+++ /dev/null
@@ -1,29 +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.tasks.core;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public class TaskActivationAdapter implements ITaskActivationListener {
-
- public void preTaskActivated(ITask task) {
- }
-
- public void preTaskDeactivated(ITask task) {
- }
-
- public void taskActivated(ITask task) {
- }
-
- public void taskDeactivated(ITask task) {
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivityAdapter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivityAdapter.java
deleted file mode 100644
index 303f23e6d..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskActivityAdapter.java
+++ /dev/null
@@ -1,23 +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.tasks.core;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskActivityAdapter implements ITaskActivityListener {
-
- public void activityReset() {
- }
-
- public void elapsedTimeUpdated(ITask task, long newElapsedTime) {
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskMapping.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskMapping.java
deleted file mode 100644
index a95a89361..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskMapping.java
+++ /dev/null
@@ -1,122 +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.tasks.core;
-
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskMapping implements ITaskMapping {
-
- public void copyFrom(ITaskMapping source) {
- // ignore
- }
-
- public Date getCompletionDate() {
- // ignore
- return null;
- }
-
- public String getComponent() {
- // ignore
- return null;
- }
-
- public Date getCreationDate() {
- // ignore
- return null;
- }
-
- public String getDescription() {
- // ignore
- return null;
- }
-
- public Date getDueDate() {
- // ignore
- return null;
- }
-
- public Date getModificationDate() {
- // ignore
- return null;
- }
-
- public String getOwner() {
- // ignore
- return null;
- }
-
- public PriorityLevel getPriority() {
- // ignore
- return null;
- }
-
- public String getProduct() {
- // ignore
- return null;
- }
-
- public String getSummary() {
- // ignore
- return null;
- }
-
- public TaskData getTaskData() {
- // ignore
- return null;
- }
-
- public String getTaskKey() {
- // ignore
- return null;
- }
-
- public String getTaskKind() {
- // ignore
- return null;
- }
-
- public String getTaskUrl() {
- // ignore
- return null;
- }
-
- public List<String> getCc() {
- // ignore
- return null;
- }
-
- public List<String> getKeywords() {
- // ignore
- return null;
- }
-
- public String getReporter() {
- // ignore
- return null;
- }
-
- public String getResolution() {
- // ignore
- return null;
- }
-
- public String getTaskStatus() {
- // ignore
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
deleted file mode 100644
index e52971ccf..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
+++ /dev/null
@@ -1,836 +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.tasks.core;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.net.MalformedURLException;
-import java.net.Proxy;
-import java.net.URL;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TimeZone;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-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.commons.net.WebClientUtil;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryPerson;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
-
-/**
- * Note that task repositories use Strings for storing time stamps because using Date objects led to the following
- * problems:
- * <ul>
- * <li>Often we are unable to get the time zone of the repository so interpreting the date string correctly doesn't
- * work.</li>
- * <li>Even if we do know the time zone information the local clock may be wrong. This can cause lost incoming when
- * asking the repository for all changes since date X.</li>
- * <li>The solution we have come up with thus far is not to interpret the date as a DATE object but rather simply use
- * the date string given to us by the repository itself.</li>
- * </ul>
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Eugene Kuleshov
- * @author Steffen Pingel
- * @since 2.0
- */
-@SuppressWarnings("deprecation")
-public final class TaskRepository extends PlatformObject {
-
- public static final String DEFAULT_CHARACTER_ENCODING = "UTF-8";
-
- private static final String USERNAME = ".username";
-
- private static final String PASSWORD = ".password";
-
- private static final String SAVE_PASSWORD = ".savePassword";
-
- private static final String ENABLED = ".enabled";
-
- private static final String AUTH_REPOSITORY = "org.eclipse.mylyn.tasklist.repositories";
-
- // transient
- private IStatus errorStatus = null;
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} to access
- * credentials
- */
- @Deprecated
- public static final String AUTH_PASSWORD = AUTH_REPOSITORY + PASSWORD;
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} to access
- * credentials
- */
- @Deprecated
- public static final String AUTH_USERNAME = AUTH_REPOSITORY + USERNAME;
-
- public static final String ANONYMOUS_LOGIN = "org.eclipse.mylyn.tasklist.repositories.anonymous";
-
- private static final String AUTH_HTTP = "org.eclipse.mylyn.tasklist.repositories.httpauth";
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} to access
- * credentials
- */
- @Deprecated
- public static final String AUTH_HTTP_PASSWORD = AUTH_HTTP + PASSWORD;
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} to access
- * credentials
- */
- @Deprecated
- public static final String AUTH_HTTP_USERNAME = AUTH_HTTP + USERNAME;
-
- public static final String NO_VERSION_SPECIFIED = "unknown";
-
- private static final String AUTH_SCHEME = "Basic";
-
- private static final String AUTH_REALM = "";
-
- private static final URL DEFAULT_URL;
-
- private static final String PROPERTY_CONFIG_TIMESTAMP = "org.eclipse.mylyn.tasklist.repositories.configuration.timestamp";
-
- public static final String PROXY_USEDEFAULT = "org.eclipse.mylyn.tasklist.repositories.proxy.usedefault";
-
- public static final String PROXY_HOSTNAME = "org.eclipse.mylyn.tasklist.repositories.proxy.hostname";
-
- public static final String PROXY_PORT = "org.eclipse.mylyn.tasklist.repositories.proxy.port";
-
- private static final String AUTH_PROXY = "org.eclipse.mylyn.tasklist.repositories.proxy";
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} to access
- * credentials
- */
- @Deprecated
- public static final String PROXY_USERNAME = AUTH_PROXY + USERNAME;
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} to access
- * credentials
- */
- @Deprecated
- public static final String PROXY_PASSWORD = AUTH_PROXY + PASSWORD;
-
- public static final String OFFLINE = "org.eclipse.mylyn.tasklist.repositories.offline";
-
- // HACK: Lock used to work around race condition in
- // Platform.add/get/flushAuthorizationInfo()
- private static final Object LOCK = new Object();
-
- private final Set<PropertyChangeListener> propertyChangeListeners = new HashSet<PropertyChangeListener>();
-
- // HACK: private credentials for headless operation
- private static Map<String, Map<String, String>> credentials = new HashMap<String, Map<String, String>>();
-
- static {
- URL url = null;
- try {
- url = new URL("http://eclipse.org/mylyn");
- } catch (Exception ex) {
- // TODO ?
- }
- DEFAULT_URL = url;
- }
-
- private static String getKeyPrefix(AuthenticationType type) {
- switch (type) {
- case HTTP:
- return AUTH_HTTP;
- case PROXY:
- return AUTH_PROXY;
- case REPOSITORY:
- return AUTH_REPOSITORY;
- }
- throw new IllegalArgumentException("Unknown authentication type: " + type);
- }
-
- private boolean isCachedUserName;
-
- private String cachedUserName;
-
- private final Map<String, String> properties = new LinkedHashMap<String, String>();
-
- /**
- * Stores properties that are not persisted. Note that this map is currently cleared when flushCredentials() is
- * invoked.
- */
- private final Map<String, String> transientProperties = new HashMap<String, String>();
-
- /*
- * TODO: should be externalized and added to extension point, see bug 183606
- */
- private boolean isBugRepository = false;
-
- private transient volatile boolean updating;
-
- public TaskRepository(String connectorKind, String repositoryUrl) {
- this(connectorKind, repositoryUrl, NO_VERSION_SPECIFIED);
- }
-
- /**
- * @deprecated use {@link #setProperty(String, String)} instead of passing a map
- */
- @Deprecated
- public TaskRepository(String kind, String serverUrl, Map<String, String> properties) {
- setProperty(IRepositoryConstants.PROPERTY_CONNECTOR_KIND, kind);
- setProperty(IRepositoryConstants.PROPERTY_URL, serverUrl);
- this.properties.putAll(properties);
- // use platform proxy by default (headless will need to set this to false)
- this.setProperty(TaskRepository.PROXY_USEDEFAULT, new Boolean(true).toString());
- }
-
- /**
- * for testing purposes sets repository time zone to local default time zone sets character encoding to
- * DEFAULT_CHARACTER_ENCODING
- */
- @Deprecated
- public TaskRepository(String kind, String serverUrl, String version) {
- this(kind, serverUrl, version, DEFAULT_CHARACTER_ENCODING, TimeZone.getDefault().getID());
- }
-
- @Deprecated
- public TaskRepository(String connectorKind, String repositoryUrl, String version, String encoding, String timeZoneId) {
- Assert.isNotNull(connectorKind);
- Assert.isNotNull(repositoryUrl);
- setProperty(IRepositoryConstants.PROPERTY_CONNECTOR_KIND, connectorKind);
- setProperty(IRepositoryConstants.PROPERTY_URL, repositoryUrl);
- setProperty(IRepositoryConstants.PROPERTY_VERSION, version);
- setProperty(IRepositoryConstants.PROPERTY_ENCODING, encoding);
- setProperty(IRepositoryConstants.PROPERTY_TIMEZONE, timeZoneId);
- // use platform proxy by default (headless will need to set this to false)
- this.setProperty(TaskRepository.PROXY_USEDEFAULT, new Boolean(true).toString());
-
- // for backwards compatibility to versions prior to 2.2
- this.setProperty(AUTH_REPOSITORY + SAVE_PASSWORD, String.valueOf(true));
- this.setProperty(AUTH_HTTP + SAVE_PASSWORD, String.valueOf(true));
- this.setProperty(AUTH_PROXY + SAVE_PASSWORD, String.valueOf(true));
- }
-
- // TODO e3.4 move to new api
- private void addAuthInfo(Map<String, String> map) {
- synchronized (LOCK) {
- try {
- if (Platform.isRunning()) {
- // write the map to the keyring
- try {
- Platform.addAuthorizationInfo(new URL(getRepositoryUrl()), AUTH_REALM, AUTH_SCHEME, map);
- } catch (MalformedURLException ex) {
- Platform.addAuthorizationInfo(DEFAULT_URL, getRepositoryUrl(), AUTH_SCHEME, map);
- }
- } else {
- Map<String, String> headlessCreds = getAuthInfo();
- headlessCreds.putAll(map);
- }
- } catch (CoreException e) {
- // API 3.0 propagate exception
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Could not set authorization credentials", e));
- }
- }
- }
-
- public void clearCredentials() {
- }
-
- @Override
- public boolean equals(Object object) {
- if (object == this) {
- return true;
- }
- if (object instanceof TaskRepository) {
- TaskRepository repository = (TaskRepository) object;
- return getConnectorKind().equals(repository.getConnectorKind())
- && getRepositoryUrl().equals(repository.getRepositoryUrl());
- }
- return false;
- }
-
- // TODO e3.4 move to new api
- public void flushAuthenticationCredentials() {
- synchronized (LOCK) {
- isCachedUserName = false;
-
- transientProperties.clear();
-
- // API30: legacy support for versions prior to 2.2 that did not set the enable flag, remove for 3.0
- setProperty(getKeyPrefix(AuthenticationType.HTTP) + ENABLED, null);
- setProperty(getKeyPrefix(AuthenticationType.PROXY) + ENABLED, null);
- setProperty(getKeyPrefix(AuthenticationType.REPOSITORY) + ENABLED, null);
-
- try {
- if (Platform.isRunning()) {
- try {
- Platform.flushAuthorizationInfo(new URL(getRepositoryUrl()), AUTH_REALM, AUTH_SCHEME);
- } catch (MalformedURLException ex) {
- Platform.flushAuthorizationInfo(DEFAULT_URL, getRepositoryUrl(), AUTH_SCHEME);
- }
- } else {
- Map<String, String> headlessCreds = getAuthInfo();
- headlessCreds.clear();
- }
- } catch (CoreException e) {
- // FIXME propagate exception?
- StatusHandler.fail(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Could not flush authorization credentials", e));
- }
- }
- }
-
- // TODO e3.4 move to new api
- @SuppressWarnings( { "unchecked" })
- private Map<String, String> getAuthInfo() {
- synchronized (LOCK) {
- if (Platform.isRunning()) {
- try {
- return Platform.getAuthorizationInfo(new URL(getRepositoryUrl()), AUTH_REALM, AUTH_SCHEME);
- } catch (MalformedURLException ex) {
- return Platform.getAuthorizationInfo(DEFAULT_URL, getRepositoryUrl(), AUTH_SCHEME);
- } catch (Exception e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
- "Could not retrieve authorization credentials", e));
- }
- } else {
- Map<String, String> headlessCreds = credentials.get(getRepositoryUrl());
- if (headlessCreds == null) {
- headlessCreds = new HashMap<String, String>();
- credentials.put(getRepositoryUrl(), headlessCreds);
- }
- return headlessCreds;
- }
- return null;
- }
- }
-
- private String getAuthInfo(String property) {
- Map<String, String> map = getAuthInfo();
- return map == null ? null : map.get(property);
- }
-
- public String getCharacterEncoding() {
- final String encoding = properties.get(IRepositoryConstants.PROPERTY_ENCODING);
- return encoding == null || "".equals(encoding) ? DEFAULT_CHARACTER_ENCODING : encoding;
- }
-
- /**
- * Get the last refresh date as initialized {@link Date} object, null if not set<br />
- *
- * @return {@link Date} configuration date, null if not set
- */
- public Date getConfigurationDate() {
- Date configDate = null;
- String value = this.getProperty(PROPERTY_CONFIG_TIMESTAMP);
- try {
- configDate = new Date(Long.valueOf(value).longValue());
-
- } catch (Exception e) {
-
- }
- return configDate;
- }
-
- /**
- * @return "<unknown>" if kind is unknown
- */
- public String getConnectorKind() {
- String kind = properties.get(IRepositoryConstants.PROPERTY_CONNECTOR_KIND);
- if (kind != null) {
- return kind;
- } else {
- return IRepositoryConstants.KIND_UNKNOWN;
- }
- }
-
- /**
- * Returns the credentials for an authentication type.
- *
- * @param authType
- * the type of authentication
- * @return null, if no credentials are set for <code>authType</code>
- * @since 3.0
- */
- public synchronized AuthenticationCredentials getCredentials(AuthenticationType authType) {
- String key = getKeyPrefix(authType);
-
- String enabled = getProperty(key + ENABLED);
- if (enabled == null || "true".equals(enabled)) {
- String userName = getAuthInfo(key + USERNAME);
- String password;
-
- String savePassword = getProperty(key + SAVE_PASSWORD);
- if (savePassword != null && "true".equals(savePassword)) {
- password = getAuthInfo(key + PASSWORD);
- } else {
- password = transientProperties.get(key + PASSWORD);
- }
-
- if (userName == null) {
- userName = "";
- }
- if (password == null) {
- password = "";
- }
-
- if (enabled == null && userName.length() == 0) {
- // API30: legacy support for versions prior to 2.2 that did not set the enable flag, remove for 3.0
- return null;
- }
-
- return new AuthenticationCredentials(userName, password);
- } else {
- return null;
- }
- }
-
- /**
- * @deprecated use {@link #getCredentials(AuthenticationType)} instead
- */
- @Deprecated
- public String getHttpPassword() {
- return getPassword(AuthenticationType.HTTP);
- }
-
- /**
- * @deprecated use {@link #getCredentials(AuthenticationType)} instead
- */
- @Deprecated
- public String getHttpUser() {
- return getUserName(AuthenticationType.HTTP);
- }
-
- /**
- * @deprecated use {@link #getCredentials(AuthenticationType)} instead
- */
- @Deprecated
- public String getPassword() {
- return getPassword(AuthenticationType.REPOSITORY);
- }
-
- /**
- * Legacy support for < 2.2. Remove in 2.3.
- */
- private String getPassword(AuthenticationType authType) {
- AuthenticationCredentials credentials = getCredentials(authType);
- return (credentials != null) ? credentials.getPassword() : null;
- }
-
- public Map<String, String> getProperties() {
- return new LinkedHashMap<String, String>(this.properties);
- }
-
- public String getProperty(String name) {
- return this.properties.get(name);
- }
-
- /**
- * @deprecated use {@link TaskRepositoryLocation#getProxyForHost(String, String)} instead
- */
- @Deprecated
- public Proxy getProxy() {
- Proxy proxy = Proxy.NO_PROXY;
- if (isDefaultProxyEnabled()) {
- proxy = WebClientUtil.getPlatformProxy(getRepositoryUrl());
- } else {
-
- String proxyHost = getProperty(PROXY_HOSTNAME);
- String proxyPort = getProperty(PROXY_PORT);
- String proxyUsername = "";
- String proxyPassword = "";
- if (proxyHost != null && proxyHost.length() > 0) {
- proxyUsername = getProxyUsername();
- proxyPassword = getProxyPassword();
- }
- proxy = WebClientUtil.getProxy(proxyHost, proxyPort, proxyUsername, proxyPassword);
- }
- return proxy;
- }
-
- /**
- * @deprecated use {@link #getCredentials(AuthenticationType)} instead
- */
- @Deprecated
- public String getProxyPassword() {
- return getPassword(AuthenticationType.PROXY);
- }
-
- /**
- * @deprecated use {@link #getCredentials(AuthenticationType)} instead
- */
- @Deprecated
- public String getProxyUsername() {
- return getUserName(AuthenticationType.PROXY);
- }
-
- /**
- * @return the URL if the label property is not set
- */
- public String getRepositoryLabel() {
- String label = properties.get(IRepositoryConstants.PROPERTY_LABEL);
- if (label != null && label.length() > 0) {
- return label;
- } else {
- return getRepositoryUrl();
- }
- }
-
- /**
- * @since 3.0
- */
- public boolean getSavePassword(AuthenticationType authType) {
- String value = getProperty(getKeyPrefix(authType) + SAVE_PASSWORD);
- return value != null && "true".equals(value);
- }
-
- public String getSynchronizationTimeStamp() {
- return this.properties.get(IRepositoryConstants.PROPERTY_SYNCTIMESTAMP);
- }
-
- public String getTimeZoneId() {
- final String timeZoneId = properties.get(IRepositoryConstants.PROPERTY_TIMEZONE);
- return timeZoneId == null || "".equals(timeZoneId) ? TimeZone.getDefault().getID() : timeZoneId;
- }
-
- /**
- * @deprecated Use {@link #getRepositoryUrl()} instead
- */
- @Deprecated
- public String getUrl() {
- return getRepositoryUrl();
- }
-
- /**
- * @since 3.0
- */
- public String getRepositoryUrl() {
- return properties.get(IRepositoryConstants.PROPERTY_URL);
- }
-
- /**
- * The username is cached since it needs to be retrieved frequently (e.g. for Task List decoration).
- */
- public String getUserName() {
- // NOTE: if anonymous, user name is "" string so we won't go to keyring
- if (!isCachedUserName) {
- cachedUserName = getUserName(AuthenticationType.REPOSITORY);
- isCachedUserName = true;
- }
- return cachedUserName;
- }
-
- /**
- * Legacy support for < 2.2. Remove in 2.3.
- */
- private String getUserName(AuthenticationType authType) {
- AuthenticationCredentials credentials = getCredentials(authType);
- return (credentials != null) ? credentials.getUserName() : null;
- }
-
- public String getVersion() {
- final String version = properties.get(IRepositoryConstants.PROPERTY_VERSION);
- return version == null || "".equals(version) ? NO_VERSION_SPECIFIED : version;
- }
-
- /**
- * @deprecated use #getCredentials(AuthenticationType) instead
- */
- @Deprecated
- public boolean hasCredentials() {
- String username = getUserName();
- String password = getPassword();
- return username != null && username.length() > 0 && password != null && password.length() > 0;
- }
-
- @Override
- public int hashCode() {
- return getRepositoryUrl().hashCode() * 31 + getConnectorKind().hashCode();
- }
-
- public boolean hasProperty(String name) {
- String value = getProperty(name);
- return value != null && value.trim().length() > 0;
- }
-
- /**
- * @deprecated #getCredentials(AuthenticationType) instead
- */
- @Deprecated
- public boolean isAnonymous() {
- return getProperty(ANONYMOUS_LOGIN) == null || "true".equals(getProperty(ANONYMOUS_LOGIN));
- }
-
- public boolean isBugRepository() {
- return isBugRepository;
- }
-
- /**
- * Use platform proxy settings
- */
- public boolean isDefaultProxyEnabled() {
- return "true".equals(getProperty(PROXY_USEDEFAULT));
- }
-
- public boolean isOffline() {
- return getProperty(OFFLINE) != null && "true".equals(getProperty(OFFLINE));
- }
-
- public void removeProperty(String key) {
- this.properties.remove(key);
- }
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} instead
- */
- @Deprecated
- public void setAnonymous(boolean b) {
- properties.put(ANONYMOUS_LOGIN, String.valueOf(b));
- }
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} instead
- */
- @Deprecated
- public void setAuthenticationCredentials(String username, String password) {
- setCredentials(AuthenticationType.REPOSITORY, username, password);
- }
-
- public void setBugRepository(boolean isBugRepository) {
- this.isBugRepository = isBugRepository;
- }
-
- public void setCharacterEncoding(String characterEncoding) {
- properties.put(IRepositoryConstants.PROPERTY_ENCODING, characterEncoding == null ? DEFAULT_CHARACTER_ENCODING
- : characterEncoding);
- }
-
- /**
- * Set the Configuration date to the {@link Date} indicated.
- *
- * @param configuration
- * date {@link {@link Date}
- */
- final public void setConfigurationDate(final Date date) {
- this.setProperty(PROPERTY_CONFIG_TIMESTAMP, String.valueOf(date.getTime()));
- // should persist here, but that can only be done by the TaskRepositoryManager
- // However this is also included when persisting ordinary sync time
- }
-
- /**
- * Sets the credentials for <code>authType</code>.
- *
- * @param authType
- * the type of authentication
- * @param credentials
- * the credentials, if null, the credentials for <code>authType</code> will be flushed
- * @param savePassword
- * if true, the password will be persisted in the platform key ring; otherwise it will be stored in
- * memory only
- * @since 3.0
- */
- public synchronized void setCredentials(AuthenticationType authType, AuthenticationCredentials credentials,
- boolean savePassword) {
- String key = getKeyPrefix(authType);
-
- setProperty(key + SAVE_PASSWORD, String.valueOf(savePassword));
-
- if (credentials == null) {
- setProperty(key + ENABLED, String.valueOf(false));
- transientProperties.remove(key + PASSWORD);
- setCredentialsInternal("", "", key + USERNAME, key + PASSWORD);
- } else {
- setProperty(key + ENABLED, String.valueOf(true));
- if (savePassword) {
- setCredentialsInternal(credentials.getUserName(), credentials.getPassword(), key + USERNAME, key
- + PASSWORD);
- transientProperties.remove(key + PASSWORD);
- } else {
- setCredentialsInternal(credentials.getUserName(), "", key + USERNAME, key + PASSWORD);
- transientProperties.put(key + PASSWORD, credentials.getPassword());
- }
- }
-
- if (authType == AuthenticationType.REPOSITORY) {
- if (credentials == null) {
- this.cachedUserName = null;
- this.isCachedUserName = false;
- } else {
- this.cachedUserName = credentials.getUserName();
- this.isCachedUserName = true;
- }
- }
- }
-
- /**
- * Legacy support for < 2.2. Remove in 2.3.
- */
- private void setCredentials(AuthenticationType type, String username, String password) {
- if (username == null) {
- setCredentials(type, null, true);
- } else {
- setCredentials(type, new AuthenticationCredentials(username, password), true);
- }
-
- }
-
- private void setCredentialsInternal(String username, String password, String userProperty, String passwordProperty) {
- Map<String, String> map = getAuthInfo();
- if (map == null) {
- map = new HashMap<String, String>();
- }
-
- if (username != null) {
- map.put(userProperty, username);
- }
- if (password != null) {
- map.put(passwordProperty, password);
- }
- addAuthInfo(map);
- }
-
- /**
- * @deprecated use esetCredentials(AuthenticationType, AuthenticationCredentials, boolean)
- */
- @Deprecated
- public void setHttpAuthenticationCredentials(String username, String password) {
- setCredentials(AuthenticationType.HTTP, username, password);
- }
-
- public void setOffline(boolean offline) {
- properties.put(OFFLINE, String.valueOf(offline));
- }
-
- /**
- * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} instead
- */
- @Deprecated
- public void setProxyAuthenticationCredentials(String username, String password) {
- setCredentials(AuthenticationType.PROXY, username, password);
- }
-
- public void setRepositoryLabel(String repositoryLabel) {
- setProperty(IRepositoryConstants.PROPERTY_LABEL, repositoryLabel);
- }
-
- /**
- * ONLY for use by IRepositoryConstants. To set the sync time call IRepositoryConstants.setSyncTime(repository,
- * date);
- */
- public void setSynchronizationTimeStamp(String syncTime) {
- setProperty(IRepositoryConstants.PROPERTY_SYNCTIMESTAMP, syncTime);
- }
-
- public void setProperty(String key, String value) {
- String old = this.properties.get(key);
- this.properties.put(key, value);
- notifyChangeListeners(key, old, value);
- }
-
- private void notifyChangeListeners(String key, String old, String value) {
- PropertyChangeEvent event = new PropertyChangeEvent(this, key, old, value);
- for (PropertyChangeListener listener : propertyChangeListeners) {
- listener.propertyChange(event);
- }
- }
-
- public void setTimeZoneId(String timeZoneId) {
- setProperty(IRepositoryConstants.PROPERTY_TIMEZONE, timeZoneId == null ? TimeZone.getDefault().getID()
- : timeZoneId);
- }
-
- /**
- * @deprecated Use {@link #setRepositoryUrl(String)} instead
- */
- @Deprecated
- public void setUrl(String newUrl) {
- setRepositoryUrl(newUrl);
- }
-
- /**
- * @since 3.0
- */
- public void setRepositoryUrl(String repositoryUrl) {
- Assert.isNotNull(repositoryUrl);
- properties.put(IRepositoryConstants.PROPERTY_URL, repositoryUrl);
- }
-
- public void setVersion(String ver) {
- properties.put(IRepositoryConstants.PROPERTY_VERSION, ver == null ? NO_VERSION_SPECIFIED : ver);
- }
-
- @Override
- public String toString() {
- return getRepositoryUrl();
- }
-
- /**
- * @since 3.0
- */
- public boolean isUpdating() {
- return updating;
- }
-
- /**
- * @since 3.0
- */
- public void setUpdating(boolean updating) {
- this.updating = updating;
- }
-
- /**
- * @since 3.0
- */
- public IRepositoryPerson createPerson(String personId) {
- return new RepositoryPerson(this, personId);
- }
-
- /**
- * @since 3.0
- */
- public IStatus getStatus() {
- return errorStatus;
- }
-
- /**
- * @since 3.0
- */
- public void setStatus(IStatus errorStatus) {
- this.errorStatus = errorStatus;
- }
-
- /**
- * @since 3.0
- */
- public void addChangeListener(PropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
- }
-
- /**
- * @since 3.0
- */
- public void removeChangeListener(PropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryLocationFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryLocationFactory.java
deleted file mode 100644
index 3141b8e83..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryLocationFactory.java
+++ /dev/null
@@ -1,27 +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.tasks.core;
-
-import org.eclipse.mylyn.commons.net.AbstractWebLocation;
-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
-
-/**
- * @since 2.2
- * @author Steffen Pingel
- */
-public class TaskRepositoryLocationFactory {
-
- /**
- * @since 3.0
- */
- public AbstractWebLocation createWebLocation(final TaskRepository taskRepository) {
- return new TaskRepositoryLocation(taskRepository);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentHandler.java
deleted file mode 100644
index b48bdb871..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentHandler.java
+++ /dev/null
@@ -1,36 +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.tasks.core.data;
-
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Extend to provide facility for uploading and downloading files from task repositories.
- *
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractTaskAttachmentHandler {
-
- public abstract boolean canGetContent(TaskRepository repository, ITask task);
-
- public abstract boolean canPostContent(TaskRepository repository, ITask task);
-
- public abstract InputStream getContent(TaskRepository repository, ITask task,
- TaskAttribute attachmentAttribute, IProgressMonitor monitor) throws CoreException;
-
- public abstract void postContent(TaskRepository repository, ITask task, AbstractTaskAttachmentSource source,
- String comment, TaskAttribute attachmentAttribute, IProgressMonitor monitor) throws CoreException;
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentSource.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentSource.java
deleted file mode 100644
index 42e891bee..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskAttachmentSource.java
+++ /dev/null
@@ -1,34 +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.tasks.core.data;
-
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class AbstractTaskAttachmentSource {
-
- public abstract InputStream createInputStream(IProgressMonitor monitor) throws CoreException;
-
- public abstract boolean isLocal();
-
- public abstract long getLength();
-
- public abstract String getName();
-
- public abstract String getContentType();
-
- public abstract String getDescription();
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskDataHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskDataHandler.java
deleted file mode 100644
index 32780c583..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskDataHandler.java
+++ /dev/null
@@ -1,93 +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.tasks.core.data;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.RepositoryResponse;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * Responsible for retrieving and posting task data to a repository.
- *
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- * @author Frank Becker
- * @since 3.0
- */
-public abstract class AbstractTaskDataHandler {
-
- /**
- * Download task data for each id provided
- *
- * Override getMultiTaskData() to return true and implement this method if connector supports download of multiple
- * task data in one request.
- *
- * @since 3.0
- */
- public void getMultiTaskData(TaskRepository repository, Set<String> taskIds, TaskDataCollector collector,
- IProgressMonitor monitor) throws CoreException {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Return a reference to the newly created report in the case of new task submission, null otherwise
- */
- public abstract RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData,
- Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Initialize a new task data object with default attributes and values
- */
- public abstract boolean initializeTaskData(TaskRepository repository, TaskData data,
- ITaskMapping initializationData, IProgressMonitor monitor) throws CoreException;
-
- /**
- * @since 2.2
- * @return false if this operation is not supported by the connector, true if initialized
- */
- public boolean initializeSubTaskData(TaskRepository repository, TaskData taskData, TaskData parentTaskData,
- IProgressMonitor monitor) throws CoreException {
- return false;
- }
-
- /**
- * @param taskRepository
- * TODO
- * @param task
- * the parent task, may be null
- * @param task
- * the parent task data, may be null
- * @since 2.2
- */
- public boolean canInitializeSubTaskData(TaskRepository taskRepository, ITask task) {
- return false;
- }
-
- public abstract TaskAttributeMapper getAttributeMapper(TaskRepository taskRepository);
-
- /**
- * @param taskRepository
- * TODO
- * @return true if connector support downloading multiple task data in single request, false otherwise. If true,
- * override and implement getMultiTaskData
- */
- public boolean canGetMultiTaskData(TaskRepository taskRepository) {
- return false;
- }
-
- public void migrateTaskData(TaskRepository taskRepository, TaskData taskData) {
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataManager.java
deleted file mode 100644
index 326dc7d3e..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataManager.java
+++ /dev/null
@@ -1,34 +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.tasks.core.data;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- * @noimplement
- */
-public interface ITaskDataManager {
-
- public ITaskDataWorkingCopy createWorkingCopy(ITask task, TaskData taskData);
-
- public abstract ITaskDataWorkingCopy getWorkingCopy(ITask task) throws CoreException;
-
- public abstract void discardEdits(ITask task) throws CoreException;
-
- public abstract TaskData getTaskData(ITask task) throws CoreException;
-
- public abstract TaskData getTaskData(TaskRepository task, String taskId) throws CoreException;
-
- public abstract boolean hasTaskData(ITask task);
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataWorkingCopy.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataWorkingCopy.java
deleted file mode 100644
index cd2b88a38..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/ITaskDataWorkingCopy.java
+++ /dev/null
@@ -1,44 +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.tasks.core.data;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public interface ITaskDataWorkingCopy {
-
- public abstract TaskData getEditsData();
-
- public abstract TaskData getLastReadData();
-
- public abstract TaskData getLocalData();
-
- public abstract TaskData getRepositoryData();
-
- public abstract boolean isSaved();
-
- public abstract void revert();
-
- public abstract void refresh(IProgressMonitor monitor) throws CoreException;
-
- public abstract void save(Set<TaskAttribute> edits, IProgressMonitor monitor) throws CoreException;
-
- public abstract String getConnectorKind();
-
- public abstract String getRepositoryUrl();
-
- public abstract String getTaskId();
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java
deleted file mode 100644
index 9394478e0..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentMapper.java
+++ /dev/null
@@ -1,268 +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.tasks.core.data;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-
-/**
- * @since 3.0
- * @author Steffen Pingel
- */
-public class TaskAttachmentMapper {
-
- private IRepositoryPerson author;
-
- private String comment;
-
- private String contentType;
-
- private Date creationDate;
-
- private Boolean deprecated;
-
- private String description;
-
- private String fileName;
-
- private Long length;
-
- private Boolean patch;
-
- private String url;
-
- private String attachmentId;
-
- public TaskAttachmentMapper() {
- }
-
- public String getAttachmentId() {
- return attachmentId;
- }
-
- public IRepositoryPerson getAuthor() {
- return author;
- }
-
- public String getComment() {
- return comment;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getFileName() {
- return fileName;
- }
-
- public Long getLength() {
- return length;
- }
-
- public String getUrl() {
- return url;
- }
-
- public Boolean isDeprecated() {
- return deprecated;
- }
-
- public Boolean isPatch() {
- return patch;
- }
-
- public void setAttachmentId(String attachmentId) {
- this.attachmentId = attachmentId;
- }
-
- public void setAuthor(IRepositoryPerson author) {
- this.author = author;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public void setDeprecated(Boolean deprecated) {
- this.deprecated = deprecated;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public void setLength(Long length) {
- this.length = length;
- }
-
- public void setPatch(Boolean patch) {
- this.patch = patch;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public static TaskAttachmentMapper createFrom(TaskAttribute taskAttribute) {
- Assert.isNotNull(taskAttribute);
- TaskAttributeMapper mapper = taskAttribute.getTaskData().getAttributeMapper();
- TaskAttachmentMapper attachment = new TaskAttachmentMapper();
- attachment.setAttachmentId(mapper.getValue(taskAttribute));
- TaskAttribute child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_AUTHOR);
- if (child != null) {
- attachment.setAuthor(mapper.getRepositoryPerson(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_CONTENT_TYPE);
- if (child != null) {
- attachment.setContentType(mapper.getValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_DATE);
- if (child != null) {
- attachment.setCreationDate(mapper.getDateValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_DESCRIPTION);
- if (child != null) {
- attachment.setDescription(mapper.getValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_FILENAME);
- if (child != null) {
- attachment.setFileName(mapper.getValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED);
- if (child != null) {
- attachment.setDeprecated(mapper.getBooleanValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_PATCH);
- if (child != null) {
- attachment.setPatch(mapper.getBooleanValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_SIZE);
- if (child != null) {
- Long value = mapper.getLongValue(child);
- if (value != null) {
- attachment.setLength(value);
- }
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_URL);
- if (child != null) {
- attachment.setUrl(mapper.getValue(child));
- }
- return attachment;
- }
-
- public void applyTo(TaskAttribute taskAttribute) {
- Assert.isNotNull(taskAttribute);
- TaskData taskData = taskAttribute.getTaskData();
- TaskAttributeMapper mapper = taskData.getAttributeMapper();
- taskAttribute.getMetaData().defaults().setType(TaskAttribute.TYPE_ATTACHMENT);
- if (getAttachmentId() != null) {
- mapper.setValue(taskAttribute, getAttachmentId());
- }
- if (getAuthor() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_AUTHOR);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_PERSON);
- mapper.setRepositoryPerson(child, getAuthor());
- }
- if (getContentType() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_CONTENT_TYPE);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_SHORT_TEXT);
- mapper.setValue(child, getContentType());
- }
- if (getCreationDate() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_DATE);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_DATE);
- mapper.setDateValue(child, getCreationDate());
- }
- if (getDescription() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_DESCRIPTION);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_SHORT_TEXT);
- mapper.setValue(child, getDescription());
- }
- if (getFileName() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_FILENAME);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_SHORT_TEXT);
- mapper.setValue(child, getFileName());
- }
- if (isDeprecated() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_BOOLEAN);
- mapper.setBooleanValue(child, isDeprecated());
- }
- if (isPatch() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_IS_PATCH);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_BOOLEAN);
- mapper.setBooleanValue(child, isPatch());
- }
- if (getLength() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_SIZE);
- mapper.setLongValue(child, getLength());
- }
- if (getUrl() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_URL);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_URL);
- mapper.setValue(child, getUrl());
- }
- }
-
- public void applyTo(ITaskAttachment taskAttachment) {
- Assert.isNotNull(taskAttachment);
- if (getAuthor() != null) {
- taskAttachment.setAuthor(getAuthor());
- }
- if (getContentType() != null) {
- taskAttachment.setContentType(getContentType());
- }
- if (getCreationDate() != null) {
- taskAttachment.setCreationDate(getCreationDate());
- }
- if (getDescription() != null) {
- taskAttachment.setDescription(getDescription());
- }
- if (getFileName() != null) {
- taskAttachment.setFileName(getFileName());
- }
- if (isDeprecated() != null) {
- taskAttachment.setDeprecated(isDeprecated());
- }
- if (isPatch() != null) {
- taskAttachment.setPatch(isPatch());
- }
- if (getLength() != null) {
- taskAttachment.setLength(getLength());
- }
- if (url != null) {
- taskAttachment.setUrl(getUrl());
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentModel.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentModel.java
deleted file mode 100644
index 884e81a53..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttachmentModel.java
+++ /dev/null
@@ -1,87 +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.tasks.core.data;
-
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskAttachmentModel {
-
- private boolean attachContext;
-
- private final TaskAttribute attribute;
-
- private String comment;
-
- private AbstractTaskAttachmentSource source;
-
- private final ITask task;
-
- private final TaskRepository taskRepository;
-
- private String contentType;
-
- public TaskAttachmentModel(TaskRepository taskRepository, ITask task, TaskAttribute attribute) {
- this.taskRepository = taskRepository;
- this.task = task;
- this.attribute = attribute;
- }
-
- public boolean getAttachContext() {
- return attachContext;
- }
-
- public TaskAttribute getAttribute() {
- return attribute;
- }
-
- public String getComment() {
- return comment;
- }
-
- public AbstractTaskAttachmentSource getSource() {
- return source;
- }
-
- public ITask getTask() {
- return task;
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public void setAttachContext(boolean attachContext) {
- this.attachContext = attachContext;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public void setSource(AbstractTaskAttachmentSource source) {
- this.source = source;
- }
-
- public String getContentType() {
- if (contentType == null) {
- return getSource().getContentType();
- }
- return contentType;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
deleted file mode 100644
index d177f8c34..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
+++ /dev/null
@@ -1,531 +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.tasks.core.data;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * Encapsulates attributes for task data.
- *
- * @author Rob Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-public final class TaskAttribute {
-
- /**
- * Boolean attribute. If true, repository user needs to be added to the cc list.
- */
- public static final String ADD_SELF_CC = "task.common.addselfcc";
-
- public static final String ATTACHMENT_AUTHOR = "task.common.attachment.author";
-
- public static final String ATTACHMENT_CONTENT_TYPE = "task.common.attachment.ctype";
-
- public static final String ATTACHMENT_DATE = "task.common.attachment.date";
-
- public static final String ATTACHMENT_DESCRIPTION = "task.common.attachment.description";
-
- public static final String ATTACHMENT_FILENAME = "filename";
-
- public static final String ATTACHMENT_ID = "task.common.attachment.id";
-
- public static final String ATTACHMENT_IS_DEPRECATED = "task.common.attachment.deprecated";
-
- public static final String ATTACHMENT_IS_PATCH = "task.common.attachment.patch";
-
- public static final String ATTACHMENT_SIZE = "task.common.attachment.size";
-
- public static final String ATTACHMENT_URL = "task.common.attachment.url";
-
- public static final String COMMENT_ATTACHMENT_ID = "task.common.comment.attachment.id";
-
- public static final String COMMENT_AUTHOR = "task.common.comment.author";
-
- @Deprecated
- public static final String COMMENT_AUTHOR_NAME = "task.common.comment.author.name";
-
- public static final String COMMENT_DATE = "task.common.comment.date";
-
- public static final String COMMENT_HAS_ATTACHMENT = "task.common.comment.attachment";
-
- public static final String COMMENT_NEW = "task.common.comment.new";
-
- /**
- * @since 3.0
- */
- public static final String COMMENT_NUMBER = "task.common.comment.number";
-
- public static final String COMMENT_TEXT = "task.common.comment.text";
-
- public static final String COMMENT_URL = "task.common.comment.url";
-
- /**
- * @since 3.0
- */
- public static final String COMPONENT = "task.common.component";
-
- /**
- * @since 3.0
- */
- public static final String DATE_COMPLETION = "task.common.date.completed";
-
- public static final String DATE_CREATION = "task.common.date.created";
-
- /**
- * @since 3.0
- */
- public static final String DATE_DUE = "task.common.date.due";
-
- public static final String DATE_MODIFICATION = "task.common.date.modified";
-
- public static final String DESCRIPTION = "task.common.description";
-
- public static final String KEYWORDS = "task.common.keywords";
-
- public static final String KIND_DEFAULT = "task.common.kind.default";
-
- public static final String KIND_OPERATION = "task.common.kind.operation";
-
- public static final String KIND_PEOPLE = "task.common.kind.default";
-
- //public static final String META_SHOW_IN_ATTRIBUTES_SECTION = "task.meta.showInTaskEditorAttributesSection";
-
- public static final String META_ASSOCIATED_ATTRIBUTE_ID = "task.meta.associated.attribute";
-
- public static final String META_ATTRIBUTE_KIND = "task.meta.attributeKind";
-
- public static final String META_ATTRIBUTE_TYPE = "task.meta.type";
-
- public static final String META_DEFAULT_OPTION = "task.meta.defaultOption";
-
-// public static final String META_DETAIL_LEVEL = "task.meta.detailLevel";
-
- public static final String META_LABEL = "task.meta.label";
-
- public static final String META_READ_ONLY = "task.meta.readOnly";
-
- public static final String NEW_ATTACHMENT = "task.common.new.attachment";
-
- // XXX merge with USER_CC
- //public static final String NEW_CC = "task.common.newcc";
-
- public static final String OPERATION = "task.common.operation";
-
- public static final String PERSON_NAME = "task.common.person.name";
-
- public static final String PREFIX_ATTACHMENT = "task.common.attachment-";
-
- public static final String PREFIX_COMMENT = "task.common.comment-";
-
- // XXX merge with USER_CC
- //public static final String REMOVE_CC = "task.common.removecc";
-
- public static final String PREFIX_OPERATION = "task.common.operation-";
-
- public static final String PRIORITY = "task.common.priority";
-
- public static final String PRODUCT = "task.common.product";
-
- public static final String RESOLUTION = "task.common.resolution";
-
- public static final String STATUS = "task.common.status";
-
- public static final String SUMMARY = "task.common.summary";
-
- public static final String TASK_KEY = "task.common.key";
-
- public static final String TASK_KIND = "task.common.kind";
-
- /**
- * @since 3.0
- */
- public static final String TASK_URL = "task.common.url";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_ATTACHMENT = "attachment";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_BOOLEAN = "boolean";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_COMMENT = "comment";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_CONTAINER = "container";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_DATE = "date";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_INTEGER = "integer";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_LONG_RICH_TEXT = "longRichText";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_LONG_TEXT = "longText";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_MULTI_SELECT = "multiSelect";
-
- public static final String TYPE_OPERATION = "operation";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_PERSON = "person";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_SHORT_RICH_TEXT = "shortRichText";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_SHORT_TEXT = "shortText";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_SINGLE_SELECT = "singleSelect";
-
- /**
- * @since 3.0
- */
- public static final String TYPE_TASK_DEPENDENCY = "taskDepenedency";
-
- public static final String TYPE_URL = "url";
-
- public static final String USER_ASSIGNED = "task.common.user.assigned";
-
- @Deprecated
- public static final String USER_ASSIGNED_NAME = "task.common.user.assigned.name";
-
- public static final String USER_CC = "task.common.user.cc";
-
- public static final String USER_REPORTER = "task.common.user.reporter";
-
- @Deprecated
- public static final String USER_REPORTER_NAME = "task.common.user.reporter.name";
-
- private Map<String, TaskAttribute> attributeById;
-
- private final String attributeId;
-
- private Map<String, String> metaData;
-
- private Map<String, String> optionByKey;
-
- private final TaskAttribute parentAttribute;
-
- private final TaskData taskData;
-
- /**
- * Attribute's values (selected or added)
- */
- private final List<String> values;
-
- public TaskAttribute(TaskAttribute parentAttribute, String attributeId) {
- Assert.isNotNull(parentAttribute);
- Assert.isNotNull(attributeId);
- this.parentAttribute = parentAttribute;
- this.attributeId = attributeId;
- this.taskData = parentAttribute.getTaskData();
- this.values = new ArrayList<String>(1);
- parentAttribute.add(this);
- }
-
- /**
- * Constructor for the root node.
- */
- TaskAttribute(TaskData taskData) {
- Assert.isNotNull(taskData);
- this.parentAttribute = null;
- this.taskData = taskData;
- this.attributeId = "root";
- this.values = new ArrayList<String>(1);
- }
-
- private void add(TaskAttribute attribute) {
- if (attributeById == null) {
- attributeById = new LinkedHashMap<String, TaskAttribute>();
- }
- attributeById.put(attribute.getId(), attribute);
- }
-
- public void addValue(String value) {
- Assert.isNotNull(value);
- values.add(value);
- }
-
- public void clearAttributes() {
- attributeById = null;
- }
-
- void clearMetaDataMap() {
- metaData = null;
- }
-
- public void clearOptions() {
- optionByKey = null;
- }
-
- public void clearValues() {
- values.clear();
- }
-
- public TaskAttribute createAttribute(String attributeId) {
- return new TaskAttribute(this, attributeId);
- }
-
- public void deepAddCopy(TaskAttribute source) {
- TaskAttribute target = createAttribute(source.getId());
- target.values.addAll(source.values);
- if (source.metaData != null) {
- target.metaData = new LinkedHashMap<String, String>(source.metaData);
- }
- if (source.optionByKey != null) {
- target.optionByKey = new LinkedHashMap<String, String>(source.optionByKey);
- }
- if (source.attributeById != null) {
- for (TaskAttribute child : source.attributeById.values()) {
- target.deepAddCopy(child);
- }
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TaskAttribute other = (TaskAttribute) obj;
- if (attributeId == null) {
- if (other.attributeId != null) {
- return false;
- }
- } else if (!attributeId.equals(other.attributeId)) {
- return false;
- }
- return true;
- }
-
- public TaskAttribute getAttribute(String attributeId) {
- Assert.isNotNull(attributeId);
- return (attributeById != null) ? attributeById.get(attributeId) : null;
- }
-
- public Map<String, TaskAttribute> getAttributes() {
- if (attributeById != null) {
- return Collections.unmodifiableMap(attributeById);
- } else {
- return Collections.emptyMap();
- }
- }
-
- public String getId() {
- return attributeId;
- }
-
- public TaskAttribute getMappedAttribute(String attributeId) {
- Assert.isNotNull(attributeId);
- return (attributeById != null) ? attributeById.get(getTaskData().getAttributeMapper().mapToRepositoryKey(this,
- attributeId)) : null;
- }
-
- public TaskAttribute getMappedAttribute(String[] path) {
- TaskAttribute attribute = this;
- for (String id : path) {
- attribute = attribute.getMappedAttribute(id);
- if (attribute == null) {
- break;
- }
- }
- return attribute;
- }
-
- String getMetaDatum(String key) {
- return (metaData != null) ? metaData.get(key) : null;
- }
-
- Map<String, String> getMetaDataMap() {
- if (metaData != null) {
- return Collections.unmodifiableMap(metaData);
- } else {
- return Collections.emptyMap();
- }
- }
-
- public String getOption(String key) {
- return (optionByKey != null) ? optionByKey.get(key) : null;
- }
-
- public Map<String, String> getOptions() {
- if (optionByKey != null) {
- return Collections.unmodifiableMap(optionByKey);
- } else {
- return Collections.emptyMap();
- }
- }
-
- public TaskAttribute getParentAttribute() {
- return parentAttribute;
- }
-
- public String[] getPath() {
- List<String> path = new ArrayList<String>();
- TaskAttribute attribute = this;
- while (attribute.getParentAttribute() != null) {
- path.add(attribute.getId());
- attribute = attribute.getParentAttribute();
- }
- Collections.reverse(path);
- return path.toArray(new String[0]);
- }
-
- public TaskAttributeMetaData getMetaData() {
- return new TaskAttributeMetaData(this);
- }
-
- public TaskData getTaskData() {
- return taskData;
- }
-
- public String getValue() {
- if (values.size() > 0) {
- return values.get(0);
- } else {
- return "";
- }
- }
-
- public List<String> getValues() {
- return Collections.unmodifiableList(values);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((attributeId == null) ? 0 : attributeId.hashCode());
- return result;
- }
-
- void putMetaDatum(String key, String value) {
- Assert.isNotNull(key);
- Assert.isNotNull(value);
- if (metaData == null) {
- metaData = new LinkedHashMap<String, String>();
- }
- metaData.put(key, value);
- }
-
- /**
- * Adds an attribute option value
- *
- * @param readableValue
- * The value displayed on the screen
- * @param parameterValue
- * The option value used when sending the form to the server
- */
- public void putOption(String key, String value) {
- Assert.isNotNull(key);
- Assert.isNotNull(value);
- if (optionByKey == null) {
- optionByKey = new LinkedHashMap<String, String>();
- }
- optionByKey.put(key, value);
- }
-
- public void removeAttribute(String attributeId) {
- if (attributeById != null) {
- attributeById.remove(attributeId);
- }
- }
-
- void removeMetaDatum(String metaDataId) {
- if (metaData != null) {
- metaData.remove(metaDataId);
- }
- }
-
- public void removeValue(String value) {
- values.remove(value);
- }
-
- public void setValue(String value) {
- Assert.isNotNull(value);
- if (values.size() > 0) {
- values.clear();
- }
- values.add(value);
- }
-
- public void setValues(List<String> values) {
- this.values.clear();
- this.values.addAll(values);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- toString(sb, "");
- return sb.toString();
- }
-
- private void toString(StringBuilder sb, String prefix) {
- sb.append(prefix);
- sb.append("TaskAttribute[id=" + attributeId + ",values=" + values + ",options=" + optionByKey + ",metaData="
- + metaData + "]\n");
- if (attributeById != null) {
- for (TaskAttribute child : attributeById.values()) {
- child.toString(sb, prefix + " ");
- }
- }
- }
-
- public TaskAttribute createMappedAttribute(String attributeId) {
- Assert.isNotNull(attributeId);
- String mappedAttributeId = getTaskData().getAttributeMapper().mapToRepositoryKey(this, attributeId);
- Assert.isNotNull(mappedAttributeId);
- return new TaskAttribute(this, mappedAttributeId);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java
deleted file mode 100644
index 2605f6228..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java
+++ /dev/null
@@ -1,270 +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.tasks.core.data;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskAttributeMapper {
-
- private final TaskRepository taskRepository;
-
- public TaskAttributeMapper(TaskRepository taskRepository) {
- Assert.isNotNull(taskRepository);
- this.taskRepository = taskRepository;
- }
-
- public TaskAttribute createTaskAttachment(TaskData taskData) {
- TaskAttribute taskAttribute = taskData.getRoot().createAttribute(
- mapToRepositoryKey(taskData.getRoot(), TaskAttribute.NEW_ATTACHMENT));
- TaskAttachmentMapper.createFrom(taskAttribute);
- return taskAttribute;
- }
-
- public boolean equals(TaskAttribute newAttribute, TaskAttribute oldAttribute) {
- return newAttribute.getValues().equals(oldAttribute.getValues());
- }
-
- public TaskAttribute getAssoctiatedAttribute(TaskAttribute taskAttribute) {
- String id = taskAttribute.getMetaDatum(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
- if (id != null) {
- // look up as nested attribute first
- TaskAttribute associatedAttribute = taskAttribute.getAttribute(id);
- if (associatedAttribute != null) {
- return associatedAttribute;
- }
- // fall back to root
- return taskAttribute.getTaskData().getRoot().getAttribute(id);
- }
- return null;
- }
-
- public TaskAttribute getAssoctiatedAttribute(TaskOperation taskOperation) {
- TaskAttribute taskAttribute = taskOperation.getTaskAttribute();
- if (taskAttribute != null) {
- return getAssoctiatedAttribute(taskAttribute);
- }
- return null;
- }
-
- public List<TaskAttribute> getAttributesByType(TaskData taskData, String type) {
- Assert.isNotNull(taskData);
- Assert.isNotNull(type);
- List<TaskAttribute> result = new ArrayList<TaskAttribute>();
- for (TaskAttribute taskAttribute : taskData.getRoot().getAttributes().values()) {
- if (type.equals(taskAttribute.getMetaData().getType())) {
- result.add(taskAttribute);
- }
- }
- return result;
- }
-
- public boolean getBooleanValue(TaskAttribute attribute) {
- String booleanString = attribute.getValue();
- if (booleanString != null && booleanString.length() > 0) {
- return Boolean.parseBoolean(booleanString);
- }
- return false;
- }
-
- public Date getDateValue(TaskAttribute attribute) {
- String dateString = attribute.getValue();
- try {
- if (dateString != null && dateString.length() > 0) {
- return new Date(Long.parseLong(dateString));
- }
- } catch (NumberFormatException e) {
- // ignore
- }
- return null;
- }
-
- public String getDefaultOption(TaskAttribute taskAttribute) {
- return taskAttribute.getMetaData().getDefaultOption();
- }
-
- public Integer getIntegerValue(TaskAttribute attribute) {
- String integerString = attribute.getValue();
- try {
- if (integerString != null) {
- return Integer.parseInt(integerString);
- }
- } catch (NumberFormatException e) {
- // ignore
- }
- return null;
- }
-
- public String getLabel(TaskAttribute taskAttribute) {
- return taskAttribute.getMetaData().getLabel();
- }
-
- public Long getLongValue(TaskAttribute attribute) {
- String longString = attribute.getValue();
- try {
- if (longString != null) {
- return Long.parseLong(longString);
- }
- } catch (NumberFormatException e) {
- // ignore
- }
- return null;
- }
-
- /**
- * Returns labelByValue.
- */
- public Map<String, String> getOptions(TaskAttribute attribute) {
- return attribute.getOptions();
- }
-
- public IRepositoryPerson getRepositoryPerson(TaskAttribute taskAttribute) {
- IRepositoryPerson person = taskRepository.createPerson(taskAttribute.getValue());
- TaskAttribute child = taskAttribute.getMappedAttribute(TaskAttribute.PERSON_NAME);
- if (child != null) {
- person.setName(getValue(child));
- }
- return person;
- }
-
- public List<TaskOperation> getTaskOperations(TaskAttribute operationsAttribute) {
- Assert.isNotNull(operationsAttribute);
- TaskData taskData = operationsAttribute.getTaskData();
- List<TaskOperation> result = new ArrayList<TaskOperation>();
- for (TaskAttribute taskAttribute : taskData.getRoot().getAttributes().values()) {
- if (TaskAttribute.TYPE_OPERATION.equals(taskAttribute.getMetaData().getType())
- && !taskAttribute.getId().equals(mapToRepositoryKey(taskData.getRoot(), TaskAttribute.OPERATION))) {
- result.add(TaskOperation.createFrom(taskAttribute));
- }
- }
- return result;
- }
-
- public TaskOperation getTaskOperation(TaskAttribute taskAttribute) {
- Assert.isNotNull(taskAttribute);
- return TaskOperation.createFrom(taskAttribute);
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public String getValue(TaskAttribute taskAttribute) {
- return taskAttribute.getValue();
- }
-
- public String getValueLabel(TaskAttribute taskAttribute) {
- StringBuilder sb = new StringBuilder();
- String sep = "";
- for (String value : taskAttribute.getValues()) {
- String option = taskAttribute.getOption(value);
- if (option != null) {
- value = option;
- }
- sb.append(sep).append(value);
- sep = ", ";
- }
- return sb.toString();
- }
-
- public List<String> getValueLabels(TaskAttribute taskAttribute) {
- List<String> values = taskAttribute.getValues();
- List<String> result = new ArrayList<String>(values.size());
- for (String value : values) {
- String option = taskAttribute.getOption(value);
- if (option != null) {
- value = option;
- }
- result.add(value);
- }
- return result;
- }
-
- public List<String> getValues(TaskAttribute attribute) {
- return new ArrayList<String>(attribute.getValues());
- }
-
- public boolean hasValue(TaskAttribute attribute) {
- return attribute.getValues().size() > 0;
- }
-
- public String mapToRepositoryKey(TaskAttribute parent, String key) {
- return key;
- }
-
- public void setBooleanValue(TaskAttribute attribute, Boolean value) {
- attribute.setValue(Boolean.toString(value));
- }
-
- public void setDateValue(TaskAttribute attribute, Date date) {
- if (date != null) {
- attribute.setValue(Long.toString(date.getTime()));
- } else {
- attribute.clearValues();
- }
- }
-
- public void setIntegerValue(TaskAttribute attribute, Integer value) {
- if (value != null) {
- attribute.setValue(value.toString());
- } else {
- attribute.clearValues();
- }
- }
-
- public void setLongValue(TaskAttribute attribute, Long value) {
- if (value != null) {
- attribute.setValue(value.toString());
- } else {
- attribute.clearValues();
- }
- }
-
- public void setRepositoryPerson(TaskAttribute taskAttribute, IRepositoryPerson person) {
- setValue(taskAttribute, person.getPersonId());
- if (person.getName() != null) {
- TaskAttribute child = taskAttribute.createAttribute(TaskAttribute.PERSON_NAME);
- setValue(child, person.getName());
- }
- }
-
- public void setTaskOperation(TaskAttribute taskAttribute, TaskOperation taskOperation) {
- Assert.isNotNull(taskAttribute);
- Assert.isNotNull(taskOperation);
- TaskOperation.applyTo(taskAttribute, taskOperation.getOperationId(), taskOperation.getLabel());
- }
-
- public void setValue(TaskAttribute attribute, String value) {
- attribute.setValue(value);
- }
-
- public void setValues(TaskAttribute attribute, List<String> values) {
- attribute.setValues(values);
- }
-
- public void updateTaskAttachment(ITaskAttachment taskAttachment, TaskAttribute taskAttribute) {
- TaskAttachmentMapper.createFrom(taskAttribute).applyTo(taskAttachment);
- }
-
- public void updateTaskComment(ITaskComment taskComment, TaskAttribute taskAttribute) {
- TaskCommentMapper.createFrom(taskAttribute).applyTo(taskComment);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java
deleted file mode 100644
index 77f67b6cf..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java
+++ /dev/null
@@ -1,138 +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.tasks.core.data;
-
-import java.util.Map;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskAttributeMetaData {
-
-// public enum DetailLevel {
-// /** A little bit of detail, e.g. a task showing in the Task List. */
-// LOW,
-// /** More detail, e.g. a task showing in a tool tip. */
-// MEDIUM,
-// /** A lot of detail, e.g. a task showing in an editor. */
-// //HIGH
-// };
-
- private final TaskAttribute taskAttribute;
-
- TaskAttributeMetaData(TaskAttribute taskAttribute) {
- this.taskAttribute = taskAttribute;
- }
-
- public TaskAttributeMetaData defaults() {
- setLabel(null);
- setKind(null);
- setReadOnly(true);
- setType(TaskAttribute.TYPE_SHORT_TEXT);
- return this;
- }
-
- public TaskAttributeMetaData clear() {
- taskAttribute.clearMetaDataMap();
- return this;
- }
-
- public String getDefaultOption() {
- return taskAttribute.getMetaDatum(TaskAttribute.META_DEFAULT_OPTION);
- }
-
-// public DetailLevel getDetailLevel() {
-// try {
-// return DetailLevel.valueOf(taskAttribute.getMetaDatum(TaskAttribute.META_DEFAULT_OPTION));
-// } catch (IllegalArgumentException e) {
-// return null;
-// }
-// }
-
- public String getKind() {
- return taskAttribute.getMetaDatum(TaskAttribute.META_ATTRIBUTE_KIND);
- }
-
- public String getLabel() {
- return taskAttribute.getMetaDatum(TaskAttribute.META_LABEL);
- }
-
- public String getType() {
- return taskAttribute.getMetaDatum(TaskAttribute.META_ATTRIBUTE_TYPE);
- }
-
- public String getValue(String key) {
- return taskAttribute.getMetaDatum(key);
- }
-
- public Map<String, String> getValues() {
- return taskAttribute.getMetaDataMap();
- }
-
- public boolean isReadOnly() {
- return Boolean.parseBoolean(taskAttribute.getMetaDatum(TaskAttribute.META_READ_ONLY));
- }
-
- public TaskAttributeMetaData putValue(String key, String value) {
- taskAttribute.putMetaDatum(key, value);
- return this;
- }
-
- public TaskAttributeMetaData setDefaultOption(String defaultOption) {
- if (defaultOption != null) {
- taskAttribute.putMetaDatum(TaskAttribute.META_DEFAULT_OPTION, defaultOption);
- } else {
- taskAttribute.removeMetaDatum(TaskAttribute.META_DEFAULT_OPTION);
- }
- return this;
- }
-
-// public TaskAttributeMetaData setDetailLevel(DetailLevel detailLevel) {
-// if (detailLevel != null) {
-// taskAttribute.putMetaDatum(TaskAttribute.META_DETAIL_LEVEL, detailLevel.name());
-// } else {
-// taskAttribute.removeMetaDatum(TaskAttribute.META_DETAIL_LEVEL);
-// }
-// return this;
-// }
-
- public TaskAttributeMetaData setKind(String value) {
- if (value != null) {
- taskAttribute.putMetaDatum(TaskAttribute.META_ATTRIBUTE_KIND, value);
- } else {
- taskAttribute.removeMetaDatum(TaskAttribute.META_ATTRIBUTE_KIND);
- }
- return this;
- }
-
- public TaskAttributeMetaData setLabel(String value) {
- if (value != null) {
- taskAttribute.putMetaDatum(TaskAttribute.META_LABEL, value);
- } else {
- taskAttribute.removeMetaDatum(TaskAttribute.META_LABEL);
- }
- return this;
- }
-
- public TaskAttributeMetaData setReadOnly(boolean value) {
- taskAttribute.putMetaDatum(TaskAttribute.META_READ_ONLY, Boolean.toString(value));
- return this;
- }
-
- public TaskAttributeMetaData setType(String value) {
- if (value != null) {
- taskAttribute.putMetaDatum(TaskAttribute.META_ATTRIBUTE_TYPE, value);
- } else {
- taskAttribute.removeMetaDatum(TaskAttribute.META_ATTRIBUTE_TYPE);
- }
- return this;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java
deleted file mode 100644
index 4c8d8ef15..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskCommentMapper.java
+++ /dev/null
@@ -1,180 +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.tasks.core.data;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-
-/**
- * A comment posted by a user on a task.
- *
- * @author Rob Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskCommentMapper {
-
- private IRepositoryPerson author;
-
- private String commentId;
-
- private Date creationDate;
-
- private Integer number;
-
- private String text;
-
- private String url;
-
- public TaskCommentMapper() {
- }
-
- public IRepositoryPerson getAuthor() {
- return author;
- }
-
- public String getCommentId() {
- return commentId;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public Integer getNumber() {
- return number;
- }
-
- public String getText() {
- return text;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setAuthor(IRepositoryPerson author) {
- this.author = author;
- }
-
- public void setCommentId(String commentId) {
- this.commentId = commentId;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public void setNumber(Integer number) {
- this.number = number;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- @SuppressWarnings("deprecation")
- public static TaskCommentMapper createFrom(TaskAttribute taskAttribute) {
- Assert.isNotNull(taskAttribute);
- TaskData taskData = taskAttribute.getTaskData();
- TaskAttributeMapper mapper = taskData.getAttributeMapper();
- TaskCommentMapper comment = new TaskCommentMapper();
- comment.setCommentId(mapper.getValue(taskAttribute));
- TaskAttribute child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_AUTHOR);
- if (child != null) {
- IRepositoryPerson person = mapper.getRepositoryPerson(child);
- if (person.getName() == null) {
- child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_AUTHOR_NAME);
- if (child != null) {
- person.setName(child.getValue());
- }
- }
- comment.setAuthor(person);
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_DATE);
- if (child != null) {
- comment.setCreationDate(mapper.getDateValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_NUMBER);
- if (child != null) {
- comment.setNumber(mapper.getIntegerValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_URL);
- if (child != null) {
- comment.setUrl(mapper.getValue(child));
- }
- child = taskAttribute.getMappedAttribute(TaskAttribute.COMMENT_TEXT);
- if (child != null) {
- comment.setText(mapper.getValue(child));
- }
- return comment;
- }
-
- public void applyTo(TaskAttribute taskAttribute) {
- Assert.isNotNull(taskAttribute);
- TaskData taskData = taskAttribute.getTaskData();
- TaskAttributeMapper mapper = taskData.getAttributeMapper();
- taskAttribute.getMetaData().defaults().setType(TaskAttribute.TYPE_COMMENT);
- if (getCommentId() != null) {
- mapper.setValue(taskAttribute, getCommentId());
- }
- if (getAuthor() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.COMMENT_AUTHOR);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_PERSON);
- mapper.setRepositoryPerson(child, getAuthor());
- }
- if (getCreationDate() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.COMMENT_DATE);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_DATE);
- mapper.setDateValue(child, getCreationDate());
- }
- if (getNumber() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.COMMENT_NUMBER);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_INTEGER);
- mapper.setIntegerValue(child, getNumber());
- }
- if (getUrl() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.COMMENT_URL);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_URL);
- mapper.setValue(child, getUrl());
- }
- if (getText() != null) {
- TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.COMMENT_TEXT);
- child.getMetaData().defaults().setType(TaskAttribute.TYPE_LONG_RICH_TEXT);
- mapper.setValue(child, getText());
- taskAttribute.putMetaDatum(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, child.getId());
- }
- }
-
- public void applyTo(ITaskComment taskComment) {
- Assert.isNotNull(taskComment);
- if (getAuthor() != null) {
- taskComment.setAuthor(getAuthor());
- }
- if (getCreationDate() != null) {
- taskComment.setCreationDate(getCreationDate());
- }
- if (getNumber() != null) {
- taskComment.setNumber(getNumber());
- }
- if (getUrl() != null) {
- taskComment.setUrl(getUrl());
- }
- if (getText() != null) {
- taskComment.setText(getText());
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskData.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskData.java
deleted file mode 100644
index e1e8b88ab..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskData.java
+++ /dev/null
@@ -1,88 +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.tasks.core.data;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public final class TaskData {
-
- private final String connectorKind;
-
- private boolean partial;
-
- private String version;
-
- private final String repositoryUrl;
-
- private final String taskId;
-
- private final TaskAttributeMapper mapper;
-
- private final TaskAttribute root;
-
- public TaskData(TaskAttributeMapper mapper, String connectorKind, String repositoryUrl, String taskId) {
- Assert.isNotNull(mapper);
- Assert.isNotNull(connectorKind);
- Assert.isNotNull(repositoryUrl);
- Assert.isNotNull(taskId);
- this.mapper = mapper;
- this.connectorKind = connectorKind;
- this.repositoryUrl = repositoryUrl;
- this.taskId = taskId;
- this.root = new TaskAttribute(this);
- }
-
- public TaskAttribute getRoot() {
- return root;
- }
-
- public String getConnectorKind() {
- return connectorKind;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Returns true if this is a new, unsubmitted task; false otherwise.
- */
- public boolean isNew() {
- return getTaskId().length() == 0;
- }
-
- public boolean isPartial() {
- return partial;
- }
-
- public void setPartial(boolean complete) {
- this.partial = complete;
- }
-
- public TaskAttributeMapper getAttributeMapper() {
- return mapper;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataCollector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataCollector.java
deleted file mode 100644
index 25cb76e9b..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataCollector.java
+++ /dev/null
@@ -1,26 +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.tasks.core.data;
-
-/**
- * This class is used for collecting tasks, e.g. when performing queries on a repository.
- *
- * @author Rob Elves
- * @since 3.0
- */
-public abstract class TaskDataCollector {
-
- /**
- * @since 3.0
- */
- public static final int MAX_HITS = 5000;
-
- public abstract void accept(TaskData taskData);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java
deleted file mode 100644
index af33ead29..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java
+++ /dev/null
@@ -1,162 +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.tasks.core.data;
-
-import java.util.ArrayList;
-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.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent.EventKind;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskDataModel {
-
- private List<TaskDataModelListener> listeners;
-
- private final ITask task;
-
- private final TaskRepository taskRepository;
-
- private final Set<TaskAttribute> unsavedChanedAttributes;
-
- private final ITaskDataWorkingCopy workingCopy;
-
- public TaskDataModel(TaskRepository taskRepository, ITask task, ITaskDataWorkingCopy taskDataState) {
- Assert.isNotNull(taskRepository);
- Assert.isNotNull(task);
- Assert.isNotNull(taskDataState);
- this.task = task;
- this.taskRepository = taskRepository;
- this.workingCopy = taskDataState;
- this.unsavedChanedAttributes = new HashSet<TaskAttribute>();
- }
-
- public void addModelListener(TaskDataModelListener listener) {
- if (listeners == null) {
- listeners = new ArrayList<TaskDataModelListener>();
- }
- listeners.add(listener);
- }
-
- /**
- * Invoke upon change to attribute value.
- *
- * @param attribute
- * changed attribute
- */
- public void attributeChanged(TaskAttribute attribute) {
- if (attribute.getParentAttribute() != getTaskData().getRoot()) {
- throw new RuntimeException(
- "Editing is only supported for attributes that are attached to the root of task data");
- }
-
- unsavedChanedAttributes.add(attribute);
-
- if (this.listeners != null) {
- final TaskDataModelEvent event = new TaskDataModelEvent(this, EventKind.CHANGED, attribute);
- TaskDataModelListener[] listeners = this.listeners.toArray(new TaskDataModelListener[0]);
- for (final TaskDataModelListener listener : listeners) {
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Listener failed", e));
- }
-
- public void run() throws Exception {
- listener.attributeChanged(event);
- }
- });
- }
- }
- }
-
- public Set<TaskAttribute> getChangedAttributes() {
- return new HashSet<TaskAttribute>(workingCopy.getEditsData().getRoot().getAttributes().values());
- }
-
- public Set<TaskAttribute> getChangedOldAttributes() {
- // FIXME implement
- return null;
- }
-
- public ITask getTask() {
- return task;
- }
-
- public TaskData getTaskData() {
- return workingCopy.getLocalData();
- }
-
- public TaskRepository getTaskRepository() {
- return taskRepository;
- }
-
- public boolean hasBeenRead() {
- return workingCopy.getLastReadData() != null;
- }
-
- public boolean hasIncomingChanges(TaskAttribute taskAttribute) {
- TaskData lastReadData = workingCopy.getLastReadData();
- if (lastReadData == null) {
- return true;
- }
-
- if (hasOutgoingChanges(taskAttribute)) {
- return false;
- }
-
- TaskAttribute oldAttribute = lastReadData.getRoot().getMappedAttribute(taskAttribute.getPath());
- if (oldAttribute == null) {
- return true;
- }
-
- return !getTaskData().getAttributeMapper().equals(taskAttribute, oldAttribute);
- }
-
- public boolean hasOutgoingChanges(TaskAttribute taskAttribute) {
- return workingCopy.getEditsData().getRoot().getMappedAttribute(taskAttribute.getPath()) != null;
- }
-
- public boolean isDirty() {
- return unsavedChanedAttributes.size() > 0 || !workingCopy.isSaved();
- }
-
- public void refresh(IProgressMonitor monitor) throws CoreException {
- workingCopy.refresh(monitor);
- }
-
- public void removeModelListener(TaskDataModelListener listener) {
- listeners.remove(listener);
- }
-
- public void revert() {
- workingCopy.revert();
- unsavedChanedAttributes.clear();
- }
-
- public void save(IProgressMonitor monitor) throws CoreException {
- workingCopy.save(unsavedChanedAttributes, monitor);
- unsavedChanedAttributes.clear();
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelEvent.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelEvent.java
deleted file mode 100644
index 231141502..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelEvent.java
+++ /dev/null
@@ -1,45 +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.tasks.core.data;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public final class TaskDataModelEvent {
-
- public enum EventKind {
- CHANGED
- }
-
- private final EventKind kind;
-
- private final TaskDataModel model;
-
- private final TaskAttribute taskAttribute;;
-
- public TaskDataModelEvent(TaskDataModel model, EventKind kind, TaskAttribute taskAttribute) {
- this.model = model;
- this.kind = kind;
- this.taskAttribute = taskAttribute;
- }
-
- public EventKind getKind() {
- return kind;
- }
-
- public TaskDataModel getModel() {
- return model;
- }
-
- public TaskAttribute getTaskAttribute() {
- return taskAttribute;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java
deleted file mode 100644
index 72d47d42c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java
+++ /dev/null
@@ -1,19 +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.tasks.core.data;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class TaskDataModelListener {
-
- public abstract void attributeChanged(TaskDataModelEvent event);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java
deleted file mode 100644
index f3501085c..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java
+++ /dev/null
@@ -1,402 +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.tasks.core.data;
-
-import java.util.Date;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskMapper implements ITaskMapping {
-
- private final boolean createNonExistingAttributes;
-
- private final TaskData taskData;
-
- public TaskMapper(TaskData taskData) {
- this(taskData, false);
- }
-
- public TaskMapper(TaskData taskData, boolean createNonExistingAttributes) {
- this.createNonExistingAttributes = createNonExistingAttributes;
- Assert.isNotNull(taskData);
- this.taskData = taskData;
- }
-
- public boolean applyTo(ITask task) {
- boolean changed = false;
- if (hasChanges(task.getCompletionDate(), TaskAttribute.DATE_COMPLETION)) {
- task.setCompletionDate(getCompletionDate());
- changed = true;
- }
- if (hasChanges(task.getCreationDate(), TaskAttribute.DATE_CREATION)) {
- task.setCreationDate(getCreationDate());
- changed = true;
- }
- if (hasChanges(task.getModificationDate(), TaskAttribute.DATE_MODIFICATION)) {
- task.setModificationDate(getModificationDate());
- changed = true;
- }
- if (hasChanges(task.getDueDate(), TaskAttribute.DATE_DUE)) {
- task.setDueDate(getDueDate());
- changed = true;
- }
- if (hasChanges(task.getOwner(), TaskAttribute.USER_ASSIGNED)) {
- task.setOwner(getOwner());
- changed = true;
- }
- if (hasChanges(task.getPriority(), TaskAttribute.PRIORITY)) {
- if (getPriority() != null) {
- task.setPriority(getPriority().toString());
- } else {
- task.setPriority(PriorityLevel.getDefault().toString());
- }
- changed = true;
- }
- if (hasChanges(task.getSummary(), TaskAttribute.SUMMARY)) {
- task.setSummary(getSummary());
- changed = true;
- }
- if (hasChanges(task.getTaskKey(), TaskAttribute.TASK_KEY)) {
- task.setTaskKey(getTaskKey());
- changed = true;
- }
- if (hasChanges(task.getTaskKind(), TaskAttribute.TASK_KIND)) {
- task.setTaskKind(getTaskKind());
- changed = true;
- }
- if (hasChanges(task.getUrl(), TaskAttribute.TASK_URL)) {
- task.setUrl(getTaskUrl());
- changed = true;
- }
- return changed;
- }
-
- private boolean areEquals(Object existingProperty, Object newProperty) {
- return (existingProperty != null) ? !existingProperty.equals(newProperty) : newProperty != null;
- }
-
- private void copyAttributeValue(TaskAttribute sourceAttribute, TaskAttribute targetAttribute) {
- if (targetAttribute == null) {
- return;
- }
- if (!sourceAttribute.getMetaData().isReadOnly() && !targetAttribute.getMetaData().isReadOnly()) {
- targetAttribute.clearValues();
- if (targetAttribute.getOptions().size() > 0) {
- List<String> values = sourceAttribute.getValues();
- for (String value : values) {
- if (targetAttribute.getOptions().containsValue(value)) {
- targetAttribute.addValue(value);
- }
- }
- } else {
- List<String> values = sourceAttribute.getValues();
- for (String value : values) {
- targetAttribute.addValue(value);
- }
- }
- }
- }
-
- /**
- * TODO update comment
- *
- * Sets attribute values from <code>sourceTaskData</code> on <code>targetTaskData</code>. Sets the following
- * attributes:
- * <ul>
- * <li>summary
- * <li>description
- * </ul>
- * Other attribute values are only set if they exist on <code>sourceTaskData</code> and <code>targetTaskData</code>.
- *
- * @param sourceTaskData
- * the source task data values are copied from, the connector kind of repository of
- * <code>sourceTaskData</code> can be different from <code>targetTaskData</code>
- * @param targetTaskData
- * the target task data values are copied to, the connector kind matches the one of this task data
- * handler
- * @since 2.2
- */
- public void copyFrom(ITaskMapping source) {
- if (source.getTaskData() != null && this.getTaskData() != null
- && source.getTaskData().equals(this.getTaskData().getConnectorKind())) {
- // task data objects are from the same connector, copy all attributes
- for (TaskAttribute sourceAttribute : source.getTaskData().getRoot().getAttributes().values()) {
- copyAttributeValue(sourceAttribute, this.getTaskData().getRoot().getAttribute(sourceAttribute.getId()));
- }
- } else {
- if (source.getCc() != null) {
- setCc(source.getCc());
- }
- if (source.getDescription() != null) {
- setDescription(source.getDescription());
- }
- if (source.getComponent() != null) {
- setComponent(source.getComponent());
- }
- if (source.getKeywords() != null) {
- setKeywords(source.getKeywords());
- }
- if (source.getOwner() != null) {
- setOwner(source.getOwner());
- }
- if (source.getPriority() != null) {
- setPriority(source.getPriority());
- }
- if (source.getProduct() != null) {
- setProduct(source.getProduct());
- }
- if (source.getSummary() != null) {
- setSummary(source.getSummary());
- }
-
- }
- }
-
- private TaskAttribute createAttribute(String attributeKey) {
- attributeKey = taskData.getAttributeMapper().mapToRepositoryKey(taskData.getRoot(), attributeKey);
- TaskAttribute attribute = taskData.getRoot().createAttribute(attributeKey);
- return attribute;
- }
-
- public List<String> getCc() {
- return getValues(TaskAttribute.USER_CC);
- }
-
- public Date getCompletionDate() {
- return getDateValue(TaskAttribute.DATE_COMPLETION);
- }
-
- public String getComponent() {
- return getValue(TaskAttribute.COMPONENT);
- }
-
- public Date getCreationDate() {
- return getDateValue(TaskAttribute.DATE_CREATION);
- }
-
- private Date getDateValue(String attributeKey) {
- TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
- if (attribute != null) {
- return taskData.getAttributeMapper().getDateValue(attribute);
- }
- return null;
- }
-
- public String getDescription() {
- return getValue(TaskAttribute.DESCRIPTION);
- }
-
- public Date getDueDate() {
- return getDateValue(TaskAttribute.DATE_DUE);
- }
-
- public List<String> getKeywords() {
- return getValues(TaskAttribute.KEYWORDS);
- }
-
- private TaskAttribute getMappedAttribute(String attributeKey) {
- TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
- if (createNonExistingAttributes && attribute == null) {
- attribute = createAttribute(attributeKey);
- }
- return attribute;
- }
-
- public Date getModificationDate() {
- return getDateValue(TaskAttribute.DATE_MODIFICATION);
- }
-
- public String getOwner() {
- return getValue(TaskAttribute.USER_ASSIGNED);
- }
-
- public PriorityLevel getPriority() {
- String value = getValue(TaskAttribute.PRIORITY);
- return (value != null) ? PriorityLevel.fromString(value) : null;
- }
-
- public String getProduct() {
- return getValue(TaskAttribute.PRODUCT);
- }
-
- public String getReporter() {
- return getValue(TaskAttribute.USER_REPORTER);
- }
-
- public String getResolution() {
- return getValue(TaskAttribute.RESOLUTION);
- }
-
- public String getSummary() {
- return getValue(TaskAttribute.SUMMARY);
- }
-
- public TaskData getTaskData() {
- return taskData;
- }
-
- public String getTaskKey() {
- return getValue(TaskAttribute.TASK_KEY);
- }
-
- public String getTaskKind() {
- return getValue(TaskAttribute.TASK_KIND);
- }
-
- public String getTaskStatus() {
- return getValue(TaskAttribute.STATUS);
- }
-
- public String getTaskUrl() {
- return getValue(TaskAttribute.TASK_URL);
- }
-
- private String getValue(String attributeKey) {
- TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
- if (attribute != null) {
- return taskData.getAttributeMapper().getValueLabel(attribute);
- }
- return null;
- }
-
- private List<String> getValues(String attributeKey) {
- TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
- if (attribute != null) {
- return taskData.getAttributeMapper().getValueLabels(attribute);
- }
- return null;
- }
-
- public boolean hasChanges(ITask task) {
- boolean changed = false;
- changed |= hasChanges(task.getCompletionDate(), TaskAttribute.DATE_COMPLETION);
- changed |= hasChanges(task.getCreationDate(), TaskAttribute.DATE_CREATION);
- changed |= hasChanges(task.getModificationDate(), TaskAttribute.DATE_MODIFICATION);
- changed |= hasChanges(task.getDueDate(), TaskAttribute.DATE_DUE);
- changed |= hasChanges(task.getOwner(), TaskAttribute.USER_ASSIGNED);
- changed |= hasChanges(task.getPriority(), TaskAttribute.PRIORITY);
- changed |= hasChanges(task.getSummary(), TaskAttribute.SUMMARY);
- changed |= hasChanges(task.getTaskKey(), TaskAttribute.TASK_KEY);
- changed |= hasChanges(task.getTaskKind(), TaskAttribute.TASK_KIND);
- changed |= hasChanges(task.getUrl(), TaskAttribute.TASK_URL);
- return changed;
- }
-
- private boolean hasChanges(Object value, String attributeKey) {
- TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
- if (attribute != null) {
- if (TaskAttribute.TYPE_BOOLEAN.equals(attribute.getMetaData().getType())) {
- return areEquals(value, taskData.getAttributeMapper().getBooleanValue(attribute));
- } else if (TaskAttribute.TYPE_DATE.equals(attribute.getMetaData().getType())) {
- return areEquals(value, taskData.getAttributeMapper().getDateValue(attribute));
- } else if (TaskAttribute.TYPE_INTEGER.equals(attribute.getMetaData().getType())) {
- return areEquals(value, taskData.getAttributeMapper().getIntegerValue(attribute));
- } else {
- return areEquals(value, taskData.getAttributeMapper().getValue(attribute));
- }
- }
- return false;
- }
-
- public void setCc(List<String> cc) {
- setValues(TaskAttribute.USER_CC, cc);
- }
-
- public void setCompletionDate(Date dateCompleted) {
- setDateValue(TaskAttribute.DATE_COMPLETION, dateCompleted);
- }
-
- public void setComponent(String component) {
- setValue(TaskAttribute.COMPONENT, component);
- }
-
- public void setCreationDate(Date dateCreated) {
- setDateValue(TaskAttribute.DATE_CREATION, dateCreated);
- }
-
- private TaskAttribute setDateValue(String attributeKey, Date value) {
- TaskAttribute attribute = getMappedAttribute(attributeKey);
- if (attribute != null) {
- taskData.getAttributeMapper().setDateValue(attribute, value);
- }
- return attribute;
- }
-
- public void setDescription(String description) {
- setValue(TaskAttribute.DESCRIPTION, description);
- }
-
- public void setDueDate(Date value) {
- setDateValue(TaskAttribute.DATE_DUE, value);
- }
-
- public void setKeywords(List<String> keywords) {
- setValues(TaskAttribute.KEYWORDS, keywords);
- }
-
- public void setModificationDate(Date dateModified) {
- setDateValue(TaskAttribute.DATE_MODIFICATION, dateModified);
- }
-
- // TODO use Person class?
- public void setOwner(String owner) {
- setValue(TaskAttribute.USER_ASSIGNED, owner);
- }
-
- public void setPriority(PriorityLevel priority) {
- setValue(TaskAttribute.PRIORITY, priority.toString());
- }
-
- public void setProduct(String product) {
- setValue(TaskAttribute.PRODUCT, product);
- }
-
- // TODO use Person class?
- public void setReporter(String reporter) {
- setValue(TaskAttribute.USER_REPORTER, reporter);
- }
-
- public void setSummary(String summary) {
- setValue(TaskAttribute.SUMMARY, summary);
- }
-
- public void setTaskKind(String taskKind) {
- setValue(TaskAttribute.TASK_KIND, taskKind);
- }
-
- public void setTaskUrl(String taskUrl) {
- setValue(TaskAttribute.TASK_URL, taskUrl);
- }
-
- private TaskAttribute setValue(String attributeKey, String value) {
- TaskAttribute attribute = getMappedAttribute(attributeKey);
- if (attribute != null) {
- taskData.getAttributeMapper().setValue(attribute, value);
- }
- return attribute;
-
- }
-
- private TaskAttribute setValues(String attributeKey, List<String> values) {
- TaskAttribute attribute = getMappedAttribute(attributeKey);
- if (attribute != null) {
- taskData.getAttributeMapper().setValues(attribute, values);
- }
- return attribute;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java
deleted file mode 100644
index d89bb183f..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskOperation.java
+++ /dev/null
@@ -1,129 +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.tasks.core.data;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * @author Rob Elves
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskOperation {
-
- public static void applyTo(TaskAttribute taskAttribute, String operationId, String label) {
- TaskData taskData = taskAttribute.getTaskData();
- taskData.getAttributeMapper().setValue(taskAttribute, operationId);
- taskAttribute.getMetaData().defaults().setType(TaskAttribute.TYPE_OPERATION).setLabel(label);
- }
-
- public static TaskOperation createFrom(TaskAttribute taskAttribute) {
- Assert.isNotNull(taskAttribute);
- TaskData taskData = taskAttribute.getTaskData();
- TaskOperation operation = new TaskOperation(taskData.getRepositoryUrl(), taskData.getConnectorKind(),
- taskData.getTaskId(), taskAttribute.getValue());
- operation.setLabel(taskAttribute.getMetaData().getLabel());
- operation.setTaskAttribute(taskAttribute);
- return operation;
- }
-
- private final String connectorKind;
-
- private String label;
-
- private final String operationId;
-
- private final String repositoryUrl;
-
- private TaskAttribute taskAttribute;
-
- private final String taskId;
-
- public TaskOperation(String connectorKind, String repositoryUrl, String taskId, String operationId) {
- Assert.isNotNull(connectorKind);
- Assert.isNotNull(repositoryUrl);
- Assert.isNotNull(taskId);
- Assert.isNotNull(operationId);
- this.connectorKind = connectorKind;
- this.repositoryUrl = repositoryUrl;
- this.taskId = taskId;
- this.operationId = operationId;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TaskOperation other = (TaskOperation) obj;
- if (!connectorKind.equals(other.connectorKind)) {
- return false;
- }
- if (!operationId.equals(other.operationId)) {
- return false;
- }
- if (!repositoryUrl.equals(other.repositoryUrl)) {
- return false;
- }
- if (!taskId.equals(other.taskId)) {
- return false;
- }
- return true;
- }
-
- public String getConnectorKind() {
- return connectorKind;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getOperationId() {
- return operationId;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public TaskAttribute getTaskAttribute() {
- return taskAttribute;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + connectorKind.hashCode();
- result = prime * result + operationId.hashCode();
- result = prime * result + repositoryUrl.hashCode();
- result = prime * result + taskId.hashCode();
- return result;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public void setTaskAttribute(TaskAttribute taskAttribute) {
- this.taskAttribute = taskAttribute;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskRelation.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskRelation.java
deleted file mode 100644
index 5f991a8b8..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskRelation.java
+++ /dev/null
@@ -1,66 +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.tasks.core.data;
-
-import org.eclipse.core.runtime.Assert;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class TaskRelation {
-
- private final String taskId;
-
- private final Kind kind;
-
- private final Direction direction;
-
- public enum Direction {
- INWARD, OUTWARD
- };
-
- public enum Kind {
- CONTAINMENT, DEPENDENCY, DUPLICATE
- }
-
- private TaskRelation(Kind kind, Direction direction, String taskId) {
- Assert.isNotNull(kind);
- Assert.isNotNull(direction);
- Assert.isNotNull(taskId);
- this.kind = kind;
- this.direction = direction;
- this.taskId = taskId;
- }
-
- public String getTaskId() {
- return taskId;
- }
-
- public Kind getKind() {
- return kind;
- }
-
- public Direction getDirection() {
- return direction;
- }
-
- public static TaskRelation parentTask(String taskId) {
- return new TaskRelation(Kind.CONTAINMENT, Direction.INWARD, taskId);
- }
-
- public static TaskRelation subtask(String taskId) {
- return new TaskRelation(Kind.CONTAINMENT, Direction.OUTWARD, taskId);
- }
-
- public static TaskRelation dependency(String taskId, Direction direction) {
- return new TaskRelation(Kind.DEPENDENCY, direction, taskId);
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/ISynchronizationSession.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/ISynchronizationSession.java
deleted file mode 100644
index e5b4c7808..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/ISynchronizationSession.java
+++ /dev/null
@@ -1,49 +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.tasks.core.sync;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @since 3.0
- * @author Steffen Pingel
- */
-public interface ISynchronizationSession {
-
- public abstract Set<ITask> getChangedTasks();
-
- public abstract Object getData();
-
- public abstract ITaskDataManager getTaskDataManager();
-
- public abstract TaskRepository getTaskRepository();
-
- public abstract Set<ITask> getTasks();
-
- public abstract boolean isFullSynchronization();
-
- public abstract boolean isUser();
-
- public abstract boolean needsPerformQueries();
-
- public abstract void setData(Object data);
-
- public abstract void setNeedsPerformQueries(boolean performQueries);
-
- public abstract void markStale(ITask task);
-
- public abstract void putTaskData(ITask task, TaskData taskData) throws CoreException;
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java
deleted file mode 100644
index 7f841d291..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJob.java
+++ /dev/null
@@ -1,90 +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.tasks.core.sync;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-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.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class SubmitJob extends TaskJob {
-
- private final List<SubmitJobListener> submitJobListeners = Collections.synchronizedList(new ArrayList<SubmitJobListener>());
-
- public SubmitJob(String name) {
- super(name);
- }
-
- public void addSubmitJobListener(SubmitJobListener listener) {
- submitJobListeners.add(listener);
- }
-
- public void removeSubmitJobListener(SubmitJobListener listener) {
- submitJobListeners.remove(listener);
- }
-
- protected SubmitJobListener[] getSubmitJobListeners() {
- return submitJobListeners.toArray(new SubmitJobListener[0]);
- }
-
- protected void fireTaskSubmitted(final IProgressMonitor monitor) throws CoreException {
- SubmitJobListener[] listeners = submitJobListeners.toArray(new SubmitJobListener[0]);
- if (listeners.length > 0) {
- final SubmitJobEvent event = new SubmitJobEvent(this);
- for (final SubmitJobListener listener : listeners) {
- listener.taskSubmitted(event, Policy.subMonitorFor(monitor, 100));
- }
- }
- }
-
- protected void fireTaskSynchronized(final IProgressMonitor monitor) throws CoreException {
- SubmitJobListener[] listeners = submitJobListeners.toArray(new SubmitJobListener[0]);
- if (listeners.length > 0) {
- final SubmitJobEvent event = new SubmitJobEvent(this);
- for (final SubmitJobListener listener : listeners) {
- listener.taskSynchronized(event, Policy.subMonitorFor(monitor, 100));
- }
- }
- }
-
- protected void fireDone() {
- SubmitJobListener[] listeners = submitJobListeners.toArray(new SubmitJobListener[0]);
- if (listeners.length > 0) {
- final SubmitJobEvent event = new SubmitJobEvent(this);
- for (final SubmitJobListener listener : listeners) {
- SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Listener failed", e));
- }
-
- public void run() throws Exception {
- listener.done(event);
- }
- });
- }
- }
- }
-
- public abstract ITask getTask();
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobEvent.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobEvent.java
deleted file mode 100644
index 3cb5ec2f0..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobEvent.java
+++ /dev/null
@@ -1,27 +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.tasks.core.sync;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public class SubmitJobEvent {
-
- private final SubmitJob job;
-
- public SubmitJobEvent(SubmitJob job) {
- this.job = job;
- }
-
- public SubmitJob getJob() {
- return job;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobListener.java
deleted file mode 100644
index c9d14b4c1..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SubmitJobListener.java
+++ /dev/null
@@ -1,26 +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.tasks.core.sync;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class SubmitJobListener {
-
- public abstract void taskSubmitted(SubmitJobEvent event, IProgressMonitor monitor) throws CoreException;
-
- public abstract void taskSynchronized(SubmitJobEvent event, IProgressMonitor monitor) throws CoreException;
-
- public abstract void done(SubmitJobEvent event);
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SynchronizationJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SynchronizationJob.java
deleted file mode 100644
index 8a48ed7cf..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/SynchronizationJob.java
+++ /dev/null
@@ -1,43 +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.tasks.core.sync;
-
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class SynchronizationJob extends Job {
-
-// private boolean changedTasksSynchronization = true;
-
- private boolean fullSynchronization = false;
-
- public SynchronizationJob(String name) {
- super(name);
- }
-
-// public boolean isChangedTasksSynchronization() {
-// return changedTasksSynchronization;
-// }
-
- public boolean isFullSynchronization() {
- return fullSynchronization;
- }
-
-// public void setChangedTasksSynchronization(boolean synchronizeChangedTasks) {
-// this.changedTasksSynchronization = synchronizeChangedTasks;
-// }
-
- public void setFullSynchronization(boolean fullSynchronization) {
- this.fullSynchronization = fullSynchronization;
- }
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/TaskJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/TaskJob.java
deleted file mode 100644
index 0af04b3e5..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/sync/TaskJob.java
+++ /dev/null
@@ -1,26 +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.tasks.core.sync;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-
-/**
- * @author Steffen Pingel
- * @since 3.0
- */
-public abstract class TaskJob extends Job {
-
- public TaskJob(String name) {
- super(name);
- }
-
- public abstract IStatus getStatus();
-
-}

Back to the top