blob: f8d2eacc5bf1f83ee5667d4e37474469c78d5355 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2016, 2019 Chalmers | University of Gothenburg, rt-labs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Chalmers | University of Gothenburg and rt-labs - initial API and implementation and/or initial documentation
* Chalmers | University of Gothenburg - additional features, updated API
*******************************************************************************/
package org.eclipse.capra.ui.zest;
import java.util.Optional;
import org.eclipse.capra.core.helpers.ExtensionPointHelper;
import org.eclipse.jface.viewers.LabelProvider;
/**
*
* This class provides labels for the nodes and edges for the graph to be
* displayed in the zest view.
*
*/
public class TraceNodeLabelProvider extends LabelProvider {
@Override
public String getText(Object element) {
return ExtensionPointHelper.getArtifactHandlers().stream()
.map(handler -> handler.withCastedHandler(element, (h, e) -> h.getDisplayName(e)))
.filter(Optional::isPresent)
.map(Optional::get)
.findFirst()
.orElseGet(element::toString);
}
// TODO Add labels for the edges
}