Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2013 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2014 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 16-21
Link Here
|
16 |
* Andrew Eisenberg <andrew@eisenberg.as> - [JUnit] Rerun failed first does not work with JUnit4 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=140392 |
16 |
* Andrew Eisenberg <andrew@eisenberg.as> - [JUnit] Rerun failed first does not work with JUnit4 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=140392 |
17 |
* Thirumala Reddy Mutchukota <thirumala@google.com> - [JUnit] Avoid rerun test launch on UI thread - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411841 |
17 |
* Thirumala Reddy Mutchukota <thirumala@google.com> - [JUnit] Avoid rerun test launch on UI thread - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411841 |
18 |
* Andrew Eisenberg <andrew@eisenberg.as> - [JUnit] Add a monospace font option for the junit results view - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411794 |
18 |
* Andrew Eisenberg <andrew@eisenberg.as> - [JUnit] Add a monospace font option for the junit results view - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411794 |
|
|
19 |
* Xavier Coulon <xcoulon@redhat.com> - [JUnit] Add "Link with Editor" to JUnit view - https://bugs.eclipse.org/bugs/show_bug.cgi?id=372588 |
19 |
*******************************************************************************/ |
20 |
*******************************************************************************/ |
20 |
package org.eclipse.jdt.internal.junit.ui; |
21 |
package org.eclipse.jdt.internal.junit.ui; |
21 |
|
22 |
|
Lines 96-101
Link Here
|
96 |
import org.eclipse.jface.dialogs.MessageDialog; |
97 |
import org.eclipse.jface.dialogs.MessageDialog; |
97 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
98 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
98 |
import org.eclipse.jface.resource.ImageDescriptor; |
99 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
|
100 |
import org.eclipse.jface.viewers.ISelection; |
99 |
|
101 |
|
100 |
import org.eclipse.ui.IActionBars; |
102 |
import org.eclipse.ui.IActionBars; |
101 |
import org.eclipse.ui.IEditorActionBarContributor; |
103 |
import org.eclipse.ui.IEditorActionBarContributor; |
Lines 149-154
Link Here
|
149 |
|
151 |
|
150 |
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
152 |
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; |
151 |
|
153 |
|
|
|
154 |
import org.eclipse.jdt.internal.ui.JavaPluginImages; |
155 |
import org.eclipse.jdt.internal.ui.actions.AbstractToggleLinkingAction; |
152 |
import org.eclipse.jdt.internal.ui.viewsupport.ViewHistory; |
156 |
import org.eclipse.jdt.internal.ui.viewsupport.ViewHistory; |
153 |
|
157 |
|
154 |
/** |
158 |
/** |
Lines 159-185
Link Here
|
159 |
public static final String NAME= "org.eclipse.jdt.junit.ResultView"; //$NON-NLS-1$ |
163 |
public static final String NAME= "org.eclipse.jdt.junit.ResultView"; //$NON-NLS-1$ |
160 |
|
164 |
|
161 |
private static final String RERUN_LAST_COMMAND= "org.eclipse.jdt.junit.junitShortcut.rerunLast"; //$NON-NLS-1$ |
165 |
private static final String RERUN_LAST_COMMAND= "org.eclipse.jdt.junit.junitShortcut.rerunLast"; //$NON-NLS-1$ |
|
|
166 |
|
162 |
private static final String RERUN_FAILED_FIRST_COMMAND= "org.eclipse.jdt.junit.junitShortcut.rerunFailedFirst"; //$NON-NLS-1$ |
167 |
private static final String RERUN_FAILED_FIRST_COMMAND= "org.eclipse.jdt.junit.junitShortcut.rerunFailedFirst"; //$NON-NLS-1$ |
163 |
|
168 |
|
164 |
static final int REFRESH_INTERVAL= 200; |
169 |
static final int REFRESH_INTERVAL= 200; |
165 |
|
170 |
|
166 |
static final int LAYOUT_FLAT= 0; |
171 |
static final int LAYOUT_FLAT= 0; |
|
|
172 |
|
167 |
static final int LAYOUT_HIERARCHICAL= 1; |
173 |
static final int LAYOUT_HIERARCHICAL= 1; |
168 |
|
174 |
|
169 |
/** |
175 |
/** |
170 |
* Whether the output scrolls and reveals tests as they are executed. |
176 |
* Whether the output scrolls and reveals tests as they are executed. |
171 |
*/ |
177 |
*/ |
172 |
protected boolean fAutoScroll = true; |
178 |
protected boolean fAutoScroll= true; |
|
|
179 |
|
173 |
/** |
180 |
/** |
174 |
* The current orientation; either <code>VIEW_ORIENTATION_HORIZONTAL</code> |
181 |
* The current orientation; either <code>VIEW_ORIENTATION_HORIZONTAL</code> |
175 |
* <code>VIEW_ORIENTATION_VERTICAL</code>, or <code>VIEW_ORIENTATION_AUTOMATIC</code>. |
182 |
* <code>VIEW_ORIENTATION_VERTICAL</code>, or <code>VIEW_ORIENTATION_AUTOMATIC</code>. |
176 |
*/ |
183 |
*/ |
177 |
private int fOrientation= VIEW_ORIENTATION_AUTOMATIC; |
184 |
private int fOrientation= VIEW_ORIENTATION_AUTOMATIC; |
|
|
185 |
|
178 |
/** |
186 |
/** |
179 |
* The current orientation; either <code>VIEW_ORIENTATION_HORIZONTAL</code> |
187 |
* The current orientation; either <code>VIEW_ORIENTATION_HORIZONTAL</code> |
180 |
* <code>VIEW_ORIENTATION_VERTICAL</code>. |
188 |
* <code>VIEW_ORIENTATION_VERTICAL</code>. |
181 |
*/ |
189 |
*/ |
182 |
private int fCurrentOrientation; |
190 |
private int fCurrentOrientation; |
|
|
191 |
|
183 |
/** |
192 |
/** |
184 |
* The current layout mode (LAYOUT_FLAT or LAYOUT_HIERARCHICAL). |
193 |
* The current layout mode (LAYOUT_FLAT or LAYOUT_HIERARCHICAL). |
185 |
*/ |
194 |
*/ |
Lines 188-203
Link Here
|
188 |
// private boolean fTestIsRunning= false; |
197 |
// private boolean fTestIsRunning= false; |
189 |
|
198 |
|
190 |
protected JUnitProgressBar fProgressBar; |
199 |
protected JUnitProgressBar fProgressBar; |
|
|
200 |
|
191 |
protected ProgressImages fProgressImages; |
201 |
protected ProgressImages fProgressImages; |
|
|
202 |
|
192 |
protected Image fViewImage; |
203 |
protected Image fViewImage; |
|
|
204 |
|
193 |
protected CounterPanel fCounterPanel; |
205 |
protected CounterPanel fCounterPanel; |
|
|
206 |
|
194 |
protected boolean fShowOnErrorOnly= false; |
207 |
protected boolean fShowOnErrorOnly= false; |
|
|
208 |
|
195 |
protected Clipboard fClipboard; |
209 |
protected Clipboard fClipboard; |
|
|
210 |
|
196 |
protected volatile String fInfoMessage; |
211 |
protected volatile String fInfoMessage; |
197 |
|
212 |
|
198 |
private FailureTrace fFailureTrace; |
213 |
private FailureTrace fFailureTrace; |
199 |
|
214 |
|
200 |
private TestViewer fTestViewer; |
215 |
private TestViewer fTestViewer; |
|
|
216 |
|
201 |
/** |
217 |
/** |
202 |
* Is the UI disposed? |
218 |
* Is the UI disposed? |
203 |
*/ |
219 |
*/ |
Lines 207-279
Link Here
|
207 |
* Actions |
223 |
* Actions |
208 |
*/ |
224 |
*/ |
209 |
private Action fNextAction; |
225 |
private Action fNextAction; |
|
|
226 |
|
210 |
private Action fPreviousAction; |
227 |
private Action fPreviousAction; |
211 |
|
228 |
|
212 |
private StopAction fStopAction; |
229 |
private StopAction fStopAction; |
|
|
230 |
|
231 |
|
232 |
/** |
233 |
* Helper to open and activate editors. |
234 |
* |
235 |
* @since 3.7 |
236 |
*/ |
237 |
private LinkWithEditorAction fLinkWithEditorAction; |
238 |
|
213 |
private JUnitCopyAction fCopyAction; |
239 |
private JUnitCopyAction fCopyAction; |
|
|
240 |
|
214 |
private Action fPasteAction; |
241 |
private Action fPasteAction; |
215 |
|
242 |
|
216 |
private Action fRerunLastTestAction; |
243 |
private Action fRerunLastTestAction; |
|
|
244 |
|
217 |
private IHandlerActivation fRerunLastActivation; |
245 |
private IHandlerActivation fRerunLastActivation; |
|
|
246 |
|
218 |
private Action fRerunFailedFirstAction; |
247 |
private Action fRerunFailedFirstAction; |
|
|
248 |
|
219 |
private IHandlerActivation fRerunFailedFirstActivation; |
249 |
private IHandlerActivation fRerunFailedFirstActivation; |
220 |
|
250 |
|
221 |
private Action fFailuresOnlyFilterAction; |
251 |
private Action fFailuresOnlyFilterAction; |
|
|
252 |
|
222 |
private ScrollLockAction fScrollLockAction; |
253 |
private ScrollLockAction fScrollLockAction; |
|
|
254 |
|
223 |
private ToggleOrientationAction[] fToggleOrientationActions; |
255 |
private ToggleOrientationAction[] fToggleOrientationActions; |
|
|
256 |
|
224 |
private ShowTestHierarchyAction fShowTestHierarchyAction; |
257 |
private ShowTestHierarchyAction fShowTestHierarchyAction; |
|
|
258 |
|
225 |
private ShowTimeAction fShowTimeAction; |
259 |
private ShowTimeAction fShowTimeAction; |
|
|
260 |
|
226 |
private ActivateOnErrorAction fActivateOnErrorAction; |
261 |
private ActivateOnErrorAction fActivateOnErrorAction; |
|
|
262 |
|
227 |
private IMenuListener fViewMenuListener; |
263 |
private IMenuListener fViewMenuListener; |
228 |
|
264 |
|
229 |
private TestRunSession fTestRunSession; |
265 |
private TestRunSession fTestRunSession; |
|
|
266 |
|
230 |
private TestSessionListener fTestSessionListener; |
267 |
private TestSessionListener fTestSessionListener; |
231 |
|
268 |
|
232 |
private RunnerViewHistory fViewHistory; |
269 |
private RunnerViewHistory fViewHistory; |
|
|
270 |
|
233 |
private TestRunSessionListener fTestRunSessionListener; |
271 |
private TestRunSessionListener fTestRunSessionListener; |
234 |
|
272 |
|
235 |
final Image fStackViewIcon; |
273 |
final Image fStackViewIcon; |
|
|
274 |
|
236 |
final Image fTestRunOKIcon; |
275 |
final Image fTestRunOKIcon; |
|
|
276 |
|
237 |
final Image fTestRunFailIcon; |
277 |
final Image fTestRunFailIcon; |
|
|
278 |
|
238 |
final Image fTestRunOKDirtyIcon; |
279 |
final Image fTestRunOKDirtyIcon; |
|
|
280 |
|
239 |
final Image fTestRunFailDirtyIcon; |
281 |
final Image fTestRunFailDirtyIcon; |
240 |
|
282 |
|
241 |
final Image fTestIcon; |
283 |
final Image fTestIcon; |
|
|
284 |
|
242 |
final Image fTestOkIcon; |
285 |
final Image fTestOkIcon; |
|
|
286 |
|
243 |
final Image fTestErrorIcon; |
287 |
final Image fTestErrorIcon; |
|
|
288 |
|
244 |
final Image fTestFailIcon; |
289 |
final Image fTestFailIcon; |
|
|
290 |
|
245 |
final Image fTestAssumptionFailureIcon; |
291 |
final Image fTestAssumptionFailureIcon; |
|
|
292 |
|
246 |
final Image fTestRunningIcon; |
293 |
final Image fTestRunningIcon; |
|
|
294 |
|
247 |
final Image fTestIgnoredIcon; |
295 |
final Image fTestIgnoredIcon; |
248 |
|
296 |
|
249 |
final ImageDescriptor fSuiteIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuite.gif"); //$NON-NLS-1$ |
297 |
final ImageDescriptor fSuiteIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuite.gif"); //$NON-NLS-1$ |
|
|
298 |
|
250 |
final ImageDescriptor fSuiteOkIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuiteok.gif"); //$NON-NLS-1$ |
299 |
final ImageDescriptor fSuiteOkIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuiteok.gif"); //$NON-NLS-1$ |
|
|
300 |
|
251 |
final ImageDescriptor fSuiteErrorIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuiteerror.gif"); //$NON-NLS-1$ |
301 |
final ImageDescriptor fSuiteErrorIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuiteerror.gif"); //$NON-NLS-1$ |
|
|
302 |
|
252 |
final ImageDescriptor fSuiteFailIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuitefail.gif"); //$NON-NLS-1$ |
303 |
final ImageDescriptor fSuiteFailIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuitefail.gif"); //$NON-NLS-1$ |
|
|
304 |
|
253 |
final ImageDescriptor fSuiteRunningIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuiterun.gif"); //$NON-NLS-1$ |
305 |
final ImageDescriptor fSuiteRunningIconDescriptor= JUnitPlugin.getImageDescriptor("obj16/tsuiterun.gif"); //$NON-NLS-1$ |
254 |
|
306 |
|
255 |
final Image fSuiteIcon; |
307 |
final Image fSuiteIcon; |
|
|
308 |
|
256 |
final Image fSuiteOkIcon; |
309 |
final Image fSuiteOkIcon; |
|
|
310 |
|
257 |
final Image fSuiteErrorIcon; |
311 |
final Image fSuiteErrorIcon; |
|
|
312 |
|
258 |
final Image fSuiteFailIcon; |
313 |
final Image fSuiteFailIcon; |
|
|
314 |
|
259 |
final Image fSuiteRunningIcon; |
315 |
final Image fSuiteRunningIcon; |
260 |
|
316 |
|
261 |
final List<Image> fImagesToDispose; |
317 |
final List<Image> fImagesToDispose; |
262 |
|
318 |
|
263 |
// Persistence tags. |
319 |
// Persistence tags. |
264 |
static final String TAG_PAGE= "page"; //$NON-NLS-1$ |
320 |
static final String TAG_PAGE= "page"; //$NON-NLS-1$ |
|
|
321 |
|
265 |
static final String TAG_RATIO= "ratio"; //$NON-NLS-1$ |
322 |
static final String TAG_RATIO= "ratio"; //$NON-NLS-1$ |
|
|
323 |
|
266 |
static final String TAG_TRACEFILTER= "tracefilter"; //$NON-NLS-1$ |
324 |
static final String TAG_TRACEFILTER= "tracefilter"; //$NON-NLS-1$ |
|
|
325 |
|
267 |
static final String TAG_ORIENTATION= "orientation"; //$NON-NLS-1$ |
326 |
static final String TAG_ORIENTATION= "orientation"; //$NON-NLS-1$ |
|
|
327 |
|
268 |
static final String TAG_SCROLL= "scroll"; //$NON-NLS-1$ |
328 |
static final String TAG_SCROLL= "scroll"; //$NON-NLS-1$ |
|
|
329 |
|
269 |
/** |
330 |
/** |
270 |
* @since 3.2 |
331 |
* @since 3.2 |
271 |
*/ |
332 |
*/ |
272 |
static final String TAG_LAYOUT= "layout"; //$NON-NLS-1$ |
333 |
static final String TAG_LAYOUT= "layout"; //$NON-NLS-1$ |
|
|
334 |
|
273 |
/** |
335 |
/** |
274 |
* @since 3.2 |
336 |
* @since 3.2 |
275 |
*/ |
337 |
*/ |
276 |
static final String TAG_FAILURES_ONLY= "failuresOnly"; //$NON-NLS-1$ |
338 |
static final String TAG_FAILURES_ONLY= "failuresOnly"; //$NON-NLS-1$ |
|
|
339 |
|
277 |
/** |
340 |
/** |
278 |
* @since 3.4 |
341 |
* @since 3.4 |
279 |
*/ |
342 |
*/ |
Lines 288-302
Link Here
|
288 |
* @since 3.6 |
351 |
* @since 3.6 |
289 |
*/ |
352 |
*/ |
290 |
static final String PREF_LAST_URL= "lastImportURL"; //$NON-NLS-1$ |
353 |
static final String PREF_LAST_URL= "lastImportURL"; //$NON-NLS-1$ |
291 |
|
354 |
|
292 |
//orientations |
355 |
//orientations |
293 |
static final int VIEW_ORIENTATION_VERTICAL= 0; |
356 |
static final int VIEW_ORIENTATION_VERTICAL= 0; |
|
|
357 |
|
294 |
static final int VIEW_ORIENTATION_HORIZONTAL= 1; |
358 |
static final int VIEW_ORIENTATION_HORIZONTAL= 1; |
|
|
359 |
|
295 |
static final int VIEW_ORIENTATION_AUTOMATIC= 2; |
360 |
static final int VIEW_ORIENTATION_AUTOMATIC= 2; |
296 |
|
361 |
|
297 |
private IMemento fMemento; |
362 |
private IMemento fMemento; |
298 |
|
363 |
|
299 |
Image fOriginalViewImage; |
364 |
Image fOriginalViewImage; |
|
|
365 |
|
300 |
IElementChangedListener fDirtyListener; |
366 |
IElementChangedListener fDirtyListener; |
301 |
|
367 |
|
302 |
|
368 |
|
Lines 304-309
Link Here
|
304 |
private SashForm fSashForm; |
370 |
private SashForm fSashForm; |
305 |
|
371 |
|
306 |
private Composite fCounterComposite; |
372 |
private Composite fCounterComposite; |
|
|
373 |
|
307 |
private Composite fParent; |
374 |
private Composite fParent; |
308 |
|
375 |
|
309 |
/** |
376 |
/** |
Lines 312-331
Link Here
|
312 |
private UpdateUIJob fUpdateJob; |
379 |
private UpdateUIJob fUpdateJob; |
313 |
|
380 |
|
314 |
/** |
381 |
/** |
315 |
* A Job that runs as long as a test run is running. |
382 |
* A Job that runs as long as a test run is running. It is used to show busyness for running |
316 |
* It is used to show busyness for running jobs in the view (title in italics). |
383 |
* jobs in the view (title in italics). |
317 |
*/ |
384 |
*/ |
318 |
private JUnitIsRunningJob fJUnitIsRunningJob; |
385 |
private JUnitIsRunningJob fJUnitIsRunningJob; |
|
|
386 |
|
319 |
private ILock fJUnitIsRunningLock; |
387 |
private ILock fJUnitIsRunningLock; |
320 |
public static final Object FAMILY_JUNIT_RUN = new Object(); |
388 |
|
|
|
389 |
public static final Object FAMILY_JUNIT_RUN= new Object(); |
321 |
|
390 |
|
322 |
private IPartListener2 fPartListener= new IPartListener2() { |
391 |
private IPartListener2 fPartListener= new IPartListener2() { |
323 |
public void partActivated(IWorkbenchPartReference ref) { } |
392 |
public void partActivated(IWorkbenchPartReference ref) { |
324 |
public void partBroughtToTop(IWorkbenchPartReference ref) { } |
393 |
} |
325 |
public void partInputChanged(IWorkbenchPartReference ref) { } |
394 |
|
326 |
public void partClosed(IWorkbenchPartReference ref) { } |
395 |
public void partBroughtToTop(IWorkbenchPartReference ref) { |
327 |
public void partDeactivated(IWorkbenchPartReference ref) { } |
396 |
} |
328 |
public void partOpened(IWorkbenchPartReference ref) { } |
397 |
|
|
|
398 |
public void partInputChanged(IWorkbenchPartReference ref) { |
399 |
} |
400 |
|
401 |
public void partClosed(IWorkbenchPartReference ref) { |
402 |
} |
403 |
|
404 |
public void partDeactivated(IWorkbenchPartReference ref) { |
405 |
} |
406 |
|
407 |
public void partOpened(IWorkbenchPartReference ref) { |
408 |
} |
329 |
|
409 |
|
330 |
public void partVisible(IWorkbenchPartReference ref) { |
410 |
public void partVisible(IWorkbenchPartReference ref) { |
331 |
if (getSite().getId().equals(ref.getId())) { |
411 |
if (getSite().getId().equals(ref.getId())) { |
Lines 410-416
Link Here
|
410 |
|
490 |
|
411 |
@Override |
491 |
@Override |
412 |
public ImageDescriptor getImageDescriptor(Object element) { |
492 |
public ImageDescriptor getImageDescriptor(Object element) { |
413 |
TestRunSession session= (TestRunSession) element; |
493 |
TestRunSession session= (TestRunSession)element; |
414 |
if (session.isStopped()) |
494 |
if (session.isStopped()) |
415 |
return fSuiteIconDescriptor; |
495 |
return fSuiteIconDescriptor; |
416 |
|
496 |
|
Lines 481-487
Link Here
|
481 |
if (lastPath != null) { |
561 |
if (lastPath != null) { |
482 |
importDialog.setFilterPath(lastPath); |
562 |
importDialog.setFilterPath(lastPath); |
483 |
} |
563 |
} |
484 |
importDialog.setFilterExtensions(new String[] {"*.xml", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ |
564 |
importDialog.setFilterExtensions(new String[] { "*.xml", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ |
485 |
String path= importDialog.open(); |
565 |
String path= importDialog.open(); |
486 |
if (path == null) |
566 |
if (path == null) |
487 |
return; |
567 |
return; |
Lines 497-519
Link Here
|
497 |
} |
577 |
} |
498 |
} |
578 |
} |
499 |
} |
579 |
} |
500 |
|
580 |
|
501 |
private static class JUnitPasteAction extends Action { |
581 |
private static class JUnitPasteAction extends Action { |
502 |
private final Shell fShell; |
582 |
private final Shell fShell; |
|
|
583 |
|
503 |
private Clipboard fClipboard; |
584 |
private Clipboard fClipboard; |
504 |
|
585 |
|
505 |
public JUnitPasteAction(Shell shell, Clipboard clipboard) { |
586 |
public JUnitPasteAction(Shell shell, Clipboard clipboard) { |
506 |
super(JUnitMessages.TestRunnerViewPart_JUnitPasteAction_label); |
587 |
super(JUnitMessages.TestRunnerViewPart_JUnitPasteAction_label); |
507 |
Assert.isNotNull(clipboard); |
588 |
Assert.isNotNull(clipboard); |
508 |
fShell= shell; |
589 |
fShell= shell; |
509 |
fClipboard= clipboard; |
590 |
fClipboard= clipboard; |
510 |
} |
591 |
} |
511 |
|
592 |
|
512 |
@Override |
593 |
@Override |
513 |
public void run() { |
594 |
public void run() { |
514 |
String urlData= (String) fClipboard.getContents(URLTransfer.getInstance()); |
595 |
String urlData= (String)fClipboard.getContents(URLTransfer.getInstance()); |
515 |
if (urlData == null) { |
596 |
if (urlData == null) { |
516 |
urlData= (String) fClipboard.getContents(TextTransfer.getInstance()); |
597 |
urlData= (String)fClipboard.getContents(TextTransfer.getInstance()); |
517 |
} |
598 |
} |
518 |
if (urlData != null && urlData.length() > 0) { |
599 |
if (urlData != null && urlData.length() > 0) { |
519 |
if (isValidUrl(urlData)) { |
600 |
if (isValidUrl(urlData)) { |
Lines 524-530
Link Here
|
524 |
MessageDialog.openInformation(fShell, |
605 |
MessageDialog.openInformation(fShell, |
525 |
JUnitMessages.TestRunnerViewPart_JUnitPasteAction_cannotpaste_title, |
606 |
JUnitMessages.TestRunnerViewPart_JUnitPasteAction_cannotpaste_title, |
526 |
JUnitMessages.TestRunnerViewPart_JUnitPasteAction_cannotpaste_message |
607 |
JUnitMessages.TestRunnerViewPart_JUnitPasteAction_cannotpaste_message |
527 |
); |
608 |
); |
528 |
} |
609 |
} |
529 |
|
610 |
|
530 |
private boolean isValidUrl(String urlData) { |
611 |
private boolean isValidUrl(String urlData) { |
Lines 537-543
Link Here
|
537 |
return true; |
618 |
return true; |
538 |
} |
619 |
} |
539 |
} |
620 |
} |
540 |
|
621 |
|
541 |
private static class ImportTestRunSessionFromURLAction extends Action { |
622 |
private static class ImportTestRunSessionFromURLAction extends Action { |
542 |
private static class URLValidator implements IInputValidator { |
623 |
private static class URLValidator implements IInputValidator { |
543 |
public String isValid(String newText) { |
624 |
public String isValid(String newText) { |
Lines 554-577
Link Here
|
554 |
} |
635 |
} |
555 |
|
636 |
|
556 |
private static final String DIALOG_SETTINGS= "ImportTestRunSessionFromURLAction"; //$NON-NLS-1$ |
637 |
private static final String DIALOG_SETTINGS= "ImportTestRunSessionFromURLAction"; //$NON-NLS-1$ |
557 |
|
638 |
|
558 |
private final Shell fShell; |
639 |
private final Shell fShell; |
559 |
|
640 |
|
560 |
public ImportTestRunSessionFromURLAction(Shell shell) { |
641 |
public ImportTestRunSessionFromURLAction(Shell shell) { |
561 |
super(JUnitMessages.TestRunnerViewPart_ImportTestRunSessionFromURLAction_import_from_url); |
642 |
super(JUnitMessages.TestRunnerViewPart_ImportTestRunSessionFromURLAction_import_from_url); |
562 |
fShell= shell; |
643 |
fShell= shell; |
563 |
} |
644 |
} |
564 |
|
645 |
|
565 |
@Override |
646 |
@Override |
566 |
public void run() { |
647 |
public void run() { |
567 |
String title= JUnitMessages.TestRunnerViewPart_ImportTestRunSessionAction_title; |
648 |
String title= JUnitMessages.TestRunnerViewPart_ImportTestRunSessionAction_title; |
568 |
String message= JUnitMessages.TestRunnerViewPart_ImportTestRunSessionFromURLAction_url; |
649 |
String message= JUnitMessages.TestRunnerViewPart_ImportTestRunSessionFromURLAction_url; |
569 |
|
650 |
|
570 |
final IDialogSettings dialogSettings= JUnitPlugin.getDefault().getDialogSettings(); |
651 |
final IDialogSettings dialogSettings= JUnitPlugin.getDefault().getDialogSettings(); |
571 |
String url= dialogSettings.get(PREF_LAST_URL); |
652 |
String url= dialogSettings.get(PREF_LAST_URL); |
572 |
|
653 |
|
573 |
IInputValidator validator= new URLValidator(); |
654 |
IInputValidator validator= new URLValidator(); |
574 |
|
655 |
|
575 |
InputDialog inputDialog= new InputDialog(fShell, title, message, url, validator) { |
656 |
InputDialog inputDialog= new InputDialog(fShell, title, message, url, validator) { |
576 |
@Override |
657 |
@Override |
577 |
protected Control createDialogArea(Composite parent) { |
658 |
protected Control createDialogArea(Composite parent) { |
Lines 583-588
Link Here
|
583 |
} |
664 |
} |
584 |
return dialogArea2; |
665 |
return dialogArea2; |
585 |
} |
666 |
} |
|
|
667 |
|
586 |
@Override |
668 |
@Override |
587 |
protected IDialogSettings getDialogBoundsSettings() { |
669 |
protected IDialogSettings getDialogBoundsSettings() { |
588 |
IDialogSettings settings= dialogSettings.getSection(DIALOG_SETTINGS); |
670 |
IDialogSettings settings= dialogSettings.getSection(DIALOG_SETTINGS); |
Lines 592-603
Link Here
|
592 |
settings.put("DIALOG_HEIGHT", Dialog.DIALOG_DEFAULT_BOUNDS); //$NON-NLS-1$ |
674 |
settings.put("DIALOG_HEIGHT", Dialog.DIALOG_DEFAULT_BOUNDS); //$NON-NLS-1$ |
593 |
return settings; |
675 |
return settings; |
594 |
} |
676 |
} |
|
|
677 |
|
595 |
@Override |
678 |
@Override |
596 |
protected boolean isResizable() { |
679 |
protected boolean isResizable() { |
597 |
return true; |
680 |
return true; |
598 |
} |
681 |
} |
599 |
}; |
682 |
}; |
600 |
|
683 |
|
601 |
int res= inputDialog.open(); |
684 |
int res= inputDialog.open(); |
602 |
if (res == IDialogConstants.OK_ID) { |
685 |
if (res == IDialogConstants.OK_ID) { |
603 |
url= inputDialog.getValue(); |
686 |
url= inputDialog.getValue(); |
Lines 609-614
Link Here
|
609 |
|
692 |
|
610 |
private static class ExportTestRunSessionAction extends Action { |
693 |
private static class ExportTestRunSessionAction extends Action { |
611 |
private final TestRunSession fTestRunSession; |
694 |
private final TestRunSession fTestRunSession; |
|
|
695 |
|
612 |
private final Shell fShell; |
696 |
private final Shell fShell; |
613 |
|
697 |
|
614 |
public ExportTestRunSessionAction(Shell shell, TestRunSession testRunSession) { |
698 |
public ExportTestRunSessionAction(Shell shell, TestRunSession testRunSession) { |
Lines 627-633
Link Here
|
627 |
exportDialog.setFilterPath(lastPath); |
711 |
exportDialog.setFilterPath(lastPath); |
628 |
} |
712 |
} |
629 |
exportDialog.setFileName(getFileName()); |
713 |
exportDialog.setFileName(getFileName()); |
630 |
exportDialog.setFilterExtensions(new String[] {"*.xml", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ |
714 |
exportDialog.setFilterExtensions(new String[] { "*.xml", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ |
631 |
String path= exportDialog.open(); |
715 |
String path= exportDialog.open(); |
632 |
if (path == null) |
716 |
if (path == null) |
633 |
return; |
717 |
return; |
Lines 664-676
Link Here
|
664 |
String testRunLabel= BasicElementLabels.getJavaElementName(testRunSession.getTestRunName()); |
748 |
String testRunLabel= BasicElementLabels.getJavaElementName(testRunSession.getTestRunName()); |
665 |
String msg; |
749 |
String msg; |
666 |
if (testRunSession.getLaunch() != null) { |
750 |
if (testRunSession.getLaunch() != null) { |
667 |
msg= Messages.format(JUnitMessages.TestRunnerViewPart_Launching, new Object[]{ testRunLabel }); |
751 |
msg= Messages.format(JUnitMessages.TestRunnerViewPart_Launching, new Object[] { testRunLabel }); |
668 |
} else { |
752 |
} else { |
669 |
msg= testRunLabel; |
753 |
msg= testRunLabel; |
670 |
} |
754 |
} |
671 |
registerInfoMessage(msg); |
755 |
registerInfoMessage(msg); |
672 |
} |
756 |
} |
673 |
|
757 |
|
674 |
TestRunSession deactivatedSession= setActiveTestRunSession(testRunSession); |
758 |
TestRunSession deactivatedSession= setActiveTestRunSession(testRunSession); |
675 |
if (deactivatedSession != null) |
759 |
if (deactivatedSession != null) |
676 |
deactivatedSession.swapOut(); |
760 |
deactivatedSession.swapOut(); |
Lines 678-690
Link Here
|
678 |
} |
762 |
} |
679 |
}); |
763 |
}); |
680 |
} |
764 |
} |
|
|
765 |
|
681 |
public void sessionRemoved(final TestRunSession testRunSession) { |
766 |
public void sessionRemoved(final TestRunSession testRunSession) { |
682 |
getDisplay().asyncExec(new Runnable() { |
767 |
getDisplay().asyncExec(new Runnable() { |
683 |
public void run() { |
768 |
public void run() { |
684 |
if (testRunSession.equals(fTestRunSession)) { |
769 |
if (testRunSession.equals(fTestRunSession)) { |
685 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
770 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
686 |
TestRunSession deactivatedSession; |
771 |
TestRunSession deactivatedSession; |
687 |
if (! testRunSessions.isEmpty()) { |
772 |
if (!testRunSessions.isEmpty()) { |
688 |
deactivatedSession= setActiveTestRunSession(testRunSessions.get(0)); |
773 |
deactivatedSession= setActiveTestRunSession(testRunSessions.get(0)); |
689 |
} else { |
774 |
} else { |
690 |
deactivatedSession= setActiveTestRunSession(null); |
775 |
deactivatedSession= setActiveTestRunSession(null); |
Lines 698-704
Link Here
|
698 |
} |
783 |
} |
699 |
|
784 |
|
700 |
private class TestSessionListener implements ITestSessionListener { |
785 |
private class TestSessionListener implements ITestSessionListener { |
701 |
public void sessionStarted(){ |
786 |
public void sessionStarted() { |
702 |
fTestViewer.registerViewersRefresh(); |
787 |
fTestViewer.registerViewersRefresh(); |
703 |
fShowOnErrorOnly= getShowOnErrorOnly(); |
788 |
fShowOnErrorOnly= getShowOnErrorOnly(); |
704 |
|
789 |
|
Lines 708-719
Link Here
|
708 |
fRerunLastTestAction.setEnabled(true); |
793 |
fRerunLastTestAction.setEnabled(true); |
709 |
} |
794 |
} |
710 |
|
795 |
|
711 |
public void sessionEnded(long elapsedTime){ |
796 |
public void sessionEnded(long elapsedTime) { |
712 |
deregisterTestSessionListener(false); |
797 |
deregisterTestSessionListener(false); |
713 |
|
798 |
|
714 |
fTestViewer.registerAutoScrollTarget(null); |
799 |
fTestViewer.registerAutoScrollTarget(null); |
715 |
|
800 |
|
716 |
String[] keys= {elapsedTimeAsString(elapsedTime)}; |
801 |
String[] keys= { elapsedTimeAsString(elapsedTime) }; |
717 |
String msg= Messages.format(JUnitMessages.TestRunnerViewPart_message_finish, keys); |
802 |
String msg= Messages.format(JUnitMessages.TestRunnerViewPart_message_finish, keys); |
718 |
registerInfoMessage(msg); |
803 |
registerInfoMessage(msg); |
719 |
|
804 |
|
Lines 732-737
Link Here
|
732 |
JavaCore.addElementChangedListener(fDirtyListener); |
817 |
JavaCore.addElementChangedListener(fDirtyListener); |
733 |
} |
818 |
} |
734 |
warnOfContentChange(); |
819 |
warnOfContentChange(); |
|
|
820 |
fLinkWithEditorAction.setEnabled(fTestRunSession != null); |
821 |
setLinkingWithEditorActive(fTestRunSession != null); |
735 |
} |
822 |
} |
736 |
}); |
823 |
}); |
737 |
stopUpdateJobs(); |
824 |
stopUpdateJobs(); |
Lines 739-745
Link Here
|
739 |
|
826 |
|
740 |
public void sessionStopped(final long elapsedTime) { |
827 |
public void sessionStopped(final long elapsedTime) { |
741 |
deregisterTestSessionListener(false); |
828 |
deregisterTestSessionListener(false); |
742 |
|
829 |
|
743 |
fTestViewer.registerAutoScrollTarget(null); |
830 |
fTestViewer.registerAutoScrollTarget(null); |
744 |
|
831 |
|
745 |
registerInfoMessage(JUnitMessages.TestRunnerViewPart_message_stopped); |
832 |
registerInfoMessage(JUnitMessages.TestRunnerViewPart_message_stopped); |
Lines 748-754
Link Here
|
748 |
|
835 |
|
749 |
public void sessionTerminated() { |
836 |
public void sessionTerminated() { |
750 |
deregisterTestSessionListener(true); |
837 |
deregisterTestSessionListener(true); |
751 |
|
838 |
|
752 |
fTestViewer.registerAutoScrollTarget(null); |
839 |
fTestViewer.registerAutoScrollTarget(null); |
753 |
|
840 |
|
754 |
registerInfoMessage(JUnitMessages.TestRunnerViewPart_message_terminated); |
841 |
registerInfoMessage(JUnitMessages.TestRunnerViewPart_message_terminated); |
Lines 776-796
Link Here
|
776 |
} |
863 |
} |
777 |
fTestViewer.registerViewerUpdate(testElement); |
864 |
fTestViewer.registerViewerUpdate(testElement); |
778 |
|
865 |
|
779 |
// show the view on the first error only |
866 |
// show the view on the first error only |
780 |
if (fShowOnErrorOnly && (getErrorsPlusFailures() == 1)) |
867 |
if (fShowOnErrorOnly && (getErrorsPlusFailures() == 1)) |
781 |
postShowTestResultsView(); |
868 |
postShowTestResultsView(); |
782 |
|
869 |
|
783 |
//TODO: |
870 |
//TODO: |
784 |
// [Bug 35590] JUnit window doesn't report errors from junit.extensions.TestSetup [JUnit] |
871 |
// [Bug 35590] JUnit window doesn't report errors from junit.extensions.TestSetup [JUnit] |
785 |
// when a failure occurs in test setup then no test is running |
872 |
// when a failure occurs in test setup then no test is running |
786 |
// to update the views we artificially signal the end of a test run |
873 |
// to update the views we artificially signal the end of a test run |
787 |
// if (!fTestIsRunning) { |
874 |
// if (!fTestIsRunning) { |
788 |
// fTestIsRunning= false; |
875 |
// fTestIsRunning= false; |
789 |
// testEnded(testCaseElement); |
876 |
// testEnded(testCaseElement); |
790 |
// } |
877 |
// } |
791 |
} |
878 |
} |
792 |
|
879 |
|
793 |
public void testEnded(TestCaseElement testCaseElement){ |
880 |
public void testEnded(TestCaseElement testCaseElement) { |
794 |
fTestViewer.registerViewerUpdate(testCaseElement); |
881 |
fTestViewer.registerViewerUpdate(testCaseElement); |
795 |
} |
882 |
} |
796 |
|
883 |
|
Lines 816-821
Link Here
|
816 |
super(name); |
903 |
super(name); |
817 |
setSystem(true); |
904 |
setSystem(true); |
818 |
} |
905 |
} |
|
|
906 |
|
819 |
@Override |
907 |
@Override |
820 |
public IStatus runInUIThread(IProgressMonitor monitor) { |
908 |
public IStatus runInUIThread(IProgressMonitor monitor) { |
821 |
if (!isDisposed()) { |
909 |
if (!isDisposed()) { |
Lines 828-833
Link Here
|
828 |
public void stop() { |
916 |
public void stop() { |
829 |
fRunning= false; |
917 |
fRunning= false; |
830 |
} |
918 |
} |
|
|
919 |
|
831 |
@Override |
920 |
@Override |
832 |
public boolean shouldSchedule() { |
921 |
public boolean shouldSchedule() { |
833 |
return fRunning; |
922 |
return fRunning; |
Lines 839-850
Link Here
|
839 |
super(name); |
928 |
super(name); |
840 |
setSystem(true); |
929 |
setSystem(true); |
841 |
} |
930 |
} |
|
|
931 |
|
842 |
@Override |
932 |
@Override |
843 |
public IStatus run(IProgressMonitor monitor) { |
933 |
public IStatus run(IProgressMonitor monitor) { |
844 |
// wait until the test run terminates |
934 |
// wait until the test run terminates |
845 |
fJUnitIsRunningLock.acquire(); |
935 |
fJUnitIsRunningLock.acquire(); |
846 |
return Status.OK_STATUS; |
936 |
return Status.OK_STATUS; |
847 |
} |
937 |
} |
|
|
938 |
|
848 |
@Override |
939 |
@Override |
849 |
public boolean belongsTo(Object family) { |
940 |
public boolean belongsTo(Object family) { |
850 |
return family == TestRunnerViewPart.FAMILY_JUNIT_RUN; |
941 |
return family == TestRunnerViewPart.FAMILY_JUNIT_RUN; |
Lines 858-864
Link Here
|
858 |
boolean enabled= false; |
949 |
boolean enabled= false; |
859 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
950 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
860 |
for (TestRunSession testRunSession : testRunSessions) { |
951 |
for (TestRunSession testRunSession : testRunSessions) { |
861 |
if (! testRunSession.isRunning() && ! testRunSession.isStarting()) { |
952 |
if (!testRunSession.isRunning() && !testRunSession.isStarting()) { |
862 |
enabled= true; |
953 |
enabled= true; |
863 |
break; |
954 |
break; |
864 |
} |
955 |
} |
Lines 877-883
Link Here
|
877 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
968 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
878 |
for (Iterator<TestRunSession> iter= testRunSessions.iterator(); iter.hasNext();) { |
969 |
for (Iterator<TestRunSession> iter= testRunSessions.iterator(); iter.hasNext();) { |
879 |
TestRunSession testRunSession= iter.next(); |
970 |
TestRunSession testRunSession= iter.next(); |
880 |
if (! testRunSession.isRunning() && ! testRunSession.isStarting()) { |
971 |
if (!testRunSession.isRunning() && !testRunSession.isStarting()) { |
881 |
iter.remove(); |
972 |
iter.remove(); |
882 |
} |
973 |
} |
883 |
} |
974 |
} |
Lines 899-904
Link Here
|
899 |
} |
990 |
} |
900 |
} |
991 |
} |
901 |
|
992 |
|
|
|
993 |
/** |
994 |
* This action toggles whether this {@link TestRunnerViewPart} links its selection to the active |
995 |
* editor. |
996 |
* |
997 |
*/ |
998 |
private class LinkWithEditorAction extends AbstractToggleLinkingAction { |
999 |
|
1000 |
/** Image to use when the sync is on.*/ |
1001 |
private static final String SYNCED_GIF= "synced.gif"; //$NON-NLS-1$ |
1002 |
|
1003 |
/** Image to use when the sync is broken.*/ |
1004 |
private static final String SYNC_BROKEN_GIF= "sync_broken.gif"; //$NON-NLS-1$ |
1005 |
|
1006 |
private String fIconName = SYNC_BROKEN_GIF; |
1007 |
|
1008 |
LinkWithEditorAction() { |
1009 |
// enable by default |
1010 |
setChecked(true); |
1011 |
} |
1012 |
|
1013 |
@Override |
1014 |
public void run() { |
1015 |
setLinkingWithEditorActive(isChecked()); |
1016 |
} |
1017 |
|
1018 |
/** |
1019 |
* Updates the Link image with a "normal link" image if parameter is true, or a |
1020 |
* "broken link" image otherwise |
1021 |
* |
1022 |
* @param isInSync the state of synchronization |
1023 |
*/ |
1024 |
public void updateLinkImage(boolean isInSync) { |
1025 |
String iconName= isInSync ? SYNCED_GIF : SYNC_BROKEN_GIF; |
1026 |
if (!iconName.equals(fIconName)) { |
1027 |
JavaPluginImages.setLocalImageDescriptors(fLinkWithEditorAction, iconName); |
1028 |
fIconName= iconName; |
1029 |
} |
1030 |
} |
1031 |
|
1032 |
} |
1033 |
|
1034 |
/** |
1035 |
* @return {@code true} if the {@link LinkWithEditorAction} is checked, false otherwise. |
1036 |
* @since 3.7 |
1037 |
*/ |
1038 |
public boolean isLinkWithEditorActive() { |
1039 |
return fLinkWithEditorAction.isChecked(); |
1040 |
} |
1041 |
|
902 |
private class RerunLastAction extends Action { |
1042 |
private class RerunLastAction extends Action { |
903 |
public RerunLastAction() { |
1043 |
public RerunLastAction() { |
904 |
setText(JUnitMessages.TestRunnerViewPart_rerunaction_label); |
1044 |
setText(JUnitMessages.TestRunnerViewPart_rerunaction_label); |
Lines 909-915
Link Here
|
909 |
} |
1049 |
} |
910 |
|
1050 |
|
911 |
@Override |
1051 |
@Override |
912 |
public void run(){ |
1052 |
public void run() { |
913 |
rerunTestRun(); |
1053 |
rerunTestRun(); |
914 |
} |
1054 |
} |
915 |
} |
1055 |
} |
Lines 924-930
Link Here
|
924 |
} |
1064 |
} |
925 |
|
1065 |
|
926 |
@Override |
1066 |
@Override |
927 |
public void run(){ |
1067 |
public void run() { |
928 |
rerunTestFailedFirst(); |
1068 |
rerunTestFailedFirst(); |
929 |
} |
1069 |
} |
930 |
} |
1070 |
} |
Lines 975-981
Link Here
|
975 |
int type= delta.getElement().getElementType(); |
1115 |
int type= delta.getElement().getElementType(); |
976 |
|
1116 |
|
977 |
switch (type) { |
1117 |
switch (type) { |
978 |
// Consider containers for class files. |
1118 |
// Consider containers for class files. |
979 |
case IJavaElement.JAVA_MODEL: |
1119 |
case IJavaElement.JAVA_MODEL: |
980 |
case IJavaElement.JAVA_PROJECT: |
1120 |
case IJavaElement.JAVA_PROJECT: |
981 |
case IJavaElement.PACKAGE_FRAGMENT_ROOT: |
1121 |
case IJavaElement.PACKAGE_FRAGMENT_ROOT: |
Lines 1059-1067
Link Here
|
1059 |
//setImageDescriptor(JUnitPlugin.getImageDescriptor("obj16/failures.gif")); //$NON-NLS-1$ |
1199 |
//setImageDescriptor(JUnitPlugin.getImageDescriptor("obj16/failures.gif")); //$NON-NLS-1$ |
1060 |
update(); |
1200 |
update(); |
1061 |
} |
1201 |
} |
|
|
1202 |
|
1062 |
public void update() { |
1203 |
public void update() { |
1063 |
setChecked(getShowOnErrorOnly()); |
1204 |
setChecked(getShowOnErrorOnly()); |
1064 |
} |
1205 |
} |
|
|
1206 |
|
1065 |
@Override |
1207 |
@Override |
1066 |
public void run() { |
1208 |
public void run() { |
1067 |
boolean checked= isChecked(); |
1209 |
boolean checked= isChecked(); |
Lines 1085-1091
Link Here
|
1085 |
fTestFailIcon= createManagedImage("obj16/testfail.gif"); //$NON-NLS-1$ |
1227 |
fTestFailIcon= createManagedImage("obj16/testfail.gif"); //$NON-NLS-1$ |
1086 |
fTestRunningIcon= createManagedImage("obj16/testrun.gif"); //$NON-NLS-1$ |
1228 |
fTestRunningIcon= createManagedImage("obj16/testrun.gif"); //$NON-NLS-1$ |
1087 |
fTestIgnoredIcon= createManagedImage("obj16/testignored.gif"); //$NON-NLS-1$ |
1229 |
fTestIgnoredIcon= createManagedImage("obj16/testignored.gif"); //$NON-NLS-1$ |
1088 |
fTestAssumptionFailureIcon = createManagedImage("obj16/testassumptionfailed.gif"); //$NON-NLS-1$ |
1230 |
fTestAssumptionFailureIcon= createManagedImage("obj16/testassumptionfailed.gif"); //$NON-NLS-1$ |
1089 |
|
1231 |
|
1090 |
fSuiteIcon= createManagedImage(fSuiteIconDescriptor); |
1232 |
fSuiteIcon= createManagedImage(fSuiteIconDescriptor); |
1091 |
fSuiteOkIcon= createManagedImage(fSuiteOkIconDescriptor); |
1233 |
fSuiteOkIcon= createManagedImage(fSuiteOkIconDescriptor); |
Lines 1120-1126
Link Here
|
1120 |
private IWorkbenchSiteProgressService getProgressService() { |
1262 |
private IWorkbenchSiteProgressService getProgressService() { |
1121 |
Object siteService= getSite().getAdapter(IWorkbenchSiteProgressService.class); |
1263 |
Object siteService= getSite().getAdapter(IWorkbenchSiteProgressService.class); |
1122 |
if (siteService != null) |
1264 |
if (siteService != null) |
1123 |
return (IWorkbenchSiteProgressService) siteService; |
1265 |
return (IWorkbenchSiteProgressService)siteService; |
1124 |
return null; |
1266 |
return null; |
1125 |
} |
1267 |
} |
1126 |
|
1268 |
|
Lines 1158-1164
Link Here
|
1158 |
// } |
1300 |
// } |
1159 |
Integer ratio= memento.getInteger(TAG_RATIO); |
1301 |
Integer ratio= memento.getInteger(TAG_RATIO); |
1160 |
if (ratio != null) |
1302 |
if (ratio != null) |
1161 |
fSashForm.setWeights(new int[] { ratio.intValue(), 1000 - ratio.intValue()} ); |
1303 |
fSashForm.setWeights(new int[] { ratio.intValue(), 1000 - ratio.intValue() }); |
1162 |
Integer orientation= memento.getInteger(TAG_ORIENTATION); |
1304 |
Integer orientation= memento.getInteger(TAG_ORIENTATION); |
1163 |
if (orientation != null) |
1305 |
if (orientation != null) |
1164 |
fOrientation= orientation.intValue(); |
1306 |
fOrientation= orientation.intValue(); |
Lines 1200-1205
Link Here
|
1200 |
} |
1342 |
} |
1201 |
} |
1343 |
} |
1202 |
|
1344 |
|
|
|
1345 |
/** |
1346 |
* Activate the 'Link with Editor' in the current {@link IWorkbenchPage}. (The |
1347 |
* {@link TestViewer} will respond to {@link ISelection} changes.) |
1348 |
* |
1349 |
* @param active boolean to indicate if the link with editor is active ({@code true}) or not ( |
1350 |
* {@code false}) |
1351 |
* |
1352 |
* @since 3.7 |
1353 |
*/ |
1354 |
public void setLinkingWithEditorActive(final boolean active) { |
1355 |
if (active) { |
1356 |
getSite().getPage().addPostSelectionListener(fTestViewer); |
1357 |
fTestViewer.setSelection(getSite().getPage().getActiveEditor()); |
1358 |
} else { |
1359 |
getSite().getPage().removePostSelectionListener(fTestViewer); |
1360 |
} |
1361 |
} |
1362 |
|
1363 |
/** |
1364 |
* Updates the Link image with a "normal link" image if parameter is true, or a "broken link" |
1365 |
* image otherwise |
1366 |
* |
1367 |
* @param isInSync the state of synchronization |
1368 |
* |
1369 |
* @since 3.7 |
1370 |
*/ |
1371 |
public void setLinkingWithEditorInSync(final boolean isInSync) { |
1372 |
fLinkWithEditorAction.updateLinkImage(isInSync); |
1373 |
} |
1374 |
|
1203 |
private void startUpdateJobs() { |
1375 |
private void startUpdateJobs() { |
1204 |
postSyncProcessChanges(); |
1376 |
postSyncProcessChanges(); |
1205 |
|
1377 |
|
Lines 1237-1243
Link Here
|
1237 |
doShowInfoMessage(); |
1409 |
doShowInfoMessage(); |
1238 |
refreshCounters(); |
1410 |
refreshCounters(); |
1239 |
|
1411 |
|
1240 |
if (! fPartIsVisible) |
1412 |
if (!fPartIsVisible) |
1241 |
updateViewTitleProgress(); |
1413 |
updateViewTitleProgress(); |
1242 |
else { |
1414 |
else { |
1243 |
updateViewIcon(); |
1415 |
updateViewIcon(); |
Lines 1298-1328
Link Here
|
1298 |
} |
1470 |
} |
1299 |
ILaunch launch= fTestRunSession.getLaunch(); |
1471 |
ILaunch launch= fTestRunSession.getLaunch(); |
1300 |
if (launch != null && launch.getLaunchConfiguration() != null) { |
1472 |
if (launch != null && launch.getLaunchConfiguration() != null) { |
1301 |
ILaunchConfiguration launchConfiguration= launch.getLaunchConfiguration(); |
1473 |
ILaunchConfiguration launchConfiguration= launch.getLaunchConfiguration(); |
1302 |
if (launchConfiguration != null) { |
1474 |
if (launchConfiguration != null) { |
1303 |
try { |
1475 |
try { |
1304 |
String oldName= launchConfiguration.getName(); |
1476 |
String oldName= launchConfiguration.getName(); |
1305 |
String oldFailuresFilename= launchConfiguration.getAttribute(JUnitLaunchConfigurationConstants.ATTR_FAILURES_NAMES, (String) null); |
1477 |
String oldFailuresFilename= launchConfiguration.getAttribute(JUnitLaunchConfigurationConstants.ATTR_FAILURES_NAMES, (String)null); |
1306 |
String configName; |
1478 |
String configName; |
1307 |
if (oldFailuresFilename != null) { |
1479 |
if (oldFailuresFilename != null) { |
1308 |
configName= oldName; |
1480 |
configName= oldName; |
1309 |
} else { |
1481 |
} else { |
1310 |
configName= Messages.format(JUnitMessages.TestRunnerViewPart_rerunFailedFirstLaunchConfigName, oldName); |
1482 |
configName= Messages.format(JUnitMessages.TestRunnerViewPart_rerunFailedFirstLaunchConfigName, oldName); |
1311 |
} |
|
|
1312 |
ILaunchConfigurationWorkingCopy tmp= launchConfiguration.copy(configName); |
1313 |
tmp.setAttribute(JUnitLaunchConfigurationConstants.ATTR_FAILURES_NAMES, createFailureNamesFile()); |
1314 |
relaunch(tmp, launch.getLaunchMode()); |
1315 |
return; |
1316 |
} catch (CoreException e) { |
1317 |
ErrorDialog.openError(getSite().getShell(), |
1318 |
JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus() |
1319 |
); |
1320 |
} |
1483 |
} |
|
|
1484 |
ILaunchConfigurationWorkingCopy tmp= launchConfiguration.copy(configName); |
1485 |
tmp.setAttribute(JUnitLaunchConfigurationConstants.ATTR_FAILURES_NAMES, createFailureNamesFile()); |
1486 |
relaunch(tmp, launch.getLaunchMode()); |
1487 |
return; |
1488 |
} catch (CoreException e) { |
1489 |
ErrorDialog.openError(getSite().getShell(), |
1490 |
JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus() |
1491 |
); |
1321 |
} |
1492 |
} |
1322 |
MessageDialog.openInformation(getSite().getShell(), |
1493 |
} |
|
|
1494 |
MessageDialog.openInformation(getSite().getShell(), |
1323 |
JUnitMessages.TestRunnerViewPart_cannotrerun_title, |
1495 |
JUnitMessages.TestRunnerViewPart_cannotrerun_title, |
1324 |
JUnitMessages.TestRunnerViewPart_cannotrerurn_message |
1496 |
JUnitMessages.TestRunnerViewPart_cannotrerurn_message |
1325 |
); |
1497 |
); |
1326 |
} |
1498 |
} |
1327 |
} |
1499 |
} |
1328 |
|
1500 |
|
Lines 1354-1360
Link Here
|
1354 |
} |
1526 |
} |
1355 |
|
1527 |
|
1356 |
public void setAutoScroll(boolean scroll) { |
1528 |
public void setAutoScroll(boolean scroll) { |
1357 |
fAutoScroll = scroll; |
1529 |
fAutoScroll= scroll; |
1358 |
} |
1530 |
} |
1359 |
|
1531 |
|
1360 |
public boolean isAutoScroll() { |
1532 |
public boolean isAutoScroll() { |
Lines 1385-1391
Link Here
|
1385 |
} |
1557 |
} |
1386 |
|
1558 |
|
1387 |
private String elapsedTimeAsString(long runTime) { |
1559 |
private String elapsedTimeAsString(long runTime) { |
1388 |
return NumberFormat.getInstance().format((double)runTime/1000); |
1560 |
return NumberFormat.getInstance().format((double)runTime / 1000); |
1389 |
} |
1561 |
} |
1390 |
|
1562 |
|
1391 |
private void handleStopped() { |
1563 |
private void handleStopped() { |
Lines 1493-1499
Link Here
|
1493 |
} |
1665 |
} |
1494 |
if (!fTestRunSession.isStarting() && !fShowOnErrorOnly) |
1666 |
if (!fTestRunSession.isStarting() && !fShowOnErrorOnly) |
1495 |
showTestResultsView(); |
1667 |
showTestResultsView(); |
1496 |
|
1668 |
|
1497 |
setTitleToolTip(); |
1669 |
setTitleToolTip(); |
1498 |
|
1670 |
|
1499 |
clearStatus(); |
1671 |
clearStatus(); |
Lines 1507-1517
Link Here
|
1507 |
startUpdateJobs(); |
1679 |
startUpdateJobs(); |
1508 |
|
1680 |
|
1509 |
fStopAction.setEnabled(true); |
1681 |
fStopAction.setEnabled(true); |
|
|
1682 |
fLinkWithEditorAction.setEnabled(true); |
1510 |
|
1683 |
|
1511 |
} else /* old or fresh session: don't want jobs at this stage */ { |
1684 |
} else /* old or fresh session: don't want jobs at this stage */{ |
1512 |
stopUpdateJobs(); |
1685 |
stopUpdateJobs(); |
1513 |
|
1686 |
|
1514 |
fStopAction.setEnabled(fTestRunSession.isKeptAlive()); |
1687 |
fStopAction.setEnabled(fTestRunSession.isKeptAlive()); |
|
|
1688 |
fLinkWithEditorAction.setEnabled(fTestRunSession != null); |
1689 |
// if "Link with Editor" is active, register the listener |
1690 |
if (isLinkWithEditorActive()) { |
1691 |
getSite().getPage().addPostSelectionListener(fTestViewer); |
1692 |
fTestViewer.setSelection(getSite().getPage().getActiveEditor()); |
1693 |
} |
1694 |
|
1515 |
fTestViewer.expandFirstLevel(); |
1695 |
fTestViewer.expandFirstLevel(); |
1516 |
} |
1696 |
} |
1517 |
} |
1697 |
} |
Lines 1527-1542
Link Here
|
1527 |
|
1707 |
|
1528 |
private void updateRerunFailedFirstAction() { |
1708 |
private void updateRerunFailedFirstAction() { |
1529 |
boolean state= hasErrorsOrFailures() && fTestRunSession.getLaunch() != null; |
1709 |
boolean state= hasErrorsOrFailures() && fTestRunSession.getLaunch() != null; |
1530 |
fRerunFailedFirstAction.setEnabled(state); |
1710 |
fRerunFailedFirstAction.setEnabled(state); |
1531 |
} |
1711 |
} |
1532 |
|
1712 |
|
1533 |
/** |
1713 |
/** |
1534 |
* @return the display name of the current test run sessions kind, or <code>null</code> |
1714 |
* @return the display name of the current test run sessions kind, or <code>null</code> |
1535 |
*/ |
1715 |
*/ |
1536 |
public String getTestKindDisplayName() { |
1716 |
public String getTestKindDisplayName() { |
1537 |
ITestKind kind= fTestRunSession.getTestRunnerKind(); |
1717 |
ITestKind kind= fTestRunSession.getTestRunnerKind(); |
1538 |
if (!kind.isNull()) { |
1718 |
if (!kind.isNull()) { |
1539 |
return kind.getDisplayName(); |
1719 |
return kind.getDisplayName(); |
1540 |
} |
1720 |
} |
1541 |
return null; |
1721 |
return null; |
1542 |
} |
1722 |
} |
Lines 1546-1563
Link Here
|
1546 |
|
1726 |
|
1547 |
String testRunLabel= BasicElementLabels.getJavaElementName(fTestRunSession.getTestRunName()); |
1727 |
String testRunLabel= BasicElementLabels.getJavaElementName(fTestRunSession.getTestRunName()); |
1548 |
if (testKindDisplayStr != null) |
1728 |
if (testKindDisplayStr != null) |
1549 |
setTitleToolTip(MessageFormat.format(JUnitMessages.TestRunnerViewPart_titleToolTip, new Object[] {testRunLabel, testKindDisplayStr})); |
1729 |
setTitleToolTip(MessageFormat.format(JUnitMessages.TestRunnerViewPart_titleToolTip, new Object[] { testRunLabel, testKindDisplayStr })); |
1550 |
else |
1730 |
else |
1551 |
setTitleToolTip(testRunLabel); |
1731 |
setTitleToolTip(testRunLabel); |
1552 |
} |
1732 |
} |
1553 |
|
1733 |
|
1554 |
@Override |
1734 |
@Override |
1555 |
public synchronized void dispose(){ |
1735 |
public synchronized void dispose() { |
1556 |
fIsDisposed= true; |
1736 |
fIsDisposed= true; |
1557 |
if (fTestRunSessionListener != null) |
1737 |
if (fTestRunSessionListener != null) |
1558 |
JUnitCorePlugin.getModel().removeTestRunSessionListener(fTestRunSessionListener); |
1738 |
JUnitCorePlugin.getModel().removeTestRunSessionListener(fTestRunSessionListener); |
1559 |
|
1739 |
|
1560 |
IHandlerService handlerService= (IHandlerService) getSite().getWorkbenchWindow().getService(IHandlerService.class); |
1740 |
IHandlerService handlerService= (IHandlerService)getSite().getWorkbenchWindow().getService(IHandlerService.class); |
1561 |
handlerService.deactivateHandler(fRerunLastActivation); |
1741 |
handlerService.deactivateHandler(fRerunLastActivation); |
1562 |
handlerService.deactivateHandler(fRerunFailedFirstActivation); |
1742 |
handlerService.deactivateHandler(fRerunFailedFirstActivation); |
1563 |
setActiveTestRunSession(null); |
1743 |
setActiveTestRunSession(null); |
Lines 1579-1584
Link Here
|
1579 |
if (fFailureTrace != null) { |
1759 |
if (fFailureTrace != null) { |
1580 |
fFailureTrace.dispose(); |
1760 |
fFailureTrace.dispose(); |
1581 |
} |
1761 |
} |
|
|
1762 |
getSite().getPage().removePostSelectionListener(fTestViewer); |
1582 |
} |
1763 |
} |
1583 |
|
1764 |
|
1584 |
private void disposeImages() { |
1765 |
private void disposeImages() { |
Lines 1593-1599
Link Here
|
1593 |
} |
1774 |
} |
1594 |
|
1775 |
|
1595 |
private void refreshCounters() { |
1776 |
private void refreshCounters() { |
1596 |
// TODO: Inefficient. Either |
1777 |
// TODO: Inefficient. Either |
1597 |
// - keep a boolean fHasTestRun and update only on changes, or |
1778 |
// - keep a boolean fHasTestRun and update only on changes, or |
1598 |
// - improve components to only redraw on changes (once!). |
1779 |
// - improve components to only redraw on changes (once!). |
1599 |
|
1780 |
|
Lines 1612-1618
Link Here
|
1612 |
totalCount= fTestRunSession.getTotalCount(); |
1793 |
totalCount= fTestRunSession.getTotalCount(); |
1613 |
errorCount= fTestRunSession.getErrorCount(); |
1794 |
errorCount= fTestRunSession.getErrorCount(); |
1614 |
failureCount= fTestRunSession.getFailureCount(); |
1795 |
failureCount= fTestRunSession.getFailureCount(); |
1615 |
assumptionFailureCount = fTestRunSession.getAssumptionFailureCount(); |
1796 |
assumptionFailureCount= fTestRunSession.getAssumptionFailureCount(); |
1616 |
hasErrorsOrFailures= errorCount + failureCount > 0; |
1797 |
hasErrorsOrFailures= errorCount + failureCount > 0; |
1617 |
stopped= fTestRunSession.isStopped(); |
1798 |
stopped= fTestRunSession.isStopped(); |
1618 |
} else { |
1799 |
} else { |
Lines 1621-1627
Link Here
|
1621 |
totalCount= 0; |
1802 |
totalCount= 0; |
1622 |
errorCount= 0; |
1803 |
errorCount= 0; |
1623 |
failureCount= 0; |
1804 |
failureCount= 0; |
1624 |
assumptionFailureCount = 0; |
1805 |
assumptionFailureCount= 0; |
1625 |
hasErrorsOrFailures= false; |
1806 |
hasErrorsOrFailures= false; |
1626 |
stopped= false; |
1807 |
stopped= false; |
1627 |
} |
1808 |
} |
Lines 1634-1640
Link Here
|
1634 |
int ticksDone; |
1815 |
int ticksDone; |
1635 |
if (startedCount == 0) |
1816 |
if (startedCount == 0) |
1636 |
ticksDone= 0; |
1817 |
ticksDone= 0; |
1637 |
else if (startedCount == totalCount && ! fTestRunSession.isRunning()) |
1818 |
else if (startedCount == totalCount && !fTestRunSession.isRunning()) |
1638 |
ticksDone= totalCount; |
1819 |
ticksDone= totalCount; |
1639 |
else |
1820 |
else |
1640 |
ticksDone= startedCount - 1; |
1821 |
ticksDone= startedCount - 1; |
Lines 1660-1666
Link Here
|
1660 |
if (page != null) { |
1841 |
if (page != null) { |
1661 |
try { // show the result view |
1842 |
try { // show the result view |
1662 |
testRunner= (TestRunnerViewPart)page.findView(TestRunnerViewPart.NAME); |
1843 |
testRunner= (TestRunnerViewPart)page.findView(TestRunnerViewPart.NAME); |
1663 |
if(testRunner == null) { |
1844 |
if (testRunner == null) { |
1664 |
IWorkbenchPart activePart= page.getActivePart(); |
1845 |
IWorkbenchPart activePart= page.getActivePart(); |
1665 |
testRunner= (TestRunnerViewPart)page.showView(TestRunnerViewPart.NAME, null, IWorkbenchPage.VIEW_VISIBLE); |
1846 |
testRunner= (TestRunnerViewPart)page.showView(TestRunnerViewPart.NAME, null, IWorkbenchPage.VIEW_VISIBLE); |
1666 |
//restore focus |
1847 |
//restore focus |
Lines 1696-1701
Link Here
|
1696 |
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { |
1877 |
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { |
1697 |
return new Point(1, 1); // (0, 0) does not work with super-intelligent ViewForm |
1878 |
return new Point(1, 1); // (0, 0) does not work with super-intelligent ViewForm |
1698 |
} |
1879 |
} |
|
|
1880 |
|
1699 |
@Override |
1881 |
@Override |
1700 |
protected void layout(Composite composite, boolean flushCache) { |
1882 |
protected void layout(Composite composite, boolean flushCache) { |
1701 |
} |
1883 |
} |
Lines 1715-1721
Link Here
|
1715 |
fFailureTrace= new FailureTrace(bottom, fClipboard, this, failureToolBar); |
1897 |
fFailureTrace= new FailureTrace(bottom, fClipboard, this, failureToolBar); |
1716 |
bottom.setContent(fFailureTrace.getComposite()); |
1898 |
bottom.setContent(fFailureTrace.getComposite()); |
1717 |
|
1899 |
|
1718 |
fSashForm.setWeights(new int[]{50, 50}); |
1900 |
fSashForm.setWeights(new int[] { 50, 50 }); |
1719 |
return fSashForm; |
1901 |
return fSashForm; |
1720 |
} |
1902 |
} |
1721 |
|
1903 |
|
Lines 1750-1764
Link Here
|
1750 |
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); |
1932 |
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); |
1751 |
|
1933 |
|
1752 |
IActionBars actionBars= getViewSite().getActionBars(); |
1934 |
IActionBars actionBars= getViewSite().getActionBars(); |
1753 |
|
1935 |
|
1754 |
fCopyAction = new JUnitCopyAction(fFailureTrace, fClipboard); |
1936 |
fCopyAction= new JUnitCopyAction(fFailureTrace, fClipboard); |
1755 |
fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId()); |
1937 |
fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId()); |
1756 |
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction); |
1938 |
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction); |
1757 |
|
1939 |
|
1758 |
fPasteAction= new JUnitPasteAction(parent.getShell(), fClipboard); |
1940 |
fPasteAction= new JUnitPasteAction(parent.getShell(), fClipboard); |
1759 |
fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId()); |
1941 |
fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId()); |
1760 |
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction); |
1942 |
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction); |
1761 |
|
1943 |
|
1762 |
initPageSwitcher(); |
1944 |
initPageSwitcher(); |
1763 |
addDropAdapter(parent); |
1945 |
addDropAdapter(parent); |
1764 |
|
1946 |
|
Lines 1777-1783
Link Here
|
1777 |
|
1959 |
|
1778 |
fTestRunSessionListener= new TestRunSessionListener(); |
1960 |
fTestRunSessionListener= new TestRunSessionListener(); |
1779 |
JUnitCorePlugin.getModel().addTestRunSessionListener(fTestRunSessionListener); |
1961 |
JUnitCorePlugin.getModel().addTestRunSessionListener(fTestRunSessionListener); |
1780 |
|
1962 |
|
1781 |
// always show youngest test run in view. simulate "sessionAdded" event to do that |
1963 |
// always show youngest test run in view. simulate "sessionAdded" event to do that |
1782 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
1964 |
List<TestRunSession> testRunSessions= JUnitCorePlugin.getModel().getTestRunSessions(); |
1783 |
if (!testRunSessions.isEmpty()) { |
1965 |
if (!testRunSessions.isEmpty()) { |
Lines 1786-1816
Link Here
|
1786 |
} |
1968 |
} |
1787 |
|
1969 |
|
1788 |
private void addDropAdapter(Composite parent) { |
1970 |
private void addDropAdapter(Composite parent) { |
1789 |
DropTarget dropTarget = new DropTarget(parent, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT); |
1971 |
DropTarget dropTarget= new DropTarget(parent, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT); |
1790 |
dropTarget.setTransfer(new Transfer[] { TextTransfer.getInstance() }); |
1972 |
dropTarget.setTransfer(new Transfer[] { TextTransfer.getInstance() }); |
1791 |
class DropAdapter extends DropTargetAdapter { |
1973 |
class DropAdapter extends DropTargetAdapter { |
1792 |
@Override |
1974 |
@Override |
1793 |
public void dragEnter(DropTargetEvent event) { |
1975 |
public void dragEnter(DropTargetEvent event) { |
1794 |
event.detail = DND.DROP_COPY; |
1976 |
event.detail= DND.DROP_COPY; |
1795 |
event.feedback = DND.FEEDBACK_NONE; |
1977 |
event.feedback= DND.FEEDBACK_NONE; |
1796 |
} |
1978 |
} |
1797 |
@Override |
1979 |
|
|
|
1980 |
@Override |
1798 |
public void dragOver(DropTargetEvent event) { |
1981 |
public void dragOver(DropTargetEvent event) { |
1799 |
event.detail = DND.DROP_COPY; |
1982 |
event.detail= DND.DROP_COPY; |
1800 |
event.feedback = DND.FEEDBACK_NONE; |
1983 |
event.feedback= DND.FEEDBACK_NONE; |
1801 |
} |
1984 |
} |
1802 |
@Override |
1985 |
|
|
|
1986 |
@Override |
1803 |
public void dragOperationChanged(DropTargetEvent event) { |
1987 |
public void dragOperationChanged(DropTargetEvent event) { |
1804 |
event.detail = DND.DROP_COPY; |
1988 |
event.detail= DND.DROP_COPY; |
1805 |
event.feedback = DND.FEEDBACK_NONE; |
1989 |
event.feedback= DND.FEEDBACK_NONE; |
1806 |
} |
1990 |
} |
1807 |
@Override |
1991 |
|
|
|
1992 |
@Override |
1808 |
public void drop(final DropTargetEvent event) { |
1993 |
public void drop(final DropTargetEvent event) { |
1809 |
if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) { |
1994 |
if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) { |
1810 |
String url= (String) event.data; |
1995 |
String url= (String)event.data; |
1811 |
importTestRunSession(url); |
1996 |
importTestRunSession(url); |
1812 |
} |
1997 |
} |
1813 |
} |
1998 |
} |
1814 |
} |
1999 |
} |
1815 |
dropTarget.addDropListener(new DropAdapter()); |
2000 |
dropTarget.addDropListener(new DropAdapter()); |
1816 |
} |
2001 |
} |
Lines 1825-1831
Link Here
|
1825 |
|
2010 |
|
1826 |
@Override |
2011 |
@Override |
1827 |
public String getName(Object page) { |
2012 |
public String getName(Object page) { |
1828 |
return fViewHistory.getText((TestRunSession) page); |
2013 |
return fViewHistory.getText((TestRunSession)page); |
1829 |
} |
2014 |
} |
1830 |
|
2015 |
|
1831 |
@Override |
2016 |
@Override |
Lines 1835-1841
Link Here
|
1835 |
|
2020 |
|
1836 |
@Override |
2021 |
@Override |
1837 |
public void activatePage(Object page) { |
2022 |
public void activatePage(Object page) { |
1838 |
fViewHistory.setActiveEntry((TestRunSession) page); |
2023 |
fViewHistory.setActiveEntry((TestRunSession)page); |
1839 |
} |
2024 |
} |
1840 |
|
2025 |
|
1841 |
@Override |
2026 |
@Override |
Lines 1849-1854
Link Here
|
1849 |
parent.addControlListener(new ControlListener() { |
2034 |
parent.addControlListener(new ControlListener() { |
1850 |
public void controlMoved(ControlEvent e) { |
2035 |
public void controlMoved(ControlEvent e) { |
1851 |
} |
2036 |
} |
|
|
2037 |
|
1852 |
public void controlResized(ControlEvent e) { |
2038 |
public void controlResized(ControlEvent e) { |
1853 |
computeOrientation(); |
2039 |
computeOrientation(); |
1854 |
} |
2040 |
} |
Lines 1874-1880
Link Here
|
1874 |
private void configureToolBar() { |
2060 |
private void configureToolBar() { |
1875 |
IActionBars actionBars= getViewSite().getActionBars(); |
2061 |
IActionBars actionBars= getViewSite().getActionBars(); |
1876 |
IToolBarManager toolBar= actionBars.getToolBarManager(); |
2062 |
IToolBarManager toolBar= actionBars.getToolBarManager(); |
1877 |
IMenuManager viewMenu = actionBars.getMenuManager(); |
2063 |
IMenuManager viewMenu= actionBars.getMenuManager(); |
1878 |
|
2064 |
|
1879 |
fNextAction= new ShowNextFailureAction(this); |
2065 |
fNextAction= new ShowNextFailureAction(this); |
1880 |
fNextAction.setEnabled(false); |
2066 |
fNextAction.setEnabled(false); |
Lines 1887-1912
Link Here
|
1887 |
fStopAction= new StopAction(); |
2073 |
fStopAction= new StopAction(); |
1888 |
fStopAction.setEnabled(false); |
2074 |
fStopAction.setEnabled(false); |
1889 |
|
2075 |
|
|
|
2076 |
fLinkWithEditorAction= new LinkWithEditorAction(); |
2077 |
fLinkWithEditorAction.setEnabled(false); |
2078 |
|
1890 |
fRerunLastTestAction= new RerunLastAction(); |
2079 |
fRerunLastTestAction= new RerunLastAction(); |
1891 |
IHandlerService handlerService= (IHandlerService) getSite().getWorkbenchWindow().getService(IHandlerService.class); |
2080 |
IHandlerService handlerService= (IHandlerService)getSite().getWorkbenchWindow().getService(IHandlerService.class); |
1892 |
IHandler handler = new AbstractHandler() { |
2081 |
IHandler handler= new AbstractHandler() { |
1893 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
2082 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
1894 |
fRerunLastTestAction.run(); |
2083 |
fRerunLastTestAction.run(); |
1895 |
return null; |
2084 |
return null; |
1896 |
} |
2085 |
} |
|
|
2086 |
|
1897 |
@Override |
2087 |
@Override |
1898 |
public boolean isEnabled() { |
2088 |
public boolean isEnabled() { |
1899 |
return fRerunLastTestAction.isEnabled(); |
2089 |
return fRerunLastTestAction.isEnabled(); |
1900 |
} |
2090 |
} |
1901 |
}; |
2091 |
}; |
1902 |
fRerunLastActivation= handlerService.activateHandler(RERUN_LAST_COMMAND, handler); |
2092 |
fRerunLastActivation= handlerService.activateHandler(RERUN_LAST_COMMAND, handler); |
1903 |
|
2093 |
|
1904 |
fRerunFailedFirstAction= new RerunLastFailedFirstAction(); |
2094 |
fRerunFailedFirstAction= new RerunLastFailedFirstAction(); |
1905 |
handler = new AbstractHandler() { |
2095 |
handler= new AbstractHandler() { |
1906 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
2096 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
1907 |
fRerunFailedFirstAction.run(); |
2097 |
fRerunFailedFirstAction.run(); |
1908 |
return null; |
2098 |
return null; |
1909 |
} |
2099 |
} |
|
|
2100 |
|
1910 |
@Override |
2101 |
@Override |
1911 |
public boolean isEnabled() { |
2102 |
public boolean isEnabled() { |
1912 |
return fRerunFailedFirstAction.isEnabled(); |
2103 |
return fRerunFailedFirstAction.isEnabled(); |
Lines 1919-1929
Link Here
|
1919 |
fScrollLockAction= new ScrollLockAction(this); |
2110 |
fScrollLockAction= new ScrollLockAction(this); |
1920 |
fScrollLockAction.setChecked(!fAutoScroll); |
2111 |
fScrollLockAction.setChecked(!fAutoScroll); |
1921 |
|
2112 |
|
1922 |
fToggleOrientationActions = |
2113 |
fToggleOrientationActions= |
1923 |
new ToggleOrientationAction[] { |
2114 |
new ToggleOrientationAction[] { |
1924 |
new ToggleOrientationAction(VIEW_ORIENTATION_VERTICAL), |
2115 |
new ToggleOrientationAction(VIEW_ORIENTATION_VERTICAL), |
1925 |
new ToggleOrientationAction(VIEW_ORIENTATION_HORIZONTAL), |
2116 |
new ToggleOrientationAction(VIEW_ORIENTATION_HORIZONTAL), |
1926 |
new ToggleOrientationAction(VIEW_ORIENTATION_AUTOMATIC)}; |
2117 |
new ToggleOrientationAction(VIEW_ORIENTATION_AUTOMATIC) }; |
1927 |
|
2118 |
|
1928 |
fShowTestHierarchyAction= new ShowTestHierarchyAction(); |
2119 |
fShowTestHierarchyAction= new ShowTestHierarchyAction(); |
1929 |
fShowTimeAction= new ShowTimeAction(); |
2120 |
fShowTimeAction= new ShowTimeAction(); |
Lines 1937-1950
Link Here
|
1937 |
toolBar.add(fRerunFailedFirstAction); |
2128 |
toolBar.add(fRerunFailedFirstAction); |
1938 |
toolBar.add(fStopAction); |
2129 |
toolBar.add(fStopAction); |
1939 |
toolBar.add(fViewHistory.createHistoryDropDownAction()); |
2130 |
toolBar.add(fViewHistory.createHistoryDropDownAction()); |
1940 |
|
2131 |
toolBar.add(new Separator()); |
|
|
2132 |
toolBar.add(fLinkWithEditorAction); |
1941 |
|
2133 |
|
1942 |
viewMenu.add(fShowTestHierarchyAction); |
2134 |
viewMenu.add(fShowTestHierarchyAction); |
1943 |
viewMenu.add(fShowTimeAction); |
2135 |
viewMenu.add(fShowTimeAction); |
1944 |
viewMenu.add(new Separator()); |
2136 |
viewMenu.add(new Separator()); |
1945 |
|
2137 |
|
1946 |
MenuManager layoutSubMenu= new MenuManager(JUnitMessages.TestRunnerViewPart_layout_menu); |
2138 |
MenuManager layoutSubMenu= new MenuManager(JUnitMessages.TestRunnerViewPart_layout_menu); |
1947 |
for (int i = 0; i < fToggleOrientationActions.length; ++i) { |
2139 |
for (int i= 0; i < fToggleOrientationActions.length; ++i) { |
1948 |
layoutSubMenu.add(fToggleOrientationActions[i]); |
2140 |
layoutSubMenu.add(fToggleOrientationActions[i]); |
1949 |
} |
2141 |
} |
1950 |
viewMenu.add(layoutSubMenu); |
2142 |
viewMenu.add(layoutSubMenu); |
Lines 1983-1989
Link Here
|
1983 |
IEditorPart activeEditorPart= (IEditorPart)activePart; |
2175 |
IEditorPart activeEditorPart= (IEditorPart)activePart; |
1984 |
IEditorActionBarContributor contributor= activeEditorPart.getEditorSite().getActionBarContributor(); |
2176 |
IEditorActionBarContributor contributor= activeEditorPart.getEditorSite().getActionBarContributor(); |
1985 |
if (contributor instanceof EditorActionBarContributor) |
2177 |
if (contributor instanceof EditorActionBarContributor) |
1986 |
return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager(); |
2178 |
return ((EditorActionBarContributor)contributor).getActionBars().getStatusLineManager(); |
1987 |
} |
2179 |
} |
1988 |
// no active part |
2180 |
// no active part |
1989 |
return getViewSite().getActionBars().getStatusLineManager(); |
2181 |
return getViewSite().getActionBars().getStatusLineManager(); |
Lines 1995-2004
Link Here
|
1995 |
composite.setLayout(layout); |
2187 |
composite.setLayout(layout); |
1996 |
setCounterColumns(layout); |
2188 |
setCounterColumns(layout); |
1997 |
|
2189 |
|
1998 |
fCounterPanel = new CounterPanel(composite); |
2190 |
fCounterPanel= new CounterPanel(composite); |
1999 |
fCounterPanel.setLayoutData( |
2191 |
fCounterPanel.setLayoutData( |
2000 |
new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
2192 |
new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
2001 |
fProgressBar = new JUnitProgressBar(composite); |
2193 |
fProgressBar= new JUnitProgressBar(composite); |
2002 |
fProgressBar.setLayoutData( |
2194 |
fProgressBar.setLayoutData( |
2003 |
new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
2195 |
new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
2004 |
return composite; |
2196 |
return composite; |
Lines 2070-2076
Link Here
|
2070 |
public void rerunTest(String testId, String className, String testName, String launchMode) { |
2262 |
public void rerunTest(String testId, String className, String testName, String launchMode) { |
2071 |
if (lastLaunchIsKeptAlive()) { |
2263 |
if (lastLaunchIsKeptAlive()) { |
2072 |
fTestRunSession.rerunTest(testId, className, testName); |
2264 |
fTestRunSession.rerunTest(testId, className, testName); |
2073 |
TestCaseElement testCaseElement= (TestCaseElement) fTestRunSession.getTestElement(testId); |
2265 |
TestCaseElement testCaseElement= (TestCaseElement)fTestRunSession.getTestElement(testId); |
2074 |
testCaseElement.setStatus(TestElement.Status.RUNNING, null, null, null); |
2266 |
testCaseElement.setStatus(TestElement.Status.RUNNING, null, null, null); |
2075 |
fTestViewer.registerViewerUpdate(testCaseElement); |
2267 |
fTestViewer.registerViewerUpdate(testCaseElement); |
2076 |
postSyncProcessChanges(); |
2268 |
postSyncProcessChanges(); |
Lines 2086-2094
Link Here
|
2086 |
try { |
2278 |
try { |
2087 |
String name= className; |
2279 |
String name= className; |
2088 |
if (testName != null) |
2280 |
if (testName != null) |
2089 |
name+= "."+testName; //$NON-NLS-1$ |
2281 |
name+= "." + testName; //$NON-NLS-1$ |
2090 |
String configName= Messages.format(JUnitMessages.TestRunnerViewPart_configName, name); |
2282 |
String configName= Messages.format(JUnitMessages.TestRunnerViewPart_configName, name); |
2091 |
ILaunchConfigurationWorkingCopy tmp = launchConfiguration.copy(configName); |
2283 |
ILaunchConfigurationWorkingCopy tmp= launchConfiguration.copy(configName); |
2092 |
// fix for bug: 64838 junit view run single test does not use correct class [JUnit] |
2284 |
// fix for bug: 64838 junit view run single test does not use correct class [JUnit] |
2093 |
tmp.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, className); |
2285 |
tmp.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, className); |
2094 |
// reset the container |
2286 |
// reset the container |
Lines 2098-2109
Link Here
|
2098 |
} |
2290 |
} |
2099 |
relaunch(tmp, launchMode); |
2291 |
relaunch(tmp, launchMode); |
2100 |
return; |
2292 |
return; |
2101 |
} catch (CoreException e) { |
2293 |
} catch (CoreException e) { |
2102 |
ErrorDialog.openError(getSite().getShell(), |
2294 |
ErrorDialog.openError(getSite().getShell(), |
2103 |
JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus() |
2295 |
JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus() |
2104 |
); |
2296 |
); |
2105 |
return; |
2297 |
return; |
2106 |
} |
2298 |
} |
2107 |
} |
2299 |
} |
2108 |
} |
2300 |
} |
2109 |
} |
2301 |
} |
Lines 2134-2145
Link Here
|
2134 |
private void setOrientation(int orientation) { |
2326 |
private void setOrientation(int orientation) { |
2135 |
if ((fSashForm == null) || fSashForm.isDisposed()) |
2327 |
if ((fSashForm == null) || fSashForm.isDisposed()) |
2136 |
return; |
2328 |
return; |
2137 |
boolean horizontal = orientation == VIEW_ORIENTATION_HORIZONTAL; |
2329 |
boolean horizontal= orientation == VIEW_ORIENTATION_HORIZONTAL; |
2138 |
fSashForm.setOrientation(horizontal ? SWT.HORIZONTAL : SWT.VERTICAL); |
2330 |
fSashForm.setOrientation(horizontal ? SWT.HORIZONTAL : SWT.VERTICAL); |
2139 |
for (int i = 0; i < fToggleOrientationActions.length; ++i) |
2331 |
for (int i= 0; i < fToggleOrientationActions.length; ++i) |
2140 |
fToggleOrientationActions[i].setChecked(fOrientation == fToggleOrientationActions[i].getOrientation()); |
2332 |
fToggleOrientationActions[i].setChecked(fOrientation == fToggleOrientationActions[i].getOrientation()); |
2141 |
fCurrentOrientation = orientation; |
2333 |
fCurrentOrientation= orientation; |
2142 |
GridLayout layout= (GridLayout) fCounterComposite.getLayout(); |
2334 |
GridLayout layout= (GridLayout)fCounterComposite.getLayout(); |
2143 |
setCounterColumns(layout); |
2335 |
setCounterColumns(layout); |
2144 |
fParent.layout(); |
2336 |
fParent.layout(); |
2145 |
} |
2337 |
} |
Lines 2165-2171
Link Here
|
2165 |
} catch (InterruptedException e) { |
2357 |
} catch (InterruptedException e) { |
2166 |
// cancelled |
2358 |
// cancelled |
2167 |
} catch (InvocationTargetException e) { |
2359 |
} catch (InvocationTargetException e) { |
2168 |
CoreException ce= (CoreException) e.getCause(); |
2360 |
CoreException ce= (CoreException)e.getCause(); |
2169 |
StatusManager.getManager().handle(ce.getStatus(), StatusManager.SHOW | StatusManager.LOG); |
2361 |
StatusManager.getManager().handle(ce.getStatus(), StatusManager.SHOW | StatusManager.LOG); |
2170 |
} |
2362 |
} |
2171 |
} |
2363 |
} |