diff options
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/NewBugzillaSubTaskAction.java')
-rw-r--r-- | org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/NewBugzillaSubTaskAction.java | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/NewBugzillaSubTaskAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/NewBugzillaSubTaskAction.java deleted file mode 100644 index 88a2aa36e..000000000 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/NewBugzillaSubTaskAction.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Mylyn project committers 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 - *******************************************************************************/ - -package org.eclipse.mylyn.internal.bugzilla.ui.actions; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTask; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler; -import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaImages; -import org.eclipse.mylyn.monitor.core.StatusHandler; -import org.eclipse.mylyn.tasks.core.AbstractAttributeFactory; -import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; -import org.eclipse.mylyn.tasks.core.AbstractTask; -import org.eclipse.mylyn.tasks.core.RepositoryTaskData; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; -import org.eclipse.mylyn.tasks.ui.TasksUiUtil; -import org.eclipse.mylyn.tasks.ui.editors.NewTaskEditorInput; -import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; - -/** - * @author Frank Becker - */ -public class NewBugzillaSubTaskAction extends Action implements IViewActionDelegate, IExecutableExtension { - - private static final String LABEL = "Subtask"; - - public static final String ID = "org.eclipse.mylyn.bugzilla.ui.new.subtask"; - - private BugzillaTask selectedTask; - - public NewBugzillaSubTaskAction() { - super(LABEL); - setToolTipText(LABEL); - setId(ID); - setImageDescriptor(BugzillaImages.NEW_SUB_TASK); - } - - public void init(IViewPart view) { - // ignore - - } - - @SuppressWarnings("restriction") - public void run(IAction action) { - AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector( - BugzillaCorePlugin.REPOSITORY_KIND); - - String repositoryUrl = selectedTask.getRepositoryUrl(); - TaskRepository taskRepository = TasksUiPlugin.getRepositoryManager().getRepository(repositoryUrl); - RepositoryTaskData selectedTaskData = TasksUiPlugin.getTaskDataManager().getNewTaskData(repositoryUrl, - selectedTask.getTaskId()); - - BugzillaTaskDataHandler taskDataHandler = (BugzillaTaskDataHandler) connector.getTaskDataHandler(); - AbstractAttributeFactory attributeFactory = taskDataHandler.getAttributeFactory(taskRepository.getUrl(), - taskRepository.getConnectorKind(), AbstractTask.DEFAULT_TASK_KIND); - RepositoryTaskData taskData = new RepositoryTaskData(attributeFactory, BugzillaCorePlugin.REPOSITORY_KIND, - taskRepository.getUrl(), TasksUiPlugin.getDefault().getNextNewRepositoryTaskId()); - taskData.setNew(true); - try { - taskDataHandler.initializeSubTaskData(taskRepository, taskData, selectedTaskData, new NullProgressMonitor()); - } catch (CoreException e) { - StatusHandler.displayStatus("Unable to create Subtask", e.getStatus()); - } - - // open editor - NewTaskEditorInput editorInput = new NewTaskEditorInput(taskRepository, taskData); - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page); - } - - public void selectionChanged(IAction action, ISelection selection) { - selectedTask = null; - if (selection instanceof StructuredSelection) { - Object selectedObject = ((StructuredSelection) selection).getFirstElement(); - if (selectedObject instanceof BugzillaTask) { - selectedTask = (BugzillaTask) selectedObject; - } - } - - action.setEnabled(selectedTask != null); - } - - public void setInitializationData(IConfigurationElement config, String propertyName, Object data) - throws CoreException { - // ignore - - } - -} |