Search in sources :

Example 16 with AbstractTaskDataHandler

use of org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler in project eclipse-integration-commons by spring-projects.

the class IdeUiUtils method createTaskData.

private static TaskData createTaskData(final TaskRepository taskRepository, final String projectKey) throws CoreException {
    AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(JIRA_CONNECTOR_KIND);
    final AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
    final TaskData taskData = new TaskData(taskDataHandler.getAttributeMapper(taskRepository), JIRA_CONNECTOR_KIND, taskRepository.getRepositoryUrl(), "");
    ICoreRunnable runner = new ICoreRunnable() {

        public void run(IProgressMonitor monitor) throws CoreException {
            TaskMapping mapping = new TaskMapping() {

                @Override
                public String getProduct() {
                    return projectKey;
                }
            };
            if (!taskDataHandler.initializeTaskData(taskRepository, taskData, mapping, monitor)) {
                throw new CoreException(new Status(Status.ERROR, IdeUiPlugin.PLUGIN_ID, "The repository does not have a project with key: " + projectKey));
            }
        }
    };
    UiUtil.busyCursorWhile(runner);
    return taskData;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) ICoreRunnable(org.springsource.ide.eclipse.commons.ui.ICoreRunnable) AbstractRepositoryConnector(org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector) TaskMapping(org.eclipse.mylyn.tasks.core.TaskMapping) AbstractTaskDataHandler(org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler) TaskData(org.eclipse.mylyn.tasks.core.data.TaskData)

Aggregations

AbstractTaskDataHandler (org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler)16 TaskData (org.eclipse.mylyn.tasks.core.data.TaskData)16 TaskAttributeMapper (org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper)15 OSIORestClient (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestClient)14 TestData (org.eclipse.linuxtools.mylyn.osio.rest.test.support.TestData)13 Test (org.junit.Test)13 OSIORestConfiguration (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestConfiguration)11 RepositoryLocation (org.eclipse.mylyn.commons.repositories.core.RepositoryLocation)11 TaskAttribute (org.eclipse.mylyn.tasks.core.data.TaskAttribute)11 NullOperationMonitor (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.NullOperationMonitor)10 JsonWriter (com.google.gson.stream.JsonWriter)5 FileReader (java.io.FileReader)5 StringWriter (java.io.StringWriter)5 IStatus (org.eclipse.core.runtime.IStatus)3 OSIORestTaskSchema (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestTaskSchema)3 TaskCommentMapper (org.eclipse.mylyn.tasks.core.data.TaskCommentMapper)3 ArrayList (java.util.ArrayList)2 LinkedHashSet (java.util.LinkedHashSet)2 CoreException (org.eclipse.core.runtime.CoreException)2 Status (org.eclipse.core.runtime.Status)2