Lines 40-46
Link Here
|
40 |
import org.eclipse.mylyn.tasks.core.ITaskContainer; |
40 |
import org.eclipse.mylyn.tasks.core.ITaskContainer; |
41 |
import org.eclipse.mylyn.tasks.ui.TasksUiUtil; |
41 |
import org.eclipse.mylyn.tasks.ui.TasksUiUtil; |
42 |
import org.eclipse.swt.dnd.DND; |
42 |
import org.eclipse.swt.dnd.DND; |
43 |
import org.eclipse.swt.dnd.DropTargetEvent; |
|
|
44 |
import org.eclipse.swt.dnd.FileTransfer; |
43 |
import org.eclipse.swt.dnd.FileTransfer; |
45 |
import org.eclipse.swt.dnd.TextTransfer; |
44 |
import org.eclipse.swt.dnd.TextTransfer; |
46 |
import org.eclipse.swt.dnd.TransferData; |
45 |
import org.eclipse.swt.dnd.TransferData; |
Lines 64-81
Link Here
|
64 |
} |
63 |
} |
65 |
|
64 |
|
66 |
@Override |
65 |
@Override |
67 |
public void dragOver(DropTargetEvent event) { |
|
|
68 |
// support dragging from sources only supporting DROP_LINK |
69 |
if (event.detail == DND.DROP_NONE && (event.operations & DND.DROP_LINK) == DND.DROP_LINK) { |
70 |
event.detail = DND.DROP_LINK; |
71 |
} |
72 |
super.dragOver(event); |
73 |
} |
74 |
|
75 |
@Override |
76 |
public boolean performDrop(final Object data) { |
66 |
public boolean performDrop(final Object data) { |
77 |
List<ITask> tasksToMove = new ArrayList<ITask>(); |
67 |
List<ITask> tasksToMove = new ArrayList<ITask>(); |
78 |
|
|
|
79 |
if (localTransfer) { |
68 |
if (localTransfer) { |
80 |
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); |
69 |
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); |
81 |
List<ITask> tasks = TasksUiInternal.getTasksFromSelection(selection); |
70 |
List<ITask> tasks = TasksUiInternal.getTasksFromSelection(selection); |
Lines 107-155
Link Here
|
107 |
} |
96 |
} |
108 |
} |
97 |
} |
109 |
} else { |
98 |
} else { |
110 |
for (ITask task : tasksToMove) { |
99 |
if (currentTarget instanceof ITask && getCurrentLocation() == ViewerDropAdapter.LOCATION_ON |
111 |
if (currentTarget instanceof UncategorizedTaskContainer) { |
100 |
&& getCurrentOperation() != DND.DROP_MOVE) { |
112 |
moveTask(task, (UncategorizedTaskContainer) currentTarget); |
101 |
// TODO call extension with currentOperation, currentTarget and tasksToMove |
113 |
} else if (currentTarget instanceof TaskCategory) { |
102 |
} else { |
114 |
moveTask(task, (TaskCategory) currentTarget); |
103 |
for (ITask task : tasksToMove) { |
115 |
} else if (currentTarget instanceof UnmatchedTaskContainer) { |
104 |
if (currentTarget instanceof UncategorizedTaskContainer) { |
116 |
if (((UnmatchedTaskContainer) currentTarget).getRepositoryUrl().equals(task.getRepositoryUrl())) { |
105 |
moveTask(task, (UncategorizedTaskContainer) currentTarget); |
117 |
moveTask(task, (AbstractTaskCategory) currentTarget); |
106 |
} else if (currentTarget instanceof TaskCategory) { |
118 |
} |
107 |
moveTask(task, (TaskCategory) currentTarget); |
119 |
} else if (currentTarget instanceof ITask) { |
108 |
} else if (currentTarget instanceof UnmatchedTaskContainer) { |
120 |
ITask targetTask = (ITask) currentTarget; |
109 |
if (((UnmatchedTaskContainer) currentTarget).getRepositoryUrl().equals(task.getRepositoryUrl())) { |
121 |
TaskListView view = TaskListView.getFromActivePerspective(); |
110 |
moveTask(task, (AbstractTaskCategory) currentTarget); |
122 |
if ((getCurrentLocation() == LOCATION_BEFORE || getCurrentLocation() == LOCATION_AFTER) |
|
|
123 |
&& view != null && view.isScheduledPresentation()) { |
124 |
if (targetTask instanceof AbstractTask) { |
125 |
DateRange targetDate = ((AbstractTask) targetTask).getScheduledForDate(); |
126 |
TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, targetDate); |
127 |
} |
111 |
} |
128 |
} else { |
112 |
} else if (currentTarget instanceof ITask) { |
129 |
AbstractTaskCategory targetCategory = null; |
113 |
ITask targetTask = (ITask) currentTarget; |
130 |
// TODO: TaskCategory only used what about AbstractTaskCategory descendants? |
114 |
TaskListView view = TaskListView.getFromActivePerspective(); |
131 |
ITaskContainer container = TaskCategory.getParentTaskCategory(targetTask); |
115 |
if ((getCurrentLocation() == LOCATION_BEFORE || getCurrentLocation() == LOCATION_AFTER) |
132 |
if (container instanceof TaskCategory || container instanceof UncategorizedTaskContainer) { |
116 |
&& view != null && view.isScheduledPresentation()) { |
133 |
targetCategory = (AbstractTaskCategory) container; |
117 |
if (targetTask instanceof AbstractTask) { |
134 |
} else if (container instanceof UnmatchedTaskContainer) { |
118 |
DateRange targetDate = ((AbstractTask) targetTask).getScheduledForDate(); |
135 |
if (((UnmatchedTaskContainer) container).getRepositoryUrl().equals(task.getRepositoryUrl())) { |
119 |
TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, targetDate); |
|
|
120 |
} |
121 |
} else { |
122 |
AbstractTaskCategory targetCategory = null; |
123 |
// TODO: TaskCategory only used what about AbstractTaskCategory descendants? |
124 |
ITaskContainer container = TaskCategory.getParentTaskCategory(targetTask); |
125 |
if (container instanceof TaskCategory || container instanceof UncategorizedTaskContainer) { |
136 |
targetCategory = (AbstractTaskCategory) container; |
126 |
targetCategory = (AbstractTaskCategory) container; |
|
|
127 |
} else if (container instanceof UnmatchedTaskContainer) { |
128 |
if (((UnmatchedTaskContainer) container).getRepositoryUrl().equals( |
129 |
task.getRepositoryUrl())) { |
130 |
targetCategory = (AbstractTaskCategory) container; |
131 |
} |
132 |
} |
133 |
if (targetCategory != null) { |
134 |
moveTask(task, targetCategory); |
137 |
} |
135 |
} |
138 |
} |
136 |
} |
139 |
if (targetCategory != null) { |
137 |
} else if (currentTarget instanceof ScheduledTaskContainer) { |
140 |
moveTask(task, targetCategory); |
138 |
ScheduledTaskContainer container = (ScheduledTaskContainer) currentTarget; |
|
|
139 |
if (container instanceof Unscheduled) { |
140 |
TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, null); |
141 |
} else if (isValidTarget(container)) { |
142 |
TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, |
143 |
container.getDateRange()); |
141 |
} |
144 |
} |
|
|
145 |
} else if (currentTarget == null) { |
146 |
moveTask(task, TasksUiPlugin.getTaskList().getDefaultCategory()); |
142 |
} |
147 |
} |
143 |
} else if (currentTarget instanceof ScheduledTaskContainer) { |
|
|
144 |
ScheduledTaskContainer container = (ScheduledTaskContainer) currentTarget; |
145 |
if (container instanceof Unscheduled) { |
146 |
TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, null); |
147 |
} else if (isValidTarget(container)) { |
148 |
TasksUiPlugin.getTaskActivityManager().setScheduledFor((AbstractTask) task, |
149 |
container.getDateRange()); |
150 |
} |
151 |
} else if (currentTarget == null) { |
152 |
moveTask(task, TasksUiPlugin.getTaskList().getDefaultCategory()); |
153 |
} |
148 |
} |
154 |
} |
149 |
} |
155 |
} |
150 |
} |
Lines 260-265
Link Here
|
260 |
return true; |
255 |
return true; |
261 |
} else if (target instanceof LocalTask && getCurrentLocation() == ViewerDropAdapter.LOCATION_ON) { |
256 |
} else if (target instanceof LocalTask && getCurrentLocation() == ViewerDropAdapter.LOCATION_ON) { |
262 |
return true; |
257 |
return true; |
|
|
258 |
} else if (target instanceof ITask && getCurrentLocation() == ViewerDropAdapter.LOCATION_ON |
259 |
&& getCurrentOperation() != DND.DROP_MOVE) { |
260 |
return true; |
263 |
} else { |
261 |
} else { |
264 |
return false; |
262 |
return false; |
265 |
} |
263 |
} |