Skip to content

Commit

Permalink
scripting: Update the XY views to new tracecompass API
Browse files Browse the repository at this point in the history
Trace Compass has moved from org.swtchart to org.eclipse.swtchart and
updated its API accordingly. The scripting views had not been updated
for it and the styles of scatter and histogram charts did not work
anymore (they were all line chart).

Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Change-Id: I571b2854f057ae7c61c513c7e49a25c24c914350
Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/172147
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
  • Loading branch information
tahini committed Nov 16, 2020
1 parent a6edfa9 commit 624bef8
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.xychart.ScriptedXYTreeViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfXYChartSettings;
import org.eclipse.tracecompass.tmf.ui.views.TmfChartView;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfXYChartSettings;
import org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView;

/**
* A data provider view to display the results of a scripted analysis. It uses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle;
import org.eclipse.tracecompass.tmf.core.presentation.IYAppearance;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfFilteredXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfXYChartSettings;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfXYChartSettings;

/**
* Viewer for the {@link ScriptedHistogramView}
Expand All @@ -26,13 +27,23 @@ public class ScriptedHistogramViewer extends TmfFilteredXYChartViewer {

private static final int DEFAULT_SERIES_WIDTH = 1;

/**
* Constructor
*
* @param parent
* Parent composite
* @param settings
* Chart settings
* @param providerId
* Data provider ID
*/
public ScriptedHistogramViewer(Composite parent, TmfXYChartSettings settings, String providerId) {
super(parent, settings, providerId);
}

@Override
public IYAppearance getSeriesAppearance(@NonNull String seriesName) {
return getPresentationProvider().getAppearance(seriesName, IYAppearance.Type.BAR, DEFAULT_SERIES_WIDTH);
public @NonNull OutputElementStyle getSeriesStyle(@NonNull Long seriesId) {
return getPresentationProvider().getSeriesStyle(seriesId, IYAppearance.Type.BAR, DEFAULT_SERIES_WIDTH);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.xychart.ScriptedXYTreeViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfXYChartSettings;
import org.eclipse.tracecompass.tmf.ui.views.TmfChartView;
import org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfXYChartSettings;


/**
* A data provider view to display the results of a scripted analysis. It uses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle;
import org.eclipse.tracecompass.tmf.core.presentation.IYAppearance;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfFilteredXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfXYChartSettings;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfXYChartSettings;

/**
* Viewer for the {@link ScriptedScatterView}
Expand All @@ -26,13 +27,23 @@ public class ScriptedScatterViewer extends TmfFilteredXYChartViewer {

private static final int DEFAULT_SERIES_WIDTH = 1;

/**
* Constructor
*
* @param parent
* Parent composite
* @param settings
* Chart settings
* @param providerId
* Data provider ID
*/
public ScriptedScatterViewer(Composite parent, TmfXYChartSettings settings, String providerId) {
super(parent, settings, providerId);
}

@Override
public IYAppearance getSeriesAppearance(@NonNull String seriesName) {
return getPresentationProvider().getAppearance(seriesName, IYAppearance.Type.SCATTER, DEFAULT_SERIES_WIDTH);
public @NonNull OutputElementStyle getSeriesStyle(@NonNull Long seriesId) {
return getPresentationProvider().getSeriesStyle(seriesId, IYAppearance.Type.SCATTER, DEFAULT_SERIES_WIDTH);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataProvider;
import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractSelectTreeViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractSelectTreeViewer2;
import org.eclipse.tracecompass.tmf.ui.viewers.tree.ITmfTreeColumnDataProvider;
import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfGenericTreeEntry;
import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeColumnData;
Expand All @@ -34,7 +34,7 @@
*
* @author Benjamin Saint-Cyr
*/
public class ScriptedXYTreeViewer extends AbstractSelectTreeViewer {
public class ScriptedXYTreeViewer extends AbstractSelectTreeViewer2 {

private final String fProviderId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfFilteredXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfXYChartSettings;
import org.eclipse.tracecompass.tmf.ui.views.TmfChartView;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfXYChartSettings;
import org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView;

/**
* A data provider view to display the results of a scripted analysis. It uses
Expand Down

0 comments on commit 624bef8

Please sign in to comment.