Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2015-12-01 01:32:55 +0000
committerSam Davis2015-12-09 20:04:46 +0000
commit75123a088465809eedf6edf78417855ea9ff160c (patch)
treebf0af1b8fcc8f26299c233d51a382a5ce48bddcb
parent338621720668be556f677c6f85ad46934cf7dfaa (diff)
downloadorg.eclipse.mylyn.tasks-75123a088465809eedf6edf78417855ea9ff160c.tar.gz
org.eclipse.mylyn.tasks-75123a088465809eedf6edf78417855ea9ff160c.tar.xz
org.eclipse.mylyn.tasks-75123a088465809eedf6edf78417855ea9ff160c.zip
483856: [api] allow connectors to open a wizard when creating subtasks
Change-Id: If0835369657c233564abf126b309cb5a2578d899 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=483856
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java18
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java10
2 files changed, 28 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
index cf8a099cd..d18cd28bb 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewSubTaskAction.java
@@ -22,9 +22,12 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.commons.core.ICoreRunnable;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.ui.CommonUiUtil;
+import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
@@ -38,6 +41,7 @@ import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
@@ -83,6 +87,13 @@ public class NewSubTaskAction extends BaseSelectionListenerAction implements IVi
AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
selectedTask.getConnectorKind());
+ IWizard wizard = getNewSubTaskWizard();
+ if (wizard != null) {
+ WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard);
+ dialog.setBlockOnOpen(true);
+ dialog.open();
+ return;
+ }
TaskData taskData = createTaskData(connector);
if (taskData != null) {
try {
@@ -96,6 +107,13 @@ public class NewSubTaskAction extends BaseSelectionListenerAction implements IVi
}
}
+ private IWizard getNewSubTaskWizard() {
+ TaskRepository repository = TasksUi.getRepositoryManager().getRepository(selectedTask.getConnectorKind(),
+ selectedTask.getRepositoryUrl());
+ AbstractRepositoryConnectorUi connectorUi = TasksUi.getRepositoryConnectorUi(selectedTask.getConnectorKind());
+ return connectorUi.getNewSubTaskWizard(repository, selectedTask);
+ }
+
private TaskData createTaskData(AbstractRepositoryConnector connector) {
final AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
if (taskDataHandler == null) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
index bc13109f1..32d16613e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
@@ -102,6 +102,16 @@ public abstract class AbstractRepositoryConnectorUi {
public abstract IWizard getNewTaskWizard(@NonNull TaskRepository repository, @Nullable ITaskMapping selection);
/**
+ * Connectors can implement this method if they need to open a wizard dialog before opening a new subtask editor.
+ *
+ * @since 3.18
+ */
+ @Nullable
+ public IWizard getNewSubTaskWizard(TaskRepository taskRepository, ITask parentTask) {
+ return null;
+ }
+
+ /**
* Override to return a custom task editor ID. If overriding this method the connector becomes responsible for
* showing the additional pages handled by the default task editor. As of Mylyn 2.0M2 these are the Planning and
* Context pages.

Back to the top