use of org.eclipse.tracecompass.tmf.core.model.OutputStyleModel in project tracecompass by tracecompass.
the class BaseXYPresentationProvider method fetchStyles.
/**
* Use the
* {@link IOutputStyleProvider#fetchStyle(Map, org.eclipse.core.runtime.IProgressMonitor)}
* to fetch the appropriate style for a specific provider ID given by
* getProviderId. Everything is stored in a map of styles where the keys are
* string that will be used in states and the value are
* {@link OutputElementStyle}
*
* @return The style map
*/
private Map<@NonNull String, @NonNull OutputElementStyle> fetchStyles() {
Map<String, OutputElementStyle> stylesMap = fStylesMap;
if (stylesMap == null) {
stylesMap = new LinkedHashMap<>();
synchronized (fProviders) {
for (ITmfTreeXYDataProvider<?> provider : fProviders) {
if (provider instanceof IOutputStyleProvider) {
TmfModelResponse<@NonNull OutputStyleModel> styleResponse = ((IOutputStyleProvider) provider).fetchStyle(getStyleParameters(), null);
OutputStyleModel styleModel = styleResponse.getModel();
if (styleModel != null) {
for (Entry<String, OutputElementStyle> entry : styleModel.getStyles().entrySet()) {
OutputElementStyle style = entry.getValue();
// Make sure the style values map is mutable
stylesMap.put(entry.getKey(), new OutputElementStyle(style.getParentKey(), Maps.newHashMap(style.getStyleValues())));
}
}
}
}
}
fStylesMap = stylesMap;
}
return stylesMap;
}
use of org.eclipse.tracecompass.tmf.core.model.OutputStyleModel in project tracecompass by tracecompass.
the class BaseDataProviderTimeGraphPresentationProvider method fetchStyles.
/**
* Use the
* {@link IOutputStyleProvider#fetchStyle(Map, org.eclipse.core.runtime.IProgressMonitor)}
* to fetch the appropriate style for a specific provider ID given by
* getProviderId. Everything is stored in a map of styles where the keys are
* string that will be used in states and the value are
* {@link OutputElementStyle}
*
* @return The style map
*/
private Map<@NonNull String, @NonNull OutputElementStyle> fetchStyles() {
Map<String, OutputElementStyle> stylesMap = fStylesMap;
if (stylesMap == null) {
stylesMap = new LinkedHashMap<>();
synchronized (fProviders) {
for (ITimeGraphDataProvider<?> provider : fProviders.keySet()) {
if (provider instanceof IOutputStyleProvider) {
TmfModelResponse<@NonNull OutputStyleModel> styleResponse = ((IOutputStyleProvider) provider).fetchStyle(getStyleParameters(), null);
OutputStyleModel styleModel = styleResponse.getModel();
if (styleModel != null) {
for (Entry<String, OutputElementStyle> entry : styleModel.getStyles().entrySet()) {
OutputElementStyle style = entry.getValue();
// Make sure the style values map is mutable
stylesMap.put(entry.getKey(), new OutputElementStyle(style.getParentKey(), Maps.newHashMap(style.getStyleValues())));
}
}
}
}
}
fStylesMap = stylesMap;
}
return stylesMap;
}
use of org.eclipse.tracecompass.tmf.core.model.OutputStyleModel in project tracecompass by tracecompass.
the class TmfTimeGraphCompositeDataProvider method fetchStyle.
@Override
public TmfModelResponse<OutputStyleModel> fetchStyle(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
Map<String, OutputElementStyle> styles = new HashMap<>();
for (P dataProvider : getProviders()) {
if (dataProvider instanceof IOutputStyleProvider) {
TmfModelResponse<OutputStyleModel> response = ((IOutputStyleProvider) dataProvider).fetchStyle(fetchParameters, monitor);
OutputStyleModel model = response.getModel();
if (model != null) {
styles.putAll(model.getStyles());
}
}
}
if (styles.isEmpty()) {
return new TmfModelResponse<>(null, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
return new TmfModelResponse<>(new OutputStyleModel(styles), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
Aggregations