|
Lines 330-336
Link Here
|
| 330 |
* folder. |
330 |
* folder. |
| 331 |
*/ |
331 |
*/ |
| 332 |
public boolean willPartBeVisible(String partId) { |
332 |
public boolean willPartBeVisible(String partId) { |
| 333 |
LayoutPart part = findPart(partId); |
333 |
return willPartBeVisible(partId, null); |
|
|
334 |
} |
| 335 |
public boolean willPartBeVisible(String partId, String secondaryId) { |
| 336 |
LayoutPart part = findPart(partId, secondaryId); |
| 334 |
if (part == null) |
337 |
if (part == null) |
| 335 |
return false; |
338 |
return false; |
| 336 |
ILayoutContainer container = part.getContainer(); |
339 |
ILayoutContainer container = part.getContainer(); |
|
Lines 742-769
Link Here
|
| 742 |
* Wild cards now supported. |
745 |
* Wild cards now supported. |
| 743 |
*/ |
746 |
*/ |
| 744 |
private LayoutPart findPart(String id) { |
747 |
private LayoutPart findPart(String id) { |
| 745 |
// Check main window. |
748 |
String myNull = null; |
| 746 |
LayoutPart part = findPart(id, mainLayout.getChildren()); |
749 |
return findPart(id, myNull); |
| 747 |
if (part != null) |
|
|
| 748 |
return part; |
| 749 |
|
| 750 |
// Check each detached windows |
| 751 |
for (int i = 0, length = detachedWindowList.size(); i < length; i++) { |
| 752 |
DetachedWindow window = (DetachedWindow) detachedWindowList.get(i); |
| 753 |
part = findPart(id, window.getChildren()); |
| 754 |
if (part != null) |
| 755 |
return part; |
| 756 |
} |
| 757 |
for (int i = 0; i < detachedPlaceHolderList.size(); i++) { |
| 758 |
DetachedPlaceHolder holder = |
| 759 |
(DetachedPlaceHolder) detachedPlaceHolderList.get(i); |
| 760 |
part = findPart(id, holder.getChildren()); |
| 761 |
if (part != null) |
| 762 |
return part; |
| 763 |
} |
| 764 |
|
| 765 |
// Not found. |
| 766 |
return null; |
| 767 |
} |
750 |
} |
| 768 |
/** |
751 |
/** |
| 769 |
* Find the first part that matches the specified |
752 |
* Find the first part that matches the specified |
|
Lines 772-792
Link Here
|
| 772 |
*/ |
755 |
*/ |
| 773 |
private LayoutPart findPart(String primaryId, String secondaryId) { |
756 |
private LayoutPart findPart(String primaryId, String secondaryId) { |
| 774 |
// check main window. |
757 |
// check main window. |
| 775 |
LayoutPart part = findPart(primaryId, secondaryId, mainLayout.getChildren()); |
758 |
LayoutPart part = (secondaryId != null) ? |
|
|
759 |
findPart(primaryId, secondaryId, mainLayout.getChildren()) : |
| 760 |
findPart(primaryId, mainLayout.getChildren()); |
| 776 |
if (part != null) |
761 |
if (part != null) |
| 777 |
return part; |
762 |
return part; |
| 778 |
|
763 |
|
| 779 |
// check each detached windows. |
764 |
// check each detached windows. |
| 780 |
for (int i = 0, length = detachedWindowList.size(); i < length; i++) { |
765 |
for (int i = 0, length = detachedWindowList.size(); i < length; i++) { |
| 781 |
DetachedWindow window = (DetachedWindow) detachedWindowList.get(i); |
766 |
DetachedWindow window = (DetachedWindow) detachedWindowList.get(i); |
| 782 |
part = findPart(primaryId, secondaryId, window.getChildren()); |
767 |
part = (secondaryId != null) ? |
|
|
768 |
findPart(primaryId, secondaryId, window.getChildren()) : |
| 769 |
findPart(primaryId, window.getChildren()); |
| 783 |
if (part != null) |
770 |
if (part != null) |
| 784 |
return part; |
771 |
return part; |
| 785 |
} |
772 |
} |
| 786 |
for (int i = 0; i < detachedPlaceHolderList.size(); i++) { |
773 |
for (int i = 0; i < detachedPlaceHolderList.size(); i++) { |
| 787 |
DetachedPlaceHolder holder = |
774 |
DetachedPlaceHolder holder = |
| 788 |
(DetachedPlaceHolder) detachedPlaceHolderList.get(i); |
775 |
(DetachedPlaceHolder) detachedPlaceHolderList.get(i); |
| 789 |
part = findPart(primaryId, secondaryId, holder.getChildren()); |
776 |
part = (secondaryId != null) ? |
|
|
777 |
findPart(primaryId, secondaryId, holder.getChildren()) : |
| 778 |
findPart(primaryId, holder.getChildren()) ; |
| 790 |
if (part != null) |
779 |
if (part != null) |
| 791 |
return part; |
780 |
return part; |
| 792 |
} |
781 |
} |
|
Lines 809-816
Link Here
|
| 809 |
MatchingPart currentMatchingPart = null; |
798 |
MatchingPart currentMatchingPart = null; |
| 810 |
for (int i = 0, length = parts.length; i < length; i++) { |
799 |
for (int i = 0, length = parts.length; i < length; i++) { |
| 811 |
LayoutPart part = parts[i]; |
800 |
LayoutPart part = parts[i]; |
|
|
801 |
// check for part equality, parts with secondary ids fail |
| 812 |
if (part.getID().equals(id)) { |
802 |
if (part.getID().equals(id)) { |
| 813 |
// parts with a secondary id do not match in this case |
|
|
| 814 |
if (part instanceof ViewPane) { |
803 |
if (part instanceof ViewPane) { |
| 815 |
ViewPane pane = (ViewPane) part; |
804 |
ViewPane pane = (ViewPane) part; |
| 816 |
IViewReference ref = (IViewReference)pane.getPartReference(); |
805 |
IViewReference ref = (IViewReference)pane.getPartReference(); |
|
Lines 818-834
Link Here
|
| 818 |
continue; |
807 |
continue; |
| 819 |
} |
808 |
} |
| 820 |
return part; |
809 |
return part; |
| 821 |
} |
810 |
} |
| 822 |
else if (part.getID().indexOf(WILD_CARD) != -1) { |
811 |
// check pattern matching placeholders |
|
|
812 |
else if (part instanceof PartPlaceholder && part.getID().indexOf(WILD_CARD) != -1) { |
| 823 |
StringMatcher sm = new StringMatcher(part.getID(), true, false); |
813 |
StringMatcher sm = new StringMatcher(part.getID(), true, false); |
| 824 |
MatchingPart matchingPart; |
814 |
MatchingPart matchingPart; |
| 825 |
if (sm.match(id)) { |
815 |
if (sm.match(id)) { |
| 826 |
matchingPart = new MatchingPart(part.getID(), null, part); |
816 |
matchingPart = new MatchingPart(part.getID(), null, part); |
| 827 |
if (currentMatchingPart != null && |
817 |
if (currentMatchingPart == null) |
| 828 |
matchingPart.pid.length() > currentMatchingPart.pid.length()) |
|
|
| 829 |
currentMatchingPart = matchingPart; |
| 830 |
else |
| 831 |
currentMatchingPart = matchingPart; |
818 |
currentMatchingPart = matchingPart; |
|
|
819 |
else if (matchingPart.pid.length() > currentMatchingPart.pid.length()) |
| 820 |
currentMatchingPart = matchingPart; |
| 832 |
} |
821 |
} |
| 833 |
} |
822 |
} |
| 834 |
else if (part instanceof EditorArea) { |
823 |
else if (part instanceof EditorArea) { |