diff options
author | mkersten | 2005-12-09 03:41:30 +0000 |
---|---|---|
committer | mkersten | 2005-12-09 03:41:30 +0000 |
commit | 03091ca0d4fe7b6be371c2a2dde12ce6649eed3a (patch) | |
tree | 1273a986718dbba6079e1c47b61da55f6997a4be | |
parent | 643f8277b05e1936879d7a3a60ff5560630411c1 (diff) | |
download | org.eclipse.mylyn.tasks-03091ca0d4fe7b6be371c2a2dde12ce6649eed3a.tar.gz org.eclipse.mylyn.tasks-03091ca0d4fe7b6be371c2a2dde12ce6649eed3a.tar.xz org.eclipse.mylyn.tasks-03091ca0d4fe7b6be371c2a2dde12ce6649eed3a.zip |
Progress on: Bug 119557: Tasklist data doesn't change when changing workspace
https://bugs.eclipse.org/bugs/show_bug.cgi?id=119557
9 files changed, 103 insertions, 412 deletions
diff --git a/org.eclipse.mylyn.help.ui/doc/faq.html b/org.eclipse.mylyn.help.ui/doc/faq.html index b45e2cede..9a26307e9 100644 --- a/org.eclipse.mylyn.help.ui/doc/faq.html +++ b/org.eclipse.mylyn.help.ui/doc/faq.html @@ -67,7 +67,11 @@ version.</p> <img border="0" src="images/faq/eclipse-manage-configuration.gif" width="679" height="335"></p> <h3> </h3> -<h3><a name="filtering-declarations">How do I stop declarations from showing up in the Package Explorer??</a></h3> +<h3><a name="filtering-declarations0">What is the effect of Mylar on Eclipse +performance?</a></h3> +<p>...</p> +<h3> </h3> + <h3><a name="filtering-declarations">How do I stop declarations from showing up in the Package Explorer?</a></h3> <p>If you don't like Mylar's constant showing of Java members in the Package Explorer, select the drop-down menu, then "Filters..." and enable the "Mylar Java Declarations Filter". It will then diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTasklistTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTasklistTests.java index 8d6cdadb8..cb73aca93 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTasklistTests.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/AllTasklistTests.java @@ -28,7 +28,6 @@ public class AllTasklistTests { suite.addTestSuite(TaskListUiTest.class); suite.addTestSuite(TaskHistoryTest.class); suite.addTestSuite(TaskDataExportTest.class); - suite.addTestSuite(ChangeMainTaskDirTest.class); suite.addTestSuite(BackgroundSaveTest.class); suite.addTestSuite(TaskActivityTimingTest.class); //$JUnit-END$ diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/ChangeMainTaskDirTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/ChangeMainTaskDirTest.java deleted file mode 100644 index 2f5ce884d..000000000 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/ChangeMainTaskDirTest.java +++ /dev/null @@ -1,327 +0,0 @@ -package org.eclipse.mylar.tasklist.tests; - -import java.io.File; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.mylar.bugzilla.ui.BugzillaUiPlugin; -import org.eclipse.mylar.bugzilla.ui.tasklist.BugzillaTask; -import org.eclipse.mylar.bugzilla.ui.tasklist.BugzillaTask.BugTaskState; -import org.eclipse.mylar.core.InteractionEvent; -import org.eclipse.mylar.core.MylarPlugin; -import org.eclipse.mylar.core.internal.MylarContext; -import org.eclipse.mylar.core.internal.MylarContextManager; -import org.eclipse.mylar.tasklist.ITask; -import org.eclipse.mylar.tasklist.ITaskHandler; -import org.eclipse.mylar.tasklist.MylarTaskListPlugin; -import org.eclipse.mylar.tasklist.internal.Task; -import org.eclipse.mylar.tasklist.internal.TaskListManager; - -/** - * Tests changes to the main mylar data directory location. - * - * @author Wesley Coelho - */ -public class ChangeMainTaskDirTest extends TestCase { - - private static final int ELAPSED_TIME1 = 123456; - - private static final int ELAPSED_TIME2 = 999999; - - private File newMainDataDir = null; - - private String originalMainDataDir = null; - - private TaskListManager manager = MylarTaskListPlugin.getTaskListManager(); - - private String defaultDirectory = MylarPlugin.getDefault().getDataDirectory(); - - protected void setUp() throws Exception { - super.setUp(); - - // Get the original main data directory so that it can be reset later - originalMainDataDir = MylarPlugin.getDefault().getDataDirectory(); - - // Create test main data directories to use - newMainDataDir = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator + "TestMainDir1"); - newMainDataDir.mkdir(); - assertTrue(newMainDataDir.exists()); - - } - - public void testDefaultDataDirectoryLocation() { - - String newDirectory = defaultDirectory + File.separator + "TestDir"; - - // Check that default directory is correct - assertTrue("Wrong default directory returned", defaultDirectory.equals(ResourcesPlugin.getWorkspace().getRoot() - .getLocation().toString() - + File.separator + ".mylar")); - - // Set the directory to something else - MylarPlugin.getDefault().setDataDirectory(newDirectory); - - // Check that the change was made - assertTrue("Wrong mylar directory returned", MylarPlugin.getDefault().getDataDirectory().equals(newDirectory)); - - } - - /** - * Tests moving the main mylar data directory to another location (Without - * copying existing data to the new directory) - */ - public void testChangeMainDataDir() { - - // Create a task in the main dir and context with an interaction event - // to be saved - ITask mainDataDirTask = createAndSaveTask("Main Task", false); - - // Switch task directory - switchMainTaskDirectory(newMainDataDir.getPath()); - - // Check that there are no tasks in the tasklist after switching to the - // empty dir - assertTrue(manager.getTaskList().getRootTasks().size() == 0); - - // Check that the main data dir task isn't in the list or the folder - File taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + mainDataDirTask.getContextPath() + MylarTaskListPlugin.FILE_EXTENSION); - assertFalse(taskFile.exists()); - assertNull(manager.getTaskForHandle(mainDataDirTask.getHandleIdentifier(), false)); - - // Check that a newly created task appears in the right place (method - // will check) - ITask newDataDirTask = createAndSaveTask("New Data Dir", false); - taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + newDataDirTask.getContextPath() + MylarTaskListPlugin.FILE_EXTENSION); - assertTrue(taskFile.exists()); - - // Check for other the tasklist file in the new dir - File destTaskListFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE); - assertTrue(destTaskListFile.exists()); - - // Switch back to the main task directory - switchMainTaskDirectory(originalMainDataDir); - - // Check that the previously created main dir task is in the task list - // and its file exists - assertNotNull(manager.getTaskForHandle(mainDataDirTask.getHandleIdentifier(), false)); - taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + mainDataDirTask.getContextPath() + MylarTaskListPlugin.FILE_EXTENSION); - assertTrue(taskFile.exists()); - - // Check that the task created in the "New Data Dir" isn't there now - // that we're back to the main dir - assertNull(manager.getTaskForHandle(newDataDirTask.getHandleIdentifier(), false)); - - } - - /** - * Same as above but using bugzilla tasks Tests moving the main mylar data - * directory to another location (Without copying existing data to the new - * directory) - */ - public void testChangeMainDataDirBugzilla() { - - // Create a task in the main dir and context with an interaction event - // to be saved - ITask mainDataDirTask = createAndSaveTask("Main Task", true); - - // Set time to see if the right task data is returned by the registry - // mechanism - mainDataDirTask.setElapsedTime(ELAPSED_TIME1); - - // Save tasklist - MylarTaskListPlugin.getDefault().getTaskListSaveManager().saveTaskListAndContexts(); - - // Temp check that the task is there - assertNotNull(manager.getTaskForHandle(mainDataDirTask.getHandleIdentifier(), false)); - - // Switch task directory - switchMainTaskDirectory(newMainDataDir.getPath()); - - // Check that there are no tasks in the tasklist after switching to the - // empty dir - assertTrue(manager.getTaskList().getRootTasks().size() == 0); - - // Check that the main data dir task isn't in the list or the folder - File taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + mainDataDirTask.getContextPath() + MylarTaskListPlugin.FILE_EXTENSION); - assertFalse(taskFile.exists()); - assertNull(manager.getTaskForHandle(mainDataDirTask.getHandleIdentifier(), false)); - - // Check that a newly created task appears in the right place (method - // will check) - ITask newDataDirTask = createAndSaveTask("New Data Dir", true); - taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + newDataDirTask.getContextPath() + MylarTaskListPlugin.FILE_EXTENSION); - assertTrue(taskFile.exists()); - - // Save tasklist - MylarTaskListPlugin.getDefault().getTaskListSaveManager().saveTaskListAndContexts(); - - // Check for tasklist file in the new dir - File destTaskListFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + MylarTaskListPlugin.DEFAULT_TASK_LIST_FILE); - assertTrue(destTaskListFile.exists()); - - // Switch back to the main task directory - switchMainTaskDirectory(originalMainDataDir); - - // Check that the previously created main dir task is in the task list - // and its file exists - assertNotNull(manager.getTaskForHandle(mainDataDirTask.getHandleIdentifier(), false)); - taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + mainDataDirTask.getContextPath() + MylarTaskListPlugin.FILE_EXTENSION); - assertTrue(taskFile.exists()); - - // Check that the elapsed time is still right - assertTrue(manager.getTaskForHandle(mainDataDirTask.getHandleIdentifier(), false).getElapsedTime() == ELAPSED_TIME1); - - // Check that the task created in the "New Data Dir" isn't there now - // that we're back to the main dir - assertNull(manager.getTaskForHandle(newDataDirTask.getHandleIdentifier(), false)); - - } - - /** - * Tests for bugzilla registry problem where the registry entry has outdated - * fields that don't match the corresponding task - */ - public void testBugzillaRegistry() { - - int commonBugID = 123; - - // Create a task in the main dir and context with an interaction event - // to be saved - ITask bugzillaTask1 = new BugzillaTask(BugzillaUiPlugin.getDefault().createBugHandleIdentifier(commonBugID), - "BugZTask", true, true); - addBugzillaTask(bugzillaTask1); - - // Set time to see if the right task data is returned by the registry - // mechanism - bugzillaTask1.setElapsedTime(ELAPSED_TIME1); - - // Switch task directory - switchMainTaskDirectory(newMainDataDir.getPath()); - - // Create a new bugzilla task with the same bug id - ITask bugzillaTask2 = new BugzillaTask(BugzillaUiPlugin.getDefault().createBugHandleIdentifier(commonBugID), - "BugZTask", true, true); - addBugzillaTask(bugzillaTask1); - - // Set a time that's different from the other task - bugzillaTask2.setElapsedTime(ELAPSED_TIME2); - - // Switch back to the main task directory - switchMainTaskDirectory(originalMainDataDir); - - // Check that the elapsed time is still right - assertTrue(manager.getTaskForHandle(bugzillaTask1.getHandleIdentifier(), false).getElapsedTime() == ELAPSED_TIME1); - - // Switch back to the other task directory - switchMainTaskDirectory(newMainDataDir.getPath()); - - // Check that the elapsed time is still right - assertTrue("Task has wrong time", manager.getTaskForHandle(bugzillaTask2.getHandleIdentifier(), false) - .getElapsedTime() == ELAPSED_TIME2); - - } - - /** - * Creates a task with an interaction event and checks that it has been - * properly saved in the currently active data directory - */ - protected ITask createAndSaveTask(String taskName, boolean createBugzillaTask) { - - // Create the task and add it to the root of the task list - ITask newTask = null; - if (!createBugzillaTask) { - newTask = new Task(MylarTaskListPlugin.getTaskListManager().genUniqueTaskHandle(), taskName, true); - manager.moveToRoot(newTask); - } else { - newTask = new BugzillaTask(MylarTaskListPlugin.getTaskListManager().genUniqueTaskHandle(), taskName, true, - true); - addBugzillaTask(newTask); - } - - MylarContext mockContext = MylarPlugin.getContextManager().loadContext(newTask.getHandleIdentifier(), - newTask.getContextPath()); - InteractionEvent event = new InteractionEvent(InteractionEvent.Kind.EDIT, "structureKind", "handle", "originId"); - mockContext.parseEvent(event); - MylarPlugin.getContextManager().contextActivated(mockContext); - - // Save the context file and check that it exists - MylarPlugin.getContextManager().saveContext(mockContext.getId(), newTask.getContextPath()); - File taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator - + newTask.getContextPath() + MylarContextManager.FILE_EXTENSION); - assertTrue(MylarPlugin.getContextManager().hasContext(newTask.getContextPath())); - assertTrue(taskFile.exists()); - - return newTask; - } - - private void addBugzillaTask(ITask newTask) { - - ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(newTask); - if (taskHandler != null) { - ITask addedTask = taskHandler.taskAdded(newTask); - if (addedTask instanceof BugzillaTask) { - BugzillaTask newTask2 = (BugzillaTask) addedTask; - if (newTask2 == newTask) { - ((BugzillaTask) newTask).scheduleDownloadReport(); - } else { - newTask = newTask2; - ((BugzillaTask) newTask).updateTaskDetails(); - } - } - } else { - ((BugzillaTask) newTask).scheduleDownloadReport(); - } - - MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask); - - BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry((BugzillaTask) newTask); - - try { - while (((BugzillaTask) newTask).getState() != BugTaskState.FREE) { - Thread.sleep(250); - } - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (RuntimeException re) { - re.printStackTrace(); - } - } - - /** - * Copy (almost) of code that changes the task directory - * (MylarTaskListPreferencePage) - */ - protected void switchMainTaskDirectory(String newDir) { - - // Order matters: - MylarTaskListPlugin.getDefault().getTaskListSaveManager().saveTaskListAndContexts(); - MylarPlugin.getDefault().getPreferenceStore().setValue(MylarPlugin.PREF_DATA_DIR, newDir); - MylarTaskListPlugin.getDefault().setDataDirectory(MylarPlugin.getDefault().getDataDirectory()); - } - - protected void tearDown() throws Exception { - - MylarPlugin.getDefault().setDataDirectory(defaultDirectory); - - // Delete the test destination folder - - File[] files = newMainDataDir.listFiles(); - for (File file : files) { - file.delete(); - } - - newMainDataDir.delete(); - assertFalse(newMainDataDir.exists()); - - super.tearDown(); - } -} diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataExportTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataExportTest.java index 8b9d87a4b..1e76877b2 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataExportTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataExportTest.java @@ -54,7 +54,7 @@ public class TaskDataExportTest extends TestCase{ //Save the context file and check that it exists MylarPlugin.getContextManager().saveContext(mockContext.getId(), task1.getContextPath()); - File taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator + task1.getContextPath() + MylarContextManager.FILE_EXTENSION); + File taskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator + task1.getContextPath() + MylarContextManager.CONTEXT_FILE_EXTENSION); assertTrue(MylarPlugin.getContextManager().hasContext(task1.getContextPath())); assertTrue(taskFile.exists()); } @@ -88,11 +88,11 @@ public class TaskDataExportTest extends TestCase{ File destActivationHistoryFile = new File(destinationDir + File.separator + MylarContextManager.CONTEXT_HISTORY_FILE_NAME - + MylarContextManager.FILE_EXTENSION); + + MylarContextManager.CONTEXT_FILE_EXTENSION); assertTrue(destActivationHistoryFile.exists()); //Check that the task context file created in setUp() was exported - File destTaskContextFile = new File(destinationDir + File.separator + task1.getContextPath() + MylarContextManager.FILE_EXTENSION); + File destTaskContextFile = new File(destinationDir + File.separator + task1.getContextPath() + MylarContextManager.CONTEXT_FILE_EXTENSION); assertTrue(destTaskContextFile.exists()); } diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java index e164d124a..8d9bc5a0b 100644 --- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java +++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java @@ -37,15 +37,18 @@ public class TaskListManagerTest extends TestCase { protected void setUp() throws Exception { super.setUp(); manager = MylarTaskListPlugin.getTaskListManager(); + manager.createNewTaskList(); } @Override protected void tearDown() throws Exception { super.tearDown(); manager.createNewTaskList(); + MylarTaskListPlugin.getDefault().getTaskListSaveManager().saveTaskListAndContexts(); } public void testMoves() { + assertEquals(0, manager.getTaskList().getRootTasks().size()); Task task1 = new Task("t1", "t1", true); manager.moveToRoot(task1); assertEquals(1, manager.getTaskList().getRootTasks().size()); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java index 065fdac0c..a2692f2a8 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java @@ -266,7 +266,7 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup { } }; - private static IPropertyChangeListener PREFERENCE_LISTENER = new IPropertyChangeListener() { + private final IPropertyChangeListener PREFERENCE_LISTENER = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(MULTIPLE_ACTIVE_TASKS)) { @@ -274,6 +274,19 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup { TaskListView.getDefault().toggleNextAction(!getPrefs().getBoolean(MULTIPLE_ACTIVE_TASKS)); TaskListView.getDefault().clearTaskHistory(); } + if (event.getProperty().equals(MylarPlugin.PREF_DATA_DIR)) { + if (event.getOldValue() instanceof String) { + String newDirPath = MylarPlugin.getDefault().getDataDirectory(); + String taskListFilePath = newDirPath + File.separator + DEFAULT_TASK_LIST_FILE; + + getTaskListSaveManager().saveTaskListAndContexts(); + getTaskListManager().setTaskListFile(new File(taskListFilePath)); + getTaskListManager().createNewTaskList(); + getTaskListManager().readTaskList(); + + if (TaskListView.getDefault() != null) TaskListView.getDefault().clearTaskHistory(); + } + } } }; @@ -403,18 +416,18 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup { return MylarPlugin.getDefault().getPreferenceStore(); } - /** - * Sets the directory containing the task list file to use. - * Switches immediately to use the data at that location. - */ - public void setDataDirectory(String newDirPath) { - String taskListFilePath = newDirPath + File.separator + DEFAULT_TASK_LIST_FILE; - getTaskListManager().setTaskListFile(new File(taskListFilePath)); - getTaskListManager().createNewTaskList(); - getTaskListManager().readTaskList(); - - if (TaskListView.getDefault() != null) TaskListView.getDefault().clearTaskHistory(); - } +// /** +// * Sets the directory containing the task list file to use. +// * Switches immediately to use the data at that location. +// */ +// public void setDataDirectory(String newDirPath) { +// String taskListFilePath = newDirPath + File.separator + DEFAULT_TASK_LIST_FILE; +// getTaskListManager().setTaskListFile(new File(taskListFilePath)); +// getTaskListManager().createNewTaskList(); +// getTaskListManager().readTaskList(); +// +// if (TaskListView.getDefault() != null) TaskListView.getDefault().clearTaskHistory(); +// } private void checkTaskListBackup() { // if (getPrefs().contains(PREVIOUS_SAVE_DATE)) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskInfoEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskInfoEditor.java index 339b84a2d..ccf8610eb 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskInfoEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskInfoEditor.java @@ -18,6 +18,7 @@ import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.mylar.core.MylarPlugin; +import org.eclipse.mylar.core.internal.MylarContextManager; import org.eclipse.mylar.core.util.DateUtil; import org.eclipse.mylar.core.util.ErrorLogger; import org.eclipse.mylar.tasklist.ITask; @@ -29,17 +30,14 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.SWTException; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Spinner; import org.eclipse.swt.widgets.Text; @@ -91,7 +89,7 @@ public class TaskInfoEditor extends EditorPart { private static final String pasteActionDefId = "org.eclipse.ui.edit.paste"; - private Button browse; +// private Button browse; private Text pathText; @@ -111,10 +109,10 @@ public class TaskInfoEditor extends EditorPart { private ITaskActivityListener TASK_LIST_LISTENER = new ITaskActivityListener() { public void taskActivated(ITask activeTask) { - if (task != null && !browse.isDisposed() - && activeTask.getHandleIdentifier().equals(task.getHandleIdentifier())) { - browse.setEnabled(false); - } +// if (task != null && !browse.isDisposed() +// && activeTask.getHandleIdentifier().equals(task.getHandleIdentifier())) { +// browse.setEnabled(false); +// } } public void tasksActivated(List<ITask> tasks) { @@ -124,10 +122,10 @@ public class TaskInfoEditor extends EditorPart { } public void taskDeactivated(ITask deactiveTask) { - if (task != null && !browse.isDisposed() - && deactiveTask.getHandleIdentifier().equals(task.getHandleIdentifier())) { - browse.setEnabled(true); - } +// if (task != null && !browse.isDisposed() +// && deactiveTask.getHandleIdentifier().equals(task.getHandleIdentifier())) { +// browse.setEnabled(true); +// } } public void tasklistRead() { @@ -139,10 +137,9 @@ public class TaskInfoEditor extends EditorPart { if (!description.isDisposed()) { description.setText(updateTask.getDescription(false)); } - if (!pathText.isDisposed() && !updateTask.getContextPath().equals(task.getContextPath())) { - pathText.setText("<Mylar_Dir>/" + task.getContextPath()); - } - +// if (!pathText.isDisposed() && !updateTask.getContextPath().equals(task.getContextPath())) { +// pathText.setText(MylarPlugin.getDefault().getDataDirectory() + '/' + task.getContextPath()); +// } } } @@ -546,59 +543,61 @@ public class TaskInfoEditor extends EditorPart { Composite container = toolkit.createComposite(section); section.setClient(container); TableWrapLayout layout = new TableWrapLayout(); - layout.numColumns = 3; + layout.numColumns = 2; container.setLayout(layout); - Label l = toolkit.createLabel(container, "Task Handle:"); - l.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); - Text handle = toolkit.createText(container, task.getHandleIdentifier(), SWT.BORDER); - TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB); - td.colspan = 2; - handle.setLayoutData(td); - handle.setEditable(false); - handle.setEnabled(false); +// Label l = toolkit.createLabel(container, "Task Handle:"); +// l.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); +// Text handle = toolkit.createText(container, task.getHandleIdentifier(), SWT.BORDER); +// TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB); +// td.colspan = 2; +// handle.setLayoutData(td); +// handle.setEditable(false); +// handle.setEnabled(false); Label l2 = toolkit.createLabel(container, "Task context file:"); l2.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); - pathText = toolkit.createText(container, "<Mylar_Dir>/" + task.getContextPath() + ".xml", SWT.BORDER); + String contextPath = MylarPlugin.getDefault().getDataDirectory() + + '/' + task.getContextPath() + MylarContextManager.CONTEXT_FILE_EXTENSION; + pathText = toolkit.createText(container, contextPath, SWT.BORDER); pathText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); pathText.setEditable(false); pathText.setEnabled(false); - browse = toolkit.createButton(container, "Change", SWT.PUSH | SWT.CENTER); - if (task.isActive()) { - browse.setEnabled(false); - } else { - browse.setEnabled(true); - } - browse.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - - if (task.isActive()) { - MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Task Message", - "Task can not be active when changing taskscape"); - } else { - FileDialog dialog = new FileDialog(Display.getDefault().getActiveShell(), SWT.OPEN); - String[] ext = { "*.xml" }; - dialog.setFilterExtensions(ext); - - String mylarDir = MylarPlugin.getDefault().getDataDirectory() + "/"; - mylarDir = mylarDir.replaceAll("\\\\", "/"); - dialog.setFilterPath(mylarDir); - - String res = dialog.open(); - if (res != null) { - res = res.replaceAll("\\\\", "/"); - pathText.setText("<MylarDir>/" + res + ".xml"); - markDirty(true); - } - } - } - }); - toolkit.createLabel(container, ""); - l = toolkit.createLabel(container, "Go to Mylar Preferences to change <Mylar_Dir>"); - l.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); +// browse = toolkit.createButton(container, "Change", SWT.PUSH | SWT.CENTER); +// if (task.isActive()) { +// browse.setEnabled(false); +// } else { +// browse.setEnabled(true); +// } +// browse.addSelectionListener(new SelectionAdapter() { +// @Override +// public void widgetSelected(SelectionEvent e) { +// +// if (task.isActive()) { +// MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Task Message", +// "Task can not be active when changing taskscape"); +// } else { +// FileDialog dialog = new FileDialog(Display.getDefault().getActiveShell(), SWT.OPEN); +// String[] ext = { "*.xml" }; +// dialog.setFilterExtensions(ext); +// +// String mylarDir = MylarPlugin.getDefault().getDataDirectory() + "/"; +// mylarDir = mylarDir.replaceAll("\\\\", "/"); +// dialog.setFilterPath(mylarDir); +// +// String res = dialog.open(); +// if (res != null) { +// res = res.replaceAll("\\\\", "/"); +// pathText.setText("<MylarDir>/" + res + ".xml"); +// markDirty(true); +// } +// } +// } +// }); +// toolkit.createLabel(container, ""); +// l = toolkit.createLabel(container, "Go to Task List Preferences to change task context directory"); +// l.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); } private void refreshTaskListView(ITask task) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTaskListPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTaskListPreferencePage.java index 8cf3b4c28..c43efa8cf 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTaskListPreferencePage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTaskListPreferencePage.java @@ -113,9 +113,9 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork if (copyExistingDataCheckbox.getSelection()) { MylarTaskListPlugin.getDefault().getTaskListSaveManager().copyDataDirContentsTo(taskDirectory); } -// getPreferenceStore().setValue(MylarPlugin.PREF_DATA_DIR, taskDirectory); MylarPlugin.getDefault().setDataDirectory(taskDirectory); - MylarTaskListPlugin.getDefault().setDataDirectory(MylarPlugin.getDefault().getDataDirectory()); +// getPreferenceStore().setValue(MylarPlugin.PREF_DATA_DIR, taskDirectory); +// MylarTaskListPlugin.getDefault().setDataDirectory(MylarPlugin.getDefault().getDataDirectory()); } getPreferenceStore().setValue(MylarTaskListPlugin.COPY_TASK_DATA, copyExistingDataCheckbox.getSelection()); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java index 9fa13dede..1aa5c837c 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/TaskDataExportWizard.java @@ -106,7 +106,7 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { 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.FILE_EXTENSION); + + MylarContextManager.CONTEXT_FILE_EXTENSION); final File destZipFile = new File(destDir + File.separator + ZIP_FILE_NAME); // Prompt the user to confirm if ANY of the save operations will cause @@ -137,7 +137,7 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { if (exportPage.exportTaskContexts()) { for (ITask task : getAllTasks()) { - File destTaskFile = new File(destDir + File.separator + task.getContextPath() + MylarContextManager.FILE_EXTENSION); + File destTaskFile = new File(destDir + File.separator + task.getContextPath() + MylarContextManager.CONTEXT_FILE_EXTENSION); if (destTaskFile.exists()) { if (!MessageDialog.openConfirm(getShell(), "Confirm File Replace", "Task context files already exist in " + destDir + ". Do you want to overwrite them?")) { @@ -230,7 +230,7 @@ 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.FILE_EXTENSION); + + MylarContextManager.CONTEXT_HISTORY_FILE_NAME + MylarContextManager.CONTEXT_FILE_EXTENSION); MylarPlugin.getContextManager().saveActivityHistoryContext(); @@ -255,9 +255,9 @@ public class TaskDataExportWizard extends Wizard implements IExportWizard { // copy } - File destTaskFile = new File(destinationDirectory + File.separator + task.getContextPath() + MylarContextManager.FILE_EXTENSION); + File destTaskFile = new File(destinationDirectory + File.separator + task.getContextPath() + MylarContextManager.CONTEXT_FILE_EXTENSION); File sourceTaskFile = new File(MylarPlugin.getDefault().getDataDirectory() + File.separator + task.getContextPath() - + MylarContextManager.FILE_EXTENSION); + + MylarContextManager.CONTEXT_FILE_EXTENSION); if (zip) { if (!filesToZipMap.containsKey(task.getContextPath())) { |