1 11 package org.eclipse.ui.actions; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.ui.IPartListener; 15 import org.eclipse.ui.IWorkbenchPart; 16 17 44 public abstract class PartEventAction extends Action implements IPartListener { 45 46 49 private IWorkbenchPart activePart; 50 51 56 protected PartEventAction(String text) { 57 super(text); 58 } 59 60 69 protected PartEventAction(String text, int style) { 70 super(text, style); 71 } 72 73 78 public IWorkbenchPart getActivePart() { 79 return activePart; 80 } 81 82 88 public void partActivated(IWorkbenchPart part) { 89 activePart = part; 90 } 91 92 97 public void partBroughtToTop(IWorkbenchPart part) { 98 } 100 101 107 public void partClosed(IWorkbenchPart part) { 108 if (part == activePart) { 109 activePart = null; 110 } 111 } 112 113 119 public void partDeactivated(IWorkbenchPart part) { 120 activePart = null; 121 } 122 123 128 public void partOpened(IWorkbenchPart part) { 129 } 131 } 132 | Popular Tags |