1 11 package org.eclipse.ui.internal; 12 13 public class ContainerPlaceholder extends PartPlaceholder implements 14 ILayoutContainer { 15 private static int nextId = 0; 16 17 private ILayoutContainer realContainer; 18 19 24 public ContainerPlaceholder(String id) { 25 super(((id == null) ? "Container Placeholder " + nextId++ : id)); } 27 28 31 public void add(LayoutPart child) { 32 if (!(child instanceof PartPlaceholder)) { 33 return; 34 } 35 realContainer.add(child); 36 } 37 38 41 public boolean allowsBorder() { 42 return true; 43 } 44 45 48 public LayoutPart[] getChildren() { 49 return realContainer.getChildren(); 50 } 51 52 55 public LayoutPart getFocus() { 56 return null; 57 } 58 59 62 public LayoutPart getRealContainer() { 63 return (LayoutPart) realContainer; 64 } 65 66 69 public boolean isChildVisible(LayoutPart child) { 70 return false; 71 } 72 73 76 public void remove(LayoutPart child) { 77 if (!(child instanceof PartPlaceholder)) { 78 return; 79 } 80 realContainer.remove(child); 81 } 82 83 86 public void replace(LayoutPart oldChild, LayoutPart newChild) { 87 if (!(oldChild instanceof PartPlaceholder) 88 && !(newChild instanceof PartPlaceholder)) { 89 return; 90 } 91 realContainer.replace(oldChild, newChild); 92 } 93 94 97 public void setChildVisible(LayoutPart child, boolean visible) { 98 } 99 100 103 public void setFocus(LayoutPart child) { 104 } 105 106 public void setRealContainer(ILayoutContainer container) { 107 108 if (container == null) { 109 if (realContainer != null) { 111 LayoutPart[] children = realContainer.getChildren(); 112 if (children != null) { 113 for (int i = 0, length = children.length; i < length; i++) { 114 children[i].setContainer(realContainer); 115 } 116 } 117 } 118 } else { 119 LayoutPart[] children = container.getChildren(); 121 if (children != null) { 122 for (int i = 0, length = children.length; i < length; i++) { 123 children[i].setContainer(this); 124 } 125 } 126 } 127 128 this.realContainer = container; 129 } 130 131 public void findSashes(LayoutPart part, PartPane.Sashes sashes) { 132 ILayoutContainer container = getContainer(); 133 134 if (container != null) { 135 container.findSashes(this, sashes); 136 } 137 } 138 139 142 public boolean allowsAutoFocus() { 143 return false; 144 } 145 146 149 public boolean childIsZoomed(LayoutPart toTest) { 150 return false; 151 } 152 } 153 | Popular Tags |