1 11 package org.eclipse.jdt.internal.junit.ui; 12 13 14 import org.eclipse.swt.events.DisposeEvent; 15 import org.eclipse.swt.events.DisposeListener; 16 17 import org.eclipse.jface.action.Action; 18 19 import org.eclipse.jdt.internal.junit.model.TestElement; 20 21 24 public class CompareResultsAction extends Action { 25 26 private FailureTrace fView; 27 private CompareResultDialog fOpenDialog; 28 29 public CompareResultsAction(FailureTrace view) { 30 super(JUnitMessages.CompareResultsAction_label); 31 setDescription(JUnitMessages.CompareResultsAction_description); 32 setToolTipText(JUnitMessages.CompareResultsAction_tooltip); 33 34 setDisabledImageDescriptor(JUnitPlugin.getImageDescriptor("dlcl16/compare.gif")); setHoverImageDescriptor(JUnitPlugin.getImageDescriptor("elcl16/compare.gif")); setImageDescriptor(JUnitPlugin.getImageDescriptor("elcl16/compare.gif")); fView= view; 39 } 40 41 44 public void run() { 45 TestElement failedTest= fView.getFailedTest(); 46 if (fOpenDialog != null) { 47 fOpenDialog.setInput(failedTest); 48 fOpenDialog.getShell().setActive(); 49 50 } else { 51 fOpenDialog= new CompareResultDialog(fView.getShell(), failedTest); 52 fOpenDialog.create(); 53 fOpenDialog.getShell().addDisposeListener(new DisposeListener() { 54 public void widgetDisposed(DisposeEvent e) { 55 fOpenDialog= null; 56 } 57 }); 58 fOpenDialog.setBlockOnOpen(false); 59 fOpenDialog.open(); 60 } 61 } 62 63 public void updateOpenDialog(TestElement failedTest) { 64 if (fOpenDialog != null) { 65 fOpenDialog.setInput(failedTest); 66 } 67 } 68 } 69 | Popular Tags |