1 11 package org.eclipse.jdt.ui.actions; 12 13 import org.eclipse.core.runtime.Assert; 14 15 import org.eclipse.ui.IWorkbenchSite; 16 import org.eclipse.ui.PlatformUI; 17 18 import org.eclipse.jdt.core.IJavaElement; 19 20 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 21 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; 22 23 36 public class WorkingSetFindAction extends FindAction { 37 38 private FindAction fAction; 39 40 43 public WorkingSetFindAction(IWorkbenchSite site, FindAction action, String workingSetName) { 44 super(site); 45 init(action, workingSetName); 46 } 47 48 51 public WorkingSetFindAction(JavaEditor editor, FindAction action, String workingSetName) { 52 super(editor); 53 init(action, workingSetName); 54 } 55 56 Class [] getValidTypes() { 57 return null; } 59 60 void init() { 61 } 63 64 private void init(FindAction action, String workingSetName) { 65 Assert.isNotNull(action); 66 fAction= action; 67 setText(workingSetName); 68 setImageDescriptor(action.getImageDescriptor()); 69 setToolTipText(action.getToolTipText()); 70 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.WORKING_SET_FIND_ACTION); 71 } 72 73 public void run(IJavaElement element) { 74 fAction.run(element); 75 } 76 77 boolean canOperateOn(IJavaElement element) { 78 return fAction.canOperateOn(element); 79 } 80 81 int getLimitTo() { 82 return -1; 83 } 84 85 String getOperationUnavailableMessage() { 86 return fAction.getOperationUnavailableMessage(); 87 } 88 89 } 90 | Popular Tags |