|
Lines 177-182
Link Here
|
| 177 |
* Find the sashs around the specified part. |
177 |
* Find the sashs around the specified part. |
| 178 |
*/ |
178 |
*/ |
| 179 |
public void findSashes(LayoutPart pane,PartPane.Sashes sashes) { |
179 |
public void findSashes(LayoutPart pane,PartPane.Sashes sashes) { |
|
|
180 |
if(root == null) { |
| 181 |
return; |
| 182 |
} |
| 180 |
LayoutTree part = root.find(pane); |
183 |
LayoutTree part = root.find(pane); |
| 181 |
if(part == null) |
184 |
if(part == null) |
| 182 |
return; |
185 |
return; |
|
Lines 365-372
Link Here
|
| 365 |
} |
368 |
} |
| 366 |
} |
369 |
} |
| 367 |
|
370 |
|
| 368 |
addChild(newRelationshipInfo); |
371 |
addChild(newRelationshipInfo); |
| 369 |
root.updateSashes(parent); |
372 |
if(root != null) { |
|
|
373 |
root.updateSashes(parent); |
| 374 |
} |
| 370 |
resizeSashes(parent.getClientArea()); |
375 |
resizeSashes(parent.getClientArea()); |
| 371 |
} |
376 |
} |
| 372 |
/** |
377 |
/** |
|
Lines 427-433
Link Here
|
| 427 |
child.createControl(parent); |
432 |
child.createControl(parent); |
| 428 |
} |
433 |
} |
| 429 |
|
434 |
|
| 430 |
root.updateSashes(parent); |
435 |
if(root != null) { |
|
|
436 |
root.updateSashes(parent); |
| 437 |
} |
| 431 |
active = true; |
438 |
active = true; |
| 432 |
resizeSashes(parent.getClientArea()); |
439 |
resizeSashes(parent.getClientArea()); |
| 433 |
} |
440 |
} |
|
Lines 479-485
Link Here
|
| 479 |
* Dispose all sashs used in this perspective. |
486 |
* Dispose all sashs used in this perspective. |
| 480 |
*/ |
487 |
*/ |
| 481 |
public void disposeSashes() { |
488 |
public void disposeSashes() { |
| 482 |
root.disposeSashes(); |
489 |
if(root != null) { |
|
|
490 |
root.disposeSashes(); |
| 491 |
} |
| 483 |
} |
492 |
} |
| 484 |
/** |
493 |
/** |
| 485 |
* Return the most bottom right part or null if none. |
494 |
* Return the most bottom right part or null if none. |
|
Lines 577-585
Link Here
|
| 577 |
return; |
586 |
return; |
| 578 |
|
587 |
|
| 579 |
children.remove(child); |
588 |
children.remove(child); |
| 580 |
root = root.remove(child); |
589 |
if(root != null) { |
| 581 |
if(root != null) |
590 |
root = root.remove(child); |
| 582 |
root.updateSashes(parent); |
591 |
if(root != null) { |
|
|
592 |
root.updateSashes(parent); |
| 593 |
} |
| 594 |
} |
| 583 |
childRemoved(child); |
595 |
childRemoved(child); |
| 584 |
|
596 |
|
| 585 |
if (active){ |
597 |
if (active){ |
|
Lines 595-609
Link Here
|
| 595 |
if (isZoomed()) |
607 |
if (isZoomed()) |
| 596 |
zoomOut(); |
608 |
zoomOut(); |
| 597 |
|
609 |
|
| 598 |
if (!isChild(oldChild))return; |
610 |
if (!isChild(oldChild)) { |
| 599 |
|
611 |
return; |
|
|
612 |
} |
| 613 |
|
| 614 |
LayoutTree leaf = null; |
| 615 |
if (root != null) { |
| 616 |
leaf = root.find(oldChild); |
| 617 |
} |
| 618 |
|
| 619 |
if (leaf == null) { |
| 620 |
return; |
| 621 |
} |
| 622 |
|
| 600 |
children.remove(oldChild); |
623 |
children.remove(oldChild); |
| 601 |
children.add(newChild); |
624 |
children.add(newChild); |
| 602 |
|
625 |
|
| 603 |
childAdded(newChild); |
626 |
childAdded(newChild); |
| 604 |
LayoutTree leaf = root.find(oldChild); |
627 |
|
| 605 |
leaf.setPart(newChild); |
628 |
leaf.setPart(newChild); |
| 606 |
root.updateSashes(parent); |
629 |
if (root != null) { |
|
|
630 |
root.updateSashes(parent); |
| 631 |
} |
| 607 |
|
632 |
|
| 608 |
childRemoved(oldChild); |
633 |
childRemoved(oldChild); |
| 609 |
if (active){ |
634 |
if (active){ |
|
Lines 617-623
Link Here
|
| 617 |
} |
642 |
} |
| 618 |
private void resizeSashes(Rectangle parentSize) { |
643 |
private void resizeSashes(Rectangle parentSize) { |
| 619 |
if (!active) return; |
644 |
if (!active) return; |
| 620 |
root.setBounds(parentSize); |
645 |
if (root != null) { |
|
|
646 |
root.setBounds(parentSize); |
| 647 |
} |
| 621 |
} |
648 |
} |
| 622 |
/** |
649 |
/** |
| 623 |
* @see LayoutPart#setBounds |
650 |
* @see LayoutPart#setBounds |
|
Lines 696-702
Link Here
|
| 696 |
ILayoutContainer sourceContainer = isStackType(sourcePart) ? (ILayoutContainer)sourcePart : sourcePart.getContainer(); |
723 |
ILayoutContainer sourceContainer = isStackType(sourcePart) ? (ILayoutContainer)sourcePart : sourcePart.getContainer(); |
| 697 |
|
724 |
|
| 698 |
if (containerBounds.contains(position)) { |
725 |
if (containerBounds.contains(position)) { |
| 699 |
targetPart = root.findPart(parent.toControl(position)); |
726 |
|
|
|
727 |
if (root != null) { |
| 728 |
targetPart = root.findPart(parent.toControl(position)); |
| 729 |
} |
| 700 |
|
730 |
|
| 701 |
if (targetPart != null) { |
731 |
if (targetPart != null) { |
| 702 |
final Control targetControl = targetPart.getControl(); |
732 |
final Control targetControl = targetPart.getControl(); |
|
Lines 887-892
Link Here
|
| 887 |
* @param buf |
917 |
* @param buf |
| 888 |
*/ |
918 |
*/ |
| 889 |
public void describeLayout(StringBuffer buf) { |
919 |
public void describeLayout(StringBuffer buf) { |
|
|
920 |
if (root == null) { |
| 921 |
return; |
| 922 |
} |
| 923 |
|
| 890 |
if (isZoomed()) { |
924 |
if (isZoomed()) { |
| 891 |
buf.append("zoomed "); //$NON-NLS-1$ |
925 |
buf.append("zoomed "); //$NON-NLS-1$ |
| 892 |
root.describeLayout(buf); |
926 |
root.describeLayout(buf); |