1 11 package org.eclipse.pde.internal.ui.search; 12 13 import org.eclipse.pde.core.plugin.IFragment; 14 import org.eclipse.pde.core.plugin.IPlugin; 15 import org.eclipse.pde.core.plugin.IPluginExtension; 16 import org.eclipse.pde.core.plugin.IPluginImport; 17 import org.eclipse.pde.internal.core.search.PluginSearchInput; 18 import org.eclipse.pde.internal.core.search.PluginSearchScope; 19 import org.eclipse.pde.internal.ui.PDEPluginImages; 20 import org.eclipse.pde.internal.ui.PDEUIMessages; 21 import org.eclipse.search.ui.ISearchQuery; 22 23 24 public class FindDeclarationsAction extends BaseSearchAction { 25 26 private Object fSelectedObject; 27 28 public FindDeclarationsAction(Object object) { 29 super(PDEUIMessages.SearchAction_Declaration); 30 setImageDescriptor(PDEPluginImages.DESC_PSEARCH_OBJ); 31 this.fSelectedObject = object; 32 } 33 34 protected ISearchQuery createSearchQuery() { 35 PluginSearchInput input = new PluginSearchInput(); 36 37 if (fSelectedObject instanceof IPluginImport) { 38 input.setSearchString(((IPluginImport) fSelectedObject).getId()); 39 input.setSearchElement(PluginSearchInput.ELEMENT_PLUGIN); 40 } else if (fSelectedObject instanceof IPluginExtension) { 41 input.setSearchString(((IPluginExtension)fSelectedObject).getPoint()); 42 input.setSearchElement(PluginSearchInput.ELEMENT_EXTENSION_POINT); 43 } else if (fSelectedObject instanceof IPlugin) { 44 input.setSearchString(((IPlugin)fSelectedObject).getId()); 45 input.setSearchElement(PluginSearchInput.ELEMENT_PLUGIN); 46 } else if (fSelectedObject instanceof IFragment) { 47 input.setSearchString(((IFragment)fSelectedObject).getId()); 48 input.setSearchElement(PluginSearchInput.ELEMENT_FRAGMENT); 49 } 50 input.setSearchLimit(PluginSearchInput.LIMIT_DECLARATIONS); 51 input.setSearchScope(new PluginSearchScope()); 52 return new PluginSearchQuery(input); 53 } 54 55 } 56 | Popular Tags |