Skip to content

Commit

Permalink
Bug 581856: Remove the deprecated IElementResolver
Browse files Browse the repository at this point in the history
Replace it with ICoreElementResolver use, as prescribed by the
deprecation notice.

Deprecated in commit 2d3d2f0, since v7.1.0.

Bump the necessary versioning, based on the Eclipse API build.

Fix the default Eclipse formatting where lightly applicable while there.

Reorganize the imports while doing these replacements, accordingly.

[Removed] o.e.t.tmf.core.model.timegraph.IElementResolver

Change-Id: Ic0fd3f2461b210939abe721152c2a7ba39a45726
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/201542
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
marco-miller committed Apr 28, 2023
1 parent 1086ae9 commit 1b16126
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 129 deletions.
Expand Up @@ -45,8 +45,8 @@
import org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets.timegraph.BaseDataProviderTimeGraphPresentationProvider;
import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils;
import org.eclipse.tracecompass.tmf.core.dataprovider.DataProviderManager;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;
import org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphDataProvider;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphRowModel;
import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState;
Expand Down Expand Up @@ -91,7 +91,6 @@
* @author Patrick Tasse
* @author Geneviève Bastien
*/
@SuppressWarnings("deprecation")
public class FlameChartView extends BaseDataProviderTimeGraphView {

// ------------------------------------------------------------------------
Expand Down Expand Up @@ -591,8 +590,8 @@ protected void fillTimeGraphEntryContextMenu(IMenuManager menuManager) {
if (sSel.getFirstElement() instanceof TimeGraphEntry) {
TimeGraphEntry entry = (TimeGraphEntry) sSel.getFirstElement();
ITmfTreeDataModel entryModel = entry.getEntryModel();
if (entryModel instanceof IElementResolver) {
Multimap<String, Object> metadata = ((IElementResolver) entryModel).getMetadata();
if (entryModel instanceof ICoreElementResolver) {
Multimap<String, Object> metadata = ((ICoreElementResolver) entryModel).getMetadata();
Collection<Object> tids = metadata.get(OsStrings.tid());
if (tids.size() == 1) {
HostThread hostThread = new HostThread(getTrace(entry).getHostId(), (Integer) tids.iterator().next());
Expand Down
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Version: 7.0.0.qualifier
Bundle-Version: 8.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.tracecompass.analysis.os.linux.core;singleton:=true
Bundle-Activator: org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.os.linux.core.model.OsStrings;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.cpuusage.CpuUsageDataProvider;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;
import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel;

import com.google.common.collect.HashMultimap;
Expand All @@ -30,7 +30,7 @@
* @author Loic Prieur-Drevon
* @since 2.4
*/
public class CpuUsageEntryModel extends TmfTreeDataModel implements IElementResolver {
public class CpuUsageEntryModel extends TmfTreeDataModel implements ICoreElementResolver {
private final int fTid;
private final long fTime;
private final Multimap<String, Object> fMetadata;
Expand Down Expand Up @@ -110,6 +110,7 @@ public boolean equals(@Nullable Object obj) {
return fTid == other.fTid
&& fTime == other.fTime;
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), fTid, fTime);
Expand Down
Expand Up @@ -20,7 +20,7 @@
import org.eclipse.tracecompass.segmentstore.core.segment.interfaces.INamedSegment;
import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
Expand All @@ -31,7 +31,7 @@
* @author Alexandre Montplaisir
* @since 2.0
*/
public final class SystemCall implements INamedSegment, ITmfSourceLookup, IElementResolver {
public final class SystemCall implements INamedSegment, ITmfSourceLookup, ICoreElementResolver {

private static final long serialVersionUID = 1554494342105208730L;

Expand Down
Expand Up @@ -71,7 +71,7 @@
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
import org.eclipse.tracecompass.tmf.core.model.CoreFilterProperty;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;
import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect;
import org.eclipse.tracecompass.tmf.core.signal.TmfDataModelSelectedSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
Expand Down Expand Up @@ -153,8 +153,8 @@ public void widgetSelected(@Nullable SelectionEvent e) {
ITmfTimestamp start = TmfTimestamp.fromNanos(selectedSegment.getStart());
ITmfTimestamp end = TmfTimestamp.fromNanos(selectedSegment.getEnd());
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(AbstractSegmentStoreTableViewer.this, start, end, fTrace));
if (selectedSegment instanceof IElementResolver) {
Multimap<String, Object> metadata = ((IElementResolver) selectedSegment).getMetadata();
if (selectedSegment instanceof ICoreElementResolver) {
Multimap<String, Object> metadata = ((ICoreElementResolver) selectedSegment).getMetadata();
if (!metadata.isEmpty()) {
TmfSignalManager.dispatchSignal(new TmfDataModelSelectedSignal(AbstractSegmentStoreTableViewer.this, metadata));
}
Expand Down
@@ -1,17 +1,17 @@
package org.eclipse.tracecompass.tmf.core.tests.filter.parser;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;

import com.google.common.collect.Multimap;

/**
* Implements an {@link IElementResolver} for test
* Implements an {@link ICoreElementResolver} for test
*
* @author Jean-Christian
*
*/
public class ElementResolverStub implements IElementResolver {
public class ElementResolverStub implements ICoreElementResolver {
private final @NonNull Multimap<@NonNull String, @NonNull Object> fData;

/**
Expand Down
2 changes: 1 addition & 1 deletion tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Version: 8.4.0.qualifier
Bundle-Version: 9.0.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.tracecompass.tmf.core;singleton:=true
Bundle-Activator: org.eclipse.tracecompass.internal.tmf.core.Activator
Expand Down
Expand Up @@ -137,7 +137,7 @@ public Builder setTooltip(String tooltip) {
* @param dataType
* the dataType to set
* @return this {@link Builder} object
* @since 8.4
* @since 9.0
*/
public Builder setDataType(DataType dataType) {
fDataType = dataType;
Expand Down
Expand Up @@ -39,9 +39,10 @@ public enum DataType {
*/
STRING,
/**
* Data representing a time range of string: [start,end],
* where `start` and `end` are timestamps in nanoseconds
* @since 8.4
* Data representing a time range of string: [start,end], where `start` and
* `end` are timestamps in nanoseconds
*
* @since 9.0
*/
TIME_RANGE;
}
Expand Up @@ -112,7 +112,7 @@ public static Format getFormat(DataType type, String units) {
* @param end
* The end time
* @return A standard Time Range string
* @since 8.4
* @since 9.0
*/
public static String toRangeString(long start, long end) {
return "[" + start + "," + end + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Expand Down
Expand Up @@ -12,7 +12,6 @@
package org.eclipse.tracecompass.tmf.core.model;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IPropertyCollection;

/**
Expand All @@ -24,7 +23,7 @@
* @author Patrick Tasse
* @since 5.2
*/
public interface IOutputElement extends IElementResolver, IPropertyCollection {
public interface IOutputElement extends ICoreElementResolver, IPropertyCollection {

/**
* Get the value, may be unused if the element has a style
Expand Down
Expand Up @@ -39,7 +39,7 @@ public interface ITableColumnDescriptor {
* Gets the data type of the column
*
* @return {@link DataType}.
* @since 8.4
* @since 9.0
*/
default DataType getDataType() {
return DataType.STRING;
Expand Down

This file was deleted.

Expand Up @@ -12,9 +12,10 @@
package org.eclipse.tracecompass.tmf.core.model.timegraph;

import org.eclipse.tracecompass.tmf.core.model.CoreMetadataStrings;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;

/**
* String constants to be used for the metadata of {@link IElementResolver}.
* String constants to be used for the metadata of {@link ICoreElementResolver}.
*
* @since 5.2
* @noimplement This interface is not intended to be implemented by clients.
Expand Down
Expand Up @@ -11,6 +11,7 @@

package org.eclipse.tracecompass.tmf.core.model.timegraph;

import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;

import com.google.common.collect.HashMultimap;
Expand All @@ -24,7 +25,7 @@
* @author Simon Delisle
* @since 4.0
*/
public interface ITimeGraphEntryModel extends ITmfTreeDataModel, IElementResolver {
public interface ITimeGraphEntryModel extends ITmfTreeDataModel, ICoreElementResolver {

/**
* Gets the entry start time
Expand All @@ -41,8 +42,8 @@ public interface ITimeGraphEntryModel extends ITmfTreeDataModel, IElementResolve
long getEndTime();

/**
* Returns true if the entry has a row model, or false if it is a blank entry
* with no associated states.
* Returns true if the entry has a row model, or false if it is a blank
* entry with no associated states.
*
* @return true if the entry has a row model
*/
Expand Down
Expand Up @@ -624,7 +624,7 @@ private static boolean isUnique(TraceTypeHelper trace, Collection<Pair<Integer,
* the ID of an experiment (like "o.e.l.specificexperiment" )
* @return a list of {@link TraceTypeHelper} sorted by confidence (highest
* first)
* @since 8.4
* @since 9.0
*/
public static List<TraceTypeHelper> selectExperimentType(List<ITmfTrace> traces, String experimentTypeHint) {
Comparator<Pair<Integer, TraceTypeHelper>> comparator = (o1, o2) -> {
Expand Down Expand Up @@ -699,7 +699,7 @@ public static List<TraceTypeHelper> selectExperimentType(List<ITmfTrace> traces,
* doesn't exist
* @throws CoreException
* if trace cannot be instantiated
* @since 8.4
* @since 9.0
*/
public static TmfExperiment instantiateExperiment(String typeID) throws CoreException {
IConfigurationElement ce = TRACE_TYPE_ATTRIBUTES.get(typeID);
Expand Down
Expand Up @@ -141,7 +141,7 @@ public int validateWithConfidence(String path) {
* list of traces belonging to the experiment
* @return the confidence level (0 is lowest), or -1 if validation fails or
* trace is not an experiment
* @since 8.4
* @since 9.0
*/
public int validateExperimentWithTraces(List<ITmfTrace> traces) {
if (!isExperimentType()) {
Expand Down
Expand Up @@ -378,18 +378,18 @@ public IStatus validate(final IProject project, final String path) {
/**
* Validates the experiment based on the traces provided. All subclasses of
* TmfExperiment should override this method to compute its own validation.
* If the experiment type is valid based on the provided traces, the
* method should return TraceValidationStatus with confidence. If it is not
* valid, an ERROR status should be returned. Note that the generic Tmf
* experiment reserves the confidence value of 1, therefore all extending
* classes should return a confidence level accordingly.
* If the experiment type is valid based on the provided traces, the method
* should return TraceValidationStatus with confidence. If it is not valid,
* an ERROR status should be returned. Note that the generic Tmf experiment
* reserves the confidence value of 1, therefore all extending classes
* should return a confidence level accordingly.
*
* @param traces
* list of ITmfTraces that is used to validate this experiment
* @return status an IStatus object with validation result. Use ERROR status
* to indicate an error, otherwise use TraceValidationStatus with a
* confidence.
* @since 8.4
* @since 9.0
*/
public IStatus validateWithTraces(List<ITmfTrace> traces) {
if (getClass() == TmfExperiment.class) {
Expand Down
Expand Up @@ -53,8 +53,8 @@
import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.tmf.core.dataprovider.DataProviderManager;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;
import org.eclipse.tracecompass.tmf.core.model.filters.TimeQueryFilter;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IElementResolver;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfSelectionTreeDataModel;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataProvider;
Expand Down Expand Up @@ -152,8 +152,8 @@ public void selectionChanged(SelectionChangedEvent event) {
Object entry = selection.getFirstElement();
if (entry instanceof TmfGenericTreeEntry) {
ITmfTreeDataModel model = ((TmfGenericTreeEntry<?>) entry).getModel();
if (model instanceof IElementResolver) {
Multimap<@NonNull String, @NonNull Object> metadata = ((IElementResolver) model).getMetadata();
if (model instanceof ICoreElementResolver) {
Multimap<@NonNull String, @NonNull Object> metadata = ((ICoreElementResolver) model).getMetadata();
if (!metadata.isEmpty()) {
TmfSignalManager.dispatchSignal(new TmfDataModelSelectedSignal(AbstractSelectTreeViewer2.this, metadata));
}
Expand Down

0 comments on commit 1b16126

Please sign in to comment.