Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 71646 Details for
Bug 160389
[api] change how offline task data is cached to disk and refactor attribute factory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Offline take 3
OfflineXML.patch (text/plain), 231.72 KB, created by
Robert Elves
on 2007-06-18 14:11:42 EDT
(
hide
)
Description:
Offline take 3
Filename:
MIME Type:
Creator:
Robert Elves
Created:
2007-06-18 14:11:42 EDT
Size:
231.72 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java,v >retrieving revision 1.61 >diff -u -r1.61 RepositorySynchronizationManager.java >--- src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java 18 Jun 2007 04:13:12 -0000 1.61 >+++ src/org/eclipse/mylyn/tasks/ui/RepositorySynchronizationManager.java 18 Jun 2007 18:10:09 -0000 >@@ -44,9 +44,8 @@ > protected boolean forceSyncExecForTesting = false; > > /** >- * Synchronize a single task. Note that if you have a collection of tasks to >- * synchronize with this connector then you should call synchronize(Set<Set<AbstractTask> >- * repositoryTasks, ...) >+ * Synchronize a single task. Note that if you have a collection of tasks to synchronize with this connector then >+ * you should call synchronize(Set<Set<AbstractTask> repositoryTasks, ...) > * > * @param listener > * can be null >@@ -92,14 +91,15 @@ > } > > /** >- * For synchronizing a single query. Use synchronize(Set, >- * IJobChangeListener) if synchronizing multiple queries at a time. >+ * For synchronizing a single query. Use synchronize(Set, IJobChangeListener) if synchronizing multiple queries at a >+ * time. > */ > public final Job synchronize(AbstractRepositoryConnector connector, final AbstractRepositoryQuery repositoryQuery, > IJobChangeListener listener, boolean forceSync) { > TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository( > repositoryQuery.getRepositoryKind(), repositoryQuery.getRepositoryUrl()); >- return synchronize(connector, repository, Collections.singleton(repositoryQuery), listener, Job.LONG, 0, forceSync); >+ return synchronize(connector, repository, Collections.singleton(repositoryQuery), listener, Job.LONG, 0, >+ forceSync); > } > > public final Job synchronize(AbstractRepositoryConnector connector, TaskRepository repository, >@@ -136,12 +136,12 @@ > } > > /** >- * Synchronizes only those tasks that have changed since the last time the >- * given repository was synchronized. Calls to this method update >- * TaskRepository.syncTime. >+ * Synchronizes only those tasks that have changed since the last time the given repository was synchronized. Calls >+ * to this method update TaskRepository.syncTime. > */ > public final void synchronizeChanged(final AbstractRepositoryConnector connector, final TaskRepository repository) { >- final SynchronizeChangedTasksJob synchronizeChangedTasksJob = new SynchronizeChangedTasksJob(connector, repository); >+ final SynchronizeChangedTasksJob synchronizeChangedTasksJob = new SynchronizeChangedTasksJob(connector, >+ repository); > synchronizeChangedTasksJob.setSystem(true); > synchronizeChangedTasksJob.setRule(new RepositoryMutexRule(repository)); > if (!forceSyncExecForTesting) { >@@ -161,11 +161,10 @@ > * @param modifiedAttributes > * attributes that have changed during edit session > */ >- public synchronized void saveOutgoing(AbstractTask repositoryTask, >- Set<RepositoryTaskAttribute> modifiedAttributes) { >+ public synchronized void saveOutgoing(AbstractTask repositoryTask, Set<RepositoryTaskAttribute> modifiedAttributes) { > repositoryTask.setSyncState(RepositoryTaskSyncState.OUTGOING); >- TasksUiPlugin.getDefault().getTaskDataManager().saveEdits(repositoryTask.getHandleIdentifier(), >- Collections.unmodifiableSet(modifiedAttributes)); >+ TasksUiPlugin.getDefault().getTaskDataManager().saveEdits(repositoryTask.getRepositoryUrl(), >+ repositoryTask.getTaskId(), Collections.unmodifiableSet(modifiedAttributes)); > TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask, false); > } > >@@ -174,8 +173,8 @@ > * > * @return true if call results in change of sync state > */ >- public synchronized boolean saveIncoming(final AbstractTask repositoryTask, >- final RepositoryTaskData newTaskData, boolean forceSync) { >+ public synchronized boolean saveIncoming(final AbstractTask repositoryTask, final RepositoryTaskData newTaskData, >+ boolean forceSync) { > final RepositoryTaskSyncState startState = repositoryTask.getSyncState(); > RepositoryTaskSyncState status = repositoryTask.getSyncState(); > >@@ -186,21 +185,20 @@ > } > > RepositoryTaskData previousTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( >- repositoryTask.getHandleIdentifier()); >+ repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); > > if (repositoryTask.isSubmitting()) { > status = RepositoryTaskSyncState.SYNCHRONIZED; > repositoryTask.setSubmitting(false); > TaskDataManager dataManager = TasksUiPlugin.getDefault().getTaskDataManager(); >- dataManager.discardEdits(repositoryTask.getHandleIdentifier()); >+ dataManager.discardEdits(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); > > TasksUiPlugin.getDefault().getTaskDataManager().setNewTaskData(repositoryTask.getHandleIdentifier(), > newTaskData); > /** > * If we set both so we don't see our own changes > * >- * @see RepositorySynchronizationManager.setTaskRead(AbstractTask, >- * boolean) >+ * @see RepositorySynchronizationManager.setTaskRead(AbstractTask, boolean) > */ > // TasksUiPlugin.getDefault().getTaskDataManager().setOldTaskData(repositoryTask.getHandleIdentifier(), > // newTaskData); >@@ -273,8 +271,8 @@ > public void setTaskRead(AbstractTask repositoryTask, boolean read) { > TaskDataManager dataManager = TasksUiPlugin.getDefault().getTaskDataManager(); > RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( >- repositoryTask.getHandleIdentifier()); >- >+ repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); >+ > if (read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.INCOMING)) { > if (taskData != null && taskData.getLastModified() != null) { > repositoryTask.setLastSyncDateStamp(taskData.getLastModified()); >@@ -305,8 +303,7 @@ > // fall back for cases where the stamp is missing, set bogus date > repositoryTask.setLastSyncDateStamp(LocalTask.SYNC_DATE_NOW); > } >- >- >+ > } else if (!read && repositoryTask.getSyncState().equals(RepositoryTaskSyncState.SYNCHRONIZED)) { > repositoryTask.setSyncState(RepositoryTaskSyncState.INCOMING); > TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask, false); >@@ -315,10 +312,10 @@ > > public void discardOutgoing(AbstractTask repositoryTask) { > TaskDataManager dataManager = TasksUiPlugin.getDefault().getTaskDataManager(); >- dataManager.discardEdits(repositoryTask.getHandleIdentifier()); >+ dataManager.discardEdits(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); > repositoryTask.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED); >- >- TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask, false); >+ >+ TasksUiPlugin.getTaskListManager().getTaskList().notifyTaskChanged(repositoryTask, true); > } > > /** >Index: src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java,v >retrieving revision 1.53 >diff -u -r1.53 TasksUiUtil.java >--- src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java 16 Jun 2007 17:47:58 -0000 1.53 >+++ src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java 18 Jun 2007 18:10:10 -0000 >@@ -80,8 +80,7 @@ > public static final int FLAG_NO_RICH_EDITOR = 1 << 17; > > /** >- * Resolves a rich editor for the task if available. Must be called from UI >- * thread. >+ * Resolves a rich editor for the task if available. Must be called from UI thread. > */ > public static void openUrl(String url, boolean useRichEditorIfAvailable) { > try { >@@ -168,8 +167,7 @@ > AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() > .getConnectorForRepositoryTaskUrl(fullUrl); > if (connector != null) { >- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin >- .getRepositoryUi(connector.getRepositoryType()); >+ AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getRepositoryUi(connector.getRepositoryType()); > if (repositoryUrl != null && taskId != null) { > opened = connectorUi.openRepositoryTask(repositoryUrl, taskId); > } else { >@@ -197,8 +195,7 @@ > task = (AbstractTask) element; > } > >- >- if(task instanceof LocalTask) { >+ if (task instanceof LocalTask) { > TasksUiUtil.openEditor(task, false); > } else if (task instanceof AbstractTask) { > >@@ -219,7 +216,7 @@ > if (connector != null) { > > RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( >- task.getHandleIdentifier()); >+ task.getRepositoryUrl(), task.getTaskId()); > > if (taskData != null) { > TasksUiUtil.openEditor(task, true, false); >@@ -256,8 +253,7 @@ > String taskEditorId = TaskEditor.ID_EDITOR; > if (task instanceof AbstractTask) { > AbstractTask repositoryTask = (AbstractTask) task; >- AbstractRepositoryConnectorUi repositoryUi = TasksUiPlugin.getRepositoryUi(repositoryTask >- .getRepositoryKind()); >+ AbstractRepositoryConnectorUi repositoryUi = TasksUiPlugin.getRepositoryUi(repositoryTask.getRepositoryKind()); > String customTaskEditorId = repositoryUi.getTaskEditorId(repositoryTask); > if (customTaskEditorId != null) { > taskEditorId = customTaskEditorId; >@@ -466,8 +462,8 @@ > selection = (IStructuredSelection) windowSelection; > } > } >- >- if(selection == null) { >+ >+ if (selection == null) { > return null; > } > >@@ -510,7 +506,8 @@ > > PreferenceManager manager = new PreferenceManager(); > manager.addToRoot(targetNode); >- final PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow() >+ final PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow() > .getShell(), manager); > final boolean[] result = new boolean[] { false }; > BusyIndicator.showWhile(Display.getDefault(), new Runnable() { >Index: src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java,v >retrieving revision 1.57 >diff -u -r1.57 SynchronizeTaskJob.java >--- src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java 15 Jun 2007 22:04:58 -0000 1.57 >+++ src/org/eclipse/mylyn/tasks/ui/SynchronizeTaskJob.java 18 Jun 2007 18:10:09 -0000 >@@ -141,20 +141,6 @@ > TaskFactory factory = new TaskFactory(repository, true, forced); > repositoryTask = factory.createTask(downloadedTaskData, new SubProgressMonitor(monitor, 1)); > >-// TasksUiPlugin.getSynchronizationManager().saveIncoming(repositoryTask, downloadedTaskData, forced); >-// connector.updateTaskFromTaskData(repository, repositoryTask, downloadedTaskData); >-// repositoryTask.dropSubTasks(); >-// for (String subId : taskDataHandler.getSubTaskIds(downloadedTaskData)) { >-// if (subId == null || subId.trim().equals("")) { >-// continue; >-// } >-// AbstractTask subTask = factory.createTaskFromExistingId(repository, subId, false, >-// new SubProgressMonitor(monitor, 1)); >-// if (subTask != null) { >-// repositoryTask.addSubTask(subTask); >-// } >-// } >- > // HACK: Remove once connectors can get access to > // TaskDataManager and do this themselves > if ((oldDueDate == null && repositoryTask.getDueDate() != null) >@@ -178,4 +164,4 @@ > > repositoryTask.setStale(false); > } >-} >\ No newline at end of file >+} >Index: src/org/eclipse/mylyn/tasks/ui/SynchronizeChangedTasksJob.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeChangedTasksJob.java,v >retrieving revision 1.2 >diff -u -r1.2 SynchronizeChangedTasksJob.java >--- src/org/eclipse/mylyn/tasks/ui/SynchronizeChangedTasksJob.java 15 Jun 2007 22:04:58 -0000 1.2 >+++ src/org/eclipse/mylyn/tasks/ui/SynchronizeChangedTasksJob.java 18 Jun 2007 18:10:09 -0000 >@@ -72,7 +72,7 @@ > } > } > >- if (!tasks.isEmpty()) { >+ if (tasks.isEmpty()) { > return Status.OK_STATUS; > } > >Index: src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java,v >retrieving revision 1.111 >diff -u -r1.111 TasksUiPlugin.java >--- src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java 16 Jun 2007 01:59:44 -0000 1.111 >+++ src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java 18 Jun 2007 18:10:10 -0000 >@@ -27,7 +27,6 @@ > import org.eclipse.core.resources.ISaveParticipant; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; > import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; >@@ -40,14 +39,16 @@ > import org.eclipse.mylyn.context.core.ContextCorePlugin; > import org.eclipse.mylyn.internal.context.core.ContextPreferenceContstants; > import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; >-import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer; > import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector; >+import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer; > import org.eclipse.mylyn.internal.tasks.core.TaskDataManager; > import org.eclipse.mylyn.internal.tasks.ui.IDynamicSubMenuContributor; > import org.eclipse.mylyn.internal.tasks.ui.ITaskHighlighter; > import org.eclipse.mylyn.internal.tasks.ui.ITaskListNotification; > import org.eclipse.mylyn.internal.tasks.ui.ITaskListNotificationProvider; > import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants; >+import org.eclipse.mylyn.internal.tasks.ui.OfflineCachingStorage; >+import org.eclipse.mylyn.internal.tasks.ui.OfflineFileStorage; > import org.eclipse.mylyn.internal.tasks.ui.TaskListBackupManager; > import org.eclipse.mylyn.internal.tasks.ui.TaskListColorsAndFonts; > import org.eclipse.mylyn.internal.tasks.ui.TaskListNotificationIncoming; >@@ -95,11 +96,15 @@ > */ > public class TasksUiPlugin extends AbstractUIPlugin implements IStartup { > >+ private static final String FOLDER_OFFLINE = "offline"; >+ > public static final String LABEL_VIEW_REPOSITORIES = "Task Repositories view"; > > public static final String PLUGIN_ID = "org.eclipse.mylyn.tasklist"; > >- private static final String NAME_DATA_DIR = ".mylar"; >+ private static final String DIRECTORY_METADATA = ".metadata"; >+ >+ private static final String NAME_DATA_DIR = ".mylyn"; > > private static final char DEFAULT_PATH_SEPARATOR = '/'; > >@@ -379,7 +384,7 @@ > taskRepositoryManager.readRepositories(getRepositoriesFilePath()); > > // instantiates taskDataManager >- readOfflineReports(); >+ startOfflineStorageManager(); > > loadTemplateRepositories(); > >@@ -582,7 +587,7 @@ > } > > public String getDefaultDataDirectory() { >- return ResourcesPlugin.getWorkspace().getRoot().getLocation().toString() + '/' + NAME_DATA_DIR; >+ return ResourcesPlugin.getWorkspace().getRoot().getLocation().toString() + '/' +DIRECTORY_METADATA+ '/'+ NAME_DATA_DIR; > } > > public String getDataDirectory() { >@@ -764,27 +769,13 @@ > return taskListBackupManager; > } > >- // TODO: clean-up >- private void readOfflineReports() { >- IPath offlineReportsPath = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); >- >-// try { >- taskDataManager = new TaskDataManager(taskRepositoryManager, offlineReportsPath);// , >- // true); >-// } catch (Throwable t) { >-// MylarStatusHandler.log("Recreating offline task cache due to format update.", >-// this); >-// boolean deleted = offlineReportsPath.toFile().delete(); >-// if (!deleted) { >-// MylarStatusHandler.log(t, "could not delete offline repository tasks file"); >-// } >-// try { >-// taskDataManager = new TaskDataManager(taskRepositoryManager, >-// offlineReportsPath, false); >-// } catch (Exception e1) { >-// MylarStatusHandler.log(e1, "could not reset offline repository tasks file"); >-// } >-// } >+ private void startOfflineStorageManager() { >+ //IPath offlineReportsPath = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); >+ File root = new File(this.getDataDirectory() + '/' + FOLDER_OFFLINE); >+ OfflineFileStorage storage = new OfflineFileStorage(root); >+ OfflineCachingStorage cachedStorage = new OfflineCachingStorage(storage); >+ taskDataManager = new TaskDataManager(taskRepositoryManager, cachedStorage); >+ taskDataManager.start(); > } > > public TaskDataManager getTaskDataManager() { >@@ -916,12 +907,10 @@ > AbstractTask repositoryTask) { > > TaskListNotificationIncoming notification = new TaskListNotificationIncoming(repositoryTask); >- > RepositoryTaskData newTaskData = getDefault().getTaskDataManager().getNewTaskData( >- repositoryTask.getHandleIdentifier()); >- >+ repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); > RepositoryTaskData oldTaskData = getDefault().getTaskDataManager().getOldTaskData( >- repositoryTask.getHandleIdentifier()); >+ repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); > > if (newTaskData != null && oldTaskData != null) { > >@@ -967,7 +956,7 @@ > boolean attributeChanged = false; > > for (RepositoryTaskAttribute newAttribute : newTaskData.getAttributes()) { >- RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getID()); >+ RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getId()); > if (oldAttribute == null) { > attributeChanged = true; > break; >Index: src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java,v >retrieving revision 1.64 >diff -u -r1.64 SynchronizeQueryJob.java >--- src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java 18 Jun 2007 04:13:12 -0000 1.64 >+++ src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java 18 Jun 2007 18:10:09 -0000 >@@ -143,21 +143,8 @@ > } > } > >- > taskList.notifyContainersUpdated(null); > >-// // HACK: force entire Task List to refresh in case containers need to >-// // appear or disappear >-// PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { >-// public void run() { >-// TaskListView view = TaskListView.getFromActivePerspective(); >-// if (view != null) { >-// // TODO: remove explicit refresh >-// view.getViewer().refresh(); >-// } >-// } >-// }); >- > return Status.OK_STATUS; > } finally { > monitor.done(); >Index: src/org/eclipse/mylyn/tasks/ui/TaskListManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java,v >retrieving revision 1.87 >diff -u -r1.87 TaskListManager.java >--- src/org/eclipse/mylyn/tasks/ui/TaskListManager.java 15 Jun 2007 22:04:58 -0000 1.87 >+++ src/org/eclipse/mylyn/tasks/ui/TaskListManager.java 18 Jun 2007 18:10:09 -0000 >@@ -731,10 +731,10 @@ > if (task instanceof AbstractTask) { > AbstractTask repositoryTask = (AbstractTask) task; > if (repositoryTask.getRepositoryUrl().equals(oldRepositoryUrl)) { >- RepositoryTaskData newTaskData = taskDataManager.getNewTaskData(repositoryTask.getHandleIdentifier()); >- RepositoryTaskData oldTaskData = taskDataManager.getOldTaskData(repositoryTask.getHandleIdentifier()); >- Set<RepositoryTaskAttribute> edits = taskDataManager.getEdits(repositoryTask.getHandleIdentifier()); >- taskDataManager.remove(repositoryTask.getHandleIdentifier()); >+ RepositoryTaskData newTaskData = taskDataManager.getNewTaskData(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); >+ RepositoryTaskData oldTaskData = taskDataManager.getOldTaskData(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); >+ Set<RepositoryTaskAttribute> edits = taskDataManager.getEdits(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); >+ taskDataManager.remove(repositoryTask.getRepositoryUrl(), repositoryTask.getTaskId()); > > String newHandle = RepositoryTaskHandleUtil.getHandle(newRepositoryUrl, repositoryTask.getTaskId()); > >@@ -747,7 +747,7 @@ > taskDataManager.setOldTaskData(newHandle, oldTaskData); > } > if (!edits.isEmpty()) { >- taskDataManager.saveEdits(newHandle, edits); >+ taskDataManager.saveEdits(newRepositoryUrl, repositoryTask.getTaskId(), edits); > } > } > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java,v >retrieving revision 1.7 >diff -u -r1.7 PersonProposalProvider.java >--- src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java 14 Jun 2007 03:35:24 -0000 1.7 >+++ src/org/eclipse/mylyn/internal/tasks/ui/PersonProposalProvider.java 18 Jun 2007 18:10:09 -0000 >@@ -142,7 +142,7 @@ > addAddress(task.getOwner(), addressSet); > > RepositoryTaskData data = TasksUiPlugin.getDefault().getTaskDataManager() // >- .getOldTaskData(task.getHandleIdentifier()); >+ .getOldTaskData(task.getRepositoryUrl(), task.getTaskId()); > addAddresses(data, addressSet); > } > >Index: src/org/eclipse/mylyn/internal/tasks/ui/WorkspaceAwareContextStore.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/WorkspaceAwareContextStore.java,v >retrieving revision 1.6 >diff -u -r1.6 WorkspaceAwareContextStore.java >--- src/org/eclipse/mylyn/internal/tasks/ui/WorkspaceAwareContextStore.java 8 Jun 2007 00:34:11 -0000 1.6 >+++ src/org/eclipse/mylyn/internal/tasks/ui/WorkspaceAwareContextStore.java 18 Jun 2007 18:10:09 -0000 >@@ -13,33 +13,57 @@ > > import java.io.File; > >+import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.mylyn.context.core.AbstractContextStore; >+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; > import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; > > /** > * @author Mik Kersten > */ > public class WorkspaceAwareContextStore extends AbstractContextStore { >- >+ >+ private static final String MIGRATION_FAILED = "Failed migrate old data folder"; >+ >+ private static final String DIRECTORY_METADATA = ".metadata"; >+ >+ private static final String OLD_DATA_DIR = ".mylar"; >+ > public static final String CONTEXTS_DIRECTORY = "contexts"; >- >+ > private File rootDirectory; >- >+ > private File contextDirectory; >- >+ > @Override > public void init() { >+ // Migrate .mylar data folder to .metadata/mylyn >+ // if user was still using default location >+ String oldDefaultDataPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString() + '/' >+ + OLD_DATA_DIR; >+ File oldDefaultDataDir = new File(oldDefaultDataPath); >+ if (oldDefaultDataDir.exists()) { >+ File metadata = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toString() + '/' >+ + DIRECTORY_METADATA); >+ if (!metadata.exists()) { >+ StatusManager.log(MIGRATION_FAILED, this); >+ } else { >+ if (!oldDefaultDataDir.renameTo(new File(TasksUiPlugin.getDefault().getDefaultDataDirectory()))) { >+ StatusManager.log(MIGRATION_FAILED, this); >+ } >+ } >+ } > rootDirectory = new File(TasksUiPlugin.getDefault().getDataDirectory()); > if (!rootDirectory.exists()) { > rootDirectory.mkdir(); >- }; >- >+ } >+ > contextDirectory = new File(rootDirectory, CONTEXTS_DIRECTORY); > if (!contextDirectory.exists()) { > contextDirectory.mkdir(); >- }; >+ } > } >- >+ > @Override > public File getRootDirectory() { > return rootDirectory; >Index: src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java,v >retrieving revision 1.8 >diff -u -r1.8 TaskWorkingSetAction.java >--- src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java 17 Jun 2007 01:21:47 -0000 1.8 >+++ src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskWorkingSetAction.java 18 Jun 2007 18:10:09 -0000 >@@ -30,7 +30,6 @@ > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.SelectionChangedEvent; >-import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardDialog; > import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages; > import org.eclipse.swt.SWT; >@@ -46,10 +45,8 @@ > import org.eclipse.ui.IWorkingSetManager; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.IWorkingSetEditWizard; >-import org.eclipse.ui.internal.IWorkbenchHelpContextIds; > import org.eclipse.ui.internal.WorkbenchMessages; > import org.eclipse.ui.internal.WorkbenchPlugin; >-import org.eclipse.ui.internal.WorkingSet; > import org.eclipse.ui.internal.WorkingSetComparator; > import org.eclipse.ui.internal.dialogs.AbstractWorkingSetDialog; > import org.eclipse.ui.internal.dialogs.WorkingSetFilter; >Index: src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java,v >retrieving revision 1.2 >diff -u -r1.2 NewTaskAction.java >--- src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java 15 Jun 2007 18:29:10 -0000 1.2 >+++ src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java 18 Jun 2007 18:10:09 -0000 >@@ -38,7 +38,7 @@ > > @Override > public void run() { >- >+ > IWizard wizard; > List<TaskRepository> repositories = TasksUiPlugin.getRepositoryManager().getAllRepositories(); > if (repositories.size() == 1) { >Index: src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractFilteredTree.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractFilteredTree.java,v >retrieving revision 1.3 >diff -u -r1.3 AbstractFilteredTree.java >--- src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractFilteredTree.java 18 Jun 2007 02:12:18 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractFilteredTree.java 18 Jun 2007 18:10:09 -0000 >@@ -30,7 +30,6 @@ > import org.eclipse.swt.widgets.Label; > import org.eclipse.ui.dialogs.FilteredTree; > import org.eclipse.ui.dialogs.PatternFilter; >-import org.eclipse.ui.forms.FormColors; > import org.eclipse.ui.internal.WorkbenchMessages; > > /** >Index: src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditorInput.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditorInput.java,v >retrieving revision 1.1 >diff -u -r1.1 AbstractRepositoryTaskEditorInput.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditorInput.java 14 Jun 2007 18:43:59 -0000 1.1 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditorInput.java 18 Jun 2007 18:10:10 -0000 >@@ -14,6 +14,7 @@ > import java.util.Set; > > import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil; > import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages; > import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; > import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >@@ -115,8 +116,8 @@ > } > > public void refreshInput() { >- this.editableTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getEditableCopy(handle); >- this.oldTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getOldTaskData(handle); >- this.oldEdits = TasksUiPlugin.getDefault().getTaskDataManager().getEdits(handle); >+ this.editableTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getEditableCopy(repository.getUrl(), RepositoryTaskHandleUtil.getTaskId(handle)); >+ this.oldTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getOldTaskData(repository.getUrl(), RepositoryTaskHandleUtil.getTaskId(handle)); >+ this.oldEdits = TasksUiPlugin.getDefault().getTaskDataManager().getEdits(repository.getUrl(), RepositoryTaskHandleUtil.getTaskId(handle)); > } > } >Index: src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java,v >retrieving revision 1.49 >diff -u -r1.49 TaskEditor.java >--- src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java 16 Jun 2007 01:59:44 -0000 1.49 >+++ src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java 18 Jun 2007 18:10:10 -0000 >@@ -24,24 +24,18 @@ > import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; > import org.eclipse.mylyn.internal.tasks.core.LocalTask; > import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages; >-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants; > import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor; > import org.eclipse.mylyn.internal.tasks.ui.editors.TaskPlanningEditor; > import org.eclipse.mylyn.tasks.core.AbstractTask; > import org.eclipse.mylyn.tasks.core.RepositoryTaskData; > import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi; > import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; >-import org.eclipse.mylyn.tasks.ui.TasksUiUtil; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.SWTError; >-import org.eclipse.swt.browser.Browser; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Menu; > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IEditorSite; > import org.eclipse.ui.PartInitException; >-import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.forms.IManagedForm; > import org.eclipse.ui.forms.editor.FormPage; > import org.eclipse.ui.forms.editor.IFormPage; >Index: src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java,v >retrieving revision 1.161 >diff -u -r1.161 AbstractRepositoryTaskEditor.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 18 Jun 2007 05:02:53 -0000 1.161 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java 18 Jun 2007 18:10:10 -0000 >@@ -2498,7 +2498,7 @@ > return false; > } > >- RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getID()); >+ RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getId()); > if (oldAttribute == null) > return true; > if (oldAttribute.getValue() != null && !oldAttribute.getValue().equals(newAttribute.getValue())) { >Index: src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java,v >retrieving revision 1.3 >diff -u -r1.3 TasksUiPreferencePage.java >--- src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java 16 Jun 2007 01:59:44 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java 18 Jun 2007 18:10:09 -0000 >@@ -18,7 +18,6 @@ > import org.eclipse.jface.preference.PreferencePage; > import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants; > import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants; >-import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView; > import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.ModifyEvent; >@@ -32,10 +31,8 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.DirectoryDialog; >-import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Group; > import org.eclipse.swt.widgets.Label; >-import org.eclipse.swt.widgets.Listener; > import org.eclipse.swt.widgets.Spinner; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.IWorkbench; >Index: .refactorings/2007/6/25/refactorings.index >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/.refactorings/2007/6/25/refactorings.index,v >retrieving revision 1.8 >diff -u -r1.8 refactorings.index >--- .refactorings/2007/6/25/refactorings.index 18 Jun 2007 16:02:23 -0000 1.8 >+++ .refactorings/2007/6/25/refactorings.index 18 Jun 2007 18:10:09 -0000 >@@ -16,3 +16,4 @@ > 1182180874650 Rename type 'TaskElementFactory' > 1182181923190 Rename local variable 'compositeImages' > 1182181928542 Rename field 'compositeImages' >+1182183465937 Rename type 'SynchronizeTasksJob' >Index: .refactorings/2007/6/25/refactorings.history >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/.refactorings/2007/6/25/refactorings.history,v >retrieving revision 1.8 >diff -u -r1.8 refactorings.history >--- .refactorings/2007/6/25/refactorings.history 18 Jun 2007 16:02:23 -0000 1.8 >+++ .refactorings/2007/6/25/refactorings.history 18 Jun 2007 18:10:09 -0000 >@@ -18,4 +18,5 @@ > <refactoring comment="Rename type 'org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskElementFactory' to 'TaskWorkingSetElementFactory' - Original project: 'org.eclipse.mylyn.tasks.ui' - Original element: 'org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskElementFactory' - Renamed element: 'org.eclipse.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetElementFactory' - Update references to refactored element - Update fully qualified names in '*.xml, *.properties, *.exsd, *.mf' files - Update textual occurrences in comments and strings" description="Rename type 'TaskElementFactory'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylyn.internal.tasks.ui.workingsets{TaskElementFactory.java[TaskElementFactory" matchStrategy="1" name="TaskWorkingSetElementFactory" patterns="*.xml, *.properties, *.exsd, *.mf" qualified="true" references="true" similarDeclarations="false" stamp="1182180874650" textual="false" version="1.0"/> > <refactoring comment="Rename local variable 'compositeImages' in 'org.eclipse.mylyn.internal.tasks.ui.views.TaskElementLabelProvider.TaskElementLabelProvider(...)' to 'wideImages' - Original project: 'org.eclipse.mylyn.tasks.ui' - Original element: 'org.eclipse.mylyn.internal.tasks.ui.views.TaskElementLabelProvider.TaskElementLabelProvider(boolean).compositeImages' - Renamed element: 'org.eclipse.mylyn.internal.tasks.ui.views.TaskElementLabelProvider.TaskElementLabelProvider(boolean).wideImages' - Update references to refactored element" description="Rename local variable 'compositeImages'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src<org.eclipse.mylyn.internal.tasks.ui.views{TaskElementLabelProvider.java" name="wideImages" references="true" selection="2577 15" stamp="1182181923190" version="1.0"/> > <refactoring comment="Rename field 'compositeImages' in 'org.eclipse.mylyn.internal.tasks.ui.views.TaskElementLabelProvider' to 'wideImages' - Original project: 'org.eclipse.mylyn.tasks.ui' - Original element: 'org.eclipse.mylyn.internal.tasks.ui.views.TaskElementLabelProvider.compositeImages' - Renamed element: 'org.eclipse.mylyn.internal.tasks.ui.views.TaskElementLabelProvider.wideImages' - Update references to refactored element - Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'compositeImages'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src<org.eclipse.mylyn.internal.tasks.ui.views{TaskElementLabelProvider.java[TaskElementLabelProvider^compositeImages" name="wideImages" references="true" setter="false" stamp="1182181928542" textual="false" version="1.0"/> >+<refactoring comment="Rename type 'org.eclipse.mylyn.tasks.ui.SynchronizeTasksJob' to 'SynchronizeTaskJob' - Original project: 'org.eclipse.mylyn.tasks.ui' - Original element: 'org.eclipse.mylyn.tasks.ui.SynchronizeTasksJob' - Renamed element: 'org.eclipse.mylyn.tasks.ui.SynchronizeTaskJob' - Update references to refactored element - Rename similarly named elements - Update fully qualified names in '*.xml, *.xsd' files - Update textual occurrences in comments and strings" description="Rename type 'SynchronizeTasksJob'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylyn.tasks.ui{SynchronizeTasksJob.java[SynchronizeTasksJob" matchStrategy="1" name="SynchronizeTaskJob" patterns="*.xml, *.xsd" qualified="true" references="true" similarDeclarations="true" stamp="1182183465937" textual="true" version="1.0"/> > </session> >Index: src/org/eclipse/mylyn/internal/tasks/ui/wizards/ContextRetrieveWizardPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/ContextRetrieveWizardPage.java,v >retrieving revision 1.14 >diff -u -r1.14 ContextRetrieveWizardPage.java >--- src/org/eclipse/mylyn/internal/tasks/ui/wizards/ContextRetrieveWizardPage.java 18 Jun 2007 15:46:42 -0000 1.14 >+++ src/org/eclipse/mylyn/internal/tasks/ui/wizards/ContextRetrieveWizardPage.java 18 Jun 2007 18:10:09 -0000 >@@ -114,14 +114,14 @@ > AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector( > repository.getKind()); > >- List<RepositoryAttachment> contextAttachments = new ArrayList<RepositoryAttachment>(connector >- .getContextAttachments(repository, task)); >+ List<RepositoryAttachment> contextAttachments = new ArrayList<RepositoryAttachment>( >+ connector.getContextAttachments(repository, task)); > > Collections.sort(contextAttachments, new Comparator<RepositoryAttachment>() { > > public int compare(RepositoryAttachment attachment1, RepositoryAttachment attachment2) { > RepositoryTaskData data = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( >- task.getHandleIdentifier()); >+ task.getRepositoryUrl(), task.getTaskId()); > > AbstractAttributeFactory factory = null; > >@@ -131,10 +131,10 @@ > factory = data.getAttributeFactory(); > } > if (factory != null) { >- created1 = factory.getDateForAttributeType(RepositoryTaskAttribute.ATTACHMENT_DATE, attachment1 >- .getDateCreated()); >- created2 = factory.getDateForAttributeType(RepositoryTaskAttribute.ATTACHMENT_DATE, attachment2 >- .getDateCreated()); >+ created1 = factory.getDateForAttributeType(RepositoryTaskAttribute.ATTACHMENT_DATE, >+ attachment1.getDateCreated()); >+ created2 = factory.getDateForAttributeType(RepositoryTaskAttribute.ATTACHMENT_DATE, >+ attachment2.getDateCreated()); > } > > if (created1 != null && created2 != null) { >Index: src/org/eclipse/mylyn/internal/tasks/ui/OfflineCachingStorage.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/OfflineCachingStorage.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/OfflineCachingStorage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/OfflineCachingStorage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,321 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 Mylar committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.tasks.ui; >+ >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.Map; >+import java.util.Queue; >+import java.util.Set; >+import java.util.Timer; >+import java.util.TimerTask; >+import java.util.concurrent.ConcurrentHashMap; >+import java.util.concurrent.ConcurrentLinkedQueue; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.mylyn.internal.tasks.core.ITaskDataStorage; >+import org.eclipse.mylyn.internal.tasks.core.TaskDataState; >+ >+/** >+ * Least Recently Used (LRU) cache >+ * >+ * TODO: Use meta context to make cache more efficient >+ * >+ * @author Rob Elves >+ */ >+public class OfflineCachingStorage implements ITaskDataStorage { >+ >+ private static final int DEFAULT_FLUSH_INTERVAL = 60 * 1000; >+ >+ private static final int MAX_READ_QUEUE_SIZE = 80; >+ >+ private Map<String, Map<String, TaskDataState>> readCache = new ConcurrentHashMap<String, Map<String, TaskDataState>>(); >+ >+ private Map<String, Map<String, TaskDataState>> writeCache = new ConcurrentHashMap<String, Map<String, TaskDataState>>(); >+ >+ private Queue<TaskDataState> lruQueue = new ConcurrentLinkedQueue<TaskDataState>(); >+ >+ private ITaskDataStorage storage; >+ >+ private CacheFlushJob cacheFlushJob; >+ >+ private Timer cacheFlushTimer; >+ >+ public OfflineCachingStorage(ITaskDataStorage storage) { >+ this.storage = storage; >+ } >+ >+ /** >+ * FOR TESTING PURPOSES DESTROYS ALL DATA IN STORAGE >+ */ >+ public void clear() { >+ if (cacheFlushJob != null) { >+ cacheFlushJob.waitSaveCompleted(); >+ } >+ readCache.clear(); >+ writeCache.clear(); >+ lruQueue.clear(); >+ storage.clear(); >+ } >+ >+ public void flush() { >+ cacheFlushJob.waitSaveCompleted(); >+ persistToStorage(); >+ } >+ >+ public TaskDataState get(String repositoryUrl, String id) { >+ TaskDataState result = null; >+ result = retrieveFromCache(repositoryUrl, id); >+ if (result == null) { >+ result = retrieveFromStorage(repositoryUrl, id); >+ } >+ if (result != null) { >+ pushRead(result); >+ } >+ return result; >+ } >+ >+ private TaskDataState retrieveFromCache(String repositoryUrl, String id) { >+ Map<String, TaskDataState> idMap = readCache.get(repositoryUrl); >+ >+ if (idMap != null) { >+ return idMap.get(id); >+ } >+ return null; >+ } >+ >+ private TaskDataState retrieveFromStorage(String repositoryUrl, String id) { >+ TaskDataState result = null; >+ synchronized (readCache) { >+ Map<String, TaskDataState> idMap = readCache.get(repositoryUrl); >+ if (idMap == null) { >+ idMap = new HashMap<String, TaskDataState>(); >+ readCache.put(repositoryUrl, idMap); >+ } else { >+ result = idMap.get(id); >+ } >+ >+ if (result == null) { >+ result = storage.get(repositoryUrl, id); >+ if (result != null) { >+ idMap.put(id, result); >+ } >+ } >+ } >+ return result; >+ } >+ >+ public void put(TaskDataState taskDataState) { >+ putReadCache(taskDataState); >+ putWriteCache(taskDataState); >+ cacheFlushJob.requestSave(); >+ } >+ >+ public void remove(String repositoryUrl, String id) { >+ Map<String, TaskDataState> idMap = writeCache.get(repositoryUrl); >+ if (idMap != null) { >+ idMap.remove(id); >+ } >+ idMap = readCache.get(repositoryUrl); >+ if (idMap != null) { >+ idMap.remove(id); >+ } >+ >+ lruQueue.remove(new TaskDataState(repositoryUrl, id)); >+ >+ storage.remove(repositoryUrl, id); >+ } >+ >+ public void start() throws Exception { >+ storage.start(); >+ if (cacheFlushTimer == null && cacheFlushJob == null) { >+ cacheFlushTimer = new Timer(); >+ cacheFlushTimer.schedule(new RequestSaveTimerTask(), DEFAULT_FLUSH_INTERVAL, DEFAULT_FLUSH_INTERVAL); >+ cacheFlushJob = new CacheFlushJob(); >+ cacheFlushJob.schedule(); >+ } >+ } >+ >+ public void stop() throws Exception { >+ cacheFlushTimer.cancel(); >+ cacheFlushJob.cancel(); >+ this.flush(); >+ cacheFlushTimer = null; >+ cacheFlushJob = null; >+ storage.stop(); >+ } >+ >+ private void pushRead(TaskDataState state) { >+ >+ lruQueue.remove(state); >+ lruQueue.add(state); >+ if (lruQueue.size() > MAX_READ_QUEUE_SIZE) { >+ flushReadCache(false); >+ } >+ } >+ >+ private void putReadCache(TaskDataState taskDataState) { >+ if (taskDataState == null) { >+ return; >+ } >+ synchronized (readCache) { >+ >+ Map<String, TaskDataState> idMap = readCache.get(taskDataState.getUrl()); >+ if (idMap == null) { >+ idMap = new HashMap<String, TaskDataState>(); >+ readCache.put(taskDataState.getUrl(), idMap); >+ } >+ >+ idMap.put(taskDataState.getId(), taskDataState); >+ } >+ pushRead(taskDataState); >+ } >+ >+ private synchronized void putWriteCache(TaskDataState taskDataState) { >+ if (taskDataState == null) { >+ return; >+ } >+ >+ Map<String, TaskDataState> idMap = writeCache.get(taskDataState.getUrl()); >+ if (idMap == null) { >+ idMap = new HashMap<String, TaskDataState>(); >+ writeCache.put(taskDataState.getUrl(), idMap); >+ } >+ idMap.put(taskDataState.getId(), taskDataState); >+ } >+ >+ private void persistToStorage() { >+ synchronized (writeCache) { >+ >+ for (Map<String, TaskDataState> idMap : writeCache.values()) { >+ Set<TaskDataState> toRemove = new HashSet<TaskDataState>(); >+ for (Iterator<TaskDataState> it = idMap.values().iterator(); it.hasNext();) { >+ TaskDataState state = it.next(); >+ storage.put(state); >+ toRemove.add(state); >+ } >+ for (TaskDataState removedState : toRemove) { >+ idMap.remove(removedState); >+ } >+ } >+ } >+ } >+ >+ private class CacheFlushJob extends Job { >+ >+ private volatile boolean saveRequested = false; >+ >+ private volatile boolean saveCompleted = true; >+ >+ CacheFlushJob() { >+ super("Flush Cache Job"); >+ setPriority(Job.LONG); >+ setSystem(true); >+ } >+ >+ protected IStatus run(IProgressMonitor monitor) { >+ while (true) { >+ if (saveRequested) { >+ saveRequested = false; >+ saveCompleted = false; >+ persistToStorage(); >+ } >+ >+ if (!saveRequested) { >+ synchronized (this) { >+ saveCompleted = true; >+ notifyAll(); >+ try { >+ wait(); >+ } catch (InterruptedException ex) { >+ // ignore >+ } >+ } >+ } >+ } >+ } >+ >+ void requestSave() { >+ saveRequested = true; >+ } >+ >+ void runRequested() { >+ synchronized (this) { >+ notifyAll(); >+ } >+ } >+ >+ void waitSaveCompleted() { >+ while (!saveCompleted) { >+ synchronized (this) { >+ try { >+ wait(); >+ } catch (InterruptedException ex) { >+ // ignore >+ } >+ } >+ } >+ } >+ } >+ >+ private class RequestSaveTimerTask extends TimerTask { >+ >+ @Override >+ public void run() { >+ if (!Platform.isRunning()) { >+ return; >+ } else { >+ flushReadCache(false); >+ cacheFlushJob.runRequested(); >+ } >+ } >+ } >+ >+ /** >+ * @param reset >+ * if true all read cached data is dropped if false only remove until cache lower than >+ * MAX_READ_QUEUE_SIZE >+ */ >+ public void flushReadCache(boolean reset) { >+ if (reset) { >+ lruQueue.clear(); >+ readCache.clear(); >+ } else { >+ while (lruQueue.size() > MAX_READ_QUEUE_SIZE / 2) { >+ TaskDataState state = lruQueue.poll(); >+ if (state != null) { >+ Map<String, TaskDataState> tasksMap = readCache.get(state.getUrl()); >+ if (tasksMap != null) { >+ tasksMap.remove(state.getUrl()); >+ } >+ } >+ } >+ } >+ } >+ >+ /** >+ * For testing... >+ */ >+ public Queue<TaskDataState> getReadQueue() { >+ return lruQueue; >+ } >+ >+ public Map<String, Map<String, TaskDataState>> getReadCache() { >+ return readCache; >+ } >+ >+ public Map<String, Map<String, TaskDataState>> getWriteCache() { >+ return writeCache; >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/tasks/ui/OfflineFileStorage.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/OfflineFileStorage.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/OfflineFileStorage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/OfflineFileStorage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,708 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 University Of British Columbia and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * University Of British Columbia - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.tasks.ui; >+ >+import java.io.File; >+import java.io.FileInputStream; >+import java.io.FileOutputStream; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.io.OutputStreamWriter; >+import java.net.URLEncoder; >+import java.nio.channels.FileChannel; >+import java.nio.channels.FileLock; >+import java.util.ArrayList; >+import java.util.Date; >+import java.util.HashSet; >+import java.util.List; >+import java.util.Map; >+import java.util.Set; >+import java.util.zip.ZipEntry; >+import java.util.zip.ZipInputStream; >+import java.util.zip.ZipOutputStream; >+ >+import org.eclipse.mylyn.context.core.ContextCorePlugin; >+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; >+import org.eclipse.mylyn.internal.tasks.core.ITaskDataStorage; >+import org.eclipse.mylyn.internal.tasks.core.TaskDataState; >+import org.eclipse.mylyn.tasks.core.AbstractAttributeFactory; >+import org.eclipse.mylyn.tasks.core.RepositoryAttachment; >+import org.eclipse.mylyn.tasks.core.RepositoryOperation; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >+import org.eclipse.mylyn.tasks.core.TaskComment; >+import org.eclipse.ui.IMemento; >+import org.eclipse.ui.XMLMemento; >+ >+/** >+ * @author Rob Elves >+ */ >+public class OfflineFileStorage implements ITaskDataStorage { >+ >+ private static final String ATTRIBUTE_TASK_KIND = "taskKind"; >+ >+ private static final String ATTRIBUTE_IS_PATCH = "isPatch"; >+ >+ private static final String ATTRIBUTE_IS_OBSOLETE = "isObsolete"; >+ >+ private static final String ATTRIBUTE_CREATOR = "creator"; >+ >+ private static final String ATTRIBUTE_NUMBER = "number"; >+ >+ private static final String ATTRIBUTE_HAS_ATTACHMENT = "hasAttachment"; >+ >+ private static final String ATTRIBUTE_ATTACHMENT_ID = "attachmentId"; >+ >+ private static final String ATTRIBUTE_KNOB_NAME = "knob_name"; >+ >+ private static final String ATTRIBUTE_OPERATION_NAME = "operationName"; >+ >+ private static final String ATTRIBUTE_OPTION_NAME = "optionName"; >+ >+ private static final String ATTRIBUTE_OPTION_SELECTION = "optionSelection"; >+ >+ private static final String ATTRIBUTE_IS_CHECKED = "isChecked"; >+ >+ private static final String ATTRIBUTE_INPUT_NAME = "inputName"; >+ >+ private static final String ATTRIBUTE_INPUT_VALUE = "inputValue"; >+ >+ private static final String ATTRIBUTE_READONLY = "readonly"; >+ >+ private static final String ATTRIBUTE_HIDDEN = "hidden"; >+ >+ private static final String ATTRIBUTE_PARAMETER = "parameter"; >+ >+ private static final String ATTRIBUTE_VALUE = "value"; >+ >+ private static final String ELEMENT_META_DATA = "MetaData"; >+ >+ private static final String ELEMENT_META = "meta"; >+ >+ private static final String ELEMENT_OPTION = "option"; >+ >+ private static final String ELEMENT_OPTIONS = "options"; >+ >+ private static final String ELEMENT_VALUES = "values"; >+ >+ private static final String ELEMENT_VALUE = "value"; >+ >+ private static final String ELEMENT_ATTRIBUTE = "Attribute"; >+ >+ private static final String ELEMENT_NAME = "name"; >+ >+ private static final String ELEMENT_OPTION_NAMES = "optionNames"; >+ >+ private static final String ELEMENT_OPERATION = "Operation"; >+ >+ private static final String ELEMENT_SELECTED = "Selected"; >+ >+ private static final String ELEMENT_COMMENT = "Comment"; >+ >+ private static final String ELEMENT_ATTACHMENT = "Attachment"; >+ >+ private static final String ELEMENT_ATTACHMENTS = "Attachments"; >+ >+ private static final String ELEMENT_COMMENTS = "Comments"; >+ >+ private static final String ELEMENT_OPERATIONS = "Operations"; >+ >+ private static final String ELEMENT_ATTRIBUTES = "Attributes"; >+ >+ private static final String ATTRIBUTE_REPOSITORY_KIND = "repositoryKind"; >+ >+ private static final String ATTRIBUTE_REPOSITORY_URL = "repositoryUrl"; >+ >+ private static final String ATTRIBUTE_KEY = "key"; >+ >+ private static final String ATTRIBUTE_ID = "id"; >+ >+ private static final String ATTRIBUTE_NAME = "name"; >+ >+ private static final String FILE_NAME_INTERNAL = "data.xml"; >+ >+ private static final String ELEMENT_EDITS_DATA = "EditsData"; >+ >+ private static final String ELEMENT_OLD_DATA = "OldData"; >+ >+ private static final String ELEMENT_NEW_DATA = "NewData"; >+ >+ private static final String ATTRIBUTE_VERSION = "version"; >+ >+ private static final String ELEMENT_TASK_STATE = "TaskState"; >+ >+ private static final String ENCODING_UTF_8 = "UTF-8"; >+ >+ private static final String SCHEMA_VERSION = "1.0"; >+ >+ private static final String EXTENSION = ".zip"; >+ >+ private File dataDir; >+ >+ // HACK: Remove attribute factories all together!!! >+ private static final AbstractAttributeFactory temporaryFactory = new AbstractAttributeFactory() { >+ private static final long serialVersionUID = 1L; >+ >+ @Override >+ public Date getDateForAttributeType(String attributeKey, String dateString) { >+ return null; >+ } >+ >+ @Override >+ public boolean getIsHidden(String key) { >+ return false; >+ } >+ >+ @Override >+ public String getName(String key) { >+ return key; >+ } >+ >+ @Override >+ public boolean isReadOnly(String key) { >+ return false; >+ } >+ >+ @Override >+ public String mapCommonAttributeKey(String key) { >+ return key; >+ } >+ >+ }; >+ >+ public OfflineFileStorage(File rootFolder) { >+ dataDir = rootFolder; >+ } >+ >+ public void start() throws Exception { >+ if (!dataDir.exists()) { >+ dataDir.mkdirs(); >+ } >+ } >+ >+ public void stop() throws Exception { >+ // ignore >+ } >+ >+ public synchronized TaskDataState get(String repositoryUrl, String id) { >+ TaskDataState state = null; >+ FileInputStream fileInputStream = null; >+ FileLock lock = null; >+ try { >+ File dataFile = getDataFile(URLEncoder.encode(repositoryUrl, ENCODING_UTF_8), id); >+ if (dataFile != null && dataFile.exists()) { >+ >+ fileInputStream = new FileInputStream(dataFile); >+ FileChannel channel = fileInputStream.getChannel(); >+ lock = channel.tryLock(0L, Long.MAX_VALUE, true); >+ if (lock != null) { >+ state = new TaskDataState(repositoryUrl, id); >+ ZipInputStream inputStream = new ZipInputStream(fileInputStream); >+ ZipEntry entry = inputStream.getNextEntry(); >+ if (entry != null) { >+ XMLMemento input = XMLMemento.createReadRoot(new InputStreamReader(inputStream, ENCODING_UTF_8)); >+ if (input != null) { >+ readData(state, input); >+ } >+ } >+ } >+ } >+ } catch (Exception e) { >+ StatusManager.fail(e, "Error retrieving offline data", false); >+ } finally { >+ try { >+ if (lock != null && lock.isValid()) { >+ lock.release(); >+ } >+ if (fileInputStream != null) { >+ fileInputStream.close(); >+ } >+ } catch (IOException e) { >+ StatusManager.fail(e, "Error closing offline data input stream", false); >+ } >+ } >+ >+ return state; >+ } >+ >+ public synchronized void put(TaskDataState taskDataState) { >+ FileOutputStream fileOutputStream = null; >+ FileLock lock = null; >+ try { >+ String repositoryFolder = URLEncoder.encode(taskDataState.getNewTaskData().getRepositoryUrl(), >+ ENCODING_UTF_8); >+ File dataFile = getDataFile(repositoryFolder, taskDataState.getId()); >+ if (dataFile != null) { >+ if (!dataFile.getParentFile().exists()) { >+ if (!dataFile.getParentFile().mkdirs()) { >+ throw new IOException("Could not create offline data folder: " >+ + dataFile.getParentFile().getAbsolutePath()); >+ } >+ } >+ fileOutputStream = new FileOutputStream(dataFile); >+ FileChannel channel = fileOutputStream.getChannel(); >+ lock = null; >+ lock = channel.tryLock(); >+ if (lock != null) { >+ final ZipOutputStream outputStream = new ZipOutputStream(fileOutputStream); >+ outputStream.setMethod(ZipOutputStream.DEFLATED); >+ ZipEntry zipEntry = new ZipEntry(FILE_NAME_INTERNAL); >+ outputStream.putNextEntry(zipEntry); >+ >+ OutputStreamWriter writer = new OutputStreamWriter(outputStream, ENCODING_UTF_8); >+ XMLMemento memento = XMLMemento.createWriteRoot(ELEMENT_TASK_STATE); >+ memento.putString(ATTRIBUTE_VERSION, SCHEMA_VERSION); >+ if (taskDataState.getNewTaskData() != null) { >+ IMemento child = memento.createChild(ELEMENT_NEW_DATA); >+ addTaskData(child, taskDataState.getNewTaskData()); >+ } >+ if (taskDataState.getOldTaskData() != null) { >+ IMemento child = memento.createChild(ELEMENT_OLD_DATA); >+ addTaskData(child, taskDataState.getOldTaskData()); >+ } >+ if (taskDataState.getEdits() != null && taskDataState.getEdits().size() > 0) { >+ IMemento child = memento.createChild(ELEMENT_EDITS_DATA); >+ addEdits(child, taskDataState.getEdits()); >+ } >+ memento.save(writer); >+ } >+ } >+ } catch (Exception e) { >+ StatusManager.fail(e, "Error saving offline data", false); >+ } finally { >+ try { >+ if (lock != null && lock.isValid()) { >+ lock.release(); >+ } >+ if (fileOutputStream != null) { >+ fileOutputStream.flush(); >+ fileOutputStream.close(); >+ } >+ } catch (IOException e) { >+ StatusManager.fail(e, "Error closing offline data output stream", false); >+ } >+ } >+ >+ } >+ >+ private void readData(TaskDataState taskState, XMLMemento parent) { >+ IMemento newData = parent.getChild(ELEMENT_NEW_DATA); >+ if (newData != null) { >+ RepositoryTaskData newTaskData = readTaskData(newData); >+ if (newTaskData != null) { >+ taskState.setNewTaskData(newTaskData); >+ } >+ } >+ >+ IMemento oldData = parent.getChild(ELEMENT_OLD_DATA); >+ if (oldData != null) { >+ RepositoryTaskData oldTaskData = readTaskData(oldData); >+ if (oldTaskData != null) { >+ taskState.setOldTaskData(oldTaskData); >+ } >+ } >+ >+ IMemento editsData = parent.getChild(ELEMENT_EDITS_DATA); >+ if (editsData != null) { >+ Set<RepositoryTaskAttribute> edits = readEdits(editsData); >+ if (edits != null) { >+ taskState.setEdits(edits); >+ } >+ } >+ >+ } >+ >+ private RepositoryTaskData readTaskData(IMemento newData) { >+ String kind = newData.getString(ATTRIBUTE_REPOSITORY_KIND); >+ String id = newData.getString(ATTRIBUTE_ID); >+ String url = newData.getString(ATTRIBUTE_REPOSITORY_URL); >+ >+ if (kind == null || url == null || id == null) { >+ return null; >+ } >+ >+ RepositoryTaskData data = new RepositoryTaskData(temporaryFactory, kind, url, id); >+ IMemento attMemento = newData.getChild(ELEMENT_ATTRIBUTES); >+ if (attMemento != null) { >+ List<RepositoryTaskAttribute> attributes = readAttributes(attMemento); >+ for (RepositoryTaskAttribute repositoryTaskAttribute : attributes) { >+ data.addAttribute(repositoryTaskAttribute.getId(), repositoryTaskAttribute); >+ } >+ } >+ >+ IMemento opsMemento = newData.getChild(ELEMENT_OPERATIONS); >+ if (opsMemento != null) { >+ List<RepositoryOperation> operations = readOperations(opsMemento); >+ for (RepositoryOperation operation : operations) { >+ data.addOperation(operation); >+ } >+ } >+ >+ IMemento commentsMemento = newData.getChild(ELEMENT_COMMENTS); >+ if (commentsMemento != null) { >+ List<TaskComment> comments = readComments(commentsMemento); >+ for (TaskComment comment : comments) { >+ data.addComment(comment); >+ } >+ } >+ >+ IMemento attachmentsMemento = newData.getChild(ELEMENT_ATTACHMENTS); >+ if (attachmentsMemento != null) { >+ List<RepositoryAttachment> attachments = readAttachments(attachmentsMemento); >+ for (RepositoryAttachment attachment : attachments) { >+ data.addAttachment(attachment); >+ } >+ } >+ >+ return data; >+ >+ } >+ >+ private void addEdits(IMemento parent, Set<RepositoryTaskAttribute> edits) { >+ List<RepositoryTaskAttribute> changedAttributes = new ArrayList<RepositoryTaskAttribute>(); >+ changedAttributes.addAll(edits); >+ addAttributes(parent, changedAttributes); >+ } >+ >+ private Set<RepositoryTaskAttribute> readEdits(IMemento parent) { >+ return new HashSet<RepositoryTaskAttribute>(readAttributes(parent)); >+ } >+ >+ private void addTaskData(IMemento parent, RepositoryTaskData newTaskData) { >+ parent.putString(ATTRIBUTE_ID, getText(newTaskData.getId())); >+ parent.putString(ATTRIBUTE_TASK_KIND, getText(newTaskData.getTaskKind())); >+ parent.putString(ATTRIBUTE_REPOSITORY_URL, getText(newTaskData.getRepositoryUrl())); >+ parent.putString(ATTRIBUTE_REPOSITORY_KIND, getText(newTaskData.getRepositoryKind())); >+ >+ IMemento attributes = parent.createChild(ELEMENT_ATTRIBUTES); >+ addAttributes(attributes, newTaskData.getAttributes()); >+ >+ IMemento operations = parent.createChild(ELEMENT_OPERATIONS); >+ addOperations(operations, newTaskData.getOperations()); >+ if (newTaskData.getSelectedOperation() != null) { >+ addSelectedOperation(operations, newTaskData.getSelectedOperation()); >+ } >+ >+ IMemento comments = parent.createChild(ELEMENT_COMMENTS); >+ addComments(comments, newTaskData.getComments()); >+ >+ IMemento attachments = parent.createChild(ELEMENT_ATTACHMENTS); >+ addAttachments(attachments, newTaskData.getAttachments()); >+ >+ } >+ >+ public void addAttachments(IMemento parent, List<RepositoryAttachment> attachments) { >+ for (RepositoryAttachment attachment : attachments) { >+ IMemento memento = parent.createChild(ELEMENT_ATTACHMENT); >+ memento.putString(ATTRIBUTE_IS_PATCH, String.valueOf(attachment.isPatch())); >+ memento.putString(ATTRIBUTE_IS_OBSOLETE, String.valueOf(attachment.isObsolete())); >+ memento.putString(ATTRIBUTE_CREATOR, getText(attachment.getCreator())); >+ memento.putString(ATTRIBUTE_ID, getText(attachment.getTaskId())); >+ memento.putString(ATTRIBUTE_REPOSITORY_KIND, getText(attachment.getRepositoryKind())); >+ memento.putString(ATTRIBUTE_REPOSITORY_URL, getText(attachment.getRepositoryUrl())); >+ IMemento attributes = memento.createChild(ELEMENT_ATTRIBUTES); >+ addAttributes(attributes, attachment.getAttributes()); >+ } >+ } >+ >+ public List<RepositoryAttachment> readAttachments(IMemento parent) { >+ List<RepositoryAttachment> attachments = new ArrayList<RepositoryAttachment>(); >+ for (IMemento attachmentMemento : parent.getChildren(ELEMENT_ATTACHMENT)) { >+ RepositoryAttachment attachment = new RepositoryAttachment(temporaryFactory); >+ String isPatch = attachmentMemento.getString(ATTRIBUTE_IS_PATCH); >+ String isObsolete = attachmentMemento.getString(ATTRIBUTE_IS_OBSOLETE); >+ String taskId = attachmentMemento.getString(ATTRIBUTE_ID); >+ String creator = attachmentMemento.getString(ATTRIBUTE_CREATOR); >+ String repositoryKind = attachmentMemento.getString(ATTRIBUTE_REPOSITORY_KIND); >+ String repositoryUrl = attachmentMemento.getString(ATTRIBUTE_REPOSITORY_URL); >+ >+ if (isPatch != null) { >+ attachment.setPatch(Boolean.parseBoolean(isPatch)); >+ } >+ if (isObsolete != null) { >+ attachment.setObsolete(Boolean.parseBoolean(isObsolete)); >+ } >+ if (creator != null) { >+ attachment.setCreator(creator); >+ } >+ if (repositoryKind != null) { >+ attachment.setRepositoryKind(repositoryKind); >+ } >+ if (repositoryUrl != null) { >+ attachment.setRepositoryUrl(repositoryUrl); >+ } >+ if (taskId != null) { >+ attachment.setTaskId(taskId); >+ } >+ IMemento attributesMemento = attachmentMemento.getChild(ELEMENT_ATTRIBUTES); >+ if (attributesMemento != null) { >+ List<RepositoryTaskAttribute> attributes = readAttributes(attributesMemento); >+ for (RepositoryTaskAttribute repositoryTaskAttribute : attributes) { >+ attachment.addAttribute(repositoryTaskAttribute.getId(), repositoryTaskAttribute); >+ } >+ } >+ attachments.add(attachment); >+ } >+ return attachments; >+ } >+ >+ public void addComments(IMemento parent, List<TaskComment> comments) { >+ for (TaskComment taskComment : comments) { >+ IMemento comment = parent.createChild(ELEMENT_COMMENT); >+ comment.putInteger(ATTRIBUTE_NUMBER, taskComment.getNumber()); >+ comment.putString(ATTRIBUTE_HAS_ATTACHMENT, String.valueOf(taskComment.hasAttachment())); >+ comment.putString(ATTRIBUTE_ATTACHMENT_ID, getText(taskComment.getAttachmentId())); >+ IMemento attributes = comment.createChild(ELEMENT_ATTRIBUTES); >+ addAttributes(attributes, taskComment.getAttributes()); >+ } >+ } >+ >+ public List<TaskComment> readComments(IMemento parent) { >+ List<TaskComment> comments = new ArrayList<TaskComment>(); >+ for (IMemento commentMemento : parent.getChildren(ELEMENT_COMMENT)) { >+ Integer commentNumber = commentMemento.getInteger(ATTRIBUTE_NUMBER); >+ String hasAttachment = commentMemento.getString(ATTRIBUTE_HAS_ATTACHMENT); >+ String attachmentId = commentMemento.getString(ATTRIBUTE_ATTACHMENT_ID); >+ if (commentNumber != null) { >+ TaskComment comment = new TaskComment(temporaryFactory, commentNumber); >+ if (hasAttachment != null) { >+ comment.setHasAttachment(Boolean.parseBoolean(hasAttachment)); >+ } >+ if (attachmentId != null) { >+ comment.setAttachmentId(attachmentId); >+ } >+ IMemento attributesMemento = commentMemento.getChild(ELEMENT_ATTRIBUTES); >+ if (attributesMemento != null) { >+ List<RepositoryTaskAttribute> attributes = readAttributes(attributesMemento); >+ for (RepositoryTaskAttribute repositoryTaskAttribute : attributes) { >+ comment.addAttribute(repositoryTaskAttribute.getId(), repositoryTaskAttribute); >+ } >+ } >+ comments.add(comment); >+ } >+ } >+ return comments; >+ } >+ >+ private void addSelectedOperation(IMemento operations, RepositoryOperation selectedOperation) { >+ IMemento selected = operations.createChild(ELEMENT_SELECTED); >+ ArrayList<RepositoryOperation> list = new ArrayList<RepositoryOperation>(); >+ list.add(selectedOperation); >+ addOperations(selected, list); >+ } >+ >+ public void addOperations(IMemento parent, List<RepositoryOperation> operations) { >+ for (RepositoryOperation operation : operations) { >+ IMemento operationMemento = parent.createChild(ELEMENT_OPERATION); >+ operationMemento.putString(ATTRIBUTE_KNOB_NAME, getText(operation.getKnobName())); >+ operationMemento.putString(ATTRIBUTE_OPERATION_NAME, getText(operation.getOperationName())); >+ operationMemento.putString(ATTRIBUTE_OPTION_NAME, getText(operation.getOptionName())); >+ operationMemento.putString(ATTRIBUTE_OPTION_SELECTION, getText(operation.getOptionSelection())); >+ operationMemento.putString(ATTRIBUTE_IS_CHECKED, String.valueOf(operation.isChecked())); >+ operationMemento.putString(ATTRIBUTE_INPUT_NAME, getText(operation.getInputName())); >+ operationMemento.putString(ATTRIBUTE_INPUT_VALUE, getText(operation.getInputValue())); >+ >+ if (operation.getOptionNames() != null && operation.getOptionNames().size() > 0) { >+ IMemento optionNames = operationMemento.createChild(ELEMENT_OPTION_NAMES); >+ for (String name : operation.getOptionNames()) { >+ IMemento nameMemento = optionNames.createChild(ELEMENT_NAME); >+ nameMemento.putTextData(getText(name)); >+ nameMemento.putString(ATTRIBUTE_VALUE, getText(operation.getOptionValue(name))); >+ } >+ } >+ } >+ } >+ >+ /* public for testing */ >+ public List<RepositoryOperation> readOperations(IMemento parent) { >+ List<RepositoryOperation> operations = new ArrayList<RepositoryOperation>(); >+ for (IMemento operationMemento : parent.getChildren(ELEMENT_OPERATION)) { >+ String knobName = operationMemento.getString(ATTRIBUTE_KNOB_NAME); >+ String operationName = operationMemento.getString(ATTRIBUTE_OPERATION_NAME); >+ String optionName = operationMemento.getString(ATTRIBUTE_OPTION_NAME); >+ String selection = operationMemento.getString(ATTRIBUTE_OPTION_SELECTION); >+ String isChecked = operationMemento.getString(ATTRIBUTE_IS_CHECKED); >+ String inputName = operationMemento.getString(ATTRIBUTE_INPUT_NAME); >+ String inputValue = operationMemento.getString(ATTRIBUTE_INPUT_VALUE); >+ >+ if (knobName == null || operationName == null) >+ continue; >+ >+ RepositoryOperation op = new RepositoryOperation(knobName, operationName); >+ if (optionName != null) { >+ op.setUpOptions(optionName); >+ } >+ if (isChecked != null) { >+ op.setChecked(Boolean.parseBoolean(isChecked)); >+ } >+ if (inputName != null) { >+ op.setInputName(inputName); >+ } >+ if (inputValue != null) { >+ op.setInputValue(inputValue); >+ } >+ >+ IMemento optionNames = operationMemento.getChild(ELEMENT_OPTION_NAMES); >+ if (optionNames != null) { >+ for (IMemento nameMemento : optionNames.getChildren(ELEMENT_NAME)) { >+ if (nameMemento.getTextData() != null && nameMemento.getTextData().length() > 0) { >+ op.addOption(nameMemento.getTextData(), nameMemento.getString(ATTRIBUTE_VALUE)); >+ } >+ } >+ } >+ >+ // Selection must be applied after addition of options >+ if (selection != null) { >+ op.setOptionSelection(selection); >+ } >+ >+ operations.add(op); >+ >+ } >+ return operations; >+ } >+ >+ /* public for testing */ >+ public void addAttributes(IMemento parent, List<RepositoryTaskAttribute> attributes) { >+ for (RepositoryTaskAttribute attribute : attributes) { >+ IMemento attribMemento = parent.createChild(ELEMENT_ATTRIBUTE); >+ attribMemento.putString(ATTRIBUTE_ID, getText(attribute.getId())); >+ attribMemento.putString(ATTRIBUTE_NAME, getText(attribute.getName())); >+ attribMemento.putString(ATTRIBUTE_HIDDEN, String.valueOf(attribute.isHidden())); >+ attribMemento.putString(ATTRIBUTE_READONLY, String.valueOf(attribute.isReadOnly())); >+ >+ IMemento values = attribMemento.createChild(ELEMENT_VALUES); >+ for (String value : attribute.getValues()) { >+ values.createChild(ELEMENT_VALUE).putTextData(getText(value)); >+ } >+ >+ IMemento options = attribMemento.createChild(ELEMENT_OPTIONS); >+ for (String optionValue : attribute.getOptions()) { >+ IMemento option = options.createChild(ELEMENT_OPTION); >+ option.putTextData(getText(optionValue)); >+ String parameter = attribute.getOptionParameter(optionValue); >+ if (parameter != null) { >+ option.putString(ATTRIBUTE_PARAMETER, getText(parameter)); >+ } >+ } >+ IMemento metaData = attribMemento.createChild(ELEMENT_META_DATA); >+ Map<String, String> metadata = attribute.getMetaData(); >+ if (metadata != null && metadata.size() > 0) { >+ for (String key : metadata.keySet()) { >+ IMemento meta = metaData.createChild(ELEMENT_META); >+ meta.putString(ATTRIBUTE_KEY, getText(key)); >+ meta.putTextData(getText(metadata.get(key))); >+ } >+ } >+ } >+ } >+ >+ private String getText(String text) { >+ if (text == null) >+ return null; >+ return ContextCorePlugin.cleanXmlString(text); >+ } >+ >+ /* public for testing */ >+ public List<RepositoryTaskAttribute> readAttributes(IMemento parent) { >+ List<RepositoryTaskAttribute> attributes = new ArrayList<RepositoryTaskAttribute>(); >+ for (IMemento attrMemento : parent.getChildren(ELEMENT_ATTRIBUTE)) { >+ String id = attrMemento.getString(ATTRIBUTE_ID); >+ String name = attrMemento.getString(ATTRIBUTE_NAME); >+ String hidden = attrMemento.getString(ATTRIBUTE_HIDDEN); >+ if (id != null && name != null && hidden != null) { >+ RepositoryTaskAttribute attribute = new RepositoryTaskAttribute(id, name, Boolean.parseBoolean(hidden)); >+ attributes.add(attribute); >+ String readOnly = attrMemento.getString(ATTRIBUTE_READONLY); >+ if (readOnly != null) { >+ attribute.setReadOnly(Boolean.parseBoolean(readOnly)); >+ } >+ >+ IMemento values = attrMemento.getChild(ELEMENT_VALUES); >+ if (values != null) { >+ for (IMemento valueMemento : values.getChildren(ELEMENT_VALUE)) { >+ attribute.addValue(valueMemento.getTextData()); >+ } >+ } >+ >+ IMemento options = attrMemento.getChild(ELEMENT_OPTIONS); >+ if (options != null) { >+ for (IMemento optionMemento : options.getChildren(ELEMENT_OPTION)) { >+ attribute.addOption(optionMemento.getTextData(), optionMemento.getString(ATTRIBUTE_PARAMETER)); >+ } >+ } >+ >+ IMemento metaData = attrMemento.getChild(ELEMENT_META_DATA); >+ if (metaData != null) { >+ for (IMemento optionMemento : metaData.getChildren(ELEMENT_META)) { >+ attribute.putMetaDataValue(optionMemento.getString(ATTRIBUTE_KEY), optionMemento.getTextData()); >+ } >+ } >+ } >+ } >+ return attributes; >+ } >+ >+ public void remove(String repositoryUrl, String id) { >+ if (repositoryUrl == null || id == null) >+ return; >+ File file; >+ try { >+ file = getDataFile(URLEncoder.encode(repositoryUrl, ENCODING_UTF_8), id); >+ if (file != null && file.exists()) { >+ file.delete(); >+ } >+ >+ if (file != null && file.getParentFile() != null && file.getParentFile().exists() >+ && file.getParentFile().list().length == 0) { >+ file.getParentFile().delete(); >+ } >+ >+ // TODO: Remove folder if last file removed >+ >+ } catch (Exception e) { >+ StatusManager.fail(e, "Error removing offline data: " + repositoryUrl + "-" + id, false); >+ } >+ >+ } >+ >+ private File getDataFile(String folder, String id) throws IOException { >+ File repositoryFolder = new File(dataDir, folder); >+ File dataFile = new File(repositoryFolder, id + EXTENSION); >+ return dataFile; >+ } >+ >+ /** >+ * Delete entire offline repositoy contents, FOR TESTING ONLY >+ */ >+ public void clear() { >+ if (dataDir.exists()) { >+ for (File file : dataDir.listFiles()) { >+ destroy(file); >+ } >+ } >+ } >+ >+ private void destroy(File folder) { >+ if (folder.isDirectory()) { >+ for (File file : folder.listFiles()) { >+ destroy(file); >+ } >+ } >+ folder.delete(); >+ } >+ >+ public void flush() { >+ // ignore; >+ } >+ >+} >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java,v >retrieving revision 1.65 >diff -u -r1.65 BugzillaRepositoryConnector.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 15 Jun 2007 22:04:39 -0000 1.65 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 18 Jun 2007 18:10:12 -0000 >@@ -433,7 +433,7 @@ > throws CoreException { > String product = existingReport.getAttributeValue(BugzillaReportElement.PRODUCT.getKeyString()); > for (RepositoryTaskAttribute attribute : existingReport.getAttributes()) { >- BugzillaReportElement element = BugzillaReportElement.valueOf(attribute.getID().trim().toUpperCase( >+ BugzillaReportElement element = BugzillaReportElement.valueOf(attribute.getId().trim().toUpperCase( > Locale.ENGLISH)); > attribute.clearOptions(); > List<String> optionValues = BugzillaCorePlugin.getRepositoryConfiguration(taskRepository, false) >Index: src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java,v >retrieving revision 1.33 >diff -u -r1.33 AbstractReportFactory.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java 8 Jun 2007 00:35:34 -0000 1.33 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java 18 Jun 2007 18:10:12 -0000 >@@ -58,24 +58,24 @@ > > final BufferedInputStream is = new BufferedInputStream(inStream, 1024); > >- // Remove control characters other than \\n and \\r >- InputStream iis = new InputStream() { >- public int read() throws IOException { >- int c; >- while ((c = is.read()) != -1) { >- if (!Character.isISOControl(c) || c == '\n' || c == '\r') { >- return c; >- } >- } >- return -1; >- } >- }; >+ // filtered upon tasklist and offline taskdata externalization >+// InputStream iis = new InputStream() { >+// public int read() throws IOException { >+// int c; >+// while ((c = is.read()) != -1) { >+// if (!Character.isISOControl(c) || c == '\n' || c == '\r') { >+// return c; >+// } >+// } >+// return -1; >+// } >+// }; > > Reader in; > if (characterEncoding != null) { >- in = new InputStreamReader(iis, characterEncoding); >+ in = new InputStreamReader(is, characterEncoding); > } else { >- in = new InputStreamReader(iis); >+ in = new InputStreamReader(is); > } > > if (in != null && clean) { >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java,v >retrieving revision 1.26 >diff -u -r1.26 BugzillaTask.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java 13 Jun 2007 08:00:14 -0000 1.26 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTask.java 18 Jun 2007 18:10:12 -0000 >@@ -24,20 +24,12 @@ > private String severity; > > private String product; >- >+ > public BugzillaTask(String repositoryUrl, String id, String label) { > super(repositoryUrl, id, label); > setTaskUrl(BugzillaClient.getBugUrlWithoutLogin(repositoryUrl, id)); >-// if (newTask) { >-// setSyncState(RepositoryTaskSyncState.INCOMING); >-// } > } > >-// public BugzillaTask(BugzillaQueryHit hit, boolean newTask) { >-// this(hit.getRepositoryUrl(), hit.getTaskId(), hit.getSummary(), newTask); >-// setPriority(hit.getPriority()); >-// } >- > @Override > public String getTaskKind() { > return IBugzillaConstants.BUGZILLA_TASK_KIND; >Index: src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java,v >retrieving revision 1.14 >diff -u -r1.14 SaxBugzillaQueryContentHandler.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java 15 Jun 2007 22:04:39 -0000 1.14 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/SaxBugzillaQueryContentHandler.java 18 Jun 2007 18:10:12 -0000 >@@ -37,9 +37,6 @@ > /** The priority of the bug */ > private String priority = AbstractTask.PriorityLevel.getDefault().toString(); > >- /** The state of the bug */ >- private String state = ""; >- > private StringBuffer characters; > > private ITaskCollector collector; >@@ -116,7 +113,7 @@ > //hit.setOwner(parsedText); > break; > case BUG_STATUS: >- state = parsedText; >+ // state = parsedText; > break; > // case RESOLUTION: > // resolution = parsedText; >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java,v >retrieving revision 1.76 >diff -u -r1.76 BugzillaClient.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 15 Jun 2007 22:04:39 -0000 1.76 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 18 Jun 2007 18:10:12 -0000 >@@ -807,7 +807,7 @@ > Iterator<RepositoryTaskAttribute> itr = taskData.getAttributes().iterator(); > while (itr.hasNext()) { > RepositoryTaskAttribute a = itr.next(); >- if (a != null && a.getID() != null && a.getID().compareTo("") != 0) { >+ if (a != null && a.getId() != null && a.getId().compareTo("") != 0) { > String value = null; > value = a.getValue(); > if (value == null) >@@ -815,7 +815,7 @@ > > cleanQAContact(a); > >- fields.put(a.getID(), new NameValuePair(a.getID(), value)); >+ fields.put(a.getId(), new NameValuePair(a.getId(), value)); > } > } > >@@ -828,7 +828,7 @@ > } > > private void cleanQAContact(RepositoryTaskAttribute a) { >- if (a.getID().equals(BugzillaReportElement.QA_CONTACT.getKeyString())) { >+ if (a.getId().equals(BugzillaReportElement.QA_CONTACT.getKeyString())) { > if ("true".equals(configParameters.get(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN))) { > if (a.getValue() != null && a.getValue().length() > 0) { > int atIndex = a.getValue().indexOf("@"); >@@ -851,19 +851,19 @@ > RepositoryTaskAttribute a = it.next(); > if (a == null) { > continue; >- } else if (a.getID().equals(BugzillaReportElement.CC.getKeyString()) >- || a.getID().equals(RepositoryTaskAttribute.REMOVE_CC) >- || a.getID().equals(BugzillaReportElement.REPORTER.getKeyString()) >- || a.getID().equals(BugzillaReportElement.ASSIGNED_TO.getKeyString()) >- || a.getID().equals(BugzillaReportElement.CREATION_TS.getKeyString())) { >+ } else if (a.getId().equals(BugzillaReportElement.CC.getKeyString()) >+ || a.getId().equals(RepositoryTaskAttribute.REMOVE_CC) >+ || a.getId().equals(BugzillaReportElement.REPORTER.getKeyString()) >+ || a.getId().equals(BugzillaReportElement.ASSIGNED_TO.getKeyString()) >+ || a.getId().equals(BugzillaReportElement.CREATION_TS.getKeyString())) { > continue; >- } else if (a.getID() != null && a.getID().compareTo("") != 0) { >+ } else if (a.getId() != null && a.getId().compareTo("") != 0) { > cleanQAContact(a); > String value = a.getValue(); >- if (a.getID().equals(BugzillaReportElement.DELTA_TS.getKeyString())) { >+ if (a.getId().equals(BugzillaReportElement.DELTA_TS.getKeyString())) { > value = stripTimeZone(value); > } >- fields.put(a.getID(), new NameValuePair(a.getID(), value != null ? value : "")); >+ fields.put(a.getId(), new NameValuePair(a.getId(), value != null ? value : "")); > } > } > >#P org.eclipse.mylyn.web.tasks >Index: src/org/eclipse/mylyn/internal/web/tasks/BrowserFormPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.web.tasks/src/org/eclipse/mylyn/internal/web/tasks/BrowserFormPage.java,v >retrieving revision 1.1 >diff -u -r1.1 BrowserFormPage.java >--- src/org/eclipse/mylyn/internal/web/tasks/BrowserFormPage.java 16 Jun 2007 01:59:46 -0000 1.1 >+++ src/org/eclipse/mylyn/internal/web/tasks/BrowserFormPage.java 18 Jun 2007 18:10:13 -0000 >@@ -15,12 +15,9 @@ > import org.eclipse.swt.SWTError; > import org.eclipse.swt.browser.Browser; > import org.eclipse.swt.layout.FillLayout; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; > import org.eclipse.ui.forms.IManagedForm; > import org.eclipse.ui.forms.editor.FormEditor; > import org.eclipse.ui.forms.editor.FormPage; >-import org.eclipse.ui.forms.widgets.FormToolkit; > import org.eclipse.ui.forms.widgets.ScrolledForm; > > /** >#P org.eclipse.mylyn.jira.ui >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java,v >retrieving revision 1.50 >diff -u -r1.50 JiraTaskDataHandler.java >--- src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java 15 Jun 2007 22:04:26 -0000 1.50 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraTaskDataHandler.java 18 Jun 2007 18:10:14 -0000 >@@ -215,7 +215,7 @@ > } > > for (RepositoryTaskAttribute attribute : links.values()) { >- data.addAttribute(attribute.getID(), attribute); >+ data.addAttribute(attribute.getId(), attribute); > } > } > >@@ -325,7 +325,7 @@ > attribute.addValue(value); > } > } >- data.addAttribute(attribute.getID(), attribute); >+ data.addAttribute(attribute.getId(), attribute); > } > > // TODO move into server configuration and populate lazily >@@ -334,7 +334,7 @@ > // avoid server round-trips > for (RepositoryTaskAttribute attribute : oldTaskData.getAttributes()) { > if (!attribute.isReadOnly()) { >- editableKeys.add(attribute.getID()); >+ editableKeys.add(attribute.getId()); > } > } > } else { >@@ -345,7 +345,7 @@ > for (RepositoryTaskAttribute attribute : editableAttributes) { > // System.err.println(" " + attribute.getID() + " : " + > // attribute.getName()); >- editableKeys.add(attributeFactory.mapCommonAttributeKey(attribute.getID())); >+ editableKeys.add(attributeFactory.mapCommonAttributeKey(attribute.getId())); > } > } > } catch (JiraInsufficientPermissionException ex) { >@@ -354,9 +354,9 @@ > } > > for (RepositoryTaskAttribute attribute : data.getAttributes()) { >- boolean editable = editableKeys.contains(attribute.getID().toLowerCase()); >+ boolean editable = editableKeys.contains(attribute.getId().toLowerCase()); > attribute.setReadOnly(!editable); >- if (editable && !attributeFactory.getIsHidden(attribute.getID())) { >+ if (editable && !attributeFactory.getIsHidden(attribute.getId())) { > attribute.setHidden(false); > } > >@@ -680,8 +680,8 @@ > > ArrayList<CustomField> customFields = new ArrayList<CustomField>(); > for (RepositoryTaskAttribute attr : taskData.getAttributes()) { >- if (attr.getID().startsWith(JiraAttributeFactory.ATTRIBUTE_CUSTOM_PREFIX)) { >- String id = attr.getID().substring(JiraAttributeFactory.ATTRIBUTE_CUSTOM_PREFIX.length()); >+ if (attr.getId().startsWith(JiraAttributeFactory.ATTRIBUTE_CUSTOM_PREFIX)) { >+ String id = attr.getId().substring(JiraAttributeFactory.ATTRIBUTE_CUSTOM_PREFIX.length()); > customFields.add(new CustomField(id, attr.getMetaDataValue(JiraAttributeFactory.TYPE_KEY), attr > .getName(), attr.getValues())); > } >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/JiraRepositoryConnector.java,v >retrieving revision 1.58 >diff -u -r1.58 JiraRepositoryConnector.java >--- src/org/eclipse/mylyn/internal/jira/ui/JiraRepositoryConnector.java 15 Jun 2007 22:04:26 -0000 1.58 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraRepositoryConnector.java 18 Jun 2007 18:10:14 -0000 >@@ -40,7 +40,6 @@ > import org.eclipse.mylyn.internal.jira.core.service.JiraClient; > import org.eclipse.mylyn.internal.jira.core.service.JiraException; > import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; >-import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil; > import org.eclipse.mylyn.tasks.core.AbstractAttributeFactory; > import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery; >@@ -152,8 +151,7 @@ > return Status.CANCEL_STATUS; > > monitor.subTask(++n + "/" + issues.size() + " " + issue.getKey() + " " + issue.getSummary()); >- String handle = RepositoryTaskHandleUtil.getHandle(repository.getUrl(), issue.getId()); >- RepositoryTaskData oldTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(handle); >+ RepositoryTaskData oldTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(repository.getUrl(), issue.getId()); > resultCollector.accept(offlineHandler.createTaskData(repository, client, issue, oldTaskData)); > } > return Status.OK_STATUS; >@@ -223,8 +221,7 @@ > } > > monitor.subTask(++n + "/" + issues.size() + " " + issue.getKey() + " " + issue.getSummary()); >- String handle = RepositoryTaskHandleUtil.getHandle(repository.getUrl(), issue.getId()); >- RepositoryTaskData oldTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(handle); >+ RepositoryTaskData oldTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(repository.getUrl(), issue.getId()); > RepositoryTaskData taskData = offlineHandler.createTaskData(repository, client, issue, oldTaskData); > factory.createTask(taskData, new NullProgressMonitor()); > >Index: src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java,v >retrieving revision 1.14 >diff -u -r1.14 JiraAttributeFactory.java >--- src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java 15 Jun 2007 22:04:26 -0000 1.14 >+++ src/org/eclipse/mylyn/internal/jira/ui/JiraAttributeFactory.java 18 Jun 2007 18:10:14 -0000 >@@ -46,7 +46,7 @@ > @Override > public RepositoryTaskAttribute createAttribute(String key) { > RepositoryTaskAttribute attribute = super.createAttribute(key); >- attribute.putMetaDataValue(TYPE_KEY, JiraAttribute.valueById(attribute.getID()).getKey()); >+ attribute.putMetaDataValue(TYPE_KEY, JiraAttribute.valueById(attribute.getId()).getKey()); > return attribute; > } > >#P org.eclipse.mylyn.bugzilla.tests >Index: src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java,v >retrieving revision 1.107 >diff -u -r1.107 BugzillaRepositoryConnectorTest.java >--- src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java 14 Jun 2007 21:20:24 -0000 1.107 >+++ src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java 18 Jun 2007 18:10:15 -0000 >@@ -14,7 +14,6 @@ > import java.io.BufferedWriter; > import java.io.File; > import java.io.FileWriter; >-import java.util.ArrayList; > import java.util.Date; > import java.util.HashSet; > import java.util.Iterator; >@@ -190,7 +189,8 @@ > task.getHandleIdentifier()); > assertNotNull(taskData); > >- TasksUiPlugin.getTaskListManager().getTaskList().moveToContainer(task, TasksUiPlugin.getTaskListManager().getTaskList().getDefaultCategory()); >+ TasksUiPlugin.getTaskListManager().getTaskList().moveToContainer(task, >+ TasksUiPlugin.getTaskListManager().getTaskList().getDefaultCategory()); > int numComments = taskData.getComments().size(); > > // Modify it >@@ -198,7 +198,7 @@ > taskData.setNewComment(newCommentText); > Set<RepositoryTaskAttribute> changed = new HashSet<RepositoryTaskAttribute>(); > changed.add(taskData.getAttribute(RepositoryTaskAttribute.COMMENT_NEW)); >- TasksUiPlugin.getDefault().getTaskDataManager().saveEdits(task.getHandleIdentifier(), changed); >+ TasksUiPlugin.getDefault().getTaskDataManager().saveEdits(task.getRepositoryUrl(), task.getTaskId(), changed); > > // Submit changes > submit(task, taskData); >@@ -219,7 +219,7 @@ > // because task doesn't have bug report (new query hit) > // Result: retrieved with no incoming status > // task.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED); >- TasksUiPlugin.getDefault().getTaskDataManager().remove(task.getHandleIdentifier()); >+ TasksUiPlugin.getDefault().getTaskDataManager().remove(task.getRepositoryUrl(), task.getTaskId()); > TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, false, null); > assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); > RepositoryTaskData bugReport2 = null; >@@ -244,13 +244,13 @@ > BugzillaTask query1Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description1"); > taskList.addQuery(query1); > taskList.addTask(query1Hit, query1); >- >+ > BugzillaRepositoryQuery query2 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL, > "queryurl2", "description2"); > BugzillaTask query2Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description2"); > taskList.addQuery(query2); > taskList.addTask(query2Hit, query1); >- >+ > assertEquals(2, taskList.getQueries().size()); > assertEquals(1, taskList.getAllTasks().size()); > for (AbstractTask hit : query1.getHits()) { >@@ -423,7 +423,6 @@ > > TasksUiPlugin.getSynchronizationManager().synchronize(connector, tasks, true, null); > >- > for (AbstractTask task : tasks) { > if (task.getTaskId() == "4") { > assertEquals(priority4, task4.getPriority()); >@@ -451,11 +450,8 @@ > TasksUiPlugin.getRepositoryManager().setSyncTime(repository, task7.getLastSyncDateStamp(), > TasksUiPlugin.getDefault().getRepositoriesFilePath()); > >- assertNotNull(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( >- RepositoryTaskHandleUtil.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL, "7"))); >- ArrayList<String> taskDataList = new ArrayList<String>(); >- taskDataList.add(task7.getHandleIdentifier()); >- TasksUiPlugin.getDefault().getTaskDataManager().remove(taskDataList); >+ assertNotNull(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(IBugzillaConstants.TEST_BUGZILLA_222_URL, "7")); >+ TasksUiPlugin.getDefault().getTaskDataManager().remove(task7.getRepositoryUrl(), task7.getTaskId()); > > assertNull(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( > RepositoryTaskHandleUtil.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL, "7"))); >@@ -475,8 +471,8 @@ > priority = "P1"; > recentTaskData.setAttributeValue(BugzillaReportElement.PRIORITY.getKeyString(), priority); > } >- TasksUiPlugin.getDefault().getTaskDataManager().clear(); // NO TASK >- // DATA >+ // REMOVE ALL TASK DATA >+ TasksUiPlugin.getDefault().getTaskDataManager().clear(); > connector.getTaskDataHandler().postTaskData(repository, recentTaskData, new NullProgressMonitor()); > TasksUiPlugin.getSynchronizationManager().synchronizeChanged(connector, repository); > assertEquals(RepositoryTaskSyncState.INCOMING, task7.getSyncState()); >@@ -536,10 +532,8 @@ > float estimatedTime, remainingTime, actualTime, addTime; > String deadline = null; > >- estimatedTime = Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ESTIMATED_TIME >- .getKeyString())); >- remainingTime = Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.REMAINING_TIME >- .getKeyString())); >+ estimatedTime = Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ESTIMATED_TIME.getKeyString())); >+ remainingTime = Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.REMAINING_TIME.getKeyString())); > actualTime = Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ACTUAL_TIME.getKeyString())); > if (enableDeadline) > deadline = bugtaskdata.getAttributeValue(BugzillaReportElement.DEADLINE.getKeyString()); >@@ -556,24 +550,24 @@ > if (enableDeadline) > bugtaskdata.setAttributeValue(BugzillaReportElement.DEADLINE.getKeyString(), deadline); > >- for (AbstractTask task : tasks) { >- RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( >- task.getHandleIdentifier()); >- taskData.setAttributeValue(BugzillaReportElement.ADD_COMMENT.getKeyString(), "New Estimate: " >+// for (AbstractTask task : tasks) { >+// RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( >+// task.getHandleIdentifier()); >+ bugtaskdata.setAttributeValue(BugzillaReportElement.ADD_COMMENT.getKeyString(), "New Estimate: " > + estimatedTime + "\nNew Remaining: " + remainingTime + "\nAdd: " + addTime); >- submit(task, taskData); >- } >+ submit(bugtask, bugtaskdata); >+// } > > synchAndAssertState(tasks, RepositoryTaskSyncState.SYNCHRONIZED); > > bugtaskdata = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(bugtask.getHandleIdentifier()); > >- assertEquals(estimatedTime, Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ESTIMATED_TIME >- .getKeyString()))); >- assertEquals(remainingTime, Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.REMAINING_TIME >- .getKeyString()))); >- assertEquals(actualTime + addTime, Float.parseFloat(bugtaskdata >- .getAttributeValue(BugzillaReportElement.ACTUAL_TIME.getKeyString()))); >+ assertEquals(estimatedTime, >+ Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ESTIMATED_TIME.getKeyString()))); >+ assertEquals(remainingTime, >+ Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.REMAINING_TIME.getKeyString()))); >+ assertEquals(actualTime + addTime, >+ Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ACTUAL_TIME.getKeyString()))); > if (enableDeadline) > assertEquals(deadline, bugtaskdata.getAttributeValue(BugzillaReportElement.DEADLINE.getKeyString())); > >Index: src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java,v >retrieving revision 1.24 >diff -u -r1.24 AbstractBugzillaTest.java >--- src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java 14 Jun 2007 08:31:34 -0000 1.24 >+++ src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java 18 Jun 2007 18:10:15 -0000 >@@ -60,6 +60,7 @@ > @Override > protected void setUp() throws Exception { > super.setUp(); >+ TasksUiPlugin.getDefault().getTaskDataManager().clear(); > manager = TasksUiPlugin.getRepositoryManager(); > TasksUiPlugin.getTaskListManager().getTaskList().reset(); > manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath()); >#P org.eclipse.mylyn.jira.tests >Index: src/org/eclipse/mylyn/jira/tests/JiraAttachmentHandlerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.tests/src/org/eclipse/mylyn/jira/tests/JiraAttachmentHandlerTest.java,v >retrieving revision 1.9 >diff -u -r1.9 JiraAttachmentHandlerTest.java >--- src/org/eclipse/mylyn/jira/tests/JiraAttachmentHandlerTest.java 13 Jun 2007 07:59:45 -0000 1.9 >+++ src/org/eclipse/mylyn/jira/tests/JiraAttachmentHandlerTest.java 18 Jun 2007 18:10:15 -0000 >@@ -107,6 +107,7 @@ > TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null); > RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData( > task.getHandleIdentifier()); >+ assertNotNull(taskData); > assertEquals(1, taskData.getAttachments().size()); > > InputStream in = attachmentHandler.getAttachmentAsStream(repository, taskData.getAttachments().get(0), >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java,v >retrieving revision 1.27 >diff -u -r1.27 BugzillaRepositoryUi.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java 13 Jun 2007 21:15:51 -0000 1.27 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java 18 Jun 2007 18:10:16 -0000 >@@ -211,7 +211,7 @@ > if(task instanceof BugzillaTask){ > // XXX This is only used in the planning editor, and if its input was set correctly as a RepositoryTaskEditorInput > // we wouldn't have to get the task data this way from here >- RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getHandleIdentifier()); >+ RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getRepositoryUrl(), task.getTaskId()); > if(taskData != null && taskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString()) != null) > return true; > } >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java,v >retrieving revision 1.65 >diff -u -r1.65 BugzillaTaskEditor.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java 18 Jun 2007 05:02:50 -0000 1.65 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java 18 Jun 2007 18:10:16 -0000 >@@ -350,7 +350,7 @@ > > @Override > protected boolean hasContentAssist(RepositoryTaskAttribute attribute) { >- return BugzillaReportElement.NEWCC.getKeyString().equals(attribute.getID()); >+ return BugzillaReportElement.NEWCC.getKeyString().equals(attribute.getId()); > } > > @Override >@@ -634,7 +634,6 @@ > @Override > public void linkActivated(HyperlinkEvent e) { > if (BugzillaTaskEditor.this.getEditor() instanceof TaskEditor) { >- TaskEditor mylarTaskEditor = (TaskEditor) BugzillaTaskEditor.this.getEditor(); > TasksUiUtil.openUrl(repository.getUrl() + IBugzillaConstants.URL_VOTE + taskData.getId(), false); > } > } >#P org.eclipse.mylyn.web.core >Index: src/org/eclipse/mylyn/web/core/HtmlStreamTokenizer.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.web.core/src/org/eclipse/mylyn/web/core/HtmlStreamTokenizer.java,v >retrieving revision 1.1 >diff -u -r1.1 HtmlStreamTokenizer.java >--- src/org/eclipse/mylyn/web/core/HtmlStreamTokenizer.java 9 Jun 2007 02:10:30 -0000 1.1 >+++ src/org/eclipse/mylyn/web/core/HtmlStreamTokenizer.java 18 Jun 2007 18:10:17 -0000 >@@ -330,6 +330,13 @@ > } > if (escape != null) { > Character character = parseReference(escape); >+ if (character != null && !((0x0A == character || 0x0D == character || 0x09 == ch) >+ || (character >= 0x20 && character <= 0xD7FF) >+ || (character >= 0xE000 && character <= 0xFFFD) || (character >= 0x10000 && character <= 0x10FFFF))) { >+ // Character is an invalid xml character >+ // http://www.w3.org/TR/REC-xml/#charsets >+ character = null; >+ } > if (character != null) { > ch = character.charValue(); > } else { >@@ -534,36 +541,36 @@ > */ > static { > entities = new HashMap<String, Character>(); >- entities.put("nbsp",Character.valueOf('\240')); // no-break >+ entities.put("nbsp", Character.valueOf('\240')); // no-break > // space = > // non-breaking > // space >- entities.put("iexcl",Character.valueOf('\241')); // inverted >+ entities.put("iexcl", Character.valueOf('\241')); // inverted > // exclamation > // mark >- entities.put("cent",Character.valueOf('\242')); // cent sign >- entities.put("pound",Character.valueOf('\243')); // pound >+ entities.put("cent", Character.valueOf('\242')); // cent sign >+ entities.put("pound", Character.valueOf('\243')); // pound > // sign >- entities.put("curren",Character.valueOf('\244')); // currency >+ entities.put("curren", Character.valueOf('\244')); // currency > // sign >- entities.put("yen",Character.valueOf('\245')); // yen sign = >+ entities.put("yen", Character.valueOf('\245')); // yen sign = > // yuan sign >- entities.put("brvbar",Character.valueOf('\246')); // broken >+ entities.put("brvbar", Character.valueOf('\246')); // broken > // bar = > // broken > // vertical > // bar >- entities.put("sect",Character.valueOf('\247')); // section >+ entities.put("sect", Character.valueOf('\247')); // section > // sign >- entities.put("uml",Character.valueOf('\250')); // diaeresis = >+ entities.put("uml", Character.valueOf('\250')); // diaeresis = > // spacing > // diaeresis >- entities.put("copy",Character.valueOf('\251')); // copyright >+ entities.put("copy", Character.valueOf('\251')); // copyright > // sign >- entities.put("ordf",Character.valueOf('\252')); // feminine >+ entities.put("ordf", Character.valueOf('\252')); // feminine > // ordinal > // indicator >- entities.put("laquo",Character.valueOf('\253')); // left-pointing >+ entities.put("laquo", Character.valueOf('\253')); // left-pointing > // double > // angle > // quotation >@@ -571,65 +578,65 @@ > // left > // pointing > // guillemet >- entities.put("not",Character.valueOf('\254')); // not sign >- entities.put("shy",Character.valueOf('\255')); // soft hyphen = >+ entities.put("not", Character.valueOf('\254')); // not sign >+ entities.put("shy", Character.valueOf('\255')); // soft hyphen = > // discretionary > // hyphen >- entities.put("reg",Character.valueOf('\256')); // registered >+ entities.put("reg", Character.valueOf('\256')); // registered > // sign = > // registered > // trade mark > // sign >- entities.put("macr",Character.valueOf('\257')); // macron = >+ entities.put("macr", Character.valueOf('\257')); // macron = > // spacing > // macron = > // overline > // = APL > // overbar >- entities.put("deg",Character.valueOf('\260')); // degree sign >- entities.put("plusmn",Character.valueOf('\261')); // plus-minus >+ entities.put("deg", Character.valueOf('\260')); // degree sign >+ entities.put("plusmn", Character.valueOf('\261')); // plus-minus > // sign = > // plus-or-minus > // sign >- entities.put("sup2",Character.valueOf('\262')); // superscript >+ entities.put("sup2", Character.valueOf('\262')); // superscript > // two = > // superscript > // digit two > // = squared >- entities.put("sup3",Character.valueOf('\263')); // superscript >+ entities.put("sup3", Character.valueOf('\263')); // superscript > // three = > // superscript > // digit > // three = > // cubed >- entities.put("acute",Character.valueOf('\264')); // acute >+ entities.put("acute", Character.valueOf('\264')); // acute > // accent = > // spacing > // acute >- entities.put("micro",Character.valueOf('\265')); // micro >+ entities.put("micro", Character.valueOf('\265')); // micro > // sign >- entities.put("para",Character.valueOf('\266')); // pilcrow >+ entities.put("para", Character.valueOf('\266')); // pilcrow > // sign = > // paragraph > // sign >- entities.put("middot",Character.valueOf('\267')); // middle >+ entities.put("middot", Character.valueOf('\267')); // middle > // dot = > // Georgian > // comma = > // Greek > // middle > // dot >- entities.put("cedil",Character.valueOf('\270')); // cedilla = >+ entities.put("cedil", Character.valueOf('\270')); // cedilla = > // spacing > // cedilla >- entities.put("sup1",Character.valueOf('\271')); // superscript >+ entities.put("sup1", Character.valueOf('\271')); // superscript > // one = > // superscript > // digit one >- entities.put("ordm",Character.valueOf('\272')); // masculine >+ entities.put("ordm", Character.valueOf('\272')); // masculine > // ordinal > // indicator >- entities.put("raquo",Character.valueOf('\273')); // right-pointing >+ entities.put("raquo", Character.valueOf('\273')); // right-pointing > // double > // angle > // quotation >@@ -637,20 +644,20 @@ > // right > // pointing > // guillemet >- entities.put("frac14",Character.valueOf('\274')); // vulgar >+ entities.put("frac14", Character.valueOf('\274')); // vulgar > // fraction > // one > // quarter = > // fraction > // one > // quarter >- entities.put("frac12",Character.valueOf('\275')); // vulgar >+ entities.put("frac12", Character.valueOf('\275')); // vulgar > // fraction > // one half > // = > // fraction > // one half >- entities.put("frac34",Character.valueOf('\276')); // vulgar >+ entities.put("frac34", Character.valueOf('\276')); // vulgar > // fraction > // three > // quarters >@@ -658,13 +665,13 @@ > // fraction > // three > // quarters >- entities.put("iquest",Character.valueOf('\277')); // inverted >+ entities.put("iquest", Character.valueOf('\277')); // inverted > // question > // mark = > // turned > // question > // mark >- entities.put("Agrave",Character.valueOf('\300')); // latin >+ entities.put("Agrave", Character.valueOf('\300')); // latin > // capital > // letter A > // with >@@ -673,27 +680,27 @@ > // capital > // letter A > // grave >- entities.put("Aacute",Character.valueOf('\301')); // latin >+ entities.put("Aacute", Character.valueOf('\301')); // latin > // capital > // letter A > // with > // acute >- entities.put("Acirc",Character.valueOf('\302')); // latin >+ entities.put("Acirc", Character.valueOf('\302')); // latin > // capital > // letter A > // with > // circumflex >- entities.put("Atilde",Character.valueOf('\303')); // latin >+ entities.put("Atilde", Character.valueOf('\303')); // latin > // capital > // letter A > // with > // tilde >- entities.put("Auml",Character.valueOf('\304')); // latin >+ entities.put("Auml", Character.valueOf('\304')); // latin > // capital > // letter A > // with > // diaeresis >- entities.put("Aring",Character.valueOf('\305')); // latin >+ entities.put("Aring", Character.valueOf('\305')); // latin > // capital > // letter A > // with ring >@@ -702,93 +709,93 @@ > // capital > // letter A > // ring >- entities.put("AElig",Character.valueOf('\306')); // latin >+ entities.put("AElig", Character.valueOf('\306')); // latin > // capital > // letter AE > // = latin > // capital > // ligature > // AE >- entities.put("Ccedil",Character.valueOf('\307')); // latin >+ entities.put("Ccedil", Character.valueOf('\307')); // latin > // capital > // letter C > // with > // cedilla >- entities.put("Egrave",Character.valueOf('\310')); // latin >+ entities.put("Egrave", Character.valueOf('\310')); // latin > // capital > // letter E > // with > // grave >- entities.put("Eacute",Character.valueOf('\311')); // latin >+ entities.put("Eacute", Character.valueOf('\311')); // latin > // capital > // letter E > // with > // acute >- entities.put("Ecirc",Character.valueOf('\312')); // latin >+ entities.put("Ecirc", Character.valueOf('\312')); // latin > // capital > // letter E > // with > // circumflex >- entities.put("Euml",Character.valueOf('\313')); // latin >+ entities.put("Euml", Character.valueOf('\313')); // latin > // capital > // letter E > // with > // diaeresis >- entities.put("Igrave",Character.valueOf('\314')); // latin >+ entities.put("Igrave", Character.valueOf('\314')); // latin > // capital > // letter I > // with > // grave >- entities.put("Iacute",Character.valueOf('\315')); // latin >+ entities.put("Iacute", Character.valueOf('\315')); // latin > // capital > // letter I > // with > // acute >- entities.put("Icirc",Character.valueOf('\316')); // latin >+ entities.put("Icirc", Character.valueOf('\316')); // latin > // capital > // letter I > // with > // circumflex >- entities.put("Iuml",Character.valueOf('\317')); // latin >+ entities.put("Iuml", Character.valueOf('\317')); // latin > // capital > // letter I > // with > // diaeresis >- entities.put("ETH",Character.valueOf('\320')); // latin capital >+ entities.put("ETH", Character.valueOf('\320')); // latin capital > // letter ETH >- entities.put("Ntilde",Character.valueOf('\321')); // latin >+ entities.put("Ntilde", Character.valueOf('\321')); // latin > // capital > // letter N > // with > // tilde >- entities.put("Ograve",Character.valueOf('\322')); // latin >+ entities.put("Ograve", Character.valueOf('\322')); // latin > // capital > // letter O > // with > // grave >- entities.put("Oacute",Character.valueOf('\323')); // latin >+ entities.put("Oacute", Character.valueOf('\323')); // latin > // capital > // letter O > // with > // acute >- entities.put("Ocirc",Character.valueOf('\324')); // latin >+ entities.put("Ocirc", Character.valueOf('\324')); // latin > // capital > // letter O > // with > // circumflex >- entities.put("Otilde",Character.valueOf('\325')); // latin >+ entities.put("Otilde", Character.valueOf('\325')); // latin > // capital > // letter O > // with > // tilde >- entities.put("Ouml",Character.valueOf('\326')); // latin >+ entities.put("Ouml", Character.valueOf('\326')); // latin > // capital > // letter O > // with > // diaeresis >- entities.put("times",Character.valueOf('\327')); // multiplication >+ entities.put("times", Character.valueOf('\327')); // multiplication > // sign >- entities.put("Oslash",Character.valueOf('\330')); // latin >+ entities.put("Oslash", Character.valueOf('\330')); // latin > // capital > // letter O > // with >@@ -797,41 +804,41 @@ > // capital > // letter O > // slash >- entities.put("Ugrave",Character.valueOf('\331')); // latin >+ entities.put("Ugrave", Character.valueOf('\331')); // latin > // capital > // letter U > // with > // grave >- entities.put("Uacute",Character.valueOf('\332')); // latin >+ entities.put("Uacute", Character.valueOf('\332')); // latin > // capital > // letter U > // with > // acute >- entities.put("Ucirc",Character.valueOf('\333')); // latin >+ entities.put("Ucirc", Character.valueOf('\333')); // latin > // capital > // letter U > // with > // circumflex >- entities.put("Uuml",Character.valueOf('\334')); // latin >+ entities.put("Uuml", Character.valueOf('\334')); // latin > // capital > // letter U > // with > // diaeresis >- entities.put("Yacute",Character.valueOf('\335')); // latin >+ entities.put("Yacute", Character.valueOf('\335')); // latin > // capital > // letter Y > // with > // acute >- entities.put("THORN",Character.valueOf('\336')); // latin >+ entities.put("THORN", Character.valueOf('\336')); // latin > // capital > // letter > // THORN >- entities.put("szlig",Character.valueOf('\337')); // latin >+ entities.put("szlig", Character.valueOf('\337')); // latin > // small > // letter > // sharp s = > // ess-zed >- entities.put("agrave",Character.valueOf('\340')); // latin >+ entities.put("agrave", Character.valueOf('\340')); // latin > // small > // letter a > // with >@@ -840,27 +847,27 @@ > // small > // letter a > // grave >- entities.put("aacute",Character.valueOf('\341')); // latin >+ entities.put("aacute", Character.valueOf('\341')); // latin > // small > // letter a > // with > // acute >- entities.put("acirc",Character.valueOf('\342')); // latin >+ entities.put("acirc", Character.valueOf('\342')); // latin > // small > // letter a > // with > // circumflex >- entities.put("atilde",Character.valueOf('\343')); // latin >+ entities.put("atilde", Character.valueOf('\343')); // latin > // small > // letter a > // with > // tilde >- entities.put("auml",Character.valueOf('\344')); // latin >+ entities.put("auml", Character.valueOf('\344')); // latin > // small > // letter a > // with > // diaeresis >- entities.put("aring",Character.valueOf('\345')); // latin >+ entities.put("aring", Character.valueOf('\345')); // latin > // small > // letter a > // with ring >@@ -869,93 +876,93 @@ > // small > // letter a > // ring >- entities.put("aelig",Character.valueOf('\346')); // latin >+ entities.put("aelig", Character.valueOf('\346')); // latin > // small > // letter ae > // = latin > // small > // ligature > // ae >- entities.put("ccedil",Character.valueOf('\347')); // latin >+ entities.put("ccedil", Character.valueOf('\347')); // latin > // small > // letter c > // with > // cedilla >- entities.put("egrave",Character.valueOf('\350')); // latin >+ entities.put("egrave", Character.valueOf('\350')); // latin > // small > // letter e > // with > // grave >- entities.put("eacute",Character.valueOf('\351')); // latin >+ entities.put("eacute", Character.valueOf('\351')); // latin > // small > // letter e > // with > // acute >- entities.put("ecirc",Character.valueOf('\352')); // latin >+ entities.put("ecirc", Character.valueOf('\352')); // latin > // small > // letter e > // with > // circumflex >- entities.put("euml",Character.valueOf('\353')); // latin >+ entities.put("euml", Character.valueOf('\353')); // latin > // small > // letter e > // with > // diaeresis >- entities.put("igrave",Character.valueOf('\354')); // latin >+ entities.put("igrave", Character.valueOf('\354')); // latin > // small > // letter i > // with > // grave >- entities.put("iacute",Character.valueOf('\355')); // latin >+ entities.put("iacute", Character.valueOf('\355')); // latin > // small > // letter i > // with > // acute >- entities.put("icirc",Character.valueOf('\356')); // latin >+ entities.put("icirc", Character.valueOf('\356')); // latin > // small > // letter i > // with > // circumflex >- entities.put("iuml",Character.valueOf('\357')); // latin >+ entities.put("iuml", Character.valueOf('\357')); // latin > // small > // letter i > // with > // diaeresis >- entities.put("eth",Character.valueOf('\360')); // latin small >+ entities.put("eth", Character.valueOf('\360')); // latin small > // letter eth >- entities.put("ntilde",Character.valueOf('\361')); // latin >+ entities.put("ntilde", Character.valueOf('\361')); // latin > // small > // letter n > // with > // tilde >- entities.put("ograve",Character.valueOf('\362')); // latin >+ entities.put("ograve", Character.valueOf('\362')); // latin > // small > // letter o > // with > // grave >- entities.put("oacute",Character.valueOf('\363')); // latin >+ entities.put("oacute", Character.valueOf('\363')); // latin > // small > // letter o > // with > // acute >- entities.put("ocirc",Character.valueOf('\364')); // latin >+ entities.put("ocirc", Character.valueOf('\364')); // latin > // small > // letter o > // with > // circumflex >- entities.put("otilde",Character.valueOf('\365')); // latin >+ entities.put("otilde", Character.valueOf('\365')); // latin > // small > // letter o > // with > // tilde >- entities.put("ouml",Character.valueOf('\366')); // latin >+ entities.put("ouml", Character.valueOf('\366')); // latin > // small > // letter o > // with > // diaeresis >- entities.put("divide",Character.valueOf('\367')); // division >+ entities.put("divide", Character.valueOf('\367')); // division > // sign >- entities.put("oslash",Character.valueOf('\370')); // latin >+ entities.put("oslash", Character.valueOf('\370')); // latin > // small > // letter o > // with >@@ -964,56 +971,56 @@ > // small > // letter o > // slash >- entities.put("ugrave",Character.valueOf('\371')); // latin >+ entities.put("ugrave", Character.valueOf('\371')); // latin > // small > // letter u > // with > // grave >- entities.put("uacute",Character.valueOf('\372')); // latin >+ entities.put("uacute", Character.valueOf('\372')); // latin > // small > // letter u > // with > // acute >- entities.put("ucirc",Character.valueOf('\373')); // latin >+ entities.put("ucirc", Character.valueOf('\373')); // latin > // small > // letter u > // with > // circumflex >- entities.put("uuml",Character.valueOf('\374')); // latin >+ entities.put("uuml", Character.valueOf('\374')); // latin > // small > // letter u > // with > // diaeresis >- entities.put("yacute",Character.valueOf('\375')); // latin >+ entities.put("yacute", Character.valueOf('\375')); // latin > // small > // letter y > // with > // acute >- entities.put("thorn",Character.valueOf('\376')); // latin >+ entities.put("thorn", Character.valueOf('\376')); // latin > // small > // letter > // thorn >- entities.put("yuml",Character.valueOf('\377')); // latin >+ entities.put("yuml", Character.valueOf('\377')); // latin > // small > // letter y > // with > // diaeresis > > // Special characters >- entities.put("quot",Character.valueOf('\42')); // quotation >+ entities.put("quot", Character.valueOf('\42')); // quotation > // mark = APL > // quote >- entities.put("amp",Character.valueOf('\46')); // ampersand >- entities.put("lt",Character.valueOf('\74')); // less-than >+ entities.put("amp", Character.valueOf('\46')); // ampersand >+ entities.put("lt", Character.valueOf('\74')); // less-than > // sign >- entities.put("gt",Character.valueOf('\76')); // greater-than >+ entities.put("gt", Character.valueOf('\76')); // greater-than > // sign > // Latin Extended-A >- entities.put("OElig",Character.valueOf('\u0152')); // latin >+ entities.put("OElig", Character.valueOf('\u0152')); // latin > // capital > // ligature > // OE >- entities.put("oelig",Character.valueOf('\u0153')); // latin >+ entities.put("oelig", Character.valueOf('\u0153')); // latin > // small > // ligature > // oe, >@@ -1025,78 +1032,78 @@ > // character > // in some > // languages >- entities.put("Scaron",Character.valueOf('\u0160')); // latin >+ entities.put("Scaron", Character.valueOf('\u0160')); // latin > // capital > // letter > // S > // with > // caron >- entities.put("scaron",Character.valueOf('\u0161')); // latin >+ entities.put("scaron", Character.valueOf('\u0161')); // latin > // small > // letter > // s > // with > // caron >- entities.put("Yuml",Character.valueOf('\u0178')); // latin >+ entities.put("Yuml", Character.valueOf('\u0178')); // latin > // capital > // letter Y > // with > // diaeresis > // Spacing Modifier Letters >- entities.put("circ",Character.valueOf('\u02c6')); // modifier >+ entities.put("circ", Character.valueOf('\u02c6')); // modifier > // letter > // circumflex > // accent >- entities.put("tilde",Character.valueOf('\u02dc')); // small >+ entities.put("tilde", Character.valueOf('\u02dc')); // small > // tilde > // General punctuation >- entities.put("ensp",Character.valueOf('\u2002')); // en space >- entities.put("emsp",Character.valueOf('\u2003')); // em space >- entities.put("thinsp",Character.valueOf('\u2009')); // thin >+ entities.put("ensp", Character.valueOf('\u2002')); // en space >+ entities.put("emsp", Character.valueOf('\u2003')); // em space >+ entities.put("thinsp", Character.valueOf('\u2009')); // thin > // space >- entities.put("zwnj",Character.valueOf('\u200c')); // zero >+ entities.put("zwnj", Character.valueOf('\u200c')); // zero > // width > // non-joiner >- entities.put("zwj",Character.valueOf('\u200d')); // zero >+ entities.put("zwj", Character.valueOf('\u200d')); // zero > // width > // joiner >- entities.put("lrm",Character.valueOf('\u200e')); // left-to-right >+ entities.put("lrm", Character.valueOf('\u200e')); // left-to-right > // mark >- entities.put("rlm",Character.valueOf('\u200f')); // right-to-left >+ entities.put("rlm", Character.valueOf('\u200f')); // right-to-left > // mark >- entities.put("ndash",Character.valueOf('\u2013')); // en dash >- entities.put("mdash",Character.valueOf('\u2014')); // em dash >- entities.put("lsquo",Character.valueOf('\u2018')); // left >+ entities.put("ndash", Character.valueOf('\u2013')); // en dash >+ entities.put("mdash", Character.valueOf('\u2014')); // em dash >+ entities.put("lsquo", Character.valueOf('\u2018')); // left > // single > // quotation > // mark >- entities.put("rsquo",Character.valueOf('\u2019')); // right >+ entities.put("rsquo", Character.valueOf('\u2019')); // right > // single > // quotation > // mark >- entities.put("sbquo",Character.valueOf('\u201a')); // single >+ entities.put("sbquo", Character.valueOf('\u201a')); // single > // low-9 > // quotation > // mark >- entities.put("ldquo",Character.valueOf('\u201c')); // left >+ entities.put("ldquo", Character.valueOf('\u201c')); // left > // double > // quotation > // mark >- entities.put("rdquo",Character.valueOf('\u201d')); // right >+ entities.put("rdquo", Character.valueOf('\u201d')); // right > // double > // quotation > // mark >- entities.put("bdquo",Character.valueOf('\u201e')); // double >+ entities.put("bdquo", Character.valueOf('\u201e')); // double > // low-9 > // quotation > // mark >- entities.put("dagger",Character.valueOf('\u2020')); // dagger >- entities.put("Dagger",Character.valueOf('\u2021')); // double >+ entities.put("dagger", Character.valueOf('\u2020')); // dagger >+ entities.put("Dagger", Character.valueOf('\u2021')); // double > // dagger >- entities.put("permil",Character.valueOf('\u2030')); // per >+ entities.put("permil", Character.valueOf('\u2030')); // per > // mille > // sign >- entities.put("lsaquo",Character.valueOf('\u2039')); // single >+ entities.put("lsaquo", Character.valueOf('\u2039')); // single > // left-pointing > // angle > // quotation >@@ -1104,7 +1111,7 @@ > // not > // yet > // standardized >- entities.put("rsaquo",Character.valueOf('\u203a')); // single >+ entities.put("rsaquo", Character.valueOf('\u203a')); // single > // right-pointing > // angle > // quotation >@@ -1112,6 +1119,6 @@ > // not > // yet > // standardized >- entities.put("euro",Character.valueOf('\u20ac')); // euro sign >+ entities.put("euro", Character.valueOf('\u20ac')); // euro sign > } > } >#P org.eclipse.mylyn.tasks.tests >Index: src/org/eclipse/mylyn/tasks/tests/RepositoryTaskSynchronizationTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositoryTaskSynchronizationTest.java,v >retrieving revision 1.34 >diff -u -r1.34 RepositoryTaskSynchronizationTest.java >--- src/org/eclipse/mylyn/tasks/tests/RepositoryTaskSynchronizationTest.java 13 Jun 2007 22:49:36 -0000 1.34 >+++ src/org/eclipse/mylyn/tasks/tests/RepositoryTaskSynchronizationTest.java 18 Jun 2007 18:10:18 -0000 >@@ -39,9 +39,9 @@ > > private static final String DATE_STAMP_1 = "2006-06-21 15:29:40"; > >- private static final String HANDLE1 = "handle1"; >+ private static final String MOCCK_ID = "1"; > >- private static final String URL1 = "http://www.eclipse.org/mylar"; >+ //private static final String URL1 = "http://www.eclipse.org/mylar"; > > private TestRepositoryConnector connector = new TestRepositoryConnector(); > >@@ -61,9 +61,9 @@ > } > > public void testHasIncoming() { >- AbstractTask task = new MockRepositoryTask(HANDLE1); >+ AbstractTask task = new MockRepositoryTask(MOCCK_ID); > RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), >- URL1, "1"); >+ MockRepositoryConnector.REPOSITORY_URL, MOCCK_ID); > task.setLastSyncDateStamp("never"); > > assertTrue(TasksUiPlugin.getSynchronizationManager().checkHasIncoming(task, taskData)); >@@ -101,7 +101,7 @@ > // and again... > > RepositoryTaskData taskData3 = new RepositoryTaskData(new MockAttributeFactory(), >- connector.getRepositoryType(), URL1, "1"); >+ connector.getRepositoryType(), MockRepositoryConnector.REPOSITORY_URL, "1"); > taskData3.setAttributeValue(RepositoryTaskAttribute.DATE_MODIFIED, DATE_STAMP_3); > TasksUiPlugin.getSynchronizationManager().saveIncoming(task, taskData3, false); > // last modified stamp not updated until user synchronizes (newdata == >@@ -420,15 +420,14 @@ > private AbstractTask primeTaskAndRepository(RepositoryTaskSyncState localState, > RepositoryTaskSyncState remoteState) { > RepositoryTaskData taskData = null; >- AbstractTask task = new MockRepositoryTask(HANDLE1); >+ AbstractTask task = new MockRepositoryTask(MOCCK_ID); > >- taskData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), URL1, "1"); >- TasksUiPlugin.getDefault().getTaskDataManager().setNewTaskData(task.getHandleIdentifier(), taskData); >+ taskData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), MockRepositoryConnector.REPOSITORY_URL, MOCCK_ID); > taskData.setAttributeValue(RepositoryTaskAttribute.DATE_MODIFIED, DATE_STAMP_1); > task.setLastSyncDateStamp(DATE_STAMP_1); > task.setSyncState(localState); >- >- newData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), URL1, "1"); >+ TasksUiPlugin.getDefault().getTaskDataManager().setNewTaskData(task.getHandleIdentifier(), taskData); >+ newData = new RepositoryTaskData(new MockAttributeFactory(), connector.getRepositoryType(), MockRepositoryConnector.REPOSITORY_URL, MOCCK_ID); > > switch (remoteState) { > case CONFLICT: >Index: src/org/eclipse/mylyn/tasks/tests/TaskDataManagerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataManagerTest.java,v >retrieving revision 1.20 >diff -u -r1.20 TaskDataManagerTest.java >--- src/org/eclipse/mylyn/tasks/tests/TaskDataManagerTest.java 13 Jun 2007 22:49:36 -0000 1.20 >+++ src/org/eclipse/mylyn/tasks/tests/TaskDataManagerTest.java 18 Jun 2007 18:10:18 -0000 >@@ -9,7 +9,6 @@ > package org.eclipse.mylyn.tasks.tests; > > import java.io.IOException; >-import java.util.ArrayList; > import java.util.HashSet; > import java.util.Set; > >@@ -53,8 +52,7 @@ > MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); > offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), > taskData); >- assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >+ assertNotNull(offlineTaskDataManager.getNewTaskData(MockRepositoryConnector.REPOSITORY_URL, "1")); > } > > public void testSave() throws CoreException, IOException, ClassNotFoundException { >@@ -85,35 +83,31 @@ > > offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "2"), > taskData); >- assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >- assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "2"))); >- offlineTaskDataManager.saveNow(); >- offlineTaskDataManager.clear(); >- assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >- assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "2"))); >- offlineTaskDataManager.readOfflineData(); >- RepositoryTaskData loaded1 = offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1")); >- assertNotNull(loaded1); >- >- RepositoryTaskAttribute atr = loaded1.getAttribute("key"); >+ >+ RepositoryTaskData loaded = offlineTaskDataManager.getNewTaskData(MockRepositoryConnector.REPOSITORY_URL, "1"); >+ assertNotNull(loaded); >+ RepositoryTaskAttribute atr = loaded.getAttribute("key"); > assertNotNull(atr); >- > assertEquals("value1", atr.getMetaDataValue("key1")); > assertEquals("value2", atr.getMetaDataValue("key2")); >+ >+ >+ loaded = offlineTaskDataManager.getNewTaskData(MockRepositoryConnector.REPOSITORY_URL, "2"); >+ assertNotNull(loaded); >+ atr = loaded.getAttribute("key"); >+ assertNotNull(atr); > >- RepositoryTaskData loaded2 = offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "2")); >- assertNotNull(loaded2); >- RepositoryTaskAttribute atr2 = loaded2.getAttribute("key"); >- assertNotNull(atr2); >+ assertEquals("value3", atr.getMetaDataValue("key3")); >+ assertEquals("value4", atr.getMetaDataValue("key4")); >+ >+ offlineTaskDataManager.saveNow(); >+ offlineTaskDataManager.remove(MockRepositoryConnector.REPOSITORY_URL, "1"); >+ offlineTaskDataManager.remove(MockRepositoryConnector.REPOSITORY_URL, "2"); >+ >+ >+ assertNull(offlineTaskDataManager.getNewTaskData(MockRepositoryConnector.REPOSITORY_URL, "1")); >+ assertNull(offlineTaskDataManager.getNewTaskData(MockRepositoryConnector.REPOSITORY_URL, "2")); > >- assertEquals("value3", atr2.getMetaDataValue("key3")); >- assertEquals("value4", atr2.getMetaDataValue("key4")); > } > > public void testGetNextOfflineBugId() throws IOException, ClassNotFoundException { >@@ -121,34 +115,32 @@ > assertEquals("2", offlineTaskDataManager.getNewRepositoryTaskId()); > offlineTaskDataManager.saveNow(); > offlineTaskDataManager.clear(); >- offlineTaskDataManager.readOfflineData(); > assertEquals("3", offlineTaskDataManager.getNewRepositoryTaskId()); > } > >- public void testGetTaskData() throws CoreException, IOException, ClassNotFoundException { >- RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), >- MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); >- taskData.setNewComment("version 1"); >- offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), >- taskData); >- offlineTaskDataManager.setOldTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), >- taskData); >- assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >- taskData = new RepositoryTaskData(new MockAttributeFactory(), MockRepositoryConnector.REPOSITORY_KIND, >- MockRepositoryConnector.REPOSITORY_URL, "1"); >- taskData.setNewComment("version 2"); >- offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), >- taskData); >- >- offlineTaskDataManager.saveNow(); >- offlineTaskDataManager.clear(); >- offlineTaskDataManager.readOfflineData(); >- assertEquals("version 2", offlineTaskDataManager.getNewTaskData( >- RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1")).getNewComment()); >- assertEquals("version 1", offlineTaskDataManager.getOldTaskData( >- RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1")).getNewComment()); >- } >+// public void testGetTaskData() throws CoreException, IOException, ClassNotFoundException { >+// RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), >+// MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); >+// taskData.setNewComment("version 1"); >+// offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), >+// taskData); >+// offlineTaskDataManager.setOldTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), >+// taskData); >+// assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >+// MockRepositoryConnector.REPOSITORY_URL, "1"))); >+// taskData = new RepositoryTaskData(new MockAttributeFactory(), MockRepositoryConnector.REPOSITORY_KIND, >+// MockRepositoryConnector.REPOSITORY_URL, "1"); >+// taskData.setNewComment("version 2"); >+// offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), >+// taskData); >+// >+// offlineTaskDataManager.saveNow(); >+// offlineTaskDataManager.clear(); >+// offlineTaskDataManager.readOfflineData(); >+// assertEquals("version 2", offlineTaskDataManager.getNewTaskData( >+// RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1")).getNewComment()); >+// assertEquals("version 1", offlineTaskDataManager.getOldTaskData(MockRepositoryConnector.REPOSITORY_URL, "1").getNewComment()); >+// } > > public void testUniqueCopy() throws Exception { > RepositoryTaskData taskData = new RepositoryTaskData(new MockAttributeFactory(), >@@ -183,49 +175,15 @@ > MockRepositoryConnector.REPOSITORY_URL, "1"))); > assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( > MockRepositoryConnector.REPOSITORY_URL, "2"))); >- offlineTaskDataManager.remove(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "2")); >+ offlineTaskDataManager.remove(MockRepositoryConnector.REPOSITORY_URL, "2"); > assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( > MockRepositoryConnector.REPOSITORY_URL, "1"))); > assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( > MockRepositoryConnector.REPOSITORY_URL, "2"))); > offlineTaskDataManager.saveNow(); > offlineTaskDataManager.clear(); >- offlineTaskDataManager.readOfflineData(); >- assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >- assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "2"))); >- } >- >- public void testRemoveListOfRepositoryTaskData() throws CoreException, IOException, ClassNotFoundException { >- RepositoryTaskData taskData1 = new RepositoryTaskData(new MockAttributeFactory(), >- MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); >- offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), >- taskData1); >- RepositoryTaskData taskData2 = new RepositoryTaskData(new MockAttributeFactory(), >- MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "2"); >- offlineTaskDataManager.setNewTaskData(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "2"), >- taskData2); >- offlineTaskDataManager.saveNow(); >- assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >- assertNotNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "2"))); >- ArrayList<String> list = new ArrayList<String>(); >- list.add(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "1")); >- list.add(RepositoryTaskHandleUtil.getHandle(MockRepositoryConnector.REPOSITORY_URL, "2")); >- offlineTaskDataManager.remove(list); >- assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >- assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "2"))); >- offlineTaskDataManager.saveNow(); >- offlineTaskDataManager.clear(); >- offlineTaskDataManager.readOfflineData(); >- assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "1"))); >- assertNull(offlineTaskDataManager.getNewTaskData(RepositoryTaskHandleUtil.getHandle( >- MockRepositoryConnector.REPOSITORY_URL, "2"))); >+ assertNull(offlineTaskDataManager.getNewTaskData(MockRepositoryConnector.REPOSITORY_URL, "1")); >+ assertNull(offlineTaskDataManager.getNewTaskData(MockRepositoryConnector.REPOSITORY_URL, "2")); > } > > public void testEditing() { >@@ -250,8 +208,7 @@ > > Set<RepositoryTaskAttribute> attSave = new HashSet<RepositoryTaskAttribute>(); > attSave.add(editData.getAttribute(RepositoryTaskAttribute.COMMENT_NEW)); >- offlineTaskDataManager.saveEdits(RepositoryTaskHandleUtil >- .getHandle(MockRepositoryConnector.REPOSITORY_URL, "1"), attSave); >+ offlineTaskDataManager.saveEdits(MockRepositoryConnector.REPOSITORY_URL, "1", attSave); > > editData = null; > editData = offlineTaskDataManager.getEditableCopy(RepositoryTaskHandleUtil.getHandle( >Index: src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java,v >retrieving revision 1.23 >diff -u -r1.23 AllTasksTests.java >--- src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java 12 Jun 2007 02:29:22 -0000 1.23 >+++ src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java 18 Jun 2007 18:10:18 -0000 >@@ -50,6 +50,8 @@ > suite.addTestSuite(TaskHistoryTest.class); > suite.addTestSuite(UrlConnectionUtilTest.class); > suite.addTestSuite(CommentQuoterTest.class); >+ suite.addTestSuite(OfflineStorageTest.class); >+ suite.addTestSuite(OfflineCachingStorageTest.class); > // $JUnit-END$ > > // suite.addTestSuite(BackgroundSaveTest.class); >Index: src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java,v >retrieving revision 1.60 >diff -u -r1.60 TaskListManagerTest.java >--- src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java 14 Jun 2007 18:01:04 -0000 1.60 >+++ src/org/eclipse/mylyn/tasks/tests/TaskListManagerTest.java 18 Jun 2007 18:10:18 -0000 >@@ -559,7 +559,6 @@ > > AbstractTask sub1 = manager.createNewLocalTask("sub 1"); > manager.getTaskList().addTask(sub1, task1); >- System.err.println(">>> " + task1.getChildren()); > > manager.getTaskList().moveToContainer(sub1, manager.getTaskList().getArchiveContainer()); > >Index: src/org/eclipse/mylyn/tasks/tests/OfflineStorageTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/OfflineStorageTest.java >diff -N src/org/eclipse/mylyn/tasks/tests/OfflineStorageTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/OfflineStorageTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,308 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 Mylar 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.tests; >+ >+import java.io.File; >+import java.util.ArrayList; >+import java.util.HashSet; >+import java.util.List; >+import java.util.Set; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.mylyn.internal.tasks.core.TaskDataState; >+import org.eclipse.mylyn.internal.tasks.ui.OfflineFileStorage; >+import org.eclipse.mylyn.tasks.core.RepositoryAttachment; >+import org.eclipse.mylyn.tasks.core.RepositoryOperation; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >+import org.eclipse.mylyn.tasks.core.TaskComment; >+import org.eclipse.mylyn.tasks.tests.connector.MockAttributeFactory; >+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector; >+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; >+import org.eclipse.ui.XMLMemento; >+ >+/** >+ * @author Rob Elves >+ */ >+public class OfflineStorageTest extends TestCase { >+ >+ File dataDir; >+ >+ OfflineFileStorage storage; >+ >+ protected void setUp() throws Exception { >+ //dataDir = new File("c:/offline"); >+ dataDir = new File(TasksUiPlugin.getDefault().getDataDirectory() + "/offline"); >+ storage = new OfflineFileStorage(dataDir); >+ storage.start(); >+ super.setUp(); >+ } >+ >+ protected void tearDown() throws Exception { >+ storage.stop(); >+ removeTestFiles(dataDir); >+ } >+ >+ private void removeTestFiles(File folder) { >+ if (folder.isDirectory()) { >+ for (File file : folder.listFiles()) { >+ removeTestFiles(file); >+ } >+ } >+ folder.delete(); >+ } >+ >+ public void testPutAndGet() throws Exception { >+ >+ TaskDataState state = new TaskDataState(MockRepositoryConnector.REPOSITORY_URL, "1"); >+ >+ RepositoryTaskData newData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); >+ >+ newData.setAttributeValue("attributeKey1", "attValue!"); >+ newData.setDescription("description"); >+ newData.setNew(true); >+ newData.setNewComment("new comment"); >+ newData.setSummary("summary"); >+ newData.setTaskKey("task key"); >+ >+ RepositoryTaskData oldData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); >+ >+ Set<RepositoryTaskAttribute> edits = new HashSet<RepositoryTaskAttribute>(); >+ >+ state.setNewTaskData(newData); >+ state.setOldTaskData(oldData); >+ state.setEdits(edits); >+ >+ storage.put(state); >+ >+ TaskDataState retrieved = storage.get(MockRepositoryConnector.REPOSITORY_URL, "1"); >+ assertNotNull(retrieved); >+ RepositoryTaskData newTaskData = retrieved.getNewTaskData(); >+ assertNotNull(newTaskData); >+ assertEquals(MockRepositoryConnector.REPOSITORY_KIND, newTaskData.getRepositoryKind()); >+ assertEquals("description", newTaskData.getDescription()); >+ assertEquals("new comment", newTaskData.getNewComment()); >+ assertEquals("task key", newTaskData.getTaskKey()); >+ } >+ >+ public void testRemove() throws Exception { >+ assertNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, "1")); >+ >+ TaskDataState state = new TaskDataState(MockRepositoryConnector.REPOSITORY_URL, "1"); >+ >+ RepositoryTaskData newData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); >+ >+ newData.setAttributeValue("attributeKey1", "attValue!"); >+ newData.setDescription("description"); >+ newData.setNew(true); >+ newData.setNewComment("new comment"); >+ newData.setSummary("summary"); >+ newData.setTaskKey("task key"); >+ >+ RepositoryTaskData oldData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, "1"); >+ >+ Set<RepositoryTaskAttribute> edits = new HashSet<RepositoryTaskAttribute>(); >+ >+ state.setNewTaskData(newData); >+ state.setOldTaskData(oldData); >+ state.setEdits(edits); >+ >+ storage.put(state); >+ assertNotNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, "1")); >+ storage.remove(MockRepositoryConnector.REPOSITORY_URL, "1"); >+ assertNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, "1")); >+ >+ } >+ >+ public void testAttributes() throws Exception { >+ List<RepositoryTaskAttribute> attributes = new ArrayList<RepositoryTaskAttribute>(); >+ RepositoryTaskAttribute attribute = new RepositoryTaskAttribute("testId", "testName", true); >+ attribute.setReadOnly(true); >+ attribute.addOption("Option Name 1", "Option Value 1"); >+ attribute.addOption("Option Name 2", "Option Value 2"); >+ attribute.addValue("Value 1"); >+ attribute.addValue("Value 2"); >+ attribute.addValue("Value 3"); >+ attribute.putMetaDataValue("MetaKey1", "MetaValue1"); >+ attribute.putMetaDataValue("MetaKey2", "MetaValue2"); >+ attribute.putMetaDataValue("MetaKey3", "MetaValue3"); >+ attribute.putMetaDataValue("MetaKey4", "MetaValue4"); >+ >+ attributes.add(attribute); >+ >+ XMLMemento memento = XMLMemento.createWriteRoot("Attributes"); >+ storage.addAttributes(memento, attributes); >+ List<RepositoryTaskAttribute> readAttributes = storage.readAttributes(memento); >+ assertNotNull(readAttributes); >+ assertEquals(1, readAttributes.size()); >+ RepositoryTaskAttribute attr = readAttributes.get(0); >+ >+ assertEquals("testId", attr.getId()); >+ assertEquals("testName", attr.getName()); >+ assertEquals(true, attr.isHidden()); >+ assertEquals(true, attr.isReadOnly()); >+ >+ assertNotNull(attr.getOptions()); >+ assertEquals(2, attr.getOptions().size()); >+ >+ assertEquals("Option Name 1", attr.getOptions().get(0)); >+ assertEquals("Option Name 2", attr.getOptions().get(1)); >+ assertEquals("Option Value 1", attr.getOptionParameter(attr.getOptions().get(0))); >+ assertEquals("Option Value 2", attr.getOptionParameter(attr.getOptions().get(1))); >+ >+ assertEquals("Value 1", attr.getValues().get(0)); >+ assertEquals("Value 2", attr.getValues().get(1)); >+ assertEquals("Value 3", attr.getValues().get(2)); >+ >+ assertEquals("MetaValue1", attribute.getMetaDataValue("MetaKey1")); >+ assertEquals("MetaValue2", attribute.getMetaDataValue("MetaKey2")); >+ assertEquals("MetaValue3", attribute.getMetaDataValue("MetaKey3")); >+ assertEquals("MetaValue4", attribute.getMetaDataValue("MetaKey4")); >+ } >+ >+ public void testOperations() throws Exception { >+ RepositoryOperation op = new RepositoryOperation("knob1", "operationName1"); >+ op.setChecked(true); >+ op.setInputName("InputName"); >+ op.setInputValue("InputValue"); >+ op.setUpOptions("TheOptionName"); >+ op.addOption("optionName1", "optionValue1"); >+ op.addOption("optionName2", "optionValue2"); >+ op.setOptionSelection("optionSelection1"); >+ >+ RepositoryOperation op2 = new RepositoryOperation("knob2", "operationName2"); >+ op2.setChecked(true); >+ op2.setInputName("InputName2"); >+ op2.setInputValue("InputValue2"); >+ op2.setUpOptions("TheOptionName2"); >+ op2.addOption("optionName1", "optionValue1"); >+ op2.addOption("optionName2", "optionValue2"); >+ op2.setOptionSelection("optionSelection2"); >+ XMLMemento memento = XMLMemento.createWriteRoot("Operations"); >+ >+ List<RepositoryOperation> operations = new ArrayList<RepositoryOperation>(); >+ operations.add(op); >+ operations.add(op2); >+ storage.addOperations(memento, operations); >+ List<RepositoryOperation> readOperations = storage.readOperations(memento); >+ RepositoryOperation op1 = readOperations.get(0); >+ assertEquals("knob1", op1.getKnobName()); >+ assertEquals("operationName1", op1.getOperationName()); >+ assertEquals("InputName", op1.getInputName()); >+ assertEquals("InputValue", op1.getInputValue()); >+ >+ assertEquals("TheOptionName", op1.getOptionName()); >+ assertEquals(2, op1.getOptionNames().size()); >+ assertEquals("optionValue1", op1.getOptionValue(op1.getOptionNames().get(0))); >+ assertEquals("optionValue2", op1.getOptionValue(op1.getOptionNames().get(1))); >+ assertEquals("optionSelection1", op1.getOptionSelection()); >+ >+ RepositoryOperation op2ver2 = readOperations.get(1); >+ assertEquals("knob2", op2ver2.getKnobName()); >+ assertEquals("operationName2", op2ver2.getOperationName()); >+ assertEquals("InputName2", op2ver2.getInputName()); >+ assertEquals("InputValue2", op2ver2.getInputValue()); >+ >+ assertEquals("TheOptionName2", op2ver2.getOptionName()); >+ assertEquals(2, op2ver2.getOptionNames().size()); >+ assertEquals("optionValue1", op2ver2.getOptionValue(op1.getOptionNames().get(0))); >+ assertEquals("optionValue2", op2ver2.getOptionValue(op1.getOptionNames().get(1))); >+ assertEquals("optionSelection2", op2ver2.getOptionSelection()); >+ } >+ >+ public void testComments() throws Exception { >+ TaskComment comment1 = new TaskComment(new MockAttributeFactory(), 1); >+ comment1.setAttachmentId("attachmentId1"); >+ comment1.setHasAttachment(true); >+ comment1.addAttribute("attr1", new RepositoryTaskAttribute("attr1", "attr1Name", false)); >+ >+ TaskComment comment2 = new TaskComment(new MockAttributeFactory(), 2); >+ comment2.setAttachmentId("attachmentId2"); >+ comment2.setHasAttachment(false); >+ comment2.addAttribute("attr2", new RepositoryTaskAttribute("attr2", "attr2Name", false)); >+ comment2.addAttribute("attr3", new RepositoryTaskAttribute("attr3", "attr3Name", true)); >+ >+ XMLMemento memento = XMLMemento.createWriteRoot("Comments"); >+ List<TaskComment> comments = new ArrayList<TaskComment>(); >+ comments.add(comment1); >+ comments.add(comment2); >+ storage.addComments(memento, comments); >+ List<TaskComment> returnedComments = storage.readComments(memento); >+ assertEquals(2, returnedComments.size()); >+ >+ assertEquals("attachmentId1", returnedComments.get(0).getAttachmentId()); >+ assertEquals(true, returnedComments.get(0).hasAttachment()); >+ assertEquals(1, returnedComments.get(0).getAttributes().size()); >+ assertEquals("attr1", returnedComments.get(0).getAttributes().get(0).getId()); >+ assertEquals("attr1Name", returnedComments.get(0).getAttributes().get(0).getName()); >+ >+ assertEquals("attachmentId2", returnedComments.get(1).getAttachmentId()); >+ assertEquals(false, returnedComments.get(1).hasAttachment()); >+ assertEquals(2, returnedComments.get(1).getAttributes().size()); >+ assertEquals("attr2", returnedComments.get(1).getAttributes().get(0).getId()); >+ assertEquals("attr2Name", returnedComments.get(1).getAttributes().get(0).getName()); >+ assertEquals("attr3Name", returnedComments.get(1).getAttributes().get(1).getName()); >+ } >+ >+ public void testAttachments() throws Exception { >+ >+ List<RepositoryAttachment> attachments = new ArrayList<RepositoryAttachment>(); >+ RepositoryAttachment attachment1 = new RepositoryAttachment(new MockAttributeFactory()); >+ attachment1.setCreator("thecreator"); >+ attachment1.setObsolete(false); >+ attachment1.setPatch(true); >+ attachment1.setRepositoryKind("bugzilla"); >+ attachment1.setRepositoryUrl("repUrl"); >+ attachment1.setTaskId("taskid1"); >+ attachment1.addAttribute("attr1", new RepositoryTaskAttribute("attr1", "attr1Name", true)); >+ attachment1.addAttribute("attr2", new RepositoryTaskAttribute("attr2", "attr2Name", true)); >+ >+ RepositoryAttachment attachment2 = new RepositoryAttachment(new MockAttributeFactory()); >+ attachment2.setCreator("thecreator2"); >+ attachment2.setObsolete(true); >+ attachment2.setPatch(false); >+ attachment2.setRepositoryKind("bugzilla2"); >+ attachment2.setRepositoryUrl("repUrl2"); >+ attachment2.setTaskId("taskid2"); >+ attachment2.addAttribute("attr3", new RepositoryTaskAttribute("attr3", "attr3Name", true)); >+ attachment2.addAttribute("attr4", new RepositoryTaskAttribute("attr4", "attr4Name", true)); >+ >+ attachments.add(attachment1); >+ attachments.add(attachment2); >+ XMLMemento memento = XMLMemento.createWriteRoot("Attachments"); >+ storage.addAttachments(memento, attachments); >+ List<RepositoryAttachment> readAttachments = storage.readAttachments(memento); >+ >+ assertEquals(2, readAttachments.size()); >+ RepositoryAttachment readAttachment = readAttachments.get(0); >+ assertEquals(attachment1.getTaskId(), readAttachment.getTaskId()); >+ assertEquals(attachment1.getCreator(), readAttachment.getCreator()); >+ assertEquals(attachment1.isObsolete(), readAttachment.isObsolete()); >+ assertEquals(attachment1.isPatch(), readAttachment.isPatch()); >+ assertEquals(attachment1.getRepositoryKind(), readAttachment.getRepositoryKind()); >+ assertEquals(attachment1.getRepositoryUrl(), readAttachment.getRepositoryUrl()); >+ assertEquals(attachment1.getAttributeValue("attr1"), readAttachment.getAttributeValue("attr1")); >+ assertEquals(attachment1.getAttributeValue("attr2"), readAttachment.getAttributeValue("attr2")); >+ >+ readAttachment = readAttachments.get(1); >+ assertEquals(attachment2.getTaskId(), readAttachment.getTaskId()); >+ assertEquals(attachment2.getCreator(), readAttachment.getCreator()); >+ assertEquals(attachment2.isObsolete(), readAttachment.isObsolete()); >+ assertEquals(attachment2.isPatch(), readAttachment.isPatch()); >+ assertEquals(attachment2.getRepositoryKind(), readAttachment.getRepositoryKind()); >+ assertEquals(attachment2.getRepositoryUrl(), readAttachment.getRepositoryUrl()); >+ assertEquals(attachment2.getAttributeValue("attr3"), readAttachment.getAttributeValue("attr3")); >+ assertEquals(attachment2.getAttributeValue("attr4"), readAttachment.getAttributeValue("attr4")); >+ } >+} >Index: src/org/eclipse/mylyn/tasks/tests/OfflineCachingStorageTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/OfflineCachingStorageTest.java >diff -N src/org/eclipse/mylyn/tasks/tests/OfflineCachingStorageTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/OfflineCachingStorageTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,149 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 Mylar 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.tests; >+ >+import java.io.File; >+import java.util.HashSet; >+import java.util.Set; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.mylyn.internal.tasks.core.TaskDataState; >+import org.eclipse.mylyn.internal.tasks.ui.OfflineCachingStorage; >+import org.eclipse.mylyn.internal.tasks.ui.OfflineFileStorage; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >+import org.eclipse.mylyn.tasks.tests.connector.MockAttributeFactory; >+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector; >+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; >+ >+/** >+ * @author Rob Elves >+ */ >+public class OfflineCachingStorageTest extends TestCase { >+ >+ private static final String MOCK_ID = "1"; >+ >+ private File dataDir; >+ >+ private OfflineCachingStorage storage; >+ >+ protected void setUp() throws Exception { >+ //dataDir = new File("c:/offline"); >+ dataDir = new File(TasksUiPlugin.getDefault().getDataDirectory() + '/' + "offline"); >+ storage = new OfflineCachingStorage(new OfflineFileStorage(dataDir)); >+ storage.start(); >+ super.setUp(); >+ } >+ >+ protected void tearDown() throws Exception { >+ storage.stop(); >+ storage.clear(); >+ } >+ >+ public void testPutAndGet() throws Exception { >+ >+ TaskDataState state = new TaskDataState(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ >+ RepositoryTaskData newData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ >+ newData.setAttributeValue("attributeKey1", "attValue!"); >+ newData.setDescription("description"); >+ newData.setNew(true); >+ newData.setNewComment("new comment"); >+ newData.setSummary("summary"); >+ newData.setTaskKey("task key"); >+ >+ RepositoryTaskData oldData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ >+ Set<RepositoryTaskAttribute> edits = new HashSet<RepositoryTaskAttribute>(); >+ >+ state.setNewTaskData(newData); >+ state.setOldTaskData(oldData); >+ state.setEdits(edits); >+ >+ storage.put(state); >+ >+ TaskDataState retrieved = storage.get(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ assertNotNull(retrieved); >+ RepositoryTaskData newTaskData = retrieved.getNewTaskData(); >+ assertNotNull(newTaskData); >+ assertEquals(MockRepositoryConnector.REPOSITORY_KIND, newTaskData.getRepositoryKind()); >+ assertEquals("description", newTaskData.getDescription()); >+ assertEquals("new comment", newTaskData.getNewComment()); >+ assertEquals("task key", newTaskData.getTaskKey()); >+ } >+ >+ public void testRemove() throws Exception { >+ assertNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID)); >+ >+ TaskDataState state = new TaskDataState(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ >+ RepositoryTaskData newData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ >+ newData.setAttributeValue("attributeKey1", "attValue!"); >+ newData.setDescription("description"); >+ newData.setNew(true); >+ newData.setNewComment("new comment"); >+ newData.setSummary("summary"); >+ newData.setTaskKey("task key"); >+ >+ RepositoryTaskData oldData = new RepositoryTaskData(new MockAttributeFactory(), >+ MockRepositoryConnector.REPOSITORY_KIND, MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ >+ Set<RepositoryTaskAttribute> edits = new HashSet<RepositoryTaskAttribute>(); >+ >+ state.setNewTaskData(newData); >+ state.setOldTaskData(oldData); >+ state.setEdits(edits); >+ >+ storage.put(state); >+ assertEquals(1, storage.getReadQueue().size()); >+ assertEquals("1", storage.getReadQueue().iterator().next().getId()); >+ assertNotNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID)); >+ storage.remove(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ assertEquals(0, storage.getReadQueue().size()); >+ assertNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID)); >+ >+ } >+ >+ public void testLRUQueue() { >+ assertNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID)); >+ assertEquals(0, storage.getReadQueue().size()); >+ TaskDataState state1 = new TaskDataState(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID); >+ TaskDataState state2 = new TaskDataState(MockRepositoryConnector.REPOSITORY_URL, "2"); >+ TaskDataState state3 = new TaskDataState(MockRepositoryConnector.REPOSITORY_URL, "3"); >+ >+ storage.put(state1); >+ storage.put(state2); >+ storage.put(state3); >+ >+ assertEquals(3, storage.getReadQueue().size()); >+ >+ // should return least recently used >+ assertEquals("1", storage.getReadQueue().iterator().next().getId()); >+ >+ assertNotNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, "3")); >+ assertNotNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, "2")); >+ assertNotNull(storage.get(MockRepositoryConnector.REPOSITORY_URL, MOCK_ID)); >+ >+ assertEquals(3, storage.getReadQueue().size()); >+ >+ // should return least recently used >+ assertEquals("3", storage.getReadQueue().iterator().next().getId()); >+ storage.put(state1); >+ storage.put(state3); >+ // should return least recently used >+ assertEquals("2", storage.getReadQueue().iterator().next().getId()); >+ assertEquals(3, storage.getReadQueue().size()); >+ } >+} >Index: .refactorings/2007/6/25/refactorings.index >=================================================================== >RCS file: .refactorings/2007/6/25/refactorings.index >diff -N .refactorings/2007/6/25/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/6/25/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+1182103561703 Copy compilation unit >+1182103621687 Rename type 'FileSystemTaskDataStorageTest' >+1182103638140 Rename type 'OfflineXMLStorageTest' >+1182103665234 Rename type 'CachingOfflineStorageTest' >+1182103708843 Rename type 'OfflineXmlStorageTest' >+1182105507625 Extract constant 'MOCK_ID' >Index: .refactorings/2007/6/25/refactorings.history >=================================================================== >RCS file: .refactorings/2007/6/25/refactorings.history >diff -N .refactorings/2007/6/25/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/6/25/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+<?xml version="1.0" encoding="utf-8" standalone="no"?> >+<session version="1.0"> >+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylyn.tasks.tests/src/org.eclipse.mylyn.tasks.tests' - Original project: 'org.eclipse.mylyn.tasks.tests' - Destination element: 'org.eclipse.mylyn.tasks.tests/src/org.eclipse.mylyn.tasks.tests' - Original element: 'org.eclipse.mylyn.tasks.tests.FileSystemTaskDataStorageTest.java'" description="Copy compilation unit" destination="/src<org.eclipse.mylyn.tasks.tests" element1="/src<org.eclipse.mylyn.tasks.tests{FileSystemTaskDataStorageTest.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src<org.eclipse.mylyn.tasks.tests{FileSystemTaskDataStorageTest.java	true	true	CachingOfflineStorageTest.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1182103561703" units="1" version="1.0"/> >+<refactoring comment="Rename type 'org.eclipse.mylyn.tasks.tests.FileSystemTaskDataStorageTest' to 'OfflineXMLStorageTest' - Original project: 'org.eclipse.mylyn.tasks.tests' - Original element: 'org.eclipse.mylyn.tasks.tests.FileSystemTaskDataStorageTest' - Renamed element: 'org.eclipse.mylyn.tasks.tests.OfflineXMLStorageTest' - Update references to refactored element - Rename similarly named elements - Update fully qualified names in '*.xml, *.xsd' files - Update textual occurrences in comments and strings" description="Rename type 'FileSystemTaskDataStorageTest'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylyn.tasks.tests{FileSystemTaskDataStorageTest.java[FileSystemTaskDataStorageTest" matchStrategy="1" name="OfflineXMLStorageTest" patterns="*.xml, *.xsd" qualified="true" references="true" similarDeclarations="true" stamp="1182103621687" textual="true" version="1.0"/> >+<refactoring comment="Rename type 'org.eclipse.mylyn.tasks.tests.OfflineXMLStorageTest' to 'OfflineXmlStorageTest' - Original project: 'org.eclipse.mylyn.tasks.tests' - Original element: 'org.eclipse.mylyn.tasks.tests.OfflineXMLStorageTest' - Renamed element: 'org.eclipse.mylyn.tasks.tests.OfflineXmlStorageTest' - Update references to refactored element - Rename similarly named elements - Update fully qualified names in '*.xml, *.xsd' files - Update textual occurrences in comments and strings" description="Rename type 'OfflineXMLStorageTest'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylyn.tasks.tests{OfflineXMLStorageTest.java[OfflineXMLStorageTest" matchStrategy="1" name="OfflineXmlStorageTest" patterns="*.xml, *.xsd" qualified="true" references="true" similarDeclarations="true" stamp="1182103638140" textual="true" version="1.0"/> >+<refactoring comment="Rename type 'org.eclipse.mylyn.tasks.tests.CachingOfflineStorageTest' to 'OfflineCachingStorageTest' - Original project: 'org.eclipse.mylyn.tasks.tests' - Original element: 'org.eclipse.mylyn.tasks.tests.CachingOfflineStorageTest' - Renamed element: 'org.eclipse.mylyn.tasks.tests.OfflineCachingStorageTest' - Update references to refactored element - Rename similarly named elements - Update fully qualified names in '*.xml, *.xsd' files - Update textual occurrences in comments and strings" description="Rename type 'CachingOfflineStorageTest'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylyn.tasks.tests{CachingOfflineStorageTest.java[CachingOfflineStorageTest" matchStrategy="1" name="OfflineCachingStorageTest" patterns="*.xml, *.xsd" qualified="true" references="true" similarDeclarations="true" stamp="1182103665234" textual="true" version="1.0"/> >+<refactoring comment="Rename type 'org.eclipse.mylyn.tasks.tests.OfflineXmlStorageTest' to 'OfflineStorageTest' - Original project: 'org.eclipse.mylyn.tasks.tests' - Original element: 'org.eclipse.mylyn.tasks.tests.OfflineXmlStorageTest' - Renamed element: 'org.eclipse.mylyn.tasks.tests.OfflineStorageTest' - Update references to refactored element - Rename similarly named elements - Update fully qualified names in '*.xml, *.xsd' files - Update textual occurrences in comments and strings" description="Rename type 'OfflineXmlStorageTest'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylyn.tasks.tests{OfflineXmlStorageTest.java[OfflineXmlStorageTest" matchStrategy="1" name="OfflineStorageTest" patterns="*.xml, *.xsd" qualified="true" references="true" similarDeclarations="true" stamp="1182103708843" textual="true" version="1.0"/> >+<refactoring comment="Extract constant 'org.eclipse.mylyn.tasks.tests.OfflineCachingStorageTest.MOCK_ID' from expression '"1"' - Original project: 'org.eclipse.mylyn.tasks.tests' - Constant name: 'MOCK_ID' - Constant expression: '"1"' - Declared visibility: 'private' - Replace occurrences of expression with constant" description="Extract constant 'MOCK_ID'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src<org.eclipse.mylyn.tasks.tests{OfflineCachingStorageTest.java" name="MOCK_ID" qualify="false" replace="true" selection="3287 3" stamp="1182105507625" version="1.0" visibility="2"/> >+</session> >#P org.eclipse.mylyn.tests >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tests/META-INF/MANIFEST.MF,v >retrieving revision 1.41 >diff -u -r1.41 MANIFEST.MF >--- META-INF/MANIFEST.MF 15 Jun 2007 06:23:45 -0000 1.41 >+++ META-INF/MANIFEST.MF 18 Jun 2007 18:10:19 -0000 >@@ -16,7 +16,6 @@ > org.eclipse.mylyn.java.tests, > org.eclipse.mylyn.tasks.tests, > org.eclipse.mylyn.monitor.tests, >- org.eclipse.mylyn.web, > org.eclipse.mylyn.tasks.ui, > org.eclipse.mylyn.context.core, > org.eclipse.mylyn.bugzilla.tests, >@@ -35,5 +34,6 @@ > org.eclipse.mylyn.monitor.core, > org.eclipse.mylyn.web.tasks, > org.eclipse.mylyn, >- org.eclipse.mylyn.web.core >+ org.eclipse.mylyn.web.core, >+ org.eclipse.mylyn.web.ui > Bundle-RequiredExecutionEnvironment: J2SE-1.5 >#P org.eclipse.mylyn.trac.core >Index: src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java,v >retrieving revision 1.20 >diff -u -r1.20 TracTaskDataHandler.java >--- src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java 14 Jun 2007 05:18:55 -0000 1.20 >+++ src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java 18 Jun 2007 18:10:19 -0000 >@@ -290,7 +290,7 @@ > attr.setValue(field.getDefaultValue()); > } > } >- data.addAttribute(attr.getID(), attr); >+ data.addAttribute(attr.getId(), attr); > } > > private static RepositoryTaskAttribute createAttribute(AbstractAttributeFactory factory, RepositoryTaskData data, >Index: src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java,v >retrieving revision 1.48 >diff -u -r1.48 TracRepositoryConnector.java >--- src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java 14 Jun 2007 22:00:59 -0000 1.48 >+++ src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java 18 Jun 2007 18:10:19 -0000 >@@ -332,10 +332,10 @@ > > List<RepositoryTaskAttribute> attributes = data.getAttributes(); > for (RepositoryTaskAttribute attribute : attributes) { >- if (TracAttributeFactory.isInternalAttribute(attribute.getID())) { >+ if (TracAttributeFactory.isInternalAttribute(attribute.getId())) { > // ignore > } else if (!attribute.isReadOnly()) { >- ticket.putValue(attribute.getID(), attribute.getValue()); >+ ticket.putValue(attribute.getId(), attribute.getValue()); > } > } > >#P org.eclipse.mylyn.sandbox.ui >Index: src/org/eclipse/mylyn/internal/sandbox/bridge/bugs/BugzillaMylarSearchOperation.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/src/org/eclipse/mylyn/internal/sandbox/bridge/bugs/BugzillaMylarSearchOperation.java,v >retrieving revision 1.25 >diff -u -r1.25 BugzillaMylarSearchOperation.java >--- src/org/eclipse/mylyn/internal/sandbox/bridge/bugs/BugzillaMylarSearchOperation.java 15 Jun 2007 22:04:33 -0000 1.25 >+++ src/org/eclipse/mylyn/internal/sandbox/bridge/bugs/BugzillaMylarSearchOperation.java 18 Jun 2007 18:10:20 -0000 >@@ -214,7 +214,7 @@ > > // we have a bugzilla task, so get the bug report > BugzillaTask bugTask = (BugzillaTask) task; >- RepositoryTaskData bugTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(bugTask.getHandleIdentifier()); >+ RepositoryTaskData bugTaskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(bugTask.getRepositoryUrl(), bugTask.getTaskId()); > //RepositoryTaskData bugTaskData = bugTask.getTaskData(); > > // parse the bug report for the element that we are searching >#P org.eclipse.mylyn.context.core >Index: .refactorings/2007/6/24/refactorings.index >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.core/.refactorings/2007/6/24/refactorings.index,v >retrieving revision 1.2 >diff -u -r1.2 refactorings.index >--- .refactorings/2007/6/24/refactorings.index 12 Jun 2007 19:05:28 -0000 1.2 >+++ .refactorings/2007/6/24/refactorings.index 18 Jun 2007 18:10:21 -0000 >@@ -1,2 +1,4 @@ > 1181620930143 Rename field 'CONTENT_TYPE_ANY' > 1181674511100 Rename type 'IMylarSearchOperation' >+1182034231703 Rename method 'makeXMLString' >+1182034251781 Rename method 'cleanXMLString' >Index: .refactorings/2007/6/24/refactorings.history >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.core/.refactorings/2007/6/24/refactorings.history,v >retrieving revision 1.2 >diff -u -r1.2 refactorings.history >--- .refactorings/2007/6/24/refactorings.history 12 Jun 2007 19:05:28 -0000 1.2 >+++ .refactorings/2007/6/24/refactorings.history 18 Jun 2007 18:10:21 -0000 >@@ -2,4 +2,6 @@ > <session version="1.0"> > <refactoring comment="Rename field 'CONTENT_TYPE_ANY' in 'org.eclipse.mylyn.context.core.ContextCorePlugin' to 'CONTENT_TYPE_RESOURCE' - Original project: 'org.eclipse.mylyn.context.core' - Original element: 'org.eclipse.mylyn.context.core.ContextCorePlugin.CONTENT_TYPE_ANY' - Renamed element: 'org.eclipse.mylyn.context.core.ContextCorePlugin.CONTENT_TYPE_RESOURCE' - Update references to refactored element - Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'CONTENT_TYPE_ANY'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src<org.eclipse.mylyn.context.core{ContextCorePlugin.java[ContextCorePlugin^CONTENT_TYPE_ANY" name="CONTENT_TYPE_RESOURCE" references="true" setter="false" stamp="1181620930143" textual="false" version="1.0"/> > <refactoring comment="Rename type 'org.eclipse.mylyn.internal.context.core.IMylarSearchOperation' to 'IActiveSearchOperation' - Original project: 'org.eclipse.mylyn.context.core' - Original element: 'org.eclipse.mylyn.internal.context.core.IMylarSearchOperation' - Renamed element: 'org.eclipse.mylyn.internal.context.core.IActiveSearchOperation' - Update references to refactored element - Update fully qualified names in '*.xml, *.properties, *.exsd, *.mf' files - Update textual occurrences in comments and strings" description="Rename type 'IMylarSearchOperation'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src<org.eclipse.mylyn.internal.context.core{IMylarSearchOperation.java[IMylarSearchOperation" matchStrategy="1" name="IActiveSearchOperation" patterns="*.xml, *.properties, *.exsd, *.mf" qualified="true" references="true" similarDeclarations="false" stamp="1181674511100" textual="false" version="1.0"/> >+<refactoring comment="Rename method 'org.eclipse.mylyn.context.core.ContextCorePlugin.makeXMLString(...)' to 'cleanXMLString' - Original project: 'org.eclipse.mylyn.context.core' - Original element: 'org.eclipse.mylyn.context.core.ContextCorePlugin.makeXMLString(...)' - Renamed element: 'org.eclipse.mylyn.context.core.ContextCorePlugin.cleanXMLString(...)' - Update references to refactored element" delegate="false" deprecate="false" description="Rename method 'makeXMLString'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src<org.eclipse.mylyn.context.core{ContextCorePlugin.java[ContextCorePlugin~makeXMLString~QString;" name="cleanXMLString" references="true" stamp="1182034231703" version="1.0"/> >+<refactoring comment="Rename method 'org.eclipse.mylyn.context.core.ContextCorePlugin.cleanXMLString(...)' to 'cleanXmlString' - Original project: 'org.eclipse.mylyn.context.core' - Original element: 'org.eclipse.mylyn.context.core.ContextCorePlugin.cleanXMLString(...)' - Renamed element: 'org.eclipse.mylyn.context.core.ContextCorePlugin.cleanXmlString(...)' - Update references to refactored element" delegate="false" deprecate="false" description="Rename method 'cleanXMLString'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src<org.eclipse.mylyn.context.core{ContextCorePlugin.java[ContextCorePlugin~cleanXMLString~QString;" name="cleanXmlString" references="true" stamp="1182034251781" version="1.0"/> > </session> >Index: src/org/eclipse/mylyn/context/core/ContextCorePlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.core/src/org/eclipse/mylyn/context/core/ContextCorePlugin.java,v >retrieving revision 1.20 >diff -u -r1.20 ContextCorePlugin.java >--- src/org/eclipse/mylyn/context/core/ContextCorePlugin.java 15 Jun 2007 22:04:47 -0000 1.20 >+++ src/org/eclipse/mylyn/context/core/ContextCorePlugin.java 18 Jun 2007 18:10:21 -0000 >@@ -11,7 +11,6 @@ > package org.eclipse.mylyn.context.core; > > import java.util.ArrayList; >-import java.util.Arrays; > import java.util.Collections; > import java.util.HashMap; > import java.util.HashSet; >@@ -43,7 +42,7 @@ > private Map<String, AbstractContextStructureBridge> bridges = new HashMap<String, AbstractContextStructureBridge>(); > > private Map<String, List<String>> childContentTypeMap = new HashMap<String, List<String>>(); >- >+ > private AbstractContextStructureBridge defaultBridge = null; > > private static ContextCorePlugin INSTANCE; >@@ -105,7 +104,7 @@ > > @Override > public boolean isDocument(String handle) { >- return false; >+ return false; > // throw new RuntimeException("null adapter for handle: " + handle); > } > >@@ -169,9 +168,9 @@ > } > providers.add(provider); > } >- >+ > /** >- * @return all relation providers >+ * @return all relation providers > */ > public Set<AbstractRelationProvider> getRelationProviders() { > Set<AbstractRelationProvider> allProviders = new HashSet<AbstractRelationProvider>(); >@@ -184,7 +183,7 @@ > public Set<AbstractRelationProvider> getRelationProviders(String contentType) { > return relationProviders.get(contentType); > } >- >+ > public static ContextCorePlugin getDefault() { > return INSTANCE; > } >@@ -269,8 +268,7 @@ > public static void initExtensions() { > if (!extensionsRead) { > IExtensionRegistry registry = Platform.getExtensionRegistry(); >- IExtensionPoint extensionPoint = registry >- .getExtensionPoint(BridgesExtensionPointReader.EXTENSION_ID_CONTEXT); >+ IExtensionPoint extensionPoint = registry.getExtensionPoint(BridgesExtensionPointReader.EXTENSION_ID_CONTEXT); > IExtension[] extensions = extensionPoint.getExtensions(); > for (int i = 0; i < extensions.length; i++) { > IConfigurationElement[] elements = extensions[i].getConfigurationElements(); >@@ -309,9 +307,9 @@ > private static final String ELEMENT_STRUCTURE_BRIDGE = "structureBridge"; > > private static final String ELEMENT_RELATION_PROVIDER = "relationProvider"; >- >+ > private static final String ATTR_CLASS = "class"; >- >+ > private static final String ATTR_CONTENT_TYPE = "contentType"; > > private static final String ATTR_PARENT_CONTENT_TYPE = "parentContentType"; >@@ -321,15 +319,15 @@ > public static void initExtensions() { > if (!extensionsRead) { > IExtensionRegistry registry = Platform.getExtensionRegistry(); >- IExtensionPoint extensionPoint = registry >- .getExtensionPoint(BridgesExtensionPointReader.EXTENSION_ID_CONTEXT); >+ IExtensionPoint extensionPoint = registry.getExtensionPoint(BridgesExtensionPointReader.EXTENSION_ID_CONTEXT); > IExtension[] extensions = extensionPoint.getExtensions(); > for (int i = 0; i < extensions.length; i++) { > IConfigurationElement[] elements = extensions[i].getConfigurationElements(); > for (int j = 0; j < elements.length; j++) { > if (elements[j].getName().compareTo(BridgesExtensionPointReader.ELEMENT_STRUCTURE_BRIDGE) == 0) { > readBridge(elements[j]); >- } else if (elements[j].getName().compareTo(BridgesExtensionPointReader.ELEMENT_RELATION_PROVIDER) == 0) { >+ } else if (elements[j].getName().compareTo( >+ BridgesExtensionPointReader.ELEMENT_RELATION_PROVIDER) == 0) { > readRelationProvider(elements[j]); > } > } >@@ -350,8 +348,7 @@ > > AbstractContextStructureBridge bridge = (AbstractContextStructureBridge) object; > if (element.getAttribute(BridgesExtensionPointReader.ATTR_PARENT_CONTENT_TYPE) != null) { >- String parentContentType = element >- .getAttribute(BridgesExtensionPointReader.ATTR_PARENT_CONTENT_TYPE); >+ String parentContentType = element.getAttribute(BridgesExtensionPointReader.ATTR_PARENT_CONTENT_TYPE); > if (parentContentType instanceof String) { > bridge.setParentContentType(parentContentType); > } >@@ -361,12 +358,12 @@ > StatusManager.log(e, "Could not load bridge extension"); > } > } >- >+ > @SuppressWarnings("deprecation") > private static void readRelationProvider(IConfigurationElement element) { > try { > String contentType = element.getAttribute(BridgesExtensionPointReader.ATTR_CONTENT_TYPE); >- AbstractRelationProvider relationProvider = (AbstractRelationProvider)element.createExecutableExtension(BridgesExtensionPointReader.ATTR_CLASS); >+ AbstractRelationProvider relationProvider = (AbstractRelationProvider) element.createExecutableExtension(BridgesExtensionPointReader.ATTR_CLASS); > if (contentType != null) { > ContextCorePlugin.getDefault().addRelationProvider(contentType, relationProvider); > } >@@ -428,4 +425,25 @@ > return Collections.emptyList(); > } > } >+ >+ /** >+ * TODO: Move to utility class >+ * @param text >+ * @return string with all non valid characters removed, if text is null return null >+ */ >+ public static String cleanXmlString(String text) { >+ if (text == null) >+ return null; >+ StringBuilder builder = new StringBuilder(text.length()); >+ for (int x = 0; x < text.length(); x++) { >+ char ch = text.charAt(x); >+ // http://www.w3.org/TR/REC-xml/#charsets >+ // Valid unicode characters for xml 1.0 >+ if ((0x0A == ch || 0x0D == ch || 0x09 == ch) || (ch >= 0x20 && ch <= 0xD7FF) >+ || (ch >= 0xE000 && ch <= 0xFFFD) || (ch >= 0x10000 && ch <= 0x10FFFF)) { >+ builder.append(ch); >+ } >+ } >+ return builder.toString(); >+ } > } >#P org.eclipse.mylyn.tasks.core >Index: src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java,v >retrieving revision 1.45 >diff -u -r1.45 AbstractRepositoryConnector.java >--- src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java 15 Jun 2007 22:04:35 -0000 1.45 >+++ src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java 18 Jun 2007 18:10:22 -0000 >@@ -84,16 +84,16 @@ > /** > * create task and necessary subtasks (1 level nesting) > */ >- public AbstractTask createTaskFromExistingId(TaskRepository repository, String id, >- IProgressMonitor monitor) throws CoreException { >+ public AbstractTask createTaskFromExistingId(TaskRepository repository, String id, IProgressMonitor monitor) >+ throws CoreException { > return createTaskFromExistingId(repository, id, true, monitor); > } > > /** > * Create new repository task, adding result to tasklist > */ >- public AbstractTask createTaskFromExistingId(TaskRepository repository, String id, >- boolean retrieveSubTasks, IProgressMonitor monitor) throws CoreException { >+ public AbstractTask createTaskFromExistingId(TaskRepository repository, String id, boolean retrieveSubTasks, >+ IProgressMonitor monitor) throws CoreException { > AbstractTask task = taskList.getTask(repository.getUrl(), id); > AbstractTask repositoryTask = null; > if (task instanceof AbstractTask) { >@@ -115,8 +115,7 @@ > } > > /** >- * Creates a new task from the given task data. Does NOT add resulting task >- * to the tasklist >+ * Creates a new task from the given task data. Does NOT add resulting task to the tasklist > */ > public AbstractTask createTaskFromTaskData(TaskRepository repository, RepositoryTaskData taskData, > boolean retrieveSubTasks, IProgressMonitor monitor) throws CoreException { >@@ -153,8 +152,7 @@ > } > > /** >- * Utility method for construction of connector specific task object TODO: >- * Move to 'task' factory >+ * Utility method for construction of connector specific task object TODO: Move to 'task' factory > * > * @return instance of AbstractTask > */ >@@ -184,15 +182,12 @@ > public abstract String getRepositoryType(); > > /** >- * Updates the properties of <code>repositoryTask</code>. Invoked when on >- * task synchronization if {@link #getTaskDataHandler()} returns >- * <code>null</code> or >- * {@link ITaskDataHandler#getTaskData(TaskRepository, String)} returns >- * <code>null</code>. >+ * Updates the properties of <code>repositoryTask</code>. Invoked when on task synchronization if >+ * {@link #getTaskDataHandler()} returns <code>null</code> or >+ * {@link ITaskDataHandler#getTaskData(TaskRepository, String)} returns <code>null</code>. > * > * <p> >- * Connectors that provide {@link RepositoryTaskData} objects for all tasks >- * do not need to implement this method. >+ * Connectors that provide {@link RepositoryTaskData} objects for all tasks do not need to implement this method. > * > * @param repository > * the repository >@@ -219,20 +214,21 @@ > } > > /** >- * Implementors of this repositoryOperations must perform it locally without >- * going to the server since it is used for frequent repositoryOperations >- * such as decoration. >+ * Implementors of this repositoryOperations must perform it locally without going to the server since it is used >+ * for frequent repositoryOperations such as decoration. > * > * @return an empty set if no contexts > */ > public final Set<RepositoryAttachment> getContextAttachments(TaskRepository repository, AbstractTask task) { > Set<RepositoryAttachment> contextAttachments = new HashSet<RepositoryAttachment>(); > >- if (taskDataManager != null && taskDataManager.getNewTaskData(task.getHandleIdentifier()) != null) { >- for (RepositoryAttachment attachment : taskDataManager.getNewTaskData(task.getHandleIdentifier()) >- .getAttachments()) { >- if (attachment.getDescription().equals(MYLAR_CONTEXT_DESCRIPTION)) { >- contextAttachments.add(attachment); >+ if (taskDataManager != null) { >+ RepositoryTaskData newData = taskDataManager.getNewTaskData(task.getRepositoryUrl(), task.getTaskId()); >+ if (newData != null) { >+ for (RepositoryAttachment attachment : newData.getAttachments()) { >+ if (attachment.getDescription().equals(MYLAR_CONTEXT_DESCRIPTION)) { >+ contextAttachments.add(attachment); >+ } > } > } > } >@@ -259,15 +255,17 @@ > * > * All errors should be thrown as <code>CoreException</code> for the framework to handle, since background > * synchronizations fail silently when disconnected. >- * @param tasks TODO >+ * >+ * @param tasks >+ * TODO > * > * @return null 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 > */ >- public abstract boolean markStaleTasks(TaskRepository repository, >- Set<AbstractTask> tasks, IProgressMonitor monitor) throws CoreException; >+ public abstract boolean markStaleTasks(TaskRepository repository, Set<AbstractTask> tasks, IProgressMonitor monitor) >+ throws CoreException; > > /** > * Attaches the associated context to <code>task</code>. >@@ -309,13 +307,12 @@ > } > > /** >- * Retrieves a context stored in <code>attachment</code> from >- * <code>task</code>. >+ * Retrieves a context stored in <code>attachment</code> from <code>task</code>. > * > * @return false, if operation is not supported by repository > */ >- public final boolean retrieveContext(TaskRepository repository, AbstractTask task, >- RepositoryAttachment attachment, String destinationPath, IProgressMonitor monitor) throws CoreException { >+ public final boolean retrieveContext(TaskRepository repository, AbstractTask task, RepositoryAttachment attachment, >+ String destinationPath, IProgressMonitor monitor) throws CoreException { > IAttachmentHandler attachmentHandler = getAttachmentHandler(); > if (attachmentHandler == null) { > return false; >@@ -376,8 +373,7 @@ > } > > /** >- * Reset and update the repository attributes from the server (e.g. >- * products, components) >+ * Reset and update the repository attributes from the server (e.g. products, components) > * > * TODO: remove? > */ >@@ -392,10 +388,8 @@ > } > > /** >- * 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. >+ * 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. > */ > public String getSynchronizationTimestamp(TaskRepository repository, Set<AbstractTask> changedTasks) { > Date mostRecent = new Date(0); >@@ -421,7 +415,7 @@ > > private RepositoryTaskData getTaskData(AbstractTask task) { > if (taskDataManager != null) { >- return taskDataManager.getNewTaskData(task.getHandleIdentifier()); >+ return taskDataManager.getNewTaskData(task.getRepositoryUrl(), task.getTaskId()); > } > return null; > } >@@ -437,5 +431,4 @@ > this.taskDataManager = taskDataManager; > } > >- > } >Index: src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java,v >retrieving revision 1.53 >diff -u -r1.53 DelegatingTaskExternalizer.java >--- src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java 15 Jun 2007 22:04:35 -0000 1.53 >+++ src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java 18 Jun 2007 18:10:22 -0000 >@@ -19,6 +19,7 @@ > import java.util.List; > import java.util.Locale; > >+import org.eclipse.mylyn.context.core.ContextCorePlugin; > import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; > import org.eclipse.mylyn.internal.tasks.core.LocalTask; > import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil; >@@ -126,7 +127,7 @@ > public static final String KEY_SYNC_STATE = "offlineSyncState"; > > public static final String KEY_OWNER = "Owner"; >- >+ > public static final String KEY_STALE = "Stale"; > > private List<ITaskListExternalizer> delegateExternalizers = new ArrayList<ITaskListExternalizer>(); >@@ -271,14 +272,7 @@ > protected String stripControlCharacters(String text) { > if (text == null) > return ""; >- StringBuilder builder = new StringBuilder(text.length()); >- for (int x = 0; x < text.length(); x++) { >- char temp = text.charAt(x); >- if (!Character.isISOControl(temp) || temp == '\n' || temp == '\r' || temp == '\t') { >- builder.append(temp); >- } >- } >- return builder.toString(); >+ return ContextCorePlugin.cleanXmlString(text); > } > > protected String formatExternDate(Date date) { >Index: src/org/eclipse/mylyn/tasks/core/RepositoryOperation.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryOperation.java,v >retrieving revision 1.2 >diff -u -r1.2 RepositoryOperation.java >--- src/org/eclipse/mylyn/tasks/core/RepositoryOperation.java 8 Jun 2007 00:35:02 -0000 1.2 >+++ src/org/eclipse/mylyn/tasks/core/RepositoryOperation.java 18 Jun 2007 18:10:22 -0000 >@@ -45,7 +45,7 @@ > private boolean hasOptions = false; > > /** The name of the operation (text that we display) */ >- private String op_name; >+ private String operation_name; > > /** The option that is selected */ > private String op_sel; >@@ -69,7 +69,7 @@ > */ > public RepositoryOperation(String knobName, String operationName) { > knob_name = knobName; >- op_name = operationName; >+ operation_name = operationName; > } > > /** >@@ -87,7 +87,7 @@ > * @return The display name > */ > public String getOperationName() { >- return op_name; >+ return operation_name; > } > > /** >Index: src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java,v >retrieving revision 1.26 >diff -u -r1.26 RepositoryTaskData.java >--- src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java 13 Jun 2007 22:49:37 -0000 1.26 >+++ src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java 18 Jun 2007 18:10:22 -0000 >@@ -20,9 +20,8 @@ > import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil; > > /** >- * 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). >+ * 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 >@@ -31,13 +30,9 @@ > > private static final long serialVersionUID = 2304501248225237699L; > >- private boolean hasLocalChanges = false; >- > private boolean isNew = false; > > private String reportID; >- >- private String key; > > private String repositoryURL; > >@@ -55,16 +50,14 @@ > /** The repositoryOperations that can be done on the report */ > private List<RepositoryOperation> repositoryOperations = new ArrayList<RepositoryOperation>(); > >- > public RepositoryTaskData(AbstractAttributeFactory factory, String repositoryKind, String repositoryURL, String id) { >- this(factory, repositoryKind, repositoryURL, id, AbstractTask.DEFAULT_TASK_KIND); >+ 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.key = id; > this.repositoryKind = repositoryKind; > this.repositoryURL = repositoryURL; > this.taskKind = taskKind; >@@ -288,6 +281,10 @@ > return getId(); > } > >+ public void setTaskKey(String key) { >+ setAttributeValue(RepositoryTaskAttribute.TASK_KEY, key); >+ } >+ > /** > * @return the server for this report > */ >@@ -295,16 +292,6 @@ > return repositoryURL; > } > >- @Deprecated >- public boolean hasLocalChanges() { >- return hasLocalChanges; >- } >- >- @Deprecated >- public void setHasLocalChanges(boolean b) { >- hasLocalChanges = b; >- } >- > @Override > public List<String> getAttributeValues(String key) { > RepositoryTaskAttribute attribute = getAttribute(key); >@@ -342,17 +329,12 @@ > > public void setRepositoryURL(String repositoryURL) { > this.repositoryURL = repositoryURL; >+ for (RepositoryAttachment attachment : attachments) { >+ attachment.setRepositoryUrl(repositoryURL); >+ } > } >- >+ > public final String getHandleIdentifier() { > return RepositoryTaskHandleUtil.getHandle(getRepositoryUrl(), getId()); > } >- >- public String getKey() { >- return key; >- } >- >- public void setKey(String key) { >- this.key = key; >- } > } >Index: src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java,v >retrieving revision 1.26 >diff -u -r1.26 RepositoryTaskAttribute.java >--- src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java 8 Jun 2007 00:35:02 -0000 1.26 >+++ src/org/eclipse/mylyn/tasks/core/RepositoryTaskAttribute.java 18 Jun 2007 18:10:22 -0000 >@@ -111,8 +111,8 @@ > /** Attribute pretty printing name */ > private String name; > >- /** Name of the option used when updating the attribute on the server */ >- private String key; >+ /** ID of the option used when updating the attribute on the server */ >+ private String id; > > /** Option parameters */ > private Map<String, String> optionParameters; >@@ -127,8 +127,8 @@ > > private Map<String, String> metaData = new HashMap<String, String>(); > >- public RepositoryTaskAttribute(String key, String name, boolean hidden) { >- this.key = key; >+ public RepositoryTaskAttribute(String id, String name, boolean hidden) { >+ this.id = id; > this.name = name; > this.hidden = hidden; > this.options = new ArrayList<String>(); >@@ -139,8 +139,8 @@ > return name; > } > >- public String getID() { >- return key; >+ public String getId() { >+ return id; > } > > public boolean isReadOnly() { >@@ -241,14 +241,14 @@ > > @Override > public String toString() { >- return getID() + ":" + values; >+ return getId() + ":" + values; > } > > @Override > public int hashCode() { > final int prime = 31; > int result = 1; >- result = prime * result + ((key == null) ? 0 : key.hashCode()); >+ result = prime * result + ((id == null) ? 0 : id.hashCode()); > return result; > } > >@@ -261,10 +261,10 @@ > if (getClass() != obj.getClass()) > return false; > final RepositoryTaskAttribute other = (RepositoryTaskAttribute) obj; >- if (key == null) { >- if (other.key != null) >+ if (id == null) { >+ if (other.id != null) > return false; >- } else if (!key.equals(other.key)) >+ } else if (!id.equals(other.id)) > return false; > return true; > } >Index: .refactorings/2007/6/24/refactorings.index >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/.refactorings/2007/6/24/refactorings.index,v >retrieving revision 1.13 >diff -u -r1.13 refactorings.index >--- .refactorings/2007/6/24/refactorings.index 15 Jun 2007 00:05:46 -0000 1.13 >+++ .refactorings/2007/6/24/refactorings.index 18 Jun 2007 18:10:21 -0000 >@@ -35,3 +35,4 @@ > 1181857348844 Rename enum constant 'CHANGED_LOCAL' > 1181857358034 Rename enum constant 'CHANGED_REMOTE' > 1181865589494 Extract constant 'SYNC_DATE_NOW' >+1181957955671 Copy compilation unit >Index: .refactorings/2007/6/24/refactorings.history >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/.refactorings/2007/6/24/refactorings.history,v >retrieving revision 1.13 >diff -u -r1.13 refactorings.history >--- .refactorings/2007/6/24/refactorings.history 15 Jun 2007 00:05:46 -0000 1.13 >+++ .refactorings/2007/6/24/refactorings.history 18 Jun 2007 18:10:21 -0000 >@@ -38,4 +38,5 @@ > <refactoring comment="Rename enum constant 'CHANGED_LOCAL' of 'org.eclipse.mylyn.tasks.core.TaskContainerDelta.Kind' to 'CHANGED' - Original project: 'org.eclipse.mylyn.tasks.core' - Original element: 'org.eclipse.mylyn.tasks.core.TaskContainerDelta.Kind.CHANGED_LOCAL' - Renamed element: 'org.eclipse.mylyn.tasks.core.TaskContainerDelta.Kind.CHANGED' - Update references to refactored element - Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename enum constant 'CHANGED_LOCAL'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.enum.constant" input="/src<org.eclipse.mylyn.tasks.core{TaskContainerDelta.java[TaskContainerDelta[Kind^CHANGED_LOCAL" name="CHANGED" references="true" setter="false" stamp="1181857348844" textual="false" version="1.0"/> > <refactoring comment="Rename enum constant 'CHANGED_REMOTE' of 'org.eclipse.mylyn.tasks.core.TaskContainerDelta.Kind' to 'CONTENT' - Original project: 'org.eclipse.mylyn.tasks.core' - Original element: 'org.eclipse.mylyn.tasks.core.TaskContainerDelta.Kind.CHANGED_REMOTE' - Renamed element: 'org.eclipse.mylyn.tasks.core.TaskContainerDelta.Kind.CONTENT' - Update references to refactored element - Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename enum constant 'CHANGED_REMOTE'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.enum.constant" input="/src<org.eclipse.mylyn.tasks.core{TaskContainerDelta.java[TaskContainerDelta[Kind^CHANGED_REMOTE" name="CONTENT" references="true" setter="false" stamp="1181857358034" textual="false" version="1.0"/> > <refactoring comment="Extract constant 'org.eclipse.mylyn.internal.tasks.core.LocalTask.SYNC_DATE_NOW' from expression '"now"' - Original project: 'org.eclipse.mylyn.tasks.core' - Constant name: 'SYNC_DATE_NOW' - Constant expression: '"now"' - Declared visibility: 'private' - Replace occurrences of expression with constant" description="Extract constant 'SYNC_DATE_NOW'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src<org.eclipse.mylyn.internal.tasks.core{LocalTask.java" name="SYNC_DATE_NOW" qualify="false" replace="true" selection="1171 5" stamp="1181865589494" version="1.0" visibility="2"/> >+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylyn.tasks.core/src/org.eclipse.mylyn.internal.tasks.core' - Original project: 'org.eclipse.mylyn.tasks.core' - Destination element: 'org.eclipse.mylyn.tasks.core/src/org.eclipse.mylyn.internal.tasks.core' - Original element: 'org.eclipse.mylyn.internal.tasks.core.TaskDataManager.java'" description="Copy compilation unit" destination="/src<org.eclipse.mylyn.internal.tasks.core" element1="/src<org.eclipse.mylyn.internal.tasks.core{TaskDataManager.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src<org.eclipse.mylyn.internal.tasks.core{TaskDataManager.java	true	true	CopyOfTaskDataManager.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1181957955671" units="1" version="1.0"/> > </session> >Index: src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java,v >retrieving revision 1.31 >diff -u -r1.31 TaskDataManager.java >--- src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java 15 Jun 2007 22:04:35 -0000 1.31 >+++ src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java 18 Jun 2007 18:10:21 -0000 >@@ -12,25 +12,12 @@ > > import java.io.ByteArrayInputStream; > import java.io.ByteArrayOutputStream; >-import java.io.File; >-import java.io.FileInputStream; >-import java.io.FileOutputStream; >-import java.io.IOException; > import java.io.ObjectInputStream; > import java.io.ObjectOutputStream; > import java.util.Collections; >-import java.util.HashSet; > import java.util.List; >-import java.util.Map; > import java.util.Set; >-import java.util.Timer; >-import java.util.TimerTask; > >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; > import org.eclipse.mylyn.tasks.core.AbstractAttributeFactory; > import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; >@@ -45,106 +32,53 @@ > */ > public class TaskDataManager { > >- private static final String OFFLINE_REPORTS = "offlineReports"; >- >- private static final int SAVE_INTERVAL = 60 * 1000; >- >- private File primaryFile; >- >- private File backupFile; >- >- private OfflineDataStore dataStore; >- >- private TaskDataSaverJob saverJob; >- > private TaskRepositoryManager taskRepositoryManager; > >- private Timer saveTimer; >+ private ITaskDataStorage storage; > >- private IPath primaryPath; >+ private int nextNewId = 1; > >- private IPath backupPath; >- >- public TaskDataManager(TaskRepositoryManager taskRepositoryManager, IPath path) { >- this.primaryPath = path.append(OFFLINE_REPORTS); >- this.backupPath = path.append(OFFLINE_REPORTS + ".bak"); >+ public TaskDataManager(TaskRepositoryManager taskRepositoryManager, ITaskDataStorage storage) { > this.taskRepositoryManager = taskRepositoryManager; >- this.primaryFile = primaryPath.toFile(); >- this.backupFile = backupPath.toFile(); >- >- if (primaryFile.exists()) { >- try { >- readOfflineData(); >- } catch (Throwable e) { >- StatusManager.fail(e, "Error loading offline task data", false); >- if (restoreFromBackup()) { >- try { >- readOfflineData(); >- } catch (Throwable e1) { >- dataStore = new OfflineDataStore(); >- } >- } else { >- dataStore = new OfflineDataStore(); >- } >- } >- } else { >- if (restoreFromBackup()) { >- try { >- readOfflineData(); >- } catch (Throwable e1) { >- dataStore = new OfflineDataStore(); >- } >- } else { >- dataStore = new OfflineDataStore(); >- } >- } >- >- saveTimer = new Timer(); >- saveTimer.schedule(new RequestSaveTimerTask(), SAVE_INTERVAL, SAVE_INTERVAL); >- saverJob = new TaskDataSaverJob(); >- saverJob.schedule(); >- } >- >- private boolean restoreFromBackup() { >- this.primaryFile = primaryPath.toFile(); >- this.backupFile = backupPath.toFile(); >- >- if (backupFile.exists()) { >- if (primaryFile.exists()) { >- if (!primaryFile.delete()) { >- StatusManager.log("Unable to retire primary offline data", this); >- } >- } >- this.primaryFile = primaryPath.toFile(); >- if (backupFile.renameTo(primaryFile)) { >- this.primaryFile = primaryPath.toFile(); >- this.backupFile = backupPath.toFile(); >- return true; >- } else { >- StatusManager.log("Unable to restore from offline backup", this); >- } >- } >- return false; >+ this.storage = storage; > } > > /** >- * Add a RepositoryTaskData to the offline reports file. Previously stored taskData is held and can be retrieved via >- * getOldTaskData() >+ * Add a RepositoryTaskData to the offline reports file. > */ >- public void setNewTaskData(String taskHandle, RepositoryTaskData newEntry) { >- if (taskHandle == null || newEntry == null) { >+ public void setNewTaskData(String taskHandle, RepositoryTaskData data) { >+ if (taskHandle == null || data == null) { > return; > } >- dataStore.getNewDataMap().put(taskHandle, newEntry); >- dataStateChanged(); >+ >+ TaskDataState state = retrieveState(data); >+ if (state != null) { >+ state.setNewTaskData(data); >+ } else { >+ state = new TaskDataState(data.getRepositoryUrl(), data.getId()); >+ state.setNewTaskData(data); >+ } >+ saveState(state); > } > >- public void setOldTaskData(String taskHandle, RepositoryTaskData oldEntry) { >- if (taskHandle == null || oldEntry == null) { >+ public void setOldTaskData(String taskHandle, RepositoryTaskData data) { >+ if (taskHandle == null || data == null) { > return; > } >- dataStore.getOldDataMap().put(taskHandle, oldEntry); >- dataStateChanged(); >+ TaskDataState state = retrieveState(data); >+ if (state != null) { >+ state.setOldTaskData(data); >+ } else { >+ StatusManager.log("Attempt to save old data when no new data exists.", this); >+ } >+ saveState(state); >+ } >+ >+ @Deprecated >+ public RepositoryTaskData getNewTaskData(String handle) { >+ String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle); >+ String id = RepositoryTaskHandleUtil.getTaskId(handle); >+ return getNewTaskData(repositoryUrl, id); > } > > /** >@@ -152,25 +86,23 @@ > * > * @return offline task data, null if no data found > */ >- public RepositoryTaskData getNewTaskData(String handle) { >- RepositoryTaskData data = dataStore.getNewDataMap().get(handle); >- return data; >+ public RepositoryTaskData getNewTaskData(String repositoryUrl, String id) { >+ 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 handle) { >- return dataStore.getOldDataMap().get(handle); >- } >- >- public Map<String, RepositoryTaskData> getUnsubmitted() { >- return Collections.unmodifiableMap(dataStore.getUnsubmittedTaskData()); >- } >- >- public void removeUnsubmitted(String handle) { >- dataStore.getUnsubmittedTaskData().remove(handle); >- dataStateChanged(); >+ public RepositoryTaskData getOldTaskData(String repositoryUrl, String id) { >+ TaskDataState state = retrieveState(repositoryUrl, id); >+ if (state != null) { >+ return state.getOldTaskData(); >+ } >+ return null; > } > > /** >@@ -178,116 +110,126 @@ > * Incremented each time this method is called. > */ > public synchronized String getNewRepositoryTaskId() { >- dataStateChanged(); >- return "" + dataStore.getNextTaskId(); >+ // TODO: generate based on values of unsubmitted offline report ids >+ return "" + nextNewId++; > } > >- private Set<RepositoryTaskAttribute> getLocalChanges(String handle) { >- Set<RepositoryTaskAttribute> localChanges; >- localChanges = dataStore.getLocalEdits().get(handle); >- if (localChanges != null) { >- return Collections.unmodifiableSet(localChanges); >- } >- return Collections.emptySet(); >+ public RepositoryTaskData getEditableCopy(String handle) { >+ String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle); >+ String id = RepositoryTaskHandleUtil.getTaskId(handle); >+ return getEditableCopy(repositoryUrl, id); > } > > /** >+ * > * @return editable copy of task data with any edits applied > */ >- public RepositoryTaskData getEditableCopy(String handle) { >- RepositoryTaskData data = getNewTaskData(handle); >+ public RepositoryTaskData getEditableCopy(String repositoryUrl, String id) { >+ TaskDataState state = retrieveState(repositoryUrl, id); > RepositoryTaskData clone = null; >- if (data != null) { >- try { >- clone = (RepositoryTaskData) ObjectCloner.deepCopy(data); >- updateAttributeFactory(clone); >- } catch (Exception e) { >- StatusManager.fail(e, "Error constructing modifiable task", false); >- return null; >- } >- for (RepositoryTaskAttribute attribute : getLocalChanges(handle)) { >- 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)) { >+ if (state != null) { >+ if (state.getNewTaskData() != null) >+ try { >+ clone = (RepositoryTaskData) ObjectCloner.deepCopy(state.getNewTaskData()); >+ updateAttributeFactory(clone); >+ } catch (Exception e) { >+ StatusManager.fail(e, "Error constructing modifiable task", false); >+ 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 { >- existing.addValue(value); > } >- } > >- } else { >- clone.addAttribute(attribute.getID(), attribute); >+ } else { >+ clone.addAttribute(attribute.getId(), attribute); >+ } > } >- > } > } >- > return clone; > > } > >- public void saveEdits(String handle, Set<RepositoryTaskAttribute> attributes) { >- Set<RepositoryTaskAttribute> edits = dataStore.getLocalEdits().get(handle); >- if (edits == null) { >- edits = new HashSet<RepositoryTaskAttribute>(); >- edits.addAll(attributes); >- dataStore.getLocalEdits().put(handle, edits); >- } else { >- edits.removeAll(attributes); >- edits.addAll(attributes); >- } >- dataStateChanged(); >+ public void saveEdits(String handle, Set<RepositoryTaskAttribute> changedAttributes) { >+ String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle); >+ String id = RepositoryTaskHandleUtil.getTaskId(handle); >+ saveEdits(repositoryUrl, id, changedAttributes); > } > >- public Set<RepositoryTaskAttribute> getEdits(String handle) { >- Set<RepositoryTaskAttribute> changes = dataStore.getLocalEdits().get(handle); >- if (changes == null) { >- return Collections.emptySet(); >- } else { >- return Collections.unmodifiableSet(changes); >+ 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) { >+ StatusManager.fail(e, "Error saving edits", false); >+ } > } > > } > >- public void discardEdits(String handle) { >- dataStore.getLocalEdits().remove(handle); >- dataStateChanged(); >+ public Set<RepositoryTaskAttribute> getEdits(String repositoryUrl, String id) { >+ TaskDataState state = retrieveState(repositoryUrl, id); >+ if (state != null) { >+ if (state.getEdits() != null) { >+ return Collections.unmodifiableSet(state.getEdits()); >+ } >+ } >+ return Collections.emptySet(); > } > >- /** >- * Remove some bugs from the offline reports list >- * >- * @param indicesToRemove >- * An array of the indicies of the bugs to be removed >- */ >- public void remove(List<String> handlesToRemove) { >- for (String handle : handlesToRemove) { >- remove(handle); >+ public void discardEdits(String repositoryUrl, String id) { >+ TaskDataState state = retrieveState(repositoryUrl, id); >+ state.discardEdits(); >+ try { >+ storage.put(state); >+ } catch (Exception e) { >+ StatusManager.fail(e, "Discard edits failed.", false); > } > } > > public void remove(String handle) { >- dataStore.getNewDataMap().remove(handle); >- dataStore.getOldDataMap().remove(handle); >- discardEdits(handle); >+ String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle); >+ String id = RepositoryTaskHandleUtil.getTaskId(handle); >+ remove(repositoryUrl, id); >+ } >+ >+ public void remove(String repositoryUrl, String id) { >+ try { >+ storage.remove(repositoryUrl, id); >+ } catch (Exception e) { >+ StatusManager.fail(e, "Attempt to remove offline data for " + repositoryUrl + "-" + id + " failed.", false); >+ } > } > > /** > * Public for testing only force a reset of all data maps Does not signal data changed (doesn't request save) > */ > public void clear() { >- if (saverJob != null) { >- saverJob.waitSaveCompleted(); >- } >- dataStore = new OfflineDataStore(); >+ storage.clear(); > } > > /** >@@ -305,183 +247,6 @@ > } > } > >- /** >- * Public for testing >- */ >- public void readOfflineData() throws IOException, ClassNotFoundException { >- clear(); >- synchronized (primaryFile) { >- ObjectInputStream in = null; >- FileInputStream fileInputStream = null; >- try { >- fileInputStream = new FileInputStream(primaryFile); >- in = new ObjectInputStream(fileInputStream); >- dataStore = (OfflineDataStore) in.readObject(); >- for (RepositoryTaskData taskData : dataStore.getNewDataMap().values()) { >- updateAttributeFactory(taskData); >- } >- for (RepositoryTaskData taskData : dataStore.getOldDataMap().values()) { >- updateAttributeFactory(taskData); >- } >- } finally { >- if (in != null) { >- try { >- in.close(); >- } catch (IOException e) { >- StatusManager.fail(e, "Could not close stream", false); >- } >- } >- if (fileInputStream != null) { >- try { >- fileInputStream.close(); >- } catch (IOException e) { >- StatusManager.fail(e, "Could not close stream", false); >- } >- } >- } >- >- } >- } >- >- private void dataStateChanged() { >- if (saverJob != null) { >- saverJob.requestSave(); >- } >- } >- >- /** >- * Force save of offline task data >- */ >- public void saveNow() { >- saverJob.waitSaveCompleted(); >- writeFile(); >- } >- >- private class RequestSaveTimerTask extends TimerTask { >- >- @Override >- public void run() { >- if (!Platform.isRunning()) { >- return; >- } else { >- saverJob.runRequested(); >- } >- } >- } >- >- public boolean hasOutgoing(String handleIdentifier) { >- return getLocalChanges(handleIdentifier).size() > 0; >- } >- >- private void writeFile() { >- synchronized (primaryFile) { >- if (Platform.isRunning()) { >- ObjectOutputStream out = null; >- FileOutputStream fileOuputStream = null; >- try { >- if (backupFile.exists()) { >- if (!backupFile.delete()) { >- StatusManager.log("Unable to retire old offline backup.", this); >- return; >- } >- } >- >- if (primaryFile.exists() && !primaryFile.renameTo(backupFile)) { >- StatusManager.log("Unable to backup offline data.", this); >- return; >- } >- >- fileOuputStream = new FileOutputStream(primaryPath.toFile()); >- out = new ObjectOutputStream(fileOuputStream); >- out.writeObject(dataStore); >- } catch (Exception e) { >- StatusManager.fail(e, "Error occurred during save of offline task data.", false); >- restoreFromBackup(); >- } finally { >- if (out != null) { >- try { >- out.close(); >- } catch (IOException e) { >- StatusManager.fail(e, "Could not close stream", false); >- } >- } >- if (fileOuputStream != null) { >- try { >- fileOuputStream.close(); >- } catch (IOException e) { >- StatusManager.fail(e, "Could not close stream", false); >- } >- } >- } >- } >- } >- } >- >- private class TaskDataSaverJob extends Job { >- >- // private final Queue<RepositoryTaskData> dataQueue = new >- // LinkedList<RepositoryTaskData>(); >- >- private volatile boolean saveRequested = false; >- >- private volatile boolean saveCompleted = true; >- >- TaskDataSaverJob() { >- super("Task Data Saver"); >- setPriority(Job.LONG); >- setSystem(true); >- } >- >- protected IStatus run(IProgressMonitor monitor) { >- while (true) { >- if (saveRequested) { >- saveRequested = false; >- saveCompleted = false; >- writeFile(); >- } >- >- if (!saveRequested) { >- synchronized (this) { >- saveCompleted = true; >- notifyAll(); >- try { >- wait(); >- } catch (InterruptedException ex) { >- // ignore >- } >- } >- } >- } >- } >- >- // void addDataToQueue(RepositoryTaskData data) { >- // dataQueue.add(data); >- // } >- >- void requestSave() { >- saveRequested = true; >- } >- >- void runRequested() { >- synchronized (this) { >- notifyAll(); >- } >- } >- >- void waitSaveCompleted() { >- while (!saveCompleted) { >- synchronized (this) { >- try { >- wait(); >- } catch (InterruptedException ex) { >- // ignore >- } >- } >- } >- } >- } >- >- // HACK: until we get proper offline storage.... > // Reference: > // http://www.javaworld.com/javaworld/javatips/jw-javatip76.html?page=2 > static class ObjectCloner { >@@ -517,21 +282,60 @@ > > } > >+ public void start() { >+ try { >+ storage.start(); >+ } catch (Exception e) { >+ StatusManager.fail(e, "Stop failed", false); >+ } >+ } >+ > public void stop() { >- saveTimer.cancel(); >- saverJob.cancel(); >- saveNow(); >-// saverJob.runRequested(); >-// try { >-// saverJob.join(); >-// System.err.println(">> join complete"); >-// } catch (InterruptedException e) { >-// // ignore >-// } >- // TODO: Save job getting axed during workbench shutdown resulting in >- // corrupt task data file >- // bug#186553 >- // saveNow(); >+ try { >+ storage.stop(); >+ } catch (Exception e) { >+ StatusManager.fail(e, "Stop failed", false); >+ } >+ } >+ >+ public void saveNow() { >+ storage.flush(); >+ } >+ >+ private TaskDataState retrieveState(RepositoryTaskData data) { >+ return retrieveState(data.getRepositoryUrl(), data.getId()); >+ } >+ >+ 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) { >+ e.printStackTrace(); >+ StatusManager.fail(e, "Error saving offline data", false); >+ } >+ return state; >+ } >+ >+ private void saveState(TaskDataState state) { >+ if (state != null) { >+ try { >+ storage.put(state); >+ } catch (Exception e) { >+ StatusManager.fail(e, "Error saving state to storage", false); >+ } >+ } else { >+ >+ } > } > > } >Index: src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java >diff -N src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/core/ITaskDataStorage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 University Of British Columbia and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * University Of British Columbia - initial API and implementation >+ *******************************************************************************/ >+ >+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); >+} >Index: .refactorings/2007/6/25/refactorings.index >=================================================================== >RCS file: .refactorings/2007/6/25/refactorings.index >diff -N .refactorings/2007/6/25/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/6/25/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+1182093894562 Rename method 'removeTaskDataState' >+1182116742640 Delete element >Index: src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java >diff -N src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/core/TaskDataState.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,122 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 University Of British Columbia and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * University Of British Columbia - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.tasks.core; >+ >+import java.util.HashSet; >+import java.util.Set; >+ >+import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute; >+import org.eclipse.mylyn.tasks.core.RepositoryTaskData; >+ >+/** >+ * @author Rob Elves >+ */ >+public class TaskDataState { >+ >+ private RepositoryTaskData newTaskData; >+ >+ private RepositoryTaskData oldTaskData; >+ >+ private Set<RepositoryTaskAttribute> edits = new HashSet<RepositoryTaskAttribute>(); >+ >+ private String url; >+ >+ private 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) >+ >+} >Index: .refactorings/2007/6/25/refactorings.history >=================================================================== >RCS file: .refactorings/2007/6/25/refactorings.history >diff -N .refactorings/2007/6/25/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/6/25/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+<?xml version="1.0" encoding="utf-8" standalone="no"?> >+<session version="1.0"> >+<refactoring comment="Rename method 'org.eclipse.mylyn.internal.tasks.core.ITaskDataStorage.removeTaskDataState(...)' to 'remove' - Original project: 'org.eclipse.mylyn.tasks.core' - Original element: 'org.eclipse.mylyn.internal.tasks.core.ITaskDataStorage.removeTaskDataState(...)' - Renamed element: 'org.eclipse.mylyn.internal.tasks.core.ITaskDataStorage.remove(...)' - Update references to refactored element" delegate="false" deprecate="false" description="Rename method 'removeTaskDataState'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src<org.eclipse.mylyn.internal.tasks.core{ITaskDataStorage.java[ITaskDataStorage~removeTaskDataState~QString;~QString;" name="remove" references="true" stamp="1182093894562" version="1.0"/> >+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylyn.tasks.core' - Original project: 'org.eclipse.mylyn.tasks.core' - Original element: 'org.eclipse.mylyn.internal.tasks.core.CopyOfTaskDataManager.java'" description="Delete element" element1="/src<org.eclipse.mylyn.internal.tasks.core{CopyOfTaskDataManager.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1182116742640" subPackages="false" version="1.0"/> >+</session> >#P org.eclipse.mylyn.java.ui >Index: src/org/eclipse/mylyn/internal/java/ui/JavaUiBridgePlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaUiBridgePlugin.java,v >retrieving revision 1.4 >diff -u -r1.4 JavaUiBridgePlugin.java >--- src/org/eclipse/mylyn/internal/java/ui/JavaUiBridgePlugin.java 15 Jun 2007 22:05:06 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/java/ui/JavaUiBridgePlugin.java 18 Jun 2007 18:10:23 -0000 >@@ -23,7 +23,6 @@ > import org.eclipse.mylyn.context.core.IInteractionContext; > import org.eclipse.mylyn.context.core.IInteractionContextListener; > import org.eclipse.mylyn.context.core.IInteractionElement; >-import org.eclipse.mylyn.context.ui.ContextUiPlugin; > import org.eclipse.mylyn.internal.java.ui.editor.ActiveFoldingListener; > import org.eclipse.mylyn.internal.java.ui.wizards.RecommendedPreferencesWizard; > import org.eclipse.mylyn.internal.monitor.core.util.StatusManager; >#P org.eclipse.mylyn.team.ui >Index: src/org/eclipse/mylyn/internal/team/ui/templates/CommitTemplateVariables.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.team.ui/src/org/eclipse/mylyn/internal/team/ui/templates/CommitTemplateVariables.java,v >retrieving revision 1.3 >diff -u -r1.3 CommitTemplateVariables.java >--- src/org/eclipse/mylyn/internal/team/ui/templates/CommitTemplateVariables.java 14 Jun 2007 05:19:45 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/team/ui/templates/CommitTemplateVariables.java 18 Jun 2007 18:10:24 -0000 >@@ -246,7 +246,7 @@ > } > > public static RepositoryTaskData getTaskData(AbstractTask task) { >- return TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getHandleIdentifier()); >+ return TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getRepositoryUrl(), task.getTaskId()); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 160389
:
64548
|
65355
|
71577
|
71578
|
71639
| 71646 |
71653
|
71660
|
71670
|
71673