1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.core.runtime.IConfigurationElement; 14 import org.eclipse.jface.viewers.ISelectionProvider; 15 import org.eclipse.ui.IWorkbenchPart; 16 17 23 public class PartPluginAction extends PluginAction { 24 27 public PartPluginAction(IConfigurationElement actionElement, String id, 28 int style) { 29 super(actionElement, id, style); 30 } 31 32 35 protected void registerSelectionListener(IWorkbenchPart aPart) { 36 ISelectionProvider selectionProvider = aPart.getSite() 37 .getSelectionProvider(); 38 if (selectionProvider != null) { 39 selectionProvider.addSelectionChangedListener(this); 40 selectionChanged(selectionProvider.getSelection()); 41 } 42 } 43 44 47 protected void unregisterSelectionListener(IWorkbenchPart aPart) { 48 ISelectionProvider selectionProvider = aPart.getSite() 49 .getSelectionProvider(); 50 if (selectionProvider != null) { 51 selectionProvider.removeSelectionChangedListener(this); 52 } 53 } 54 } 55 | Popular Tags |