Skip to content

Commit

Permalink
tmf: Fix default Eclipse formatting in these (few)
Browse files Browse the repository at this point in the history
Fix the default Eclipse formatting across these few revisited files;
namely TmfTraceType, TraceTypeHelper, AbstractSelectTreeViewer2,
AbstractTimeGraphView and TimeGraphEntry.

Skip such reformatting for some lines, for legacy preservation purposes.

Slightly amend the text for reformatted yet trivial one-liner comments.

Change-Id: I7f6e048584e887be3dd83c84033620caaec81b02
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/201538
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
marco-miller committed Apr 27, 2023
1 parent 5526b93 commit 658e72a
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,10 @@ public static String buildCompatibilityTraceTypeId(String traceTypeId) {
* This method figures out the trace type of a given trace.
*
* @param path
* The path of trace to import (file or directory for directory traces)
* The path of trace to import (file or directory)
* @param traceTypeHint
* the ID of a trace (like "o.e.l.specifictrace" )
* @return a list of {@link TraceTypeHelper} sorted by confidence (highest first)
* @return a list of {@link TraceTypeHelper} sorted by descending confidence
*
* @throws TmfTraceImportException
* if there are errors in the trace file or no trace type found
Expand Down Expand Up @@ -536,7 +536,8 @@ public static String buildCompatibilityTraceTypeId(String traceTypeId) {
// if the trace type hint is valid, return it immediately
return Collections.singletonList(traceTypeHelper);
}
// insert in the tree map, ordered by confidence (highest confidence first) then name
// insert in the tree map, ordered by confidence (highest
// confidence first) then name
Pair<Integer, TraceTypeHelper> element = new Pair<>(confidence, traceTypeHelper);
validCandidates.add(element);
}
Expand All @@ -563,7 +564,7 @@ public static String buildCompatibilityTraceTypeId(String traceTypeId) {
}
} else {
for (Pair<Integer, TraceTypeHelper> candidatePair : reducedCandidates) {
// Don't select the trace type if it has the lowest confidence
// Don't select trace type if it has the lowest confidence
if (candidatePair.getFirst() > 0) {
returned.add(candidatePair.getSecond());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;

/**
* TraceTypeHelper, a helper that can link a few names to a configuration element
* and a trace
* TraceTypeHelper, a helper that can link a few names to a configuration
* element and a trace
*
* @author Matthew Khouzam
*/
Expand Down Expand Up @@ -165,6 +165,7 @@ private static int getConfidenceFromStatus(IStatus status) {

/**
* Get an object of the trace type
*
* @return an object of the trace type
*/
public ITmfTrace getTrace() {
Expand All @@ -190,8 +191,10 @@ public boolean isExperimentType() {
}

/**
* Returns whether trace type is for a directory trace or a single file trace
* @return <code>true</code> if trace type is for a directory trace else <code>false</code>
* Returns whether trace type is for directory trace or single file trace
*
* @return <code>true</code> if trace type is for a directory trace else
* <code>false</code>
*/
public boolean isDirectoryTraceType() {
return fIsDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ public abstract class AbstractSelectTreeViewer2 extends AbstractTmfTreeViewer {
/** Timeout between updates in the updateData thread **/
private static final long BUILD_UPDATE_TIMEOUT = 500;

/** ID of the checked tree items in the map of data in {@link TmfTraceContext} */
/**
* ID of the checked tree items in the map of data in
* {@link TmfTraceContext}
*/
private static final char SEP = ':';
private static final @NonNull String CHECKED_ELEMENTS = ".CHECKED_ELEMENTS"; //$NON-NLS-1$
private static final @NonNull String FILTER_STRING = ".FILTER_STRING"; //$NON-NLS-1$
Expand Down Expand Up @@ -164,6 +167,7 @@ public void selectionChanged(SelectionChangedEvent event) {
* this class typically need to override the getColumnText method if they
* have more than one column to display. It also allows to change the font
* and colors of the cells.
*
* @since 6.0
*/
protected class DataProviderTreeLabelProvider extends TreeLabelProvider {
Expand Down Expand Up @@ -356,17 +360,17 @@ private Collection<ITmfTreeViewerEntry> getCheckedViewerEntries() {
}

/**
* Recursively find entries which were previously checked and check them again
* by id.
* Recursively find entries which were previously checked and check them
* again by id.
*
* @param ids
* Set of previously checked IDs
* @param root
* {@link ITmfTreeViewerEntry} to compare to the set of checked
* entries
* @param checkedElements
* list of checked entries to which we add the root entry if it was
* previously checked
* list of checked entries to which we add the root entry if it
* was previously checked
*/
private void checkEntries(Set<Long> ids, ITmfTreeViewerEntry root, List<ITmfTreeViewerEntry> checkedElements) {
if (root instanceof TmfGenericTreeEntry
Expand Down Expand Up @@ -447,7 +451,10 @@ public IStatus run(IProgressMonitor monitor) {

ITmfResponse.Status status = response.getStatus();
if (status == ITmfResponse.Status.COMPLETED) {
/* Model is complete, no need to request again the data provider */
/*
* Model is complete, no need to request again
* the data provider
*/
isComplete = true;
if (!fIsInitialized) {
fIsInitialized = true;
Expand All @@ -464,15 +471,16 @@ public IStatus run(IProgressMonitor monitor) {
isComplete = true;
} else {
/**
* Status is RUNNING. Sleeping current thread to wait before request data
* provider again
* Status is RUNNING. Sleeping current thread to
* wait before request data provider again
**/
try {
Thread.sleep((long) (BUILD_UPDATE_TIMEOUT * factor));
factor = Math.min(20, factor + 1);
} catch (InterruptedException e) {
/**
* InterruptedException is throw by Thread.Sleep and we should retry querying
* InterruptedException is throw by
* Thread.Sleep and we should retry querying
* the data provider
**/
runScope.addData(FAILED_TO_SLEEP_PREFIX + getName(), e);
Expand All @@ -492,7 +500,7 @@ public IStatus run(IProgressMonitor monitor) {
}

private void updateTree(ITmfTrace trace, long start, long end, List<@NonNull ITmfTreeDataModel> model) {
try (FlowScopeLog parentScope = new FlowScopeLogBuilder(LOGGER, Level.FINE, "AbstractSelectTreeViewer:TreeUpdateRequested" ) //$NON-NLS-1$
try (FlowScopeLog parentScope = new FlowScopeLogBuilder(LOGGER, Level.FINE, "AbstractSelectTreeViewer:TreeUpdateRequested") //$NON-NLS-1$
.setCategory(fLogCategory).build()) {
final TmfTreeViewerEntry rootEntry = getRoot(trace);
/*
Expand Down Expand Up @@ -549,8 +557,8 @@ private List<ITmfTreeViewerEntry> getAllDefaultCheckedIds(List<@NonNull ITmfTree
}

/**
* Save the checked entries' ID in the view context before changing trace and
* check them again in the new tree.
* Save the checked entries' ID in the view context before changing trace
* and check them again in the new tree.
*/
private void saveViewContext() {
ITmfTrace previousTrace = getTrace();
Expand All @@ -566,7 +574,7 @@ private void saveViewContext() {
String filterString = filterControl != null ? filterControl.getText() : null;
TmfTraceManager.getInstance().updateTraceContext(previousTrace,
builder -> builder.setData(getDataContextId(CHECKED_ELEMENTS), ids)
.setData(getDataContextId(FILTER_STRING), filterString));
.setData(getDataContextId(FILTER_STRING), filterString));
}
}

Expand All @@ -593,11 +601,14 @@ private void restorePatternFilter(ITmfTrace trace) {
*
* @param id
* the entry's unique ID
* @return the correctly dimensioned image if there is a legend image provider
* @return the correctly dimensioned image if there is a legend image
* provider
* @since 6.0
*/
protected Image getLegendImage(@NonNull Long id) {
/* If the image height match the row height, row height will increment */
/*
* If the image height match the row height, row height will increment
*/
ILegendImageProvider2 legendImageProvider = fLegendImageProvider;
int legendColumnIndex = fLegendIndex;
if (legendImageProvider != null && legendColumnIndex >= 0) {
Expand All @@ -619,7 +630,8 @@ protected ITmfTreeViewerEntry updateElements(ITmfTrace trace, long start, long e
/**
* Getter for the {@link ITmfTreeDataProvider} to query for this TreeViewer
*
* @param trace the trace
* @param trace
* the trace
* @return the relevant provider, if any
* @since 4.0
*/
Expand Down Expand Up @@ -650,7 +662,8 @@ protected void initializeDataSource(@NonNull ITmfTrace trace) {
}

/**
* Algorithm to convert a model (List of {@link TmfTreeDataModel}) to the tree.
* Algorithm to convert a model (List of {@link TmfTreeDataModel}) to the
* tree.
*
* @param start
* queried start time
Expand Down Expand Up @@ -686,8 +699,7 @@ protected ITmfTreeViewerEntry modelToTree(long start, long end, List<ITmfTreeDat
* comparator to sort {@link TmfGenericTreeEntry}s
* @return the comparator
*/
protected static <T extends TmfGenericTreeEntry<? extends TmfTreeDataModel>>
@NonNull TmfTreeColumnData createColumn(String text, Comparator<T> comparator) {
protected static <T extends TmfGenericTreeEntry<? extends TmfTreeDataModel>> @NonNull TmfTreeColumnData createColumn(String text, Comparator<T> comparator) {
TmfTreeColumnData column = new TmfTreeColumnData(text);
column.setComparator(new ViewerComparator() {
@Override
Expand Down
Loading

0 comments on commit 658e72a

Please sign in to comment.