Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Export-Package: org.eclipse.tracecompass.internal.provisional.tmf.core.model,
org.eclipse.tracecompass.tmf.core.model.annotations,
org.eclipse.tracecompass.tmf.core.model.filters,
org.eclipse.tracecompass.tmf.core.model.genericxy,
org.eclipse.tracecompass.tmf.core.model.object,
org.eclipse.tracecompass.tmf.core.model.timegraph,
org.eclipse.tracecompass.tmf.core.model.tree,
org.eclipse.tracecompass.tmf.core.model.xy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
/**
* Interface to implement to indicate capabilities of a data provider, such as
* "canCreate" and "canDelete" capability.
*
* <p>
* "canCreate" indicates that a given data provider can create a derived data
* provider. "canDelete" indicates that a given data provider can be deleted.
*
* <p>
* Call method {@link IDataProviderFactory#getAdapter(Class)} with class
* {@link ITmfDataProviderConfigurator} to obtain an instance of
* {@link ITmfDataProviderConfigurator}, which implements the "canCreate" and
* "canDelete" capabilities.
* <p>
* "selectionRange" indicates that a given data provider can use the selection
* range to compute its data. Clients should include the selection range in
* query parameters and refresh the data when the selection range changes.
*
* @since 9.6
* @author Bernd Hufmann
Expand All @@ -43,4 +47,15 @@ public interface IDataProviderCapabilities {
* {@code false}
*/
boolean canDelete();

/**
* Whether the data provider uses the selection range.
*
* @return {@code true} if this data provider uses the selection range, else
* {@code false}
* @since 10.2
*/
default boolean selectionRange() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ public enum ProviderType {
* A provider for generic xy charts with a time-less x-axis
* @since 10.1
*/
TREE_GENERIC_XY
TREE_GENERIC_XY,
/**
* A provider of generic data objects
* @since 10.2
*/
DATA
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class DataProviderCapabilities implements IDataProviderCapabilities {

private final boolean canCreate;
private final boolean canDelete;
private final boolean selectionRange;

/**
* Constructor
Expand All @@ -39,6 +40,7 @@ public class DataProviderCapabilities implements IDataProviderCapabilities {
public DataProviderCapabilities(Builder builder) {
canCreate = builder.canCreate;
canDelete = builder.canDelete;
selectionRange = builder.selectionRange;
}

@Override
Expand All @@ -51,6 +53,11 @@ public boolean canDelete() {
return canDelete;
}

@Override
public boolean selectionRange() {
return selectionRange;
}

@Override
@SuppressWarnings("nls")
public String toString() {
Expand Down Expand Up @@ -84,6 +91,7 @@ public boolean equals(@Nullable Object obj) {
public static class Builder {
private boolean canCreate = false;
private boolean canDelete = false;
private boolean selectionRange = false;

/**
* Sets canCreate flag
Expand Down Expand Up @@ -111,6 +119,20 @@ public Builder setCanDelete(boolean canDelete) {
return this;
}

/**
* Sets selectionRange flag
*
* @param selectionRange
* {@code true} if this data provider uses the selection
* range, else {@code false}
* @return the builder instance.
* @since 10.2
*/
public Builder setSelectionRange(boolean selectionRange) {
this.selectionRange = selectionRange;
return this;
}

/**
* The method to construct an instance of
* {@link IDataProviderCapabilities}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.eclipse.tracecompass.tmf.core.model.object;

import java.util.Map;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.model.ITmfDataProvider;
import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse;

/**
* Interface for a data provider that returns a generic object as model
*
* @since 10.2
*/
public interface IObjectDataProvider extends ITmfDataProvider {

/**
* This method computes a generic object model. Then, it returns a
* {@link TmfModelResponse} that contains the model.
*
* @param fetchParameters
* Map of parameters that can be used to compute result object
* @param monitor
* A ProgressMonitor to cancel task
* @return A {@link TmfModelResponse} instance
*/
public TmfModelResponse<ObjectModel> fetchData(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**********************************************************************
* Copyright (c) 2025 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/

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

import org.eclipse.jdt.annotation.Nullable;

/**
* Represents a generic object with optional navigation parameters.
* <p>
* If the object is a partial subdivision of the full object, then the optional
* next and previous navigation parameter objects can be set, and later returned
* as query parameters to get the following or preceding subdivision.
*
* @since 10.2
*/
public class ObjectModel {

private final Object fObject;
private @Nullable Object fNext;
private @Nullable Object fPrevious;

/**
* Constructor
*
* @param object
* the generic object represented by this model
*/
public ObjectModel(Object object) {
fObject = object;
}

/**
* Get the generic object represented by this model
*
* @return the object
*/
public Object getObject() {
return fObject;
}

/**
* Get the next navigation parameter object
*
* @return the next navigation parameter object
*/
public @Nullable Object getNext() {
return fNext;
}

/**
* Get the previous navigation parameter object
*
* @return the previous navigation parameter object
*/
public @Nullable Object getPrevious() {
return fPrevious;
}

/**
* Set the next navigation parameter object
*
* @param next
* the next navigation parameter object
*/
public void setNext(Object next) {
fNext = next;
}

/**
* Set the previous navigation parameter object
*
* @param previous
* the previous navigation parameter object
*/
public void setPrevious(Object previous) {
fPrevious = previous;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*******************************************************************************
* Copyright (c) 2025 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

@org.eclipse.jdt.annotation.NonNullByDefault
package org.eclipse.tracecompass.tmf.core.model.object;
Loading