1 11 package org.eclipse.jface.action; 12 13 import org.eclipse.swt.widgets.Composite; 14 import org.eclipse.swt.widgets.CoolBar; 15 import org.eclipse.swt.widgets.Menu; 16 import org.eclipse.swt.widgets.ToolBar; 17 18 26 public class SubContributionItem implements IContributionItem { 27 30 private boolean visible; 31 32 35 private IContributionItem innerItem; 36 37 41 public SubContributionItem(IContributionItem item) { 42 innerItem = item; 43 } 44 45 49 public void dispose() { 50 innerItem.dispose(); 51 } 52 53 56 public void fill(Composite parent) { 57 if (visible) { 58 innerItem.fill(parent); 59 } 60 } 61 62 65 public void fill(Menu parent, int index) { 66 if (visible) { 67 innerItem.fill(parent, index); 68 } 69 } 70 71 74 public void fill(ToolBar parent, int index) { 75 if (visible) { 76 innerItem.fill(parent, index); 77 } 78 } 79 80 83 public String getId() { 84 return innerItem.getId(); 85 } 86 87 92 public IContributionItem getInnerItem() { 93 return innerItem; 94 } 95 96 99 public boolean isEnabled() { 100 return innerItem.isEnabled(); 101 } 102 103 106 public boolean isDirty() { 107 return innerItem.isDirty(); 108 } 109 110 113 public boolean isDynamic() { 114 return innerItem.isDynamic(); 115 } 116 117 120 public boolean isGroupMarker() { 121 return innerItem.isGroupMarker(); 122 } 123 124 127 public boolean isSeparator() { 128 return innerItem.isSeparator(); 129 } 130 131 134 public boolean isVisible() { 135 return visible && innerItem.isVisible(); 136 } 137 138 141 public void setParent(IContributionManager parent) { 142 } 145 146 149 public void setVisible(boolean visible) { 150 this.visible = visible; 151 } 152 153 156 public void update() { 157 innerItem.update(); 158 } 159 160 163 public void update(String id) { 164 innerItem.update(id); 165 } 166 167 170 public void fill(CoolBar parent, int index) { 171 if (visible) { 172 innerItem.fill(parent, index); 173 } 174 } 175 176 179 public void saveWidgetState() { 180 } 181 182 } 183 | Popular Tags |