Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-02-15 23:10:20 -0500
committermkersten2007-02-15 23:10:20 -0500
commit69ac5bf06877318679d7fc4c9e4d04aca0a03d08 (patch)
tree44aad5b3d94eeaae8b306c207995a5e0abec379d
parentc97bd583c047f1e1cb0c439dea0d2cd2c0c581d8 (diff)
downloadorg.eclipse.mylyn.tasks-69ac5bf06877318679d7fc4c9e4d04aca0a03d08.tar.gz
org.eclipse.mylyn.tasks-69ac5bf06877318679d7fc4c9e4d04aca0a03d08.tar.xz
org.eclipse.mylyn.tasks-69ac5bf06877318679d7fc4c9e4d04aca0a03d08.zip
NEW - bug 107259: provide preview of task context
https://bugs.eclipse.org/bugs/show_bug.cgi?id=107259
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java127
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java22
3 files changed, 23 insertions, 132 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
index 9cec89933..1b2ad2dce 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
@@ -22,6 +22,7 @@ import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.core.util.DateUtil;
import org.eclipse.mylar.internal.tasks.ui.RetrieveTitleFromUrlJob;
+import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
import org.eclipse.mylar.internal.tasks.ui.actions.NewLocalTaskAction;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylar.monitor.ui.MylarMonitorUiPlugin;
@@ -251,25 +252,13 @@ public class TaskPlanningEditor extends TaskFormPage {
task.setEstimatedTimeHours(estimated.getSelection());
if (datePicker != null && datePicker.getDate() != null) {
TasksUiPlugin.getTaskListManager().setScheduledFor(task, datePicker.getDate().getTime());
- // task.setReminderDate(scheduledForDate.getDate().getTime());
} else {
- // task.setReminderDate(null);
TasksUiPlugin.getTaskListManager().setScheduledFor(task, null);
}
- // MylarTaskListPlugin.getTaskListManager().getTaskList().notifyLocalInfoChanged(task);
if (parentEditor != null) {
parentEditor.notifyTaskChanged();
}
-
- // Method not implemented yet
- // task.setStatus(statusCombo.getItem(statusCombo.getSelectionIndex()));
-
- // MylarTaskListPlugin.getTaskListManager().setStatus(task,
- // statusCombo.getItem(statusCombo.getSelectionIndex()));
-
- // refreshTaskListView(task);
-
markDirty(false);
}
@@ -278,18 +267,6 @@ public class TaskPlanningEditor extends TaskFormPage {
// don't support saving as
}
- // @SuppressWarnings("deprecation")
- // @Override
- // public void init(IEditorSite site, IEditorInput input) {
- // // if (!(input instanceof TaskEditorInput)) {
- // // throw new PartInitException("Invalid Input: Must be TaskEditorInput");
- // // }
- // setSite(site);
- // setInput(input);
- // editorInput = (TaskEditorInput) input;
- // setPartName(editorInput.getLabel());
- // }
-
@Override
public boolean isDirty() {
return isDirty;
@@ -310,7 +287,9 @@ public class TaskPlanningEditor extends TaskFormPage {
form = managedForm.getForm();
toolkit = managedForm.getToolkit();
form.setText(task.getSummary());
-
+ form.setImage(TaskListImages.getImage(TaskListImages.CALENDAR));
+ toolkit.decorateFormHeading(form.getForm());
+
editorComposite = form.getBody();
editorComposite.setLayout(new GridLayout());
editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -320,73 +299,15 @@ public class TaskPlanningEditor extends TaskFormPage {
}
createPlanningSection(editorComposite);
createNotesSection(editorComposite);
-// createResourcesSection(editorComposite);
- // } catch (SWTException e) {
- // MylarStatusHandler.log(e, "content failed");
- // }
+
if (summary != null && NewLocalTaskAction.DESCRIPTION_DEFAULT.equals(summary.getText())) {
summary.setSelection(0, summary.getText().length());
summary.setFocus();
} else if (summary != null) {
summary.setFocus();
}
-
- // createContextMenu();
-// summary.setFocus();
-// summary.setSelection(0, summary.getText().length());
}
- // protected void createContextMenu() {
- //
- // contextMenuManager = new MenuManager(CONTEXT_MENU_ID);
- // contextMenuManager.setRemoveAllWhenShown(true);
- // contextMenuManager.addMenuListener(new IMenuListener() {
- // public void menuAboutToShow(IMenuManager manager) {
- // manager.add(cutAction);
- // manager.add(copyAction);
- // manager.add(pasteAction);
- // // Clipboard clipboard = new Clipboard(comp.getDisplay());
- // // TextTransfer textTransfer = TextTransfer.getInstance();
- // // String textData = (String)
- // // clipboard.getContents(textTransfer);
- // // if (textData != null) {
- // // pasteAction.setEnabled(true);
- // // } else {
- // // pasteAction.setEnabled(false);
- // // }
- //
- // // if (currentSelectedText == null ||
- // currentSelectedText.getSelectionText().length() == 0) {
- // // copyAction.setEnabled(false);
- // // } else {
- // // copyAction.setEnabled(true);
- // // }
- // // manager.add(revealAllAction);
- // manager.add(new Separator());
- // manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- // }
- // });
- // // getSite().registerContextMenu(CONTEXT_MENU_ID, contextMenuManager,
- // // getSite().getSelectionProvider());
- // }
-
- // @Override
- // public void createPartControl(Composite parent) {
- // FormToolkit toolkit = new FormToolkit(parent.getDisplay());
- // form = toolkit.createScrolledForm(parent);
- // form.setText(task.getDescription());
- //
- // editorComposite = form.getBody();
- // editorComposite.setLayout(new GridLayout());
- // editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- // createContent(editorComposite, toolkit);
- // if (summary != null &&
- // NewLocalTaskAction.DESCRIPTION_DEFAULT.equals(summary.getText())) {
- // summary.setSelection(0);
- // summary.setFocus();
- // }
- // }
-
@Override
public void setFocus() {
//form.setFocus();
@@ -399,44 +320,10 @@ public class TaskPlanningEditor extends TaskFormPage {
return form;
}
- // public void setTask(ITask task) throws Exception {
- // if (task == null)
- // throw new Exception("ITask object is null.");
- // this.task = task;
- // }
-
- // private Composite createContent(Composite parent, FormToolkit toolkit) {
- // TaskEditorInput taskEditorInput = (TaskEditorInput) getEditorInput();
- //
- // task = taskEditorInput.getTask();
- // if (task == null) {
- // MessageDialog.openError(parent.getShell(), "No such task", "No task
- // exists with this taskId");
- // return null;
- // }
- //
- // try {
- // if (!(task instanceof AbstractRepositoryTask)) {
- // createSummarySection(parent, toolkit);
- // }
- // createPlanningSection(parent, toolkit);
- // createNotesSection(parent, toolkit);
- // // // createRelatedLinksSection(parent, toolkit);
- // createResourcesSection(parent, toolkit);
- // } catch (SWTException e) {
- // MylarStatusHandler.log(e, "content failed");
- // }
- // return null;
- // }
-
private void createSummarySection(Composite parent) {
Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | Section.TWISTIE);
section.setText(LABEL_OVERVIEW);
section.setExpanded(true);
- // if (task instanceof AbstractRepositoryTask) {
- // section.setDescription("To modify these fields use the repository
- // editor.");
- // }
section.setLayout(new GridLayout());
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -464,7 +351,7 @@ public class TaskPlanningEditor extends TaskFormPage {
summary.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
summary.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
toolkit.paintBordersFor(container);
-
+
if (task instanceof AbstractRepositoryTask) {
summary.setEnabled(false);
} else {
@@ -588,8 +475,6 @@ public class TaskPlanningEditor extends TaskFormPage {
}
});
}
- // statusCombo.setEnabled(false);
-
}
/**
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
index c13bd74fc..dea31fef7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskListManager.java
@@ -671,7 +671,11 @@ public class TaskListManager implements IPropertyChangeListener {
try {
taskList.setActive(task, true);
for (ITaskActivityListener listener : new ArrayList<ITaskActivityListener>(activityListeners)) {
- listener.taskActivated(task);
+ try {
+ listener.taskActivated(task);
+ } catch (Throwable t) {
+ MylarStatusHandler.fail(t, "task activity listener failed: " + listener, false);
+ }
}
} catch (Throwable t) {
MylarStatusHandler.fail(t, "could not activate task", false);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index e4af10a98..6aba56858 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -20,6 +20,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylar.core.MylarStatusHandler;
import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
@@ -45,6 +46,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.editor.IFormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -390,12 +392,12 @@ public class TaskEditor extends FormEditor {
IEditorPart editor = factory.createEditor(this, getEditorInput());
IEditorInput input = task != null ? factory.createEditorInput(task) : getEditorInput();
if (editor != null && input != null) {
+ FormPage taskEditor = (FormPage) editor;
+ // repositoryTaskEditor.setParentEditor(this);
+ editor.init(getEditorSite(), input);
+ taskEditor.createPartControl(getContainer());
+ index = addPage(taskEditor);
if (editor instanceof AbstractRepositoryTaskEditor) {
- TaskFormPage repositoryTaskEditor = (TaskFormPage) editor;
- // repositoryTaskEditor.setParentEditor(this);
- editor.init(getEditorSite(), input);
- repositoryTaskEditor.createPartControl(getContainer());
- index = addPage(repositoryTaskEditor);
if (getEditorInput() instanceof RepositoryTaskEditorInput) {
RepositoryTaskEditorInput existingInput = (RepositoryTaskEditorInput) getEditorInput();
setPartName(existingInput.getName());
@@ -403,11 +405,11 @@ public class TaskEditor extends FormEditor {
String label = ((NewTaskEditorInput) getEditorInput()).getName();
setPartName(label);
}
- } else {
- index = addPage(editor, input);
- }
+ setPageText(index, factory.getTitle());
+
+ }
+ // TODO: move
selectedIndex = index;
- setPageText(index++, factory.getTitle());
}
// HACK: overwrites if multiple present
@@ -462,7 +464,7 @@ public class TaskEditor extends FormEditor {
if (getSite() != null && getSite().getSelectionProvider() != null) {
return getSite().getSelectionProvider().getSelection();
} else {
- return null;
+ return StructuredSelection.EMPTY;
}
}
}

Back to the top