1 /*******************************************************************************
2  * Copyright (c) 2016, 2017 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.jdt.internal.debug.ui.actions;
15 
16 
17 
18 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
19 import org.eclipse.ui.IWorkbenchPart;
20 import org.eclipse.ui.texteditor.IEditorStatusLine;
21 
22 /**
23  * Utility class for Java Toggle breakpoints
24  */
25 public class BreakpointToggleUtils {
26 
27 	private static boolean isTracepoint = false;
28 
29 
setUnsetTracepoints(boolean tracePoint)30 	public static void setUnsetTracepoints(boolean tracePoint) {
31 		isTracepoint = tracePoint;
32 	}
33 
isToggleTracepoints()34 	public static boolean isToggleTracepoints() {
35 		return isTracepoint;
36 	}
37 
38 	/**
39 	 * Convenience method for printing messages to the status line
40 	 *
41 	 * @param message
42 	 *            the message to be displayed
43 	 * @param part
44 	 *            the currently active workbench part
45 	 */
report(final String message, final IWorkbenchPart part)46 	public static void report(final String message, final IWorkbenchPart part) {
47 		JDIDebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
48 			@Override
49 			public void run() {
50 				IEditorStatusLine statusLine = part.getAdapter(IEditorStatusLine.class);
51 				if (statusLine != null) {
52 					if (message != null) {
53 						statusLine.setMessage(true, message, null);
54 					} else {
55 						statusLine.setMessage(true, null, null);
56 					}
57 				}
58 			}
59 		});
60 	}
61 
62 }
63