|
Lines 291-314
Link Here
|
| 291 |
} |
291 |
} |
| 292 |
|
292 |
|
| 293 |
/** |
293 |
/** |
| 294 |
* Answer a list of the view panes. |
|
|
| 295 |
*/ |
| 296 |
private DetachedWindow[] collectDetachedWindows(Window[] windows) { |
| 297 |
DetachedWindow[] result = new DetachedWindow[0]; |
| 298 |
for (int i = 0, length = windows.length; i < length; i++) { |
| 299 |
if (windows[i] instanceof DetachedWindow |
| 300 |
&& ((DetachedWindow) windows[i]).belongsToWorkbenchPage(page)) { |
| 301 |
DetachedWindow[] newResult = |
| 302 |
new DetachedWindow[result.length + 1]; |
| 303 |
System.arraycopy(result, 0, newResult, 0, result.length); |
| 304 |
newResult[result.length] = (DetachedWindow) windows[i]; |
| 305 |
result = newResult; |
| 306 |
} |
| 307 |
} |
| 308 |
return result; |
| 309 |
} |
| 310 |
|
| 311 |
/** |
| 312 |
* Open the tracker to allow the user to move the specified part using |
294 |
* Open the tracker to allow the user to move the specified part using |
| 313 |
* keyboard. |
295 |
* keyboard. |
| 314 |
*/ |
296 |
*/ |
|
Lines 316-337
Link Here
|
| 316 |
DragUtil.performDrag(pane, DragUtil.getDisplayBounds(pane.getControl())); |
298 |
DragUtil.performDrag(pane, DragUtil.getDisplayBounds(pane.getControl())); |
| 317 |
} |
299 |
} |
| 318 |
/** |
300 |
/** |
| 319 |
* Answer a list of the view panes. |
|
|
| 320 |
*/ |
| 321 |
private void collectDragParts(List result, LayoutPart[] parts) { |
| 322 |
for (int i = 0, length = parts.length; i < length; i++) { |
| 323 |
LayoutPart part = parts[i]; |
| 324 |
if (part instanceof ViewPane) { |
| 325 |
result.add(part); |
| 326 |
} else if (part instanceof ILayoutContainer) { |
| 327 |
collectDragParts( |
| 328 |
result, |
| 329 |
((ILayoutContainer) part).getChildren()); |
| 330 |
} |
| 331 |
} |
| 332 |
} |
| 333 |
|
| 334 |
/** |
| 335 |
* Answer a list of the PartPlaceholder objects. |
301 |
* Answer a list of the PartPlaceholder objects. |
| 336 |
*/ |
302 |
*/ |
| 337 |
private PartPlaceholder[] collectPlaceholders() { |
303 |
private PartPlaceholder[] collectPlaceholders() { |
|
Lines 440-446
Link Here
|
| 440 |
disableAllDrag(); |
406 |
disableAllDrag(); |
| 441 |
|
407 |
|
| 442 |
// Reparent all views to the main window |
408 |
// Reparent all views to the main window |
| 443 |
Composite parent = (Composite) mainLayout.getParent(); |
409 |
Composite parent = mainLayout.getParent(); |
| 444 |
Vector children = new Vector(); |
410 |
Vector children = new Vector(); |
| 445 |
collectViewPanes(children, mainLayout.getChildren()); |
411 |
collectViewPanes(children, mainLayout.getChildren()); |
| 446 |
|
412 |
|
|
Lines 477-483
Link Here
|
| 477 |
ILayoutContainer oldContainer = part.getContainer(); |
443 |
ILayoutContainer oldContainer = part.getContainer(); |
| 478 |
|
444 |
|
| 479 |
// Reparent the part back to the main window |
445 |
// Reparent the part back to the main window |
| 480 |
part.reparent((Composite) mainLayout.getParent()); |
446 |
part.reparent(mainLayout.getParent()); |
| 481 |
|
447 |
|
| 482 |
// Update container. |
448 |
// Update container. |
| 483 |
if (oldContainer == null) |
449 |
if (oldContainer == null) |
|
Lines 903-909
Link Here
|
| 903 |
} else if (newContainer instanceof PartTabFolder) { |
869 |
} else if (newContainer instanceof PartTabFolder) { |
| 904 |
// move this part relative to the folder |
870 |
// move this part relative to the folder |
| 905 |
// rather than relative to the part in the folder |
871 |
// rather than relative to the part in the folder |
| 906 |
movePart(part, position, (PartTabFolder) newContainer); |
872 |
movePart(part, position, newContainer); |
| 907 |
} |
873 |
} |
| 908 |
} |
874 |
} |
| 909 |
/** |
875 |
/** |
|
Lines 979-992
Link Here
|
| 979 |
// If drop target is not registered object then reject. |
945 |
// If drop target is not registered object then reject. |
| 980 |
if (e.dropTarget == null |
946 |
if (e.dropTarget == null |
| 981 |
&& e.relativePosition != DragCursors.OFFSCREEN) { |
947 |
&& e.relativePosition != DragCursors.OFFSCREEN) { |
| 982 |
e.dropTarget = null; |
948 |
e.relativePosition = DragCursors.INVALID; |
| 983 |
e.relativePosition = offScreenPosition; |
949 |
//e.dropTarget = null; |
|
|
950 |
//e.relativePosition = offScreenPosition; |
| 984 |
return; |
951 |
return; |
| 985 |
} |
952 |
} |
| 986 |
|
953 |
|
| 987 |
// If drop target is not over view, or tab folder, reject. |
954 |
// If drop target is not over view, or tab folder, reject. |
| 988 |
if (!(e.dropTarget instanceof ViewPane |
955 |
if (!(e.dropTarget instanceof ViewPane |
| 989 |
|| e.dropTarget instanceof PartTabFolder)) { |
956 |
|| e.dropTarget instanceof PartTabFolder)) { |
|
|
957 |
//e.relativePosition = DragCursors.INVALID; |
| 990 |
e.dropTarget = null; |
958 |
e.dropTarget = null; |
| 991 |
e.relativePosition = offScreenPosition; |
959 |
e.relativePosition = offScreenPosition; |
| 992 |
return; |
960 |
return; |
|
Lines 994-999
Link Here
|
| 994 |
|
962 |
|
| 995 |
// If drag source is view .. |
963 |
// If drag source is view .. |
| 996 |
if (e.dragSource instanceof ViewPane) { |
964 |
if (e.dragSource instanceof ViewPane) { |
|
|
965 |
// If target is detached window force stacking. |
| 966 |
Window window = e.dropTarget.getWindow(); |
| 967 |
if (window instanceof DetachedWindow) { |
| 968 |
//e.relativePosition = DragCursors.CENTER; |
| 969 |
e.relativePosition = offScreenPosition; |
| 970 |
return; |
| 971 |
} |
| 972 |
|
| 997 |
if (e.dragSource == e.dropTarget) { |
973 |
if (e.dragSource == e.dropTarget) { |
| 998 |
// Reject stack onto same view |
974 |
// Reject stack onto same view |
| 999 |
if (e.relativePosition == DragCursors.CENTER) { |
975 |
if (e.relativePosition == DragCursors.CENTER) { |
|
Lines 1023-1035
Link Here
|
| 1023 |
e.relativePosition = DragCursors.INVALID; |
999 |
e.relativePosition = DragCursors.INVALID; |
| 1024 |
return; |
1000 |
return; |
| 1025 |
} |
1001 |
} |
| 1026 |
} |
|
|
| 1027 |
|
| 1028 |
// If target is detached window force stacking. |
| 1029 |
Window window = e.dropTarget.getWindow(); |
| 1030 |
if (window instanceof DetachedWindow) { |
| 1031 |
e.relativePosition = DragCursors.CENTER; |
| 1032 |
return; |
| 1033 |
} |
1002 |
} |
| 1034 |
|
1003 |
|
| 1035 |
// All seems well |
1004 |
// All seems well |