1 11 package org.eclipse.ui.internal.presentations; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.ui.presentations.IStackPresentationSite; 15 16 21 public class SystemMenuStateChange extends Action implements 22 ISelfUpdatingAction { 23 private IStackPresentationSite site; 24 25 private int state; 26 27 public SystemMenuStateChange(IStackPresentationSite site, String name, 28 int state) { 29 this.site = site; 30 this.state = state; 31 32 setText(name); 33 update(); 34 } 35 36 public void dispose() { 37 this.site = null; 38 } 39 40 public void run() { 41 site.setState(state); 42 } 43 44 public void update() { 45 setEnabled(site.getState() != state && site.supportsState(state)); 46 } 47 48 public boolean shouldBeVisible() { 49 return site.supportsState(state); 50 } 51 52 } 53 | Popular Tags |