1 11 package org.eclipse.ui.internal.presentations; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.ui.internal.WorkbenchMessages; 15 import org.eclipse.ui.presentations.IPresentablePart; 16 import org.eclipse.ui.presentations.IStackPresentationSite; 17 18 25 public final class SystemMenuClose extends Action implements ISelfUpdatingAction { 26 27 private IStackPresentationSite site; 28 private IPresentablePart part; 29 30 public SystemMenuClose(IStackPresentationSite site) { 31 this.site = site; 32 setText(WorkbenchMessages.PartPane_close); 33 } 34 35 public void dispose() { 36 site = null; 37 } 38 39 public void run() { 40 if (part != null) { 41 site.close(new IPresentablePart[] { part }); 42 } 43 } 44 45 public void setTarget(IPresentablePart presentablePart) { 46 this.part = presentablePart; 47 setEnabled(presentablePart != null && site.isCloseable(presentablePart)); 48 } 49 50 53 public void update() { 54 setTarget(site.getSelectedPart()); 55 } 56 57 60 public boolean shouldBeVisible() { 61 return true; 62 } 63 } 64 | Popular Tags |