1 12 package org.eclipse.ui.internal; 13 14 import org.eclipse.ui.IPlaceholderFolderLayout; 15 16 25 public class PlaceholderFolderLayout implements IPlaceholderFolderLayout { 26 private PageLayout pageLayout; 27 28 private ContainerPlaceholder placeholder; 29 30 public PlaceholderFolderLayout(PageLayout pageLayout, 31 ContainerPlaceholder folder) { 32 super(); 33 this.placeholder = folder; 34 this.pageLayout = pageLayout; 35 } 36 37 40 public void addPlaceholder(String viewId) { 41 if (!pageLayout.checkValidPlaceholderId(viewId)) { 42 return; 43 } 44 45 LayoutPart newPart = new PartPlaceholder(viewId); 47 48 linkPartToPageLayout(viewId, newPart); 49 50 placeholder.add(newPart); 52 } 53 54 58 private void linkPartToPageLayout(String viewId, LayoutPart newPart) { 59 pageLayout.setRefPart(viewId, newPart); 60 pageLayout.getViewLayoutRec(viewId, true); 62 63 pageLayout.setFolderPart(viewId, placeholder); 64 newPart.setContainer(placeholder); 65 } 66 67 70 public String getProperty(String id) { 71 LayoutPart folder = placeholder.getRealContainer(); 72 if (folder instanceof PartStack) { 73 PartStack stack = (PartStack)folder; 74 return stack.getProperty(id); 75 } 76 return null; 78 } 79 80 83 public void setProperty(String id, String value) { 84 LayoutPart folder = placeholder.getRealContainer(); 85 if (folder instanceof PartStack) { 86 PartStack stack = (PartStack)folder; 87 stack.setProperty(id,value); 88 } 89 } 91 } 92 | Popular Tags |