1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.ui.IWorkbenchPage; 14 import org.eclipse.ui.IWorkbenchPartReference; 15 import org.eclipse.ui.IWorkbenchWindow; 16 17 20 public class MaximizePartAction extends PageEventAction { 21 22 27 public MaximizePartAction(IWorkbenchWindow window) { 28 super(WorkbenchMessages.MaximizePartAction_text, window); 29 setToolTipText(WorkbenchMessages.MaximizePartAction_toolTip); 30 updateState(); 32 window.getWorkbench().getHelpSystem().setHelp(this, 33 IWorkbenchHelpContextIds.MAXIMIZE_PART_ACTION); 34 setActionDefinitionId("org.eclipse.ui.window.maximizePart"); } 36 37 40 public void pageActivated(IWorkbenchPage page) { 41 super.pageActivated(page); 42 updateState(); 43 } 44 45 48 public void pageClosed(IWorkbenchPage page) { 49 super.pageClosed(page); 50 updateState(); 51 } 52 53 56 public void run() { 57 if (getWorkbenchWindow() == null) { 58 return; 60 } 61 62 IWorkbenchPage page = getActivePage(); 63 if (page != null) { 64 if (page instanceof WorkbenchPage) { 65 IWorkbenchPartReference partRef = page.getActivePartReference(); 66 67 if (partRef != null) { 68 ((WorkbenchPage) page).toggleZoom(partRef); 69 } 70 } 71 } 72 } 73 74 77 private void updateState() { 78 setEnabled(getActivePage() != null); 79 } 80 } 81 | Popular Tags |