ca.cdtdoug.dasesp.esp8266.rtos.ui.internal.ESP8266LabelProvider.java Source code

Java tutorial

Introduction

Here is the source code for ca.cdtdoug.dasesp.esp8266.rtos.ui.internal.ESP8266LabelProvider.java

Source

/*******************************************************************************
 * Copyright (c) 2016 QNX Software Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package ca.cdtdoug.dasesp.esp8266.rtos.ui.internal;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.launchbar.core.target.ILaunchTarget;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.swt.graphics.Image;

public class ESP8266LabelProvider extends LabelProvider {

    @Override
    public String getText(Object element) {
        if (element instanceof ILaunchTarget) {
            return ((ILaunchTarget) element).getId();
        } else if (element instanceof IRemoteConnection) {
            return ((IRemoteConnection) element).getName();
        } else {
            return super.getText(element);
        }
    }

    @Override
    public Image getImage(Object element) {
        return Activator.getDefault().getImageRegistry().get(Activator.IMG_ESPLOGO);
    }

}