1 11 package org.eclipse.pde.internal.ui.search; 12 13 import org.eclipse.core.resources.IWorkspaceRunnable; 14 import org.eclipse.core.resources.ResourcesPlugin; 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.core.runtime.OperationCanceledException; 18 import org.eclipse.jface.operation.*; 19 import org.eclipse.pde.internal.core.search.IPluginSearchResultCollector; 20 import org.eclipse.pde.internal.core.search.PluginSearchInput; 21 import org.eclipse.pde.internal.core.search.PluginSearchOperation; 22 import org.eclipse.pde.internal.ui.PDEPlugin; 23 24 25 public class PluginSearchUIOperation 26 extends PluginSearchOperation 27 implements IWorkspaceRunnable, IRunnableWithProgress { 28 29 private static final String KEY_MATCH = "Search.singleMatch"; private static final String KEY_MATCHES = "Search.multipleMatches"; public PluginSearchUIOperation( 32 PluginSearchInput input, 33 IPluginSearchResultCollector collector) { 34 super(input, collector); 35 } 36 37 public void run(IProgressMonitor monitor) { 38 try { 39 IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() { 40 public void run(IProgressMonitor pm) throws CoreException { 41 execute(pm); 42 } 43 }; 44 ResourcesPlugin.getWorkspace().run( 45 workspaceRunnable, 46 monitor); 47 } catch (CoreException e) { 48 } catch (OperationCanceledException e) { 49 } 50 } 51 52 public String getPluralLabel() { 53 return input.getSearchString() + " - {0} " + PDEPlugin.getResourceString(KEY_MATCHES); } 55 56 public String getSingularLabel() { 57 return input.getSearchString() + " - 1 " + PDEPlugin.getResourceString(KEY_MATCH); } 59 60 61 } 62 | Popular Tags |