Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,19 @@ public void widgetSelected(SelectionEvent e) {
}
});

// join the running test jobs
// Cancel the job family (all TestJobs have the same family)
Button cancelFamily = new Button(group, SWT.PUSH);
cancelFamily.setText("Cancel Job family"); //$NON-NLS-1$
cancelFamily.setToolTipText("IJobManager.cancel() on test jobs"); //$NON-NLS-1$
cancelFamily.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
cancelFamily.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
cancelTestJobs();
}
});

// Put all jobs to sleep
Button sleep = new Button(group, SWT.PUSH);
sleep.setText("Sleep"); //$NON-NLS-1$
sleep.setToolTipText("Calls sleep() on all TestJobs"); //$NON-NLS-1$
Expand All @@ -259,7 +271,7 @@ public void widgetSelected(SelectionEvent e) {
}
});

// join the running test jobs
// Wake up all jobs
Button wake = new Button(group, SWT.PUSH);
wake.setText("WakeUp"); //$NON-NLS-1$
wake.setToolTipText("Calls wakeUp() on all TestJobs"); //$NON-NLS-1$
Expand Down Expand Up @@ -540,6 +552,14 @@ protected void joinTestJobs() {
}
}

private void cancelTestJobs() {
try {
progressService.busyCursorWhile(__ -> Job.getJobManager().cancel(TestJob.FAMILY_TEST_JOB));
} catch (InterruptedException | InvocationTargetException e) {
e.printStackTrace();
}
}

protected void progressNoFork() {
try {
final long duration = getDuration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,28 @@ private void createPushButtonGroup(Composite parent) {
join.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
join.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> joinTestJobs()));

// join the running test jobs
// Cancel the job family (all TestJobs have the same family)
Button cancelFamily = new Button(group, SWT.PUSH);
cancelFamily.setText("Cancel Job family"); //$NON-NLS-1$
cancelFamily.setToolTipText("IJobManager.cancel() on test jobs"); //$NON-NLS-1$
cancelFamily.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
cancelFamily.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> cancelTestJobs()));

// Use a runnable context
Button window = new Button(group, SWT.PUSH);
window.setText("Runnable in Window"); //$NON-NLS-1$
window.setToolTipText("Using a runnable context in the workbench window"); //$NON-NLS-1$
window.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
window.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> runnableInWindow()));

// join the running test jobs
// Put all jobs to sleep
Button sleep = new Button(group, SWT.PUSH);
sleep.setText("Sleep"); //$NON-NLS-1$
sleep.setToolTipText("Calls sleep() on all TestJobs"); //$NON-NLS-1$
sleep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
sleep.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> doSleep()));

// join the running test jobs
// Wake up all jobs
Button wake = new Button(group, SWT.PUSH);
wake.setText("WakeUp"); //$NON-NLS-1$
wake.setToolTipText("Calls wakeUp() on all TestJobs"); //$NON-NLS-1$
Expand Down Expand Up @@ -542,6 +549,15 @@ protected void joinTestJobs() {
}
}

private void cancelTestJobs() {
try {
PlatformUI.getWorkbench().getProgressService()
.busyCursorWhile(monitor -> Job.getJobManager().cancel(TestJob.FAMILY_TEST_JOB));
} catch (InterruptedException | InvocationTargetException e) {
e.printStackTrace();
}
}

protected void progressNoFork() {
try {
final long duration = getDuration();
Expand Down
Loading