Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9bbaba26c9edcf929f8528783c18082c43c1565d (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
/*******************************************************************************
 * Copyright (c) 2008, 2018 Red Hat, Inc.
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Kent Sebastian <ksebasti@redhat.com> - initial API and implementation,
 *        adapted from Keith Seitz's ProfileLabelProvider
 *******************************************************************************/
package org.eclipse.linuxtools.internal.oprofile.ui.view;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement;
import org.eclipse.swt.graphics.Image;

/**
 * Content provider for OprofileView's tree viewer.
 */
public class OprofileViewLabelProvider extends LabelProvider {

    @Override
    public Image getImage(Object element) {
        Assert.isLegal(element instanceof IUiModelElement, "in OprofileViewLabelProvider"); //$NON-NLS-1$
        return ((IUiModelElement) element).getLabelImage();
    }

    @Override
    public String getText(Object element) {
        Assert.isLegal(element instanceof IUiModelElement, "in OprofileViewLabelProvider"); //$NON-NLS-1$
        return ((IUiModelElement) element).getLabelText();
    }

    @Override
    public boolean isLabelProperty(Object element, String property) {
        return false;
    }

}

Back to the top