Skip to content

Commit

Permalink
scripting: Replace hardcoded DP separator with existing constant
Browse files Browse the repository at this point in the history
Change-Id: Iecc1ce47e82549ee423836b0dc47b12e3176d746
Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/193300
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
  • Loading branch information
bhufmann committed May 13, 2022
1 parent a7d74f4 commit 84c41e3
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Collection;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.core.dataprovider.DataProviderManager;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataProvider;
Expand Down Expand Up @@ -90,7 +91,7 @@ public ScriptingDataProviderManager() {
public @Nullable ITmfTreeDataProvider<? extends ITmfTreeDataModel> getProvider(ITmfTrace trace, String id) {
Collection<ITmfTreeDataProvider<? extends ITmfTreeDataModel>> dps = fInstances.get(trace);
for (ITmfTreeDataProvider<? extends ITmfTreeDataModel> dataProvider : dps) {
if (dataProvider.getId().equals(PROVIDER_ID + ':' + id)) {
if (dataProvider.getId().equals(PROVIDER_ID + DataProviderConstants.ID_SEPARATOR + id)) {
return dataProvider;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphArrow;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphDataProvider;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphEntryModel;
Expand Down Expand Up @@ -228,7 +229,7 @@ public class DataProviderScriptingModule {
DataDrivenOutputEntry entry = new DataDrivenOutputEntry(Collections.emptyList(), path, null, true,
display, id, parent, name, DisplayType.ABSOLUTE);

ITimeGraphDataProvider<TimeGraphEntryModel> provider = DataDrivenTimeGraphProviderFactory.create(trace, stateSystems, Collections.singletonList(entry), Collections.emptyList(), ScriptingDataProviderManager.PROVIDER_ID + ':' + analysisName);
ITimeGraphDataProvider<TimeGraphEntryModel> provider = DataDrivenTimeGraphProviderFactory.create(trace, stateSystems, Collections.singletonList(entry), Collections.emptyList(), ScriptingDataProviderManager.PROVIDER_ID + DataProviderConstants.ID_SEPARATOR + analysisName);
ScriptingDataProviderManager.getInstance().registerDataProvider(trace, provider);
return provider;
}
Expand Down Expand Up @@ -368,7 +369,7 @@ public class DataProviderScriptingModule {
DataDrivenOutputEntry entry = new DataDrivenOutputEntry(Collections.emptyList(), path, null, true,
display, id, parent, name, displayType);

ITmfTreeXYDataProvider<ITmfTreeDataModel> provider = DataDrivenXYProviderFactory.create(trace, stateSystems, Collections.singletonList(entry), ScriptingDataProviderManager.PROVIDER_ID + ':' + analysisName);
ITmfTreeXYDataProvider<ITmfTreeDataModel> provider = DataDrivenXYProviderFactory.create(trace, stateSystems, Collections.singletonList(entry), ScriptingDataProviderManager.PROVIDER_ID + DataProviderConstants.ID_SEPARATOR + analysisName);
ScriptingDataProviderManager.getInstance().registerDataProvider(trace, provider);
return provider;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.swt.widgets.Composite;

import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.xychart.ScriptedXYTreeViewer;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfXYChartSettings;
Expand Down Expand Up @@ -60,6 +61,6 @@ protected TmfXYChartViewer createChartViewer(Composite parent) {
}

private String getSecondaryIdName() {
return getViewSite().getSecondaryId().replace(ScriptedHistogramView.COLON, ":"); //$NON-NLS-1$
return getViewSite().getSecondaryId().replace(ScriptedHistogramView.COLON, DataProviderConstants.ID_SEPARATOR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.swt.widgets.Composite;

import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.xychart.ScriptedXYTreeViewer;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer;
Expand Down Expand Up @@ -61,6 +62,6 @@ protected TmfXYChartViewer createChartViewer(Composite parent) {
}

private String getSecondaryIdName() {
return getViewSite().getSecondaryId().replace(ScriptedScatterView.COLON, ":"); //$NON-NLS-1$
return getViewSite().getSecondaryId().replace(ScriptedScatterView.COLON, DataProviderConstants.ID_SEPARATOR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.incubator.internal.scripting.core.data.provider.ScriptedTimeGraphDataProvider;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.core.dataprovider.DataProviderManager;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphDataProvider;
import org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel;
Expand Down Expand Up @@ -58,7 +59,7 @@ public ScriptedTimeGraphView() {
protected String getProviderId() {
String secondaryId = getViewSite().getSecondaryId();
if (secondaryId != null) {
return secondaryId.replace(COLON, ":"); //$NON-NLS-1$
return secondaryId.replace(COLON, DataProviderConstants.ID_SEPARATOR);
}
return super.getProviderId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer;
Expand Down Expand Up @@ -60,6 +61,6 @@ protected TmfXYChartViewer createChartViewer(Composite parent) {
}

private String getSecondaryIdName() {
return getViewSite().getSecondaryId().replace(ScriptedXYView.COLON, ":"); //$NON-NLS-1$
return getViewSite().getSecondaryId().replace(ScriptedXYView.COLON, DataProviderConstants.ID_SEPARATOR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.scatter.ScriptedScatterView;
import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.timegraph.ScriptedTimeGraphView;
import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.xychart.ScriptedXYView;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphDataProvider;
import org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;
Expand Down Expand Up @@ -75,7 +76,7 @@ public void openTimeGraphView(ITimeGraphDataProvider<TimeGraphEntryModel> dataPr
final IWorkbench wb = PlatformUI.getWorkbench();
final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();

return activePage.showView(ScriptedTimeGraphView.ID, name.replace(":", ScriptedTimeGraphView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
return activePage.showView(ScriptedTimeGraphView.ID, name.replace(DataProviderConstants.ID_SEPARATOR, ScriptedTimeGraphView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
}

/**
Expand Down Expand Up @@ -149,7 +150,7 @@ public void run() {
final IWorkbench wb = PlatformUI.getWorkbench();
final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();

return activePage.showView(ScriptedXYView.ID, name.replace(":", ScriptedXYView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
return activePage.showView(ScriptedXYView.ID, name.replace(DataProviderConstants.ID_SEPARATOR, ScriptedXYView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
}

/**
Expand Down Expand Up @@ -179,7 +180,7 @@ public void run() {
final IWorkbench wb = PlatformUI.getWorkbench();
final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();

return activePage.showView(ScriptedHistogramView.ID, name.replace(":", ScriptedHistogramView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
return activePage.showView(ScriptedHistogramView.ID, name.replace(DataProviderConstants.ID_SEPARATOR, ScriptedHistogramView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
}

/**
Expand Down Expand Up @@ -209,7 +210,7 @@ public void run() {
final IWorkbench wb = PlatformUI.getWorkbench();
final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();

return activePage.showView(ScriptedScatterView.ID, name.replace(":", ScriptedScatterView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
return activePage.showView(ScriptedScatterView.ID, name.replace(DataProviderConstants.ID_SEPARATOR, ScriptedScatterView.COLON), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
}

}

0 comments on commit 84c41e3

Please sign in to comment.