1 /*******************************************************************************
2 * Copyright (c) 2017 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.tmf
.ui
.markers
;
15 import org
.eclipse
.tracecompass
.internal
.tmf
.core
.markers
.MarkerConfigXmlParser
;
16 import org
.eclipse
.tracecompass
.internal
.tmf
.core
.markers
.MarkerSet
;
17 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.AbstractTmfTraceAdapterFactory
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
19 import org
.eclipse
.tracecompass
.tmf
.ui
.widgets
.timegraph
.model
.IMarkerEventSource
;
22 * Configurable marker event source factory.
24 public class ConfigurableMarkerEventSourceFactory
extends AbstractTmfTraceAdapterFactory
{
27 protected <T
> T
getTraceAdapter(ITmfTrace trace
, Class
<T
> adapterType
) {
28 if (IMarkerEventSource
.class.equals(adapterType
)) {
29 ConfigurableMarkerEventSource adapter
= new ConfigurableMarkerEventSource(trace
);
31 return adapterType
.cast(adapter
);
37 public Class
<?
>[] getAdapterList() {
39 IMarkerEventSource
.class
43 private static void configure(ConfigurableMarkerEventSource source
) {
44 String defaultMarkerSetId
= MarkerUtils
.getDefaultMarkerSetId();
45 for (MarkerSet markerSet
: MarkerConfigXmlParser
.getMarkerSets()) {
46 if (markerSet
.getId().equals(defaultMarkerSetId
)) {
47 source
.configure(markerSet
);