1
/*******************************************************************************
2
* Copyright (c) 2009 Red Hat, Inc.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Red Hat - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.linuxtools.internal.callgraph.core;
13
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Status;
16
import org.eclipse.jface.dialogs.MessageDialog;
17
import org.eclipse.swt.widgets.Shell;
18
import org.eclipse.ui.IWorkbenchWindow;
19
import org.eclipse.ui.PlatformUI;
20
import org.eclipse.ui.progress.UIJob;
23
* Convenience class for opening an error dialog from a non-UI job.
26
public class SystemTapUIErrorMessages extends UIJob {
27
private String title, message;
28
private static boolean active = true;
30
public SystemTapUIErrorMessages(String name, String title, String message) {
33
this.message = message;
37
public IStatus runInUIThread(IProgressMonitor monitor) {
39
return Status.CANCEL_STATUS;
40
//Test that this job is running in the UI thread
41
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
44
return Status.CANCEL_STATUS; //Something is wrong!
47
Shell sh = new Shell();
50
MessageDialog.openError(sh, title, message);
51
return Status.OK_STATUS;
55
public static boolean isActive() {
59
public static void setActive(boolean val) {