Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3799f9468d5b411d88ce552fa0eab796990558a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*******************************************************************************
 * Copyright (c) 2012 Sebastian Schmidt and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Sebastian Schmidt - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.internal.ui.importexport.breakpoints;

import org.eclipse.core.resources.IMarker;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.swt.graphics.Image;

/**
 * A decorator which attaches the node path of breakpoints.
 */
public class BreakpointsPathDecorator extends BaseLabelProvider implements ILabelDecorator {

	@Override
	public Image decorateImage(Image image, Object element) {
		return null;
	}

	@Override
	public String decorateText(String text, Object element) {
		if (element instanceof IBreakpoint) {
			IBreakpoint breakpoint = (IBreakpoint) element;
			IMarker marker = breakpoint.getMarker();
			if (marker == null) {
				return null;
			}
			String path = marker.getAttribute(IImportExportConstants.IE_NODE_PATH, null);
			if (path != null && path.length() > 0) {
				return text + " [" + path + "]"; //$NON-NLS-1$ //$NON-NLS-2$
			}
		}

		return null;
	}
}

Back to the top