Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 206840
Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaTaskWizard.java (-6 / +11 lines)
Lines 98-115 Link Here
98
	@Override
98
	@Override
99
	public boolean performFinish() {
99
	public boolean performFinish() {
100
		try {
100
		try {
101
			String copyContextHandleIdentifier = null;
102
			
101
			productPage.saveDataToModel();
103
			productPage.saveDataToModel();
102
104
103
			if (taskSelection != null) {
105
			if (taskSelection != null) {
104
				AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
106
				if (taskSelection.getTaskData() != null) {
105
						repository.getConnectorKind());
107
					AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager()
106
				AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
108
							.getRepositoryConnector(repository.getConnectorKind());
107
				if (taskDataHandler != null) {
109
					AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
108
					taskDataHandler.cloneTaskData(taskSelection.getTaskData(), taskData);
110
					if (taskDataHandler != null) {
111
						taskDataHandler.cloneTaskData(taskSelection.getTaskData(), taskData);
112
					}
109
				}
113
				}
114
				copyContextHandleIdentifier = taskSelection.getCopyContextHandleIdentifier();
110
			}
115
			}
111
116
112
			NewTaskEditorInput editorInput = new NewTaskEditorInput(repository, taskData);
117
			NewTaskEditorInput editorInput = new NewTaskEditorInput(repository, taskData, copyContextHandleIdentifier);
113
			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
118
			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
114
			TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
119
			TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
115
			return true;
120
			return true;
(-)src/org/eclipse/mylyn/tasks/core/TaskSelection.java (+14 lines)
Lines 21-26 Link Here
21
public class TaskSelection {
21
public class TaskSelection {
22
22
23
	private final RepositoryTaskData taskData;
23
	private final RepositoryTaskData taskData;
24
	
25
	private String copyContextHandleIdentifier;
24
26
25
	public TaskSelection(RepositoryTaskData taskData) {
27
	public TaskSelection(RepositoryTaskData taskData) {
26
		if (taskData == null) {
28
		if (taskData == null) {
Lines 30-35 Link Here
30
		try {
32
		try {
31
			this.taskData = (RepositoryTaskData) TaskDataManager.ObjectCloner.deepCopy(taskData);
33
			this.taskData = (RepositoryTaskData) TaskDataManager.ObjectCloner.deepCopy(taskData);
32
			this.taskData.setAttributeFactory(taskData.getAttributeFactory());
34
			this.taskData.setAttributeFactory(taskData.getAttributeFactory());
35
			this.copyContextHandleIdentifier = null;
33
		} catch (Exception e) {
36
		} catch (Exception e) {
34
			StatusHandler.fail(e, "Error creating a task data copy", false);
37
			StatusHandler.fail(e, "Error creating a task data copy", false);
35
			throw new RuntimeException(e);
38
			throw new RuntimeException(e);
Lines 42-47 Link Here
42
		taskData.setSummary(task.getSummary());
45
		taskData.setSummary(task.getSummary());
43
		taskData.setAttributeValue(RepositoryTaskAttribute.PRIORITY, task.getPriority());
46
		taskData.setAttributeValue(RepositoryTaskAttribute.PRIORITY, task.getPriority());
44
		this.taskData = taskData;
47
		this.taskData = taskData;
48
		this.copyContextHandleIdentifier = null;
45
	}
49
	}
46
50
47
	public TaskSelection(String summary, String description) {
51
	public TaskSelection(String summary, String description) {
Lines 50-61 Link Here
50
		taskData.setSummary(summary);
54
		taskData.setSummary(summary);
51
		taskData.setDescription(description);
55
		taskData.setDescription(description);
52
		this.taskData = taskData;
56
		this.taskData = taskData;
57
		this.copyContextHandleIdentifier = null;
58
	}
59
60
	public TaskSelection(String copyContextHandleIdentifier) {
61
		this.taskData = null;
62
		this.copyContextHandleIdentifier = copyContextHandleIdentifier;
53
	}
63
	}
54
64
55
	public RepositoryTaskData getTaskData() {
65
	public RepositoryTaskData getTaskData() {
56
		return taskData;
66
		return taskData;
57
	}
67
	}
58
68
69
	public String getCopyContextHandleIdentifier() {
70
		return copyContextHandleIdentifier;
71
	}
72
59
	private class IdentityAttributeFactory extends AbstractAttributeFactory {
73
	private class IdentityAttributeFactory extends AbstractAttributeFactory {
60
74
61
		private static final long serialVersionUID = 1L;
75
		private static final long serialVersionUID = 1L;
(-)src/org/eclipse/mylyn/tasks/ui/editors/NewTaskEditorInput.java (+11 lines)
Lines 22-34 Link Here
22
 * @since 2.0
22
 * @since 2.0
23
 */
23
 */
24
public class NewTaskEditorInput extends RepositoryTaskEditorInput {
24
public class NewTaskEditorInput extends RepositoryTaskEditorInput {
25
	
26
	private String copyContextHandleIdentifier;
25
27
26
	public NewTaskEditorInput(TaskRepository repository, RepositoryTaskData taskData) {
28
	public NewTaskEditorInput(TaskRepository repository, RepositoryTaskData taskData) {
29
		this(repository, taskData, null);
30
	}
31
32
	public NewTaskEditorInput(TaskRepository repository, RepositoryTaskData taskData, String copyContextHandleIdentifier) {
27
		super(repository, taskData.getId(), "");
33
		super(repository, taskData.getId(), "");
28
		setOldTaskData(taskData);
34
		setOldTaskData(taskData);
29
		Set<RepositoryTaskAttribute> edits = Collections.emptySet();
35
		Set<RepositoryTaskAttribute> edits = Collections.emptySet();
30
		setOldEdits(edits);
36
		setOldEdits(edits);
31
		setEditableTaskData(taskData);
37
		setEditableTaskData(taskData);
38
		this.copyContextHandleIdentifier = copyContextHandleIdentifier;
32
	}
39
	}
33
40
34
	@Override
41
	@Override
Lines 49-53 Link Here
49
	public void refreshInput() {
56
	public void refreshInput() {
50
		// does nothing
57
		// does nothing
51
	}
58
	}
59
60
	public String getCopyContextHandleIdentifier() {
61
		return copyContextHandleIdentifier;
62
	}
52
	
63
	
53
}
64
}
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java (+7 lines)
Lines 68-73 Link Here
68
import org.eclipse.jface.viewers.Viewer;
68
import org.eclipse.jface.viewers.Viewer;
69
import org.eclipse.jface.viewers.ViewerSorter;
69
import org.eclipse.jface.viewers.ViewerSorter;
70
import org.eclipse.jface.window.ToolTip;
70
import org.eclipse.jface.window.ToolTip;
71
import org.eclipse.mylyn.context.core.ContextCorePlugin;
71
import org.eclipse.mylyn.internal.tasks.core.CommentQuoter;
72
import org.eclipse.mylyn.internal.tasks.core.CommentQuoter;
72
import org.eclipse.mylyn.internal.tasks.ui.PersonProposalLabelProvider;
73
import org.eclipse.mylyn.internal.tasks.ui.PersonProposalLabelProvider;
73
import org.eclipse.mylyn.internal.tasks.ui.PersonProposalProvider;
74
import org.eclipse.mylyn.internal.tasks.ui.PersonProposalProvider;
Lines 3256-3261 Link Here
3256
						modifiedTask = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(),
3257
						modifiedTask = TasksUiPlugin.getTaskListManager().getTaskList().getTask(repository.getUrl(),
3257
								taskData.getId());
3258
								taskData.getId());
3258
					}
3259
					}
3260
					if (editorInput instanceof NewTaskEditorInput) {
3261
						ContextCorePlugin.getContextManager().cloneContext(((NewTaskEditorInput)editorInput).getCopyContextHandleIdentifier(),modifiedTask.getHandleIdentifier());
3262
					}
3263
//					 ContextCorePlugin.getContextManager().cloneContext(
3264
//						     sourceTask.getHandleIdentifier(), 
3265
//						     modifiedTask.getHandleIdentifier());
3259
3266
3260
					// Synchronization accounting...
3267
					// Synchronization accounting...
3261
					if (modifiedTask != null) {
3268
					if (modifiedTask != null) {
(-)src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java (-2 / +5 lines)
Lines 69-74 Link Here
69
69
70
	@Override
70
	@Override
71
	public boolean performFinish() {
71
	public boolean performFinish() {
72
		String copyContextHandleIdentifier = null;
73
72
		AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
74
		AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
73
				taskRepository.getConnectorKind());
75
				taskRepository.getConnectorKind());
74
76
Lines 114-124 Link Here
114
			return false;
116
			return false;
115
		}
117
		}
116
118
117
		if (taskSelection != null) {
119
		if (taskSelection.getTaskData() != null) {
118
			taskDataHandler.cloneTaskData(taskSelection.getTaskData(), taskData);
120
			taskDataHandler.cloneTaskData(taskSelection.getTaskData(), taskData);
119
		}
121
		}
122
		copyContextHandleIdentifier = taskSelection.getCopyContextHandleIdentifier();
120
123
121
		NewTaskEditorInput editorInput = new NewTaskEditorInput(taskRepository, taskData);
124
		NewTaskEditorInput editorInput = new NewTaskEditorInput(taskRepository, taskData, copyContextHandleIdentifier);
122
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
125
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
123
		TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
126
		TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
124
		return true;
127
		return true;
(-)src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskSelectionDialog.java (+21 lines)
Lines 42-47 Link Here
42
import org.eclipse.swt.events.KeyEvent;
42
import org.eclipse.swt.events.KeyEvent;
43
import org.eclipse.swt.events.ModifyEvent;
43
import org.eclipse.swt.events.ModifyEvent;
44
import org.eclipse.swt.events.ModifyListener;
44
import org.eclipse.swt.events.ModifyListener;
45
import org.eclipse.swt.events.SelectionAdapter;
46
import org.eclipse.swt.events.SelectionEvent;
45
import org.eclipse.swt.layout.GridData;
47
import org.eclipse.swt.layout.GridData;
46
import org.eclipse.swt.widgets.Button;
48
import org.eclipse.swt.widgets.Button;
47
import org.eclipse.swt.widgets.Composite;
49
import org.eclipse.swt.widgets.Composite;
Lines 63-68 Link Here
63
 */
65
 */
64
public class TaskSelectionDialog extends SelectionStatusDialog {
66
public class TaskSelectionDialog extends SelectionStatusDialog {
65
67
68
	private boolean createNewTask = false;
69
	
66
	/**
70
	/**
67
	 * Implements a {@link ViewFilter} based on content typed in the filter field
71
	 * Implements a {@link ViewFilter} based on content typed in the filter field
68
	 */
72
	 */
Lines 281-286 Link Here
281
			filterText.setSelection(0, text.length());
285
			filterText.setSelection(0, text.length());
282
		}
286
		}
283
287
288
		Button newButton = new Button(area, SWT.PUSH);
289
		newButton.setText("New Task");
290
		newButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
291
292
		newButton.addSelectionListener(new SelectionAdapter() {
293
			@Override
294
			public void widgetSelected(SelectionEvent e) {
295
				createNewTask = true;
296
				setReturnCode(OK);
297
				close();
298
			}
299
		});
300
284
		return area;
301
		return area;
285
	}
302
	}
286
303
Lines 297-300 Link Here
297
		return super.close();
314
		return super.close();
298
	}
315
	}
299
316
317
	public boolean isCreateNewTask() {
318
		return createNewTask;
319
	}
320
300
}
321
}
(-)src/org/eclipse/mylyn/internal/jira/ui/wizards/NewJiraTaskWizard.java (-3 / +8 lines)
Lines 67-72 Link Here
67
67
68
	@Override
68
	@Override
69
	public boolean performFinish() {
69
	public boolean performFinish() {
70
		String copyContextHandleIdentifier = null;
71
70
		AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
72
		AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
71
				JiraUiPlugin.REPOSITORY_KIND);
73
				JiraUiPlugin.REPOSITORY_KIND);
72
74
Lines 80-90 Link Here
80
		Project project = projectPage.getSelectedProject();
82
		Project project = projectPage.getSelectedProject();
81
		taskDataHandler.initializeTaskData(taskData, server, project);
83
		taskDataHandler.initializeTaskData(taskData, server, project);
82
		if (taskSelection != null) {
84
		if (taskSelection != null) {
83
			taskDataHandler.cloneTaskData(taskSelection.getTaskData(), taskData);
85
			if (taskSelection.getTaskData() != null) {
84
		}		
86
				taskDataHandler.cloneTaskData(taskSelection.getTaskData(), taskData);
87
			}
88
			copyContextHandleIdentifier = taskSelection.getCopyContextHandleIdentifier();
89
		}
85
		taskData.setAttributeValue(RepositoryTaskAttribute.PRODUCT, project.getName());
90
		taskData.setAttributeValue(RepositoryTaskAttribute.PRODUCT, project.getName());
86
91
87
		NewTaskEditorInput editorInput = new NewTaskEditorInput(taskRepository, taskData);
92
		NewTaskEditorInput editorInput = new NewTaskEditorInput(taskRepository, taskData, copyContextHandleIdentifier);
88
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
93
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
89
		TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
94
		TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
90
		return true;
95
		return true;
(-)src/org/eclipse/mylyn/internal/context/ui/actions/ContextCopyAction.java (+11 lines)
Lines 17-25 Link Here
17
import org.eclipse.mylyn.internal.context.core.InteractionContext;
17
import org.eclipse.mylyn.internal.context.core.InteractionContext;
18
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants;
18
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiConstants;
19
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
19
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
20
import org.eclipse.mylyn.internal.tasks.ui.actions.NewTaskAction;
20
import org.eclipse.mylyn.internal.tasks.ui.actions.TaskSelectionDialog;
21
import org.eclipse.mylyn.internal.tasks.ui.actions.TaskSelectionDialog;
21
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
22
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
22
import org.eclipse.mylyn.tasks.core.AbstractTask;
23
import org.eclipse.mylyn.tasks.core.AbstractTask;
24
import org.eclipse.mylyn.tasks.core.TaskSelection;
23
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
25
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
24
import org.eclipse.ui.IViewPart;
26
import org.eclipse.ui.IViewPart;
25
import org.eclipse.ui.PlatformUI;
27
import org.eclipse.ui.PlatformUI;
Lines 77-82 Link Here
77
			return;
79
			return;
78
		}
80
		}
79
81
82
		if (dialog.isCreateNewTask()) {
83
			NewTaskAction action = new NewTaskAction();
84
			final TaskSelection taskSelection;
85
			taskSelection = new TaskSelection(sourceTask.getHandleIdentifier());
86
			if (action.showWizard(taskSelection) == Dialog.OK) {
87
				return;
88
			}
89
		}
90
80
		Object result = dialog.getFirstResult();
91
		Object result = dialog.getFirstResult();
81
92
82
		AbstractTask targetTask = null;
93
		AbstractTask targetTask = null;

Return to bug 206840