/** * Copyright (c) 2005-2013 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Eclipse Public License (EPL). * Please see the license.txt included with this distribution for details. * Any modifications to this file must keep this entire header intact. */ package org.python.pydev.debug.pyunit; import java.lang.ref.WeakReference; import org.eclipse.jface.action.Action; import org.python.pydev.plugin.PydevPlugin; import org.python.pydev.shared_ui.UIConstants; public class RelaunchErrorsAction extends Action { private WeakReference<PyUnitView> view; public RelaunchErrorsAction(PyUnitView pyUnitView) { this.view = new WeakReference<PyUnitView>(pyUnitView); this.setImageDescriptor(PydevPlugin.getImageCache().getDescriptor(UIConstants.RELAUNCH_ERRORS)); this.setToolTipText("Relaunches only the errors in the currently selected test run."); } @Override public void run() { PyUnitView pyUnitView = view.get(); PyUnitTestRun currentTestRun = pyUnitView.getCurrentTestRun(); if (currentTestRun != null) { currentTestRun.relaunchOnlyErrors(); } } }