1 11 package org.eclipse.pde.internal.ui.search.dependencies; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.core.runtime.IProgressMonitor; 16 import org.eclipse.core.runtime.IStatus; 17 import org.eclipse.core.runtime.Status; 18 import org.eclipse.core.runtime.jobs.Job; 19 import org.eclipse.jface.action.Action; 20 import org.eclipse.pde.core.plugin.IPluginModelBase; 21 import org.eclipse.pde.internal.ui.PDEPlugin; 22 import org.eclipse.pde.internal.ui.PDEUIMessages; 23 import org.eclipse.swt.widgets.Display; 24 25 26 public class UnusedDependenciesJob extends Job { 27 28 29 private IPluginModelBase fModel; 30 private boolean fReadOnly; 31 32 public UnusedDependenciesJob(String name, IPluginModelBase model, boolean readOnly) { 33 super(name); 34 fModel = model; 35 fReadOnly = readOnly; 36 } 37 38 41 protected IStatus run(IProgressMonitor monitor) { 42 try { 43 GatherUnusedDependenciesOperation udo = new GatherUnusedDependenciesOperation(fModel); 44 udo.run(monitor); 45 showResults(udo.getList().toArray()); 47 } catch (InvocationTargetException e) { 48 } catch (InterruptedException e) { 49 } finally { 50 monitor.done(); 51 } 52 return new Status(IStatus.OK, PDEPlugin.getPluginId(), IStatus.OK, PDEUIMessages.UnusedDependenciesJob_viewResults, null); 53 } 54 55 56 57 private Action getShowResultsAction(Object [] unused) { 58 return new ShowResultsAction(fModel, unused, fReadOnly); 59 } 60 61 protected void showResults(final Object [] unused) { 62 Display.getDefault().asyncExec(new Runnable () { 63 public void run() { 64 getShowResultsAction(unused).run(); 65 } 66 }); 67 } 68 } 69 | Popular Tags |