From 7ab82926cbe0f710ce8f873ecdd746be61e1e4ab Mon Sep 17 00:00:00 2001 From: mkersten Date: Tue, 24 Jan 2006 04:07:42 +0000 Subject: Progress on: update copyrights to 2006 --- .../internal/tasklist/BackgroundSaveTimer.java | 20 +- .../tasklist/DelegatingLocalTaskExternalizer.java | 30 +-- .../internal/tasklist/IBackgroundSaveListener.java | 20 +- .../internal/tasklist/MylarTaskListPlugin.java | 4 +- .../tasklist/MylarTaskListPrefConstants.java | 2 +- .../mylyn/internal/tasklist/RelativePathUtil.java | 10 +- .../org/eclipse/mylyn/internal/tasklist/Task.java | 64 +++--- .../mylyn/internal/tasklist/TaskActivityTimer.java | 35 ++-- .../mylyn/internal/tasklist/TaskCategory.java | 5 +- .../internal/tasklist/TaskCompleteFilter.java | 7 +- .../eclipse/mylyn/internal/tasklist/TaskList.java | 40 ++-- .../internal/tasklist/TaskListExtensionReader.java | 65 ++++--- .../tasklist/TaskListExternalizerException.java | 4 +- .../mylyn/internal/tasklist/TaskListManager.java | 92 +++++---- .../internal/tasklist/TaskListSaveManager.java | 72 ++++--- .../mylyn/internal/tasklist/TaskListWriter.java | 2 +- .../internal/tasklist/TaskPriorityFilter.java | 4 +- .../internal/tasklist/TaskRepositoryManager.java | 10 +- .../tasklist/planner/CompletedTaskCollector.java | 2 +- .../internal/tasklist/planner/ITaskCollector.java | 6 +- .../tasklist/planner/InProgressTaskCollector.java | 41 ++-- .../planner/ReminderRequiredCollector.java | 7 +- .../tasklist/planner/TaskReportGenerator.java | 4 +- .../tasklist/planner/ui/OpenTaskEditorAction.java | 2 +- .../tasklist/planner/ui/ReminderCellEditor.java | 2 +- .../tasklist/planner/ui/RemoveTaskAction.java | 2 +- .../planner/ui/TaskActivityLabelProvider.java | 40 ++-- .../tasklist/planner/ui/TaskActivitySorter.java | 52 ++--- .../planner/ui/TaskPlanContentProvider.java | 2 +- .../tasklist/planner/ui/TaskPlanLabelProvider.java | 20 +- .../tasklist/planner/ui/TaskPlanSorter.java | 72 ++++--- .../planner/ui/TaskPlannerContentProvider.java | 6 +- .../planner/ui/TaskPlannerEditorInput.java | 9 +- .../tasklist/planner/ui/TaskPlannerEditorPart.java | 139 ++++++------- .../tasklist/planner/ui/TaskPlannerWizard.java | 6 +- .../tasklist/planner/ui/TaskPlannerWizardPage.java | 2 +- .../internal/tasklist/ui/AbstractTaskFilter.java | 4 +- .../mylyn/internal/tasklist/ui/CategoryEditor.java | 30 +-- .../internal/tasklist/ui/CategoryEditorInput.java | 11 +- .../tasklist/ui/IContextEditorFactory.java | 4 +- .../tasklist/ui/IDynamicSubMenuContributor.java | 7 +- .../internal/tasklist/ui/ITaskHighlighter.java | 4 +- .../internal/tasklist/ui/ITaskListElement.java | 46 ++--- .../internal/tasklist/ui/MylarTaskEditor.java | 31 +-- .../internal/tasklist/ui/TaskEditorCopyAction.java | 10 +- .../internal/tasklist/ui/TaskEditorInput.java | 45 +++-- .../mylyn/internal/tasklist/ui/TaskInfoEditor.java | 48 +++-- .../mylyn/internal/tasklist/ui/TaskListImages.java | 216 ++++++++++++--------- .../tasklist/ui/TaskListPatternFilter.java | 14 +- .../internal/tasklist/ui/TaskRepositoriesView.java | 28 ++- .../internal/tasklist/ui/TasksReminderDialog.java | 115 ++++++----- .../tasklist/ui/actions/AddRepositoryAction.java | 10 +- .../ui/actions/AddRepositoryTaskAction.java | 4 +- .../tasklist/ui/actions/CollapseAllAction.java | 19 +- .../tasklist/ui/actions/CopyDescriptionAction.java | 32 +-- .../internal/tasklist/ui/actions/DeleteAction.java | 13 +- .../ui/actions/DeleteTaskRepositoryAction.java | 14 +- .../ui/actions/EditRepositoryPropertiesAction.java | 14 +- .../ui/actions/FilterCompletedTasksAction.java | 22 +-- .../internal/tasklist/ui/actions/GoIntoAction.java | 17 +- .../internal/tasklist/ui/actions/GoUpAction.java | 6 +- .../tasklist/ui/actions/ManageEditorsAction.java | 42 ++-- .../ui/actions/MarkTaskCompleteAction.java | 8 +- .../ui/actions/MarkTaskIncompleteAction.java | 8 +- .../tasklist/ui/actions/MoveTaskToRootAction.java | 51 ++--- .../tasklist/ui/actions/NewCategoryAction.java | 46 ++--- .../tasklist/ui/actions/NewLocalTaskAction.java | 57 +++--- .../tasklist/ui/actions/NewQueryAction.java | 4 +- .../ui/actions/NextTaskDropDownAction.java | 36 ++-- .../tasklist/ui/actions/OpenTaskEditorAction.java | 38 ++-- .../actions/OpenTaskInExternalBrowserAction.java | 8 +- .../ui/actions/PreviousTaskDropDownAction.java | 36 ++-- .../ui/actions/RemoveFromCategoryAction.java | 7 +- .../internal/tasklist/ui/actions/RenameAction.java | 13 +- .../tasklist/ui/actions/TaskActivateAction.java | 22 +-- .../tasklist/ui/actions/TaskDeactivateAction.java | 20 +- .../ui/actions/TaskNavigateDropDownAction.java | 4 +- .../tasklist/ui/actions/WorkOfflineAction.java | 6 +- .../preferences/MylarTaskListPreferencePage.java | 67 ++++--- .../tasklist/ui/views/DateChooserDialog.java | 16 +- .../internal/tasklist/ui/views/DatePicker.java | 7 +- .../tasklist/ui/views/RetrieveTitleFromUrlJob.java | 10 + .../tasklist/ui/views/TaskActivationHistory.java | 151 +++++++------- .../tasklist/ui/views/TaskInputDialog.java | 2 +- .../ui/views/TaskListDragSourceListener.java | 40 ++-- .../tasklist/ui/views/TaskListDropAdapter.java | 6 +- .../tasklist/ui/views/TaskListToolTipHandler.java | 65 +++---- .../internal/tasklist/ui/views/TaskListView.java | 13 +- .../ui/views/TaskRepositoryLabelProvider.java | 8 +- .../tasklist/ui/views/TasklistContentProvider.java | 10 +- .../tasklist/ui/views/TasklistLabelProvider.java | 205 +++++++++---------- .../ui/wizards/AbstractAddExistingTaskWizard.java | 14 +- .../ui/wizards/AbstractRepositoryClientWizard.java | 4 +- .../ui/wizards/AbstractRepositorySettingsPage.java | 37 ++-- .../tasklist/ui/wizards/AddExistingTaskWizard.java | 2 +- .../tasklist/ui/wizards/AddRepositoryWizard.java | 17 +- .../tasklist/ui/wizards/EditRepositoryWizard.java | 20 +- .../ui/wizards/ExistingTaskWizardPage.java | 24 +-- .../ui/wizards/MultiRepositoryAwareWizard.java | 10 +- .../tasklist/ui/wizards/NewQueryWizard.java | 9 +- .../ui/wizards/SelectRepositoryClientPage.java | 20 +- .../tasklist/ui/wizards/SelectRepositoryPage.java | 62 +++--- .../tasklist/ui/wizards/TaskDataExportWizard.java | 70 ++++--- .../ui/wizards/TaskDataExportWizardPage.java | 10 + .../src/org/eclipse/mylyn/tasklist/IQueryHit.java | 10 +- .../eclipse/mylyn/tasklist/IRepositoryQuery.java | 20 +- .../mylyn/tasklist/IRepositorySettingsPage.java | 2 +- .../src/org/eclipse/mylyn/tasklist/ITask.java | 17 +- .../mylyn/tasklist/ITaskActivityListener.java | 22 +-- .../org/eclipse/mylyn/tasklist/ITaskCategory.java | 10 +- .../org/eclipse/mylyn/tasklist/ITaskHandler.java | 17 +- .../mylyn/tasklist/ITaskListExternalizer.java | 57 +++--- .../mylyn/tasklist/ITaskRepositoryClient.java | 14 +- .../mylyn/tasklist/ITaskRepositoryListener.java | 4 +- .../org/eclipse/mylyn/tasklist/TaskRepository.java | 28 +-- 115 files changed, 1693 insertions(+), 1477 deletions(-) diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/BackgroundSaveTimer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/BackgroundSaveTimer.java index a518be486..1a1089734 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/BackgroundSaveTimer.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/BackgroundSaveTimer.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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.mylar.internal.tasklist; import org.eclipse.core.runtime.IProgressMonitor; @@ -16,7 +26,7 @@ import org.eclipse.mylar.core.util.TimerThread; public class BackgroundSaveTimer implements ITimerThreadListener { private final static int DEFAULT_SAVE_INTERVAL = 1 * 60 * 1000; - + private int saveInterval = DEFAULT_SAVE_INTERVAL; private IBackgroundSaveListener listener = null; @@ -24,22 +34,22 @@ public class BackgroundSaveTimer implements ITimerThreadListener { private TimerThread timer = null; private boolean forceSyncExec = false; - + public BackgroundSaveTimer(IBackgroundSaveListener listener) { this.listener = listener; - timer = new TimerThread(saveInterval / 1000); // This constructor wants seconds + timer = new TimerThread(saveInterval / 1000); // This constructor + // wants seconds timer.addListener(this); } public void start() { timer.start(); } - public void stop() { timer.kill(); } - + public void setSaveIntervalMillis(int saveIntervalMillis) { this.saveInterval = saveIntervalMillis; timer.setTimeoutMillis(saveIntervalMillis); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java index f2d08f6fa..41352666e 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/DelegatingLocalTaskExternalizer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -53,7 +53,7 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer { public static final String HANDLE = "Handle"; public static final String REPOSITORY_URL = "RepositoryUrl"; - + public static final String TAG_CATEGORY = "Category"; public static final String TAG_TASK = "Task"; @@ -142,7 +142,7 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer { public Element createTaskElement(ITask task, Document doc, Element parent) { Element node = doc.createElement(getTaskTagName()); -// node.setAttribute(PATH, task.getRemoteContextPath()); + // node.setAttribute(PATH, task.getRemoteContextPath()); node.setAttribute(LABEL, task.getDescription()); node.setAttribute(HANDLE, task.getHandleIdentifier()); node.setAttribute(PRIORITY, task.getPriority()); @@ -162,9 +162,9 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer { if (task.getUrl() != null) { node.setAttribute(ISSUEURL, task.getUrl()); } -// if (task.getRepositoryUrl() != null) { -// node.setAttribute(REPOSITORY_URL, task.getRepositoryUrl()); -// } + // if (task.getRepositoryUrl() != null) { + // node.setAttribute(REPOSITORY_URL, task.getRepositoryUrl()); + // } node.setAttribute(NOTES, task.getNotes()); node.setAttribute(ELAPSED, "" + task.getElapsedTime()); node.setAttribute(ESTIMATED, "" + task.getEstimateTimeHours()); @@ -222,7 +222,8 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer { if (externalizer.canReadTask(child)) { ITask task = externalizer.readTask(child, tlist, category, null); category.addTask(task); - if (!category.isArchive()) task.setCategory(category); + if (!category.isArchive()) + task.setCategory(category); read = true; } } @@ -268,11 +269,11 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer { } else { task.setPriority(DEFAULT_PRIORITY); } -// if (element.hasAttribute(PATH)) { -// task.setRemoteContextPath(element.getAttribute(PATH)); -// } else { -// task.setRemoteContextPath(task.getHandleIdentifier()); -// } + // if (element.hasAttribute(PATH)) { + // task.setRemoteContextPath(element.getAttribute(PATH)); + // } else { + // task.setRemoteContextPath(task.getHandleIdentifier()); + // } if (element.getAttribute(ACTIVE).compareTo(TRUE) == 0) { task.setActive(true); @@ -294,7 +295,8 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer { long elapsed = 0; try { long read = Long.parseLong(element.getAttribute(ELAPSED)); - if (read > 0) elapsed = read; + if (read > 0) + elapsed = read; } catch (NumberFormatException e) { // ignore } @@ -402,7 +404,7 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer { node.setAttribute(MAX_HITS, query.getMaxHits() + ""); node.setAttribute(QUERY_STRING, query.getQueryUrl()); node.setAttribute(REPOSITORY_URL, query.getRepositoryUrl()); - + for (IQueryHit hit : query.getHits()) { try { Element element = null; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/IBackgroundSaveListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/IBackgroundSaveListener.java index 6049075ea..510bbec91 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/IBackgroundSaveListener.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/IBackgroundSaveListener.java @@ -1,16 +1,26 @@ +/******************************************************************************* + * 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.mylar.internal.tasklist; /** - * Interface implemented by clients who are to be notified of - * periodic requests to save data to disk. + * Interface implemented by clients who are to be notified of periodic requests + * to save data to disk. * * @author Wesley Coelho */ public interface IBackgroundSaveListener { - /** - * Called to notify the client of a PeriodicSaveTimer that - * a save should be performed + /** + * Called to notify the client of a PeriodicSaveTimer that a save should be + * performed */ public void saveRequested(); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPlugin.java index f63daf1f7..aa310986d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPlugin.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -354,7 +354,7 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup { for (IRepositoryQuery query : taskListManager.getTaskList().getQueries()) { query.setRepositoryUrl(repositoryUrl); - for (IQueryHit hit : query.getHits()) { + for (IQueryHit hit : query.getHits()) { hit.setRepositoryUrl(repositoryUrl); } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPrefConstants.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPrefConstants.java index 1e01416f4..4bd0a84b3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPrefConstants.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/MylarTaskListPrefConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RelativePathUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RelativePathUtil.java index 63f813339..45cd92029 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RelativePathUtil.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RelativePathUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -28,14 +28,14 @@ public class RelativePathUtil { result.append('/'); i++; } - while(diff < pathFolders.length - 1){ + while (diff < pathFolders.length - 1) { result.append(pathFolders[diff]); - diff++; - } + diff++; + } result.append(pathFolders[diff].substring(0, pathFolders[diff].lastIndexOf('.'))); } } return result.toString(); - } + } } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java index 7d6abf702..733bfb4ce 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -38,7 +38,7 @@ public class Task implements ITask { public enum TaskStatus { NOT_STARTED, IN_PROGRESS, COMPLETED; - + @Override public String toString() { switch (this) { @@ -87,7 +87,7 @@ public class Task implements ITask { private Date creationDate = null; private Date reminderDate = null; - + /** * @return null if root */ @@ -128,7 +128,7 @@ public class Task implements ITask { public void setParent(ITask parent) { this.parent = parent; } - + /** * Package visible in order to prevent sets that don't update the index. */ @@ -280,13 +280,13 @@ public class Task implements ITask { public long getElapsedTime() { return timeActive; } - + public void setElapsedTime(long elapsedTime) { if (elapsedTime >= 0) { this.timeActive = elapsedTime; - } else{ + } else { MylarStatusHandler.log("Attempt to set negative time on task: " + getDescription(), this); - } + } } public int getEstimateTimeHours() { @@ -313,9 +313,9 @@ public class Task implements ITask { this.parentCategory = cat; } -// public void internalSetCategory(TaskCategory cat) { -// this.parentCategory = cat; -// } + // public void internalSetCategory(TaskCategory cat) { + // this.parentCategory = cat; + // } public ITaskCategory getCategory() { return parentCategory; @@ -371,17 +371,17 @@ public class Task implements ITask { return true; } -// public Color getForeground() { -// if (isCompleted()) { -// return TaskListImages.GRAY_LIGHT; -// } else if (isActive()) { -// return TaskListImages.COLOR_TASK_ACTIVE; -// } else if (isOverdue()) { -// return TaskListImages.COLOR_TASK_OVERDUE; -// } else { -// return null; -// } -// } + // public Color getForeground() { + // if (isCompleted()) { + // return TaskListImages.GRAY_LIGHT; + // } else if (isActive()) { + // return TaskListImages.COLOR_TASK_ACTIVE; + // } else if (isOverdue()) { + // return TaskListImages.COLOR_TASK_OVERDUE; + // } else { + // return null; + // } + // } public Font getFont() { if (isActive()) @@ -414,7 +414,8 @@ public class Task implements ITask { } public Date getCreationDate() { - if (creationDate == null) creationDate = new Date(); + if (creationDate == null) + creationDate = new Date(); return creationDate; } @@ -458,7 +459,7 @@ public class Task implements ITask { public boolean hasValidUrl() { String taskUrl = getUrl(); - if (taskUrl != null && !taskUrl.equals("") && !taskUrl.equals("http://") && !taskUrl.equals("https://") ) { + if (taskUrl != null && !taskUrl.equals("") && !taskUrl.equals("http://") && !taskUrl.equals("https://")) { try { new URL(taskUrl); return true; @@ -469,13 +470,13 @@ public class Task implements ITask { return false; } -// public String getRepositoryUrl() { -// return repositoryUrl; -// } -// -// public void setRepositoryUrl(String repositoryUrl) { -// this.repositoryUrl = repositoryUrl; -// } + // public String getRepositoryUrl() { + // return repositoryUrl; + // } + // + // public void setRepositoryUrl(String repositoryUrl) { + // this.repositoryUrl = repositoryUrl; + // } public TaskStatus getStatus() { if (isCompleted()) { @@ -486,8 +487,7 @@ public class Task implements ITask { } /** - * For testing - * TODO: move + * For testing TODO: move */ public void setForceSyncOpen(boolean forceSyncOpen) { this.forceSyncOpen = forceSyncOpen; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskActivityTimer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskActivityTimer.java index eae5faf78..508972bed 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskActivityTimer.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskActivityTimer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -24,7 +24,7 @@ import org.eclipse.swt.events.ShellListener; import org.eclipse.ui.PlatformUI; /** - * @author Mik Kersten + * @author Mik Kersten */ public class TaskActivityTimer implements ITimerThreadListener, IInteractionEventListener, ShellListener { @@ -35,7 +35,7 @@ public class TaskActivityTimer implements ITimerThreadListener, IInteractionEven private long lastActivity; private boolean started; - + public TaskActivityTimer(ITask task, int timeout, int sleepInterval) { this.task = task; timer = new TimerThread(timeout, sleepInterval); @@ -51,7 +51,7 @@ public class TaskActivityTimer implements ITimerThreadListener, IInteractionEven } public void stopTimer() { - if(!timer.isSuspended()) { + if (!timer.isSuspended()) { addElapsedToActivityTime(); } timer.kill(); @@ -60,17 +60,17 @@ public class TaskActivityTimer implements ITimerThreadListener, IInteractionEven PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().removeShellListener(this); started = false; } - + public void fireTimedOut() { suspendTiming(); } - + public void shellDeactivated(ShellEvent e) { suspendTiming(); } - + public void interactionObserved(InteractionEvent event) { -// lastActivity = Calendar.getInstance().getTimeInMillis(); + // lastActivity = Calendar.getInstance().getTimeInMillis(); timer.resetTimer(); } @@ -83,13 +83,13 @@ public class TaskActivityTimer implements ITimerThreadListener, IInteractionEven addElapsedToActivityTime(); timer.setSuspended(true); } - + private void addElapsedToActivityTime() { long elapsed = Calendar.getInstance().getTimeInMillis() - lastActivity; task.setElapsedTime(task.getElapsedTime() + elapsed); - lastActivity = Calendar.getInstance().getTimeInMillis(); + lastActivity = Calendar.getInstance().getTimeInMillis(); } - + public void shellClosed(ShellEvent e) { timer.kill(); } @@ -101,13 +101,13 @@ public class TaskActivityTimer implements ITimerThreadListener, IInteractionEven public void shellIconified(ShellEvent e) { // ignore } - + public void startObserving() { - + } - - public void stopObserving() { - + + public void stopObserving() { + } /** @@ -120,11 +120,12 @@ public class TaskActivityTimer implements ITimerThreadListener, IInteractionEven public String toString() { return "timer for task: " + task.toString(); } + public boolean isSuspended() { return timer.isSuspended(); } public void intervalElapsed() { - addElapsedToActivityTime(); + addElapsedToActivityTime(); } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java index 00cc5160b..9be4fa5b6 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -182,7 +182,8 @@ public class TaskCategory implements ITaskCategory, Serializable { } public void openCategory() { - IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow() + .getActivePage(); if (page == null) { return; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCompleteFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCompleteFilter.java index 044553ef7..2f515e706 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCompleteFilter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCompleteFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -28,10 +28,11 @@ public class TaskCompleteFilter extends AbstractTaskFilter { } return !task.isCompleted(); } else if (element instanceof IQueryHit) { - IQueryHit hit = (IQueryHit)element; + IQueryHit hit = (IQueryHit) element; if (hit.getCorrespondingTask() != null) { if (shouldAlwaysShow(hit.getCorrespondingTask())) { -// if (hit.getCorrespondingTask().isActive() || hit.getCorrespondingTask().isPastReminder()) { + // if (hit.getCorrespondingTask().isActive() || + // hit.getCorrespondingTask().isPastReminder()) { return true; } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskList.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskList.java index 4a457877c..1b78b1a3c 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskList.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskList.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -47,7 +47,7 @@ public class TaskList implements Serializable { void removeFromRoot(ITask task) { rootTasks.remove(task); } - + void addCategory(ITaskCategory cat) { categories.add(cat); } @@ -142,13 +142,14 @@ public class TaskList implements Serializable { } return null; } - + private ITask findTaskHelper(List elements, String handle) { - if (handle == null) return null; + if (handle == null) + return null; for (ITaskListElement element : elements) { if (element instanceof ITask) { if (element.getHandleIdentifier().compareTo(handle) == 0) - return (ITask) element; + return (ITask) element; } else if (element instanceof IQueryHit) { IQueryHit hit = (IQueryHit) element; if (hit.getHandleIdentifier().compareTo(handle) == 0 && hit.getCorrespondingTask() != null) { @@ -189,7 +190,7 @@ public class TaskList implements Serializable { } return included; } - + public List getQueries() { return queries; } @@ -208,7 +209,8 @@ public class TaskList implements Serializable { int max = 0; for (ITask task : tasks) { if (task.participatesInTaskHandles()) { - String string = task.getHandleIdentifier().substring(task.getHandleIdentifier().indexOf('-') + 1, task.getHandleIdentifier().length()); + String string = task.getHandleIdentifier().substring(task.getHandleIdentifier().indexOf('-') + 1, + task.getHandleIdentifier().length()); if (!"".equals(string)) { ihandle = Integer.parseInt(string); } @@ -239,7 +241,7 @@ public class TaskList implements Serializable { } return allTasks; } - + public List getTaskCategories() { List cats = new ArrayList(); for (ITaskCategory cat : categories) { @@ -257,13 +259,15 @@ public class TaskList implements Serializable { } /** - * Use to obtain the QueryHit object associated with a particular - * task handle if it exists. - * @param handle handle of task + * Use to obtain the QueryHit object associated with a particular task + * handle if it exists. + * + * @param handle + * handle of task * @return IQueryHit corresponding to the first hit found in all queries */ public IQueryHit getQueryHitForHandle(String handle) { - IQueryHit foundHit = null; + IQueryHit foundHit = null; for (IRepositoryQuery query : queries) { if ((foundHit = findQueryHitHelper(query.getHits(), handle)) != null) { return foundHit; @@ -272,10 +276,10 @@ public class TaskList implements Serializable { return foundHit; } -// public void clearActiveTasks() { -// for (ITask task : activeTasks) { -// task.setActive(false); -// } -// activeTasks.clear(); -// } + // public void clearActiveTasks() { + // for (ITask task : activeTasks) { + // task.setActive(false); + // } + // activeTasks.clear(); + // } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java index 98ccfa777..8afe3a561 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -33,26 +33,26 @@ import org.eclipse.mylar.tasklist.ITaskRepositoryClient; public class TaskListExtensionReader { public static final String EXTENSION_REPOSITORIES = "org.eclipse.mylar.tasklist.repositories"; - + public static final String ELMNT_REPOSITORY_CLIENT = "repositoryClient"; public static final String ELMNT_TYPE = "type"; - + public static final String ELMNT_QUERY_PAGE = "queryPage"; public static final String ELMNT_SETTINGS_PAGE = "settingsPage"; - + public static final String EXTENSION_TASK_CONTRIBUTOR = "org.eclipse.mylar.tasklist.providers"; - + public static final String ELMNT_TASK_HANDLER = "taskHandler"; public static final String ATTR_EXTERNALIZER_CLASS = "externalizerClass"; public static final String ATTR_ACTION_CONTRIBUTOR_CLASS = "taskHandlerClass"; -// public static final String TASK_LISTENER_ELEMENT = "taskListener"; + // public static final String TASK_LISTENER_ELEMENT = "taskListener"; -// public static final String TASK_LISTENER_CLASS_ID = "class"; + // public static final String TASK_LISTENER_CLASS_ID = "class"; public static final String DYNAMIC_POPUP_ELEMENT = "dynamicPopupMenu"; @@ -67,7 +67,8 @@ public class TaskListExtensionReader { private static boolean extensionsRead = false; public static void initExtensions(TaskListWriter writer) { - // code from "contributing to eclipse" with modifications for deprecated code + // code from "contributing to eclipse" with modifications for deprecated + // code List externalizers = new ArrayList(); if (!extensionsRead) { IExtensionRegistry registry = Platform.getExtensionRegistry(); @@ -80,14 +81,16 @@ public class TaskListExtensionReader { readTaskHandler(elements[j], externalizers); } else if (elements[j].getName().compareTo(ELMNT_REPOSITORY_CLIENT) == 0) { readRepository(elements[j]); -// } else if (elements[j].getName().compareTo(TASK_LISTENER_ELEMENT) == 0) { -// readTaskListener(elements[j]); + // } else if + // (elements[j].getName().compareTo(TASK_LISTENER_ELEMENT) + // == 0) { + // readTaskListener(elements[j]); } else if (elements[j].getName().compareTo(DYNAMIC_POPUP_ELEMENT) == 0) { readDynamicPopupContributor(elements[j]); } } } - + IExtensionPoint repositoriesExtensionPoint = registry.getExtensionPoint(EXTENSION_REPOSITORIES); IExtension[] repositoryExtensions = repositoriesExtensionPoint.getExtensions(); for (int i = 0; i < repositoryExtensions.length; i++) { @@ -120,8 +123,8 @@ public class TaskListExtensionReader { if (editor instanceof IContextEditorFactory) { MylarTaskListPlugin.getDefault().addContextEditor((IContextEditorFactory) editor); } else { - MylarStatusHandler.log("Could not load editor: " + editor.getClass().getCanonicalName() + " must implement " - + IContextEditorFactory.class.getCanonicalName(), null); + MylarStatusHandler.log("Could not load editor: " + editor.getClass().getCanonicalName() + + " must implement " + IContextEditorFactory.class.getCanonicalName(), null); } } catch (CoreException e) { MylarStatusHandler.log(e, "Could not load tasklist listener extension"); @@ -133,8 +136,8 @@ public class TaskListExtensionReader { Object type = element.getAttribute(ELMNT_TYPE); Object repository = element.createExecutableExtension(ATTR_CLASS); if (repository instanceof ITaskRepositoryClient && type != null) { -// MylarTaskListPlugin.getRepositoryManager().addType((String)type); - MylarTaskListPlugin.getRepositoryManager().addRepositoryClient((ITaskRepositoryClient)repository); + // MylarTaskListPlugin.getRepositoryManager().addType((String)type); + MylarTaskListPlugin.getRepositoryManager().addRepositoryClient((ITaskRepositoryClient) repository); } else { MylarStatusHandler.log("could not not load extension: " + repository, null); } @@ -142,20 +145,24 @@ public class TaskListExtensionReader { MylarStatusHandler.log(e, "Could not load tasklist listener extension"); } } - -// private static void readTaskListener(IConfigurationElement element) { -// try { -// Object taskListener = element.createExecutableExtension(TASK_LISTENER_CLASS_ID); -// if (taskListener instanceof ITaskActivityListener) { -// MylarTaskListPlugin.getTaskListManager().addListener((ITaskActivityListener) taskListener); -// } else { -// MylarStatusHandler.log("Could not load tasklist listener: " + taskListener.getClass().getCanonicalName() -// + " must implement " + ITaskActivityListener.class.getCanonicalName(), null); -// } -// } catch (CoreException e) { -// MylarStatusHandler.log(e, "Could not load tasklist listener extension"); -// } -// } + + // private static void readTaskListener(IConfigurationElement element) { + // try { + // Object taskListener = + // element.createExecutableExtension(TASK_LISTENER_CLASS_ID); + // if (taskListener instanceof ITaskActivityListener) { + // MylarTaskListPlugin.getTaskListManager().addListener((ITaskActivityListener) + // taskListener); + // } else { + // MylarStatusHandler.log("Could not load tasklist listener: " + + // taskListener.getClass().getCanonicalName() + // + " must implement " + ITaskActivityListener.class.getCanonicalName(), + // null); + // } + // } catch (CoreException e) { + // MylarStatusHandler.log(e, "Could not load tasklist listener extension"); + // } + // } private static void readDynamicPopupContributor(IConfigurationElement element) { try { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExternalizerException.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExternalizerException.java index ec342e888..fb9049bd6 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExternalizerException.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExternalizerException.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -20,7 +20,7 @@ public class TaskListExternalizerException extends Exception { public TaskListExternalizerException() { super(); } - + public TaskListExternalizerException(String detailMessage) { super(detailMessage); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListManager.java index 8455f87ef..f349f042d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListManager.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -33,31 +33,31 @@ import org.eclipse.mylar.tasklist.IRepositoryQuery; * @author Mik Kersten */ public class TaskListManager { - + public static final String ARCHIVE_CATEGORY_DESCRIPTION = "Archive"; - + private Map timerMap = new HashMap(); private List listeners = new ArrayList(); - + private TaskListWriter taskListWriter; - + private File taskListFile; private TaskList taskList = new TaskList(); private boolean taskListInitialized = false; - + private int nextTaskId; private int timerSleepInterval = TimerThread.DEFAULT_SLEEP_INTERVAL; - - public TaskListManager(TaskListWriter taskListWriter, File file, int startId) { + + public TaskListManager(TaskListWriter taskListWriter, File file, int startId) { this.taskListFile = file; this.taskListWriter = taskListWriter; this.nextTaskId = startId; } - + public TaskList createNewTaskList() { taskList = new TaskList(); taskListInitialized = true; @@ -66,12 +66,13 @@ public class TaskListManager { /** * Exposed for unit testing + * * @return unmodifiable collection of ITaskActivityListeners */ public List getListeners() { return Collections.unmodifiableList(listeners); } - + public String genUniqueTaskHandle() { return TaskRepositoryManager.PREFIX_LOCAL + nextTaskId++; } @@ -89,8 +90,10 @@ public class TaskListManager { createNewTaskList(); } taskListInitialized = true; - for (ITaskActivityListener listener : listeners) listener.tasklistRead(); - // only activate the first task to avoid confusion of mutliple active tasks on startup + for (ITaskActivityListener listener : listeners) + listener.tasklistRead(); + // only activate the first task to avoid confusion of mutliple + // active tasks on startup List activeTasks = taskList.getActiveTasks(); if (activeTasks.size() > 0) { activateTask(activeTasks.get(0)); @@ -126,64 +129,75 @@ public class TaskListManager { public void moveToRoot(ITask task) { if (task.getCategory() instanceof TaskCategory) { - ((TaskCategory)task.getCategory()).removeTask(task); + ((TaskCategory) task.getCategory()).removeTask(task); } task.setCategory(null); - if (!taskList.getRootTasks().contains(task)) taskList.addRootTask(task); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + if (!taskList.getRootTasks().contains(task)) + taskList.addRootTask(task); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } public void moveToCategory(TaskCategory category, ITask task) { taskList.removeFromRoot(task); if (task.getCategory() instanceof TaskCategory) { - ((TaskCategory)task.getCategory()).removeTask(task); + ((TaskCategory) task.getCategory()).removeTask(task); } if (!category.getChildren().contains(task)) { category.addTask(task); } task.setCategory(category); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } public void addCategory(ITaskCategory cat) { taskList.addCategory(cat); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } - + public void removeFromCategory(TaskCategory category, ITask task) { if (!category.isArchive()) { category.removeTask(task); task.setCategory(null); } - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } - + public void removeFromRoot(ITask task) { taskList.removeFromRoot(task); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } - + public void addQuery(IRepositoryQuery cat) { taskList.addQuery(cat); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } public void deleteTask(ITask task) { TaskActivityTimer taskTimer = timerMap.remove(task); - if (taskTimer != null) taskTimer.stopTimer(); + if (taskTimer != null) + taskTimer.stopTimer(); taskList.setActive(task, false); taskList.deleteTask(task); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } public void deleteCategory(ITaskCategory cat) { taskList.deleteCategory(cat); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } public void deleteQuery(IRepositoryQuery query) { taskList.deleteQuery(query); - for (ITaskActivityListener listener : listeners) listener.taskListModified(); + for (ITaskActivityListener listener : listeners) + listener.taskListModified(); } public void addListener(ITaskActivityListener listener) { @@ -196,6 +210,7 @@ public class TaskListManager { /** * Deactivates previously active tasks if not in multiple active mode. + * * @param task */ public void activateTask(ITask task) { @@ -216,8 +231,9 @@ public class TaskListManager { public void deactivateTask(ITask task) { TaskActivityTimer taskTimer = timerMap.remove(task); - if (taskTimer != null) taskTimer.stopTimer(); - taskList.setActive(task, false); + if (taskTimer != null) + taskTimer.stopTimer(); + taskList.setActive(task, false); for (ITaskActivityListener listener : new ArrayList(listeners)) { listener.taskDeactivated(task); } @@ -231,13 +247,13 @@ public class TaskListManager { listener.taskChanged(task); } } - + public void notifyListUpdated() { for (ITaskActivityListener listener : new ArrayList(listeners)) { listener.taskListModified(); } } - + public void setTaskListFile(File f) { this.taskListFile = f; } @@ -249,9 +265,11 @@ public class TaskListManager { } /** - * Use to obtain the QueryHit object associated with a particular - * task handle if it exists. - * @param handle handle of task + * Use to obtain the QueryHit object associated with a particular task + * handle if it exists. + * + * @param handle + * handle of task * @return IQueryHit corresponding to the first hit found in all queries */ public IQueryHit getQueryHitForHandle(String handle) { @@ -259,7 +277,7 @@ public class TaskListManager { return null; return taskList.getQueryHitForHandle(handle); } - + public boolean isTaskListInitialized() { return taskListInitialized; } @@ -281,7 +299,7 @@ public class TaskListManager { public void markComplete(ITask task, boolean complete) { task.setCompleted(complete); - for (ITaskActivityListener listener : new ArrayList(listeners)) { + for (ITaskActivityListener listener : new ArrayList(listeners)) { listener.taskChanged(task); // to ensure comleted filter notices } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListSaveManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListSaveManager.java index c3634ec55..006ec78fe 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListSaveManager.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListSaveManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -32,55 +32,60 @@ import org.eclipse.swt.events.DisposeListener; public class TaskListSaveManager implements ITaskActivityListener, DisposeListener, IBackgroundSaveListener { private final static int DEFAULT_SAVE_INTERVAL = 5 * 60 * 1000; - + private static final String FILE_SUFFIX_BACKUP = "-backup.xml"; private BackgroundSaveTimer saveTimer = null; - + /** * Fort testing. */ private boolean forceBackgroundSave = false; - + public TaskListSaveManager() { saveTimer = new BackgroundSaveTimer(this); saveTimer.setSaveIntervalMillis(DEFAULT_SAVE_INTERVAL); saveTimer.start(); - } - - /** - * Called periodically by the save timer + } + + /** + * Called periodically by the save timer */ public void saveRequested() { - if (MylarTaskListPlugin.getDefault() != null && MylarTaskListPlugin.getDefault().isShellActive() || forceBackgroundSave) { + if (MylarTaskListPlugin.getDefault() != null && MylarTaskListPlugin.getDefault().isShellActive() + || forceBackgroundSave) { try { saveTaskListAndContexts(); -// MylarStatusHandler.log("Automatically saved task list", this); + // MylarStatusHandler.log("Automatically saved task list", + // this); } catch (Exception e) { MylarStatusHandler.fail(e, "Could not auto save task list", false); } } } - + public void saveTaskListAndContexts() { if (MylarTaskListPlugin.getDefault() != null) { MylarTaskListPlugin.getTaskListManager().saveTaskList(); for (ITask task : MylarTaskListPlugin.getTaskListManager().getTaskList().getActiveTasks()) { -// String path = task.getContextPath(); -// File file = MylarPlugin.getContextManager().getFileForContext(task.getContextPath()); -// if (!file.canWrite()) { -// MylarStatusHandler.fail(new Exception(), "could not write context path, resetting: " + path, true); -// task.setContextPath(task.getHandleIdentifier()); -// path = task.getHandleIdentifier(); -// } - MylarPlugin.getContextManager().saveContext(task.getHandleIdentifier());//, path); + // String path = task.getContextPath(); + // File file = + // MylarPlugin.getContextManager().getFileForContext(task.getContextPath()); + // if (!file.canWrite()) { + // MylarStatusHandler.fail(new Exception(), "could not write + // context path, resetting: " + path, true); + // task.setContextPath(task.getHandleIdentifier()); + // path = task.getHandleIdentifier(); + // } + MylarPlugin.getContextManager().saveContext(task.getHandleIdentifier());// , + // path); } } } - + /** - * Copies all files in the current data directory to - * the specified folder. Will overwrite. + * Copies all files in the current data directory to the specified folder. + * Will overwrite. */ public void copyDataDirContentsTo(String targetFolderPath) { File mainDataDir = new File(MylarPlugin.getDefault().getDataDirectory()); @@ -92,26 +97,29 @@ public class TaskListSaveManager implements ITaskActivityListener, DisposeListen } } } - + public void createTaskListBackupFile() { - String path = MylarPlugin.getDefault().getDataDirectory() + File.separator + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; + String path = MylarPlugin.getDefault().getDataDirectory() + File.separator + + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; File taskListFile = new File(path); String backup = path.substring(0, path.lastIndexOf('.')) + FILE_SUFFIX_BACKUP; copy(taskListFile, new File(backup)); } - + public String getBackupFilePath() { - String path = MylarPlugin.getDefault().getDataDirectory() + File.separator + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; + String path = MylarPlugin.getDefault().getDataDirectory() + File.separator + + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; return path.substring(0, path.lastIndexOf('.')) + FILE_SUFFIX_BACKUP; } public void reverseBackup() { - String path = MylarPlugin.getDefault().getDataDirectory() + File.separator + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; + String path = MylarPlugin.getDefault().getDataDirectory() + File.separator + + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; File taskListFile = new File(path); String backup = path.substring(0, path.lastIndexOf('.')) + FILE_SUFFIX_BACKUP; copy(new File(backup), taskListFile); } - + private boolean copy(File src, File dst) { try { InputStream in = new FileInputStream(src); @@ -130,12 +138,12 @@ public class TaskListSaveManager implements ITaskActivityListener, DisposeListen return false; } } - - /** For testing only **/ + + /** For testing only * */ public BackgroundSaveTimer getSaveTimer() { return saveTimer; } - + public void taskActivated(ITask task) { } @@ -159,7 +167,7 @@ public class TaskListSaveManager implements ITaskActivityListener, DisposeListen public void taskListModified() { saveTaskListAndContexts(); } - + public void widgetDisposed(DisposeEvent e) { saveTaskListAndContexts(); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java index a07b74f68..ab959741e 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskPriorityFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskPriorityFilter.java index e2f4817ca..3da60e15f 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskPriorityFilter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskPriorityFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -40,7 +40,7 @@ public class TaskPriorityFilter extends AbstractTaskFilter { } if (element instanceof ITask) { - ITask task = (ITask)element; + ITask task = (ITask) element; if (shouldAlwaysShow(task)) { return true; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java index 3f5c3e307..8d4ff7fe5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskRepositoryManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -64,7 +64,7 @@ public class TaskRepositoryManager { public ITaskRepositoryClient getRepositoryClient(String kind) { return repositoryClients.get(kind); } - + public void addRepositoryClient(ITaskRepositoryClient repositoryClient) { if (!repositoryClients.values().contains(repositoryClient)) { repositoryClients.put(repositoryClient.getKind(), repositoryClient); @@ -147,7 +147,7 @@ public class TaskRepositoryManager { } return null; } - + /** * TODO: implement default support, this just returns first found */ @@ -160,8 +160,8 @@ public class TaskRepositoryManager { } else { Collection values = repositoryMap.values(); if (!values.isEmpty()) { - HashSet repoistorySet = (HashSet)values.iterator().next(); - return (TaskRepository)repoistorySet.iterator().next(); + HashSet repoistorySet = (HashSet) values.iterator().next(); + return (TaskRepository) repoistorySet.iterator().next(); } } return null; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/CompletedTaskCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/CompletedTaskCollector.java index 42fb9bc4d..f710f95b9 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/CompletedTaskCollector.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/CompletedTaskCollector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ITaskCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ITaskCollector.java index 072317642..d56c054cc 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ITaskCollector.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ITaskCollector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -19,8 +19,8 @@ import org.eclipse.mylar.tasklist.ITask; * @author Ken Sueda */ public interface ITaskCollector { - + public abstract void consumeTask(ITask task); - + public abstract List getTasks(); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/InProgressTaskCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/InProgressTaskCollector.java index 52a4d0482..3139b90e8 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/InProgressTaskCollector.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/InProgressTaskCollector.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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.mylar.internal.tasklist.planner; import java.util.ArrayList; @@ -12,8 +22,8 @@ import org.eclipse.mylar.core.MylarPlugin; import org.eclipse.mylar.tasklist.ITask; /** - * Collects tasks that are not complete but have been worked - * on during the specified number of previous days. + * Collects tasks that are not complete but have been worked on during the + * specified number of previous days. * * @author Wesley Coelho (Adapted from CompletedTaskCollector by Key Sueda) * @author Mik Kersten @@ -21,38 +31,41 @@ import org.eclipse.mylar.tasklist.ITask; public class InProgressTaskCollector implements ITaskCollector { private Map inProgressTasks = new HashMap(); - private Date periodStartDate ; -// private long DAY = 24*3600*1000; - + + private Date periodStartDate; + + // private long DAY = 24*3600*1000; + public InProgressTaskCollector(Date periodStartDate) { -// periodStartDate = new Date(new Date().getTime() - prevDays * DAY); + // periodStartDate = new Date(new Date().getTime() - prevDays * DAY); this.periodStartDate = periodStartDate; } - + public String getLabel() { return "Tasks in Progress"; } public void consumeTask(ITask task) { - if (!task.isCompleted() && hasActivitySince(task, periodStartDate) && !inProgressTasks.containsKey(task.getHandleIdentifier())) { + if (!task.isCompleted() && hasActivitySince(task, periodStartDate) + && !inProgressTasks.containsKey(task.getHandleIdentifier())) { inProgressTasks.put(task.getHandleIdentifier(), task); } } - + protected boolean hasActivitySince(ITask task, Date startDate) { - IMylarContext mylarContext = MylarPlugin.getContextManager().loadContext(task.getHandleIdentifier());//,task.getContextPath()); - if (mylarContext != null){ + IMylarContext mylarContext = MylarPlugin.getContextManager().loadContext(task.getHandleIdentifier());// ,task.getContextPath()); + if (mylarContext != null) { List events = mylarContext.getInteractionHistory(); - if (events.size() > 0){ + if (events.size() > 0) { InteractionEvent latestEvent = events.get(events.size() - 1); - if (latestEvent.getDate().compareTo(periodStartDate) > 0){ + if (latestEvent.getDate().compareTo(periodStartDate) > 0) { return true; } } } return false; } - + public List getTasks() { List tasks = new ArrayList(); tasks.addAll(inProgressTasks.values()); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ReminderRequiredCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ReminderRequiredCollector.java index 8c6348944..ee30e5f8a 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ReminderRequiredCollector.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ReminderRequiredCollector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -23,12 +23,13 @@ import org.eclipse.mylar.tasklist.ITask; public class ReminderRequiredCollector implements ITaskCollector { private List tasks = new ArrayList(); + private Date curr = null; - + public ReminderRequiredCollector() { curr = new Date(); } - + public void consumeTask(ITask task) { if (task.getReminderDate() != null && !task.hasBeenReminded() && task.getReminderDate().compareTo(curr) < 0) { task.setReminded(true); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/TaskReportGenerator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/TaskReportGenerator.java index 679888aa0..8581063da 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/TaskReportGenerator.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/TaskReportGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -76,7 +76,7 @@ public class TaskReportGenerator implements IRunnableWithProgress { } int estimatedItemsToProcess = rootElements.size(); - monitor.beginTask("Mylar Task Planner", estimatedItemsToProcess); + monitor.beginTask("Mylar Task Planner", estimatedItemsToProcess); for (Object element : rootElements) { monitor.worked(1); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java index 06f2cc2c2..f93fc8fb3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/ReminderCellEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/ReminderCellEditor.java index 606bd91d0..af9b7ed23 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/ReminderCellEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/ReminderCellEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/RemoveTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/RemoveTaskAction.java index 66e0dee66..2ce2bf916 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/RemoveTaskAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/RemoveTaskAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivityLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivityLabelProvider.java index 071bc0ae0..a62762232 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivityLabelProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivityLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -28,15 +28,15 @@ import org.eclipse.swt.graphics.Image; * @author Ken Sueda */ public class TaskActivityLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider { - + private TasklistLabelProvider taskListLabelProvider = new TasklistLabelProvider(); - - public Image getColumnImage(Object element, int columnIndex) { - if (! (element instanceof ITaskListElement)) { - return null; - } + + public Image getColumnImage(Object element, int columnIndex) { + if (!(element instanceof ITaskListElement)) { + return null; + } if (columnIndex == 0) { - return ((ITaskListElement)element).getIcon(); + return ((ITaskListElement) element).getIcon(); } else { return null; } @@ -46,41 +46,41 @@ public class TaskActivityLabelProvider extends LabelProvider implements ITableLa try { if (element instanceof ITask) { ITask task = (ITask) element; - switch(columnIndex) { + switch (columnIndex) { case 1: return task.getPriority(); - case 2: - return task.getDescription(); + case 2: + return task.getDescription(); case 3: - if (task.getCreationDate() != null){ + if (task.getCreationDate() != null) { return DateFormat.getDateInstance(DateFormat.MEDIUM).format(task.getCreationDate()); - } else{ + } else { MylarStatusHandler.log("Task has no creation date: " + task.getDescription(), this); return "[unknown]"; } case 4: if (task.getCompletionDate() != null) { return DateFormat.getDateInstance(DateFormat.MEDIUM).format(task.getCompletionDate()); - } else{ + } else { return ""; } case 5: return DateUtil.getFormattedDurationShort(task.getElapsedTime()); - case 6: + case 6: return task.getEstimateTimeHours() + " hours"; - } + } } } catch (RuntimeException e) { MylarStatusHandler.fail(e, "Could not produce completed task label", false); return ""; - } + } return null; } public Color getForeground(Object element) { -// if (editorInput.createdDuringReportPeriod((ITask) tasks[i])) { -// table.getItem(i).setForeground(new Color(null, new RGB(0, 0, 255))); -// } + // if (editorInput.createdDuringReportPeriod((ITask) tasks[i])) { + // table.getItem(i).setForeground(new Color(null, new RGB(0, 0, 255))); + // } return taskListLabelProvider.getForeground(element); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivitySorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivitySorter.java index a20c8ab1d..52ee346a3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivitySorter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskActivitySorter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -22,13 +22,19 @@ import org.eclipse.mylar.tasklist.ITask; public class TaskActivitySorter extends ViewerSorter { public final static int DESCRIPTION = 1; + public final static int PRIORITY = 2; + public final static int CREATION_DATE = 3; + public final static int COMPLETED_DATE = 4; + public final static int DURATION = 5; + public final static int ESTIMATED = 6; + public static final int ICON = 0; - + private int criteria; public TaskActivitySorter(int criteria) { @@ -42,31 +48,31 @@ public class TaskActivitySorter extends ViewerSorter { ITask t2 = (ITask) obj2; switch (criteria) { - case DESCRIPTION: - return compareDescription(t1, t2); - case PRIORITY: - return comparePriority(t1, t2); - case CREATION_DATE: - return compareCreationDate(t1, t2); - case COMPLETED_DATE: - return compareCompletedDate(t1, t2); - case DURATION: - return compareDuration(t1, t2); - case ESTIMATED: - return compareEstimated(t1, t2); - default: - return 0; + case DESCRIPTION: + return compareDescription(t1, t2); + case PRIORITY: + return comparePriority(t1, t2); + case CREATION_DATE: + return compareCreationDate(t1, t2); + case COMPLETED_DATE: + return compareCompletedDate(t1, t2); + case DURATION: + return compareDuration(t1, t2); + case ESTIMATED: + return compareEstimated(t1, t2); + default: + return 0; } } - + protected int compareDescription(ITask task1, ITask task2) { return task1.getDescription().compareTo(task2.getDescription()); } - + protected int comparePriority(ITask task1, ITask task2) { return task1.getPriority().compareTo(task2.getPriority()); } - + protected int compareCompletedDate(ITask task1, ITask task2) { return task2.getCompletionDate().compareTo(task1.getCompletionDate()); } @@ -74,16 +80,16 @@ public class TaskActivitySorter extends ViewerSorter { protected int compareEstimated(ITask task1, ITask task2) { return task2.getEstimateTimeHours() - task1.getEstimateTimeHours(); } - + protected int compareCreationDate(ITask task1, ITask task2) { - if(task1.getCreationDate() == null) + if (task1.getCreationDate() == null) return 1; - else if(task2.getCreationDate() == null) + else if (task2.getCreationDate() == null) return -1; else return task2.getCreationDate().compareTo(task1.getCreationDate()); } - + protected int compareDuration(ITask task1, ITask task2) { return task1.getElapsedTime() < task2.getElapsedTime() ? 1 : -1; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanContentProvider.java index ecc13862e..236d8ff78 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanContentProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanLabelProvider.java index 507a55d34..60d1dbc09 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanLabelProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -27,24 +27,24 @@ public class TaskPlanLabelProvider extends LabelProvider implements ITableLabelP // {".", "Description", "Priority", "Estimated Time", "Reminder Date"}; public Image getColumnImage(Object element, int columnIndex) { - if (! (element instanceof ITaskListElement)) { - return null; - } + if (!(element instanceof ITaskListElement)) { + return null; + } if (columnIndex == 0) { - return ((ITaskListElement)element).getIcon(); + return ((ITaskListElement) element).getIcon(); } else { return null; } - + } public String getColumnText(Object element, int columnIndex) { if (element instanceof ITask) { ITask task = (ITask) element; - switch(columnIndex) { + switch (columnIndex) { case 1: return task.getPriority(); - case 2: + case 2: return task.getDescription(); case 3: return DateUtil.getFormattedDurationShort(task.getElapsedTime()); @@ -56,8 +56,8 @@ public class TaskPlanLabelProvider extends LabelProvider implements ITableLabelP } else { return ""; } - } - } + } + } return null; } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanSorter.java index 4f9de7a4b..af167435a 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanSorter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlanSorter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -19,12 +19,17 @@ import org.eclipse.mylar.tasklist.ITask; */ public class TaskPlanSorter extends TaskActivitySorter { -// {".", "Description", "Priority", "Estimated Time", "Reminder Date"}; + // {".", "Description", "Priority", "Estimated Time", "Reminder Date"}; public final static int PRIORITY = 1; + public final static int DESCRIPTION = 2; + public final static int DURATION = 3; + public final static int ESTIMATE = 4; + public final static int REMINDER = 5; + public static final int ICON = 0; private int criteria; @@ -40,43 +45,46 @@ public class TaskPlanSorter extends TaskActivitySorter { ITask t2 = (ITask) obj2; switch (criteria) { - case PRIORITY: - return comparePriority(t1, t2); - case DESCRIPTION: - return compareDescription(t1, t2); - case DURATION: - return compareDuration(t1, t2); - case ESTIMATE: - return compareEstimated(t1, t2); - case REMINDER: - return compareReminder(t1, t2); - default: - return 0; + case PRIORITY: + return comparePriority(t1, t2); + case DESCRIPTION: + return compareDescription(t1, t2); + case DURATION: + return compareDuration(t1, t2); + case ESTIMATE: + return compareEstimated(t1, t2); + case REMINDER: + return compareReminder(t1, t2); + default: + return 0; } } private int compareReminder(ITask task1, ITask task2) { - if (task2.getReminderDate() == null) return -1; - if (task1.getReminderDate() == null) return 1; - if (task1.getReminderDate() == null && task2.getReminderDate() == null) return 0; + if (task2.getReminderDate() == null) + return -1; + if (task1.getReminderDate() == null) + return 1; + if (task1.getReminderDate() == null && task2.getReminderDate() == null) + return 0; return task2.getReminderDate().compareTo(task1.getReminderDate()); } -// protected int compareEstimated(ITask task1, ITask task2) { -// if (task1.getEstimateTimeHours() > task2.getEstimateTimeHours()) { -// return 1; -// } else { -// return -1; -// } - -// private int compareDescription(ITask task1, ITask task2) { -// return task1.getDescription(false).compareTo(task2.getDescription(false)); -// } -// -// private int comparePriority(ITask task1, ITask task2) { -// return task1.getPriority().compareTo(task2.getPriority()); -// } -// + // protected int compareEstimated(ITask task1, ITask task2) { + // if (task1.getEstimateTimeHours() > task2.getEstimateTimeHours()) { + // return 1; + // } else { + // return -1; + // } + // private int compareDescription(ITask task1, ITask task2) { + // return + // task1.getDescription(false).compareTo(task2.getDescription(false)); + // } + // + // private int comparePriority(ITask task1, ITask task2) { + // return task1.getPriority().compareTo(task2.getPriority()); + // } + // } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerContentProvider.java index a049174a4..829de6da0 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerContentProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -25,9 +25,9 @@ public class TaskPlannerContentProvider implements IStructuredContentProvider { private List tasks = new ArrayList(); - public TaskPlannerContentProvider() { + public TaskPlannerContentProvider() { } - + public TaskPlannerContentProvider(List allTasks) { tasks = allTasks; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorInput.java index 40138368c..c38e4eff6 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorInput.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorInput.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -37,10 +37,10 @@ public class TaskPlannerEditorInput implements IEditorInput { private List completedTasks = null; private List inProgressTasks = null; - + private TaskReportGenerator taskReportGenerator = null; -// private int prevDaysToReport = -1; + // private int prevDaysToReport = -1; private Date reportStartDate = null; @@ -57,7 +57,8 @@ public class TaskPlannerEditorInput implements IEditorInput { try { IProgressService service = PlatformUI.getWorkbench().getProgressService(); service.run(false, true, taskReportGenerator); - while (!taskReportGenerator.isFinished()) Thread.sleep(500); + while (!taskReportGenerator.isFinished()) + Thread.sleep(500); } catch (InvocationTargetException e) { // operation was canceled } catch (InterruptedException e) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java index 715b56e34..98b245af8 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -149,18 +149,16 @@ public class TaskPlannerEditorPart extends EditorPart { @Override public void createPartControl(Composite parent) { FormToolkit toolkit = new FormToolkit(parent.getDisplay()); - ScrolledForm sform = toolkit.createScrolledForm(parent); + ScrolledForm sform = toolkit.createScrolledForm(parent); Composite editorComposite = sform.getBody(); editorComposite.setLayout(new GridLayout()); GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL_BOTH; - gridData.grabExcessHorizontalSpace = true; - gridData.grabExcessVerticalSpace = true; - editorComposite.setLayoutData(gridData); - - - + gridData.horizontalAlignment = GridData.FILL_BOTH; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + editorComposite.setLayoutData(gridData); + createSummarySection(editorComposite, toolkit, editorInput.getReportStartDate()); String label = LABEL_TASK_ACTIVITY; @@ -172,37 +170,32 @@ public class TaskPlannerEditorPart extends EditorPart { sashForm.setLayout(new GridLayout()); sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); - + TaskPlannerContentProvider activityContentProvider = new TaskPlannerContentProvider(allTasks); final TableViewer activityViewer = createTableSection(sashForm, toolkit, label, activityColumnNames, - activityColumnWidths, activitySortConstants); + activityColumnWidths, activitySortConstants); activityViewer.setContentProvider(activityContentProvider); activityViewer.setLabelProvider(new TaskActivityLabelProvider()); setSorters(activityColumnNames, activitySortConstants, activityViewer.getTable(), activityViewer, false); activityViewer.setInput(editorInput); - - - + MenuManager activityContextMenuMgr = new MenuManager("#ActivityPlannerPopupMenu"); activityContextMenuMgr.setRemoveAllWhenShown(true); activityContextMenuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { TaskPlannerEditorPart.this.fillContextMenu(activityViewer, manager); - + } }); Menu menu = activityContextMenuMgr.createContextMenu(activityViewer.getControl()); activityViewer.getControl().setMenu(menu); getSite().registerContextMenu(activityContextMenuMgr, activityViewer); - Composite planContainer = toolkit.createComposite(sashForm); GridLayout planLayout = new GridLayout(); planLayout.marginTop = 10; planContainer.setLayout(planLayout); - - TaskPlannerContentProvider planContentProvider = new TaskPlannerContentProvider(); final TableViewer planViewer = createTableSection(planContainer, toolkit, "Task Plan", planColumnNames, planColumnWidths, planSortConstants); @@ -213,8 +206,8 @@ public class TaskPlannerEditorPart extends EditorPart { initDrop(planViewer, planContentProvider); setSorters(planColumnNames, planSortConstants, planViewer.getTable(), planViewer, true); planViewer.setInput(editorInput); - - MenuManager planContextMenuMgr = new MenuManager("#PlanPlannerPopupMenu"); + + MenuManager planContextMenuMgr = new MenuManager("#PlanPlannerPopupMenu"); planContextMenuMgr.setRemoveAllWhenShown(true); planContextMenuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { @@ -229,17 +222,14 @@ public class TaskPlannerEditorPart extends EditorPart { createButtons(editorComposite, toolkit, planViewer, planContentProvider); } - - private void fillContextMenu(TableViewer viewer, IMenuManager manager) { - if(!viewer.getSelection().isEmpty()) { + if (!viewer.getSelection().isEmpty()) { manager.add(new OpenTaskEditorAction(viewer)); manager.add(new RemoveTaskAction(viewer)); manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } } - - + @Override public void setFocus() { } @@ -247,8 +237,9 @@ public class TaskPlannerEditorPart extends EditorPart { private void createSummarySection(Composite parent, FormToolkit toolkit, Date startDate) { Section summarySection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR); summarySection.setText(LABEL_DIALOG); -// summarySection.setLayout(new TableWrapLayout()); -// summarySection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); + // summarySection.setLayout(new TableWrapLayout()); + // summarySection.setLayoutData(new + // TableWrapData(TableWrapData.FILL_GRAB)); summarySection.setLayout(new GridLayout()); summarySection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite summaryContainer = toolkit.createComposite(summarySection); @@ -380,7 +371,6 @@ public class TaskPlannerEditorPart extends EditorPart { detailContainer.setLayout(new GridLayout()); detailContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); - return createTable(detailContainer, toolkit, columnNames, columnWidths, sortConstants); } @@ -388,10 +378,10 @@ public class TaskPlannerEditorPart extends EditorPart { int[] sortConstants) { int style = SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; Table table = toolkit.createTable(parent, style); - + table.setLayout(new GridLayout()); table.setLayoutData(new GridData(GridData.FILL_BOTH)); - + table.setLinesVisible(true); table.setHeaderVisible(true); table.setEnabled(true); @@ -408,7 +398,7 @@ public class TaskPlannerEditorPart extends EditorPart { TableViewer tableViewer = new TableViewer(table); tableViewer.setUseHashlookup(true); - tableViewer.setColumnProperties(columnNames); + tableViewer.setColumnProperties(columnNames); final OpenTaskEditorAction openAction = new OpenTaskEditorAction(tableViewer); tableViewer.addDoubleClickListener(new IDoubleClickListener() { @@ -475,21 +465,23 @@ public class TaskPlannerEditorPart extends EditorPart { } }); -// Button delete = toolkit.createButton(container, "Remove Selected", SWT.PUSH | SWT.CENTER); -// delete.addSelectionListener(new SelectionAdapter() { -// @Override -// public void widgetSelected(SelectionEvent e) { -// for (Object object : ((IStructuredSelection) viewer.getSelection()).toList()) { -// if (object instanceof ITask) { -// ITask task = (ITask) object; -// if (task != null) { -// contentProvider.removeTask(task); -// } -// } -// } -// viewer.refresh(); -// } -// }); + // Button delete = toolkit.createButton(container, "Remove Selected", + // SWT.PUSH | SWT.CENTER); + // delete.addSelectionListener(new SelectionAdapter() { + // @Override + // public void widgetSelected(SelectionEvent e) { + // for (Object object : ((IStructuredSelection) + // viewer.getSelection()).toList()) { + // if (object instanceof ITask) { + // ITask task = (ITask) object; + // if (task != null) { + // contentProvider.removeTask(task); + // } + // } + // } + // viewer.refresh(); + // } + // }); } @MylarWebRef(name = "Drag and drop article", url = "http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html") @@ -503,9 +495,9 @@ public class TaskPlannerEditorPart extends EditorPart { @Override public boolean performDrop(Object data) { - - IStructuredSelection selection = ((IStructuredSelection) TaskListView - .getDefault().getViewer().getSelection()); + + IStructuredSelection selection = ((IStructuredSelection) TaskListView.getDefault().getViewer() + .getSelection()); for (Iterator iter = selection.iterator(); iter.hasNext();) { Object selectedObject = iter.next(); @@ -514,15 +506,12 @@ public class TaskPlannerEditorPart extends EditorPart { updateEstimatedHours(contentProvider); continue; } else if (selectedObject instanceof ITaskListElement) { - if (MylarTaskListPlugin.getDefault() - .getHandlerForElement( - (ITaskListElement) selectedObject) != null) { + if (MylarTaskListPlugin.getDefault().getHandlerForElement((ITaskListElement) selectedObject) != null) { ITask task = null; if (selectedObject instanceof ITask) { task = (ITask) selectedObject; } else if (selectedObject instanceof IQueryHit) { - task = ((IQueryHit) selectedObject) - .getOrCreateCorrespondingTask(); + task = ((IQueryHit) selectedObject).getOrCreateCorrespondingTask(); } if (task != null) { contentProvider.addTask(task); @@ -535,7 +524,7 @@ public class TaskPlannerEditorPart extends EditorPart { } } tableViewer.refresh(); - return true; + return true; } @Override @@ -573,8 +562,8 @@ public class TaskPlannerEditorPart extends EditorPart { if (element instanceof ITask) { if (columnIndex == 5) { if (((ITask) element).getReminderDate() != null) { - return DateFormat.getDateInstance(DateFormat.MEDIUM) - .format(((ITask) element).getReminderDate()); + return DateFormat.getDateInstance(DateFormat.MEDIUM).format( + ((ITask) element).getReminderDate()); } else { return null; } @@ -650,22 +639,22 @@ public class TaskPlannerEditorPart extends EditorPart { totalEstimatedHoursLabel.setText(LABEL_ESTIMATED + total + " hours"); } -// public class OpenTaskEditorAction extends Action { -// -// private TableViewer viewer; -// -// public OpenTaskEditorAction(TableViewer viewer) { -// this.viewer = viewer; -// } -// -// @Override -// public void run() { -// ISelection selection = viewer.getSelection(); -// Object obj = ((IStructuredSelection) selection).getFirstElement(); -// if (obj instanceof Task) { -// ((Task) obj).openTaskInEditor(false); -// } -// viewer.refresh(obj); -// } -// } + // public class OpenTaskEditorAction extends Action { + // + // private TableViewer viewer; + // + // public OpenTaskEditorAction(TableViewer viewer) { + // this.viewer = viewer; + // } + // + // @Override + // public void run() { + // ISelection selection = viewer.getSelection(); + // Object obj = ((IStructuredSelection) selection).getFirstElement(); + // if (obj instanceof Task) { + // ((Task) obj).openTaskInEditor(false); + // } + // viewer.refresh(obj); + // } + // } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizard.java index cc9ba9c4a..9c6790274 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -42,8 +42,8 @@ public class TaskPlannerWizard extends Wizard implements INewWizard { .getActivePage(); if (page == null) return false; - IEditorInput input = new TaskPlannerEditorInput(planningGamePage.getReportStartDate(), planningGamePage.getSelectedFilters(), MylarTaskListPlugin - .getTaskListManager().getTaskList()); + IEditorInput input = new TaskPlannerEditorInput(planningGamePage.getReportStartDate(), planningGamePage + .getSelectedFilters(), MylarTaskListPlugin.getTaskListManager().getTaskList()); page.openEditor(input, MylarTaskListPrefConstants.PLANNER_EDITOR_ID); } catch (PartInitException ex) { MylarStatusHandler.log(ex, "couldn't open summary editor"); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizardPage.java index 9cc468b84..bbf9136ee 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizardPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/AbstractTaskFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/AbstractTaskFilter.java index fa81135fd..f1f30a55f 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/AbstractTaskFilter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/AbstractTaskFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -16,7 +16,7 @@ import org.eclipse.mylar.tasklist.ITask; * @author Ken Sueda */ public abstract class AbstractTaskFilter { - + public abstract boolean select(Object element); protected boolean shouldAlwaysShow(ITask task) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditor.java index a7b4fe064..70ae52f7c 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -37,14 +37,17 @@ import org.eclipse.ui.part.EditorPart; public class CategoryEditor extends EditorPart { private CategoryEditorInput input = null; + private boolean isDirty = false; + private Text description = null; - + @Override public void doSave(IProgressMonitor monitor) { input.setCategoryName(description.getText()); isDirty = false; - if (TaskListView.getDefault() != null) TaskListView.getDefault().notifyTaskDataChanged(null); + if (TaskListView.getDefault() != null) + TaskListView.getDefault().notifyTaskDataChanged(null); firePropertyChange(PROP_DIRTY); } @@ -54,11 +57,10 @@ public class CategoryEditor extends EditorPart { @SuppressWarnings("deprecation") @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { + public void init(IEditorSite site, IEditorInput input) throws PartInitException { setSite(site); setInput(input); - this.input = (CategoryEditorInput)input; + this.input = (CategoryEditorInput) input; setPartName(input.getName()); setTitleToolTip(input.getToolTipText()); } @@ -79,7 +81,7 @@ public class CategoryEditor extends EditorPart { ScrolledForm sform = toolkit.createScrolledForm(parent); sform.getBody().setLayout(new TableWrapLayout()); Composite editorComposite = sform.getBody(); - + createSummarySection(editorComposite, toolkit); } @@ -89,15 +91,15 @@ public class CategoryEditor extends EditorPart { private void createSummarySection(Composite parent, FormToolkit toolkit) { Section summarySection = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR); - summarySection.setText("Category Summary"); + summarySection.setText("Category Summary"); summarySection.setLayout(new TableWrapLayout()); - summarySection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); + summarySection.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); Composite summaryContainer = toolkit.createComposite(summarySection); - summarySection.setClient(summaryContainer); + summarySection.setClient(summaryContainer); TableWrapLayout layout = new TableWrapLayout(); - layout.numColumns = 2; + layout.numColumns = 2; summaryContainer.setLayout(layout); - + Label label = toolkit.createLabel(summaryContainer, "Description: ", SWT.NULL); label.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); description = toolkit.createText(summaryContainer, input.getCategoryName(), SWT.BORDER); @@ -105,10 +107,10 @@ public class CategoryEditor extends EditorPart { description.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { markDirty(); - } + } }); } - + private void markDirty() { isDirty = true; firePropertyChange(PROP_DIRTY); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditorInput.java index 51919aa9e..ae9b424e0 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditorInput.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/CategoryEditorInput.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -22,10 +22,11 @@ import org.eclipse.ui.IPersistableElement; public class CategoryEditorInput implements IEditorInput { private ITaskCategory category; - + public CategoryEditorInput(ITaskCategory cat) { - this.category = cat; + this.category = cat; } + public boolean exists() { return true; } @@ -53,8 +54,8 @@ public class CategoryEditorInput implements IEditorInput { public String getCategoryName() { return category.getDescription(); } - + public void setCategoryName(String description) { - category.setDescription(description); + category.setDescription(description); } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IContextEditorFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IContextEditorFactory.java index 2eff20cad..4cec8de85 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IContextEditorFactory.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IContextEditorFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -21,7 +21,7 @@ import org.eclipse.ui.IEditorPart; public interface IContextEditorFactory { public IEditorPart createEditor(); - + public IEditorInput createEditorInput(IMylarContext context); public String getTitle(); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IDynamicSubMenuContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IDynamicSubMenuContributor.java index 9d3aa8561..a0389f6a9 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IDynamicSubMenuContributor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IDynamicSubMenuContributor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -15,7 +15,6 @@ import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView; public interface IDynamicSubMenuContributor { - public abstract MenuManager getSubMenuManager(TaskListView view, - ITaskListElement selection); + public abstract MenuManager getSubMenuManager(TaskListView view, ITaskListElement selection); -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskHighlighter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskHighlighter.java index 6a998534c..4cb7eeff2 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskHighlighter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskHighlighter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -18,6 +18,6 @@ import org.eclipse.swt.graphics.Color; * @author Mik Kersten */ public interface ITaskHighlighter { - + public Color getHighlightColor(ITask task); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskListElement.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskListElement.java index 725ecca01..8737011d5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskListElement.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskListElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -19,34 +19,34 @@ import org.eclipse.swt.graphics.Image; * @author Mik Kersten */ public interface ITaskListElement { - + public abstract boolean isCompleted(); - + public abstract Image getIcon(); - public abstract Image getStatusIcon(); - + public abstract Image getStatusIcon(); + public abstract boolean isDragAndDropEnabled(); - - public abstract String getPriority(); - - public abstract String getDescription(); - - public abstract void setDescription(String description); - - public abstract String getHandleIdentifier(); - - public abstract void setHandleIdentifier(String id); - - public abstract boolean isLocal(); - - public abstract boolean isActivatable(); + + public abstract String getPriority(); + + public abstract String getDescription(); + + public abstract void setDescription(String description); + + public abstract String getHandleIdentifier(); + + public abstract void setHandleIdentifier(String id); + + public abstract boolean isLocal(); + + public abstract boolean isActivatable(); public abstract Font getFont(); - + public abstract String getToolTipText(); - -// public abstract String getStringForSortingDescription(); + + // public abstract String getStringForSortingDescription(); } -//public abstract Color getForeground(); \ No newline at end of file +// public abstract Color getForeground(); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java index 3348eedaf..81ef50822 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -59,7 +59,7 @@ public class MylarTaskEditor extends MultiPageEditorPart { private Browser webBrowser; private TaskEditorInput taskEditorInput; - + private TaskEditorListener partListener; private List editorsToNotifyOnChange = new ArrayList(); @@ -102,7 +102,7 @@ public class MylarTaskEditor extends MultiPageEditorPart { partListener = new TaskEditorListener(); activePage.addPartListener(partListener); taskInfoEditor = new TaskInfoEditor(); - + } @Override @@ -152,7 +152,8 @@ public class MylarTaskEditor extends MultiPageEditorPart { setPageText(index, ISSUE_WEB_PAGE_LABEL); webBrowser.setUrl(task.getUrl()); - boolean openWithBrowser = MylarTaskListPlugin.getPrefs().getBoolean(MylarTaskListPrefConstants.REPORT_OPEN_INTERNAL); + boolean openWithBrowser = MylarTaskListPlugin.getPrefs().getBoolean( + MylarTaskListPrefConstants.REPORT_OPEN_INTERNAL); if (task.isLocal() || openWithBrowser) setActivePage(index); } catch (SWTError e) { @@ -207,7 +208,7 @@ public class MylarTaskEditor extends MultiPageEditorPart { */ task = taskEditorInput.getTask(); try { - taskInfoEditor.init(this.getEditorSite(), this.getEditorInput()); + taskInfoEditor.init(this.getEditorSite(), this.getEditorInput()); taskInfoEditor.setTask(task); // Set the title on the editor's tab this.setPartName(taskEditorInput.getLabel()); @@ -232,20 +233,20 @@ public class MylarTaskEditor extends MultiPageEditorPart { * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart) */ public void partActivated(IWorkbenchPart part) { - if (part.equals(MylarTaskEditor.this)) { + if (part.equals(MylarTaskEditor.this)) { ITask task = taskEditorInput.getTask(); IQueryHit hit = null; MylarTaskListPlugin.getTaskListManager().getQueryHitForHandle(task.getHandleIdentifier()); - + if (TaskListView.getDefault() != null) { - Viewer viewer = TaskListView.getDefault().getViewer(); + Viewer viewer = TaskListView.getDefault().getViewer(); viewer.setSelection(new StructuredSelection(task)); // if no task exists, select the query hit if exists if (viewer.getSelection().isEmpty() && (hit = MylarTaskListPlugin.getTaskListManager().getQueryHitForHandle( task.getHandleIdentifier())) != null) { viewer.setSelection(new StructuredSelection(hit)); - } + } viewer.refresh(); } } @@ -286,12 +287,12 @@ public class MylarTaskEditor extends MultiPageEditorPart { public void changeTitle() { this.setPartName(taskEditorInput.getLabel()); } - - public void markDirty() { - firePropertyChange(PROP_DIRTY); + + public void markDirty() { + firePropertyChange(PROP_DIRTY); return; } - + @Override public void setFocus() { // taskInfoEditor.setFocus(); @@ -310,7 +311,7 @@ public class MylarTaskEditor extends MultiPageEditorPart { } } } - + public void dispose() { for (IEditorPart part : editorsToNotifyOnChange) { part.dispose(); @@ -334,5 +335,5 @@ public class MylarTaskEditor extends MultiPageEditorPart { } } - + } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorCopyAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorCopyAction.java index e32737611..a7f933903 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorCopyAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorCopyAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -19,15 +19,15 @@ import org.eclipse.jface.action.Action; * TODO: delete? */ public class TaskEditorCopyAction extends Action { - + public TaskEditorCopyAction() { setText("TaskInfoEditor.copy.text"); } - + @Override public void run() { -// if (editorPart instanceof TaskInfoEditor) -// ((TaskInfoEditor)editorPart).getCurrentText().copy(); + // if (editorPart instanceof TaskInfoEditor) + // ((TaskInfoEditor)editorPart).getCurrentText().copy(); } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorInput.java index 9b6aaa401..e332c5d71 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorInput.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskEditorInput.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -18,20 +18,19 @@ import org.eclipse.mylar.tasklist.ITask; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPersistableElement; - /** * @author Eric Booth */ public class TaskEditorInput implements IEditorInput { private static final int MAX_LABEL_LENGTH = 60; - + private ITask task; - + private String id; - + private String label; - + public TaskEditorInput(ITask task) { this.task = task; id = task.getHandleIdentifier(); @@ -45,41 +44,50 @@ public class TaskEditorInput implements IEditorInput { return description.substring(0, MAX_LABEL_LENGTH) + "..."; } } - - - public boolean exists() { + + public boolean exists() { return true; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.ui.IEditorInput#getImageDescriptor() */ public ImageDescriptor getImageDescriptor() { return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.ui.IEditorInput#getName() */ public String getName() { return "Task #" + id; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.ui.IEditorInput#getPersistable() */ public IPersistableElement getPersistable() { return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.ui.IEditorInput#getToolTipText() */ public String getToolTipText() { return label; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ public Object getAdapter(Class adapter) { @@ -92,14 +100,14 @@ public class TaskEditorInput implements IEditorInput { public ITask getTask() { return task; } - + /** * @return Returns the id. */ public String getId() { return id; } - + /** * @return Returns the label. */ @@ -107,9 +115,10 @@ public class TaskEditorInput implements IEditorInput { label = truncateDescription(task.getDescription()); return label; } - + /** - * Returns true if the argument is a bug report editor input on the same bug id. + * Returns true if the argument is a bug report editor input on the same bug + * id. */ @Override public boolean equals(Object o) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java index 812a1cd25..ef1965e03 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -266,7 +266,7 @@ public class TaskInfoEditor extends EditorPart { editorComposite = form.getBody(); editorComposite.setLayout(new GridLayout()); - editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); // Put the info onto the editor createContent(editorComposite, toolkit); form.setFocus(); @@ -300,7 +300,7 @@ public class TaskInfoEditor extends EditorPart { createSummarySection(parent, toolkit); createPlanningSection(parent, toolkit); createDocumentationSection(parent, toolkit); - //// createRelatedLinksSection(parent, toolkit); + // // createRelatedLinksSection(parent, toolkit); createResourcesSection(parent, toolkit); } catch (SWTException e) { MylarStatusHandler.log(e, "content failed"); @@ -309,7 +309,8 @@ public class TaskInfoEditor extends EditorPart { } private void createSummarySection(Composite parent, FormToolkit toolkit) { - Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | Section.TWISTIE); + Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | Section.DESCRIPTION + | Section.TWISTIE); section.setText(DESCRIPTION_OVERVIEW); section.setExpanded(true); if (!task.isLocal()) { @@ -336,14 +337,13 @@ public class TaskInfoEditor extends EditorPart { container.setLayout(compLayout); container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - Label l = toolkit.createLabel(container, "Description:"); l.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); - description = toolkit.createText(container, task.getDescription(), SWT.NONE); + description = toolkit.createText(container, task.getDescription(), SWT.NONE); description.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); description.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); toolkit.paintBordersFor(container); - + if (!task.isLocal()) { description.setEnabled(false); } else { @@ -409,7 +409,7 @@ public class TaskInfoEditor extends EditorPart { } }); } - + statusCombo = new Combo(statusComposite, SWT.READ_ONLY); for (TaskStatus status : Task.TaskStatus.values()) { @@ -435,7 +435,7 @@ public class TaskInfoEditor extends EditorPart { }); } statusCombo.setEnabled(false); - + } private void createDocumentationSection(Composite parent, FormToolkit toolkit) { @@ -443,7 +443,7 @@ public class TaskInfoEditor extends EditorPart { section.setText("Documentation"); section.setExpanded(true); section.setLayout(new GridLayout()); - section.setLayoutData(new GridData(GridData.FILL_BOTH)); + section.setLayoutData(new GridData(GridData.FILL_BOTH)); section.addExpansionListener(new IExpansionListener() { public void expansionStateChanging(ExpansionEvent e) { form.reflow(true); @@ -458,7 +458,7 @@ public class TaskInfoEditor extends EditorPart { container.setLayout(new GridLayout()); notes = toolkit.createText(container, task.getNotes(), SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); - + GridData notesDataLayout = new GridData(GridData.FILL_BOTH); notes.setLayoutData(notesDataLayout); notes.addModifyListener(new ModifyListener() { @@ -516,7 +516,7 @@ public class TaskInfoEditor extends EditorPart { public void widgetDefaultSelected(SelectionEvent arg0) { // ignore } - }); + }); datePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); removeReminder = toolkit.createButton(sectionClient, "Clear", SWT.PUSH | SWT.CENTER); @@ -533,8 +533,7 @@ public class TaskInfoEditor extends EditorPart { TaskInfoEditor.this.markDirty(true); } }); - - + // 3 Blank columns after Reminder clear button Label dummy = toolkit.createLabel(sectionClient, ""); GridData dummyLabelDataLayout = new GridData(GridData.FILL_HORIZONTAL); @@ -551,7 +550,7 @@ public class TaskInfoEditor extends EditorPart { estimated.setDigits(0); estimated.setMaximum(100); estimated.setMinimum(0); - estimated.setIncrement(1); + estimated.setIncrement(1); estimated.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { TaskInfoEditor.this.markDirty(true); @@ -565,7 +564,6 @@ public class TaskInfoEditor extends EditorPart { label = toolkit.createLabel(sectionClient, "hours "); label.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); - // 1 Blank column Label blankLabel2 = toolkit.createLabel(sectionClient, ""); @@ -573,7 +571,7 @@ public class TaskInfoEditor extends EditorPart { blankLabl2Layout.horizontalSpan = 1; blankLabl2Layout.widthHint = 25; blankLabel2.setLayoutData(blankLabl2Layout); - + // Creation date label = toolkit.createLabel(sectionClient, "Creation date:"); label.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); @@ -588,9 +586,8 @@ public class TaskInfoEditor extends EditorPart { Text creationDate = toolkit.createText(sectionClient, creationDateString, SWT.NONE); creationDate.setEditable(false); creationDate.setEnabled(true); -// toolkit.paintBordersFor(sectionClient); - - + // toolkit.paintBordersFor(sectionClient); + // Elapsed Time label = toolkit.createLabel(sectionClient, "Elapsed time:"); label.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); @@ -612,15 +609,15 @@ public class TaskInfoEditor extends EditorPart { td.heightHint = 18; elapsedTimeText.setLayoutData(td); elapsedTimeText.setEditable(false); - + // Refresh Button Button timeRefresh = toolkit.createButton(sectionClient, "Refresh", SWT.PUSH | SWT.CENTER); - + timeRefresh.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String elapsedTimeString = "0"; - try { + try { elapsedTimeString = DateUtil.getFormattedDuration(task.getElapsedTime(), true); if (elapsedTimeString.equals("")) { elapsedTimeString = "0"; @@ -632,14 +629,14 @@ public class TaskInfoEditor extends EditorPart { elapsedTimeText.setText(elapsedTimeString); } }); - + // 1 Blank column Label blankLabel3 = toolkit.createLabel(sectionClient, ""); GridData blankLabl3Layout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); blankLabl3Layout.horizontalSpan = 1; blankLabl3Layout.widthHint = 25; blankLabel3.setLayoutData(blankLabl2Layout); - + // Completion date label = toolkit.createLabel(sectionClient, "Completion date:"); label.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); @@ -785,5 +782,4 @@ public class TaskInfoEditor extends EditorPart { return "(info editor for task: " + task + ")"; } - } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListImages.java index d53a3ba5d..a28ebaf18 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListImages.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListImages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -31,64 +31,91 @@ import org.eclipse.swt.widgets.Display; /** * @author Mik Kersten - */ + */ public class TaskListImages { - private static ImageRegistry imageRegistry; - - public static final Color BACKGROUND_WHITE = new Color(Display.getDefault(), 255, 255, 255); - public static final Color BACKGROUND_ARCHIVE = new Color(Display.getDefault(), 190, 210, 238); - public static final Color GRAY_LIGHT = new Color(Display.getDefault(), 170, 170, 170); // TODO: use theme? - - public static final Color COLOR_TASK_COMPLETED = new Color(Display.getDefault(), 170, 170, 170); // TODO: use theme? - public static final Color COLOR_TASK_ACTIVE = new Color(Display.getDefault(), 36, 22, 50); + private static ImageRegistry imageRegistry; + + public static final Color BACKGROUND_WHITE = new Color(Display.getDefault(), 255, 255, 255); + + public static final Color BACKGROUND_ARCHIVE = new Color(Display.getDefault(), 190, 210, 238); + + public static final Color GRAY_LIGHT = new Color(Display.getDefault(), 170, 170, 170); // TODO: + // use + // theme? + + public static final Color COLOR_TASK_COMPLETED = new Color(Display.getDefault(), 170, 170, 170); // TODO: + // use + // theme? + + public static final Color COLOR_TASK_ACTIVE = new Color(Display.getDefault(), 36, 22, 50); + public static final Color COLOR_TASK_OVERDUE = new Color(Display.getDefault(), 200, 10, 30); - - public static final Font BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); - public static final Font ITALIC = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); - + + public static final Font BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); + + public static final Font ITALIC = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); + private static final String T_ELCL = "elcl16"; + private static final String T_TOOL = "etool16"; + private static final URL baseURL = MylarTaskListPlugin.getDefault().getBundle().getEntry("/icons/"); - + public static final ImageDescriptor TASKLIST = create("eview16", "task-list.gif"); - + public static final ImageDescriptor REPOSITORY = create("eview16", "task-repository.gif"); + public static final ImageDescriptor REPOSITORY_NEW = create("etool16", "task-repository-new.gif"); + public static final ImageDescriptor REPOSITORIES = create("eview16", "task-repositories.gif"); - + public static final ImageDescriptor REMOVE = create(T_ELCL, "remove.gif"); - public static final ImageDescriptor FILTER_COMPLETE = create(T_ELCL, "filter-complete.gif"); - public static final ImageDescriptor FILTER_PRIORITY = create(T_ELCL, "filter-priority.gif"); - - public static final ImageDescriptor COLOR_PALETTE = create(T_ELCL, "color-palette.gif"); - - public static final ImageDescriptor TASK2 = create(T_TOOL, "task.gif"); - public static final ImageDescriptor TASK = createWithOverlay(TASK2, null, true, false); - - public static final ImageDescriptor WEB_OVERLAY = create(T_TOOL, "overlay-web.gif"); - public static final ImageDescriptor TASK_WEB = createWithOverlay(TASK2, WEB_OVERLAY, false, true); - - public static final ImageDescriptor TASK_NEW = create(T_TOOL, "task-new.gif"); - public static final ImageDescriptor CATEGORY = create(T_TOOL, "category.gif"); - public static final ImageDescriptor CATEGORY_NEW = create(T_TOOL, "category-new.gif"); - public static final ImageDescriptor CATEGORY_ARCHIVE = create(T_TOOL, "category-archive.gif"); - - public static final ImageDescriptor NAVIGATE_PREVIOUS = create(T_TOOL, "navigate-previous.gif"); - public static final ImageDescriptor NAVIGATE_NEXT = create(T_TOOL, "navigate-next.gif"); - - public static final ImageDescriptor COPY = create(T_TOOL, "copy.png"); - public static final ImageDescriptor GO_UP = create(T_TOOL, "go-up.gif"); - public static final ImageDescriptor GO_INTO = create(T_TOOL, "go-into.gif"); - - public static final ImageDescriptor TASK_ACTIVE = create(T_TOOL, "task-active.gif"); - public static final ImageDescriptor TASK_INACTIVE = create(T_TOOL, "task-inactive.gif"); - public static final ImageDescriptor TASK_INACTIVE_CONTEXT = create(T_TOOL, "task-context.gif"); - public static final ImageDescriptor TASK_COMPLETE = create(T_TOOL, "task-complete.gif"); - public static final ImageDescriptor TASK_INCOMPLETE = create(T_TOOL, "task-incomplete.gif"); - + + public static final ImageDescriptor FILTER_COMPLETE = create(T_ELCL, "filter-complete.gif"); + + public static final ImageDescriptor FILTER_PRIORITY = create(T_ELCL, "filter-priority.gif"); + + public static final ImageDescriptor COLOR_PALETTE = create(T_ELCL, "color-palette.gif"); + + public static final ImageDescriptor TASK2 = create(T_TOOL, "task.gif"); + + public static final ImageDescriptor TASK = createWithOverlay(TASK2, null, true, false); + + public static final ImageDescriptor WEB_OVERLAY = create(T_TOOL, "overlay-web.gif"); + + public static final ImageDescriptor TASK_WEB = createWithOverlay(TASK2, WEB_OVERLAY, false, true); + + public static final ImageDescriptor TASK_NEW = create(T_TOOL, "task-new.gif"); + + public static final ImageDescriptor CATEGORY = create(T_TOOL, "category.gif"); + + public static final ImageDescriptor CATEGORY_NEW = create(T_TOOL, "category-new.gif"); + + public static final ImageDescriptor CATEGORY_ARCHIVE = create(T_TOOL, "category-archive.gif"); + + public static final ImageDescriptor NAVIGATE_PREVIOUS = create(T_TOOL, "navigate-previous.gif"); + + public static final ImageDescriptor NAVIGATE_NEXT = create(T_TOOL, "navigate-next.gif"); + + public static final ImageDescriptor COPY = create(T_TOOL, "copy.png"); + + public static final ImageDescriptor GO_UP = create(T_TOOL, "go-up.gif"); + + public static final ImageDescriptor GO_INTO = create(T_TOOL, "go-into.gif"); + + public static final ImageDescriptor TASK_ACTIVE = create(T_TOOL, "task-active.gif"); + + public static final ImageDescriptor TASK_INACTIVE = create(T_TOOL, "task-inactive.gif"); + + public static final ImageDescriptor TASK_INACTIVE_CONTEXT = create(T_TOOL, "task-context.gif"); + + public static final ImageDescriptor TASK_COMPLETE = create(T_TOOL, "task-complete.gif"); + + public static final ImageDescriptor TASK_INCOMPLETE = create(T_TOOL, "task-incomplete.gif"); + public static final ImageDescriptor COLLAPSE_ALL = create(T_ELCL, "collapseall.png"); - + private static ImageDescriptor create(String prefix, String name) { try { return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); @@ -96,68 +123,74 @@ public class TaskListImages { return ImageDescriptor.getMissingImageDescriptor(); } } - - private static ImageDescriptor createWithOverlay(ImageDescriptor base, ImageDescriptor overlay, boolean top, boolean left) { + + private static ImageDescriptor createWithOverlay(ImageDescriptor base, ImageDescriptor overlay, boolean top, + boolean left) { return new MylarTasklistOverlayDescriptor(base, overlay, top, left); } - + private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException { if (baseURL == null) throw new MalformedURLException(); - - StringBuffer buffer= new StringBuffer(prefix); + + StringBuffer buffer = new StringBuffer(prefix); buffer.append('/'); buffer.append(name); return new URL(baseURL, buffer.toString()); } - + private static ImageRegistry getImageRegistry() { if (imageRegistry == null) { imageRegistry = new ImageRegistry(); } - + return imageRegistry; } - + /** * Lazily initializes image map. */ public static Image getImage(ImageDescriptor imageDescriptor) { ImageRegistry imageRegistry = getImageRegistry(); - - Image image = imageRegistry.get(""+imageDescriptor.hashCode()); - if (image == null) { - image = imageDescriptor.createImage(); - imageRegistry.put(""+imageDescriptor.hashCode(), image); - } - return image; + + Image image = imageRegistry.get("" + imageDescriptor.hashCode()); + if (image == null) { + image = imageDescriptor.createImage(); + imageRegistry.put("" + imageDescriptor.hashCode(), image); + } + return image; } - -// /** -// * TODO: get rid of this -// */ -// public static ImageDescriptor getImageDescriptor(Image image) { -// for (ImageDescriptor imageDescriptor : imageMap.keySet()) { -// if (image.equals(imageMap.get(imageDescriptor))) return imageDescriptor; -// } -// return null; -// } - - + + // /** + // * TODO: get rid of this + // */ + // public static ImageDescriptor getImageDescriptor(Image image) { + // for (ImageDescriptor imageDescriptor : imageMap.keySet()) { + // if (image.equals(imageMap.get(imageDescriptor))) return imageDescriptor; + // } + // return null; + // } + public static class MylarTasklistOverlayDescriptor extends CompositeImageDescriptor { private ImageData base; + private ImageData overlay; + private Point fSize; + private boolean top; + private boolean left; - - public MylarTasklistOverlayDescriptor(ImageDescriptor baseDesc, ImageDescriptor overlayDesc, boolean top, boolean left) { + + public MylarTasklistOverlayDescriptor(ImageDescriptor baseDesc, ImageDescriptor overlayDesc, boolean top, + boolean left) { this.base = getImageData(baseDesc); this.top = top; this.left = left; - if(overlayDesc != null) this.overlay = getImageData(overlayDesc); - Point size = new Point(base.width, base.height); + if (overlayDesc != null) + this.overlay = getImageData(overlayDesc); + Point size = new Point(base.width, base.height); setImageSize(size); } @@ -166,38 +199,45 @@ public class TaskListImages { drawImage(base, 0, 0); int x = 0; int y = 0; - if (!left) x = 8;//base.width - overlay.width; - if (!top) y = 8;//base.height - overlay.height; + if (!left) + x = 8;// base.width - overlay.width; + if (!top) + y = 8;// base.height - overlay.height; if (overlay != null) { drawImage(overlay, x, y); } } private ImageData getImageData(ImageDescriptor descriptor) { - ImageData data= descriptor.getImageData(); // see bug 51965: getImageData can return null + ImageData data = descriptor.getImageData(); // see bug 51965: + // getImageData can + // return null if (data == null) { - data= DEFAULT_IMAGE_DATA; + data = DEFAULT_IMAGE_DATA; } return data; } - + /** - * Sets the size of the image created by calling createImage(). + * Sets the size of the image created by calling + * createImage(). * - * @param size the size of the image returned from calling createImage() + * @param size + * the size of the image returned from calling + * createImage() * @see ImageDescriptor#createImage() */ public void setImageSize(Point size) { Assert.isNotNull(size); Assert.isTrue(size.x >= 0 && size.y >= 0); - fSize= size; + fSize = size; } - + @Override protected Point getSize() { return new Point(fSize.x, fSize.y); } - + } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListPatternFilter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListPatternFilter.java index 521e55a41..cf67f74a5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListPatternFilter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListPatternFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -16,10 +16,10 @@ public class TaskListPatternFilter extends PatternFilter { @Override public void setPattern(String patternString) { - if(patternString == null || patternString.startsWith("*")) { - super.setPattern(patternString); - } else { - super.setPattern("*" + patternString); - } - } + if (patternString == null || patternString.startsWith("*")) { + super.setPattern(patternString); + } else { + super.setPattern("*" + patternString); + } + } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java index a11aaeddb..5c4be7347 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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.mylar.internal.tasklist.ui; import org.eclipse.jface.action.Action; @@ -30,7 +40,7 @@ import org.eclipse.ui.part.ViewPart; * @author Mik Kersten */ public class TaskRepositoriesView extends ViewPart { - + private static final String ID = "org.eclipse.mylar.tasklist.repositories"; private TableViewer viewer; @@ -40,14 +50,14 @@ public class TaskRepositoriesView extends ViewPart { private Action deleteRepositoryAction = new DeleteTaskRepositoryAction(this); private Action repositoryPropertiesAction = new EditRepositoryPropertiesAction(this); - + private final ITaskRepositoryListener REPOSITORY_LISTENER = new ITaskRepositoryListener() { public void repositorySetUpdated() { TaskRepositoriesView.this.getViewer().refresh(); } }; - + class ViewContentProvider implements IStructuredContentProvider { public void inputChanged(Viewer v, Object oldInput, Object newInput) { } @@ -65,22 +75,22 @@ public class TaskRepositoriesView extends ViewPart { } public static TaskRepositoriesView getFromActivePerspective() { - IWorkbenchPage activePage= Workbench.getInstance().getActiveWorkbenchWindow().getActivePage(); + IWorkbenchPage activePage = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage(); if (activePage == null) return null; - IViewPart view= activePage.findView(ID); + IViewPart view = activePage.findView(ID); if (view instanceof TaskRepositoriesView) - return (TaskRepositoriesView)view; - return null; + return (TaskRepositoriesView) view; + return null; } - + public void createPartControl(Composite parent) { viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new TaskRepositoryLabelProvider()); viewer.setSorter(new ViewerSorter()); viewer.setInput(getViewSite()); - + hookContextMenu(); contributeToActionBars(); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TasksReminderDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TasksReminderDialog.java index 3c262c18f..8042ee506 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TasksReminderDialog.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TasksReminderDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -40,30 +40,39 @@ import org.eclipse.swt.widgets.TableColumn; */ public class TasksReminderDialog extends Dialog { private List tasks = null; + private Table table = null; + private TableViewer tableViewer = null; - private String[] columnNames = new String[] { "Description", "Priority", "Reminder Day"}; - + + private String[] columnNames = new String[] { "Description", "Priority", "Reminder Day" }; + private static final int DISMISS_ALL_ID = 200; + private static final int DISMISS_ID = 201; + private static final int SNOOZE_ID = 202; + private static final String DISMISS_ALL_LABEL = "Dismiss All"; + private static final String DISMISS_LABEL = "Dismiss Selected"; + private static final String SNOOZE_ALL_LABEL = "Remind tommorrow"; + private static long DAY = 24 * 3600 * 1000; - + public TasksReminderDialog(Shell parentShell, List remTasks) { - super(parentShell); - tasks = remTasks; + super(parentShell); + tasks = remTasks; setShellStyle(SWT.CLOSE | SWT.MIN | SWT.MODELESS | SWT.BORDER | SWT.TITLE); } - + @Override protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText("Reminders"); + super.configureShell(shell); + shell.setText("Reminders"); } - + @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); @@ -72,32 +81,32 @@ public class TasksReminderDialog extends Dialog { composite.setLayout(gl); GridData data = new GridData(GridData.FILL_BOTH); composite.setLayoutData(data); - + Composite container = new Composite(composite, SWT.NONE); gl = new GridLayout(1, false); container.setLayout(gl); - createTable(container); + createTable(container); createTableViewer(); - + return composite; } - + @Override protected void createButtonsForButtonBar(Composite parent) { - createButton(parent, DISMISS_ALL_ID, DISMISS_ALL_LABEL, false); - createButton(parent, DISMISS_ID, DISMISS_LABEL, false); - createButton(parent, SNOOZE_ID, SNOOZE_ALL_LABEL, true); - } - + createButton(parent, DISMISS_ALL_ID, DISMISS_ALL_LABEL, false); + createButton(parent, DISMISS_ID, DISMISS_LABEL, false); + createButton(parent, SNOOZE_ID, SNOOZE_ALL_LABEL, true); + } + private void createTable(Composite parent) { int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; - table = new Table(parent, style ); + table = new Table(parent, style); GridLayout tlayout = new GridLayout(); table.setLayout(tlayout); GridData wd = new GridData(GridData.FILL_BOTH); wd.heightHint = 300; table.setLayoutData(wd); - + table.setLinesVisible(true); table.setHeaderVisible(true); @@ -120,8 +129,8 @@ public class TasksReminderDialog extends Dialog { public void widgetSelected(SelectionEvent e) { tableViewer.setSorter(new ReminderTaskSorter(ReminderTaskSorter.PRIORITY)); } - }); - + }); + column = new TableColumn(table, SWT.LEFT, 2); column.setText(columnNames[2]); column.setWidth(100); @@ -130,18 +139,17 @@ public class TasksReminderDialog extends Dialog { public void widgetSelected(SelectionEvent e) { tableViewer.setSorter(new ReminderTaskSorter(ReminderTaskSorter.DATE)); } - }); + }); } - + private void createTableViewer() { tableViewer = new TableViewer(table); - tableViewer.setUseHashlookup(true); + tableViewer.setUseHashlookup(true); tableViewer.setContentProvider(new ReminderTasksContentProvider()); tableViewer.setLabelProvider(new ReminderTasksLabelProvider()); tableViewer.setInput(tasks); } - - + protected void buttonPressed(int buttonId) { if (buttonId == DISMISS_ALL_ID) { for (ITask t : tasks) { @@ -149,8 +157,8 @@ public class TasksReminderDialog extends Dialog { } okPressed(); } else if (buttonId == DISMISS_ID) { - Object sel = ((IStructuredSelection)tableViewer.getSelection()).getFirstElement(); - if (sel != null && sel instanceof ITask ) { + Object sel = ((IStructuredSelection) tableViewer.getSelection()).getFirstElement(); + if (sel != null && sel instanceof ITask) { ITask t = (ITask) sel; t.setReminded(true); tasks.remove(t); @@ -158,14 +166,14 @@ public class TasksReminderDialog extends Dialog { okPressed(); } else { tableViewer.refresh(); - } + } } - } else if (buttonId == SNOOZE_ID) { - Object sel = ((IStructuredSelection)tableViewer.getSelection()).getFirstElement(); - if (sel != null && sel instanceof ITask ) { + } else if (buttonId == SNOOZE_ID) { + Object sel = ((IStructuredSelection) tableViewer.getSelection()).getFirstElement(); + if (sel != null && sel instanceof ITask) { ITask t = (ITask) sel; t.setReminded(false); - t.setReminderDate( new Date(new Date().getTime() + DAY)); + t.setReminderDate(new Date(new Date().getTime() + DAY)); tasks.remove(t); if (tasks.isEmpty()) { okPressed(); @@ -176,7 +184,7 @@ public class TasksReminderDialog extends Dialog { } super.buttonPressed(buttonId); } - + private class ReminderTasksContentProvider implements IStructuredContentProvider { public Object[] getElements(Object inputElement) { @@ -189,9 +197,8 @@ public class TasksReminderDialog extends Dialog { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } - - private static class ReminderTasksLabelProvider extends LabelProvider implements - ITableLabelProvider { + + private static class ReminderTasksLabelProvider extends LabelProvider implements ITableLabelProvider { public Image getColumnImage(Object element, int columnIndex) { return null; } @@ -216,9 +223,11 @@ public class TasksReminderDialog extends Dialog { private static class ReminderTaskSorter extends ViewerSorter { public final static int DESCRIPTION = 1; + public final static int PRIORITY = 2; - public final static int DATE = 3; - + + public final static int DATE = 3; + private int criteria; public ReminderTaskSorter(int criteria) { @@ -232,27 +241,27 @@ public class TasksReminderDialog extends Dialog { ITask t2 = (ITask) obj2; switch (criteria) { - case DESCRIPTION: - return compareDescription(t1, t2); - case PRIORITY: - return comparePriority(t1, t2); - case DATE: - return compareDate(t1, t2); - default: - return 0; + case DESCRIPTION: + return compareDescription(t1, t2); + case PRIORITY: + return comparePriority(t1, t2); + case DATE: + return compareDate(t1, t2); + default: + return 0; } } - + private int compareDescription(ITask task1, ITask task2) { return task1.getDescription().compareTo(task2.getDescription()); } - + private int comparePriority(ITask task1, ITask task2) { return task1.getPriority().compareTo(task2.getPriority()); } - + private int compareDate(ITask task1, ITask task2) { return task2.getReminderDate().compareTo(task1.getReminderDate()); - } + } } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java index ebb4352bd..936ff5070 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -27,7 +27,7 @@ import org.eclipse.ui.internal.Workbench; * @author Mik Kersten */ public class AddRepositoryAction extends Action { - + private static final String ID = "org.eclipse.mylar.tasklist.repositories.add"; public AddRepositoryAction() { @@ -35,11 +35,11 @@ public class AddRepositoryAction extends Action { setText("Add Repository"); setId(ID); } - + public void init(IViewPart view) { // ignore } - + public void run() { try { AddRepositoryWizard wizard = new AddRepositoryWizard(); @@ -47,7 +47,7 @@ public class AddRepositoryAction extends Action { if (wizard != null && shell != null && !shell.isDisposed()) { WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); -// dialog.getShell().setText("Mylar Tasks"); + // dialog.getShell().setText("Mylar Tasks"); dialog.setBlockOnOpen(true); if (dialog.open() == Dialog.CANCEL) { dialog.close(); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java index be0b9e5dd..e8a58b3ad 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -27,7 +27,7 @@ import org.eclipse.ui.internal.Workbench; * @author Mik Kersten */ public class AddRepositoryTaskAction extends Action implements IViewActionDelegate { - + private static final String WIZARD_LABEL = "Add an existing repository task/issue"; public void init(IViewPart view) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CollapseAllAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CollapseAllAction.java index cfc07c617..3cf5cfc0c 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CollapseAllAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CollapseAllAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -19,23 +19,24 @@ import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView; * @author Mik Kersten */ public class CollapseAllAction extends Action { - + private static final String LABEL = "Collapse All"; public static final String ID = "org.eclipse.mylar.tasklist.actions.collapse.all"; - + private TaskListView taskListView; - + public CollapseAllAction(TaskListView taskListView) { - super(LABEL); + super(LABEL); this.taskListView = taskListView; setId(ID); setText(LABEL); setToolTipText(LABEL); setImageDescriptor(TaskListImages.COLLAPSE_ALL); } - - public void run() { - if (taskListView.getViewer() != null) taskListView.getViewer().collapseAll(); + + public void run() { + if (taskListView.getViewer() != null) + taskListView.getViewer().collapseAll(); } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CopyDescriptionAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CopyDescriptionAction.java index 0ae787a8a..f52f35998 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CopyDescriptionAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/CopyDescriptionAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -24,9 +24,9 @@ public class CopyDescriptionAction extends Action { private static final String DESCRIPTION_PREFIX = "Bugzilla Bug "; public static final String ID = "org.eclipse.mylar.tasklist.actions.copy"; - + private TaskListView view; - + public CopyDescriptionAction(TaskListView view) { this.view = view; setText("Copy Description"); @@ -38,18 +38,18 @@ public class CopyDescriptionAction extends Action { @Override public void run() { - ISelection selection = this.view.getViewer().getSelection(); - Object obj = ((IStructuredSelection)selection).getFirstElement(); - if (obj instanceof ITaskListElement) { - ITaskListElement element = (ITaskListElement)obj; - String description = DESCRIPTION_PREFIX + element.getDescription(); - - // HACK: this should be done using proper copying - StyledText styledText = new StyledText(view.getDummyComposite(), SWT.NULL); - styledText.setText(description); - styledText.selectAll(); - styledText.copy(); - styledText.dispose(); - } + ISelection selection = this.view.getViewer().getSelection(); + Object obj = ((IStructuredSelection) selection).getFirstElement(); + if (obj instanceof ITaskListElement) { + ITaskListElement element = (ITaskListElement) obj; + String description = DESCRIPTION_PREFIX + element.getDescription(); + + // HACK: this should be done using proper copying + StyledText styledText = new StyledText(view.getDummyComposite(), SWT.NULL); + styledText.setText(description); + styledText.selectAll(); + styledText.copy(); + styledText.dispose(); + } } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java index cf0f7d67f..c2a6f900a 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -40,7 +40,7 @@ public class DeleteAction extends Action { public DeleteAction(TaskListView view) { this.view = view; setText("Delete"); - setId(ID); + setId(ID); setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); } @@ -51,7 +51,7 @@ public class DeleteAction extends Action { if (selectedObject instanceof ITask || selectedObject instanceof IQueryHit) { ITask task = null; if (selectedObject instanceof IQueryHit) { - task = ((IQueryHit)selectedObject).getCorrespondingTask(); + task = ((IQueryHit) selectedObject).getCorrespondingTask(); } else { task = (ITask) selectedObject; } @@ -91,7 +91,7 @@ public class DeleteAction extends Action { boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow() .getShell(), "Confirm delete", "Delete the selected query? Task data will not be deleted."); if (deleteConfirmed) { - MylarTaskListPlugin.getTaskListManager().deleteQuery((IRepositoryQuery)selectedObject); + MylarTaskListPlugin.getTaskListManager().deleteQuery((IRepositoryQuery) selectedObject); } } else if (selectedObject instanceof TaskCategory) { boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow() @@ -123,7 +123,6 @@ public class DeleteAction extends Action { } public static String genDeleteConfirmationMessage(ITask task) { - return "Delete the selected task and discard task context?\n\n" - + task.getDescription(); + return "Delete the selected task and discard task context?\n\n" + task.getDescription(); } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java index ff9bdc680..9ef0c7cd7 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -33,27 +33,27 @@ public class DeleteTaskRepositoryAction extends Action { private static final String ID = "org.eclipse.mylar.tasklist.repositories.delete"; private TaskRepositoriesView repositoriesView; - + public DeleteTaskRepositoryAction(TaskRepositoriesView repositoriesView) { this.repositoriesView = repositoriesView; setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); setText("Delete Repository"); setId(ID); } - + public void init(IViewPart view) { // ignore } - + public void run() { try { boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow() .getShell(), "Confirm Delete", "Delete the selected task repositories?"); if (deleteConfirmed) { - IStructuredSelection selection = (IStructuredSelection)repositoriesView.getViewer().getSelection(); - for (Object selectedObject: selection.toList()) { + IStructuredSelection selection = (IStructuredSelection) repositoriesView.getViewer().getSelection(); + for (Object selectedObject : selection.toList()) { if (selectedObject instanceof TaskRepository) { - MylarTaskListPlugin.getRepositoryManager().removeRepository((TaskRepository)selectedObject); + MylarTaskListPlugin.getRepositoryManager().removeRepository((TaskRepository) selectedObject); } } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java index 3416dd30b..ae15e6042 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -33,27 +33,27 @@ public class EditRepositoryPropertiesAction extends Action { private static final String ID = "org.eclipse.mylar.tasklist.repositories.properties"; private TaskRepositoriesView repositoriesView; - + public EditRepositoryPropertiesAction(TaskRepositoriesView repositoriesView) { this.repositoriesView = repositoriesView; setText("Properties"); setId(ID); } - + public void init(IViewPart view) { // ignore } - + public void run() { try { - IStructuredSelection selection = (IStructuredSelection)repositoriesView.getViewer().getSelection(); + IStructuredSelection selection = (IStructuredSelection) repositoriesView.getViewer().getSelection(); if (selection.getFirstElement() instanceof TaskRepository) { - EditRepositoryWizard wizard = new EditRepositoryWizard((TaskRepository)selection.getFirstElement()); + EditRepositoryWizard wizard = new EditRepositoryWizard((TaskRepository) selection.getFirstElement()); Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell(); if (wizard != null && shell != null && !shell.isDisposed()) { WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); -// dialog.getShell().setText("Mylar Tasks"); + // dialog.getShell().setText("Mylar Tasks"); dialog.setBlockOnOpen(true); if (dialog.open() == Dialog.CANCEL) { dialog.close(); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/FilterCompletedTasksAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/FilterCompletedTasksAction.java index c53fd6f82..be17daeda 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/FilterCompletedTasksAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/FilterCompletedTasksAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -22,26 +22,26 @@ import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView; public class FilterCompletedTasksAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.filter.completed"; - + private final TaskListView view; - + public FilterCompletedTasksAction(TaskListView view) { this.view = view; setText("Filter Completed Tasks"); - setToolTipText("Filter Completed Tasks"); - setId(ID); - setImageDescriptor(TaskListImages.FILTER_COMPLETE); - setChecked(MylarTaskListPlugin.getDefault().isFilterCompleteMode()); + setToolTipText("Filter Completed Tasks"); + setId(ID); + setImageDescriptor(TaskListImages.FILTER_COMPLETE); + setChecked(MylarTaskListPlugin.getDefault().isFilterCompleteMode()); } - + @Override public void run() { MylarTaskListPlugin.getDefault().setFilterCompleteMode(isChecked()); if (isChecked()) { view.addFilter(view.getCompleteFilter()); } else { - view.removeFilter(view.getCompleteFilter()); + view.removeFilter(view.getCompleteFilter()); } - this.view.getViewer().refresh(); + this.view.getViewer().refresh(); } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoIntoAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoIntoAction.java index b9a673b88..c2e5135e2 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoIntoAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoIntoAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -25,9 +25,10 @@ import org.eclipse.ui.IViewPart; public class GoIntoAction extends Action implements IViewActionDelegate { public static final String ID = "org.eclipse.mylar.tasklist.actions.view.go.into"; -// -// private DrillDownAdapter drillDownAdapter; -// + + // + // private DrillDownAdapter drillDownAdapter; + // public GoIntoAction() { setId(ID); setText("Go Into Category"); @@ -37,11 +38,11 @@ public class GoIntoAction extends Action implements IViewActionDelegate { public void init(IViewPart view) { // TODO Auto-generated method stub - + } public void run() { - if(TaskListView.getDefault() != null) { + if (TaskListView.getDefault() != null) { TaskListView.getDefault().goIntoCategory(); } } @@ -49,9 +50,9 @@ public class GoIntoAction extends Action implements IViewActionDelegate { public void run(IAction action) { run(); } - + public void selectionChanged(IAction action, ISelection selection) { // TODO Auto-generated method stub - + } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoUpAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoUpAction.java index fc1f696a6..74a7e5c0a 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoUpAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/GoUpAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -18,7 +18,7 @@ import org.eclipse.ui.part.DrillDownAdapter; public class GoUpAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.view.go.up"; - + public GoUpAction(DrillDownAdapter drillDownAdapter) { setText("Go Up To Root"); setToolTipText("Go Up To Root"); @@ -28,7 +28,7 @@ public class GoUpAction extends Action { @Override public void run() { - if(TaskListView.getDefault() != null) { + if (TaskListView.getDefault() != null) { TaskListView.getDefault().goUpToRoot(); } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/ManageEditorsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/ManageEditorsAction.java index 318d23a90..1c840c8a3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/ManageEditorsAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/ManageEditorsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -24,35 +24,33 @@ import org.eclipse.ui.internal.WorkbenchPlugin; public class ManageEditorsAction extends Action { public static final String ID = "org.eclipse.mylar.ui.editors.auto.manage"; - + public ManageEditorsAction() { super("Manage Editors with Context", IAction.AS_CHECK_BOX); setId(ID); update(MylarTaskListPlugin.getPrefs().getBoolean(MylarTaskListPrefConstants.AUTO_MANAGE_EDITORS)); } - + @Override public void run() { update(isChecked()); - } - - public void update(boolean on) { - setChecked(on); - MylarTaskListPlugin.getPrefs().setValue(MylarTaskListPrefConstants.AUTO_MANAGE_EDITORS, on); - - if (on) { - boolean previousValue = WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN); - MylarTaskListPlugin.getPrefs().setValue( - IPreferenceConstants.REUSE_EDITORS_BOOLEAN, - previousValue); - WorkbenchPlugin.getDefault().getPreferenceStore().setValue( - IPreferenceConstants.REUSE_EDITORS_BOOLEAN, + } + + public void update(boolean on) { + setChecked(on); + MylarTaskListPlugin.getPrefs().setValue(MylarTaskListPrefConstants.AUTO_MANAGE_EDITORS, on); + + if (on) { + boolean previousValue = WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean( + IPreferenceConstants.REUSE_EDITORS_BOOLEAN); + MylarTaskListPlugin.getPrefs().setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, previousValue); + WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, false); } else { - boolean previousValue = MylarTaskListPlugin.getPrefs().getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN); - WorkbenchPlugin.getDefault().getPreferenceStore().setValue( - IPreferenceConstants.REUSE_EDITORS_BOOLEAN, - previousValue); - } + boolean previousValue = MylarTaskListPlugin.getPrefs().getBoolean( + IPreferenceConstants.REUSE_EDITORS_BOOLEAN); + WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, + previousValue); + } } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskCompleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskCompleteAction.java index 90ebd0e9b..7a1d798c5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskCompleteAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskCompleteAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -37,10 +37,10 @@ public class MarkTaskCompleteAction extends Action { @Override public void run() { - for (Object selectedObject : ((IStructuredSelection)this.view.getViewer().getSelection()).toList()) { + for (Object selectedObject : ((IStructuredSelection) this.view.getViewer().getSelection()).toList()) { if (selectedObject instanceof ITask) { - MylarTaskListPlugin.getTaskListManager().markComplete(((ITask)selectedObject), true); + MylarTaskListPlugin.getTaskListManager().markComplete(((ITask) selectedObject), true); } } } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskIncompleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskIncompleteAction.java index f414bac7f..8f323790f 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskIncompleteAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MarkTaskIncompleteAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -37,10 +37,10 @@ public class MarkTaskIncompleteAction extends Action { @Override public void run() { - for (Object selectedObject : ((IStructuredSelection)this.view.getViewer().getSelection()).toList()) { + for (Object selectedObject : ((IStructuredSelection) this.view.getViewer().getSelection()).toList()) { if (selectedObject instanceof ITask) { - MylarTaskListPlugin.getTaskListManager().markComplete(((ITask)selectedObject), false); + MylarTaskListPlugin.getTaskListManager().markComplete(((ITask) selectedObject), false); } } } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MoveTaskToRootAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MoveTaskToRootAction.java index 6ae86fc58..70b95c198 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MoveTaskToRootAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/MoveTaskToRootAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -20,34 +20,35 @@ import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView; public class MoveTaskToRootAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.move.toroot"; - -// private final TaskListView view; + + // private final TaskListView view; public MoveTaskToRootAction(TaskListView view) { -// this.view = view; + // this.view = view; setText("Move Task to Root"); - setToolTipText("Move Task to Root"); - setId(ID); + setToolTipText("Move Task to Root"); + setId(ID); } + @Override public void run() { throw new RuntimeException("unimplemented"); -// ISelection selection = this.view.getViewer().getSelection(); -// Object obj = ((IStructuredSelection)selection).getFirstElement(); -// if (obj instanceof ITask) { -// ITask t = (ITask) obj; -// TaskCategory cat = t.getCategory(); -// if (cat != null) { -// cat.removeTask(t); -// t.setCategory(null); -// t.setParent(null); -// MylarTaskListPlugin.getTaskListManager().getTaskList().addRootTask(t); -// this.view.getViewer().refresh(); -// } else if (t.getParent() != null) { -// t.getParent().removeSubTask(t); -// t.setParent(null); -// MylarTaskListPlugin.getTaskListManager().getTaskList().addRootTask(t); -// this.view.getViewer().refresh(); -// } -// } + // ISelection selection = this.view.getViewer().getSelection(); + // Object obj = ((IStructuredSelection)selection).getFirstElement(); + // if (obj instanceof ITask) { + // ITask t = (ITask) obj; + // TaskCategory cat = t.getCategory(); + // if (cat != null) { + // cat.removeTask(t); + // t.setCategory(null); + // t.setParent(null); + // MylarTaskListPlugin.getTaskListManager().getTaskList().addRootTask(t); + // this.view.getViewer().refresh(); + // } else if (t.getParent() != null) { + // t.getParent().removeSubTask(t); + // t.setParent(null); + // MylarTaskListPlugin.getTaskListManager().getTaskList().addRootTask(t); + // this.view.getViewer().refresh(); + // } + // } } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java index 58bef132a..245a834d9 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -23,33 +23,29 @@ import org.eclipse.ui.internal.Workbench; /** * @author Mik Kersten and Ken Sueda */ -public class NewCategoryAction extends Action { +public class NewCategoryAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.create.category"; - + private final TaskListView view; public NewCategoryAction(TaskListView view) { - this.view = view; + this.view = view; setText("Add Category"); - setToolTipText("Add Category"); - setId(ID); - setImageDescriptor(TaskListImages.CATEGORY_NEW); - } - - @Override - public void run() { - InputDialog dialog = new InputDialog( - Workbench.getInstance().getActiveWorkbenchWindow().getShell(), - "Enter name", - "Enter a name for the Category: ", - "", - null); - int dialogResult = dialog.open(); - if (dialogResult == Window.OK) { - TaskCategory cat = new TaskCategory(dialog.getValue()); - MylarTaskListPlugin.getTaskListManager().addCategory(cat); - this.view.getViewer().refresh(); - } - } -} \ No newline at end of file + setToolTipText("Add Category"); + setId(ID); + setImageDescriptor(TaskListImages.CATEGORY_NEW); + } + + @Override + public void run() { + InputDialog dialog = new InputDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), + "Enter name", "Enter a name for the Category: ", "", null); + int dialogResult = dialog.open(); + if (dialogResult == Window.OK) { + TaskCategory cat = new TaskCategory(dialog.getValue()); + MylarTaskListPlugin.getTaskListManager().addCategory(cat); + this.view.getViewer().refresh(); + } + } +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java index 6d7c268ba..cd7b31e81 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -30,50 +30,51 @@ import org.eclipse.ui.internal.Workbench; public class NewLocalTaskAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.create.task"; - + private final TaskListView view; public NewLocalTaskAction(TaskListView view) { this.view = view; setText("Add Task"); - setToolTipText("Add Task"); - setId(ID); - setImageDescriptor(TaskListImages.TASK_NEW); + setToolTipText("Add Task"); + setId(ID); + setImageDescriptor(TaskListImages.TASK_NEW); } - - @Override - public void run() { - TaskInputDialog dialog = new TaskInputDialog(Workbench.getInstance() - .getActiveWorkbenchWindow().getShell()); + + @Override + public void run() { + TaskInputDialog dialog = new TaskInputDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell()); int dialogResult = dialog.open(); if (dialogResult == Window.OK) { - Task newTask = new Task(MylarTaskListPlugin.getTaskListManager() - .genUniqueTaskHandle(), dialog.getTaskname(), true); + Task newTask = new Task(MylarTaskListPlugin.getTaskListManager().genUniqueTaskHandle(), dialog + .getTaskname(), true); newTask.setPriority(dialog.getSelectedPriority()); newTask.setReminderDate(dialog.getReminderDate()); newTask.setUrl(dialog.getIssueURL()); - - Object selectedObject = ((IStructuredSelection)view.getViewer().getSelection()).getFirstElement(); - + + Object selectedObject = ((IStructuredSelection) view.getViewer().getSelection()).getFirstElement(); + if (selectedObject instanceof TaskCategory) { - MylarTaskListPlugin.getTaskListManager().moveToCategory((TaskCategory)selectedObject, newTask); + MylarTaskListPlugin.getTaskListManager().moveToCategory((TaskCategory) selectedObject, newTask); } else if (selectedObject instanceof ITask) { - ITask task = (ITask)selectedObject; + ITask task = (ITask) selectedObject; if (task.getCategory() != null) { - MylarTaskListPlugin.getTaskListManager().moveToCategory((TaskCategory)task.getCategory(), newTask); + MylarTaskListPlugin.getTaskListManager().moveToCategory((TaskCategory) task.getCategory(), newTask); } else if (view.getDrilledIntoCategory() != null) { - MylarTaskListPlugin.getTaskListManager().moveToCategory((TaskCategory)view.getDrilledIntoCategory(), newTask); - } else { - MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask); - } + MylarTaskListPlugin.getTaskListManager().moveToCategory( + (TaskCategory) view.getDrilledIntoCategory(), newTask); + } else { + MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask); + } } else if (view.getDrilledIntoCategory() != null) { - MylarTaskListPlugin.getTaskListManager().moveToCategory((TaskCategory)view.getDrilledIntoCategory(), newTask); - } else { - MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask); - } + MylarTaskListPlugin.getTaskListManager().moveToCategory((TaskCategory) view.getDrilledIntoCategory(), + newTask); + } else { + MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask); + } newTask.openTaskInEditor(false); view.getViewer().setSelection(new StructuredSelection(newTask)); view.getViewer().refresh(); } - } -} \ No newline at end of file + } +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java index d925d14d4..81a049ef6 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -27,7 +27,7 @@ import org.eclipse.ui.internal.Workbench; * @author Mik Kersten */ public class NewQueryAction extends Action implements IViewActionDelegate { - + private static final String WIZARD_LABEL = "Add or modify repository query"; public void init(IViewPart view) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NextTaskDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NextTaskDropDownAction.java index 4398d5047..f3ebd9d38 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NextTaskDropDownAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NextTaskDropDownAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -25,35 +25,35 @@ import org.eclipse.mylar.tasklist.ITask; public class NextTaskDropDownAction extends TaskNavigateDropDownAction { public static final String ID = "org.eclipse.mylar.tasklist.actions.navigate.next"; - public NextTaskDropDownAction(TaskListView view, TaskActivationHistory history){ - super(view, history); + public NextTaskDropDownAction(TaskListView view, TaskActivationHistory history) { + super(view, history); setText("Next Task"); - setToolTipText("Next Task"); - setId(ID); - setEnabled(false); - setImageDescriptor(TaskListImages.NAVIGATE_NEXT); + setToolTipText("Next Task"); + setId(ID); + setEnabled(false); + setImageDescriptor(TaskListImages.NAVIGATE_NEXT); } - - protected void addActionsToMenu(){ + + protected void addActionsToMenu() { List tasks = taskHistory.getNextTasks(); - - if(tasks.size() > MAX_ITEMS_TO_DISPLAY){ + + if (tasks.size() > MAX_ITEMS_TO_DISPLAY) { tasks = tasks.subList(0, MAX_ITEMS_TO_DISPLAY); } - - for(int i = 0; i < tasks.size(); i++){ + + for (int i = 0; i < tasks.size(); i++) { ITask currTask = tasks.get(i); Action taskNavAction = new TaskNavigateAction(currTask); ActionContributionItem item = new ActionContributionItem(taskNavAction); item.fill(dropDownMenu, -1); } } - - public void run() { - if (taskHistory.hasNext()) { + + public void run() { + if (taskHistory.hasNext()) { new TaskActivateAction().run(taskHistory.getNextTask()); setButtonStatus(); - view.getViewer().refresh(); - } + view.getViewer().refresh(); + } } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java index 9b8ddb5ac..c22529b6d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -27,7 +27,7 @@ import org.eclipse.mylar.tasklist.ITaskHandler; public class OpenTaskEditorAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.open"; - + private final TaskListView view; /** @@ -42,21 +42,21 @@ public class OpenTaskEditorAction extends Action { @Override public void run() { - ISelection selection = this.view.getViewer().getSelection(); - Object obj = ((IStructuredSelection)selection).getFirstElement(); - if (obj instanceof ITaskListElement) { - ITaskListElement element = (ITaskListElement)obj; - ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(element); - if(taskHandler != null){ - taskHandler.itemOpened(element); - } else{ - if(element instanceof Task){ - ((Task)element).openTaskInEditor(false); - } else if (element instanceof TaskCategory) { - ((TaskCategory)element).openCategoryInEditor(false); - } - } - } - this.view.getViewer().refresh(obj); + ISelection selection = this.view.getViewer().getSelection(); + Object obj = ((IStructuredSelection) selection).getFirstElement(); + if (obj instanceof ITaskListElement) { + ITaskListElement element = (ITaskListElement) obj; + ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(element); + if (taskHandler != null) { + taskHandler.itemOpened(element); + } else { + if (element instanceof Task) { + ((Task) element).openTaskInEditor(false); + } else if (element instanceof TaskCategory) { + ((TaskCategory) element).openCategoryInEditor(false); + } + } + } + this.view.getViewer().refresh(obj); } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskInExternalBrowserAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskInExternalBrowserAction.java index 8763dd08e..cc80e368b 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskInExternalBrowserAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskInExternalBrowserAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -32,7 +32,7 @@ public class OpenTaskInExternalBrowserAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.open.external"; public OpenTaskInExternalBrowserAction() { - setText("Open in External Browser"); + setText("Open in External Browser"); setToolTipText("Open in External Browser"); setId(ID); } @@ -52,7 +52,7 @@ public class OpenTaskInExternalBrowserAction extends Action { String urlString = task.getUrl(); if (task.hasValidUrl()) { URL url; - try { + try { url = new URL(urlString); IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport(); support.getExternalBrowser().openURL(url); @@ -63,4 +63,4 @@ public class OpenTaskInExternalBrowserAction extends Action { } } } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/PreviousTaskDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/PreviousTaskDropDownAction.java index c59c9cec5..7603758ae 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/PreviousTaskDropDownAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/PreviousTaskDropDownAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -25,36 +25,36 @@ import org.eclipse.mylar.tasklist.ITask; public class PreviousTaskDropDownAction extends TaskNavigateDropDownAction { public static final String ID = "org.eclipse.mylar.tasklist.actions.navigate.previous"; - public PreviousTaskDropDownAction(TaskListView view, TaskActivationHistory history){ - super(view, history); + public PreviousTaskDropDownAction(TaskListView view, TaskActivationHistory history) { + super(view, history); setText("Previous Task"); - setToolTipText("Previous Task"); - setId(ID); - setEnabled(true); - setImageDescriptor(TaskListImages.NAVIGATE_PREVIOUS); + setToolTipText("Previous Task"); + setId(ID); + setEnabled(true); + setImageDescriptor(TaskListImages.NAVIGATE_PREVIOUS); } - - protected void addActionsToMenu(){ + + protected void addActionsToMenu() { List tasks = taskHistory.getPreviousTasks(); - - if(tasks.size() > MAX_ITEMS_TO_DISPLAY){ + + if (tasks.size() > MAX_ITEMS_TO_DISPLAY) { tasks = tasks.subList(tasks.size() - MAX_ITEMS_TO_DISPLAY, tasks.size()); } - - for(int i = tasks.size() - 1; i >= 0; i--){ + + for (int i = tasks.size() - 1; i >= 0; i--) { ITask currTask = tasks.get(i); Action taskNavAction = new TaskNavigateAction(currTask); - ActionContributionItem item= new ActionContributionItem(taskNavAction); + ActionContributionItem item = new ActionContributionItem(taskNavAction); item.fill(dropDownMenu, -1); } } - - public void run() { + + public void run() { if (taskHistory.hasPrevious()) { new TaskActivateAction().run(taskHistory.getPreviousTask()); setButtonStatus(); - view.getViewer().refresh(); - } + view.getViewer().refresh(); + } } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java index 6b75463b4..a0d1505a6 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -50,7 +50,8 @@ public class RemoveFromCategoryAction extends Action { ITask task = (ITask) selectedObject; if (task.isActive()) { MessageDialog.openInformation(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), - MylarTaskListPlugin.TITLE_DIALOG, "Task must be deactivated in order to remove from category."); + MylarTaskListPlugin.TITLE_DIALOG, + "Task must be deactivated in order to remove from category."); return; } @@ -70,7 +71,7 @@ public class RemoveFromCategoryAction extends Action { return; MylarTaskListPlugin.getTaskListManager().deleteTask(task); - MylarPlugin.getContextManager().contextDeleted(task.getHandleIdentifier()); // task.getContextPath()); + MylarPlugin.getContextManager().contextDeleted(task.getHandleIdentifier()); // task.getContextPath()); } } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RenameAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RenameAction.java index 458c54543..1339dec75 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RenameAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RenameAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -19,9 +19,9 @@ import org.eclipse.swt.SWT; public class RenameAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.rename"; - + private TaskListView view; - + public RenameAction(TaskListView view) { this.view = view; setText("Rename"); @@ -31,10 +31,9 @@ public class RenameAction extends Action { @Override public void run() { - Object selectedObject = ((IStructuredSelection) this.view - .getViewer().getSelection()).getFirstElement(); - if(selectedObject instanceof ITaskListElement){ - ITaskListElement element = (ITaskListElement)selectedObject; + Object selectedObject = ((IStructuredSelection) this.view.getViewer().getSelection()).getFirstElement(); + if (selectedObject instanceof ITaskListElement) { + ITaskListElement element = (ITaskListElement) selectedObject; view.setInRenameAction(true); view.getViewer().editElement(element, 3); view.setInRenameAction(false); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskActivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskActivateAction.java index 837ab3574..102cc2418 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskActivateAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskActivateAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -26,27 +26,27 @@ import org.eclipse.ui.IViewPart; * @author Mik Kersten and Ken Sueda */ public class TaskActivateAction extends Action implements IViewActionDelegate { - + public static final String ID = "org.eclipse.mylar.tasklist.actions.context.activate"; - + public ITask task = null; - + public TaskActivateAction() { setId(ID); setText("Activate"); setImageDescriptor(TaskListImages.TASK_ACTIVE); } - + public void init(IViewPart view) { // TODO Auto-generated method stub - + } - public void run() { + public void run() { MylarPlugin.getContextManager().actionObserved(this, Boolean.TRUE.toString()); run(TaskListView.getDefault().getSelectedTask()); } - + public void run(ITask task) { if (task != null) { MylarTaskListPlugin.getTaskListManager().activateTask(task); @@ -55,13 +55,13 @@ public class TaskActivateAction extends Action implements IViewActionDelegate { } } } - + public void run(IAction action) { run(); } public void selectionChanged(IAction action, ISelection selection) { // TODO Auto-generated method stub - + } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java index 10ea18f52..b4d8dccb0 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -24,19 +24,21 @@ import org.eclipse.ui.IWorkbenchPage; * @author Mik Kersten */ public class TaskDeactivateAction extends Action { - + public static final String ID = "org.eclipse.mylar.tasklist.actions.context.deactivate"; - + public TaskDeactivateAction() { setId(ID); setText("Deactivate"); setImageDescriptor(TaskListImages.TASK_INACTIVE); } - + public void run(ITask task) { MylarPlugin.getContextManager().actionObserved(this, Boolean.FALSE.toString()); - IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page == null) return; + IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow() + .getActivePage(); + if (page == null) + return; try { if (task != null) { MylarTaskListPlugin.getTaskListManager().deactivateTask(task); @@ -45,10 +47,10 @@ public class TaskDeactivateAction extends Action { } } catch (Exception e) { MylarStatusHandler.log(e, " Closing task editor on task deactivation failed"); - } + } } - + public void run() { run(TaskListView.getDefault().getSelectedTask()); } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskNavigateDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskNavigateDropDownAction.java index 65f07cb8a..bd6097472 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskNavigateDropDownAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskNavigateDropDownAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -72,7 +72,7 @@ public abstract class TaskNavigateDropDownAction extends Action implements IMenu public void run() { new TaskActivateAction().run(targetTask); - taskHistory.navigatedToTask(targetTask); + taskHistory.navigatedToTask(targetTask); setButtonStatus(); view.getViewer().refresh(); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/WorkOfflineAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/WorkOfflineAction.java index 43d679113..26322e642 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/WorkOfflineAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/WorkOfflineAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -17,14 +17,14 @@ import org.eclipse.mylar.internal.tasklist.MylarTaskListPrefConstants; public class WorkOfflineAction extends Action { public static final String ID = "org.eclipse.mylar.tasklist.actions.work.offline"; - + public WorkOfflineAction() { setId(ID); setText("Work Offline"); setToolTipText("Work Offline"); setChecked(MylarTaskListPlugin.getPrefs().getBoolean(MylarTaskListPrefConstants.WORK_OFFLINE)); } - + @Override public void run() { boolean on = !MylarTaskListPlugin.getPrefs().getBoolean(MylarTaskListPrefConstants.WORK_OFFLINE); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java index b83f3a23a..20e076a1b 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -77,9 +77,10 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork container.setLayoutData(gridData); GridLayout gl = new GridLayout(1, false); container.setLayout(gl); - // closeEditors = new Button(container, SWT.CHECK); - // closeEditors.setText("Close all editors on task deactivation (defaults to close only editors of interesting resources)"); - // closeEditors.setSelection(getPreferenceStore().getBoolean(MylarPlugin.AUTO_MANAGE_EDITORS)); + // closeEditors = new Button(container, SWT.CHECK); + // closeEditors.setText("Close all editors on task deactivation + // (defaults to close only editors of interesting resources)"); + // closeEditors.setSelection(getPreferenceStore().getBoolean(MylarPlugin.AUTO_MANAGE_EDITORS)); multipleActive = new Button(container, SWT.CHECK); multipleActive.setText("Enable multiple task contexts to be active"); @@ -98,10 +99,10 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork reportInternal = new Button(container, SWT.RADIO); reportInternal.setText("Internal browser"); reportInternal.setSelection(getPreferenceStore().getBoolean(MylarTaskListPrefConstants.REPORT_OPEN_INTERNAL)); - // reportExternal = new Button(container, SWT.RADIO); - // reportExternal.setText("External browser"); - // reportExternal.setSelection(getPreferenceStore().getBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL)); - // reportExternal.setEnabled(false); + // reportExternal = new Button(container, SWT.RADIO); + // reportExternal.setText("External browser"); + // reportExternal.setSelection(getPreferenceStore().getBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL)); + // reportExternal.setEnabled(false); } @Override @@ -109,51 +110,59 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork String taskDirectory = taskDirectoryText.getText(); taskDirectory = taskDirectory.replaceAll("\\\\", "/"); if (!taskDirectory.equals(MylarPlugin.getDefault().getDataDirectory())) { - //Order matters: + // Order matters: MylarTaskListPlugin.getDefault().getTaskListSaveManager().saveTaskListAndContexts(); if (copyExistingDataCheckbox.getSelection()) { MylarTaskListPlugin.getDefault().getTaskListSaveManager().copyDataDirContentsTo(taskDirectory); } MylarPlugin.getDefault().setDataDirectory(taskDirectory); -// getPreferenceStore().setValue(MylarPlugin.PREF_DATA_DIR, taskDirectory); -// MylarTaskListPlugin.getDefault().setDataDirectory(MylarPlugin.getDefault().getDataDirectory()); + // getPreferenceStore().setValue(MylarPlugin.PREF_DATA_DIR, + // taskDirectory); + // MylarTaskListPlugin.getDefault().setDataDirectory(MylarPlugin.getDefault().getDataDirectory()); } - getPreferenceStore().setValue(MylarTaskListPrefConstants.COPY_TASK_DATA, copyExistingDataCheckbox.getSelection()); + getPreferenceStore().setValue(MylarTaskListPrefConstants.COPY_TASK_DATA, + copyExistingDataCheckbox.getSelection()); getPreferenceStore().setValue(MylarTaskListPrefConstants.REPORT_OPEN_EDITOR, reportEditor.getSelection()); getPreferenceStore().setValue(MylarTaskListPrefConstants.REPORT_OPEN_INTERNAL, reportInternal.getSelection()); - // getPreferenceStore().setValue(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL, reportExternal.getSelection()); + // getPreferenceStore().setValue(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL, + // reportExternal.getSelection()); getPreferenceStore().setValue(MylarTaskListPrefConstants.DEFAULT_URL_PREFIX, taskURLPrefixText.getText()); getPreferenceStore().setValue(MylarTaskListPrefConstants.MULTIPLE_ACTIVE_TASKS, multipleActive.getSelection()); - + return true; } @Override public boolean performCancel() { - // closeEditors.setSelection(getPreferenceStore().getBoolean(MylarPlugin.AUTO_MANAGE_EDITORS)); + // closeEditors.setSelection(getPreferenceStore().getBoolean(MylarPlugin.AUTO_MANAGE_EDITORS)); reportEditor.setSelection(getPreferenceStore().getBoolean(MylarTaskListPrefConstants.REPORT_OPEN_EDITOR)); reportInternal.setSelection(getPreferenceStore().getBoolean(MylarTaskListPrefConstants.REPORT_OPEN_INTERNAL)); - // reportExternal.setSelection(getPreferenceStore().getBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL)); + // reportExternal.setSelection(getPreferenceStore().getBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL)); multipleActive.setSelection(getPreferenceStore().getBoolean(MylarTaskListPrefConstants.MULTIPLE_ACTIVE_TASKS)); - // saveCombo.setText(getPreferenceStore().getString(MylarTaskListPlugin.SAVE_TASKLIST_MODE)); + // saveCombo.setText(getPreferenceStore().getString(MylarTaskListPlugin.SAVE_TASKLIST_MODE)); return true; } public void performDefaults() { super.performDefaults(); copyExistingDataCheckbox.setSelection(true); -// IPath rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); -// String taskDirectory = rootPath.toString() + "/" + MylarPlugin.DATA_DIR_NAME; + // IPath rootPath = + // ResourcesPlugin.getWorkspace().getRoot().getLocation(); + // String taskDirectory = rootPath.toString() + "/" + + // MylarPlugin.DATA_DIR_NAME; taskDirectoryText.setText(MylarPlugin.getDefault().getDefaultDataDirectory()); -// copyExistingDataCheckbox.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPlugin.COPY_TASK_DATA)); - reportEditor.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPrefConstants.REPORT_OPEN_EDITOR)); - reportInternal.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPrefConstants.REPORT_OPEN_INTERNAL)); - // reportExternal.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL)); + // copyExistingDataCheckbox.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPlugin.COPY_TASK_DATA)); + reportEditor + .setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPrefConstants.REPORT_OPEN_EDITOR)); + reportInternal.setSelection(getPreferenceStore().getDefaultBoolean( + MylarTaskListPrefConstants.REPORT_OPEN_INTERNAL)); + // reportExternal.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPlugin.REPORT_OPEN_EXTERNAL)); taskURLPrefixText.setText(getPreferenceStore().getDefaultString(MylarTaskListPrefConstants.DEFAULT_URL_PREFIX)); - - multipleActive.setSelection(getPreferenceStore().getDefaultBoolean(MylarTaskListPrefConstants.MULTIPLE_ACTIVE_TASKS)); + + multipleActive.setSelection(getPreferenceStore().getDefaultBoolean( + MylarTaskListPrefConstants.MULTIPLE_ACTIVE_TASKS)); } private Label createLabel(Composite parent, String text) { @@ -171,9 +180,10 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork taskDirComposite.setText("Mylar Data Directory (task list and contexts)"); taskDirComposite.setLayout(new GridLayout(2, false)); taskDirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + String taskDirectory = MylarPlugin.getDefault().getDataDirectory(); -// String taskDirectory = getPreferenceStore().getString(MylarPlugin.PREF_DATA_DIR); + // String taskDirectory = + // getPreferenceStore().getString(MylarPlugin.PREF_DATA_DIR); taskDirectory = taskDirectory.replaceAll("\\\\", "/"); taskDirectoryText = new Text(taskDirComposite, SWT.BORDER); taskDirectoryText.setText(taskDirectory); @@ -201,7 +211,8 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork copyExistingDataCheckbox = new Button(taskDirComposite, SWT.CHECK); copyExistingDataCheckbox.setText("Copy existing data to new location"); - copyExistingDataCheckbox.setSelection(getPreferenceStore().getBoolean(MylarTaskListPrefConstants.COPY_TASK_DATA)); + copyExistingDataCheckbox.setSelection(getPreferenceStore() + .getBoolean(MylarTaskListPrefConstants.COPY_TASK_DATA)); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DateChooserDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DateChooserDialog.java index 184c4f98f..4f63f3c56 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DateChooserDialog.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DateChooserDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -29,8 +29,9 @@ import org.eclipse.swt.widgets.Shell; public class DateChooserDialog extends Dialog { private DatePicker picker = null; + private Calendar reminderDate = null; - + public DateChooserDialog(Shell parentShell) { super(parentShell); } @@ -40,22 +41,21 @@ public class DateChooserDialog extends Dialog { this.reminderDate = Calendar.getInstance(); this.reminderDate.setTime(reminderDate); } - + protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridLayout gl = new GridLayout(1, false); composite.setLayout(gl); GridData data = new GridData(GridData.FILL_BOTH); - + picker = new DatePicker(composite, SWT.NONE); -// picker.setDate() - + // picker.setDate() + data.heightHint = 90; // HACK picker.setLayoutData(data); return composite; } - protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { reminderDate = picker.getDate(); @@ -63,7 +63,7 @@ public class DateChooserDialog extends Dialog { } super.buttonPressed(buttonId); } - + public Calendar getReminderDate() { return reminderDate; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DatePicker.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DatePicker.java index e691c31e3..3e33d83a3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DatePicker.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/DatePicker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -90,7 +90,7 @@ public class DatePicker extends Composite { gridLayout.makeColumnsEqualWidth = false; this.setLayout(gridLayout); - setSize(new org.eclipse.swt.graphics.Point(135, 18));//28 + setSize(new org.eclipse.swt.graphics.Point(135, 18));// 28 dateText = new Text(this, SWT.READ_ONLY); dateText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); dateText.setLayoutData(dateTextGridData); @@ -429,5 +429,4 @@ public class DatePicker extends Composite { } -} - +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/RetrieveTitleFromUrlJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/RetrieveTitleFromUrlJob.java index ea8f18506..e74740bf0 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/RetrieveTitleFromUrlJob.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/RetrieveTitleFromUrlJob.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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.mylar.internal.tasklist.ui.views; import org.eclipse.core.runtime.IProgressMonitor; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskActivationHistory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskActivationHistory.java index 3f3874775..43ad19e84 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskActivationHistory.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskActivationHistory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -20,84 +20,90 @@ import org.eclipse.mylar.internal.tasklist.MylarTaskListPlugin; import org.eclipse.mylar.tasklist.ITask; /** -* @author Ken Sueda (original prototype) -* @author Wesley Coelho (Added persistent tasks) -* @author Mik Kersten (hardening) -*/ + * @author Ken Sueda (original prototype) + * @author Wesley Coelho (Added persistent tasks) + * @author Mik Kersten (hardening) + */ public class TaskActivationHistory { - + private List history = new ArrayList(); - + private int currentIndex = -1; - - /** - * The number of tasks from the previous Eclipse session to load into the history - * at startup. (This is not the maximum size of the history, which is currently unbounded) + + /** + * The number of tasks from the previous Eclipse session to load into the + * history at startup. (This is not the maximum size of the history, which + * is currently unbounded) */ private static final int NUM_SAVED_HISTORY_ITEMS_TO_LOAD = 10; - + private boolean persistentHistoryLoaded = false; /** - * Load in a number of saved history tasks from previous session. - * Should be called from constructor but ContextManager doesn't - * seem to be able to provide activity history at that point + * Load in a number of saved history tasks from previous session. Should be + * called from constructor but ContextManager doesn't seem to be able to + * provide activity history at that point + * * @author Wesley Coelho */ - protected void loadPersistentHistory(){ + protected void loadPersistentHistory() { int tasksAdded = 0; - - for(int i = MylarPlugin.getContextManager().getActivityHistory().getInteractionHistory().size() - 1; i >=0; i--){ + + for (int i = MylarPlugin.getContextManager().getActivityHistory().getInteractionHistory().size() - 1; i >= 0; i--) { ITask prevTask = getHistoryTaskAt(i); - + if (prevTask != null && !isDuplicate(prevTask, i + 1)) { history.add(0, prevTask); currentIndex++; tasksAdded++; - if (tasksAdded == NUM_SAVED_HISTORY_ITEMS_TO_LOAD){ + if (tasksAdded == NUM_SAVED_HISTORY_ITEMS_TO_LOAD) { break; } } - } + } } - + /** - * Returns true if the specified task appears in the activity - * history between the starting index and the end of the history list. + * Returns true if the specified task appears in the activity history + * between the starting index and the end of the history list. + * * @author Wesley Coelho */ - protected boolean isDuplicate(ITask task, int startingIndex){ - for (int i = startingIndex; i < MylarPlugin.getContextManager().getActivityHistory().getInteractionHistory().size(); i++){ + protected boolean isDuplicate(ITask task, int startingIndex) { + for (int i = startingIndex; i < MylarPlugin.getContextManager().getActivityHistory().getInteractionHistory() + .size(); i++) { ITask currTask = getHistoryTaskAt(i); - if(currTask != null && currTask.getHandleIdentifier().equals(task.getHandleIdentifier())) { + if (currTask != null && currTask.getHandleIdentifier().equals(task.getHandleIdentifier())) { return true; } } return false; } - - /** - * Returns the task corresponding to the interaction event history item at the specified position + + /** + * Returns the task corresponding to the interaction event history item at + * the specified position + * * @author Wesley Coelho */ - protected ITask getHistoryTaskAt(int pos){ + protected ITask getHistoryTaskAt(int pos) { InteractionEvent event = MylarPlugin.getContextManager().getActivityHistory().getInteractionHistory().get(pos); return MylarTaskListPlugin.getTaskListManager().getTaskForHandle(event.getStructureHandle(), false); } - + public void addTask(ITask task) { try { - if (!persistentHistoryLoaded){ + if (!persistentHistoryLoaded) { loadPersistentHistory(); persistentHistoryLoaded = true; } - + if (hasNext()) { - for (int i = currentIndex+1; i < history.size();) { + for (int i = currentIndex + 1; i < history.size();) { history.remove(i); - } - } - if (history.remove(task)){ + } + } + if (history.remove(task)) { currentIndex--; } history.add(task); @@ -106,11 +112,11 @@ public class TaskActivationHistory { MylarStatusHandler.fail(e, "could not add task to history", false); } } - + public ITask getPreviousTask() { try { if (hasPrevious()) { - if((currentIndex == 0 && !history.get(currentIndex).isActive())){ + if ((currentIndex == 0 && !history.get(currentIndex).isActive())) { return history.get(currentIndex); } else { return history.get(--currentIndex); @@ -121,27 +127,26 @@ public class TaskActivationHistory { } catch (RuntimeException e) { MylarStatusHandler.fail(e, "could not get previous task from history", false); return null; - } + } } - + /** - * Get a list of the preceding tasks in the history. - * navigatedToTask(Task) should be called to notify - * the history if the user navigates to an arbitrary - * previous task from this list + * Get a list of the preceding tasks in the history. navigatedToTask(Task) + * should be called to notify the history if the user navigates to an + * arbitrary previous task from this list + * * @author Wesley Coelho */ - public List getPreviousTasks(){ + public List getPreviousTasks() { try { - - if(!hasPrevious()){ + + if (!hasPrevious()) { return new ArrayList(); } - if(history.get(currentIndex).isActive()){ + if (history.get(currentIndex).isActive()) { return history.subList(0, currentIndex); - } - else{ + } else { return history.subList(0, currentIndex + 1); } } catch (RuntimeException e) { @@ -149,15 +154,15 @@ public class TaskActivationHistory { return new ArrayList(); } } - + /** - * Get a list of the next tasks in the history. - * navigatedToTask(Task) should be called to notify - * the history if the user navigates to an arbitrary + * Get a list of the next tasks in the history. navigatedToTask(Task) should + * be called to notify the history if the user navigates to an arbitrary * next task from this list + * * @author Wesley Coelho */ - public List getNextTasks(){ + public List getNextTasks() { try { return history.subList(currentIndex + 1, history.size()); } catch (RuntimeException e) { @@ -165,37 +170,38 @@ public class TaskActivationHistory { return new ArrayList(); } } - + /** - * Use this method to notify the task history that the - * user has navigated to an arbitrary task in the history - * without using getNextTask() or getPreviousTask() + * Use this method to notify the task history that the user has navigated to + * an arbitrary task in the history without using getNextTask() or + * getPreviousTask() + * * @author Wesley Coelho */ - public void navigatedToTask(ITask task){ - for(int i = 0; i < history.size(); i++){ + public void navigatedToTask(ITask task) { + for (int i = 0; i < history.size(); i++) { if (history.get(i).getHandleIdentifier() != null - && history.get(i).getHandleIdentifier().equals(task.getHandleIdentifier())) { + && history.get(i).getHandleIdentifier().equals(task.getHandleIdentifier())) { currentIndex = i; break; } } } - + public boolean hasPrevious() { try { - if (!persistentHistoryLoaded){ + if (!persistentHistoryLoaded) { loadPersistentHistory(); persistentHistoryLoaded = true; } - + return (currentIndex == 0 && !history.get(currentIndex).isActive()) || currentIndex > 0; } catch (RuntimeException e) { MylarStatusHandler.fail(e, "could determine previous task", false); return false; - } + } } - + public ITask getNextTask() { try { if (hasNext()) { @@ -206,9 +212,9 @@ public class TaskActivationHistory { } catch (RuntimeException e) { MylarStatusHandler.fail(e, "could not get next task", false); return null; - } + } } - + public boolean hasNext() { try { return currentIndex < history.size() - 1; @@ -217,7 +223,7 @@ public class TaskActivationHistory { return false; } } - + public void clear() { try { history.clear(); @@ -227,4 +233,3 @@ public class TaskActivationHistory { } } } - diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskInputDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskInputDialog.java index cb1577f9b..53bc8753f 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskInputDialog.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskInputDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDragSourceListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDragSourceListener.java index f4f0a4f04..98d2f56f1 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDragSourceListener.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDragSourceListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -21,7 +21,7 @@ import org.eclipse.swt.dnd.DragSourceListener; class TaskListDragSourceListener implements DragSourceListener { static final String DELIM = ", "; - + private final TaskListView view; /** @@ -39,25 +39,27 @@ class TaskListDragSourceListener implements DragSourceListener { public void dragSetData(DragSourceEvent event) { event.data = "task-drag"; -// StructuredSelection selection = (StructuredSelection) this.view.getViewer().getSelection(); -// String data = "task-drag"; -// for (Object selectedObject : ((IStructuredSelection) selection).toList()) { -// if (selectedObject instanceof ITaskListElement) { -// ITaskListElement element = (ITaskListElement) selectedObject; -// if (element.isDragAndDropEnabled()) { -// data += "task" -// data += element.getHandleIdentifier() + DELIM; -// } -// } -// } -// if (data != null) { -// event.data = data; -// } else { -// event.data = "null"; -// } + // StructuredSelection selection = (StructuredSelection) + // this.view.getViewer().getSelection(); + // String data = "task-drag"; + // for (Object selectedObject : ((IStructuredSelection) + // selection).toList()) { + // if (selectedObject instanceof ITaskListElement) { + // ITaskListElement element = (ITaskListElement) selectedObject; + // if (element.isDragAndDropEnabled()) { + // data += "task" + // data += element.getHandleIdentifier() + DELIM; + // } + // } + // } + // if (data != null) { + // event.data = data; + // } else { + // event.data = "null"; + // } } public void dragFinished(DragSourceEvent event) { // don't care if the drag is done } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java index 9cfcfd8e2..230633689 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -37,7 +37,7 @@ import org.eclipse.swt.dnd.TransferData; public class TaskListDropAdapter extends ViewerDropAdapter { private Task newTask = null; - + public TaskListDropAdapter(Viewer viewer) { super(viewer); setFeedbackEnabled(true); @@ -138,7 +138,7 @@ public class TaskListDropAdapter extends ViewerDropAdapter { // retrieveTaskDescription(url); // } retrieveTaskDescription(url); - + newTask = new Task(MylarTaskListPlugin.getTaskListManager().genUniqueTaskHandle(), urlTitle, true); if (newTask == null) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListToolTipHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListToolTipHandler.java index acd9b6ea9..a0ed94764 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListToolTipHandler.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListToolTipHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -116,10 +116,10 @@ public class TaskListToolTipHandler { } protected Image getToolTipImage(Object object) { -// ITaskListElement projectNode = getTask(object); -// if (projectNode != null) { -// // TODO Code for determining image -// } + // ITaskListElement projectNode = getTask(object); + // if (projectNode != null) { + // // TODO Code for determining image + // } if (object instanceof Control) { return (Image) ((Control) object).getData("TIP_IMAGE"); } @@ -196,8 +196,7 @@ public class TaskListToolTipHandler { return; } - if (tipShell.getShell() != null - && tipShell.getShell().getParent() != null + if (tipShell.getShell() != null && tipShell.getShell().getParent() != null && Display.getCurrent().getActiveShell() != null && tipShell.getShell().getParent() != Display.getCurrent().getActiveShell()) { tipShell = createTipShell(Display.getCurrent().getActiveShell()); @@ -210,31 +209,31 @@ public class TaskListToolTipHandler { tipShell.setVisible(true); } }); - // /* - // * Trap F1 Help to pop up a custom help box - // */ - // control.addHelpListener(new HelpListener() { - // public void helpRequested(HelpEvent event) { - // if (tipWidget == null) - // return; - // Object help = getToolTipHelp(tipWidget); - // if (help == null) - // return; - // if (help.getClass() != String.class) { - // return; - // } - // if (tipShell.isVisible()) { - // tipShell.setVisible(false); - // Shell helpShell = new Shell(parentShell, SWT.SHELL_TRIM); - // helpShell.setLayout(new FillLayout()); - // Label label = new Label(helpShell, SWT.NONE); - // label.setText((String) help); - // helpShell.pack(); - // setHoverLocation(helpShell, tipPosition); - // helpShell.open(); - // } - // } - // }); + // /* + // * Trap F1 Help to pop up a custom help box + // */ + // control.addHelpListener(new HelpListener() { + // public void helpRequested(HelpEvent event) { + // if (tipWidget == null) + // return; + // Object help = getToolTipHelp(tipWidget); + // if (help == null) + // return; + // if (help.getClass() != String.class) { + // return; + // } + // if (tipShell.isVisible()) { + // tipShell.setVisible(false); + // Shell helpShell = new Shell(parentShell, SWT.SHELL_TRIM); + // helpShell.setLayout(new FillLayout()); + // Label label = new Label(helpShell, SWT.NONE); + // label.setText((String) help); + // helpShell.pack(); + // setHoverLocation(helpShell, tipPosition); + // helpShell.open(); + // } + // } + // }); } /** @@ -253,4 +252,4 @@ public class TaskListToolTipHandler { shellBounds.y = Math.max(Math.min(position.y + 10, displayBounds.height - shellBounds.height), 0); shell.setBounds(shellBounds); } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java index ce5f1bad8..07f3b2767 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -208,6 +208,7 @@ public class TaskListView extends ViewPart { private static final int DEFAULT_SORT_DIRECTION = -1; private int sortIndex = 2; + private int sortDirection = DEFAULT_SORT_DIRECTION; private TaskActivationHistory taskHistory = new TaskActivationHistory(); @@ -630,7 +631,9 @@ public class TaskListView extends ViewPart { public int compare(Viewer compareViewer, Object o1, Object o2) { if (o1 instanceof ITaskCategory || o1 instanceof IRepositoryQuery) { if (o2 instanceof ITaskCategory || o2 instanceof IRepositoryQuery) { - return sortDirection * ((ITaskListElement) o1).getDescription().compareTo(((ITaskListElement) o2).getDescription()); + return sortDirection + * ((ITaskListElement) o1).getDescription().compareTo( + ((ITaskListElement) o2).getDescription()); } else { return -1; } @@ -724,14 +727,14 @@ public class TaskListView extends ViewPart { if (m != null) { sortIndex = m.getInteger("sortIndex"); Integer sortDirInt = m.getInteger("sortDirection"); - if(sortDirInt != null) { + if (sortDirInt != null) { sortDirection = sortDirInt.intValue(); } } else { sortIndex = 2; sortDirection = DEFAULT_SORT_DIRECTION; } - + } else { sortIndex = 2; // default priority sortDirection = DEFAULT_SORT_DIRECTION; @@ -1405,4 +1408,4 @@ public class TaskListView extends ViewPart { // public String getTitleToolTip() { // return "xxx"; // } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskRepositoryLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskRepositoryLabelProvider.java index 79db02f72..c48cd0fd8 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskRepositoryLabelProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskRepositoryLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -21,10 +21,10 @@ import org.eclipse.swt.graphics.Image; * @author Mik Kersten */ public class TaskRepositoryLabelProvider extends LabelProvider implements ITableLabelProvider { - + public String getColumnText(Object object, int index) { if (object instanceof TaskRepository) { - TaskRepository repository = (TaskRepository)object; + TaskRepository repository = (TaskRepository) object; return repository.getKind() + ": " + repository.getUrl().toExternalForm(); } else { return getText(object); @@ -38,4 +38,4 @@ public class TaskRepositoryLabelProvider extends LabelProvider implements ITable public Image getImage(Object obj) { return TaskListImages.getImage(TaskListImages.REPOSITORY); } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistContentProvider.java index 909f805f6..f7cd142db 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistContentProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Text; public class TasklistContentProvider implements IStructuredContentProvider, ITreeContentProvider { private final TaskListView view; - + private static class ContentTaskFilter extends AbstractTaskFilter { @Override public boolean select(Object element) { @@ -44,9 +44,9 @@ public class TasklistContentProvider implements IStructuredContentProvider, ITre return super.shouldAlwaysShow(task); } }; - + private ContentTaskFilter contentTaskFilter = new ContentTaskFilter(); - + public TasklistContentProvider(TaskListView view) { this.view = view; } @@ -230,4 +230,4 @@ public class TasklistContentProvider implements IStructuredContentProvider, ITre } return false; } -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistLabelProvider.java index 35b772ec9..f13eff254 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistLabelProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TasklistLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -10,7 +10,7 @@ *******************************************************************************/ /* * Created on Feb 18, 2005 - */ + */ package org.eclipse.mylar.internal.tasklist.ui.views; import org.eclipse.jface.viewers.IColorProvider; @@ -34,17 +34,18 @@ import org.eclipse.swt.graphics.Image; /** * @author Mik Kersten */ -public class TasklistLabelProvider extends LabelProvider implements IColorProvider, ITableLabelProvider, ITableColorProvider, ITableFontProvider { +public class TasklistLabelProvider extends LabelProvider implements IColorProvider, ITableLabelProvider, + ITableColorProvider, ITableFontProvider { private Color backgroundColor = null; - + @Override - public String getText(Object obj){ + public String getText(Object obj) { return getColumnText(obj, 3); } - - public String getColumnText(Object obj, int columnIndex) { - if (obj instanceof ITaskListElement) { + + public String getColumnText(Object obj, int columnIndex) { + if (obj instanceof ITaskListElement) { ITaskListElement element = (ITaskListElement) obj; switch (columnIndex) { case 0: @@ -60,121 +61,121 @@ public class TasklistLabelProvider extends LabelProvider implements IColorProvid return element.getDescription(); } } - return null; - } - - public Image getIcon(ITask task) { - String issueReportUrl = task.getUrl(); + return null; + } + + public Image getIcon(ITask task) { + String issueReportUrl = task.getUrl(); if (issueReportUrl != null && !issueReportUrl.trim().equals("") && !issueReportUrl.equals("http://")) { return TaskListImages.getImage(TaskListImages.TASK_WEB); } else { return TaskListImages.getImage(TaskListImages.TASK); } - } - - public Image getColumnImage(Object element, int columnIndex) { - if (! (element instanceof ITaskListElement)) { - return null; - } - if (columnIndex == 0) { - if (element instanceof ITaskCategory || element instanceof IRepositoryQuery) { - return ((ITaskListElement)element).getIcon(); - } else { -// return TaskListImages.getImage(TaskListImages.TASK_INACTIVE); - return ((ITaskListElement)element).getStatusIcon(); - } - } else if (columnIndex == 1) { - if (element instanceof ITaskCategory || element instanceof IRepositoryQuery) { - return null; - } - return ((ITaskListElement)element).getIcon(); - } else { - return null; - } - } + } - public void setBackgroundColor(Color c) { - this.backgroundColor = c; - } + public Image getColumnImage(Object element, int columnIndex) { + if (!(element instanceof ITaskListElement)) { + return null; + } + if (columnIndex == 0) { + if (element instanceof ITaskCategory || element instanceof IRepositoryQuery) { + return ((ITaskListElement) element).getIcon(); + } else { + // return TaskListImages.getImage(TaskListImages.TASK_INACTIVE); + return ((ITaskListElement) element).getStatusIcon(); + } + } else if (columnIndex == 1) { + if (element instanceof ITaskCategory || element instanceof IRepositoryQuery) { + return null; + } + return ((ITaskListElement) element).getIcon(); + } else { + return null; + } + } + + public void setBackgroundColor(Color c) { + this.backgroundColor = c; + } public Color getForeground(Object object, int columnIndex) { - if (object instanceof ITaskCategory) { - for (ITask child : ((ITaskCategory)object).getChildren()) { - if (child.isActive()) { - return TaskListImages.COLOR_TASK_ACTIVE; - } else if (child.isPastReminder() && !child.isCompleted()) { - return TaskListImages.COLOR_TASK_OVERDUE; - } - } - } else if (object instanceof IRepositoryQuery) { - for (ITaskListElement child : ((IRepositoryQuery)object).getHits()) { - if (child instanceof IQueryHit) { - ITask task = ((IQueryHit)child).getCorrespondingTask(); - if (task != null && task.isActive()) { - return TaskListImages.COLOR_TASK_ACTIVE; - } - } - } - } else if (object instanceof IQueryHit && ((IQueryHit)object).getCorrespondingTask() == null) { - IQueryHit hit = (IQueryHit)object; - if (hit.isCompleted()) { - return TaskListImages.COLOR_TASK_COMPLETED; - } - } else if (object instanceof ITaskListElement) { - ITask task = getAssociatedTask((ITaskListElement)object); - if (task != null) { - if (task.isCompleted()) { - return TaskListImages.COLOR_TASK_COMPLETED; - } else if (task.isActive()) { - return TaskListImages.COLOR_TASK_ACTIVE; - } else if (task.isPastReminder()) { - return TaskListImages.COLOR_TASK_OVERDUE; - } - } - } - return null; + if (object instanceof ITaskCategory) { + for (ITask child : ((ITaskCategory) object).getChildren()) { + if (child.isActive()) { + return TaskListImages.COLOR_TASK_ACTIVE; + } else if (child.isPastReminder() && !child.isCompleted()) { + return TaskListImages.COLOR_TASK_OVERDUE; + } + } + } else if (object instanceof IRepositoryQuery) { + for (ITaskListElement child : ((IRepositoryQuery) object).getHits()) { + if (child instanceof IQueryHit) { + ITask task = ((IQueryHit) child).getCorrespondingTask(); + if (task != null && task.isActive()) { + return TaskListImages.COLOR_TASK_ACTIVE; + } + } + } + } else if (object instanceof IQueryHit && ((IQueryHit) object).getCorrespondingTask() == null) { + IQueryHit hit = (IQueryHit) object; + if (hit.isCompleted()) { + return TaskListImages.COLOR_TASK_COMPLETED; + } + } else if (object instanceof ITaskListElement) { + ITask task = getAssociatedTask((ITaskListElement) object); + if (task != null) { + if (task.isCompleted()) { + return TaskListImages.COLOR_TASK_COMPLETED; + } else if (task.isActive()) { + return TaskListImages.COLOR_TASK_ACTIVE; + } else if (task.isPastReminder()) { + return TaskListImages.COLOR_TASK_OVERDUE; + } + } + } + return null; } private ITask getAssociatedTask(ITaskListElement element) { if (element instanceof ITask) { - return (ITask)element; - } else if (element instanceof IQueryHit) { - return ((IQueryHit)element).getCorrespondingTask(); - } else { - return null; - } + return (ITask) element; + } else if (element instanceof IQueryHit) { + return ((IQueryHit) element).getCorrespondingTask(); + } else { + return null; + } } public Color getBackground(Object element, int columnIndex) { - try { - if (element instanceof ITask) { - ITask task = (ITask)element; - ITaskHighlighter highlighter = MylarTaskListPlugin.getDefault().getHighlighter(); - if (highlighter != null) { - return highlighter.getHighlightColor(task); - } - } else if (element instanceof ITaskCategory) { - ITaskCategory category = (ITaskCategory)element; - if (category.isArchive()) { - return TaskListImages.BACKGROUND_ARCHIVE; - } else { - return backgroundColor; - } - } else if (element instanceof IRepositoryQuery) { - return backgroundColor; - } + try { + if (element instanceof ITask) { + ITask task = (ITask) element; + ITaskHighlighter highlighter = MylarTaskListPlugin.getDefault().getHighlighter(); + if (highlighter != null) { + return highlighter.getHighlightColor(task); + } + } else if (element instanceof ITaskCategory) { + ITaskCategory category = (ITaskCategory) element; + if (category.isArchive()) { + return TaskListImages.BACKGROUND_ARCHIVE; + } else { + return backgroundColor; + } + } else if (element instanceof IRepositoryQuery) { + return backgroundColor; + } } catch (Exception e) { MylarStatusHandler.fail(e, "Could not get background color", false); } return TaskListImages.BACKGROUND_WHITE; - } + } public Font getFont(Object element, int columnIndex) { - if (element instanceof ITaskListElement) { - ITaskListElement task = (ITaskListElement)element; - return task.getFont(); - } - return null; + if (element instanceof ITaskListElement) { + ITaskListElement task = (ITaskListElement) element; + return task.getFont(); + } + return null; } public Color getForeground(Object element) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java index 28460bceb..007129c6d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractAddExistingTaskWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbench; public abstract class AbstractAddExistingTaskWizard extends Wizard { private final TaskRepository repository; - + public AbstractAddExistingTaskWizard(TaskRepository repository) { this.repository = repository; init(); @@ -36,11 +36,13 @@ public abstract class AbstractAddExistingTaskWizard extends Wizard { @Override public final boolean performFinish() { - ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(this.repository.getKind()); + ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient( + this.repository.getKind()); ITask newTask = client.createTaskFromExistingId(repository, getTaskId()); - + if (newTask != null && TaskListView.getDefault() != null) { - Object selectedObject = ((IStructuredSelection) TaskListView.getDefault().getViewer().getSelection()).getFirstElement(); + Object selectedObject = ((IStructuredSelection) TaskListView.getDefault().getViewer().getSelection()) + .getFirstElement(); if (selectedObject instanceof TaskCategory) { MylarTaskListPlugin.getTaskListManager().moveToCategory(((TaskCategory) selectedObject), newTask); @@ -51,7 +53,7 @@ public abstract class AbstractAddExistingTaskWizard extends Wizard { TaskListView.getDefault().getViewer().setSelection(new StructuredSelection(newTask)); } } - + return true; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java index f6060623f..e13e257f4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositoryClientWizard.java @@ -23,9 +23,9 @@ public abstract class AbstractRepositoryClientWizard extends Wizard implements I private SelectRepositoryClientPage selectRepositoryClientPage = new SelectRepositoryClientPage(this); protected AbstractRepositorySettingsPage abstractRepositorySettingsPage; - + protected ITaskRepositoryClient repositoryClient; - + public void setRepositoryClient(ITaskRepositoryClient repository) { this.repositoryClient = repository; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositorySettingsPage.java index f70db4ae9..6c081d8a4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositorySettingsPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AbstractRepositorySettingsPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -30,23 +30,23 @@ import org.eclipse.ui.IWorkbench; public abstract class AbstractRepositorySettingsPage extends WizardPage { protected static final String LABEL_SERVER = "Server: "; - + protected static final String LABEL_USER = "User Name: "; protected static final String LABEL_PASSWORD = "Password: "; - + protected static final String URL_PREFIX_HTTPS = "https://"; protected static final String URL_PREFIX_HTTP = "http://"; - + protected StringFieldEditor serverUrlEditor; - + protected StringFieldEditor userNameEditor; protected RepositoryStringFieldEditor passwordEditor; - + protected TaskRepository repository; - + public AbstractRepositorySettingsPage(String title, String description) { super(title); super.setTitle(title); @@ -58,8 +58,7 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage { FillLayout layout = new FillLayout(); container.setLayout(layout); - serverUrlEditor = new StringFieldEditor("", LABEL_SERVER, - StringFieldEditor.UNLIMITED, container) { + serverUrlEditor = new StringFieldEditor("", LABEL_SERVER, StringFieldEditor.UNLIMITED, container) { @Override protected boolean doCheckState() { @@ -73,21 +72,21 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage { } }; serverUrlEditor.setErrorMessage("Server path must be a valid http(s):// url"); - + userNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, container); passwordEditor = new RepositoryStringFieldEditor("", LABEL_PASSWORD, StringFieldEditor.UNLIMITED, container); passwordEditor.getTextControl().setEchoChar('*'); - + if (repository != null) { serverUrlEditor.setStringValue(repository.getUrl().toExternalForm()); userNameEditor.setStringValue(repository.getUserName()); passwordEditor.setStringValue(repository.getPassword()); } - + createAdditionalControls(container); setControl(container); } - + protected abstract void createAdditionalControls(Composite parent); public URL getServerUrl() { @@ -98,15 +97,15 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage { return null; } } - + public String getUserName() { return userNameEditor.getStringValue(); } - + public String getPassword() { return passwordEditor.getStringValue(); } - + private boolean isValidUrl(String name) { if (name.startsWith(URL_PREFIX_HTTPS) || name.startsWith(URL_PREFIX_HTTP)) { try { @@ -119,14 +118,14 @@ public abstract class AbstractRepositorySettingsPage extends WizardPage { return false; } } - + public void init(IWorkbench workbench) { // ignore } /** - * Exposes StringFieldEditor.refreshValidState() - * TODO: is there a better way? + * Exposes StringFieldEditor.refreshValidState() TODO: is there a better + * way? */ private static class RepositoryStringFieldEditor extends StringFieldEditor { public RepositoryStringFieldEditor(String name, String labelText, int style, Composite parent) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java index a19efc96c..e0462734d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddExistingTaskWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddRepositoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddRepositoryWizard.java index 6aaf9bace..c4fdb7fb0 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddRepositoryWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/AddRepositoryWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -21,7 +21,8 @@ import org.eclipse.ui.IWorkbench; */ public class AddRepositoryWizard extends AbstractRepositoryClientWizard { -// private AbstractRepositorySettingsPage abstractRepositorySettingsPage;// = new AbstractRepositorySettingsPage(); + // private AbstractRepositorySettingsPage abstractRepositorySettingsPage;// + // = new AbstractRepositorySettingsPage(); public AddRepositoryWizard() { super(); @@ -31,10 +32,11 @@ public class AddRepositoryWizard extends AbstractRepositoryClientWizard { @Override public boolean performFinish() { if (canFinish()) { - TaskRepository repository = new TaskRepository(repositoryClient.getKind(), super.abstractRepositorySettingsPage.getServerUrl()); + TaskRepository repository = new TaskRepository(repositoryClient.getKind(), + super.abstractRepositorySettingsPage.getServerUrl()); if (repository != null) { - repository.setAuthenticationCredentials(abstractRepositorySettingsPage.getUserName(), abstractRepositorySettingsPage - .getPassword()); + repository.setAuthenticationCredentials(abstractRepositorySettingsPage.getUserName(), + abstractRepositorySettingsPage.getPassword()); MylarTaskListPlugin.getRepositoryManager().addRepository(repository); return true; } @@ -48,7 +50,7 @@ public class AddRepositoryWizard extends AbstractRepositoryClientWizard { @Override public void addPages() { super.addPages(); -// addPage(abstractRepositorySettingsPage); + // addPage(abstractRepositorySettingsPage); } public AbstractRepositorySettingsPage getRepositorySettingsPage() { @@ -61,6 +63,7 @@ public class AddRepositoryWizard extends AbstractRepositoryClientWizard { @Override public boolean canFinish() { - return super.canFinish() && abstractRepositorySettingsPage != null && abstractRepositorySettingsPage.isPageComplete(); + return super.canFinish() && abstractRepositorySettingsPage != null + && abstractRepositorySettingsPage.isPageComplete(); } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java index 7ec3cba04..030c38c64 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/EditRepositoryWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -24,12 +24,15 @@ import org.eclipse.ui.IWorkbench; */ public class EditRepositoryWizard extends Wizard implements INewWizard { - private AbstractRepositorySettingsPage abstractRepositorySettingsPage;// = new AbstractRepositorySettingsPage(); - + private AbstractRepositorySettingsPage abstractRepositorySettingsPage;// = + // new + // AbstractRepositorySettingsPage(); + public EditRepositoryWizard(TaskRepository repository) { super(); -// super.setForcePreviousAndNextButtons(true); - ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(repository.getKind()); + // super.setForcePreviousAndNextButtons(true); + ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient( + repository.getKind()); abstractRepositorySettingsPage = client.getSettingsPage(); abstractRepositorySettingsPage.setRepository(repository); abstractRepositorySettingsPage.setWizard(this); @@ -41,11 +44,12 @@ public class EditRepositoryWizard extends Wizard implements INewWizard { TaskRepository repository = new TaskRepository(abstractRepositorySettingsPage.getRepository().getKind(), abstractRepositorySettingsPage.getServerUrl()); if (repository != null) { - repository.setAuthenticationCredentials(abstractRepositorySettingsPage.getUserName(), abstractRepositorySettingsPage.getPassword()); + repository.setAuthenticationCredentials(abstractRepositorySettingsPage.getUserName(), + abstractRepositorySettingsPage.getPassword()); MylarTaskListPlugin.getRepositoryManager().addRepository(repository); return true; - } - } + } + } return false; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/ExistingTaskWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/ExistingTaskWizardPage.java index 8ba10b932..bd06b0f3b 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/ExistingTaskWizardPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/ExistingTaskWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -55,23 +55,23 @@ public class ExistingTaskWizardPage extends WizardPage { taskIdText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { getWizard().getContainer().updateButtons(); -// try { -// numDaysToReport = Integer.parseInt(taskId.getText()); -// setErrorMessage(null); -// } catch (Exception ex) { -// setErrorMessage("Must be integer"); -// numDaysToReport = 0; -// } + // try { + // numDaysToReport = Integer.parseInt(taskId.getText()); + // setErrorMessage(null); + // } catch (Exception ex) { + // setErrorMessage("Must be integer"); + // numDaysToReport = 0; + // } } }); - + setControl(container); } public boolean isPageComplete() { - return getTaskId() != null && !getTaskId().trim().equals(""); - } - + return getTaskId() != null && !getTaskId().trim().equals(""); + } + public String getTaskId() { return taskIdText.getText(); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/MultiRepositoryAwareWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/MultiRepositoryAwareWizard.java index 0ebac92cd..3efe4bc15 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/MultiRepositoryAwareWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/MultiRepositoryAwareWizard.java @@ -23,17 +23,17 @@ import org.eclipse.ui.IWorkbench; public class MultiRepositoryAwareWizard extends Wizard implements INewWizard { private SelectRepositoryPage selectRepositoryPage; - + public MultiRepositoryAwareWizard(SelectRepositoryPage page) { - selectRepositoryPage = page; + selectRepositoryPage = page; setForcePreviousAndNextButtons(true); setNeedsProgressMonitor(true); } - + public void init(IWorkbench workbench, IStructuredSelection selection) { // ignore } - + @Override public void addPages() { addPage(selectRepositoryPage); @@ -43,7 +43,7 @@ public class MultiRepositoryAwareWizard extends Wizard implements INewWizard { public boolean canFinish() { return false; } - + @Override public boolean performFinish() { // Can't finish on the first page diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java index 7305e1c04..a3a13a6a5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/NewQueryWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -23,13 +23,14 @@ public class NewQueryWizard extends MultiRepositoryAwareWizard { public NewQueryWizard() { super(new SelectRepositoryPage() { - + @Override protected IWizard createWizard(TaskRepository taskRepository) { - ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient(taskRepository.getKind()); + ITaskRepositoryClient client = MylarTaskListPlugin.getRepositoryManager().getRepositoryClient( + taskRepository.getKind()); return client.getQueryWizard(taskRepository); } - + }); } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java index 6ac346d9d..75a776b75 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryClientPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -36,11 +36,11 @@ public class SelectRepositoryClientPage extends WizardPage { private static final String TITLE = "Select a repository kind"; private TableViewer viewer; - + private AbstractRepositoryClientWizard wizard; - + class RepositoryContentProvider implements IStructuredContentProvider { - + public void inputChanged(Viewer v, Object oldInput, Object newInput) { } @@ -51,7 +51,7 @@ public class SelectRepositoryClientPage extends WizardPage { return MylarTaskListPlugin.getRepositoryManager().getRepositoryClients().toArray(); } } - + public SelectRepositoryClientPage(AbstractRepositoryClientWizard wizard) { super(TITLE); setTitle(TITLE); @@ -59,7 +59,7 @@ public class SelectRepositoryClientPage extends WizardPage { this.wizard = wizard; super.setWizard(wizard); } - + @Override public boolean canFlipToNextPage() { return wizard.getRepositoryClient() != null; @@ -69,7 +69,7 @@ public class SelectRepositoryClientPage extends WizardPage { Composite container = new Composite(parent, SWT.NULL); FillLayout layout = new FillLayout(); container.setLayout(layout); - + viewer = new TableViewer(container, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new RepositoryContentProvider()); viewer.setLabelProvider(new TaskRepositoryLabelProvider()); @@ -77,14 +77,14 @@ public class SelectRepositoryClientPage extends WizardPage { viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection)event.getSelection(); + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (selection.getFirstElement() instanceof ITaskRepositoryClient) { - wizard.setRepositoryClient((ITaskRepositoryClient)selection.getFirstElement()); + wizard.setRepositoryClient((ITaskRepositoryClient) selection.getFirstElement()); SelectRepositoryClientPage.this.setPageComplete(true); wizard.getContainer().updateButtons(); } } - + }); setControl(container); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryPage.java index 7e3d883d0..ffcb058e3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/SelectRepositoryPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -42,13 +42,13 @@ public abstract class SelectRepositoryPage extends WizardSelectionPage { private static final String TITLE = "Select a repository"; private TableViewer viewer; - + protected MultiRepositoryAwareWizard wizard; - + private String repositoryKind = null; - + class RepositoryContentProvider implements IStructuredContentProvider { - + public void inputChanged(Viewer v, Object oldInput, Object newInput) { } @@ -63,66 +63,68 @@ public abstract class SelectRepositoryPage extends WizardSelectionPage { } } } - + public SelectRepositoryPage() { super(TITLE); setTitle(TITLE); setDescription(DESCRIPTION); } - + public SelectRepositoryPage(String repositoryKind) { this(); this.repositoryKind = repositoryKind; } - + public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); FillLayout layout = new FillLayout(); container.setLayout(layout); - + viewer = new TableViewer(container, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new RepositoryContentProvider()); viewer.setLabelProvider(new TaskRepositoryLabelProvider()); viewer.setInput(MylarTaskListPlugin.getRepositoryManager().getRepositoryClients()); - + viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection)event.getSelection(); + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (selection.getFirstElement() instanceof TaskRepository) { - setSelectedNode(new CustomWizardNode((TaskRepository)selection.getFirstElement())); + setSelectedNode(new CustomWizardNode((TaskRepository) selection.getFirstElement())); setPageComplete(true); } setPageComplete(false); } }); - + viewer.addOpenListener(new IOpenListener() { - + public void open(OpenEvent event) { getContainer().showPage(getNextPage()); } - + }); viewer.getTable().setFocus(); - TaskRepository defaultRepository = MylarTaskListPlugin.getRepositoryManager().getDefaultRepository(repositoryKind); + TaskRepository defaultRepository = MylarTaskListPlugin.getRepositoryManager().getDefaultRepository( + repositoryKind); if (defaultRepository != null) { - viewer.setSelection(new StructuredSelection(defaultRepository)); + viewer.setSelection(new StructuredSelection(defaultRepository)); } - + setControl(container); } - + protected abstract IWizard createWizard(TaskRepository taskRepository); - + private class CustomWizardNode implements IWizardNode { private final TaskRepository repository; + private IWizard wizard; - + public CustomWizardNode(TaskRepository repository) { this.repository = repository; } - + public void dispose() { if (wizard != null) { wizard.dispose(); @@ -137,32 +139,32 @@ public abstract class SelectRepositoryPage extends WizardSelectionPage { if (wizard == null) { wizard = SelectRepositoryPage.this.createWizard(repository); } - + return wizard; } public boolean isContentCreated() { return wizard != null; } - + @Override public boolean equals(Object obj) { if (!(obj instanceof CustomWizardNode)) { return false; } - CustomWizardNode that = (CustomWizardNode)obj; + CustomWizardNode that = (CustomWizardNode) obj; if (this == that) { return true; } - - return this.repository.getKind().equals(that.repository.getKind()) && - this.repository.getUrl().equals(that.repository.getUrl()); + + return this.repository.getKind().equals(that.repository.getKind()) + && this.repository.getUrl().equals(that.repository.getUrl()); } - + @Override public int hashCode() { return 31 * this.repository.getUrl().hashCode() + this.repository.getKind().hashCode(); } - + } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizard.java index f4631ee31..e5a645dd3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizard.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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.mylar.internal.tasklist.ui.wizards; import java.io.File; @@ -50,9 +60,9 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { private final static String SETTINGS_SECTION = "org.eclipse.mylar.tasklist.ui.exportWizard"; private final static String ZIP_FILE_PREFIX = "mylardata"; - + private final static String ZIP_FILE_EXTENSION = ".zip"; - + private final static String WINDOW_TITLE = "Export"; private TaskDataExportWizardPage exportPage = null; @@ -63,7 +73,7 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { String date = format.format(new Date()); return ZIP_FILE_PREFIX + "-" + date + ZIP_FILE_EXTENSION; } - + public TaskDataExportWizard() { IDialogSettings masterSettings = MylarTaskListPlugin.getDefault().getDialogSettings(); setDialogSettings(getSettingsSection(masterSettings)); @@ -112,14 +122,14 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { final File destDirFile = new File(destDir); if (!destDirFile.exists() || !destDirFile.isDirectory()) { // This should never happen - MylarStatusHandler - .fail(new Exception("File Export Exception"), "Could not export data because specified location does not exist or is not a folder", true); + MylarStatusHandler.fail(new Exception("File Export Exception"), + "Could not export data because specified location does not exist or is not a folder", true); return false; } final File destTaskListFile = new File(destDir + File.separator + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE); - final File destActivationHistoryFile = new File(destDir + File.separator + MylarContextManager.CONTEXT_HISTORY_FILE_NAME - + MylarContextManager.CONTEXT_FILE_EXTENSION); + final File destActivationHistoryFile = new File(destDir + File.separator + + MylarContextManager.CONTEXT_HISTORY_FILE_NAME + MylarContextManager.CONTEXT_FILE_EXTENSION); final File destZipFile = new File(destDir + File.separator + getZipFileName()); // Prompt the user to confirm if ANY of the save operations will cause @@ -128,33 +138,36 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { if (zip) { if (destZipFile.exists()) { - if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", "The zip file " + destZipFile.getPath() - + " already exists. Do you want to overwrite it?")) { + if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", "The zip file " + + destZipFile.getPath() + " already exists. Do you want to overwrite it?")) { return false; } } } else { if (exportPage.exportTaskList() && destTaskListFile.exists()) { - if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", "The task list file " + destTaskListFile.getPath() - + " already exists. Do you want to overwrite it?")) { + if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", "The task list file " + + destTaskListFile.getPath() + " already exists. Do you want to overwrite it?")) { return false; } } if (exportPage.exportActivationHistory() && destActivationHistoryFile.exists()) { - if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", "The task activation history file " - + destActivationHistoryFile.getPath() + " already exists. Do you want to overwrite it?")) { + if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", + "The task activation history file " + destActivationHistoryFile.getPath() + + " already exists. Do you want to overwrite it?")) { return false; } } if (exportPage.exportTaskContexts()) { for (ITask task : getAllTasks()) { - File contextFile = MylarPlugin.getContextManager().getFileForContext(task.getHandleIdentifier()); + File contextFile = MylarPlugin.getContextManager() + .getFileForContext(task.getHandleIdentifier()); File destTaskFile = new File(destDir + File.separator + contextFile.getName()); if (destTaskFile.exists()) { - if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", "Task context files already exist in " + destDir - + ". Do you want to overwrite them?")) { + if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", + "Task context files already exist in " + destDir + + ". Do you want to overwrite them?")) { return false; } else { break; @@ -227,14 +240,16 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { if (exportTaskList) { MylarTaskListPlugin.getTaskListManager().saveTaskList(); - String sourceTaskListPath = MylarPlugin.getDefault().getDataDirectory() + File.separator + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; + String sourceTaskListPath = MylarPlugin.getDefault().getDataDirectory() + File.separator + + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE; File sourceTaskListFile = new File(sourceTaskListPath); if (zip) { filesToZip.add(sourceTaskListFile); } else { if (!copy(sourceTaskListFile, destTaskListFile)) { - MylarStatusHandler.fail(new Exception("Export Exception"), "Could not export task list file.", false); + MylarStatusHandler.fail(new Exception("Export Exception"), "Could not export task list file.", + false); } monitor.worked(1); } @@ -243,8 +258,9 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { if (exportActivationHistory) { try { - File sourceActivationHistoryFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + MylarContextManager.CONTEXT_HISTORY_FILE_NAME + MylarContextManager.CONTEXT_FILE_EXTENSION); + File sourceActivationHistoryFile = new File(MylarPlugin.getDefault().getDataDirectory() + + File.separator + MylarContextManager.CONTEXT_HISTORY_FILE_NAME + + MylarContextManager.CONTEXT_FILE_EXTENSION); MylarPlugin.getContextManager().saveActivityHistoryContext(); @@ -261,20 +277,21 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { if (exportTaskContexts) { boolean errorDisplayed = false; // Prevent many repeated error - // messages + // messages for (ITask task : tasks) { if (!MylarPlugin.getContextManager().hasContext(task.getHandleIdentifier())) { continue; // Tasks without a context have no file to - // copy + // copy } File contextFile = MylarPlugin.getContextManager().getFileForContext(task.getHandleIdentifier()); - + File destTaskFile = new File(destinationDirectory + File.separator + contextFile.getName()); File sourceTaskFile = contextFile; -// new File(MylarPlugin.getDefault().getDataDirectory() + File.separator + task.getContextPath() -// + MylarContextManager.CONTEXT_FILE_EXTENSION); + // new File(MylarPlugin.getDefault().getDataDirectory() + + // File.separator + task.getContextPath() + // + MylarContextManager.CONTEXT_FILE_EXTENSION); if (zip) { if (!filesToZipMap.containsKey(task.getHandleIdentifier())) { @@ -283,7 +300,8 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { } } else { if (!copy(sourceTaskFile, destTaskFile) && !errorDisplayed) { - MylarStatusHandler.fail(new Exception("Export Exception: " + sourceTaskFile.getPath() + " -> " + destTaskFile.getPath()), + MylarStatusHandler.fail(new Exception("Export Exception: " + sourceTaskFile.getPath() + + " -> " + destTaskFile.getPath()), "Could not export one or more task context files.", true); errorDisplayed = true; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizardPage.java index e8d0c3595..3392344ac 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizardPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/wizards/TaskDataExportWizardPage.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * 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.mylar.internal.tasklist.ui.wizards; import org.eclipse.jface.dialogs.IDialogSettings; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IQueryHit.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IQueryHit.java index d33154616..3cbc70982 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IQueryHit.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IQueryHit.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -18,15 +18,15 @@ import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement; public interface IQueryHit extends ITaskListElement { public String getRepositoryUrl(); - + public void setRepositoryUrl(String repositoryUrl); - + public ITask getOrCreateCorrespondingTask(); /** - * @return null if there is no corresponding report + * @return null if there is no corresponding report */ public ITask getCorrespondingTask(); - + public void setCorrespondingTask(ITask task); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositoryQuery.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositoryQuery.java index 9b7a59f74..e03550df6 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositoryQuery.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositoryQuery.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -17,22 +17,22 @@ import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement; /** * @author Mik Kersten */ -public interface IRepositoryQuery extends ITaskListElement{ +public interface IRepositoryQuery extends ITaskListElement { public String getQueryUrl(); - + public void setQueryUrl(String query); - + public String getRepositoryUrl(); - + public void setRepositoryUrl(String url); - + public List getHits(); - + public int getMaxHits(); - + public void setMaxHits(int maxHits); - + public void addHit(IQueryHit hit); - + } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositorySettingsPage.java index 396912be9..fa31c5913 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositorySettingsPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/IRepositorySettingsPage.java @@ -12,7 +12,7 @@ package org.eclipse.mylar.tasklist; /** - * @author beatmik + * @author Mik Kersten */ public interface IRepositorySettingsPage { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java index 1d2a29781..ef475887d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -39,7 +39,7 @@ public interface ITask extends ITaskListElement { public List getPlans(); public abstract TaskStatus getStatus(); - + public abstract void setCompleted(boolean completed); public abstract List getRelatedLinks(); @@ -50,22 +50,23 @@ public interface ITask extends ITaskListElement { public abstract void removeLink(String url); - public abstract boolean hasValidUrl(); + public abstract boolean hasValidUrl(); public abstract void setUrl(String url); public abstract String getUrl(); -// public abstract String getRepositoryUrl(); + // public abstract String getRepositoryUrl(); + + // public abstract void setRepositoryUrl(String repositoryUrl); -// public abstract void setRepositoryUrl(String repositoryUrl); - public abstract String getNotes(); public abstract void setNotes(String notes); /** - * @param time in milliseconds + * @param time + * in milliseconds */ public abstract void setElapsedTime(long elapsed); @@ -121,4 +122,4 @@ public interface ITask extends ITaskListElement { public abstract boolean participatesInTaskHandles(); public abstract boolean isPastReminder(); -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskActivityListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskActivityListener.java index 50655f0a0..6b68dd597 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskActivityListener.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskActivityListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -10,7 +10,7 @@ *******************************************************************************/ /* * Created on Jan 13, 2005 - */ + */ package org.eclipse.mylar.tasklist; import java.util.List; @@ -19,15 +19,15 @@ import java.util.List; * @author Mik Kersten */ public interface ITaskActivityListener { - - public abstract void taskActivated(ITask task); - - public abstract void tasksActivated(List tasks); - - public abstract void taskDeactivated(ITask task); - - public abstract void taskChanged(ITask task); - + + public abstract void taskActivated(ITask task); + + public abstract void tasksActivated(List tasks); + + public abstract void taskDeactivated(ITask task); + + public abstract void taskChanged(ITask task); + public abstract void tasklistRead(); public abstract void taskListModified(); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java index 6166a446c..0c67aacd6 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskCategory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -22,11 +22,11 @@ import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement; public interface ITaskCategory extends ITaskListElement { public List getChildren(); - -// public void removeTask(ITask task); - + + // public void removeTask(ITask task); + public boolean isArchive(); public void setIsArchive(boolean isArchive); -} \ No newline at end of file +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskHandler.java index b015668dd..518a0175a 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskHandler.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -31,15 +31,16 @@ public interface ITaskHandler { public abstract ITask addTaskToRegistry(ITask newTask); /** - * This is called both before and after the tasklist is read + * This is called both before and after the tasklist is read */ public abstract void restoreState(TaskListView taskListView); public abstract boolean enableAction(Action action, ITaskListElement element); -// public abstract boolean deleteElement(ITaskListElement element); - -// public abstract void itemRemoved(ITaskListElement element, ITaskCategory category); - -// public abstract ITask getCorrespondingTask(IQueryHit element); -} \ No newline at end of file + // public abstract boolean deleteElement(ITaskListElement element); + + // public abstract void itemRemoved(ITaskListElement element, ITaskCategory + // category); + + // public abstract ITask getCorrespondingTask(IQueryHit element); +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java index b7fc84ed8..569ca4317 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListExternalizer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -18,8 +18,8 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; /** - * Used to externalize things like tasks and bug reports along with the task list - * so that information about them can be persisted across invocations. + * Used to externalize things like tasks and bug reports along with the task + * list so that information about them can be persisted across invocations. * * @author Mik Kersten * @author Ken Sueda @@ -27,59 +27,58 @@ import org.w3c.dom.Node; * TODO: consider merging tasks and categories */ public interface ITaskListExternalizer { - + /** - * Note that registries get read as a normal category, but get - * written out first. + * Note that registries get read as a normal category, but get written out + * first. */ public abstract void createRegistry(Document doc, Node parent); - + public abstract String getCategoryTagName(); - + public abstract String getTaskTagName(); - + public abstract String getQueryTagNameForElement(IRepositoryQuery query); - + public abstract String getQueryHitTagName(); - + public abstract boolean canCreateElementFor(ITaskCategory category); - + /** * @return the element that was created, null if failed */ public abstract Element createCategoryElement(ITaskCategory category, Document doc, Element parent); public abstract boolean canCreateElementFor(ITask task); - + /** * @return the element that was created, null if failed */ public abstract Element createTaskElement(ITask task, Document doc, Element parent); public abstract boolean canReadCategory(Node node); - + public abstract void readCategory(Node node, TaskList tlist) throws TaskListExternalizerException; - + public abstract boolean canReadTask(Node node); - - public abstract ITask readTask(Node node, TaskList tlist, ITaskCategory category, ITask parent) throws TaskListExternalizerException; - - - + + public abstract ITask readTask(Node node, TaskList tlist, ITaskCategory category, ITask parent) + throws TaskListExternalizerException; + public abstract boolean canCreateElementFor(IRepositoryQuery category); - + public abstract Element createQueryElement(IRepositoryQuery query, Document doc, Element parent); - + public abstract boolean canReadQuery(Node node); - + public abstract void readQuery(Node node, TaskList tlist) throws TaskListExternalizerException; - - + public abstract boolean canCreateElementFor(IQueryHit queryHit); - + public abstract Element createQueryHitElement(IQueryHit queryHit, Document doc, Element parent); - + public abstract boolean canReadQueryHit(Node node); - - public abstract void readQueryHit(Node node, TaskList tlist, IRepositoryQuery query) throws TaskListExternalizerException; + + public abstract void readQueryHit(Node node, TaskList tlist, IRepositoryQuery query) + throws TaskListExternalizerException; } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java index 6c9519db8..045ff1c69 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -14,7 +14,6 @@ package org.eclipse.mylar.tasklist; import org.eclipse.jface.wizard.IWizard; import org.eclipse.mylar.internal.tasklist.ui.wizards.AbstractRepositorySettingsPage; - /** * @author Mik Kersten * @author Brock Janiczak @@ -27,15 +26,16 @@ public interface ITaskRepositoryClient { * @return the unique type of the repository, e.g. "bugzilla" */ public abstract String getKind(); - + /** - * @param id identifier, e.g. "123" bug Bugzilla bug 123 - * @return null if task could not be created + * @param id + * identifier, e.g. "123" bug Bugzilla bug 123 + * @return null if task could not be created */ public abstract ITask createTaskFromExistingId(TaskRepository repository, String id); - + public abstract AbstractRepositorySettingsPage getSettingsPage(); - + public abstract IWizard getQueryWizard(TaskRepository repository); public abstract IWizard getAddExistingTaskWizard(TaskRepository repository); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryListener.java index 4a8dcd81a..4ec21b19f 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryListener.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -17,5 +17,5 @@ package org.eclipse.mylar.tasklist; public interface ITaskRepositoryListener { public abstract void repositorySetUpdated(); - + } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskRepository.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskRepository.java index 8c20deb1a..20600c709 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskRepository.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskRepository.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004 - 2005 University Of British Columbia and others. + * 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 @@ -26,35 +26,35 @@ public class TaskRepository { public static final String AUTH_PASSWORD = "org.eclipse.mylar.tasklist.repositories.password"; //$NON-NLS-1$ public static final String AUTH_USERNAME = "org.eclipse.mylar.tasklist.repositories.username"; //$NON-NLS-1$ - + private static final String AUTH_SCHEME = "Basic"; private static final String AUTH_REALM = ""; - + private URL serverUrl; - + private String kind; - + public TaskRepository(String kind, URL serverUrl) { this.serverUrl = serverUrl; this.kind = kind; } - + public URL getUrl() { return serverUrl; } - + @SuppressWarnings("unchecked") public Map getCredentials() { return Platform.getAuthorizationInfo(serverUrl, AUTH_REALM, AUTH_SCHEME); } - + public boolean hasCredentials() { String username = getUserName(); String password = getPassword(); return username != null && !username.equals("") && password != null && !password.equals(""); } - + @SuppressWarnings("unchecked") public String getUserName() { Map map = Platform.getAuthorizationInfo(serverUrl, AUTH_REALM, AUTH_SCHEME); @@ -64,7 +64,7 @@ public class TaskRepository { return null; } } - + @SuppressWarnings("unchecked") public String getPassword() { Map map = Platform.getAuthorizationInfo(serverUrl, AUTH_REALM, AUTH_SCHEME); @@ -74,7 +74,7 @@ public class TaskRepository { return null; } } - + @SuppressWarnings("unchecked") public void setAuthenticationCredentials(String username, String password) { Map map = Platform.getAuthorizationInfo(serverUrl, AUTH_REALM, AUTH_SCHEME); @@ -83,7 +83,7 @@ public class TaskRepository { map = new java.util.HashMap(); } - if (username != null){ + if (username != null) { map.put(AUTH_USERNAME, username); } if (password != null) { @@ -100,7 +100,7 @@ public class TaskRepository { @Override public boolean equals(Object object) { if (serverUrl != null && object instanceof TaskRepository) { - return serverUrl.equals(((TaskRepository)object).getUrl()); + return serverUrl.equals(((TaskRepository) object).getUrl()); } else { return super.equals(object); } @@ -114,7 +114,7 @@ public class TaskRepository { return super.hashCode(); } } - + public String toString() { return serverUrl.toExternalForm(); } -- cgit v1.2.3