Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Piché2019-05-30 09:33:59 -0400
committerMatthew Khouzam2019-06-12 19:30:17 -0400
commit5454aa6299928087dacd644b280ff17839acceef (patch)
treec59b3f0f2e10183af8c9792b33166cb330764ec2
parent5911d7971d47e5c746e0f046b6951fc26208bf00 (diff)
downloadorg.eclipse.tracecompass-5454aa6299928087dacd644b280ff17839acceef.tar.gz
org.eclipse.tracecompass-5454aa6299928087dacd644b280ff17839acceef.tar.xz
org.eclipse.tracecompass-5454aa6299928087dacd644b280ff17839acceef.zip
Make anonymous inner class a lambda
Change-Id: I34070563866d3823616e4502d694e4b445438935 Signed-off-by: David Piché <david.piche@ericsson.com> Reviewed-on: https://git.eclipse.org/r/143459 Tested-by: CI Bot Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Simon Delisle <simon.delisle@ericsson.com> Reviewed-by: Simon Delisle <simon.delisle@ericsson.com>
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/base/TmfVertex.java27
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/building/AbstractTmfGraphProvider.java23
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/viewers/LamiTableViewer.java9
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/views/LamiReportView.java37
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowView.java43
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/filters/DynamicFilterDialog.java33
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentsStatisticsViewer.java12
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java31
-rw-r--r--gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java106
-rw-r--r--gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/events/GdbEventsTable.java31
-rw-r--r--gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/project/dialogs/SelectTraceExecutableDialog.java21
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java20
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/EnableChannelDialog.java9
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/LoadDialog.java18
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java26
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/OpenCommandScriptDialog.java9
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/ImportHandler.java8
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/SaveHandler.java11
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java15
-rw-r--r--lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/preferences/ControlRemoteProfilesPreferencePage.java9
-rw-r--r--pcap/org.eclipse.tracecompass.tmf.pcap.ui/src/org/eclipse/tracecompass/internal/tmf/pcap/ui/stream/StreamListView.java182
-rw-r--r--rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/Application.java9
-rw-r--r--rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/ApplicationWorkbenchAdvisor.java16
-rw-r--r--rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java17
-rw-r--r--statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/internal/segmentstore/core/segmentHistoryTree/SegmentHistoryTree.java174
-rw-r--r--statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/SegmentComparators.java43
-rw-r--r--statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/segment/interfaces/SegmentTypeComparators.java35
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/preferences/XMLAnalysesManagerPreferencePage.java27
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java30
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternLatencyTableView.java28
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternStatisticsView.java28
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/callstack/MappingFile.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java27
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/TmfBaseAspects.java8
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTraceDefinition.java32
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTxtTraceDefinition.java12
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTrace.java11
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTraceDefinition.java34
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/project/model/TmfTraceType.java13
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/RemoteFetchLogWizardRemotePage.java16
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/preferences/RemoteProfilesPreferencePage.java98
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java46
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/CustomParserUtils.java7
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java35
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/SelectSupplementaryResourcesDialog.java52
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/offset/OffsetDialog.java80
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java7
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/DropAdapterAssistant.java7
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OffsetTraceHandler.java7
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OpenAnalysisHelpHandler.java21
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameFolderHandler.java7
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameTraceHandler.java7
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java177
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/operations/SelectTracesOperation.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportConflictHandler.java8
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportTraceWizardPage.java45
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TraceValidateAndImportOperation.java14
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java59
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateContentSelected.java34
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateNoContentSelected.java42
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/TmfPieChartViewer.java47
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/TmfStatisticsViewer.java210
-rwxr-xr-xtmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java30
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/views/TmfAlignmentSynchronizer.java28
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/analysis/TmfAnalysisViewOutput.java25
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/editors/TmfEventsEditor.java21
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TraceUtils.java11
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyExperimentDialog.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyTraceDialog.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/NewExperimentDialog.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameExperimentDialog.java16
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameFolderDialog.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameTraceDialog.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectRootNodeWizardPage.java19
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectTracesWizardPage.java13
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/TrimTraceDialog.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/tracetype/preferences/TraceTypePreferencePageViewer.java17
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java476
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/table/TmfSimpleTableViewer.java18
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java109
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/TmfBaseProvider.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/colors/ColorsView.java68
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterView.java15
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterViewer.java85
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/Histogram.java18
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramTextControl.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramView.java55
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/synchronization/TmfSynchronizationView.java14
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timechart/TimeChartView.java92
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java99
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java349
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/TimeGraphFindDialog.java71
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java85
-rwxr-xr-xtmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDWidget.java26
-rwxr-xr-xtmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/ScrollView.java49
-rwxr-xr-xtmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/TimeCompressionBar.java7
-rwxr-xr-xtmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java15
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java53
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java32
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java202
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java23
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java9
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/virtualtable/TmfVirtualTable.java191
104 files changed, 1866 insertions, 2824 deletions
diff --git a/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/base/TmfVertex.java b/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/base/TmfVertex.java
index 38e380e2e3..67edde3b63 100644
--- a/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/base/TmfVertex.java
+++ b/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/base/TmfVertex.java
@@ -14,6 +14,7 @@
package org.eclipse.tracecompass.analysis.graph.core.base;
import java.util.Comparator;
+import java.util.Objects;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.graph.core.base.TmfEdge.EdgeType;
@@ -55,34 +56,12 @@ public class TmfVertex implements Comparable<TmfVertex> {
/**
* Compare vertices by ascending timestamps
*/
- public static Comparator<TmfVertex> ascending = new Comparator<TmfVertex>() {
- @Override
- public int compare(@Nullable TmfVertex v1, @Nullable TmfVertex v2) {
- if (v1 == null) {
- return 1;
- }
- if (v2 == null) {
- return -1;
- }
- return Long.compare(v1.getTs(), v2.getTs());
- }
- };
+ public static Comparator<TmfVertex> ascending = Objects.requireNonNull(Comparator.nullsLast(Comparator.comparing(TmfVertex::getTs)));
/**
* Compare vertices by descending timestamps
*/
- public static Comparator<TmfVertex> descending = new Comparator<TmfVertex>() {
- @Override
- public int compare(@Nullable TmfVertex v1, @Nullable TmfVertex v2) {
- if (v1 == null) {
- return -1;
- }
- if (v2 == null) {
- return 1;
- }
- return Long.compare(v2.getTs(), v1.getTs());
- }
- };
+ public static Comparator<TmfVertex> descending = Objects.requireNonNull(Comparator.nullsLast(Comparator.comparing(TmfVertex::getTs).reversed()));
private @Nullable TmfEdge fOutgoingVertical = null;
private @Nullable TmfEdge fIncomingVertical = null;
diff --git a/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/building/AbstractTmfGraphProvider.java b/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/building/AbstractTmfGraphProvider.java
index dc2be359dc..3b9554a7bf 100644
--- a/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/building/AbstractTmfGraphProvider.java
+++ b/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/analysis/graph/core/building/AbstractTmfGraphProvider.java
@@ -30,21 +30,16 @@ import com.google.common.collect.ImmutableList;
*/
public abstract class AbstractTmfGraphProvider implements ITmfGraphProvider {
- private static final Comparator<ITraceEventHandler> HANDLER_COMPARATOR = new Comparator<ITraceEventHandler>() {
-
- @Override
- public int compare(@Nullable ITraceEventHandler o1, @Nullable ITraceEventHandler o2) {
- if (o1 == null) {
- return 1;
- }
- if (o2 == null) {
- return -1;
- }
- int res = Integer.compare(o1.getPriority(), o2.getPriority());
- // If the handlers have the same priority, arbitrarily compare their names
- return (res != 0 ? res : o1.getClass().getName().compareTo(o2.getClass().getName()));
+ private static final Comparator<ITraceEventHandler> HANDLER_COMPARATOR = (@Nullable ITraceEventHandler o1, @Nullable ITraceEventHandler o2) -> {
+ if (o1 == null) {
+ return 1;
}
-
+ if (o2 == null) {
+ return -1;
+ }
+ int res = Integer.compare(o1.getPriority(), o2.getPriority());
+ // If the handlers have the same priority, arbitrarily compare their names
+ return (res != 0 ? res : o1.getClass().getName().compareTo(o2.getClass().getName()));
};
private final ITmfTrace fTrace;
diff --git a/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/viewers/LamiTableViewer.java b/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/viewers/LamiTableViewer.java
index 051e32bd49..82cf2de1d4 100644
--- a/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/viewers/LamiTableViewer.java
+++ b/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/viewers/LamiTableViewer.java
@@ -153,12 +153,9 @@ public final class LamiTableViewer extends TmfSimpleTableViewer implements ILami
private void createColumns() {
final List<LamiTableEntryAspect> aspects = fPage.getResultTable().getTableClass().getAspects();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (LamiTableEntryAspect aspect : aspects) {
- createColumn(aspect.getLabel(), new LamiTableColumnLabelProvider(aspect), aspect.getComparator());
- }
+ Display.getDefault().asyncExec(() -> {
+ for (LamiTableEntryAspect aspect : aspects) {
+ createColumn(aspect.getLabel(), new LamiTableColumnLabelProvider(aspect), aspect.getComparator());
}
});
}
diff --git a/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/views/LamiReportView.java b/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/views/LamiReportView.java
index e7e16c8c8f..eb215c5993 100644
--- a/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/views/LamiReportView.java
+++ b/analysis/org.eclipse.tracecompass.analysis.lami.ui/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/ui/views/LamiReportView.java
@@ -21,7 +21,6 @@ import java.util.function.Supplier;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
@@ -123,24 +122,20 @@ public final class LamiReportView extends TmfView {
}
};
- private final Function<Integer, @Nullable IImageSave> fImageProvider = new Function<Integer, @Nullable IImageSave>() {
-
- @Override
- public @Nullable IImageSave apply(Integer index) {
- LamiReportViewTabPage selectedPage = getCurrentSelectedPage();
- if (selectedPage == null) {
- return null;
- }
- List<LamiViewerControl> plots = selectedPage.getCustomGraphViewerControls();
+ private final Function<Integer, @Nullable IImageSave> fImageProvider = index -> {
+ LamiReportViewTabPage selectedPage = getCurrentSelectedPage();
+ if (selectedPage == null) {
+ return null;
+ }
+ List<LamiViewerControl> plots = selectedPage.getCustomGraphViewerControls();
- if (index >= 0 && index < plots.size()) {
- TmfViewer viewer = plots.get(index).getViewer();
- if (viewer instanceof IImageSave) {
- return (IImageSave) viewer;
- }
+ if (index >= 0 && index < plots.size()) {
+ TmfViewer viewer = plots.get(index).getViewer();
+ if (viewer instanceof IImageSave) {
+ return (IImageSave) viewer;
}
- return null;
}
+ return null;
};
private List<Supplier<@Nullable IImageSave>> getSuppliers(){
@@ -229,13 +224,9 @@ public final class LamiReportView extends TmfView {
fClearCustomViewsAction.setText(Messages.LamiReportView_ClearAllCustomViews);
IMenuManager menuMgr = actionBars.getMenuManager();
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
-
- @Override
- public void menuAboutToShow(@Nullable IMenuManager manager) {
- if (manager != null) {
- populateMenu(manager);
- }
+ menuMgr.addMenuListener((@Nullable IMenuManager manager) -> {
+ if (manager != null) {
+ populateMenu(manager);
}
});
populateMenu(menuMgr);
diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowView.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowView.java
index a2a1886753..27d927261d 100644
--- a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowView.java
+++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowView.java
@@ -41,8 +41,6 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.ViewerFilter;
@@ -177,33 +175,30 @@ public class ControlFlowView extends BaseDataProviderTimeGraphView {
public ActiveThreadsFilterAction() {
super(PackageMessages.ControlFlowView_DynamicFiltersActiveThreadToggleLabel, IAction.AS_CHECK_BOX);
setToolTipText(PackageMessages.ControlFlowView_DynamicFiltersActiveThreadToggleToolTip);
- addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (!(event.getNewValue() instanceof Boolean)) {
- return;
- }
+ addPropertyChangeListener(event -> {
+ if (!(event.getNewValue() instanceof Boolean)) {
+ return;
+ }
- Boolean enabled = (Boolean) event.getNewValue();
+ Boolean enabled = (Boolean) event.getNewValue();
- /* Always remove the previous Active Threads filter */
- getTimeGraphViewer().removeFilter(fActiveThreadsFilter);
+ /* Always remove the previous Active Threads filter */
+ getTimeGraphViewer().removeFilter(fActiveThreadsFilter);
- if (enabled) {
- fActiveThreadsFilter.setEnabled(true);
- getTimeGraphViewer().addFilter(fActiveThreadsFilter);
-
- /* Use flat representation */
- if (fFlatAction != null) {
- applyFlatPresentation();
- fFlatAction.setChecked(true);
- fHierarchicalAction.setChecked(false);
- }
- } else {
- fActiveThreadsFilter.setEnabled(false);
+ if (enabled) {
+ fActiveThreadsFilter.setEnabled(true);
+ getTimeGraphViewer().addFilter(fActiveThreadsFilter);
+
+ /* Use flat representation */
+ if (fFlatAction != null) {
+ applyFlatPresentation();
+ fFlatAction.setChecked(true);
+ fHierarchicalAction.setChecked(false);
}
- startZoomThread(getTimeGraphViewer().getTime0(), getTimeGraphViewer().getTime1());
+ } else {
+ fActiveThreadsFilter.setEnabled(false);
}
+ startZoomThread(getTimeGraphViewer().getTime0(), getTimeGraphViewer().getTime1());
});
}
}
diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/filters/DynamicFilterDialog.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/filters/DynamicFilterDialog.java
index 6115048dbf..c4f6dd36e6 100644
--- a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/filters/DynamicFilterDialog.java
+++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/filters/DynamicFilterDialog.java
@@ -22,8 +22,6 @@ import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -137,25 +135,22 @@ public class DynamicFilterDialog extends TitleAreaDialog {
fCpuRangesRadioButton.setToolTipText(Messages.DynamicFilterDialog_CpuRangesTooltip);
/* Attach an automatic validation to the field */
- fCpuRangesField.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- /* Reconstruct the string */
- final String oldString = fCpuRangesField.getText();
- final String newString = oldString.substring(0, e.start) + e.text + oldString.substring(e.end);
+ fCpuRangesField.addVerifyListener(e -> {
+ /* Reconstruct the string */
+ final String oldString = fCpuRangesField.getText();
+ final String newString = oldString.substring(0, e.start) + e.text + oldString.substring(e.end);
- /* Validate the string */
- boolean valid = validateCpuRange(newString);
+ /* Validate the string */
+ boolean valid = validateCpuRange(newString);
- Button okButton = getButton(IDialogConstants.OK_ID);
- if (okButton != null) {
- getButton(IDialogConstants.OK_ID).setEnabled(valid);
- }
- if (valid) {
- setErrorMessage(null);
- } else {
- setErrorMessage(Messages.DynamicFilterDialog_InvalidRangesErrorMsg);
- }
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null) {
+ getButton(IDialogConstants.OK_ID).setEnabled(valid);
+ }
+ if (valid) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(Messages.DynamicFilterDialog_InvalidRangesErrorMsg);
}
});
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentsStatisticsViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentsStatisticsViewer.java
index 865ef67314..17b1ab7c29 100644
--- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentsStatisticsViewer.java
+++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/statistics/AbstractSegmentsStatisticsViewer.java
@@ -176,15 +176,11 @@ public abstract class AbstractSegmentsStatisticsViewer extends AbstractTmfTreeVi
private static <E extends Comparable<E>, M extends SegmentStoreStatisticsModel> Function<TmfTreeViewerEntry, E>
keyExtractor(Function<M, E> modelExtractor) {
- return new Function<TmfTreeViewerEntry, E>() {
-
- @Override
- public E apply(TmfTreeViewerEntry entry) {
- if (entry instanceof TmfGenericTreeEntry) {
- return modelExtractor.apply(((TmfGenericTreeEntry<M>) entry).getModel());
- }
- return (E) (Comparable<E>) o -> 0;
+ return entry -> {
+ if (entry instanceof TmfGenericTreeEntry) {
+ return modelExtractor.apply(((TmfGenericTreeEntry<M>) entry).getModel());
}
+ return (E) (Comparable<E>) o -> 0;
};
}
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
index bb31398909..61e00b99f8 100644
--- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
+++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
@@ -280,24 +280,21 @@ public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableView
*/
public void updateModel(final @Nullable Object dataInput) {
final TableViewer tableViewer = getTableViewer();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!tableViewer.getTable().isDisposed()) {
- // Go to the top of the table
- tableViewer.getTable().setTopIndex(0);
- // Reset selected row
- tableViewer.setSelection(StructuredSelection.EMPTY);
- if (dataInput == null) {
- tableViewer.setInput(null);
- tableViewer.setItemCount(0);
- return;
- }
- addPackListener();
- tableViewer.setInput(dataInput);
- SegmentStoreContentProvider contentProvider = (SegmentStoreContentProvider) getTableViewer().getContentProvider();
- tableViewer.setItemCount((int) Math.min(Integer.MAX_VALUE, contentProvider.getSegmentCount()));
+ Display.getDefault().asyncExec(() -> {
+ if (!tableViewer.getTable().isDisposed()) {
+ // Go to the top of the table
+ tableViewer.getTable().setTopIndex(0);
+ // Reset selected row
+ tableViewer.setSelection(StructuredSelection.EMPTY);
+ if (dataInput == null) {
+ tableViewer.setInput(null);
+ tableViewer.setItemCount(0);
+ return;
}
+ addPackListener();
+ tableViewer.setInput(dataInput);
+ SegmentStoreContentProvider contentProvider = (SegmentStoreContentProvider) getTableViewer().getContentProvider();
+ tableViewer.setItemCount((int) Math.min(Integer.MAX_VALUE, contentProvider.getSegmentCount()));
}
});
}
diff --git a/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java b/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java
index 67c5dab804..f53075cb73 100644
--- a/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java
+++ b/gdbtrace/org.eclipse.tracecompass.gdbtrace.core/src/org/eclipse/tracecompass/internal/gdbtrace/core/trace/DsfGdbAdaptor.java
@@ -167,14 +167,11 @@ public class DsfGdbAdaptor {
*
*/
public DsfGdbPlatformEventListener() {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(DsfGdbPlatformEventListener.this);
- IWorkbench wb = PlatformUI.getWorkbench();
- IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
- DebugUITools.getDebugContextManager().getContextService(win).addDebugContextListener(DsfGdbPlatformEventListener.this);
- }
+ Display.getDefault().syncExec(() -> {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(DsfGdbPlatformEventListener.this);
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
+ DebugUITools.getDebugContextManager().getContextService(win).addDebugContextListener(DsfGdbPlatformEventListener.this);
});
}
@@ -594,17 +591,14 @@ public class DsfGdbAdaptor {
* selection policy. This could be removed when DSF provides
* an API to force the trace record selection in the Debug view.
*/
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- for (IWorkbenchWindow wbWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
- for (IWorkbenchPage wbPage : wbWindow.getPages()) {
- IViewPart vp = wbPage.findView(IDebugUIConstants.ID_DEBUG_VIEW);
- if (vp instanceof AbstractDebugView) {
- Viewer viewer = ((AbstractDebugView) vp).getViewer();
- if (viewer instanceof ITreeModelViewer) {
- ((ITreeModelViewer) viewer).setSelection(StructuredSelection.EMPTY, false, true);
- }
+ Display.getDefault().syncExec(() -> {
+ for (IWorkbenchWindow wbWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+ for (IWorkbenchPage wbPage : wbWindow.getPages()) {
+ IViewPart vp = wbPage.findView(IDebugUIConstants.ID_DEBUG_VIEW);
+ if (vp instanceof AbstractDebugView) {
+ Viewer viewer = ((AbstractDebugView) vp).getViewer();
+ if (viewer instanceof ITreeModelViewer) {
+ ((ITreeModelViewer) viewer).setSelection(StructuredSelection.EMPTY, false, true);
}
}
}
@@ -830,19 +824,16 @@ public class DsfGdbAdaptor {
}
private static void closeGdbTraceEditor(final String sessionId) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (IWorkbenchWindow wbWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
- for (IWorkbenchPage wbPage : wbWindow.getPages()) {
- for (IEditorReference editorReference : wbPage.getEditorReferences()) {
- IEditorPart editor = editorReference.getEditor(false);
- if (editor instanceof ITmfTraceEditor) {
- ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
- if (trace instanceof GdbTrace) {
- if (((GdbTrace) trace).getDsfSessionId().equals(sessionId)) {
- wbPage.closeEditor(editor, false);
- }
+ Display.getDefault().asyncExec(() -> {
+ for (IWorkbenchWindow wbWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+ for (IWorkbenchPage wbPage : wbWindow.getPages()) {
+ for (IEditorReference editorReference : wbPage.getEditorReferences()) {
+ IEditorPart editor = editorReference.getEditor(false);
+ if (editor instanceof ITmfTraceEditor) {
+ ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
+ if (trace instanceof GdbTrace) {
+ if (((GdbTrace) trace).getDsfSessionId().equals(sessionId)) {
+ wbPage.closeEditor(editor, false);
}
}
}
@@ -853,38 +844,35 @@ public class DsfGdbAdaptor {
}
private static void selectGdbTraceEditor(final String sessionId, final int recordId) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (IWorkbenchWindow wbWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
- for (IWorkbenchPage wbPage : wbWindow.getPages()) {
- for (IEditorReference editorReference : wbPage.getEditorReferences()) {
- IEditorPart editor = editorReference.getEditor(false);
- if (editor instanceof ITmfTraceEditor) {
- ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
- if (trace instanceof GdbTrace) {
- if (((GdbTrace) trace).getDsfSessionId().equals(sessionId)) {
+ Display.getDefault().asyncExec(() -> {
+ for (IWorkbenchWindow wbWindow : PlatformUI.getWorkbench().getWorkbenchWindows()) {
+ for (IWorkbenchPage wbPage : wbWindow.getPages()) {
+ for (IEditorReference editorReference : wbPage.getEditorReferences()) {
+ IEditorPart editor = editorReference.getEditor(false);
+ if (editor instanceof ITmfTraceEditor) {
+ ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
+ if (trace instanceof GdbTrace) {
+ if (((GdbTrace) trace).getDsfSessionId().equals(sessionId)) {
+ wbPage.bringToTop(editor);
+ if (recordId != -1) {
+ gotoRank(editor, recordId);
+ }
+ return;
+ }
+ } else if (trace instanceof TmfExperiment) {
+ TmfExperiment experiment = (TmfExperiment) trace;
+ List<ITmfTrace> expTraces = experiment.getTraces();
+ int nbTraces = expTraces.size();
+ for (int i = 0; i < nbTraces; i++) {
+ GdbTrace gdbTrace = (GdbTrace) expTraces.get(i);
+ if (gdbTrace.getDsfSessionId().equals(sessionId)) {
wbPage.bringToTop(editor);
if (recordId != -1) {
- gotoRank(editor, recordId);
+ int rank = recordId * nbTraces + i;
+ gotoRank(editor, rank);
}
return;
}
- } else if (trace instanceof TmfExperiment) {
- TmfExperiment experiment = (TmfExperiment) trace;
- List<ITmfTrace> expTraces = experiment.getTraces();
- int nbTraces = expTraces.size();
- for (int i = 0; i < nbTraces; i++) {
- GdbTrace gdbTrace = (GdbTrace) expTraces.get(i);
- if (gdbTrace.getDsfSessionId().equals(sessionId)) {
- wbPage.bringToTop(editor);
- if (recordId != -1) {
- int rank = recordId * nbTraces + i;
- gotoRank(editor, rank);
- }
- return;
- }
- }
}
}
}
diff --git a/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/events/GdbEventsTable.java b/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/events/GdbEventsTable.java
index 0562a5ded7..cadab0fa8c 100644
--- a/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/events/GdbEventsTable.java
+++ b/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/events/GdbEventsTable.java
@@ -18,8 +18,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableItem;
@@ -67,25 +65,22 @@ public class GdbEventsTable extends TmfEventsTable {
fTable.getColumns()[1].setAlignment(SWT.RIGHT);
// Synchronize currently selected frame in GDB with table selection
- addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent e) {
- TableItem[] selection = fTable.getSelection();
- if (selection.length > 0) {
- TableItem selectedTableItem = selection[0];
- if (selectedTableItem != null) {
- Object data = selectedTableItem.getData();
- if (data instanceof GdbTraceEvent) {
- GdbTraceEvent event = (GdbTraceEvent) data;
- GdbTrace gdbTrace = (GdbTrace) event.getTrace();
- GdbTraceEventContent content = event.getContent();
- selectFrame(gdbTrace, content.getFrameNumber());
- return;
- }
+ addSelectionChangedListener(e -> {
+ TableItem[] selection = fTable.getSelection();
+ if (selection.length > 0) {
+ TableItem selectedTableItem = selection[0];
+ if (selectedTableItem != null) {
+ Object data = selectedTableItem.getData();
+ if (data instanceof GdbTraceEvent) {
+ GdbTraceEvent event = (GdbTraceEvent) data;
+ GdbTrace gdbTrace = (GdbTrace) event.getTrace();
+ GdbTraceEventContent content = event.getContent();
+ selectFrame(gdbTrace, content.getFrameNumber());
+ return;
}
}
- fSelectedTrace = null;
}
+ fSelectedTrace = null;
});
}
diff --git a/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/project/dialogs/SelectTraceExecutableDialog.java b/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/project/dialogs/SelectTraceExecutableDialog.java
index a58e75193e..ae3106f03e 100644
--- a/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/project/dialogs/SelectTraceExecutableDialog.java
+++ b/gdbtrace/org.eclipse.tracecompass.gdbtrace.ui/src/org/eclipse/tracecompass/internal/gdbtrace/ui/views/project/dialogs/SelectTraceExecutableDialog.java
@@ -35,10 +35,8 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.gdbtrace.ui.GdbTraceUIPlugin;
@@ -120,17 +118,14 @@ public class SelectTraceExecutableDialog extends SelectionStatusDialog {
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
fExecutableNameEntry.setLayoutData(data);
fExecutableNameEntry.setFont(font);
- fExecutableNameEntry.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- fExecutablePath = Path.fromOSString(fExecutableNameEntry.getText());
- if (! validateExecutableName()) {
- updateStatus(PATH_ERROR_STATUS);
- } else if (! validateExecutableBinary()) {
- updateStatus(BINARY_ERROR_STATUS);
- } else {
- updateStatus(OK_STATUS);
- }
+ fExecutableNameEntry.addListener(SWT.Modify, event -> {
+ fExecutablePath = Path.fromOSString(fExecutableNameEntry.getText());
+ if (! validateExecutableName()) {
+ updateStatus(PATH_ERROR_STATUS);
+ } else if (! validateExecutableBinary()) {
+ updateStatus(BINARY_ERROR_STATUS);
+ } else {
+ updateStatus(OK_STATUS);
}
});
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java
index 8c57f12704..c25c158dcf 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/CreateSessionDialog.java
@@ -28,8 +28,6 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -729,20 +727,12 @@ public class CreateSessionDialog extends TitleAreaDialog implements ICreateSessi
fLiveDelayText.setText(DEFAULT_TEXT);
fLiveDelayText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
fLiveDelayText.setToolTipText(Messages.TraceControl_CreateSessionLiveDelayTooltip);
- fLiveDelayText.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- // only numbers and default are allowed.
- e.doit = e.text.matches("[0-9]*") || e.text.matches(DEFAULT_TEXT); //$NON-NLS-1$
- updateEnablement();
- }
- });
- fLiveDelayText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent event) {
- updateEnablement();
- }
+ fLiveDelayText.addVerifyListener(e -> {
+ // only numbers and default are allowed.
+ e.doit = e.text.matches("[0-9]*") || e.text.matches(DEFAULT_TEXT); //$NON-NLS-1$
+ updateEnablement();
});
+ fLiveDelayText.addModifyListener(event -> updateEnablement());
fLiveDelayText.addFocusListener(new FocusListener() {
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/EnableChannelDialog.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/EnableChannelDialog.java
index 6e44925995..b0bf6ba472 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/EnableChannelDialog.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/EnableChannelDialog.java
@@ -20,7 +20,6 @@ import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -173,13 +172,7 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
fDomain = TraceDomainType.KERNEL;
// Common verify listener
- fVerifyListener = new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- // only numbers and default are allowed.
- e.doit = e.text.matches("[0-9]*") || e.text.matches(DEFAULT_TEXT); //$NON-NLS-1$
- }
- };
+ fVerifyListener = e -> e.doit = e.text.matches("[0-9]*") || e.text.matches(DEFAULT_TEXT);
// Common focus listener
fFocusListener = new FocusListener() {
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/LoadDialog.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/LoadDialog.java
index 5ceefc5c8e..d98bf5892d 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/LoadDialog.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/LoadDialog.java
@@ -23,11 +23,7 @@ import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.ui.widgets.RemoteResourceBrowserWidget;
import org.eclipse.swt.SWT;
@@ -200,12 +196,7 @@ public class LoadDialog extends TitleAreaDialog implements ILoadDialog {
fFolderViewer = LTTngProfileViewer.createLTTngProfileViewer(fLocalComposite, SWT.NONE);
fFolderViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- fFolderViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- enableLocalButtons();
- }
- });
+ fFolderViewer.addCheckStateListener(event -> enableLocalButtons());
}
}
@@ -225,12 +216,7 @@ public class LoadDialog extends TitleAreaDialog implements ILoadDialog {
fFileWidget.setLayoutData(new GridData(GridData.FILL_BOTH));
fFileWidget.setInitialPath(LTTngControlServiceConstants.DEFAULT_PATH);
fFileWidget.setConnection(fConnection);
- fFileWidget.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- enableRemoteButtons();
- }
- });
+ fFileWidget.addSelectionChangedListener(event -> enableRemoteButtons());
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java
index f7aeed2e33..3bafc98665 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/NewConnectionDialog.java
@@ -17,18 +17,13 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.List;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -131,12 +126,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
private static IRemoteConnection[] getConnections(IRemoteConnectionType parentElement) {
List<IRemoteConnection> connectionList = parentElement.getConnections();
IRemoteConnection[] result = connectionList.toArray(new IRemoteConnection[connectionList.size()]);
- Arrays.sort(result, new Comparator<IRemoteConnection>() {
- @Override
- public int compare(IRemoteConnection o1, IRemoteConnection o2) {
- return getConnectionLabel(o1).compareTo(getConnectionLabel(o2));
- }
- });
+ Arrays.sort(result, (o1, o2) -> getConnectionLabel(o1).compareTo(getConnectionLabel(o2)));
return result;
}
@@ -245,18 +235,8 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
gd.heightHint = convertHeightInCharsToPixels(CONNECTIONTREE_HEIGHT_CHARS);
fConnectionTree.setLabelProvider(new ConnectionTreeLabelProvider());
fConnectionTree.setContentProvider(new ConnectionContentProvider());
- fConnectionTree.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- onSelectionChanged();
- }
- });
- fConnectionTree.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
+ fConnectionTree.addSelectionChangedListener(event -> onSelectionChanged());
+ fConnectionTree.addDoubleClickListener(event -> okPressed());
Composite buttons = new Composite(dialogComposite, SWT.NONE);
layout = new GridLayout(BUTTONS_NUMBER_OF_COLUMNS, true);
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/OpenCommandScriptDialog.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/OpenCommandScriptDialog.java
index ff12778051..49a20a7cca 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/OpenCommandScriptDialog.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/dialogs/OpenCommandScriptDialog.java
@@ -32,11 +32,9 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator;
import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages;
@@ -148,12 +146,7 @@ public class OpenCommandScriptDialog extends Dialog implements ISelectCommandScr
fBrowseButton = new Button(sessionGroup, SWT.PUSH);
fBrowseButton.setText(Messages.TraceControl_ExecuteScriptBrowseText);
- fBrowseButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- handleFilePathBrowseButtonPressed(SWT.OPEN);
- }
- });
+ fBrowseButton.addListener(SWT.Selection, event -> handleFilePathBrowseButtonPressed(SWT.OPEN));
// layout widgets
GridData data = new GridData(GridData.FILL_HORIZONTAL);
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/ImportHandler.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/ImportHandler.java
index 4c08b45003..91a445e210 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/ImportHandler.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/ImportHandler.java
@@ -299,13 +299,7 @@ public class ImportHandler extends BaseControlViewHandler {
traceFolder.setPersistentProperty(CtfConstants.LIVE_SESSION_NAME, connectionInfo.getSessionName());
final TmfTraceElement finalTrace = found;
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run() {
- TmfOpenTraceHelper.openTraceFromElement(finalTrace);
- }
- });
+ Display.getDefault().syncExec(() -> TmfOpenTraceHelper.openTraceFromElement(finalTrace));
}
}
}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/SaveHandler.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/SaveHandler.java
index c138e20286..f8041d8f0f 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/SaveHandler.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/SaveHandler.java
@@ -129,14 +129,9 @@ public class SaveHandler extends BaseControlViewHandler {
IFileStore remoteResource = fileService.getResource(remotePath.toString());
final boolean overwrite[] = new boolean[1];
if (destPath.toFile().exists()) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- overwrite[0] = MessageDialog.openConfirm(Display.getDefault().getActiveShell(),
- Messages.TraceControl_ProfileAlreadyExists,
- NLS.bind(Messages.TraceControl_OverwriteQuery, destPath.getFileName()));
- }
- });
+ Display.getDefault().syncExec(() -> overwrite[0] = MessageDialog.openConfirm(Display.getDefault().getActiveShell(),
+ Messages.TraceControl_ProfileAlreadyExists,
+ NLS.bind(Messages.TraceControl_OverwriteQuery, destPath.getFileName())));
if (!overwrite[0]) {
continue;
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
index fd5abbcc7f..036aaed6bd 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/model/impl/TargetNodeComponent.java
@@ -496,15 +496,12 @@ public class TargetNodeComponent extends TraceControlComponent implements IRemot
}
// Notify user
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- ErrorDialog er = new ErrorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.TraceControl_ErrorTitle, Messages.TraceControl_RetrieveNodeConfigurationFailure,
- new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e),
- IStatus.ERROR);
- er.open();
- }
+ Display.getDefault().asyncExec(() -> {
+ ErrorDialog er = new ErrorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ Messages.TraceControl_ErrorTitle, Messages.TraceControl_RetrieveNodeConfigurationFailure,
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e),
+ IStatus.ERROR);
+ er.open();
});
Activator.getDefault().logError(Messages.TraceControl_RetrieveNodeConfigurationFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/preferences/ControlRemoteProfilesPreferencePage.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/preferences/ControlRemoteProfilesPreferencePage.java
index 70a01bac2a..3fd3ff8759 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/preferences/ControlRemoteProfilesPreferencePage.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/preferences/ControlRemoteProfilesPreferencePage.java
@@ -20,9 +20,7 @@ import java.nio.file.StandardCopyOption;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -89,12 +87,7 @@ public class ControlRemoteProfilesPreferencePage extends PreferencePage implemen
buttonComposite.setLayout(new GridLayout());
buttonComposite.setLayoutData(new GridData(GridData.CENTER, GridData.BEGINNING, false, false));
- fFolderViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- enableButtons();
- }
- });
+ fFolderViewer.addCheckStateListener(event -> enableButtons());
return composite;
}
diff --git a/pcap/org.eclipse.tracecompass.tmf.pcap.ui/src/org/eclipse/tracecompass/internal/tmf/pcap/ui/stream/StreamListView.java b/pcap/org.eclipse.tracecompass.tmf.pcap.ui/src/org/eclipse/tracecompass/internal/tmf/pcap/ui/stream/StreamListView.java
index de5a1a2f70..bc9a6564c0 100644
--- a/pcap/org.eclipse.tracecompass.tmf.pcap.ui/src/org/eclipse/tracecompass/internal/tmf/pcap/ui/stream/StreamListView.java
+++ b/pcap/org.eclipse.tracecompass.tmf.pcap.ui/src/org/eclipse/tracecompass/internal/tmf/pcap/ui/stream/StreamListView.java
@@ -188,37 +188,33 @@ public class StreamListView extends TmfView {
}
private void queryAnalysis() {
- Thread thread = new Thread(new Runnable() {
-
- @Override
- public void run() {
- ITmfTrace trace = fCurrentTrace;
- if (trace == null) {
- return;
- }
- StreamListAnalysis analysis = TmfTraceUtils.getAnalysisModuleOfClass(trace, StreamListAnalysis.class, StreamListAnalysis.ID);
- if (analysis == null) {
- return;
- }
- while (!analysis.isFinished() && !fStopThread) {
- updateUI();
- try {
- Thread.sleep(WAIT_TIME);
- } catch (InterruptedException e) {
- String message = e.getMessage();
- if (message == null) {
- message = EMPTY_STRING;
- }
- Activator.logError(message, e);
- return;
+ Thread thread = new Thread(() -> {
+ ITmfTrace trace = fCurrentTrace;
+ if (trace == null) {
+ return;
+ }
+ StreamListAnalysis analysis = TmfTraceUtils.getAnalysisModuleOfClass(trace, StreamListAnalysis.class, StreamListAnalysis.ID);
+ if (analysis == null) {
+ return;
+ }
+ while (!analysis.isFinished() && !fStopThread) {
+ updateUI();
+ try {
+ Thread.sleep(WAIT_TIME);
+ } catch (InterruptedException e) {
+ String message = e.getMessage();
+ if (message == null) {
+ message = EMPTY_STRING;
}
+ Activator.logError(message, e);
+ return;
}
- // Update UI one more time (daft punk)
- if (!fStopThread) {
- updateUI();
- }
-
}
+ // Update UI one more time (daft punk)
+ if (!fStopThread) {
+ updateUI();
+ }
+
});
fStopThread = false;
@@ -235,21 +231,17 @@ public class StreamListView extends TmfView {
if (display == null || display.isDisposed()) {
return;
}
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (display.isDisposed()) {
- return;
- }
- Map<TmfPcapProtocol, Table> tableMap = fTableMap;
- if (tableMap == null) {
- return;
- }
- for (Table table : tableMap.values()) {
- if (!table.isDisposed()) {
- table.removeAll();
- }
+ display.asyncExec(() -> {
+ if (display.isDisposed()) {
+ return;
+ }
+ Map<TmfPcapProtocol, Table> tableMap = fTableMap;
+ if (tableMap == null) {
+ return;
+ }
+ for (Table table : tableMap.values()) {
+ if (!table.isDisposed()) {
+ table.removeAll();
}
}
});
@@ -260,60 +252,55 @@ public class StreamListView extends TmfView {
if (display == null || display.isDisposed()) {
return;
}
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (display.isDisposed()) {
- return;
- }
- ITmfTrace trace = fCurrentTrace;
- if (trace == null) {
- return;
- }
+ display.asyncExec(() -> {
+ if (display.isDisposed()) {
+ return;
+ }
+ ITmfTrace trace = fCurrentTrace;
+ if (trace == null) {
+ return;
+ }
- StreamListAnalysis analysis = TmfTraceUtils.getAnalysisModuleOfClass(trace, StreamListAnalysis.class, StreamListAnalysis.ID);
- if (analysis == null) {
- return;
- }
+ StreamListAnalysis analysis = TmfTraceUtils.getAnalysisModuleOfClass(trace, StreamListAnalysis.class, StreamListAnalysis.ID);
+ if (analysis == null) {
+ return;
+ }
- Map<TmfPcapProtocol, Table> tables = fTableMap;
- if (tables == null) {
- return;
- }
- for (Entry<TmfPcapProtocol, Table> protocolEntry : tables.entrySet()) {
- TmfPcapProtocol protocol = protocolEntry.getKey();
- TmfPacketStreamBuilder builder = analysis.getBuilder(protocol);
- Table table = protocolEntry.getValue();
- if (builder != null && !(table.isDisposed())) {
- for (TmfPacketStream stream : builder.getStreams()) {
-
- TableItem item;
- if (stream.getID() < table.getItemCount()) {
- item = table.getItem(stream.getID());
- } else {
- item = new TableItem(table, SWT.NONE);
- }
- item.setText(0, String.valueOf(stream.getID()));
- item.setText(1, stream.getFirstEndpoint().toString());
- item.setText(2, stream.getSecondEndpoint().toString());
- item.setText(3, String.valueOf(stream.getNbPackets()));
- item.setText(4, String.valueOf(stream.getNbBytes()));
- item.setText(5, String.valueOf(stream.getNbPacketsAtoB()));
- item.setText(6, String.valueOf(stream.getNbBytesAtoB()));
- item.setText(7, String.valueOf(stream.getNbPacketsBtoA()));
- item.setText(8, String.valueOf(stream.getNbBytesBtoA()));
- item.setText(9, stream.getStartTime().toString());
- item.setText(10, stream.getStopTime().toString());
- item.setText(11, String.format("%.3f", stream.getDuration())); //$NON-NLS-1$
- item.setText(12, String.format("%.3f", stream.getBPSAtoB())); //$NON-NLS-1$
- item.setText(13, String.format("%.3f", stream.getBPSBtoA())); //$NON-NLS-1$
- item.setData(KEY_STREAM, stream);
+ Map<TmfPcapProtocol, Table> tables = fTableMap;
+ if (tables == null) {
+ return;
+ }
+ for (Entry<TmfPcapProtocol, Table> protocolEntry : tables.entrySet()) {
+ TmfPcapProtocol protocol = protocolEntry.getKey();
+ TmfPacketStreamBuilder builder = analysis.getBuilder(protocol);
+ Table table = protocolEntry.getValue();
+ if (builder != null && !(table.isDisposed())) {
+ for (TmfPacketStream stream : builder.getStreams()) {
+
+ TableItem item;
+ if (stream.getID() < table.getItemCount()) {
+ item = table.getItem(stream.getID());
+ } else {
+ item = new TableItem(table, SWT.NONE);
}
+ item.setText(0, String.valueOf(stream.getID()));
+ item.setText(1, stream.getFirstEndpoint().toString());
+ item.setText(2, stream.getSecondEndpoint().toString());
+ item.setText(3, String.valueOf(stream.getNbPackets()));
+ item.setText(4, String.valueOf(stream.getNbBytes()));
+ item.setText(5, String.valueOf(stream.getNbPacketsAtoB()));
+ item.setText(6, String.valueOf(stream.getNbBytesAtoB()));
+ item.setText(7, String.valueOf(stream.getNbPacketsBtoA()));
+ item.setText(8, String.valueOf(stream.getNbBytesBtoA()));
+ item.setText(9, stream.getStartTime().toString());
+ item.setText(10, stream.getStopTime().toString());
+ item.setText(11, String.format("%.3f", stream.getDuration())); //$NON-NLS-1$
+ item.setText(12, String.format("%.3f", stream.getBPSAtoB())); //$NON-NLS-1$
+ item.setText(13, String.format("%.3f", stream.getBPSBtoA())); //$NON-NLS-1$
+ item.setData(KEY_STREAM, stream);
}
}
}
-
});
}
@@ -379,24 +366,15 @@ public class StreamListView extends TmfView {
Menu menu = new Menu(table);
MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText(Messages.StreamListView_FollowStream);
- menuItem.addListener(SWT.Selection, new Listener() {
-
- @Override
- public void handleEvent(@Nullable Event event) {
+ menuItem.addListener(SWT.Selection, (@Nullable Event event) -> {
TmfSignal signal = new TmfPacketStreamSelectedSignal(this, 0, fCurrentStream);
TmfSignalManager.dispatchSignal(signal);
- }
});
menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText(Messages.StreamListView_Clear);
- menuItem.addListener(SWT.Selection, new Listener() {
-
- @Override
- public void handleEvent(@Nullable Event event) {
+ menuItem.addListener(SWT.Selection, (@Nullable Event event) -> {
TmfSignal signal = new TmfPacketStreamSelectedSignal(this, 0, null);
TmfSignalManager.dispatchSignal(signal);
-
- }
});
menuItem = new MenuItem(menu, SWT.PUSH);
menuItem.setText(Messages.StreamListView_ExtractAsFilter);
diff --git a/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/Application.java b/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/Application.java
index edb2a5d2d9..909db96ebf 100644
--- a/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/Application.java
+++ b/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/Application.java
@@ -91,12 +91,9 @@ public class Application implements IApplication {
final IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = workbench.getDisplay();
fInstanceLoc.release();
- display.syncExec(new Runnable() {
- @Override
- public void run() {
- if (!display.isDisposed()) {
- workbench.close();
- }
+ display.syncExec(() -> {
+ if (!display.isDisposed()) {
+ workbench.close();
}
});
}
diff --git a/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/ApplicationWorkbenchAdvisor.java b/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/ApplicationWorkbenchAdvisor.java
index 56b86965d5..ee3133235f 100644
--- a/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/ApplicationWorkbenchAdvisor.java
+++ b/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/ApplicationWorkbenchAdvisor.java
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
@@ -99,15 +98,12 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
// Save workspace
final MultiStatus status = new MultiStatus(TracingRcpPlugin.PLUGIN_ID, 1, Messages.Application_WorkspaceSavingError, null);
try {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) {
- try {
- IWorkspace ws = ResourcesPlugin.getWorkspace();
- status.merge(ws.save(true, monitor));
- } catch (CoreException e) {
- status.merge(e.getStatus());
- }
+ IRunnableWithProgress runnable = monitor -> {
+ try {
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+ status.merge(ws.save(true, monitor));
+ } catch (CoreException e) {
+ status.merge(e.getStatus());
}
};
new ProgressMonitorDialog(null).run(true, true, runnable);
diff --git a/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java b/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java
index df600ed0f1..d0bf347ae4 100644
--- a/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java
+++ b/rcp/org.eclipse.tracecompass.rcp.ui/src/org/eclipse/tracecompass/internal/tracing/rcp/ui/SplashHandler.java
@@ -16,8 +16,6 @@ import org.eclipse.core.runtime.IProduct;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
@@ -55,15 +53,12 @@ public class SplashHandler extends BasicSplashHandler {
setForeground(FOREGROUND_COLOR);
// Set the software version.
- getContent().addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- e.gc.setForeground(getForeground());
- e.gc.drawText(
- NLS.bind(Messages.SplahScreen_VersionString,
- TracingRcpPlugin.getDefault().getBundle().getVersion().toString()),
- VERSION_LOCATION.x, VERSION_LOCATION.y, true);
- }
+ getContent().addPaintListener(e -> {
+ e.gc.setForeground(getForeground());
+ e.gc.drawText(
+ NLS.bind(Messages.SplahScreen_VersionString,
+ TracingRcpPlugin.getDefault().getBundle().getVersion().toString()),
+ VERSION_LOCATION.x, VERSION_LOCATION.y, true);
});
}
}
diff --git a/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/internal/segmentstore/core/segmentHistoryTree/SegmentHistoryTree.java b/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/internal/segmentstore/core/segmentHistoryTree/SegmentHistoryTree.java
index 41e32375ce..07a5b8cf8f 100644
--- a/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/internal/segmentstore/core/segmentHistoryTree/SegmentHistoryTree.java
+++ b/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/internal/segmentstore/core/segmentHistoryTree/SegmentHistoryTree.java
@@ -199,52 +199,46 @@ public class SegmentHistoryTree<E extends ISegment> extends AbstractOverlappingH
*/
public Iterable<@NonNull E> getIntersectingElements(final long start, final long end) {
final TimeRangeCondition rc = TimeRangeCondition.forContinuousRange(start, end);
- return new Iterable<E>() {
+ return () -> new Iterator<E>() {
- @Override
- public Iterator<@NonNull E> iterator() {
- return new Iterator<E>() {
+ private boolean started = false;
+ private Deque<Integer> queue = new LinkedList<>();
+ private Deque<E> intersecting = new LinkedList<>();
- private boolean started = false;
- private Deque<Integer> queue = new LinkedList<>();
- private Deque<E> intersecting = new LinkedList<>();
+ @Override
+ public @NonNull E next() {
+ hasNext();
+ return NonNullUtils.checkNotNull(intersecting.removeFirst());
+ }
- @Override
- public @NonNull E next() {
- hasNext();
- return NonNullUtils.checkNotNull(intersecting.removeFirst());
+ @Override
+ public boolean hasNext() {
+ /* Iteration has not started yet */
+ if (!started) {
+ queue.add(getRootNode().getSequenceNumber());
+ started = true;
+ }
+
+ /*
+ * Need to read nodes until either we find more segments
+ * or iterate over all segments
+ */
+ while (intersecting.isEmpty() && !queue.isEmpty()) {
+ SegmentTreeNode<E> currentNode;
+ try {
+ currentNode = readNode(queue.pop());
+ } catch (ClosedChannelException e) {
+ Activator.instance().logError(e.getMessage(), e);
+ return false;
}
-
- @Override
- public boolean hasNext() {
- /* Iteration has not started yet */
- if (!started) {
- queue.add(getRootNode().getSequenceNumber());
- started = true;
- }
-
- /*
- * Need to read nodes until either we find more segments
- * or iterate over all segments
- */
- while (intersecting.isEmpty() && !queue.isEmpty()) {
- SegmentTreeNode<E> currentNode;
- try {
- currentNode = readNode(queue.pop());
- } catch (ClosedChannelException e) {
- Activator.instance().logError(e.getMessage(), e);
- return false;
- }
- if (currentNode.getNodeType() == IHTNode.NodeType.CORE) {
- queue.addAll(currentNode.selectNextChildren(rc));
- }
- intersecting.addAll(currentNode.getMatchingIntervals(rc, interval -> true));
- }
-
- /* Return if we have found segments */
- return !intersecting.isEmpty();
+ if (currentNode.getNodeType() == IHTNode.NodeType.CORE) {
+ queue.addAll(currentNode.selectNextChildren(rc));
}
- };
+ intersecting.addAll(currentNode.getMatchingIntervals(rc, interval -> true));
+ }
+
+ /* Return if we have found segments */
+ return !intersecting.isEmpty();
}
};
}
@@ -262,64 +256,58 @@ public class SegmentHistoryTree<E extends ISegment> extends AbstractOverlappingH
*/
public Iterable<@NonNull E> getIntersectingElements(long start, long end, Comparator<@NonNull E> order) {
final TimeRangeCondition rc = TimeRangeCondition.forContinuousRange(start, end);
- return new Iterable<E>() {
+ return () -> new Iterator<E>() {
- @Override
- public Iterator<@NonNull E> iterator() {
- return new Iterator<E>() {
+ private boolean started = false;
+ private PriorityQueue<SegmentTreeNode.Tuple<E>> queue = new PriorityQueue<>(getNodeCount(),
+ Comparator.comparing(SegmentTreeNode.Tuple<E>::getSegment, order));
- private boolean started = false;
- private PriorityQueue<SegmentTreeNode.Tuple<E>> queue = new PriorityQueue<>(getNodeCount(),
- Comparator.comparing(SegmentTreeNode.Tuple<E>::getSegment, order));
+ private PriorityQueue<E> intersecting = new PriorityQueue<>(ITERATOR_QUEUE_SIZE, order);
- private PriorityQueue<E> intersecting = new PriorityQueue<>(ITERATOR_QUEUE_SIZE, order);
+ @Override
+ public @NonNull E next() {
+ if (hasNext()) {
+ return NonNullUtils.checkNotNull(intersecting.remove());
+ }
+ throw new NoSuchElementException();
+ }
- @Override
- public @NonNull E next() {
- if (hasNext()) {
- return NonNullUtils.checkNotNull(intersecting.remove());
- }
- throw new NoSuchElementException();
+ @Override
+ public boolean hasNext() {
+ /* Iteration has not started yet */
+ if (!started) {
+ SegmentTreeNode<E> rootNode = getRootNode();
+
+ /*
+ * Add the root node with any segment for the tuple,
+ * it will always be read.
+ */
+ queue.add(new SegmentTreeNode.Tuple(new BasicSegment(0,0), rootNode.getSequenceNumber()));
+
+ started = true;
+ }
+
+ /*
+ * Need to read nodes until either we find more segments
+ * or iterate over all nodes
+ */
+ while (!queue.isEmpty() && (intersecting.isEmpty()
+ || order.compare(intersecting.element(), queue.peek().getSegment()) > 0)) {
+ SegmentTreeNode<E> currentNode;
+ try {
+ currentNode = readNode(queue.poll().getSequenceNumber());
+ } catch (ClosedChannelException e) {
+ Activator.instance().logError(e.getMessage(), e);
+ return false;
}
-
- @Override
- public boolean hasNext() {
- /* Iteration has not started yet */
- if (!started) {
- SegmentTreeNode<E> rootNode = getRootNode();
-
- /*
- * Add the root node with any segment for the tuple,
- * it will always be read.
- */
- queue.add(new SegmentTreeNode.Tuple(new BasicSegment(0,0), rootNode.getSequenceNumber()));
-
- started = true;
- }
-
- /*
- * Need to read nodes until either we find more segments
- * or iterate over all nodes
- */
- while (!queue.isEmpty() && (intersecting.isEmpty()
- || order.compare(intersecting.element(), queue.peek().getSegment()) > 0)) {
- SegmentTreeNode<E> currentNode;
- try {
- currentNode = readNode(queue.poll().getSequenceNumber());
- } catch (ClosedChannelException e) {
- Activator.instance().logError(e.getMessage(), e);
- return false;
- }
- if (currentNode.getNodeType() == HTNode.NodeType.CORE) {
- queue.addAll(((SegmentTreeNode) currentNode).selectNextChildren(rc, order));
- }
- intersecting.addAll(currentNode.getMatchingIntervals(rc, interval -> true));
- }
-
- /* Return if we have found segments */
- return !intersecting.isEmpty();
+ if (currentNode.getNodeType() == HTNode.NodeType.CORE) {
+ queue.addAll(((SegmentTreeNode) currentNode).selectNextChildren(rc, order));
}
- };
+ intersecting.addAll(currentNode.getMatchingIntervals(rc, interval -> true));
+ }
+
+ /* Return if we have found segments */
+ return !intersecting.isEmpty();
}
};
}
diff --git a/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/SegmentComparators.java b/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/SegmentComparators.java
index 2335bc5089..d129730721 100644
--- a/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/SegmentComparators.java
+++ b/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/SegmentComparators.java
@@ -10,8 +10,7 @@
package org.eclipse.tracecompass.segmentstore.core;
import java.util.Comparator;
-
-import org.eclipse.jdt.annotation.Nullable;
+import java.util.Objects;
/**
* Segments comparators. These do not allow for null arguments.
@@ -24,53 +23,21 @@ public interface SegmentComparators {
/**
* Basic long comparator
*/
- Comparator<Long> LONG_COMPARATOR = new Comparator<Long>() {
- @Override
- public int compare(@Nullable Long o1, @Nullable Long o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException();
- }
- return o1.compareTo(o2);
- }
- };
+ Comparator<Long> LONG_COMPARATOR = Objects.requireNonNull(Long::compare);
/**
* Start time comparator
*/
- Comparator<ISegment> INTERVAL_START_COMPARATOR = new Comparator<ISegment>() {
- @Override
- public int compare(@Nullable ISegment o1, @Nullable ISegment o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException();
- }
- return Long.compare(o1.getStart(), o2.getStart());
- }
- };
+ Comparator<ISegment> INTERVAL_START_COMPARATOR = Objects.requireNonNull(Comparator.comparingLong(ISegment::getStart));
/**
* End time comparator
*/
- Comparator<ISegment> INTERVAL_END_COMPARATOR = new Comparator<ISegment>() {
- @Override
- public int compare(@Nullable ISegment o1, @Nullable ISegment o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException();
- }
- return Long.compare(o1.getEnd(), o2.getEnd());
- }
- };
+ Comparator<ISegment> INTERVAL_END_COMPARATOR = Objects.requireNonNull(Comparator.comparingLong(ISegment::getEnd));
/**
* Length comparator
*/
- Comparator<ISegment> INTERVAL_LENGTH_COMPARATOR = new Comparator<ISegment>() {
- @Override
- public int compare(@Nullable ISegment o1, @Nullable ISegment o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException();
- }
- return Long.compare(o1.getLength(), o2.getLength());
- }
- };
+ Comparator<ISegment> INTERVAL_LENGTH_COMPARATOR = Objects.requireNonNull(Comparator.comparingLong(ISegment::getLength));
}
diff --git a/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/segment/interfaces/SegmentTypeComparators.java b/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/segment/interfaces/SegmentTypeComparators.java
index 1b7963faaa..3fdb9a4f43 100644
--- a/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/segment/interfaces/SegmentTypeComparators.java
+++ b/statesystem/org.eclipse.tracecompass.segmentstore.core/src/org/eclipse/tracecompass/segmentstore/core/segment/interfaces/SegmentTypeComparators.java
@@ -29,25 +29,22 @@ public interface SegmentTypeComparators {
* named segments, their order will be undefined by they will be greater
* than all the named ones.
*/
- Comparator<ISegment> NAMED_SEGMENT_COMPARATOR = new Comparator<ISegment>() {
- @Override
- public int compare(@Nullable ISegment o1, @Nullable ISegment o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException("One of the segment to compare is null, that should never happen"); //$NON-NLS-1$
- }
- String name1 = SegmentAspects.getName(o1);
- String name2 = SegmentAspects.getName(o2);
- if (Objects.equals(name1, name2)) {
- return 0;
- }
- // Segments that are not named are greater than named ones
- if (name2 == null) {
- return -1;
- }
- if (name1 == null) {
- return 1;
- }
- return name1.compareTo(name2);
+ Comparator<ISegment> NAMED_SEGMENT_COMPARATOR = (@Nullable ISegment o1, @Nullable ISegment o2) -> {
+ if (o1 == null || o2 == null) {
+ throw new IllegalArgumentException("One of the segment to compare is null, that should never happen"); //$NON-NLS-1$
}
+ String name1 = SegmentAspects.getName(o1);
+ String name2 = SegmentAspects.getName(o2);
+ if (Objects.equals(name1, name2)) {
+ return 0;
+ }
+ // Segments that are not named are greater than named ones
+ if (name2 == null) {
+ return -1;
+ }
+ if (name1 == null) {
+ return 1;
+ }
+ return name1.compareTo(name2);
};
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/preferences/XMLAnalysesManagerPreferencePage.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/preferences/XMLAnalysesManagerPreferencePage.java
index 08bd763903..7f761a383b 100644
--- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/preferences/XMLAnalysesManagerPreferencePage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/preferences/XMLAnalysesManagerPreferencePage.java
@@ -112,21 +112,18 @@ public class XMLAnalysesManagerPreferencePage extends PreferencePage implements
private static final String LINE_SEP = System.getProperty("line.separator"); //$NON-NLS-1$
private static final String ELEMENT_SEP = "-\t"; //$NON-NLS-1$
- private static final IPropertyListener SAVE_EDITOR_LISTENER = new IPropertyListener() {
- @Override
- public void propertyChanged(Object source, int propId) {
- if (source instanceof IEditorPart) {
- IEditorPart editorPart = (IEditorPart) source;
- if (ISaveablePart.PROP_DIRTY == propId && !editorPart.isDirty()) {
- // Editor is not dirty anymore, i.e. it was saved
- if (editorPart.getEditorInput() instanceof IURIEditorInput) {
- File file = URIUtil.toFile(((IURIEditorInput) editorPart.getEditorInput()).getURI());
- boolean success = loadXmlFile(file, false);
- if (success) {
- enableAndDisableAnalyses(Collections.singletonList(file.getName()), Collections.emptyList());
- } else {
- enableAndDisableAnalyses(Collections.emptyList(), Collections.singletonList(file.getName()));
- }
+ private static final IPropertyListener SAVE_EDITOR_LISTENER = (source, propId) -> {
+ if (source instanceof IEditorPart) {
+ IEditorPart editorPart = (IEditorPart) source;
+ if (ISaveablePart.PROP_DIRTY == propId && !editorPart.isDirty()) {
+ // Editor is not dirty anymore, i.e. it was saved
+ if (editorPart.getEditorInput() instanceof IURIEditorInput) {
+ File file = URIUtil.toFile(((IURIEditorInput) editorPart.getEditorInput()).getURI());
+ boolean success = loadXmlFile(file, false);
+ if (success) {
+ enableAndDisableAnalyses(Collections.singletonList(file.getName()), Collections.emptyList());
+ } else {
+ enableAndDisableAnalyses(Collections.emptyList(), Collections.singletonList(file.getName()));
}
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java
index 4740614709..2abc422458 100644
--- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternDensityView.java
@@ -10,8 +10,6 @@ package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -44,18 +42,15 @@ public class PatternDensityView extends AbstractSegmentStoreDensityView {
*/
public PatternDensityView() {
super(ID);
- this.addPartPropertyListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) {
- Object newValue = event.getNewValue();
- if (newValue instanceof String) {
- String data = (String) newValue;
- fViewInfo.setViewData(data);
- setPartName(fViewInfo.getLabel());
- loadTableViewer();
- loadDensityViewer();
- }
+ this.addPartPropertyListener(event -> {
+ if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) {
+ Object newValue = event.getNewValue();
+ if (newValue instanceof String) {
+ String data = (String) newValue;
+ fViewInfo.setViewData(data);
+ setPartName(fViewInfo.getLabel());
+ loadTableViewer();
+ loadDensityViewer();
}
}
});
@@ -69,12 +64,7 @@ public class PatternDensityView extends AbstractSegmentStoreDensityView {
fViewInfo.setName(name);
}
super.createPartControl(parent);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- setPartName(fViewInfo.getLabel());
- }
- });
+ Display.getDefault().asyncExec(() -> setPartName(fViewInfo.getLabel()));
}
private void loadTableViewer() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternLatencyTableView.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternLatencyTableView.java
index 56291ec79c..9388c722d9 100644
--- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternLatencyTableView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternLatencyTableView.java
@@ -10,8 +10,6 @@ package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -38,17 +36,14 @@ public class PatternLatencyTableView extends AbstractSegmentStoreTableView {
* Constructor
*/
public PatternLatencyTableView() {
- this.addPartPropertyListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) {
- Object newValue = event.getNewValue();
- if (newValue instanceof String) {
- String data = (String) newValue;
- fViewInfo.setViewData(data);
- setPartName(fViewInfo.getLabel());
- loadLatencyView();
- }
+ this.addPartPropertyListener(event -> {
+ if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) {
+ Object newValue = event.getNewValue();
+ if (newValue instanceof String) {
+ String data = (String) newValue;
+ fViewInfo.setViewData(data);
+ setPartName(fViewInfo.getLabel());
+ loadLatencyView();
}
}
});
@@ -62,12 +57,7 @@ public class PatternLatencyTableView extends AbstractSegmentStoreTableView {
fViewInfo.setName(name);
}
super.createPartControl(parent);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- setPartName(fViewInfo.getLabel());
- }
- });
+ Display.getDefault().asyncExec(() -> setPartName(fViewInfo.getLabel()));
}
private void loadLatencyView() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternStatisticsView.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternStatisticsView.java
index 0ea0ae6c6e..28d111a529 100644
--- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternStatisticsView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/latency/PatternStatisticsView.java
@@ -10,8 +10,6 @@ package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentsStatisticsView;
@@ -36,17 +34,14 @@ public class PatternStatisticsView extends AbstractSegmentsStatisticsView {
* Constructor
*/
public PatternStatisticsView() {
- this.addPartPropertyListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) {
- Object newValue = event.getNewValue();
- if (newValue instanceof String) {
- String data = (String) newValue;
- fViewInfo.setViewData(data);
- setPartName(fViewInfo.getLabel());
- loadStatisticView();
- }
+ this.addPartPropertyListener(event -> {
+ if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) {
+ Object newValue = event.getNewValue();
+ if (newValue instanceof String) {
+ String data = (String) newValue;
+ fViewInfo.setViewData(data);
+ setPartName(fViewInfo.getLabel());
+ loadStatisticView();
}
}
});
@@ -60,12 +55,7 @@ public class PatternStatisticsView extends AbstractSegmentsStatisticsView {
fViewInfo.setName(name);
}
super.createPartControl(parent);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- setPartName(fViewInfo.getLabel());
- }
- });
+ Display.getDefault().asyncExec(() -> setPartName(fViewInfo.getLabel()));
}
private void loadStatisticView() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/callstack/MappingFile.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/callstack/MappingFile.java
index a219b8990e..7a7fa5aa5b 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/callstack/MappingFile.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/callstack/MappingFile.java
@@ -38,14 +38,7 @@ import org.eclipse.tracecompass.tmf.core.symbols.TmfResolvedSymbol;
public final class MappingFile implements IMappingFile {
private static final String DEFAULT_END_SUFFIX = "END__"; //$NON-NLS-1$
- private static Comparator<@NonNull Long> MAP_COMPARATOR = new Comparator<@NonNull Long>() {
-
- @Override
- public int compare(Long o1, Long o2) {
- return Long.compareUnsigned(o1, o2);
- }
-
- };
+ private static Comparator<@NonNull Long> MAP_COMPARATOR = Long::compareUnsigned;
private final String fFullPath;
private final boolean fIsBinaryFile;
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java
index 5a8b63e737..5bf7beb11d 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAnalysisModuleHelperConfigElement.java
@@ -51,24 +51,19 @@ import org.osgi.framework.Bundle;
public class TmfAnalysisModuleHelperConfigElement implements IAnalysisModuleHelper {
/** Note: This comparator is not symmetric so it cannot be used by regular sorting algorithms */
- private static final @NonNull Comparator<@NonNull ApplicableClass> APPLICABLE_CLASS_COMPARATOR = new Comparator<@NonNull ApplicableClass>() {
-
- @Override
- public int compare(@NonNull ApplicableClass o1, @NonNull ApplicableClass o2) {
- if (o1.fClass.equals(o2.fClass)) {
- // Classes are the same
- return 0;
- }
- // Otherwise, if one class is assignable from the other, the most generic one is smaller
- if (o1.fClass.isAssignableFrom(o2.fClass)) {
- return -1;
- }
- if (o2.fClass.isAssignableFrom(o1.fClass)) {
- return 1;
- }
+ private static final @NonNull Comparator<@NonNull ApplicableClass> APPLICABLE_CLASS_COMPARATOR = (@NonNull ApplicableClass o1, @NonNull ApplicableClass o2) -> {
+ if (o1.fClass.equals(o2.fClass)) {
+ // Classes are the same
return 0;
}
-
+ // Otherwise, if one class is assignable from the other, the most generic one is smaller
+ if (o1.fClass.isAssignableFrom(o2.fClass)) {
+ return -1;
+ }
+ if (o2.fClass.isAssignableFrom(o1.fClass)) {
+ return 1;
+ }
+ return 0;
};
/** Class that stores whether the analysis applies to a certain trace type */
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/TmfBaseAspects.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/TmfBaseAspects.java
index 76825783e1..60528fadd7 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/TmfBaseAspects.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/TmfBaseAspects.java
@@ -13,7 +13,6 @@ import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
@@ -67,12 +66,7 @@ public final class TmfBaseAspects {
}
};
- private static final TmfEventFieldAspect CONTENTS_ASPECT = new TmfEventFieldAspect(Messages.getMessage(Messages.AspectName_Contents), null, new TmfEventFieldAspect.IRootField() {
- @Override
- public @Nullable ITmfEventField getRootField(ITmfEvent event) {
- return event.getContent();
- }
- }) {
+ private static final TmfEventFieldAspect CONTENTS_ASPECT = new TmfEventFieldAspect(Messages.getMessage(Messages.AspectName_Contents), null, event -> event.getContent()) {
@Override
public String getHelpText() {
return Messages.getMessage(Messages.AspectHelpText_Contents);
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTraceDefinition.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTraceDefinition.java
index 5da7059de1..c421395737 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTraceDefinition.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTraceDefinition.java
@@ -219,13 +219,10 @@ public abstract class CustomTraceDefinition {
* @return a new entity resolver
*/
protected static EntityResolver createEmptyEntityResolver() {
- return new EntityResolver() {
- @Override
- public InputSource resolveEntity(String publicId, String systemId) {
- String empty = ""; //$NON-NLS-1$
- ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
- return new InputSource(bais);
- }
+ return (publicId, systemId) -> {
+ String empty = ""; //$NON-NLS-1$
+ ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
+ return new InputSource(bais);
};
}
@@ -289,6 +286,26 @@ public abstract class CustomTraceDefinition {
}
/**
+ * Return the category of this trace definition
+ *
+ * @return The category of this trace definition
+ * @since 5.0
+ */
+ public String getCategoryName() {
+ return categoryName;
+ }
+
+ /**
+ * Return the name of this trace definition
+ *
+ * @return The name of this trace definition
+ * @since 5.0
+ */
+ public String getDefinitionName() {
+ return definitionName;
+ }
+
+ /**
* Get all the custom trace definition paths contributed by extensions, for
* a given content type (XML or Text).
*
@@ -335,4 +352,5 @@ public abstract class CustomTraceDefinition {
}
return extensionDefinitionsPaths;
}
+
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTxtTraceDefinition.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTxtTraceDefinition.java
index 897c09e89a..0616f6639b 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTxtTraceDefinition.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomTxtTraceDefinition.java
@@ -663,16 +663,7 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
}
}
- Set<CustomTxtTraceDefinition> defs = new TreeSet<>(new Comparator<CustomTxtTraceDefinition>() {
- @Override
- public int compare(CustomTxtTraceDefinition o1, CustomTxtTraceDefinition o2) {
- int result = o1.categoryName.compareTo(o2.categoryName);
- if (result != 0) {
- return result;
- }
- return o1.definitionName.compareTo(o2.definitionName);
- }
- });
+ Set<CustomTxtTraceDefinition> defs = new TreeSet<>(Comparator.comparing(CustomTxtTraceDefinition::getCategoryName).thenComparing(CustomTxtTraceDefinition::getDefinitionName));
defs.addAll(Arrays.asList(loadAll(CUSTOM_TXT_TRACE_DEFINITIONS_PATH_NAME)));
if (includeDefaults) {
defs.addAll(Arrays.asList(loadAll(CUSTOM_TXT_TRACE_DEFINITIONS_DEFAULT_PATH_NAME)));
@@ -951,4 +942,5 @@ public class CustomTxtTraceDefinition extends CustomTraceDefinition {
Activator.logError("Error deleting CustomTxtTraceDefinition: definitionName=" + definitionName, e); //$NON-NLS-1$
}
}
+
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTrace.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTrace.java
index c22083730c..9f6074e422 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTrace.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTrace.java
@@ -311,13 +311,10 @@ public class CustomXmlTrace extends TmfTrace implements ITmfPersistentlyIndexabl
final DocumentBuilder db = dbf.newDocumentBuilder();
// The following allows xml parsing without access to the dtd
- final EntityResolver resolver = new EntityResolver() {
- @Override
- public InputSource resolveEntity(final String publicId, final String systemId) {
- final String empty = ""; //$NON-NLS-1$
- final ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
- return new InputSource(bais);
- }
+ final EntityResolver resolver = (publicId, systemId) -> {
+ final String empty = ""; //$NON-NLS-1$
+ final ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
+ return new InputSource(bais);
};
db.setEntityResolver(resolver);
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTraceDefinition.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTraceDefinition.java
index 1ddf274db8..7277fc03be 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTraceDefinition.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/parsers/custom/CustomXmlTraceDefinition.java
@@ -322,16 +322,7 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
}
}
- Set<CustomXmlTraceDefinition> defs = new TreeSet<>(new Comparator<CustomXmlTraceDefinition>() {
- @Override
- public int compare(CustomXmlTraceDefinition o1, CustomXmlTraceDefinition o2) {
- int result = o1.categoryName.compareTo(o2.categoryName);
- if (result != 0) {
- return result;
- }
- return o1.definitionName.compareTo(o2.definitionName);
- }
- });
+ Set<CustomXmlTraceDefinition> defs = new TreeSet<>(Comparator.comparing(CustomXmlTraceDefinition::getCategoryName).thenComparing(CustomXmlTraceDefinition::getDefinitionName));
defs.addAll(Arrays.asList(loadAll(CUSTOM_XML_TRACE_DEFINITIONS_PATH_NAME)));
if (includeDefaults) {
defs.addAll(Arrays.asList(loadAll(CUSTOM_XML_TRACE_DEFINITIONS_DEFAULT_PATH_NAME)));
@@ -431,13 +422,10 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
DocumentBuilder db = dbf.newDocumentBuilder();
// The following allows xml parsing without access to the dtd
- EntityResolver resolver = new EntityResolver() {
- @Override
- public InputSource resolveEntity(String publicId, String systemId) {
- String empty = ""; //$NON-NLS-1$
- ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
- return new InputSource(bais);
- }
+ EntityResolver resolver = (publicId, systemId) -> {
+ String empty = ""; //$NON-NLS-1$
+ ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
+ return new InputSource(bais);
};
db.setEntityResolver(resolver);
@@ -614,13 +602,10 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
DocumentBuilder db = dbf.newDocumentBuilder();
// The following allows xml parsing without access to the dtd
- EntityResolver resolver = new EntityResolver() {
- @Override
- public InputSource resolveEntity(String publicId, String systemId) {
- String empty = ""; //$NON-NLS-1$
- ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
- return new InputSource(bais);
- }
+ EntityResolver resolver = (publicId, systemId) -> {
+ String empty = ""; //$NON-NLS-1$
+ ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes());
+ return new InputSource(bais);
};
db.setEntityResolver(resolver);
@@ -676,4 +661,5 @@ public class CustomXmlTraceDefinition extends CustomTraceDefinition {
Activator.logError("Error deleteing CustomXmlTraceDefinition: definitionName=" + definitionName, e); //$NON-NLS-1$
}
}
+
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/project/model/TmfTraceType.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/project/model/TmfTraceType.java
index 1b55653b36..ebf03f0c80 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/project/model/TmfTraceType.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/project/model/TmfTraceType.java
@@ -478,15 +478,12 @@ public final class TmfTraceType {
*/
public static @NonNull List<TraceTypeHelper> selectTraceType(String path, String traceTypeHint) throws TmfTraceImportException {
- Comparator<Pair<Integer, TraceTypeHelper>> comparator = new Comparator<Pair<Integer, TraceTypeHelper>>() {
- @Override
- public int compare(Pair<Integer, TraceTypeHelper> o1, Pair<Integer, TraceTypeHelper> o2) {
- int res = -o1.getFirst().compareTo(o2.getFirst()); // invert so that highest confidence is first
- if (res == 0) {
- res = o1.getSecond().getName().compareTo(o2.getSecond().getName());
- }
- return res;
+ Comparator<Pair<Integer, TraceTypeHelper>> comparator = (o1, o2) -> {
+ int res = -o1.getFirst().compareTo(o2.getFirst()); // invert so that highest confidence is first
+ if (res == 0) {
+ res = o1.getSecond().getName().compareTo(o2.getSecond().getName());
}
+ return res;
};
TreeSet<Pair<Integer, TraceTypeHelper>> validCandidates = new TreeSet<>(comparator);
diff --git a/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/RemoteFetchLogWizardRemotePage.java b/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/RemoteFetchLogWizardRemotePage.java
index 296047adda..7cfa3c8a43 100644
--- a/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/RemoteFetchLogWizardRemotePage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/RemoteFetchLogWizardRemotePage.java
@@ -39,8 +39,6 @@ import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
@@ -241,12 +239,7 @@ public class RemoteFetchLogWizardRemotePage extends AbstractTracePackageWizardPa
fIsVisible = visible;
if (visible) {
- getContainer().getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- updateViewer();
- }
- });
+ getContainer().getShell().getDisplay().asyncExec(this::updateViewer);
} else {
getElementViewer().setInput(null);
}
@@ -362,12 +355,7 @@ public class RemoteFetchLogWizardRemotePage extends AbstractTracePackageWizardPa
fExperimentNameText.setText(fExperimentName);
fExperimentNameText.setEnabled(fCreateExperimentCheckbox.getSelection());
- fExperimentNameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updatePageCompletion();
- }
- });
+ fExperimentNameText.addModifyListener(e -> updatePageCompletion());
fCreateExperimentCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/preferences/RemoteProfilesPreferencePage.java b/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/preferences/RemoteProfilesPreferencePage.java
index da0c137ebd..26ee386b7a 100644
--- a/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/preferences/RemoteProfilesPreferencePage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.remote.ui/src/org/eclipse/tracecompass/internal/tmf/remote/ui/wizards/fetch/preferences/RemoteProfilesPreferencePage.java
@@ -37,7 +37,6 @@ import org.eclipse.core.runtime.URIUtil;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
@@ -47,9 +46,7 @@ import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -59,8 +56,6 @@ import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
@@ -258,20 +253,17 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
}
});
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- TracePackageElement element = (TracePackageElement) (selection.size() == 1 ? selection.getFirstElement() : null);
- fDetailsPanel.refreshDetailsPanel(element);
- enableButtons(selection);
- fSelectedProfileName = null;
- while (element != null) {
- if (element instanceof RemoteImportProfileElement) {
- fSelectedProfileName = ((RemoteImportProfileElement) element).getProfileName();
- }
- element = element.getParent();
+ treeViewer.addSelectionChangedListener(event -> {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ TracePackageElement element = (TracePackageElement) (selection.size() == 1 ? selection.getFirstElement() : null);
+ fDetailsPanel.refreshDetailsPanel(element);
+ enableButtons(selection);
+ fSelectedProfileName = null;
+ while (element != null) {
+ if (element instanceof RemoteImportProfileElement) {
+ fSelectedProfileName = ((RemoteImportProfileElement) element).getProfileName();
}
+ element = element.getParent();
}
});
@@ -483,12 +475,7 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
private void createContextMenu() {
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
- menuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- }
- });
+ menuManager.addMenuListener(manager -> fillContextMenu(manager));
Menu contextMenu = menuManager.createContextMenu(fTreeViewer.getTree());
fTreeViewer.getTree().setMenu(contextMenu);
@@ -762,14 +749,11 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
profileNameText.setLayoutData(gd);
profileNameText.setText(element.getProfileName());
- profileNameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- element.setProfileName(profileNameText.getText().trim());
- fTreeViewer.refresh(element, true);
- validate();
- fSelectedProfileName = element.getProfileName();
- }
+ profileNameText.addModifyListener(e -> {
+ element.setProfileName(profileNameText.getText().trim());
+ fTreeViewer.refresh(element, true);
+ validate();
+ fSelectedProfileName = element.getProfileName();
});
} else if (selection instanceof RemoteImportConnectionNodeElement) {
@@ -781,13 +765,10 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
nameText.setText(element.getName());
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
nameText.setLayoutData(gd);
- nameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- element.setName(nameText.getText().trim());
- fTreeViewer.refresh(element, true);
- validate();
- }
+ nameText.addModifyListener(e -> {
+ element.setName(nameText.getText().trim());
+ fTreeViewer.refresh(element, true);
+ validate();
});
label = new Label(fComposite, SWT.NONE);
@@ -796,13 +777,10 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
uriText.setText(element.getURI());
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
uriText.setLayoutData(gd);
- uriText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- element.setURI(uriText.getText().trim());
- fTreeViewer.refresh(element, true);
- validate();
- }
+ uriText.addModifyListener(e -> {
+ element.setURI(uriText.getText().trim());
+ fTreeViewer.refresh(element, true);
+ validate();
});
} else if (selection instanceof RemoteImportTraceGroupElement) {
@@ -814,13 +792,10 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
rootText.setLayoutData(gd);
rootText.setText(element.getRootImportPath());
- rootText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- element.setRootImportPath(rootText.getText().trim());
- fTreeViewer.refresh(element, true);
- validate();
- }
+ rootText.addModifyListener(e -> {
+ element.setRootImportPath(rootText.getText().trim());
+ fTreeViewer.refresh(element, true);
+ validate();
});
// create label for alignment
@@ -852,18 +827,15 @@ public class RemoteProfilesPreferencePage extends PreferencePage implements IWor
}
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
fileNameText.setLayoutData(gd);
- fileNameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- for (TracePackageElement child : element.getChildren()) {
- if (child instanceof TracePackageFilesElement) {
- TracePackageFilesElement files = (TracePackageFilesElement) child;
- files.setFileName(fileNameText.getText().trim());
- }
+ fileNameText.addModifyListener(e -> {
+ for (TracePackageElement child : element.getChildren()) {
+ if (child instanceof TracePackageFilesElement) {
+ TracePackageFilesElement files = (TracePackageFilesElement) child;
+ files.setFileName(fileNameText.getText().trim());
}
- fTreeViewer.refresh(element, true);
- validate();
}
+ fTreeViewer.refresh(element, true);
+ validate();
});
label = new Label(fComposite, SWT.NONE);
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java
index 41da2e83e2..c92bf6e1e5 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/commands/CopyToClipboardOperation.java
@@ -88,23 +88,20 @@ public class CopyToClipboardOperation implements IRunnableWithProgress {
copy(sb, monitor);
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- if (sb.length() == 0) {
- return;
- }
- Clipboard clipboard = new Clipboard(Display.getDefault());
- try {
- clipboard.setContents(new Object[] { sb.toString() },
- new Transfer[] { TextTransfer.getInstance() });
- } catch (OutOfMemoryError e) {
- sb.setLength(0);
- sb.trimToSize();
- showErrorDialog();
- } finally {
- clipboard.dispose();
- }
+ Display.getDefault().syncExec(() -> {
+ if (sb.length() == 0) {
+ return;
+ }
+ Clipboard clipboard = new Clipboard(Display.getDefault());
+ try {
+ clipboard.setContents(new Object[] { sb.toString() },
+ new Transfer[] { TextTransfer.getInstance() });
+ } catch (OutOfMemoryError e) {
+ sb.setLength(0);
+ sb.trimToSize();
+ showErrorDialog();
+ } finally {
+ clipboard.dispose();
}
});
@@ -151,15 +148,12 @@ public class CopyToClipboardOperation implements IRunnableWithProgress {
}
private static void showErrorDialog() {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- MessageBox confirmOperation = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
- confirmOperation.setText(Messages.CopyToClipboardOperation_OutOfMemoryErrorTitle);
- confirmOperation.setMessage(Messages.CopyToClipboardOperation_OutOfMemoryErrorMessage);
- confirmOperation.open();
- }
+ Display.getDefault().syncExec(() -> {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ MessageBox confirmOperation = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
+ confirmOperation.setText(Messages.CopyToClipboardOperation_OutOfMemoryErrorTitle);
+ confirmOperation.setMessage(Messages.CopyToClipboardOperation_OutOfMemoryErrorMessage);
+ confirmOperation.open();
});
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/CustomParserUtils.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/CustomParserUtils.java
index 848ab21050..5785c19c36 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/CustomParserUtils.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/CustomParserUtils.java
@@ -63,12 +63,7 @@ public class CustomParserUtils {
throw new OperationCanceledException();
}
if (traceTypeId.equals(trace.getTraceType())) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- trace.closeEditors();
- }
- });
+ Display.getDefault().syncExec(trace::closeEditors);
trace.deleteSupplementaryResources();
trace.refreshSupplementaryFolder();
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java
index 183598f9b0..ab48c82305 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java
@@ -51,8 +51,6 @@ import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.TitleEvent;
-import org.eclipse.swt.browser.TitleListener;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StyleRange;
@@ -62,7 +60,6 @@ import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
@@ -989,12 +986,7 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
final Shell helpShell = new Shell(getShell(), SWT.SHELL_TRIM);
helpShell.setLayout(new FillLayout());
helpBrowser = new Browser(helpShell, SWT.NONE);
- helpBrowser.addTitleListener(new TitleListener() {
- @Override
- public void changed(TitleEvent event) {
- helpShell.setText(event.title);
- }
- });
+ helpBrowser.addTitleListener(event -> helpShell.setText(event.title));
Rectangle r = container.getBounds();
Point p = container.toDisplay(r.x, r.y);
Rectangle trim = helpShell.computeTrim(p.x + (r.width - 750) / 2, p.y + (r.height - 400) / 2, 750, 400);
@@ -1229,20 +1221,17 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
infiniteButton.setVisible(true);
}
- VerifyListener digitsListener = new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- if (e.text.equals(INFINITY_STRING)) {
- e.doit = e.widget == cardinalityMaxText && e.start == 0 && e.end == ((Text) e.widget).getText().length();
- } else {
- if (((Text) e.widget).getText().equals(INFINITY_STRING)) {
- e.doit = e.start == 0 && e.end == ((Text) e.widget).getText().length();
- }
- for (int i = 0; i < e.text.length(); i++) {
- if (!Character.isDigit(e.text.charAt(i))) {
- e.doit = false;
- break;
- }
+ VerifyListener digitsListener = e -> {
+ if (e.text.equals(INFINITY_STRING)) {
+ e.doit = e.widget == cardinalityMaxText && e.start == 0 && e.end == ((Text) e.widget).getText().length();
+ } else {
+ if (((Text) e.widget).getText().equals(INFINITY_STRING)) {
+ e.doit = e.start == 0 && e.end == ((Text) e.widget).getText().length();
+ }
+ for (int i = 0; i < e.text.length(); i++) {
+ if (!Character.isDigit(e.text.charAt(i))) {
+ e.doit = false;
+ break;
}
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/SelectSupplementaryResourcesDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/SelectSupplementaryResourcesDialog.java
index c9ed9bd838..5d77ca4919 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/SelectSupplementaryResourcesDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/SelectSupplementaryResourcesDialog.java
@@ -24,13 +24,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -206,39 +202,31 @@ public class SelectSupplementaryResourcesDialog extends Dialog {
fTreeViewer.expandAll();
setAllChecked(true);
- fTreeViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (event.getElement() instanceof TmfCommonProjectElement) {
- fTreeViewer.setSubtreeChecked(event.getElement(), event.getChecked());
- fTreeViewer.setGrayed(event.getElement(), false);
- } else if (event.getElement() instanceof IResource) {
- TmfCommonProjectElement projectElement = getParentElement((IResource) event.getElement());
- int checkedCount = 0;
- Collection<IResource> resources = fResourceMap.get(projectElement);
- for (IResource resource : resources) {
- if (fTreeViewer.getChecked(resource)) {
- checkedCount++;
- }
- }
- if (checkedCount == resources.size()) {
- fTreeViewer.setChecked(projectElement, true);
- fTreeViewer.setGrayed(projectElement, false);
- } else if (checkedCount > 0) {
- fTreeViewer.setGrayChecked(projectElement, true);
- } else {
- fTreeViewer.setGrayChecked(projectElement, false);
+ fTreeViewer.addCheckStateListener(event -> {
+ if (event.getElement() instanceof TmfCommonProjectElement) {
+ fTreeViewer.setSubtreeChecked(event.getElement(), event.getChecked());
+ fTreeViewer.setGrayed(event.getElement(), false);
+ } else if (event.getElement() instanceof IResource) {
+ TmfCommonProjectElement projectElement = getParentElement((IResource) event.getElement());
+ int checkedCount = 0;
+ Collection<IResource> resources = fResourceMap.get(projectElement);
+ for (IResource resource : resources) {
+ if (fTreeViewer.getChecked(resource)) {
+ checkedCount++;
}
}
+ if (checkedCount == resources.size()) {
+ fTreeViewer.setChecked(projectElement, true);
+ fTreeViewer.setGrayed(projectElement, false);
+ } else if (checkedCount > 0) {
+ fTreeViewer.setGrayChecked(projectElement, true);
+ } else {
+ fTreeViewer.setGrayChecked(projectElement, false);
+ }
}
});
- fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateOKButtonEnablement();
- }
- });
+ fTreeViewer.addSelectionChangedListener(event -> updateOKButtonEnablement());
Composite btComp = new Composite(contextGroup, SWT.NONE);
FillLayout layout = new FillLayout(SWT.VERTICAL);
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/offset/OffsetDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/offset/OffsetDialog.java
index cbbc4fb648..d6a57843f5 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/offset/OffsetDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/dialogs/offset/OffsetDialog.java
@@ -16,7 +16,6 @@ package org.eclipse.tracecompass.internal.tmf.ui.project.dialogs.offset;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -38,8 +37,6 @@ import org.eclipse.jface.viewers.TreeViewerFocusCellManager;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TreeEditor;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -249,12 +246,7 @@ public class OffsetDialog extends Dialog {
setBasicMode();
TmfSignalManager.register(this);
- composite.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- TmfSignalManager.deregister(OffsetDialog.this);
- }
- });
+ composite.addDisposeListener(e -> TmfSignalManager.deregister(OffsetDialog.this));
return area;
}
@@ -388,21 +380,18 @@ public class OffsetDialog extends Dialog {
fTargetTimeColumn = column.getColumn();
List<TmfTraceElement> traces = new ArrayList<>(fOffsetMap.keySet());
- Collections.sort(traces, new Comparator<TmfTraceElement>() {
- @Override
- public int compare(TmfTraceElement o1, TmfTraceElement o2) {
- IPath folder1 = new Path(o1.getElementPath()).removeLastSegments(1);
- IPath folder2 = new Path(o2.getElementPath()).removeLastSegments(1);
- if (folder1.equals(folder2)) {
- return o1.getName().compareToIgnoreCase(o2.getName());
- }
- if (folder1.isPrefixOf(folder2)) {
- return 1;
- } else if (folder2.isPrefixOf(folder1)) {
- return -1;
- }
- return folder1.toString().compareToIgnoreCase(folder2.toString());
+ Collections.sort(traces, (o1, o2) -> {
+ IPath folder1 = new Path(o1.getElementPath()).removeLastSegments(1);
+ IPath folder2 = new Path(o2.getElementPath()).removeLastSegments(1);
+ if (folder1.equals(folder2)) {
+ return o1.getName().compareToIgnoreCase(o2.getName());
}
+ if (folder1.isPrefixOf(folder2)) {
+ return 1;
+ } else if (folder2.isPrefixOf(folder1)) {
+ return -1;
+ }
+ return folder1.toString().compareToIgnoreCase(folder2.toString());
});
fViewer.getViewer().setContentProvider(new ArrayTreeContentProvider());
@@ -520,15 +509,12 @@ public class OffsetDialog extends Dialog {
*/
@TmfSignalHandler
public void eventSelected(final TmfEventSelectedSignal signal) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (TmfTraceElement traceElement : fOffsetMap.keySet()) {
- if (traceElement.getResource().equals(signal.getEvent().getTrace().getResource())) {
- fRefTimeMap.put(traceElement, signal.getEvent().getTimestamp());
- fViewer.getViewer().update(traceElement, null);
- break;
- }
+ Display.getDefault().asyncExec(() -> {
+ for (TmfTraceElement traceElement : fOffsetMap.keySet()) {
+ if (traceElement.getResource().equals(signal.getEvent().getTrace().getResource())) {
+ fRefTimeMap.put(traceElement, signal.getEvent().getTimestamp());
+ fViewer.getViewer().update(traceElement, null);
+ break;
}
}
});
@@ -542,13 +528,10 @@ public class OffsetDialog extends Dialog {
*/
@TmfSignalHandler
public void timeSelected(final TmfSelectionRangeUpdatedSignal signal) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (TmfTraceElement traceElement : fOffsetMap.keySet()) {
- fTargetTimeMap.put(traceElement, signal.getBeginTime());
- fViewer.getViewer().update(traceElement, null);
- }
+ Display.getDefault().asyncExec(() -> {
+ for (TmfTraceElement traceElement : fOffsetMap.keySet()) {
+ fTargetTimeMap.put(traceElement, signal.getBeginTime());
+ fViewer.getViewer().update(traceElement, null);
}
});
}
@@ -561,18 +544,15 @@ public class OffsetDialog extends Dialog {
*/
@TmfSignalHandler
public void traceOpened(final TmfTraceOpenedSignal signal) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) {
- for (TmfTraceElement traceElement : fOffsetMap.keySet()) {
- if (traceElement.getResource().equals(trace.getResource())) {
- if (fRefTimeMap.get(traceElement) == null) {
- fRefTimeMap.put(traceElement, trace.getStartTime());
- fViewer.getViewer().update(traceElement, null);
- }
- break;
+ Display.getDefault().asyncExec(() -> {
+ for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) {
+ for (TmfTraceElement traceElement : fOffsetMap.keySet()) {
+ if (traceElement.getResource().equals(trace.getResource())) {
+ if (fRefTimeMap.get(traceElement) == null) {
+ fRefTimeMap.put(traceElement, trace.getStartTime());
+ fViewer.getViewer().update(traceElement, null);
}
+ break;
}
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java
index 09515ac281..107d43ccc6 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/ClearTraceOffsetHandler.java
@@ -95,12 +95,7 @@ public class ClearTraceOffsetHandler extends AbstractHandler {
throw new OperationCanceledException();
}
if (!TimestampTransformFactory.getTimestampTransform(trace.getResource()).equals(TimestampTransformFactory.getDefaultTransform())) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- trace.closeEditors();
- }
- });
+ Display.getDefault().syncExec(trace::closeEditors);
trace.deleteSupplementaryResources();
TimestampTransformFactory.setTimestampTransform(trace.getResource(), null);
trace.refreshSupplementaryFolder();
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/DropAdapterAssistant.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/DropAdapterAssistant.java
index 638d0a13fe..47075e69de 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/DropAdapterAssistant.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/DropAdapterAssistant.java
@@ -504,12 +504,7 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
final File source = new File(path.toString());
if (source.isDirectory()) {
IPath containerPath = folder.getFullPath().addTrailingSeparator().append(targetName);
- IOverwriteQuery overwriteImplementor = new IOverwriteQuery() {
- @Override
- public String queryOverwrite(String pathString) {
- return IOverwriteQuery.NO_ALL;
- }
- };
+ IOverwriteQuery overwriteImplementor = pathString -> IOverwriteQuery.NO_ALL;
List<File> filesToImport = Arrays.asList(source.listFiles());
ImportOperation operation = new ImportOperation(
containerPath,
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OffsetTraceHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OffsetTraceHandler.java
index fcef0cc311..81256da485 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OffsetTraceHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OffsetTraceHandler.java
@@ -106,12 +106,7 @@ public class OffsetTraceHandler extends AbstractHandler {
final TmfTraceElement trace = entry.getKey();
Long offset = entry.getValue();
if (offset != 0 && trace.getResource().exists()) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- trace.closeEditors();
- }
- });
+ Display.getDefault().syncExec(trace::closeEditors);
long previousOffset = TimestampTransformFactory.getTimestampTransform(trace.getResource()).transform(0);
ITmfTimestampTransform transform = TimestampTransformFactory.createWithOffset(previousOffset + offset);
trace.deleteSupplementaryResources();
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OpenAnalysisHelpHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OpenAnalysisHelpHandler.java
index ae52eb4ba6..d8b3319f42 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OpenAnalysisHelpHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/OpenAnalysisHelpHandler.java
@@ -96,18 +96,15 @@ public class OpenAnalysisHelpHandler extends AbstractHandler {
}
private static void displayHelpMsg(final String errorMsg) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- /*
- * TODO: A message box is not the best place to show help.
- * Something should be done with the Eclipse help
- */
- final MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- mb.setText(Messages.AnalysisModule_Help);
- mb.setMessage(errorMsg);
- mb.open();
- }
+ Display.getDefault().asyncExec(() -> {
+ /*
+ * TODO: A message box is not the best place to show help.
+ * Something should be done with the Eclipse help
+ */
+ final MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ mb.setText(Messages.AnalysisModule_Help);
+ mb.setMessage(errorMsg);
+ mb.open();
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameFolderHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameFolderHandler.java
index 8de0e0cf1c..4581cc07bb 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameFolderHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameFolderHandler.java
@@ -101,12 +101,7 @@ public class RenameFolderHandler extends AbstractHandler {
}
for (final TmfTraceElement traceElement : oldFolder.getTraces()) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- traceElement.closeEditors();
- }
- });
+ Display.getDefault().syncExec(traceElement::closeEditors);
IPath relativePath = traceElement.getPath().makeRelativeTo(oldFolder.getPath());
String newElementPath = newFolderPath.makeRelativeTo(tracesFolder.getPath()).append(relativePath).toString();
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameTraceHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameTraceHandler.java
index 7a31469f69..8492ca7f0b 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameTraceHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/RenameTraceHandler.java
@@ -101,12 +101,7 @@ public class RenameTraceHandler extends AbstractHandler {
throw new OperationCanceledException();
}
// Close the trace if open
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- oldTrace.closeEditors();
- }
- });
+ Display.getDefault().syncExec(oldTrace::closeEditors);
if (oldTrace.getResource() instanceof IFolder) {
IFolder folder = (IFolder) oldTrace.getResource();
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
index 904330b006..875403aa35 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
@@ -164,113 +164,110 @@ public class SynchronizeTracesHandler extends AbstractHandler {
TmfTraceManager.refreshSupplementaryFiles(experiment);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- List<TmfTraceElement> tracesToAdd = new ArrayList<>();
- List<TmfTraceElement> tracesToRemove = new ArrayList<>();
+ Display.getDefault().asyncExec(() -> {
+ List<TmfTraceElement> tracesToAdd = new ArrayList<>();
+ List<TmfTraceElement> tracesToRemove = new ArrayList<>();
+ /*
+ * For each trace in the experiment, if there is a
+ * transform equation, copy the original trace, so that
+ * a new state system will be generated with sync time.
+ */
+ for (TmfTraceElement traceel : tl) {
+ /* Find the original trace */
+ TmfTraceElement origtrace = traceel.getElementUnderTraceFolder();
+
/*
- * For each trace in the experiment, if there is a
- * transform equation, copy the original trace, so that
- * a new state system will be generated with sync time.
+ * Find the trace corresponding to this element in
+ * the experiment
*/
- for (TmfTraceElement traceel : tl) {
- /* Find the original trace */
- TmfTraceElement origtrace = traceel.getElementUnderTraceFolder();
-
+ ITmfTrace expTrace = null;
+ for (ITmfTrace t : experiment.getTraces()) {
+ if (t.getResource().equals(origtrace.getResource())) {
+ expTrace = t;
+ break;
+ }
+ }
+ if ((expTrace != null) && syncAlgo.isTraceSynced(expTrace.getHostId())) {
/*
- * Find the trace corresponding to this element in
- * the experiment
+ * Make sure a trace with the new name does not
+ * exist
*/
- ITmfTrace expTrace = null;
- for (ITmfTrace t : experiment.getTraces()) {
- if (t.getResource().equals(origtrace.getResource())) {
- expTrace = t;
- break;
+ StringBuilder newname = new StringBuilder(traceel.getName());
+ IContainer parentFolder = origtrace.getResource().getParent();
+ boolean traceexists;
+ do {
+ traceexists = false;
+ newname.append('_');
+ if (parentFolder.findMember(newname.toString()) != null) {
+ traceexists = true;
}
- }
- if ((expTrace != null) && syncAlgo.isTraceSynced(expTrace.getHostId())) {
- /*
- * Make sure a trace with the new name does not
- * exist
- */
- StringBuilder newname = new StringBuilder(traceel.getName());
- IContainer parentFolder = origtrace.getResource().getParent();
- boolean traceexists;
- do {
- traceexists = false;
- newname.append('_');
- if (parentFolder.findMember(newname.toString()) != null) {
- traceexists = true;
- }
- } while (traceexists);
+ } while (traceexists);
- /* Copy the original trace */
- TmfTraceElement newtrace = origtrace.copy(newname.toString());
- if (newtrace == null) {
- TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title,
- Messages.SynchronizeTracesHandler_Error + CR + CR + String.format(Messages.SynchronizeTracesHandler_CopyProblem, origtrace.getName()));
- continue;
- }
-
- /*
- * Instantiate the new trace and set its sync
- * formula
- */
- ITmfTrace trace = newtrace.instantiateTrace();
- ITmfEvent traceEvent = newtrace.instantiateEvent();
+ /* Copy the original trace */
+ TmfTraceElement newtrace = origtrace.copy(newname.toString());
+ if (newtrace == null) {
+ TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title,
+ Messages.SynchronizeTracesHandler_Error + CR + CR + String.format(Messages.SynchronizeTracesHandler_CopyProblem, origtrace.getName()));
+ continue;
+ }
- try {
- trace.initTrace(newtrace.getResource(), newtrace.getResource().getLocation().toOSString(), traceEvent.getClass());
- } catch (TmfTraceException e) {
- Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingForTrace, exp.getName(), traceel.getName()), e);
- TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + e.getMessage());
- }
- trace.setTimestampTransform(syncAlgo.getTimestampTransform(expTrace));
- TmfTraceManager.refreshSupplementaryFiles(trace);
- trace.dispose();
+ /*
+ * Instantiate the new trace and set its sync
+ * formula
+ */
+ ITmfTrace trace1 = newtrace.instantiateTrace();
+ ITmfEvent traceEvent = newtrace.instantiateEvent();
- tracesToAdd.add(newtrace);
- tracesToRemove.add(traceel);
+ try {
+ trace1.initTrace(newtrace.getResource(), newtrace.getResource().getLocation().toOSString(), traceEvent.getClass());
+ } catch (TmfTraceException e1) {
+ Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingForTrace, exp.getName(), traceel.getName()), e1);
+ TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + e1.getMessage());
}
- }
- experiment.dispose();
+ trace1.setTimestampTransform(syncAlgo.getTimestampTransform(expTrace));
+ TmfTraceManager.refreshSupplementaryFiles(trace1);
+ trace1.dispose();
- // Move synchronization file temporarily so that
- // it doesn't get deleted by the experiment change
- IFolder tmpFolder = exp.getTraceSupplementaryFolder(exp.getName() + '.' + experiment.getSynchronizationFolder(false));
- IResource syncFile = null;
- for (IResource resource : exp.getSupplementaryResources()) {
- if (resource.getName().equals(experiment.getSynchronizationFolder(false))) {
- try {
- resource.move(tmpFolder.getFullPath(), false, null);
- syncFile = resource;
- break;
- } catch (CoreException e) {
- Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingExperiment, exp.getName()), e);
- }
- }
+ tracesToAdd.add(newtrace);
+ tracesToRemove.add(traceel);
}
+ }
+ experiment.dispose();
- for (TmfTraceElement trace : tracesToRemove) {
+ // Move synchronization file temporarily so that
+ // it doesn't get deleted by the experiment change
+ IFolder tmpFolder = exp.getTraceSupplementaryFolder(exp.getName() + '.' + experiment.getSynchronizationFolder(false));
+ IResource syncFile = null;
+ for (IResource resource : exp.getSupplementaryResources()) {
+ if (resource.getName().equals(experiment.getSynchronizationFolder(false))) {
try {
- exp.removeTrace(trace);
- } catch (CoreException e) {
- Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingForTrace, exp.getName(), trace.getName()), e);
- TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + e.getMessage());
+ resource.move(tmpFolder.getFullPath(), false, null);
+ syncFile = resource;
+ break;
+ } catch (CoreException e2) {
+ Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingExperiment, exp.getName()), e2);
}
}
- for (TmfTraceElement trace : tracesToAdd) {
- exp.addTrace(trace);
+ }
+
+ for (TmfTraceElement trace2 : tracesToRemove) {
+ try {
+ exp.removeTrace(trace2);
+ } catch (CoreException e3) {
+ Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingForTrace, exp.getName(), trace2.getName()), e3);
+ TraceUtils.displayErrorMsg(Messages.SynchronizeTracesHandler_Title, Messages.SynchronizeTracesHandler_Error + CR + CR + e3.getMessage());
}
+ }
+ for (TmfTraceElement trace3 : tracesToAdd) {
+ exp.addTrace(trace3);
+ }
- // Move synchronization file back
- if (tmpFolder.exists() && syncFile != null) {
- try {
- tmpFolder.move(syncFile.getFullPath(), false, null);
- } catch (CoreException e) {
- Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingExperiment, exp.getName()), e);
- }
+ // Move synchronization file back
+ if (tmpFolder.exists() && syncFile != null) {
+ try {
+ tmpFolder.move(syncFile.getFullPath(), false, null);
+ } catch (CoreException e4) {
+ Activator.getDefault().logError(String.format(Messages.SynchronizeTracesHandler_ErrorSynchingExperiment, exp.getName()), e4);
}
}
});
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/operations/SelectTracesOperation.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/operations/SelectTracesOperation.java
index 04dda383c3..c7c4d7956b 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/operations/SelectTracesOperation.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/operations/SelectTracesOperation.java
@@ -196,12 +196,9 @@ public class SelectTracesOperation implements IRunnableWithProgress {
subMonitor.worked(1);
}
if (changed) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- experimentElement.closeEditors();
- experimentElement.deleteSupplementaryResources();
- }
+ Display.getDefault().asyncExec(() -> {
+ experimentElement.closeEditors();
+ experimentElement.deleteSupplementaryResources();
});
}
setStatus(Status.OK_STATUS);
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportConflictHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportConflictHandler.java
index 3381af9fe4..66d4ef1848 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportConflictHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportConflictHandler.java
@@ -155,13 +155,7 @@ public class ImportConflictHandler {
};
final int[] returnValue = new int[1];
- fShell.getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- returnValue[0] = dialog.open();
- }
- });
+ fShell.getDisplay().syncExec(() -> returnValue[0] = dialog.open());
return returnValue[0];
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportTraceWizardPage.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportTraceWizardPage.java
index 395516b414..da1bdf678b 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportTraceWizardPage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportTraceWizardPage.java
@@ -49,7 +49,6 @@ import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -58,11 +57,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -320,12 +317,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
getFileProvider(), new WorkbenchLabelProvider(), SWT.NONE,
DialogUtil.inRegularFontMode(parent));
- ICheckStateListener listener = new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateWidgetEnablements();
- }
- };
+ ICheckStateListener listener = event -> updateWidgetEnablements();
WorkbenchViewerComparator comparator = new WorkbenchViewerComparator();
fSelectionGroup.setTreeComparator(comparator);
@@ -486,14 +478,11 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
layoutData.widthHint = new PixelConverter(pathSelectionCombo).convertWidthInCharsToPixels(25);
pathSelectionCombo.setLayoutData(layoutData);
- TraverseListener traverseListener = new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- entryChanged = false;
- updateFromSourceField();
- }
+ TraverseListener traverseListener = e -> {
+ if (e.detail == SWT.TRAVERSE_RETURN) {
+ e.doit = false;
+ entryChanged = false;
+ updateFromSourceField();
}
};
@@ -516,12 +505,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
}
};
- ModifyListener modifyListner = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- entryChanged = true;
- }
- };
+ ModifyListener modifyListner = e -> entryChanged = true;
pathSelectionCombo.addModifyListener(modifyListner);
pathSelectionCombo.addTraverseListener(traverseListener);
@@ -812,13 +796,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
private TraceFileSystemElement selectFiles(final IFileSystemObject rootFileSystemObject,
final FileSystemObjectImportStructureProvider structureProvider) {
final TraceFileSystemElement[] results = new TraceFileSystemElement[1];
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- @Override
- public void run() {
- // Create the root element from the supplied file system object
- results[0] = TraceFileSystemElement.createRootTraceFileElement(rootFileSystemObject, structureProvider);
- }
- });
+ BusyIndicator.showWhile(getShell().getDisplay(), () -> results[0] = TraceFileSystemElement.createRootTraceFileElement(rootFileSystemObject, structureProvider));
return results[0];
}
@@ -921,12 +899,7 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
data = new GridData(GridData.FILL, GridData.CENTER, true, false);
fExperimentNameText.setLayoutData(data);
- fExperimentNameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updateWidgetEnablements();
- }
- });
+ fExperimentNameText.addModifyListener(e -> updateWidgetEnablements());
fCreateExperimentCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TraceValidateAndImportOperation.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TraceValidateAndImportOperation.java
index bd222d0156..0aa94db52a 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TraceValidateAndImportOperation.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/TraceValidateAndImportOperation.java
@@ -599,12 +599,7 @@ public class TraceValidateAndImportOperation extends TmfWorkspaceModifyOperation
ImportProvider fileSystemStructureProvider = new ImportProvider();
- IOverwriteQuery myQueryImpl = new IOverwriteQuery() {
- @Override
- public String queryOverwrite(String file) {
- return IOverwriteQuery.NO_ALL;
- }
- };
+ IOverwriteQuery myQueryImpl = file -> IOverwriteQuery.NO_ALL;
progressMonitor.setTaskName(Messages.ImportTraceWizard_ExtractImportOperationTaskName);
IPath containerPath = tempFolder.getFullPath();
@@ -769,12 +764,7 @@ public class TraceValidateAndImportOperation extends TmfWorkspaceModifyOperation
ImportProvider fileSystemStructureProvider = new ImportProvider();
- IOverwriteQuery myQueryImpl = new IOverwriteQuery() {
- @Override
- public String queryOverwrite(String file) {
- return IOverwriteQuery.NO_ALL;
- }
- };
+ IOverwriteQuery myQueryImpl = file -> IOverwriteQuery.NO_ALL;
monitor.setTaskName(Messages.ImportTraceWizard_ImportOperationTaskName + " " + fileSystemElement.getFileSystemObject().getAbsolutePath()); //$NON-NLS-1$
ImportOperation operation = new ImportOperation(containerPath, parentFolder, fileSystemStructureProvider, myQueryImpl, subList);
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java
index 7bfc54bd30..6a319b0cf9 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/AbstractTracePackageWizardPage.java
@@ -38,10 +38,8 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.tmf.ui.dialog.TmfFileDialogFactory;
@@ -235,12 +233,7 @@ public abstract class AbstractTracePackageWizardPage extends WizardPage {
fBrowseButton = new Button(filePathSelectionGroup,
SWT.PUSH);
fBrowseButton.setText(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.Messages.TracePackage_Browse);
- fBrowseButton.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- handleFilePathBrowseButtonPressed(fileDialogStyle);
- }
- });
+ fBrowseButton.addListener(SWT.Selection, event -> handleFilePathBrowseButtonPressed(fileDialogStyle));
setButtonLayoutData(fBrowseButton);
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java
index 29f09b91be..9faf41fb86 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/tracepkg/importexport/ImportTracePackageWizardPage.java
@@ -36,16 +36,12 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.AbstractTracePackageOperation;
@@ -152,21 +148,18 @@ public class ImportTracePackageWizardPage extends AbstractTracePackageWizardPage
Button button = new Button(projectSelectionGroup,
SWT.PUSH);
button.setText(Messages.ImportTracePackageWizardPage_SelectProjectButton);
- button.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- ElementListSelectionDialog d = new ElementListSelectionDialog(getContainer().getShell(), new WorkbenchLabelProvider());
+ button.addListener(SWT.Selection, event -> {
+ ElementListSelectionDialog d = new ElementListSelectionDialog(getContainer().getShell(), new WorkbenchLabelProvider());
- d.setBlockOnOpen(true);
- d.setTitle(Messages.ImportTracePackageWizardPage_SelectProjectDialogTitle);
+ d.setBlockOnOpen(true);
+ d.setTitle(Messages.ImportTracePackageWizardPage_SelectProjectDialogTitle);
- d.setElements(fOpenedTmfProjects.toArray(new IProject[] {}));
+ d.setElements(fOpenedTmfProjects.toArray(new IProject[] {}));
- d.open();
- if (d.getFirstResult() != null) {
- IProject project = (IProject) d.getFirstResult();
- selectProject(project);
- }
+ d.open();
+ if (d.getFirstResult() != null) {
+ IProject project = (IProject) d.getFirstResult();
+ selectProject(project);
}
});
setButtonLayoutData(button);
@@ -272,13 +265,10 @@ public class ImportTracePackageWizardPage extends AbstractTracePackageWizardPage
});
// User can type-in path and press return to validate
- filePathCombo.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- updateWithFilePathSelection();
- }
+ filePathCombo.addTraverseListener(e -> {
+ if (e.detail == SWT.TRAVERSE_RETURN) {
+ e.doit = false;
+ updateWithFilePathSelection();
}
});
}
@@ -292,20 +282,17 @@ public class ImportTracePackageWizardPage extends AbstractTracePackageWizardPage
}
setErrorMessage(null);
- getContainer().getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- CheckboxTreeViewer elementViewer = getElementViewer();
- Object elementViewerInput = createElementViewerInput();
- elementViewer.setInput(elementViewerInput);
- if (elementViewerInput != null) {
- elementViewer.expandToLevel(2);
- setAllChecked(elementViewer, false, true);
- fValidatedFilePath = getFilePathValue();
- }
-
- updatePageCompletion();
+ getContainer().getShell().getDisplay().asyncExec(() -> {
+ CheckboxTreeViewer elementViewer = getElementViewer();
+ Object elementViewerInput = createElementViewerInput();
+ elementViewer.setInput(elementViewerInput);
+ if (elementViewerInput != null) {
+ elementViewer.expandToLevel(2);
+ setAllChecked(elementViewer, false, true);
+ fValidatedFilePath = getFilePathValue();
}
+
+ updatePageCompletion();
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateContentSelected.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateContentSelected.java
index 2e54a876ff..d4a897997e 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateContentSelected.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateContentSelected.java
@@ -37,17 +37,14 @@ public class PieChartViewerStateContentSelected implements IPieChartViewerState
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- synchronized (context) {
- if (!context.isDisposed()) {
- context.updateGlobalPieChart();
- context.updateTimeRangeSelectionPieChart();
- context.getTimeRangePC().redraw();
- context.getGlobalPC().getLegend().setPosition(SWT.BOTTOM);
- context.layout();
- }
+ Display.getDefault().asyncExec(() -> {
+ synchronized (context) {
+ if (!context.isDisposed()) {
+ context.updateGlobalPieChart();
+ context.updateTimeRangeSelectionPieChart();
+ context.getTimeRangePC().redraw();
+ context.getGlobalPC().getLegend().setPosition(SWT.BOTTOM);
+ context.layout();
}
}
});
@@ -60,15 +57,12 @@ public class PieChartViewerStateContentSelected implements IPieChartViewerState
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- synchronized (context) {
- if (!context.isDisposed()) {
- context.updateTimeRangeSelectionPieChart();
- context.getTimeRangePC().redraw();
- context.layout();
- }
+ Display.getDefault().asyncExec(() -> {
+ synchronized (context) {
+ if (!context.isDisposed()) {
+ context.updateTimeRangeSelectionPieChart();
+ context.getTimeRangePC().redraw();
+ context.layout();
}
}
});
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateNoContentSelected.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateNoContentSelected.java
index f2e298f077..4f38c76ac1 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateNoContentSelected.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/PieChartViewerStateNoContentSelected.java
@@ -37,24 +37,21 @@ public class PieChartViewerStateNoContentSelected implements IPieChartViewerStat
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- synchronized (context) {
- if (!context.isDisposed()) {
- // Have to get rid of the time-range PieChart
- if (context.getTimeRangePC() != null) {
- if (!context.getTimeRangePC().isDisposed()) {
- context.getTimeRangePC().dispose();
- }
- context.setTimeRangePC(null);
+ Display.getDefault().asyncExec(() -> {
+ synchronized (context) {
+ if (!context.isDisposed()) {
+ // Have to get rid of the time-range PieChart
+ if (context.getTimeRangePC() != null) {
+ if (!context.getTimeRangePC().isDisposed()) {
+ context.getTimeRangePC().dispose();
}
-
- context.updateGlobalPieChart();
- // update the global chart so it takes all the place
- context.getGlobalPC().getLegend().setPosition(SWT.RIGHT);
- context.layout();
+ context.setTimeRangePC(null);
}
+
+ context.updateGlobalPieChart();
+ // update the global chart so it takes all the place
+ context.getGlobalPC().getLegend().setPosition(SWT.RIGHT);
+ context.layout();
}
}
});
@@ -72,14 +69,11 @@ public class PieChartViewerStateNoContentSelected implements IPieChartViewerStat
@Override
public void newGlobalEntries(final TmfPieChartViewer context) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- synchronized (context) {
- if (!context.isDisposed()) {
- context.updateGlobalPieChart();
- context.getGlobalPC().redraw();
- }
+ Display.getDefault().asyncExec(() -> {
+ synchronized (context) {
+ if (!context.isDisposed()) {
+ context.updateGlobalPieChart();
+ context.getGlobalPC().redraw();
}
}
});
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/TmfPieChartViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/TmfPieChartViewer.java
index 6ecf758377..89ae5da556 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/TmfPieChartViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/TmfPieChartViewer.java
@@ -147,32 +147,29 @@ public class TmfPieChartViewer extends Composite {
fTimeRangePC = null;
// Setup listeners for the tooltips
- fMouseMoveListener = new Listener() {
- @Override
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- PieChart pc = (PieChart) event.widget;
- switch (event.type) {
- /* Get tooltip information on the slice */
- case SWT.MouseMove:
- int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y);
- if (sliceIndex < 0) {
- // mouse is outside the chart
- pc.setToolTipText(null);
- break;
- }
- float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex);
- String percent = String.format("%.1f", percOfSlice); //$NON-NLS-1$
- Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]);
-
- String text = Messages.TmfStatisticsView_PieChartToolTipTextName + " = " + //$NON-NLS-1$
- pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; //$NON-NLS-1$
-
- text += Messages.TmfStatisticsView_PieChartToolTipTextEventCount + " = "//$NON-NLS-1$
- + nbEvents.toString() + " (" + percent + "%)"; //$NON-NLS-1$ //$NON-NLS-2$
- pc.setToolTipText(text);
- return;
- default:
+ fMouseMoveListener = event -> {
+ PieChart pc = (PieChart) event.widget;
+ switch (event.type) {
+ /* Get tooltip information on the slice */
+ case SWT.MouseMove:
+ int sliceIndex = pc.getSliceIndexFromPosition(0, event.x, event.y);
+ if (sliceIndex < 0) {
+ // mouse is outside the chart
+ pc.setToolTipText(null);
+ break;
}
+ float percOfSlice = (float) pc.getSlicePercent(0, sliceIndex);
+ String percent = String.format("%.1f", percOfSlice); //$NON-NLS-1$
+ Long nbEvents = Long.valueOf((long) pc.getSeriesSet().getSeries()[sliceIndex].getXSeries()[0]);
+
+ String text = Messages.TmfStatisticsView_PieChartToolTipTextName + " = " + //$NON-NLS-1$
+ pc.getSeriesSet().getSeries()[sliceIndex].getId() + "\n"; //$NON-NLS-1$
+
+ text += Messages.TmfStatisticsView_PieChartToolTipTextEventCount + " = "//$NON-NLS-1$
+ + nbEvents.toString() + " (" + percent + "%)"; //$NON-NLS-1$ //$NON-NLS-2$
+ pc.setToolTipText(text);
+ return;
+ default:
}
};
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/TmfStatisticsViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
index 3b83ea2c54..63f18ed504 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/TmfStatisticsViewer.java
@@ -38,8 +38,6 @@ import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.tracecompass.internal.tmf.ui.commands.ExportToTsvUtils;
import org.eclipse.tracecompass.internal.tmf.ui.viewers.piecharts.TmfPieChartViewer;
@@ -158,9 +156,7 @@ public class TmfStatisticsViewer extends TmfViewer {
initContent(parent);
initInput();
- fSash.addDisposeListener((e) -> {
- internalDispose();
- });
+ fSash.addDisposeListener( e -> internalDispose());
}
@Override
@@ -319,12 +315,9 @@ public class TmfStatisticsViewer extends TmfViewer {
if (viewerControl.isDisposed()) {
return;
}
- TmfUiRefreshHandler.getInstance().queueUpdate(fTreeViewer, new Runnable() {
- @Override
- public void run() {
- if (!viewerControl.isDisposed()) {
- fTreeViewer.refresh();
- }
+ TmfUiRefreshHandler.getInstance().queueUpdate(fTreeViewer, () -> {
+ if (!viewerControl.isDisposed()) {
+ fTreeViewer.refresh();
}
});
}
@@ -360,12 +353,9 @@ public class TmfStatisticsViewer extends TmfViewer {
setPieChartsVisible(moreThanOne);
- TmfUiRefreshHandler.getInstance().queueUpdate(fPieChartViewer, new Runnable() {
- @Override
- public void run() {
- if (!viewerControl.isDisposed()) {
- fPieChartViewer.refresh(refreshGlobal, refreshSelection);
- }
+ TmfUiRefreshHandler.getInstance().queueUpdate(fPieChartViewer, () -> {
+ if (!viewerControl.isDisposed()) {
+ fPieChartViewer.refresh(refreshGlobal, refreshSelection);
}
});
}
@@ -422,24 +412,20 @@ public class TmfStatisticsViewer extends TmfViewer {
fTreeViewer = new TreeViewer(fSash, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
fPieChartViewer = new TmfPieChartViewer(fSash);
- fPieChartViewer.addEventTypeSelectionListener(new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- String eventTypeName = event.text;
- if (getStatisticData().getRootNode() == null ||
- fTreeViewer.getTree() == null) {
- return;
- }
- /* Get all the nodes corresponding to the event name */
- List<TmfStatisticsTreeNode> nodes = (List<TmfStatisticsTreeNode>) getStatisticData().getRootNode().findChildren(eventTypeName, true);
- if (nodes.isEmpty()) {
- /* Shouldn't happen, except for when selecting "Others" */
- return;
- }
- /* Only select the first in the collection */
- fTreeViewer.setSelection(new StructuredSelection(nodes.get(0)), true);
+ fPieChartViewer.addEventTypeSelectionListener(event -> {
+ String eventTypeName = event.text;
+ if (getStatisticData().getRootNode() == null ||
+ fTreeViewer.getTree() == null) {
+ return;
}
+ /* Get all the nodes corresponding to the event name */
+ List<TmfStatisticsTreeNode> nodes = (List<TmfStatisticsTreeNode>) getStatisticData().getRootNode().findChildren(eventTypeName, true);
+ if (nodes.isEmpty()) {
+ /* Shouldn't happen, except for when selecting "Others" */
+ return;
+ }
+ /* Only select the first in the collection */
+ fTreeViewer.setSelection(new StructuredSelection(nodes.get(0)), true);
});
/* Make sure the sash is split in 2 equal parts */
@@ -504,85 +490,81 @@ public class TmfStatisticsViewer extends TmfViewer {
}
// Handler that will draw the percentages and the bar charts.
- fTreeViewer.getTree().addListener(SWT.EraseItem, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (columnDataList.get(event.index).getPercentageProvider() != null) {
-
- TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) event.item.getData();
-
- // If node is hidden, exit immediately.
- if (TmfBaseColumnDataProvider.HIDDEN_FOLDER_LEVELS.contains(node.getName())) {
- return;
- }
+ fTreeViewer.getTree().addListener(SWT.EraseItem, event -> {
+ if (columnDataList.get(event.index).getPercentageProvider() != null) {
- // Otherwise, get percentage and draw bar and text if
- // applicable.
- double percentage = columnDataList.get(event.index).getPercentageProvider().getPercentage(node);
+ TmfStatisticsTreeNode node = (TmfStatisticsTreeNode) event.item.getData();
- // The item is selected.
- if ((event.detail & SWT.SELECTED) > 0) {
- // Draws our own background to avoid overwriting the
- // bar.
- event.gc.fillRectangle(event.x, event.y, event.width, event.height);
- event.detail &= ~SWT.SELECTED;
- }
-
- // Drawing the percentage text
- // if events are present in top node
- // and the current node is not the top node
- // and if is total or partial events column.
- // If not, exit the method.
- if (!((event.index == TmfBaseColumnDataProvider.StatsColumn.TOTAL.getIndex() || event.index == TmfBaseColumnDataProvider.StatsColumn.PARTIAL.getIndex())
- && node != node.getTop())) {
- return;
- }
+ // If node is hidden, exit immediately.
+ if (TmfBaseColumnDataProvider.HIDDEN_FOLDER_LEVELS.contains(node.getName())) {
+ return;
+ }
- long eventValue = event.index == TmfBaseColumnDataProvider.StatsColumn.TOTAL.getIndex() ?
- node.getTop().getValues().getTotal() : node.getTop().getValues().getPartial();
+ // Otherwise, get percentage and draw bar and text if
+ // applicable.
+ double percentage = columnDataList.get(event.index).getPercentageProvider().getPercentage(node);
- if (eventValue != 0) {
+ // The item is selected.
+ if ((event.detail & SWT.SELECTED) > 0) {
+ // Draws our own background to avoid overwriting the
+ // bar.
+ event.gc.fillRectangle(event.x, event.y, event.width, event.height);
+ event.detail &= ~SWT.SELECTED;
+ }
- int oldAlpha = event.gc.getAlpha();
- Color oldForeground = event.gc.getForeground();
- Color oldBackground = event.gc.getBackground();
+ // Drawing the percentage text
+ // if events are present in top node
+ // and the current node is not the top node
+ // and if is total or partial events column.
+ // If not, exit the method.
+ if (!((event.index == TmfBaseColumnDataProvider.StatsColumn.TOTAL.getIndex() || event.index == TmfBaseColumnDataProvider.StatsColumn.PARTIAL.getIndex())
+ && node != node.getTop())) {
+ return;
+ }
- // Bar to draw
- if (percentage != 0) {
- /*
- * Draws a transparent gradient rectangle from the
- * color of foreground and background.
- */
- int barWidth = (int) ((fTreeViewer.getTree().getColumn(event.index).getWidth() - 8) * percentage);
- event.gc.setAlpha(64);
- event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_BLUE));
- event.gc.setBackground(event.item.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- event.gc.fillGradientRectangle(event.x, event.y, barWidth, event.height, true);
- event.gc.drawRectangle(event.x, event.y, barWidth, event.height);
-
- // Restore old values
- event.gc.setBackground(oldBackground);
- event.gc.setAlpha(oldAlpha);
- event.detail &= ~SWT.BACKGROUND;
+ long eventValue = event.index == TmfBaseColumnDataProvider.StatsColumn.TOTAL.getIndex() ?
+ node.getTop().getValues().getTotal() : node.getTop().getValues().getPartial();
+
+ if (eventValue != 0) {
+
+ int oldAlpha = event.gc.getAlpha();
+ Color oldForeground = event.gc.getForeground();
+ Color oldBackground = event.gc.getBackground();
+
+ // Bar to draw
+ if (percentage != 0) {
+ /*
+ * Draws a transparent gradient rectangle from the
+ * color of foreground and background.
+ */
+ int barWidth = (int) ((fTreeViewer.getTree().getColumn(event.index).getWidth() - 8) * percentage);
+ event.gc.setAlpha(64);
+ event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_BLUE));
+ event.gc.setBackground(event.item.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ event.gc.fillGradientRectangle(event.x, event.y, barWidth, event.height, true);
+ event.gc.drawRectangle(event.x, event.y, barWidth, event.height);
+
+ // Restore old values
+ event.gc.setBackground(oldBackground);
+ event.gc.setAlpha(oldAlpha);
+ event.detail &= ~SWT.BACKGROUND;
- }
+ }
- String percentageText = TmfStatisticsFormatter.toPercentageText(percentage);
- String absoluteNumberText = TmfStatisticsFormatter.toColumnData(node, TmfBaseColumnDataProvider.StatsColumn.getColumn(event.index));
+ String percentageText = TmfStatisticsFormatter.toPercentageText(percentage);
+ String absoluteNumberText = TmfStatisticsFormatter.toColumnData(node, TmfBaseColumnDataProvider.StatsColumn.getColumn(event.index));
- if (event.width > event.gc.stringExtent(percentageText).x + event.gc.stringExtent(absoluteNumberText).x) {
- int textHeight = event.gc.stringExtent(percentageText).y;
- event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- event.gc.drawText(percentageText, event.x, event.y + (event.height - textHeight) / 2, true);
- }
+ if (event.width > event.gc.stringExtent(percentageText).x + event.gc.stringExtent(absoluteNumberText).x) {
+ int textHeight = event.gc.stringExtent(percentageText).y;
+ event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ event.gc.drawText(percentageText, event.x, event.y + (event.height - textHeight) / 2, true);
+ }
- // Restores old values
- event.gc.setForeground(oldForeground);
+ // Restores old values
+ event.gc.setForeground(oldForeground);
- }
}
}
-
});
// Initializes the comparator parameters
@@ -742,13 +724,10 @@ public class TmfStatisticsViewer extends TmfViewer {
if (fPieChartViewer.isDisposed()) {
return;
}
- TmfUiRefreshHandler.getInstance().queueUpdate(fPieChartViewer, new Runnable() {
- @Override
- public void run() {
- if (!fPieChartViewer.isDisposed()) {
- fPieChartViewer.setVisible(visible);
- fPieChartViewer.getParent().layout();
- }
+ TmfUiRefreshHandler.getInstance().queueUpdate(fPieChartViewer, () -> {
+ if (!fPieChartViewer.isDisposed()) {
+ fPieChartViewer.setVisible(visible);
+ fPieChartViewer.getParent().layout();
}
});
}
@@ -800,17 +779,14 @@ public class TmfStatisticsViewer extends TmfViewer {
if (needsUpdate) {
// Performs the updates on the UI thread
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if ((fTreeViewer != null)
- && (!fTreeViewer.getTree().isDisposed())) {
- Cursor cursor = null; // indicates default
- if (waitRequested) {
- cursor = fWaitCursor;
- }
- fTreeViewer.getControl().setCursor(cursor);
+ display.asyncExec(() -> {
+ if ((fTreeViewer != null)
+ && (!fTreeViewer.getTree().isDisposed())) {
+ Cursor cursor = null; // indicates default
+ if (waitRequested) {
+ cursor = fWaitCursor;
}
+ fTreeViewer.getControl().setCursor(cursor);
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
index 9d6353752e..05891347a4 100755
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/statistics/model/TmfBaseColumnDataProvider.java
@@ -21,7 +21,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
@@ -209,13 +208,10 @@ public class TmfBaseColumnDataProvider {
return (int) (n1.getValues().getTotal() - n2.getValues().getTotal());
}
},
- new ITmfColumnPercentageProvider() {
- @Override
- public double getPercentage(TmfStatisticsTreeNode node) {
- TmfStatisticsTreeNode top = node.getTop();
- return (top == null || top.getValues().getTotal() == 0) ?
- 0 : (double) (node.getValues().getTotal()) / top.getValues().getTotal();
- }
+ node -> {
+ TmfStatisticsTreeNode top = node.getTop();
+ return (top == null || top.getValues().getTotal() == 0) ?
+ 0 : (double) (node.getValues().getTotal()) / top.getValues().getTotal();
}));
/* Column showing the number of events within the selected time range */
@@ -244,13 +240,10 @@ public class TmfBaseColumnDataProvider {
return (int) (n1.getValues().getPartial() - n2.getValues().getPartial());
}
},
- new ITmfColumnPercentageProvider() {
- @Override
- public double getPercentage(TmfStatisticsTreeNode node) {
- TmfStatisticsTreeNode top = node.getTop();
- return (top == null || top.getValues().getPartial() == 0) ?
- 0 : (double) (node.getValues().getPartial()) / top.getValues().getPartial();
- }
+ node -> {
+ TmfStatisticsTreeNode top = node.getTop();
+ return (top == null || top.getValues().getPartial() == 0) ?
+ 0 : (double) (node.getValues().getPartial()) / top.getValues().getPartial();
}));
/* Dummy column used to "fix" the display on Linux (using GTK) */
@@ -262,12 +255,7 @@ public class TmfBaseColumnDataProvider {
}
},
new ViewerComparator(),
- new ITmfColumnPercentageProvider() {
- @Override
- public double getPercentage(TmfStatisticsTreeNode node) {
- return 0;
- }
- }));
+ node -> 0));
fColumnData = builder.build();
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/views/TmfAlignmentSynchronizer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/views/TmfAlignmentSynchronizer.java
index 6d8936d207..3839b92f94 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/views/TmfAlignmentSynchronizer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/views/TmfAlignmentSynchronizer.java
@@ -19,7 +19,6 @@ import java.util.Timer;
import java.util.TimerTask;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
@@ -99,18 +98,14 @@ public class TmfAlignmentSynchronizer {
}
private IPreferenceChangeListener createPreferenceListener() {
- IPreferenceChangeListener listener = new IPreferenceChangeListener() {
-
- @Override
- public void preferenceChange(PreferenceChangeEvent event) {
- if (event.getKey().equals(ITmfUIPreferences.PREF_ALIGN_VIEWS)) {
- Object oldValue = event.getOldValue();
- Object newValue = event.getNewValue();
- if (Boolean.toString(false).equals(oldValue) && Boolean.toString(true).equals(newValue)) {
- realignViews();
- } else if (Boolean.toString(true).equals(oldValue) && Boolean.toString(false).equals(newValue)) {
- restoreViews();
- }
+ IPreferenceChangeListener listener = event -> {
+ if (event.getKey().equals(ITmfUIPreferences.PREF_ALIGN_VIEWS)) {
+ Object oldValue = event.getOldValue();
+ Object newValue = event.getNewValue();
+ if (Boolean.toString(false).equals(oldValue) && Boolean.toString(true).equals(newValue)) {
+ realignViews();
+ } else if (Boolean.toString(true).equals(oldValue) && Boolean.toString(false).equals(newValue)) {
+ restoreViews();
}
}
};
@@ -138,12 +133,7 @@ public class TmfAlignmentSynchronizer {
fCopy = new ArrayList<>(fPendingOperations);
fPendingOperations.clear();
}
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- performAllAlignments(fCopy);
- }
- });
+ Display.getDefault().syncExec(() -> performAllAlignments(fCopy));
fComplete = true;
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/analysis/TmfAnalysisViewOutput.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/analysis/TmfAnalysisViewOutput.java
index cfde5d4b95..789f3747a9 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/analysis/TmfAnalysisViewOutput.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/analysis/TmfAnalysisViewOutput.java
@@ -123,22 +123,19 @@ public class TmfAnalysisViewOutput implements IAnalysisOutput, IExecutableExtens
@Override
public void requestOutput() {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- IViewPart view = openView();
- // Transfers the properties of this output to the view
- if (!(fProperties.isEmpty()) && (view instanceof WorkbenchPart)) {
- WorkbenchPart wbPart = (WorkbenchPart) view;
- for (String key : fProperties.keySet()) {
- wbPart.setPartProperty(key, fProperties.get(key));
- }
+ Display.getDefault().asyncExec(() -> {
+ try {
+ IViewPart view = openView();
+ // Transfers the properties of this output to the view
+ if (!(fProperties.isEmpty()) && (view instanceof WorkbenchPart)) {
+ WorkbenchPart wbPart = (WorkbenchPart) view;
+ for (String key : fProperties.keySet()) {
+ wbPart.setPartProperty(key, fProperties.get(key));
}
- } catch (final PartInitException e) {
- TraceUtils.displayErrorMsg(Messages.TmfAnalysisViewOutput_Title, "Error opening view " + getName() + e.getMessage()); //$NON-NLS-1$
- Activator.getDefault().logError("Error opening view " + getName(), e); //$NON-NLS-1$
}
+ } catch (final PartInitException e) {
+ TraceUtils.displayErrorMsg(Messages.TmfAnalysisViewOutput_Title, "Error opening view " + getName() + e.getMessage()); //$NON-NLS-1$
+ Activator.getDefault().logError("Error opening view " + getName(), e); //$NON-NLS-1$
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/editors/TmfEventsEditor.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/editors/TmfEventsEditor.java
index 0b5e3243d4..1a07a4cf7d 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/editors/TmfEventsEditor.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/editors/TmfEventsEditor.java
@@ -410,18 +410,15 @@ public class TmfEventsEditor extends TmfEditor implements ITmfTraceEditor, IReus
if (!deltaFound) {
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (removed.isEmpty() && added.isEmpty()) {
- fEventsTable.getTable().refresh();
- } else {
- if (!removed.isEmpty()) {
- fEventsTable.removeBookmark(Iterables.toArray(removed, IMarker.class));
- }
- if (!added.isEmpty()) {
- fEventsTable.addBookmark(Iterables.toArray(added, IMarker.class));
- }
+ Display.getDefault().asyncExec(() -> {
+ if (removed.isEmpty() && added.isEmpty()) {
+ fEventsTable.getTable().refresh();
+ } else {
+ if (!removed.isEmpty()) {
+ fEventsTable.removeBookmark(Iterables.toArray(removed, IMarker.class));
+ }
+ if (!added.isEmpty()) {
+ fEventsTable.addBookmark(Iterables.toArray(added, IMarker.class));
}
}
});
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TraceUtils.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TraceUtils.java
index 1736b73f7c..47d780dd3f 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TraceUtils.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TraceUtils.java
@@ -63,13 +63,10 @@ public class TraceUtils {
* @since 2.2
*/
public static void displayErrorMsg(final String boxTitle, final String errorMsg, Throwable exception) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- Activator.getDefault().logError(errorMsg, exception);
- MessageDialog.openError(shell, boxTitle, errorMsg);
- }
+ Display.getDefault().asyncExec(() -> {
+ final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ Activator.getDefault().logError(errorMsg, exception);
+ MessageDialog.openError(shell, boxTitle, errorMsg);
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyExperimentDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyExperimentDialog.java
index bbcd07012f..456317cde1 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyExperimentDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyExperimentDialog.java
@@ -36,9 +36,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -135,12 +133,7 @@ public class CopyExperimentDialog extends SelectionStatusDialog {
fNewExperimentName.setFocus();
fNewExperimentName.setText(name);
fNewExperimentName.setSelection(0, name.length());
- fNewExperimentName.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- validateNewExperimentName();
- }
- });
+ fNewExperimentName.addListener(SWT.Modify, event -> validateNewExperimentName());
}
private void validateNewExperimentName() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyTraceDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyTraceDialog.java
index 031eba54de..bdd82d1616 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyTraceDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/CopyTraceDialog.java
@@ -34,9 +34,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -138,12 +136,7 @@ public class CopyTraceDialog extends SelectionStatusDialog {
fNewTraceName.setFocus();
fNewTraceName.setText(name);
fNewTraceName.setSelection(0, name.length());
- fNewTraceName.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- validateNewTraceName();
- }
- });
+ fNewTraceName.addListener(SWT.Modify, event -> validateNewTraceName());
}
private void validateNewTraceName() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/NewExperimentDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/NewExperimentDialog.java
index 150a4caf7b..2590a7495d 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/NewExperimentDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/NewExperimentDialog.java
@@ -34,9 +34,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -115,12 +113,7 @@ public class NewExperimentDialog extends SelectionStatusDialog {
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
fExperimentName.setLayoutData(data);
fExperimentName.setFont(font);
- fExperimentName.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- validateNewExperimentName();
- }
- });
+ fExperimentName.addListener(SWT.Modify, event -> validateNewExperimentName());
}
private void validateNewExperimentName() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameExperimentDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameExperimentDialog.java
index 7062cbfe29..1bbe372149 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameExperimentDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameExperimentDialog.java
@@ -35,9 +35,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -125,12 +123,7 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
fNewExperimentName.setText(name);
fNewExperimentName.setSelection(0, name.length());
- fNewExperimentName.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- validateNewExperimentName();
- }
- });
+ fNewExperimentName.addListener(SWT.Modify, event -> validateNewExperimentName());
}
private void validateNewExperimentName() {
@@ -196,12 +189,7 @@ public class RenameExperimentDialog extends SelectionStatusDialog {
throw new OperationCanceledException();
}
// Close the experiment if open
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- fExperiment.closeEditors();
- }
- });
+ Display.getDefault().syncExec(() -> fExperiment.closeEditors());
IFolder folder = fExperiment.getResource();
IFile bookmarksFile = fExperiment.getBookmarksFile();
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameFolderDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameFolderDialog.java
index f13d44b29a..e61860257e 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameFolderDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameFolderDialog.java
@@ -24,9 +24,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -99,12 +97,7 @@ public class RenameFolderDialog extends SelectionStatusDialog {
fNewFolderNameText.setFocus();
fNewFolderNameText.setText(name);
fNewFolderNameText.setSelection(0, name.length());
- fNewFolderNameText.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- validateNewFolderName();
- }
- });
+ fNewFolderNameText.addListener(SWT.Modify, event -> validateNewFolderName());
}
private void validateNewFolderName() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameTraceDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameTraceDialog.java
index 8c41d08686..cd6cb171af 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameTraceDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/RenameTraceDialog.java
@@ -25,9 +25,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -102,12 +100,7 @@ public class RenameTraceDialog extends SelectionStatusDialog {
fNewTraceNameText.setFocus();
fNewTraceNameText.setText(name);
fNewTraceNameText.setSelection(0, name.length());
- fNewTraceNameText.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- validateNewTraceName();
- }
- });
+ fNewTraceNameText.addListener(SWT.Modify, event -> validateNewTraceName());
}
private void validateNewTraceName() {
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectRootNodeWizardPage.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectRootNodeWizardPage.java
index fc384d0476..c23c282f1c 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectRootNodeWizardPage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectRootNodeWizardPage.java
@@ -16,10 +16,8 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.ViewerComparator;
@@ -140,17 +138,14 @@ public class SelectRootNodeWizardPage extends WizardPage {
fCheckboxTreeViewer.setInput(fExperiment);
column.getColumn().pack();
- fCheckboxTreeViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object element = event.getElement();
- // Uncheck all elements
- for (Object checkedElement : fCheckboxTreeViewer.getCheckedElements()) {
- fCheckboxTreeViewer.setChecked(checkedElement, false);
- }
- fCheckboxTreeViewer.setChecked(element, event.getChecked());
- setPageComplete(event.getChecked());
+ fCheckboxTreeViewer.addCheckStateListener(event -> {
+ Object element = event.getElement();
+ // Uncheck all elements
+ for (Object checkedElement : fCheckboxTreeViewer.getCheckedElements()) {
+ fCheckboxTreeViewer.setChecked(checkedElement, false);
}
+ fCheckboxTreeViewer.setChecked(element, event.getChecked());
+ setPageComplete(event.getChecked());
});
setPageComplete(true);
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectTracesWizardPage.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectTracesWizardPage.java
index 93ea0aaa54..97c7b722e9 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectTracesWizardPage.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/SelectTracesWizardPage.java
@@ -35,10 +35,8 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.ViewerComparator;
@@ -301,13 +299,10 @@ public class SelectTracesWizardPage extends WizardPage {
// Set the checkbox for the traces already included
setCheckedAlreadyIncludedTraces(keys, fContentProvider.getElements(fCheckboxTreeViewer.getInput()));
- fCheckboxTreeViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object element = event.getElement();
- setSubtreeChecked(element, event.getChecked());
- maintainCheckIntegrity(element);
- }
+ fCheckboxTreeViewer.addCheckStateListener(event -> {
+ Object element = event.getElement();
+ setSubtreeChecked(element, event.getChecked());
+ maintainCheckIntegrity(element);
});
return fCheckboxTreeViewer;
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/TrimTraceDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/TrimTraceDialog.java
index a9400b9ab2..5a0e7e2d38 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/TrimTraceDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/wizards/TrimTraceDialog.java
@@ -24,9 +24,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -113,12 +111,7 @@ public class TrimTraceDialog extends SelectionStatusDialog {
newElementName.setFocus();
newElementName.setText(name);
newElementName.setSelection(0, name.length());
- newElementName.addListener(SWT.Modify, new Listener() {
- @Override
- public void handleEvent(Event event) {
- validateNewTraceName();
- }
- });
+ newElementName.addListener(SWT.Modify, event -> validateNewTraceName());
fNewElementName = newElementName;
validateNewTraceName();
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/tracetype/preferences/TraceTypePreferencePageViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/tracetype/preferences/TraceTypePreferencePageViewer.java
index 7cec7f09c9..268b658be0 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/tracetype/preferences/TraceTypePreferencePageViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/tracetype/preferences/TraceTypePreferencePageViewer.java
@@ -108,17 +108,14 @@ public class TraceTypePreferencePageViewer {
public Composite create(Composite parent) {
Composite composite = createFilterArea(parent);
fIsEmpty = fEntries.iterator().hasNext();
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- Iterable<@NonNull TraceTypeHelper> toCheck = Iterables.filter(fEntries, helper -> helper.isEnabled());
- toCheck.forEach(handler -> checkElement(handler));
- fTree.getViewer().expandAll();
- for (TreeColumn column : fTree.getViewer().getTree().getColumns()) {
- column.pack();
- }
- fTree.getViewer().collapseAll();
+ BusyIndicator.showWhile(null, () -> {
+ Iterable<@NonNull TraceTypeHelper> toCheck = Iterables.filter(fEntries, helper -> helper.isEnabled());
+ toCheck.forEach(handler -> checkElement(handler));
+ fTree.getViewer().expandAll();
+ for (TreeColumn column : fTree.getViewer().getTree().getColumns()) {
+ column.pack();
}
+ fTree.getViewer().collapseAll();
});
return composite;
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java
index 27b7179dfa..f11faf3ee1 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/events/TmfEventsTable.java
@@ -63,8 +63,6 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
@@ -1418,164 +1416,155 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
fHeaderPopupMenuManager = new MenuManager();
fHeaderPopupMenuManager.setRemoveAllWhenShown(true);
- fHeaderPopupMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- final Point point = fTable.toControl(fLastMenuCursorLocation);
- TableColumn selectedColumn = fTable.getColumn(point);
- if (selectedColumn != null && selectedColumn.getResizable()) {
- fHeaderPopupMenuManager.add(createAutoFitAction(selectedColumn));
- fHeaderPopupMenuManager.add(new Separator());
- }
- for (int index : fTable.getColumnOrder()) {
- TableColumn column = fTable.getColumns()[index];
- if (column.getData(Key.WIDTH) != null) {
- fHeaderPopupMenuManager.add(createShowColumnAction(column));
- }
- }
+ fHeaderPopupMenuManager.addMenuListener(manager -> {
+ final Point point = fTable.toControl(fLastMenuCursorLocation);
+ TableColumn selectedColumn = fTable.getColumn(point);
+ if (selectedColumn != null && selectedColumn.getResizable()) {
+ fHeaderPopupMenuManager.add(createAutoFitAction(selectedColumn));
fHeaderPopupMenuManager.add(new Separator());
- fHeaderPopupMenuManager.add(createShowAllAction());
- fHeaderPopupMenuManager.add(createResetAllAction());
}
+ for (int index : fTable.getColumnOrder()) {
+ TableColumn column = fTable.getColumns()[index];
+ if (column.getData(Key.WIDTH) != null) {
+ fHeaderPopupMenuManager.add(createShowColumnAction(column));
+ }
+ }
+ fHeaderPopupMenuManager.add(new Separator());
+ fHeaderPopupMenuManager.add(createShowAllAction());
+ fHeaderPopupMenuManager.add(createResetAllAction());
});
fTablePopupMenuManager = new MenuManager();
fTablePopupMenuManager.setRemoveAllWhenShown(true);
- fTablePopupMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(final IMenuManager manager) {
- if (fTable.getSelectionIndices().length == 1 && fTable.getSelectionIndices()[0] == 0) {
- // Right-click on header row
- if (fHeaderState == HeaderState.SEARCH) {
- fTablePopupMenuManager.add(addAsFilterAction);
- }
- return;
+ fTablePopupMenuManager.addMenuListener(manager -> {
+ if (fTable.getSelectionIndices().length == 1 && fTable.getSelectionIndices()[0] == 0) {
+ // Right-click on header row
+ if (fHeaderState == HeaderState.SEARCH) {
+ fTablePopupMenuManager.add(addAsFilterAction);
}
- final Point point = fTable.toControl(fLastMenuCursorLocation);
- final TableItem item = fTable.getSelection().length > 0 ? fTable.getSelection()[0] : null;
- if (item != null) {
- final Rectangle imageBounds = item.getImageBounds(0);
- imageBounds.width = BOOKMARK_IMAGE.getBounds().width;
- if (point.x <= (imageBounds.x + imageBounds.width)) {
- // Right-click on left margin
- final Long rank = (Long) item.getData(Key.RANK);
- if ((rank != null) && (fBookmarksFile != null)) {
- if (fBookmarksMap.containsKey(rank)) {
- fTablePopupMenuManager.add(new ToggleBookmarkAction(
- Messages.TmfEventsTable_RemoveBookmarkActionText, rank));
- } else {
- fTablePopupMenuManager.add(new ToggleBookmarkAction(
- Messages.TmfEventsTable_AddBookmarkActionText, rank));
- }
+ return;
+ }
+ final Point point = fTable.toControl(fLastMenuCursorLocation);
+ final TableItem item = fTable.getSelection().length > 0 ? fTable.getSelection()[0] : null;
+ if (item != null) {
+ final Rectangle imageBounds = item.getImageBounds(0);
+ imageBounds.width = BOOKMARK_IMAGE.getBounds().width;
+ if (point.x <= (imageBounds.x + imageBounds.width)) {
+ // Right-click on left margin
+ final Long rank = (Long) item.getData(Key.RANK);
+ if ((rank != null) && (fBookmarksFile != null)) {
+ if (fBookmarksMap.containsKey(rank)) {
+ fTablePopupMenuManager.add(new ToggleBookmarkAction(
+ Messages.TmfEventsTable_RemoveBookmarkActionText, rank));
+ } else {
+ fTablePopupMenuManager.add(new ToggleBookmarkAction(
+ Messages.TmfEventsTable_AddBookmarkActionText, rank));
}
- return;
}
+ return;
}
+ }
- // Right-click on table
- if (fSelectedRank != -1 && fSelectedBeginRank != -1) {
- fTablePopupMenuManager.add(copyAction);
- fTablePopupMenuManager.add(new Separator());
- }
- if (fTable.isVisible() && fRawViewer.isVisible()) {
- fTablePopupMenuManager.add(hideTableAction);
- fTablePopupMenuManager.add(hideRawAction);
- } else if (!fTable.isVisible()) {
- fTablePopupMenuManager.add(showTableAction);
- } else if (!fRawViewer.isVisible()) {
- fTablePopupMenuManager.add(showRawAction);
- }
- fTablePopupMenuManager.add(exportToTextAction);
+ // Right-click on table
+ if (fSelectedRank != -1 && fSelectedBeginRank != -1) {
+ fTablePopupMenuManager.add(copyAction);
fTablePopupMenuManager.add(new Separator());
+ }
+ if (fTable.isVisible() && fRawViewer.isVisible()) {
+ fTablePopupMenuManager.add(hideTableAction);
+ fTablePopupMenuManager.add(hideRawAction);
+ } else if (!fTable.isVisible()) {
+ fTablePopupMenuManager.add(showTableAction);
+ } else if (!fRawViewer.isVisible()) {
+ fTablePopupMenuManager.add(showRawAction);
+ }
+ fTablePopupMenuManager.add(exportToTextAction);
+ fTablePopupMenuManager.add(new Separator());
- if (item != null) {
- final Object data = item.getData();
- Separator separator = null;
- if (data instanceof ITmfSourceLookup) {
- ITmfSourceLookup event = (ITmfSourceLookup) data;
- if (event.getCallsite() != null) {
- fTablePopupMenuManager.add(openCallsiteAction);
- separator = new Separator();
- }
- }
-
- if (data instanceof ITmfModelLookup) {
- ITmfModelLookup event = (ITmfModelLookup) data;
- if (event.getModelUri() != null) {
- fTablePopupMenuManager.add(openModelAction);
- separator = new Separator();
- }
-
- if (separator != null) {
- fTablePopupMenuManager.add(separator);
- }
+ if (item != null) {
+ final Object data = item.getData();
+ Separator separator = null;
+ if (data instanceof ITmfSourceLookup) {
+ ITmfSourceLookup event1 = (ITmfSourceLookup) data;
+ if (event1.getCallsite() != null) {
+ fTablePopupMenuManager.add(openCallsiteAction);
+ separator = new Separator();
}
}
- /*
- * Only show collapse filter if at least one trace can be
- * collapsed.
- */
- boolean isCollapsible = false;
- if (fTrace != null) {
- for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) {
- Class<? extends ITmfEvent> eventClass = trace.getEventType();
- isCollapsible = ITmfCollapsibleEvent.class.isAssignableFrom(eventClass);
- if (isCollapsible) {
- break;
- }
+ if (data instanceof ITmfModelLookup) {
+ ITmfModelLookup event2 = (ITmfModelLookup) data;
+ if (event2.getModelUri() != null) {
+ fTablePopupMenuManager.add(openModelAction);
+ separator = new Separator();
}
- }
- if (isCollapsible && !fCollapseFilterEnabled) {
- fTablePopupMenuManager.add(collapseAction);
- fTablePopupMenuManager.add(new Separator());
+ if (separator != null) {
+ fTablePopupMenuManager.add(separator);
+ }
}
+ }
- fTablePopupMenuManager.add(clearFiltersAction);
- final ITmfFilterTreeNode[] savedFilters = FilterManager.getSavedFilters();
- if (savedFilters.length > 0) {
- final MenuManager subMenu = new MenuManager(Messages.TmfEventsTable_ApplyPresetFilterMenuName);
- for (final ITmfFilterTreeNode node : savedFilters) {
- if (node instanceof TmfFilterNode) {
- final TmfFilterNode filter = (TmfFilterNode) node;
- subMenu.add(new Action(filter.getFilterName()) {
- @Override
- public void run() {
- applyFilter(filter);
- }
- });
- }
+ /*
+ * Only show collapse filter if at least one trace can be
+ * collapsed.
+ */
+ boolean isCollapsible = false;
+ if (fTrace != null) {
+ for (ITmfTrace trace1 : TmfTraceManager.getTraceSet(fTrace)) {
+ Class<? extends ITmfEvent> eventClass = trace1.getEventType();
+ isCollapsible = ITmfCollapsibleEvent.class.isAssignableFrom(eventClass);
+ if (isCollapsible) {
+ break;
}
- fTablePopupMenuManager.add(subMenu);
}
+ }
+
+ if (isCollapsible && !fCollapseFilterEnabled) {
+ fTablePopupMenuManager.add(collapseAction);
fTablePopupMenuManager.add(new Separator());
+ }
- ITmfTrace trace = fTrace;
- if (trace != null) {
- synchronizeAction.setChecked(TmfTraceManager.getInstance().getTraceContext(trace).isSynchronized());
- fTablePopupMenuManager.add(synchronizeAction);
+ fTablePopupMenuManager.add(clearFiltersAction);
+ final ITmfFilterTreeNode[] savedFilters = FilterManager.getSavedFilters();
+ if (savedFilters.length > 0) {
+ final MenuManager subMenu = new MenuManager(Messages.TmfEventsTable_ApplyPresetFilterMenuName);
+ for (final ITmfFilterTreeNode node : savedFilters) {
+ if (node instanceof TmfFilterNode) {
+ final TmfFilterNode filter = (TmfFilterNode) node;
+ subMenu.add(new Action(filter.getFilterName()) {
+ @Override
+ public void run() {
+ applyFilter(filter);
+ }
+ });
+ }
}
+ fTablePopupMenuManager.add(subMenu);
+ }
+ fTablePopupMenuManager.add(new Separator());
- appendToTablePopupMenu(fTablePopupMenuManager, item);
+ ITmfTrace trace2 = fTrace;
+ if (trace2 != null) {
+ synchronizeAction.setChecked(TmfTraceManager.getInstance().getTraceContext(trace2).isSynchronized());
+ fTablePopupMenuManager.add(synchronizeAction);
}
+
+ appendToTablePopupMenu(fTablePopupMenuManager, item);
});
fRawViewerPopupMenuManager = new MenuManager();
fRawViewerPopupMenuManager.setRemoveAllWhenShown(true);
- fRawViewerPopupMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(final IMenuManager manager) {
- if (fTable.isVisible() && fRawViewer.isVisible()) {
- fRawViewerPopupMenuManager.add(hideTableAction);
- fRawViewerPopupMenuManager.add(hideRawAction);
- } else if (!fTable.isVisible()) {
- fRawViewerPopupMenuManager.add(showTableAction);
- } else if (!fRawViewer.isVisible()) {
- fRawViewerPopupMenuManager.add(showRawAction);
- }
- appendToRawPopupMenu(fRawViewerPopupMenuManager);
- }
+ fRawViewerPopupMenuManager.addMenuListener(manager -> {
+ if (fTable.isVisible() && fRawViewer.isVisible()) {
+ fRawViewerPopupMenuManager.add(hideTableAction);
+ fRawViewerPopupMenuManager.add(hideRawAction);
+ } else if (!fTable.isVisible()) {
+ fRawViewerPopupMenuManager.add(showTableAction);
+ } else if (!fRawViewer.isVisible()) {
+ fRawViewerPopupMenuManager.add(showRawAction);
+ }
+ appendToRawPopupMenu(fRawViewerPopupMenuManager);
});
fHeaderMenu = fHeaderPopupMenuManager.createContextMenu(fTable);
@@ -2378,27 +2367,24 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
}
refreshBusy = true;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (request.isCancelled()) {
- return;
- }
- if (fTable.isDisposed()) {
- return;
- }
- /*
- * +1 for header row, +2 for top and bottom filter status
- * rows
- */
- fTable.setItemCount((int) fFilterMatchCount + 3);
- fTable.refresh();
- synchronized (syncObj) {
- refreshBusy = false;
- if (refreshPending) {
- refreshPending = false;
- refreshTable();
- }
+ Display.getDefault().asyncExec(() -> {
+ if (request.isCancelled()) {
+ return;
+ }
+ if (fTable.isDisposed()) {
+ return;
+ }
+ /*
+ * +1 for header row, +2 for top and bottom filter status
+ * rows
+ */
+ fTable.setItemCount((int) fFilterMatchCount + 3);
+ fTable.refresh();
+ synchronized (syncObj) {
+ refreshBusy = false;
+ if (refreshPending) {
+ refreshPending = false;
+ refreshTable();
}
}
});
@@ -2652,29 +2638,25 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
/* +1 for header row, +1 for top filter status row */
final int selection = index + 1 + (eventFilter != null ? +1 : 0);
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (monitor.isCanceled()) {
- return;
- }
- if (fTable.isDisposed()) {
- return;
- }
- fTable.setSelection(selection);
- fSelectedRank = foundRank;
- fSelectedBeginRank = fSelectedRank;
- fRawViewer.selectAndReveal(fSelectedRank);
- if (foundTimestamp != null) {
- broadcast(new TmfSelectionRangeUpdatedSignal(TmfEventsTable.this, foundTimestamp, foundTimestamp, fTrace));
- }
- fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable.this, getSelection()));
- synchronized (fSearchSyncObj) {
- fSearchThread = null;
- }
- updateStatusLine(null);
+ display.asyncExec(() -> {
+ if (monitor.isCanceled()) {
+ return;
}
+ if (fTable.isDisposed()) {
+ return;
+ }
+ fTable.setSelection(selection);
+ fSelectedRank = foundRank;
+ fSelectedBeginRank = fSelectedRank;
+ fRawViewer.selectAndReveal(fSelectedRank);
+ if (foundTimestamp != null) {
+ broadcast(new TmfSelectionRangeUpdatedSignal(TmfEventsTable.this, foundTimestamp, foundTimestamp, fTrace));
+ }
+ fireSelectionChanged(new SelectionChangedEvent(TmfEventsTable.this, getSelection()));
+ synchronized (fSearchSyncObj) {
+ fSearchThread = null;
+ }
+ updateStatusLine(null);
});
return Status.OK_STATUS;
@@ -3041,33 +3023,30 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
fDisposeOnClose = disposeOnClose;
// Perform the updates on the UI thread
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- fSelectedRank = -1;
- fSelectedBeginRank = -1;
- fTable.removeAll();
- fCache.setTrace(trace); // Clear the cache
- if (trace != null) {
- if (!fTable.isDisposed()) {
- if (fTable.getData(Key.FILTER_OBJ) == null) {
- // +1 for header row
- fTable.setItemCount((int) trace.getNbEvents() + 1);
- } else {
- stopFilterThread();
- fFilterMatchCount = 0;
- fFilterCheckCount = 0;
- /*
- * +1 for header row, +2 for top and bottom filter
- * status rows
- */
- fTable.setItemCount(3);
- startFilterThread();
- }
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ fSelectedRank = -1;
+ fSelectedBeginRank = -1;
+ fTable.removeAll();
+ fCache.setTrace(trace); // Clear the cache
+ if (trace != null) {
+ if (!fTable.isDisposed()) {
+ if (fTable.getData(Key.FILTER_OBJ) == null) {
+ // +1 for header row
+ fTable.setItemCount((int) trace.getNbEvents() + 1);
+ } else {
+ stopFilterThread();
+ fFilterMatchCount = 0;
+ fFilterCheckCount = 0;
+ /*
+ * +1 for header row, +2 for top and bottom filter
+ * status rows
+ */
+ fTable.setItemCount(3);
+ startFilterThread();
}
}
- fRawViewer.setTrace(trace);
}
+ fRawViewer.setTrace(trace);
});
}
@@ -3116,21 +3095,18 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
fCacheUpdateBusy = true;
}
// Event cache is now updated. Perform update on the UI thread
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!fTable.isDisposed()) {
- fTable.refresh();
- }
- if (completed) {
- populateCompleted();
- }
- synchronized (fCacheUpdateSyncObj) {
- fCacheUpdateBusy = false;
- if (fCacheUpdatePending) {
- fCacheUpdatePending = false;
- cacheUpdated(fCacheUpdateCompleted);
- }
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ if (!fTable.isDisposed()) {
+ fTable.refresh();
+ }
+ if (completed) {
+ populateCompleted();
+ }
+ synchronized (fCacheUpdateSyncObj) {
+ fCacheUpdateBusy = false;
+ if (fCacheUpdatePending) {
+ fCacheUpdatePending = false;
+ cacheUpdated(fCacheUpdateCompleted);
}
}
});
@@ -3426,28 +3402,25 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
return;
}
// Perform the refresh on the UI thread
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!fTable.isDisposed() && (fTrace != null)) {
- if (fTable.getData(Key.FILTER_OBJ) == null) {
- /* +1 for header row */
- fTable.setItemCount((int) fTrace.getNbEvents() + 1);
+ Display.getDefault().asyncExec(() -> {
+ if (!fTable.isDisposed() && (fTrace != null)) {
+ if (fTable.getData(Key.FILTER_OBJ) == null) {
+ /* +1 for header row */
+ fTable.setItemCount((int) fTrace.getNbEvents() + 1);
+ /* +1 for header row */
+ if ((fPendingGotoRank != -1) && ((fPendingGotoRank + 1) < fTable.getItemCount())) {
/* +1 for header row */
- if ((fPendingGotoRank != -1) && ((fPendingGotoRank + 1) < fTable.getItemCount())) {
- /* +1 for header row */
- fTable.setSelection((int) fPendingGotoRank + 1);
- fPendingGotoRank = -1;
- updateStatusLine(null);
- }
- } else {
- startFilterThread();
+ fTable.setSelection((int) fPendingGotoRank + 1);
+ fPendingGotoRank = -1;
+ updateStatusLine(null);
}
- }
- if (!fRawViewer.isDisposed() && (fTrace != null)) {
- fRawViewer.refreshEventCount();
+ } else {
+ startFilterThread();
}
}
+ if (!fRawViewer.isDisposed() && (fTrace != null)) {
+ fRawViewer.refreshEventCount();
+ }
});
}
@@ -3589,33 +3562,30 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
}
private void updateDisplayWithSelection(final long rankBegin, final long rankEnd) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- // Return if table is disposed
- if (fTable.isDisposed()) {
- return;
- }
- if (fSelectedBeginRank == rankBegin && fSelectedRank == rankEnd) {
- return;
- }
+ PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
+ // Return if table is disposed
+ if (fTable.isDisposed()) {
+ return;
+ }
+ if (fSelectedBeginRank == rankBegin && fSelectedRank == rankEnd) {
+ return;
+ }
- fSelectedRank = rankEnd;
- long toReveal = fSelectedBeginRank != rankBegin ? rankBegin : rankEnd;
- fSelectedBeginRank = rankBegin;
- int indexBegin = (int) rankBegin;
- int indexEnd = (int) rankEnd;
+ fSelectedRank = rankEnd;
+ long toReveal = fSelectedBeginRank != rankBegin ? rankBegin : rankEnd;
+ fSelectedBeginRank = rankBegin;
+ int indexBegin = (int) rankBegin;
+ int indexEnd = (int) rankEnd;
- if (fTable.getData(Key.FILTER_OBJ) != null) {
- /* +1 for top filter status row */
- indexBegin = fCache.getFilteredEventIndex(rankBegin) + 1;
- indexEnd = rankEnd == rankBegin ? indexBegin : fCache.getFilteredEventIndex(rankEnd) + 1;
- }
- /* +1 for header row */
- fTable.setSelectionRange(indexBegin + 1, indexEnd + 1);
- fRawViewer.selectAndReveal(toReveal);
- updateStatusLine(null);
+ if (fTable.getData(Key.FILTER_OBJ) != null) {
+ /* +1 for top filter status row */
+ indexBegin = fCache.getFilteredEventIndex(rankBegin) + 1;
+ indexEnd = rankEnd == rankBegin ? indexBegin : fCache.getFilteredEventIndex(rankEnd) + 1;
}
+ /* +1 for header row */
+ fTable.setSelectionRange(indexBegin + 1, indexEnd + 1);
+ fRawViewer.selectAndReveal(toReveal);
+ updateStatusLine(null);
});
}
};
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/table/TmfSimpleTableViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/table/TmfSimpleTableViewer.java
index f204774deb..b75c0589a7 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/table/TmfSimpleTableViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/table/TmfSimpleTableViewer.java
@@ -21,7 +21,6 @@ import java.util.Comparator;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ColumnLabelProvider;
@@ -176,16 +175,13 @@ public class TmfSimpleTableViewer extends TmfViewer {
fTablePopupMenuManager = new MenuManager();
fTablePopupMenuManager.setRemoveAllWhenShown(true);
- fTablePopupMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(final @Nullable IMenuManager manager) {
- TableViewer viewer = getTableViewer();
- ISelection selection = viewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection) selection;
- if (manager != null) {
- appendToTablePopupMenu(manager, sel);
- }
+ fTablePopupMenuManager.addMenuListener((final @Nullable IMenuManager manager) -> {
+ TableViewer viewer = getTableViewer();
+ ISelection selection = viewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection sel = (IStructuredSelection) selection;
+ if (manager != null) {
+ appendToTablePopupMenu(manager, sel);
}
}
});
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java
index deca807f18..67d4dc408d 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java
@@ -39,8 +39,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
@@ -227,44 +225,41 @@ public abstract class AbstractTmfTreeViewer extends TmfTimeViewer {
* Handler that will draw bar charts in the cell using a percentage
* value.
*/
- fTreeViewer.getTree().addListener(SWT.EraseItem, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (columns.get(event.index).getPercentageProvider() != null) {
+ fTreeViewer.getTree().addListener(SWT.EraseItem, event -> {
+ if (columns.get(event.index).getPercentageProvider() != null) {
- double percentage = columns.get(event.index).getPercentageProvider().getPercentage(event.item.getData());
- if (percentage == 0) { // No bar to draw
- return;
- }
-
- if ((event.detail & SWT.SELECTED) > 0) {
- /*
- * The item is selected. Draw our own background to
- * avoid overwriting the bar.
- */
- event.gc.fillRectangle(event.x, event.y, event.width, event.height);
- event.detail &= ~SWT.SELECTED;
- }
+ double percentage = columns.get(event.index).getPercentageProvider().getPercentage(event.item.getData());
+ if (percentage == 0) { // No bar to draw
+ return;
+ }
- int barWidth = (int) ((fTreeViewer.getTree().getColumn(event.index).getWidth() - 8) * percentage);
- int oldAlpha = event.gc.getAlpha();
- Color oldForeground = event.gc.getForeground();
- Color oldBackground = event.gc.getBackground();
+ if ((event.detail & SWT.SELECTED) > 0) {
/*
- * Draws a transparent gradient rectangle from the color
- * of foreground and background.
+ * The item is selected. Draw our own background to
+ * avoid overwriting the bar.
*/
- event.gc.setAlpha(64);
- event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_BLUE));
- event.gc.setBackground(event.item.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- event.gc.fillGradientRectangle(event.x, event.y, barWidth, event.height, true);
- event.gc.drawRectangle(event.x, event.y, barWidth, event.height);
- /* Restores old values */
- event.gc.setForeground(oldForeground);
- event.gc.setBackground(oldBackground);
- event.gc.setAlpha(oldAlpha);
- event.detail &= ~SWT.BACKGROUND;
+ event.gc.fillRectangle(event.x, event.y, event.width, event.height);
+ event.detail &= ~SWT.SELECTED;
}
+
+ int barWidth = (int) ((fTreeViewer.getTree().getColumn(event.index).getWidth() - 8) * percentage);
+ int oldAlpha = event.gc.getAlpha();
+ Color oldForeground = event.gc.getForeground();
+ Color oldBackground = event.gc.getBackground();
+ /*
+ * Draws a transparent gradient rectangle from the color
+ * of foreground and background.
+ */
+ event.gc.setAlpha(64);
+ event.gc.setForeground(event.item.getDisplay().getSystemColor(SWT.COLOR_BLUE));
+ event.gc.setBackground(event.item.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ event.gc.fillGradientRectangle(event.x, event.y, barWidth, event.height, true);
+ event.gc.drawRectangle(event.x, event.y, barWidth, event.height);
+ /* Restores old values */
+ event.gc.setForeground(oldForeground);
+ event.gc.setBackground(oldBackground);
+ event.gc.setAlpha(oldAlpha);
+ event.detail &= ~SWT.BACKGROUND;
}
});
}
@@ -317,15 +312,12 @@ public abstract class AbstractTmfTreeViewer extends TmfTimeViewer {
@Override
public void run() {
initializeDataSource(trace);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!trace.equals(getTrace())) {
- return;
- }
- clearContent();
- updateContent(getWindowStartTime(), getWindowEndTime(), false);
+ Display.getDefault().asyncExec(() -> {
+ if (!trace.equals(getTrace())) {
+ return;
}
+ clearContent();
+ updateContent(getWindowStartTime(), getWindowEndTime(), false);
});
}
};
@@ -429,23 +421,20 @@ public abstract class AbstractTmfTreeViewer extends TmfTimeViewer {
final ITmfTreeViewerEntry rootEntry = updateElements(trace, start, end, isSelection);
/* Set the input in main thread only if it didn't change */
if (rootEntry != null) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fTreeViewer.getControl().isDisposed()) {
- return;
- }
-
- if (rootEntry != fTreeViewer.getInput()) {
- fTreeViewer.setInput(rootEntry);
- contentChanged(rootEntry);
- } else {
- fTreeViewer.refresh();
- }
- // FIXME should add a bit of padding
- for (TreeColumn column : fTreeViewer.getTree().getColumns()) {
- column.pack();
- }
+ Display.getDefault().asyncExec(() -> {
+ if (fTreeViewer.getControl().isDisposed()) {
+ return;
+ }
+
+ if (rootEntry != fTreeViewer.getInput()) {
+ fTreeViewer.setInput(rootEntry);
+ contentChanged(rootEntry);
+ } else {
+ fTreeViewer.refresh();
+ }
+ // FIXME should add a bit of padding
+ for (TreeColumn column : fTreeViewer.getTree().getColumns()) {
+ column.pack();
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/TmfBaseProvider.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/TmfBaseProvider.java
index 9eebee9b84..3ec9b42579 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/TmfBaseProvider.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xycharts/TmfBaseProvider.java
@@ -121,12 +121,9 @@ public abstract class TmfBaseProvider {
*/
public void refresh() {
if (!TmfXYChartViewer.getDisplay().isDisposed()) {
- TmfXYChartViewer.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!getChart().isDisposed()) {
- getChart().redraw();
- }
+ TmfXYChartViewer.getDisplay().asyncExec(() -> {
+ if (!getChart().isDisposed()) {
+ getChart().redraw();
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/colors/ColorsView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/colors/ColorsView.java
index 02d49d47f3..0018d728cf 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/colors/ColorsView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/colors/ColorsView.java
@@ -32,8 +32,6 @@ import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
@@ -186,16 +184,13 @@ public class ColorsView extends TmfView {
fillerLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
fillerLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- fFillerComposite.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- if (fSelectedRow == null) {
- Color lineColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
- Point p = fFillerComposite.getSize();
- GC gc = e.gc;
- gc.setForeground(lineColor);
- gc.drawLine(0, 0, p.x - 1, 0);
- }
+ fFillerComposite.addPaintListener(e -> {
+ if (fSelectedRow == null) {
+ Color lineColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
+ Point p = fFillerComposite.getSize();
+ GC gc = e.gc;
+ gc.setForeground(lineColor);
+ gc.drawLine(0, 0, p.x - 1, 0);
}
});
@@ -502,22 +497,20 @@ public class ColorsView extends TmfView {
gd.heightHint = bgButton.getSize().y;
tickCanvas.setLayoutData(gd);
tickCanvas.setBackground(traceColorScheme.getBkColor(false, false, false));
- tickCanvas.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- Rectangle bounds = tickCanvas.getBounds();
- e.gc.setForeground(traceColorScheme.getColor(TimeGraphColorScheme.MID_LINE));
- int midy = bounds.y + bounds.height / 2 - 1;
- //int midy = e.y + e.height / 2;
- e.gc.drawLine(e.x, midy, e.x + e.width, midy);
- Rectangle rect = new Rectangle(e.x + 1, bounds.y + 2, 0, bounds.height - 6);
- for (int i = 1; i <= 3; i++) {
- rect.x += i;
- rect.width = i;
- e.gc.setBackground(fColorSetting.getTickColor());
- e.gc.fillRectangle(rect);
- }
- }});
+ tickCanvas.addPaintListener(e -> {
+ Rectangle bounds = tickCanvas.getBounds();
+ e.gc.setForeground(traceColorScheme.getColor(TimeGraphColorScheme.MID_LINE));
+ int midy = bounds.y + bounds.height / 2 - 1;
+ //int midy = e.y + e.height / 2;
+ e.gc.drawLine(e.x, midy, e.x + e.width, midy);
+ Rectangle rect = new Rectangle(e.x + 1, bounds.y + 2, 0, bounds.height - 6);
+ for (int i = 1; i <= 3; i++) {
+ rect.x += i;
+ rect.width = i;
+ e.gc.setBackground(fColorSetting.getTickColor());
+ e.gc.fillRectangle(rect);
+ }
+ });
tickButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -571,17 +564,14 @@ public class ColorsView extends TmfView {
}
}});
- addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- if (fSelectedRow == ColorSettingRow.this) {
- Color borderColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
- Point p = ColorSettingRow.this.getSize();
- Rectangle rect = new Rectangle(0, 0, p.x - 1, p.y - 1);
- GC gc = e.gc;
- gc.setForeground(borderColor);
- gc.drawRectangle(rect);
- }
+ addPaintListener(e -> {
+ if (fSelectedRow == ColorSettingRow.this) {
+ Color borderColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
+ Point p = ColorSettingRow.this.getSize();
+ Rectangle rect = new Rectangle(0, 0, p.x - 1, p.y - 1);
+ GC gc = e.gc;
+ gc.setForeground(borderColor);
+ gc.drawRectangle(rect);
}
});
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterView.java
index 66e7d7e4e5..16753d6dad 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterView.java
@@ -28,9 +28,7 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
@@ -165,14 +163,11 @@ public class FilterView extends TmfView {
contributeToActionBars();
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
- fExportAction.setEnabled(true);
- } else {
- fExportAction.setEnabled(false);
- }
+ fViewer.addSelectionChangedListener(event -> {
+ if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
+ fExportAction.setEnabled(true);
+ } else {
+ fExportAction.setEnabled(false);
}
});
this.getSite().setSelectionProvider(fViewer.getTreeViewer());
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterViewer.java
index 3161a1e6ab..0befd4fc6e 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/filter/FilterViewer.java
@@ -30,7 +30,6 @@ import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
@@ -41,10 +40,6 @@ import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
@@ -159,30 +154,24 @@ class FilterViewer extends Composite {
createContextMenu();
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
- // Update the filter node properties panel to the selection
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- ITmfFilterTreeNode node = (ITmfFilterTreeNode) selection.getFirstElement();
- updateFilterNodeComposite(node);
- // Highlight the selection's children
- highlightTreeItems(fViewer.getTree().getSelection()[0].getItems());
- } else {
- updateFilterNodeComposite(null);
- }
+ fViewer.addSelectionChangedListener(event -> {
+ if (!(event.getSelection().isEmpty()) && event.getSelection() instanceof IStructuredSelection) {
+ // Update the filter node properties panel to the selection
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ ITmfFilterTreeNode node = (ITmfFilterTreeNode) selection.getFirstElement();
+ updateFilterNodeComposite(node);
+ // Highlight the selection's children
+ highlightTreeItems(fViewer.getTree().getSelection()[0].getItems());
+ } else {
+ updateFilterNodeComposite(null);
}
});
- fViewer.getTree().addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- TmfFilterTreeNode root = (TmfFilterTreeNode) fViewer.getInput();
- if (root == null || root.getChildrenCount() == 0) {
- e.gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
- e.gc.drawText(Messages.FilterViewer_EmptyTreeHintText, 5, 0);
- }
+ fViewer.getTree().addPaintListener(e -> {
+ TmfFilterTreeNode root = (TmfFilterTreeNode) fViewer.getInput();
+ if (root == null || root.getChildrenCount() == 0) {
+ e.gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
+ e.gc.drawText(Messages.FilterViewer_EmptyTreeHintText, 5, 0);
}
});
@@ -829,13 +818,10 @@ class FilterViewer extends Composite {
fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
}
});
- fValueText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (!fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
- fNode.setValue(fValueText.getText());
- fViewer.refresh(fNode);
- }
+ fValueText.addModifyListener(e -> {
+ if (!fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
+ fNode.setValue(fValueText.getText());
+ fViewer.refresh(fNode);
}
});
@@ -912,13 +898,10 @@ class FilterViewer extends Composite {
fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
}
});
- fValueText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (!fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
- fNode.setValue(fValueText.getText());
- fViewer.refresh(fNode);
- }
+ fValueText.addModifyListener(e -> {
+ if (!fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
+ fNode.setValue(fValueText.getText());
+ fViewer.refresh(fNode);
}
});
@@ -994,13 +977,10 @@ class FilterViewer extends Composite {
fRegexText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
}
});
- fRegexText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (!fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
- fNode.setRegex(fRegexText.getText());
- fViewer.refresh(fNode);
- }
+ fRegexText.addModifyListener(e -> {
+ if (!fRegexText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
+ fNode.setRegex(fRegexText.getText());
+ fViewer.refresh(fNode);
}
});
}
@@ -1173,13 +1153,10 @@ class FilterViewer extends Composite {
fValueText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
}
});
- fValueText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (!fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
- fNode.setValue(fValueText.getText());
- fViewer.refresh(fNode);
- }
+ fValueText.addModifyListener(e -> {
+ if (!fValueText.getForeground().equals(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY))) {
+ fNode.setValue(fValueText.getText());
+ fViewer.refresh(fNode);
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/Histogram.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/Histogram.java
index 728dd74d21..afd6f2298f 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/Histogram.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/Histogram.java
@@ -24,8 +24,6 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseEvent;
@@ -366,13 +364,10 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
canvasComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(1, 1).create());
fCanvas = new Canvas(canvasComposite, SWT.DOUBLE_BUFFERED);
fCanvas.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
- fCanvas.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- Object image = fCanvas.getData(IMAGE_KEY);
- if (image instanceof Image) {
- ((Image) image).dispose();
- }
+ fCanvas.addDisposeListener(e -> {
+ Object image = fCanvas.getData(IMAGE_KEY);
+ if (image instanceof Image) {
+ ((Image) image).dispose();
}
});
@@ -641,9 +636,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
@Override
public void modelUpdated() {
if (!fCanvas.isDisposed() && fCanvas.getDisplay() != null) {
- fCanvas.getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
+ fCanvas.getDisplay().asyncExec(() -> {
if (!fCanvas.isDisposed()) {
// Retrieve and normalize the data
final int canvasWidth = fCanvas.getBounds().width;
@@ -674,7 +667,6 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
}
fTimeLineScale.redraw();
}
- }
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramTextControl.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramTextControl.java
index 407e07c32c..a9018345bf 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramTextControl.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramTextControl.java
@@ -200,12 +200,9 @@ public abstract class HistogramTextControl implements FocusListener, KeyListener
// Call self from the UI thread
if (!isDisposed()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!isDisposed()) {
- setValue(time, displayTime);
- }
+ Display.getDefault().asyncExec(() -> {
+ if (!isDisposed()) {
+ setValue(time, displayTime);
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramView.java
index 9dcc4a37ab..41aa73d63e 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/histogram/HistogramView.java
@@ -46,7 +46,6 @@ import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
@@ -377,12 +376,7 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
if (fSashDragListener == null) {
for (Control control : fSashForm.getChildren()) {
if (control instanceof Sash) {
- fSashDragListener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- TmfSignalManager.dispatchSignal(new TmfTimeViewAlignmentSignal(fSashForm, getTimeViewAlignmentInfo()));
- }
- };
+ fSashDragListener = event -> TmfSignalManager.dispatchSignal(new TmfTimeViewAlignmentSignal(fSashForm, getTimeViewAlignmentInfo()));
control.removePaintListener(this);
control.addListener(SWT.Selection, fSashDragListener);
// There should be only one sash
@@ -764,14 +758,11 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
public void selectionRangeUpdated(final TmfSelectionRangeUpdatedSignal signal) {
if (Display.getCurrent() == null) {
// Make sure the signal is handled in the UI thread
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (getParentComposite().isDisposed()) {
- return;
- }
- selectionRangeUpdated(signal);
+ Display.getDefault().asyncExec(() -> {
+ if (getParentComposite().isDisposed()) {
+ return;
}
+ selectionRangeUpdated(signal);
});
return;
}
@@ -795,14 +786,11 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
public void windowRangeUpdated(final TmfWindowRangeUpdatedSignal signal) {
if (Display.getCurrent() == null) {
// Make sure the signal is handled in the UI thread
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (getParentComposite().isDisposed()) {
- return;
- }
- windowRangeUpdated(signal);
+ Display.getDefault().asyncExec(() -> {
+ if (getParentComposite().isDisposed()) {
+ return;
}
+ windowRangeUpdated(signal);
});
return;
}
@@ -987,20 +975,17 @@ public class HistogramView extends TmfView implements ITmfTimeAligned {
}
});
- fLinkButton.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- if (fLinkState) {
- Rectangle r = fLinkButton.getBounds();
- r.x = -1;
- r.y = -1;
- e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- e.gc.drawRectangle(r);
- r.x = 0;
- r.y = 0;
- e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_DARK_GRAY));
- e.gc.drawRectangle(r);
- }
+ fLinkButton.addPaintListener(e -> {
+ if (fLinkState) {
+ Rectangle r = fLinkButton.getBounds();
+ r.x = -1;
+ r.y = -1;
+ e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
+ e.gc.drawRectangle(r);
+ r.x = 0;
+ r.y = 0;
+ e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_DARK_GRAY));
+ e.gc.drawRectangle(r);
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/synchronization/TmfSynchronizationView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/synchronization/TmfSynchronizationView.java
index 0f5c16233d..69002865c1 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/synchronization/TmfSynchronizationView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/synchronization/TmfSynchronizationView.java
@@ -125,12 +125,7 @@ public class TmfSynchronizationView extends TmfView {
if (signal.getTrace() instanceof TmfExperiment) {
fAlgoSync = ((TmfExperiment) signal.getTrace()).synchronizeTraces();
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- updateTable();
- }
- });
+ Display.getDefault().asyncExec(this::updateTable);
}
/**
@@ -143,12 +138,7 @@ public class TmfSynchronizationView extends TmfView {
public void traceSynchronized(TmfTraceSynchronizedSignal signal) {
if (signal.getSyncAlgo() != fAlgoSync) {
fAlgoSync = signal.getSyncAlgo();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- updateTable();
- }
- });
+ Display.getDefault().asyncExec(this::updateTable);
}
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timechart/TimeChartView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timechart/TimeChartView.java
index 4b21836b14..cb35c6aac1 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timechart/TimeChartView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timechart/TimeChartView.java
@@ -266,20 +266,17 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
fRefreshBusy = true;
}
// Perform the refresh on the UI thread
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fViewer.getControl().isDisposed()) {
- return;
- }
- fViewer.setInput(fTimeAnalysisEntries.toArray(new TimeChartAnalysisEntry[0]));
- fViewer.resetStartFinishTime(false);
- synchronized (fSyncObj) {
- fRefreshBusy = false;
- if (fRefreshPending) {
- fRefreshPending = false;
- refreshViewer();
- }
+ Display.getDefault().asyncExec(() -> {
+ if (fViewer.getControl().isDisposed()) {
+ return;
+ }
+ fViewer.setInput(fTimeAnalysisEntries.toArray(new TimeChartAnalysisEntry[0]));
+ fViewer.resetStartFinishTime(false);
+ synchronized (fSyncObj) {
+ fRefreshBusy = false;
+ if (fRefreshPending) {
+ fRefreshPending = false;
+ refreshViewer();
}
}
});
@@ -295,24 +292,21 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
}
final boolean reset = resetTimeIntervals;
// Perform the refresh on the UI thread
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fViewer.getControl().isDisposed()) {
- return;
- }
- if (reset) {
- fViewer.setTimeRange(fTimeAnalysisEntries.toArray(new TimeChartAnalysisEntry[0]));
- fViewer.setTimeBounds();
- }
- fViewer.getControl().redraw();
- fViewer.getControl().update();
- synchronized (fSyncObj) {
- fRedrawBusy = false;
- if (fRedrawPending) {
- fRedrawPending = false;
- redrawViewer(reset);
- }
+ Display.getDefault().asyncExec(() -> {
+ if (fViewer.getControl().isDisposed()) {
+ return;
+ }
+ if (reset) {
+ fViewer.setTimeRange(fTimeAnalysisEntries.toArray(new TimeChartAnalysisEntry[0]));
+ fViewer.setTimeBounds();
+ }
+ fViewer.getControl().redraw();
+ fViewer.getControl().update();
+ synchronized (fSyncObj) {
+ fRedrawBusy = false;
+ if (fRedrawPending) {
+ fRedrawPending = false;
+ redrawViewer(reset);
}
}
});
@@ -718,19 +712,16 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
final long beginTime = signal.getBeginTime().toNanos();
final long endTime = signal.getEndTime().toNanos();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (beginTime == endTime) {
- fViewer.setSelectedTime(beginTime, true);
- if (fStartTime != fViewer.getTime0() || fStopTime != fViewer.getTime1()) {
- fStartTime = fViewer.getTime0();
- fStopTime = fViewer.getTime1();
- itemize(fStartTime, fStopTime);
- }
- } else {
- fViewer.setSelectionRange(beginTime, endTime, true);
+ Display.getDefault().asyncExec(() -> {
+ if (beginTime == endTime) {
+ fViewer.setSelectedTime(beginTime, true);
+ if (fStartTime != fViewer.getTime0() || fStopTime != fViewer.getTime1()) {
+ fStartTime = fViewer.getTime0();
+ fStopTime = fViewer.getTime1();
+ itemize(fStartTime, fStopTime);
}
+ } else {
+ fViewer.setSelectionRange(beginTime, endTime, true);
}
});
}
@@ -749,14 +740,11 @@ public class TimeChartView extends TmfView implements ITimeGraphRangeListener, I
}
final long startTime = signal.getCurrentRange().getStartTime().toNanos();
final long endTime = signal.getCurrentRange().getEndTime().toNanos();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- fStartTime = startTime;
- fStopTime = endTime;
- itemize(fStartTime, fStopTime);
- fViewer.setStartFinishTime(startTime, endTime);
- }
+ Display.getDefault().asyncExec(() -> {
+ fStartTime = startTime;
+ fStopTime = endTime;
+ itemize(fStartTime, fStopTime);
+ fViewer.setStartFinishTime(startTime, endTime);
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java
index 0a88a78f96..baa5699f93 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractStateSystemTimeGraphView.java
@@ -201,27 +201,24 @@ public abstract class AbstractStateSystemTimeGraphView extends AbstractTimeGraph
private void doZoom(final ITmfStateSystem ss, final List<ILinkEvent> links, final List<IMarkerEvent> markers, long resolution, final @NonNull IProgressMonitor monitor, final long start, final long end, Sampling sampling,
Iterable<@NonNull TimeGraphEntry> entries, Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull String>>> predicates, Map<TimeGraphEntry, List<ITimeEvent>> gaps) {
- queryFullStates(ss, start, end, resolution, monitor, new IQueryHandler() {
- @Override
- public void handle(@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState) {
- try (TraceCompassLogUtils.ScopeLog scope = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates");) { //$NON-NLS-1$
-
- for (TimeGraphEntry entry : entries) {
- if (!sampling.equals(entry.getSampling())) {
- zoom(checkNotNull(entry), ss, fullStates, prevFullState, predicates, monitor, gaps);
- }
+ queryFullStates(ss, start, end, resolution, monitor, (@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState) -> {
+ try (TraceCompassLogUtils.ScopeLog scope = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates");) { //$NON-NLS-1$
+
+ for (TimeGraphEntry entry : entries) {
+ if (!sampling.equals(entry.getSampling())) {
+ zoom(checkNotNull(entry), ss, fullStates, prevFullState, predicates, monitor, gaps);
}
}
- /* Refresh the arrows when zooming */
- try (TraceCompassLogUtils.ScopeLog linksLogger = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { //$NON-NLS-1$
- links.addAll(getLinkList(ss, fullStates, prevFullState, monitor));
- }
- /* Refresh the view-specific markers when zooming */
- try (TraceCompassLogUtils.ScopeLog linksLogger = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { //$NON-NLS-1$
- markers.addAll(getViewMarkerList(ss, fullStates, prevFullState, monitor));
- }
- refresh();
}
+ /* Refresh the arrows when zooming */
+ try (TraceCompassLogUtils.ScopeLog linksLogger1 = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { //$NON-NLS-1$
+ links.addAll(getLinkList(ss, fullStates, prevFullState, monitor));
+ }
+ /* Refresh the view-specific markers when zooming */
+ try (TraceCompassLogUtils.ScopeLog linksLogger2 = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { //$NON-NLS-1$
+ markers.addAll(getViewMarkerList(ss, fullStates, prevFullState, monitor));
+ }
+ refresh();
});
if (!monitor.isCanceled()) {
applyResults(() -> entries.forEach(entry -> {
@@ -289,41 +286,37 @@ public abstract class AbstractStateSystemTimeGraphView extends AbstractTimeGraph
}
}
- queryRangeStates(ss, tableEntry.getKey().getLeft(), tableEntry.getKey().getRight(), quarks, resolution, monitor, new IQueryHandler() {
-
- @Override
- public void handle(@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState) {
- for (Entry<ITimeGraphEntry, List<ITimeEvent>> entryGap : row.entrySet()) {
- List<ITimeEvent> gapEvents = entryGap.getValue();
- TimeGraphEntry entry = (TimeGraphEntry) entryGap.getKey();
- List<ITimeEvent> eventList = getEventList(Objects.requireNonNull(entry), ss, fullStates, prevFullState, monitor);
-
- if (eventList != null && !eventList.isEmpty() && !monitor.isCanceled()) {
- doFilterEvents(entry, eventList, predicates);
- for (ITimeEvent event : eventList) {
- int pos = Collections.binarySearch(gapEvents, event, TimeGraphEntry.WITHIN_COMPARATOR);
- // If the event is within a gap
- if (pos >= 0) {
- ITimeEvent gap = gapEvents.get(pos);
- if (!monitor.isCanceled()) {
- // if any underlying event is not dimmed,
- // then set the related gap event dimmed
- // property to false
- boolean dimmed = gap.isPropertyActive(IFilterProperty.DIMMED);
- if (dimmed && !event.isPropertyActive(IFilterProperty.DIMMED)) {
- gap.setProperty(IFilterProperty.DIMMED, false);
- }
-
- // if any underlying event is not excluded,
- // then set the related gap event exclude
- // status property to false and add the gap
- // back to the zoom event list
- if (hasActiveSavedFilters && !event.isPropertyActive(IFilterProperty.EXCLUDE)) {
- gap.setProperty(IFilterProperty.EXCLUDE, false);
- applyResults(() -> {
- entry.updateZoomedEvent(gap);
- });
- }
+ queryRangeStates(ss, tableEntry.getKey().getLeft(), tableEntry.getKey().getRight(), quarks, resolution, monitor, (@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState) -> {
+ for (Entry<ITimeGraphEntry, List<ITimeEvent>> entryGap : row.entrySet()) {
+ List<ITimeEvent> gapEvents = entryGap.getValue();
+ TimeGraphEntry entry = (TimeGraphEntry) entryGap.getKey();
+ List<ITimeEvent> eventList = getEventList(Objects.requireNonNull(entry), ss, fullStates, prevFullState, monitor);
+
+ if (eventList != null && !eventList.isEmpty() && !monitor.isCanceled()) {
+ doFilterEvents(entry, eventList, predicates);
+ for (ITimeEvent event : eventList) {
+ int pos = Collections.binarySearch(gapEvents, event, TimeGraphEntry.WITHIN_COMPARATOR);
+ // If the event is within a gap
+ if (pos >= 0) {
+ ITimeEvent gap = gapEvents.get(pos);
+ if (!monitor.isCanceled()) {
+ // if any underlying event is not dimmed,
+ // then set the related gap event dimmed
+ // property to false
+ boolean dimmed = gap.isPropertyActive(IFilterProperty.DIMMED);
+ if (dimmed && !event.isPropertyActive(IFilterProperty.DIMMED)) {
+ gap.setProperty(IFilterProperty.DIMMED, false);
+ }
+
+ // if any underlying event is not excluded,
+ // then set the related gap event exclude
+ // status property to false and add the gap
+ // back to the zoom event list
+ if (hasActiveSavedFilters && !event.isPropertyActive(IFilterProperty.EXCLUDE)) {
+ gap.setProperty(IFilterProperty.EXCLUDE, false);
+ applyResults(() -> {
+ entry.updateZoomedEvent(gap);
+ });
}
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java
index 03c1a8a243..fec6c4d8c4 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java
@@ -62,7 +62,6 @@ import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -79,8 +78,6 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
@@ -147,15 +144,10 @@ import org.eclipse.tracecompass.tmf.ui.views.timegraph.BaseDataProviderTimeGraph
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphBookmarkListener;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphContentProvider;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphPresentationProvider;
-import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphRangeListener;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphSelectionListener;
-import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphTimeListener;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphBookmarkEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphContentProvider;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphPresentationProvider;
-import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphRangeUpdateEvent;
-import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphSelectionEvent;
-import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphTimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphViewer;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent;
@@ -386,16 +378,12 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
private Collection<@NonNull String> fGlobalFilter = null;
/** Listener that handles a click on an entry in the FusedVM View */
- private final ITimeGraphSelectionListener fMetadataSelectionListener = new ITimeGraphSelectionListener() {
-
- @Override
- public void selectionChanged(TimeGraphSelectionEvent event) {
- ITimeGraphEntry entry = event.getSelection();
- if (entry instanceof IElementResolver) {
- Multimap<@NonNull String, @NonNull Object> metadata = ((IElementResolver) entry).getMetadata();
- if (!metadata.isEmpty()) {
- broadcast(new TmfDataModelSelectedSignal(AbstractTimeGraphView.this, metadata));
- }
+ private final ITimeGraphSelectionListener fMetadataSelectionListener = event -> {
+ ITimeGraphEntry entry = event.getSelection();
+ if (entry instanceof IElementResolver) {
+ Multimap<@NonNull String, @NonNull Object> metadata = ((IElementResolver) entry).getMetadata();
+ if (!metadata.isEmpty()) {
+ broadcast(new TmfDataModelSelectedSignal(AbstractTimeGraphView.this, metadata));
}
}
};
@@ -1309,24 +1297,18 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
fTimeEventFilterAction = timeEventFilterAction;
- timeGraphViewer.addRangeListener(new ITimeGraphRangeListener() {
- @Override
- public void timeRangeUpdated(TimeGraphRangeUpdateEvent event) {
- final long startTime = event.getStartTime();
- final long endTime = event.getEndTime();
- TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(startTime), TmfTimestamp.fromNanos(endTime));
- broadcast(new TmfWindowRangeUpdatedSignal(AbstractTimeGraphView.this, range, fTrace));
- startZoomThread(startTime, endTime);
- }
+ timeGraphViewer.addRangeListener(event -> {
+ final long startTime = event.getStartTime();
+ final long endTime = event.getEndTime();
+ TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(startTime), TmfTimestamp.fromNanos(endTime));
+ broadcast(new TmfWindowRangeUpdatedSignal(AbstractTimeGraphView.this, range, fTrace));
+ startZoomThread(startTime, endTime);
});
- timeGraphViewer.addTimeListener(new ITimeGraphTimeListener() {
- @Override
- public void timeSelected(TimeGraphTimeEvent event) {
- ITmfTimestamp startTime = TmfTimestamp.fromNanos(event.getBeginTime());
- ITmfTimestamp endTime = TmfTimestamp.fromNanos(event.getEndTime());
- broadcast(new TmfSelectionRangeUpdatedSignal(AbstractTimeGraphView.this, startTime, endTime, fTrace));
- }
+ timeGraphViewer.addTimeListener(event -> {
+ ITmfTimestamp startTime = TmfTimestamp.fromNanos(event.getBeginTime());
+ ITmfTimestamp endTime = TmfTimestamp.fromNanos(event.getEndTime());
+ broadcast(new TmfSelectionRangeUpdatedSignal(AbstractTimeGraphView.this, startTime, endTime, fTrace));
});
timeGraphViewer.addBookmarkListener(new ITimeGraphBookmarkListener() {
@@ -1666,19 +1648,16 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
long beginTime = ctx.getSelectionRange().getStartTime().toNanos();
long endTime = ctx.getSelectionRange().getEndTime().toNanos();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fTimeGraphViewer.getControl().isDisposed()) {
- return;
- }
- if (beginTime == endTime) {
- fTimeGraphViewer.setSelectedTime(beginTime, true);
- } else {
- fTimeGraphViewer.setSelectionRange(beginTime, endTime, true);
- }
- synchingToTime(fTimeGraphViewer.getSelectionBegin());
+ Display.getDefault().asyncExec(() -> {
+ if (fTimeGraphViewer.getControl().isDisposed()) {
+ return;
+ }
+ if (beginTime == endTime) {
+ fTimeGraphViewer.setSelectedTime(beginTime, true);
+ } else {
+ fTimeGraphViewer.setSelectionRange(beginTime, endTime, true);
}
+ synchingToTime(fTimeGraphViewer.getSelectionBegin());
});
}
@@ -1697,18 +1676,15 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
TmfTraceContext ctx = TmfTraceManager.getInstance().getTraceContext(checkNotNull(fTrace));
final long startTime = ctx.getWindowRange().getStartTime().toNanos();
final long endTime = ctx.getWindowRange().getEndTime().toNanos();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fTimeGraphViewer.getControl().isDisposed()) {
- return;
- }
- if (startTime == fTimeGraphViewer.getTime0() && endTime == fTimeGraphViewer.getTime1()) {
- return;
- }
- fTimeGraphViewer.setStartFinishTime(startTime, endTime);
- startZoomThread(startTime, endTime);
+ Display.getDefault().asyncExec(() -> {
+ if (fTimeGraphViewer.getControl().isDisposed()) {
+ return;
+ }
+ if (startTime == fTimeGraphViewer.getTime0() && endTime == fTimeGraphViewer.getTime1()) {
+ return;
}
+ fTimeGraphViewer.setStartFinishTime(startTime, endTime);
+ startZoomThread(startTime, endTime);
});
}
@@ -2042,82 +2018,79 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
protected void refresh() {
try (FlowScopeLog parentLogger = new FlowScopeLogBuilder(LOGGER, Level.FINE, "RefreshRequested").setCategory(getViewId()).build()) { //$NON-NLS-1$
final boolean isZoomThread = Thread.currentThread() instanceof ZoomThread;
- TmfUiRefreshHandler.getInstance().queueUpdate(this, new Runnable() {
- @Override
- public void run() {
- try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:Refresh").setParentScope(parentLogger).build()) { //$NON-NLS-1$
- if (fTimeGraphViewer.getControl().isDisposed()) {
- return;
- }
- fDirty.incrementAndGet();
- try {
- synchronized (fEntryListMap) {
- fEntryList = fEntryListMap.get(fTrace);
- if (fEntryList == null) {
- fEntryList = new CopyOnWriteArrayList<>();
- } else if (fEntryComparator != null) {
- List<TimeGraphEntry> list = new ArrayList<>(fEntryList);
- Collections.sort(list, fEntryComparator);
- for (ITimeGraphEntry entry : list) {
- sortChildren(entry, fEntryComparator);
- }
- fEntryList.clear();
- fEntryList.addAll(list);
+ TmfUiRefreshHandler.getInstance().queueUpdate(this, () -> {
+ try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:Refresh").setParentScope(parentLogger).build()) { //$NON-NLS-1$
+ if (fTimeGraphViewer.getControl().isDisposed()) {
+ return;
+ }
+ fDirty.incrementAndGet();
+ try {
+ synchronized (fEntryListMap) {
+ fEntryList = fEntryListMap.get(fTrace);
+ if (fEntryList == null) {
+ fEntryList = new CopyOnWriteArrayList<>();
+ } else if (fEntryComparator != null) {
+ List<TimeGraphEntry> list = new ArrayList<>(fEntryList);
+ Collections.sort(list, fEntryComparator);
+ for (ITimeGraphEntry entry : list) {
+ sortChildren(entry, fEntryComparator);
}
+ fEntryList.clear();
+ fEntryList.addAll(list);
}
- boolean inputChanged = fEntryList != fTimeGraphViewer.getInput();
- if (inputChanged) {
- fTimeGraphViewer.setInput(fEntryList);
- /*
- * restore the previously saved filters, if any
- */
- fTimeGraphViewer.setFilters(fFiltersMap.get(fTrace));
- fTimeGraphViewer.setLinks(null);
- fTimeGraphViewer.setBookmarks(refreshBookmarks(fEditorFile));
- fTimeGraphViewer.setMarkerCategories(getMarkerCategories());
- fTimeGraphViewer.setMarkers(null);
- applyViewContext();
- } else {
- fTimeGraphViewer.refresh();
- }
- // reveal selection
- if (fIsRevealSelection) {
- fIsRevealSelection = false;
- fTimeGraphViewer.setSelection(fTimeGraphViewer.getSelection(), true);
- }
- long startBound = (fStartTime == Long.MAX_VALUE ? SWT.DEFAULT : fStartTime);
- long endBound = (fEndTime == Long.MIN_VALUE ? SWT.DEFAULT : fEndTime);
- fTimeGraphViewer.setTimeBounds(startBound, endBound);
-
- ITmfTrace trace = fTrace;
- TmfTraceContext ctx = (trace == null) ? null : TmfTraceManager.getInstance().getTraceContext(trace);
- long selectionBeginTime = ctx == null ? SWT.DEFAULT : ctx.getSelectionRange().getStartTime().toNanos();
- long selectionEndTime = ctx == null ? SWT.DEFAULT : ctx.getSelectionRange().getEndTime().toNanos();
- long startTime = ctx == null ? SWT.DEFAULT : ctx.getWindowRange().getStartTime().toNanos();
- long endTime = ctx == null ? SWT.DEFAULT : ctx.getWindowRange().getEndTime().toNanos();
- if (fStartTime > fEndTime) {
- startTime = SWT.DEFAULT;
- endTime = SWT.DEFAULT;
- } else {
- startTime = Math.min(Math.max(startTime, fStartTime), fEndTime);
- endTime = Math.min(Math.max(endTime, fStartTime), fEndTime);
- }
- fTimeGraphViewer.setSelectionRange(selectionBeginTime, selectionEndTime, false);
- fTimeGraphViewer.setStartFinishTime(startTime, endTime);
+ }
+ boolean inputChanged = fEntryList != fTimeGraphViewer.getInput();
+ if (inputChanged) {
+ fTimeGraphViewer.setInput(fEntryList);
+ /*
+ * restore the previously saved filters, if any
+ */
+ fTimeGraphViewer.setFilters(fFiltersMap.get(fTrace));
+ fTimeGraphViewer.setLinks(null);
+ fTimeGraphViewer.setBookmarks(refreshBookmarks(fEditorFile));
+ fTimeGraphViewer.setMarkerCategories(getMarkerCategories());
+ fTimeGraphViewer.setMarkers(null);
+ applyViewContext();
+ } else {
+ fTimeGraphViewer.refresh();
+ }
+ // reveal selection
+ if (fIsRevealSelection) {
+ fIsRevealSelection = false;
+ fTimeGraphViewer.setSelection(fTimeGraphViewer.getSelection(), true);
+ }
+ long startBound = (fStartTime == Long.MAX_VALUE ? SWT.DEFAULT : fStartTime);
+ long endBound = (fEndTime == Long.MIN_VALUE ? SWT.DEFAULT : fEndTime);
+ fTimeGraphViewer.setTimeBounds(startBound, endBound);
+
+ ITmfTrace trace = fTrace;
+ TmfTraceContext ctx = (trace == null) ? null : TmfTraceManager.getInstance().getTraceContext(trace);
+ long selectionBeginTime = ctx == null ? SWT.DEFAULT : ctx.getSelectionRange().getStartTime().toNanos();
+ long selectionEndTime = ctx == null ? SWT.DEFAULT : ctx.getSelectionRange().getEndTime().toNanos();
+ long startTime = ctx == null ? SWT.DEFAULT : ctx.getWindowRange().getStartTime().toNanos();
+ long endTime = ctx == null ? SWT.DEFAULT : ctx.getWindowRange().getEndTime().toNanos();
+ if (fStartTime > fEndTime) {
+ startTime = SWT.DEFAULT;
+ endTime = SWT.DEFAULT;
+ } else {
+ startTime = Math.min(Math.max(startTime, fStartTime), fEndTime);
+ endTime = Math.min(Math.max(endTime, fStartTime), fEndTime);
+ }
+ fTimeGraphViewer.setSelectionRange(selectionBeginTime, selectionEndTime, false);
+ fTimeGraphViewer.setStartFinishTime(startTime, endTime);
- if (inputChanged && selectionBeginTime != SWT.DEFAULT) {
- synchingToTime(selectionBeginTime);
- }
+ if (inputChanged && selectionBeginTime != SWT.DEFAULT) {
+ synchingToTime(selectionBeginTime);
+ }
- ZoomThread zoomThread = fZoomThread;
- if (!isZoomThread ||
- (zoomThread != null && (zoomThread.getZoomStartTime() != startTime || zoomThread.getZoomEndTime() != endTime))) {
- startZoomThread(startTime, endTime);
- }
- } finally {
- if (fDirty.decrementAndGet() < 0) {
- Activator.getDefault().logError(DIRTY_UNDERFLOW_ERROR, new Throwable());
- }
+ ZoomThread zoomThread = fZoomThread;
+ if (!isZoomThread ||
+ (zoomThread != null && (zoomThread.getZoomStartTime() != startTime || zoomThread.getZoomEndTime() != endTime))) {
+ startZoomThread(startTime, endTime);
+ }
+ } finally {
+ if (fDirty.decrementAndGet() < 0) {
+ Activator.getDefault().logError(DIRTY_UNDERFLOW_ERROR, new Throwable());
}
}
}
@@ -2138,22 +2111,19 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
}
}
try (FlowScopeLog flowParent = new FlowScopeLogBuilder(LOGGER, Level.FINE, "RedrawRequested").setCategory(getViewId()).build()) { //$NON-NLS-1$
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:Redraw").setParentScope(flowParent).build()) { //$NON-NLS-1$
- if (fTimeGraphViewer.getControl().isDisposed()) {
- return;
- }
- fTimeGraphViewer.getControl().redraw();
- fTimeGraphViewer.getControl().update();
- synchronized (fSyncObj) {
- if (fRedrawState == State.PENDING) {
- fRedrawState = State.IDLE;
- redraw();
- } else {
- fRedrawState = State.IDLE;
- }
+ Display.getDefault().asyncExec(() -> {
+ try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:Redraw").setParentScope(flowParent).build()) { //$NON-NLS-1$
+ if (fTimeGraphViewer.getControl().isDisposed()) {
+ return;
+ }
+ fTimeGraphViewer.getControl().redraw();
+ fTimeGraphViewer.getControl().update();
+ synchronized (fSyncObj) {
+ if (fRedrawState == State.PENDING) {
+ fRedrawState = State.IDLE;
+ redraw();
+ } else {
+ fRedrawState = State.IDLE;
}
}
}
@@ -2277,35 +2247,32 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
}
fMarkerSetMenu = new MenuManager(Messages.AbstractTimeGraphView_MarkerSetMenuText);
fMarkerSetMenu.setRemoveAllWhenShown(true);
- fMarkerSetMenu.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager mgr) {
- Action noneAction = new MarkerSetAction(null);
- MarkerSet defaultMarkerSet = MarkerUtils.getDefaultMarkerSet();
- String defaultMarkerSetId = (defaultMarkerSet == null) ? null : defaultMarkerSet.getId();
- noneAction.setChecked(defaultMarkerSetId == null);
- mgr.add(noneAction);
- List<MarkerSet> markerSets = MarkerConfigXmlParser.getMarkerSets();
- for (MarkerSet markerSet : markerSets) {
- Action action = new MarkerSetAction(markerSet);
- action.setChecked(markerSet.getId().equals(defaultMarkerSetId));
- mgr.add(action);
- }
- mgr.add(new Separator());
- mgr.add(new Action(Messages.AbstractTimeGraphView_MarkerSetEditActionText) {
- @Override
- public void run() {
- MarkerConfigXmlParser.initMarkerSets();
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IFileStore fileStore = EFS.getLocalFileSystem().getStore(MarkerConfigXmlParser.MARKER_CONFIG_PATH);
- try {
- IDE.openEditorOnFileStore(page, fileStore);
- } catch (PartInitException e) {
- Activator.getDefault().logError("Error opening editor on " + MarkerConfigXmlParser.MARKER_CONFIG_PATH, e); //$NON-NLS-1$
- }
- }
- });
+ fMarkerSetMenu.addMenuListener(mgr -> {
+ Action noneAction = new MarkerSetAction(null);
+ MarkerSet defaultMarkerSet = MarkerUtils.getDefaultMarkerSet();
+ String defaultMarkerSetId = (defaultMarkerSet == null) ? null : defaultMarkerSet.getId();
+ noneAction.setChecked(defaultMarkerSetId == null);
+ mgr.add(noneAction);
+ List<MarkerSet> markerSets = MarkerConfigXmlParser.getMarkerSets();
+ for (MarkerSet markerSet : markerSets) {
+ Action action = new MarkerSetAction(markerSet);
+ action.setChecked(markerSet.getId().equals(defaultMarkerSetId));
+ mgr.add(action);
}
+ mgr.add(new Separator());
+ mgr.add(new Action(Messages.AbstractTimeGraphView_MarkerSetEditActionText) {
+ @Override
+ public void run() {
+ MarkerConfigXmlParser.initMarkerSets();
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(MarkerConfigXmlParser.MARKER_CONFIG_PATH);
+ try {
+ IDE.openEditorOnFileStore(page, fileStore);
+ } catch (PartInitException e) {
+ Activator.getDefault().logError("Error opening editor on " + MarkerConfigXmlParser.MARKER_CONFIG_PATH, e); //$NON-NLS-1$
+ }
+ }
+ });
});
return fMarkerSetMenu;
}
@@ -2627,29 +2594,23 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
fEntryMenuManager.setRemoveAllWhenShown(true);
TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl();
final Menu entryMenu = fEntryMenuManager.createContextMenu(timeGraphControl);
- timeGraphControl.addTimeGraphEntryMenuListener(new MenuDetectListener() {
- @Override
- public void menuDetected(MenuDetectEvent event) {
- Point p = timeGraphControl.toControl(event.x, event.y);
- /*
- * The TimeGraphControl will call the TimeGraphEntryMenuListener before the
- * TimeEventMenuListener. If the event is triggered on the name space then show
- * the menu else clear the menu.
- */
- if (p.x < getTimeGraphViewer().getNameSpace()) {
- timeGraphControl.setMenu(entryMenu);
- } else {
- timeGraphControl.setMenu(null);
- event.doit = false;
- }
+ timeGraphControl.addTimeGraphEntryMenuListener(event -> {
+ Point p = timeGraphControl.toControl(event.x, event.y);
+ /*
+ * The TimeGraphControl will call the TimeGraphEntryMenuListener before the
+ * TimeEventMenuListener. If the event is triggered on the name space then show
+ * the menu else clear the menu.
+ */
+ if (p.x < getTimeGraphViewer().getNameSpace()) {
+ timeGraphControl.setMenu(entryMenu);
+ } else {
+ timeGraphControl.setMenu(null);
+ event.doit = false;
}
});
- fEntryMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillTimeGraphEntryContextMenu(fEntryMenuManager);
- fEntryMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- }
+ fEntryMenuManager.addMenuListener(manager -> {
+ fillTimeGraphEntryContextMenu(fEntryMenuManager);
+ fEntryMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
});
getSite().registerContextMenu(fEntryMenuManager, fTimeGraphViewer.getSelectionProvider());
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/TimeGraphFindDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/TimeGraphFindDialog.java
index 8f1ce642d7..26e70a5c1b 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/TimeGraphFindDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/TimeGraphFindDialog.java
@@ -32,8 +32,6 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
@@ -275,46 +273,43 @@ class TimeGraphFindDialog extends Dialog {
Composite statusBar = createStatusAndCloseButton(panel);
setGridData(statusBar, SWT.FILL, true, SWT.BOTTOM, false);
- panel.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_RETURN) {
- if (!Util.isMac()) {
- Control controlWithFocus = getShell().getDisplay().getFocusControl();
- if (controlWithFocus != null && (controlWithFocus.getStyle() & SWT.PUSH) == SWT.PUSH) {
- return;
- }
+ panel.addTraverseListener(e -> {
+ if (e.detail == SWT.TRAVERSE_RETURN) {
+ if (!Util.isMac()) {
+ Control controlWithFocus = getShell().getDisplay().getFocusControl();
+ if (controlWithFocus != null && (controlWithFocus.getStyle() & SWT.PUSH) == SWT.PUSH) {
+ return;
}
- Event event = new Event();
- event.type = SWT.Selection;
- event.stateMask = e.stateMask;
- fFindNextButton.notifyListeners(SWT.Selection, event);
- e.doit = false;
- } else if (e.detail == SWT.TRAVERSE_MNEMONIC) {
- Character mnemonic = new Character(Character.toLowerCase(e.character));
- Button button = fMnemonicButtonMap.get(mnemonic);
- if (button != null) {
- if ((fFindField.isFocusControl() || (button.getStyle() & SWT.PUSH) != 0)
- && button.isEnabled()) {
- Event event = new Event();
- event.type = SWT.Selection;
- event.stateMask = e.stateMask;
- if ((button.getStyle() & SWT.RADIO) != 0) {
- Composite buttonParent = button.getParent();
- if (buttonParent != null) {
- Control[] children = buttonParent.getChildren();
- for (int i = 0; i < children.length; i++) {
- ((Button) children[i]).setSelection(false);
- }
+ }
+ Event event1 = new Event();
+ event1.type = SWT.Selection;
+ event1.stateMask = e.stateMask;
+ fFindNextButton.notifyListeners(SWT.Selection, event1);
+ e.doit = false;
+ } else if (e.detail == SWT.TRAVERSE_MNEMONIC) {
+ Character mnemonic = new Character(Character.toLowerCase(e.character));
+ Button button = fMnemonicButtonMap.get(mnemonic);
+ if (button != null) {
+ if ((fFindField.isFocusControl() || (button.getStyle() & SWT.PUSH) != 0)
+ && button.isEnabled()) {
+ Event event2 = new Event();
+ event2.type = SWT.Selection;
+ event2.stateMask = e.stateMask;
+ if ((button.getStyle() & SWT.RADIO) != 0) {
+ Composite buttonParent = button.getParent();
+ if (buttonParent != null) {
+ Control[] children = buttonParent.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ ((Button) children[i]).setSelection(false);
}
- button.setSelection(true);
- } else {
- button.setSelection(!button.getSelection());
}
- button.notifyListeners(SWT.Selection, event);
- e.detail = SWT.TRAVERSE_NONE;
- e.doit = true;
+ button.setSelection(true);
+ } else {
+ button.setSelection(!button.getSelection());
}
+ button.notifyListeners(SWT.Selection, event2);
+ e.detail = SWT.TRAVERSE_NONE;
+ e.doit = true;
}
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java
index ea18eb8524..0b9443c5f5 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDView.java
@@ -18,7 +18,6 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
@@ -534,12 +533,7 @@ public class SDView extends ViewPart implements IPartListener {
protected void hookContextMenu() {
fMenuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
fMenuMgr.setRemoveAllWhenShown(true);
- fMenuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- }
- });
+ fMenuMgr.addMenuListener(this::fillContextMenu);
Menu menu = fMenuMgr.createContextMenu(fSdWidget.getViewControl());
fSdWidget.getViewControl().setMenu(menu);
getSite().registerContextMenu(fMenuMgr, fSdWidget.getSelectionProvider());
@@ -926,15 +920,12 @@ public class SDView extends ViewPart implements IPartListener {
if (getSDWidget() == null || getSDWidget().isDisposed()) {
return;
}
- getSDWidget().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (getSDWidget() == null || getSDWidget().isDisposed() ||
- ((fTimeCompressionBar != null) && fTimeCompressionBar.isDisposed())) {
- return;
- }
- setFrame(frame);
+ getSDWidget().getDisplay().syncExec(() -> {
+ if (getSDWidget() == null || getSDWidget().isDisposed() ||
+ ((fTimeCompressionBar != null) && fTimeCompressionBar.isDisposed())) {
+ return;
}
+ setFrame(frame);
});
}
@@ -945,14 +936,11 @@ public class SDView extends ViewPart implements IPartListener {
* @param sm The node to make visible in view
*/
public void ensureVisibleSync(final GraphNode sm) {
- getSDWidget().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (getSDWidget() == null || getSDWidget().isDisposed()) {
- return;
- }
- getSDWidget().ensureVisible(sm);
+ getSDWidget().getDisplay().syncExec(() -> {
+ if (getSDWidget() == null || getSDWidget().isDisposed()) {
+ return;
}
+ getSDWidget().ensureVisible(sm);
});
}
@@ -966,14 +954,11 @@ public class SDView extends ViewPart implements IPartListener {
if (getSDWidget() == null || getSDWidget().isDisposed()) {
return;
}
- getSDWidget().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (getSDWidget() == null || getSDWidget().isDisposed()) {
- return;
- }
- setFrameAndEnsureVisible(frame, sm);
+ getSDWidget().getDisplay().syncExec(() -> {
+ if (getSDWidget() == null || getSDWidget().isDisposed()) {
+ return;
}
+ setFrameAndEnsureVisible(frame, sm);
});
}
@@ -1001,12 +986,7 @@ public class SDView extends ViewPart implements IPartListener {
return;
}
- getSDWidget().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- setFrameAndEnsureVisible(frame, x, y);
- }
- });
+ getSDWidget().getDisplay().syncExec(() -> setFrameAndEnsureVisible(frame, x, y));
}
/**
@@ -1033,27 +1013,24 @@ public class SDView extends ViewPart implements IPartListener {
return;
}
- getSDWidget().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (getSDWidget() == null || getSDWidget().isDisposed()) {
- return;
+ getSDWidget().getDisplay().asyncExec(() -> {
+ if (getSDWidget() == null || getSDWidget().isDisposed()) {
+ return;
+ }
+ if (wait) {
+ if (fWaitCursor != null && !fWaitCursor.isDisposed()) {
+ fWaitCursor.dispose();
}
- if (wait) {
- if (fWaitCursor != null && !fWaitCursor.isDisposed()) {
- fWaitCursor.dispose();
- }
- fWaitCursor = new Cursor(getSDWidget().getDisplay(), SWT.CURSOR_WAIT);
- getSDWidget().setCursor(fWaitCursor);
- getSDWidget().getDisplay().update();
- } else {
- if (fWaitCursor != null && !fWaitCursor.isDisposed()) {
- fWaitCursor.dispose();
- }
- fWaitCursor = null;
- getSDWidget().setCursor(null);
- getSDWidget().getDisplay().update();
+ fWaitCursor = new Cursor(getSDWidget().getDisplay(), SWT.CURSOR_WAIT);
+ getSDWidget().setCursor(fWaitCursor);
+ getSDWidget().getDisplay().update();
+ } else {
+ if (fWaitCursor != null && !fWaitCursor.isDisposed()) {
+ fWaitCursor.dispose();
}
+ fWaitCursor = null;
+ getSDWidget().setCursor(null);
+ getSDWidget().getDisplay().update();
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDWidget.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDWidget.java
index 1a1fb04b2c..ba9fc147b6 100755
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDWidget.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/SDWidget.java
@@ -51,8 +51,6 @@ import org.eclipse.swt.widgets.Caret;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.ITmfImageConstants;
@@ -265,14 +263,7 @@ public class SDWidget extends ScrollView implements SelectionListener,
super.addDisposeListener(this);
fScrollToolTip = new DiagramToolTip(c);
- getVerticalBar().addListener(SWT.MouseUp, new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- fScrollToolTip.hideToolTip();
- }
-
- });
+ getVerticalBar().addListener(SWT.MouseUp, event -> fScrollToolTip.hideToolTip());
fAccessible = getViewControl().getAccessible();
fAccessible.addAccessibleListener(new AccessibleAdapter() {
@@ -1839,16 +1830,13 @@ public class SDWidget extends ScrollView implements SelectionListener,
if ((display == null) || (display.isDisposed())) {
return;
}
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fSdWidget.isDisposed()) {
- return;
- }
- fSdWidget.fDragX += fDeltaX;
- fSdWidget.fDragY += fDeltaY;
- fSdWidget.scrollBy(fDeltaX, fDeltaY);
+ display.asyncExec(() -> {
+ if (fSdWidget.isDisposed()) {
+ return;
}
+ fSdWidget.fDragX += fDeltaX;
+ fSdWidget.fDragY += fDeltaY;
+ fSdWidget.scrollBy(fDeltaX, fDeltaY);
});
}
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/ScrollView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/ScrollView.java
index 1807e20e3b..7223c46fea 100755
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/ScrollView.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/ScrollView.java
@@ -25,7 +25,6 @@ import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -232,28 +231,22 @@ public class ScrollView extends Composite {
setLayout(new SVLayout());
- fLocalPaintListener = new PaintListener() {
- @Override
- public void paintControl(PaintEvent event) {
- // use clipping, to reduce cost of paint.
- Rectangle r = event.gc.getClipping();
- int cx = viewToContentsX(r.x);
- int cy = viewToContentsY(r.y);
- drawContents(event.gc, cx, cy, r.width, r.height);
- }
+ fLocalPaintListener = event -> {
+ // use clipping, to reduce cost of paint.
+ Rectangle r = event.gc.getClipping();
+ int cx = viewToContentsX(r.x);
+ int cy = viewToContentsY(r.y);
+ drawContents(event.gc, cx, cy, r.width, r.height);
};
fViewControl.addPaintListener(fLocalPaintListener);
- fLocalMouseMoveListener = new MouseMoveListener() {
- @Override
- public void mouseMove(MouseEvent e) {
- int ox = e.x, oy = e.y;
- e.x = viewToContentsX(e.x);
- e.y = viewToContentsY(e.y);
- contentsMouseMoveEvent(e);
- e.x = ox;
- e.y = oy;
- }
+ fLocalMouseMoveListener = e -> {
+ int ox = e.x, oy = e.y;
+ e.x = viewToContentsX(e.x);
+ e.y = viewToContentsY(e.y);
+ contentsMouseMoveEvent(e);
+ e.x = ox;
+ e.y = oy;
};
fViewControl.addMouseMoveListener(fLocalMouseMoveListener);
@@ -864,12 +857,9 @@ public class ScrollView extends Composite {
if ((display == null) || display.isDisposed()) {
return;
}
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if (!scrollView.isDisposed()) {
- scrollView.scrollBy(deltaX, deltaY);
- }
+ display.asyncExec(() -> {
+ if (!scrollView.isDisposed()) {
+ scrollView.scrollBy(deltaX, deltaY);
}
});
}
@@ -1849,12 +1839,7 @@ public class ScrollView extends Composite {
protected void overviewAppear(int mx, int my) {
if (fOverview == null) {
fOverview = new Shell(getShell(), SWT.ON_TOP | SWT.NO_BACKGROUND);
- fOverview.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- drawOverview(e.gc, fOverview.getClientArea());
- }
- });
+ fOverview.addPaintListener(e -> drawOverview(e.gc, fOverview.getClientArea()));
}
// always the same..
fOverview.setForeground(fViewControl.getForeground());
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/TimeCompressionBar.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/TimeCompressionBar.java
index 414b27318a..aa9c9372ef 100755
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/TimeCompressionBar.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/TimeCompressionBar.java
@@ -659,12 +659,7 @@ public class TimeCompressionBar extends ScrollView implements DisposeListener {
* the second message
*/
public void highlightRegionSync(final BaseMessage mes1, final BaseMessage mes2) {
- getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- highlightRegion(mes1, mes2);
- }
- });
+ getDisplay().syncExec(() -> highlightRegion(mes1, mes2));
}
@Override
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java
index bccceb74f9..60ce1ab419 100755
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/dialogs/SDPrintDialogUI.java
@@ -21,7 +21,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackListener;
@@ -740,15 +739,11 @@ public class SDPrintDialogUI {
};
- fModifyListener = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- fPagesList = new int[0];
- computeStepXY();
- fTotalPages.setText(Integer.valueOf(maxNumOfPages()).toString());
- fOverviewCanvas.redraw();
- }
-
+ fModifyListener = e -> {
+ fPagesList = new int[0];
+ computeStepXY();
+ fTotalPages.setText(Integer.valueOf(maxNumOfPages()).toString());
+ fOverviewCanvas.redraw();
};
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
index 034a8d2f44..649587263c 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
@@ -954,33 +954,29 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
fLock.lock();
try {
if (!fView.getSDWidget().isDisposed()) {
- fView.getSDWidget().getDisplay().asyncExec(new Runnable() {
+ fView.getSDWidget().getDisplay().asyncExec(() -> {
- @Override
- public void run() {
-
- fLock.lock();
- try {
- // check if view was disposed in the meanwhile
- if ((fView != null) && (!fView.getSDWidget().isDisposed())) {
- fFrame = frame;
- fView.setFrame(fFrame);
-
- if (fCurrentTime != null) {
- moveToMessageInPage();
- }
+ fLock.lock();
+ try {
+ // check if view was disposed in the meanwhile
+ if ((fView != null) && (!fView.getSDWidget().isDisposed())) {
+ fFrame = frame;
+ fView.setFrame(fFrame);
- if (fFindCriteria != null) {
- find(fFindCriteria);
- }
+ if (fCurrentTime != null) {
+ moveToMessageInPage();
+ }
- fView.toggleWaitCursorAsync(false);
+ if (fFindCriteria != null) {
+ find(fFindCriteria);
}
- } finally {
- fLock.unlock();
- }
+ fView.toggleWaitCursorAsync(false);
+ }
+ } finally {
+ fLock.unlock();
}
+
});
}
} finally {
@@ -1045,12 +1041,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
}
} else {
// Not in GUI thread - queue action in GUI thread.
- fView.getSDWidget().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- moveToMessageInPage();
- }
- });
+ fView.getSDWidget().getDisplay().asyncExec(this::moveToMessageInPage);
}
}
} finally {
@@ -1293,13 +1284,7 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
*/
fIsSelect = false;
if (!fView.getSDWidget().isDisposed()) {
- fView.getSDWidget().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- moveToMessage();
- }
- });
+ fView.getSDWidget().getDisplay().asyncExec(() -> moveToMessage());
}
} else {
if (monitor.isCanceled()) {
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java
index 4cb5a0e06d..0169c41457 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java
@@ -152,21 +152,18 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
} catch (InterruptedException e) {
}
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fSliderThrottler != SliderThrottler.this) {
- return;
- }
- fSliderThrottler = null;
- if (SliderThrottler.this.isInterrupted() || fSlider.isDisposed()) {
- return;
- }
- Event event = new Event();
- event.widget = TmfRawEventViewer.this;
- event.detail = SWT.NONE;
- widgetSelected(new SelectionEvent(event));
+ Display.getDefault().asyncExec(() -> {
+ if (fSliderThrottler != SliderThrottler.this) {
+ return;
+ }
+ fSliderThrottler = null;
+ if (SliderThrottler.this.isInterrupted() || fSlider.isDisposed()) {
+ return;
}
+ Event event = new Event();
+ event.widget = TmfRawEventViewer.this;
+ event.detail = SWT.NONE;
+ widgetSelected(new SelectionEvent(event));
});
}
}
@@ -285,12 +282,7 @@ public class TmfRawEventViewer extends Composite implements ControlListener, Sel
fStyledText.addMouseTrackListener(this);
fStyledText.addMouseWheelListener(this);
/* disable mouse scroll of horizontal scroll bar */
- fStyledText.addListener(SWT.MouseWheel, new Listener() {
- @Override
- public void handleEvent(Event event) {
- event.doit = false;
- }
- });
+ fStyledText.addListener(SWT.MouseWheel, event -> event.doit = false);
fStyledText.addKeyListener(this);
fTextArea.setBackground(fStyledText.getBackground());
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java
index d3f959876a..73743cea0d 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java
@@ -29,8 +29,6 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.DialogSettings;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -52,8 +50,6 @@ import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.MenuDetectListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseWheelListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
@@ -69,7 +65,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Slider;
import org.eclipse.swt.widgets.Tree;
@@ -232,25 +227,22 @@ public class TimeGraphViewer extends Viewer implements ITimeDataProvider, IMarke
return;
}
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fListenerNotifier != ListenerNotifier.this) {
- return;
- }
- fListenerNotifier = null;
- if (ListenerNotifier.this.isInterrupted() || fTimeAlignedComposite.isDisposed()) {
- return;
- }
- if (fSelectionChanged) {
- fireSelectionChanged(fSelectedEntry);
- }
- if (fTimeRangeUpdated) {
- fireTimeRangeUpdated(fTime0, fTime1);
- }
- if (fTimeSelected) {
- fireTimeSelected(fSelectionBegin, fSelectionEnd);
- }
+ Display.getDefault().asyncExec(() -> {
+ if (fListenerNotifier != ListenerNotifier.this) {
+ return;
+ }
+ fListenerNotifier = null;
+ if (ListenerNotifier.this.isInterrupted() || fTimeAlignedComposite.isDisposed()) {
+ return;
+ }
+ if (fSelectionChanged) {
+ fireSelectionChanged(fSelectedEntry);
+ }
+ if (fTimeRangeUpdated) {
+ fireTimeRangeUpdated(fTime0, fTime1);
+ }
+ if (fTimeSelected) {
+ fireTimeSelected(fSelectionBegin, fSelectionEnd);
}
});
}
@@ -559,17 +551,14 @@ public class TimeGraphViewer extends Viewer implements ITimeDataProvider, IMarke
fTimeScaleCtrl.setTimeProvider(fTimeDataProvider);
fTimeScaleCtrl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
fTimeScaleCtrl.setHeight(fTimeScaleHeight);
- fTimeScaleCtrl.addMouseWheelListener(new MouseWheelListener() {
- @Override
- public void mouseScrolled(MouseEvent e) {
- if (e.count == 0) {
- return;
- }
- if ((e.stateMask & SWT.CTRL) != 0) {
- fTimeGraphCtrl.zoom(e.count > 0);
- } else {
- fTimeGraphCtrl.horizontalScroll(e.count > 0);
- }
+ fTimeScaleCtrl.addMouseWheelListener(e -> {
+ if (e.count == 0) {
+ return;
+ }
+ if ((e.stateMask & SWT.CTRL) != 0) {
+ fTimeGraphCtrl.zoom(e.count > 0);
+ } else {
+ fTimeGraphCtrl.horizontalScroll(e.count > 0);
}
});
@@ -586,34 +575,31 @@ public class TimeGraphViewer extends Viewer implements ITimeDataProvider, IMarke
fTimeGraphCtrl.setTimeGraphScale(fTimeScaleCtrl);
fTimeGraphCtrl.addSelectionListener(this);
fTimeGraphCtrl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
- fTimeGraphCtrl.addMouseWheelListener(new MouseWheelListener() {
- @Override
- public void mouseScrolled(MouseEvent e) {
- if (e.count == 0) {
- return;
- }
- /*
- * On some platforms the mouse scroll event is sent to the
- * control that has focus even if it is not under the cursor.
- * Handle the event only if not over the time graph control.
- */
- Point ctrlParentCoords = fTimeAlignedComposite.toControl(fTimeGraphCtrl.toDisplay(e.x, e.y));
- Point scrollBarParentCoords = fTimeAlignedComposite.toControl(fTimeGraphCtrl.toDisplay(e.x, e.y));
- if (fTimeGraphCtrl.getBounds().contains(ctrlParentCoords)) {
- /* the time graph control handles the event */
- adjustVerticalScrollBar();
- } else if (fTimeScaleCtrl.getBounds().contains(ctrlParentCoords)
- || fMarkerAxisCtrl.getBounds().contains(ctrlParentCoords)
- || fHorizontalScrollBar.getBounds().contains(scrollBarParentCoords)) {
- if ((e.stateMask & SWT.CTRL) != 0) {
- fTimeGraphCtrl.zoom(e.count > 0);
- } else {
- fTimeGraphCtrl.horizontalScroll(e.count > 0);
- }
+ fTimeGraphCtrl.addMouseWheelListener(e -> {
+ if (e.count == 0) {
+ return;
+ }
+ /*
+ * On some platforms the mouse scroll event is sent to the
+ * control that has focus even if it is not under the cursor.
+ * Handle the event only if not over the time graph control.
+ */
+ Point ctrlParentCoords = fTimeAlignedComposite.toControl(fTimeGraphCtrl.toDisplay(e.x, e.y));
+ Point scrollBarParentCoords = fTimeAlignedComposite.toControl(fTimeGraphCtrl.toDisplay(e.x, e.y));
+ if (fTimeGraphCtrl.getBounds().contains(ctrlParentCoords)) {
+ /* the time graph control handles the event */
+ adjustVerticalScrollBar();
+ } else if (fTimeScaleCtrl.getBounds().contains(ctrlParentCoords)
+ || fMarkerAxisCtrl.getBounds().contains(ctrlParentCoords)
+ || fHorizontalScrollBar.getBounds().contains(scrollBarParentCoords)) {
+ if ((e.stateMask & SWT.CTRL) != 0) {
+ fTimeGraphCtrl.zoom(e.count > 0);
} else {
- /* over the vertical scroll bar or outside of the viewer */
- setTopIndex(getTopIndex() - e.count);
+ fTimeGraphCtrl.horizontalScroll(e.count > 0);
}
+ } else {
+ /* over the vertical scroll bar or outside of the viewer */
+ setTopIndex(getTopIndex() - e.count);
}
});
fTimeGraphCtrl.addKeyListener(new KeyAdapter() {
@@ -667,17 +653,14 @@ public class TimeGraphViewer extends Viewer implements ITimeDataProvider, IMarke
fMarkerAxisCtrl = createTimeGraphMarkerAxis(fTimeAlignedComposite, fColorScheme, this);
fMarkerAxisCtrl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 3, 1));
fMarkerAxisCtrl.addMarkerAxisListener(this);
- fMarkerAxisCtrl.addMouseWheelListener(new MouseWheelListener() {
- @Override
- public void mouseScrolled(MouseEvent e) {
- if (e.count == 0) {
- return;
- }
- if ((e.stateMask & SWT.CTRL) != 0) {
- fTimeGraphCtrl.zoom(e.count > 0);
- } else {
- fTimeGraphCtrl.horizontalScroll(e.count > 0);
- }
+ fMarkerAxisCtrl.addMouseWheelListener(e -> {
+ if (e.count == 0) {
+ return;
+ }
+ if ((e.stateMask & SWT.CTRL) != 0) {
+ fTimeGraphCtrl.zoom(e.count > 0);
+ } else {
+ fTimeGraphCtrl.horizontalScroll(e.count > 0);
}
});
@@ -689,38 +672,32 @@ public class TimeGraphViewer extends Viewer implements ITimeDataProvider, IMarke
GridData layoutData = new GridData(SWT.FILL, SWT.TOP, false, false);
layoutData.widthHint = 0;
fHorizontalScrollBar.setLayoutData(layoutData); //(SWT.FILL, SWT.DEFAULT, true, false));
- fHorizontalScrollBar.addListener(SWT.MouseWheel, new Listener() {
- @Override
- public void handleEvent(Event event) {
- // don't handle the immediately following SWT.Selection event
- event.doit = false;
- if (event.count == 0) {
- return;
- }
- if ((event.stateMask & SWT.CTRL) != 0) {
- fTimeGraphCtrl.zoom(event.count > 0);
- } else {
- fTimeGraphCtrl.horizontalScroll(event.count > 0);
- }
+ fHorizontalScrollBar.addListener(SWT.MouseWheel, event -> {
+ // don't handle the immediately following SWT.Selection event
+ event.doit = false;
+ if (event.count == 0) {
+ return;
}
- });
- fHorizontalScrollBar.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- int start = fHorizontalScrollBar.getSelection();
- long time0 = getTime0();
- long time1 = getTime1();
- long timeMin = getMinTime();
- long timeMax = getMaxTime();
- long delta = timeMax - timeMin;
-
- long range = time1 - time0;
- time0 = timeMin + Math.round(delta * ((double) start / H_SCROLLBAR_MAX));
- time1 = time0 + range;
-
- setStartFinishTimeNotify(time0, time1);
+ if ((event.stateMask & SWT.CTRL) != 0) {
+ fTimeGraphCtrl.zoom(event.count > 0);
+ } else {
+ fTimeGraphCtrl.horizontalScroll(event.count > 0);
}
});
+ fHorizontalScrollBar.addListener(SWT.Selection, event -> {
+ int start = fHorizontalScrollBar.getSelection();
+ long time0 = getTime0();
+ long time1 = getTime1();
+ long timeMin = getMinTime();
+ long timeMax = getMaxTime();
+ long delta = timeMax - timeMin;
+
+ long range = time1 - time0;
+ time0 = timeMin + Math.round(delta * ((double) start / H_SCROLLBAR_MAX));
+ time1 = time0 + range;
+
+ setStartFinishTimeNotify(time0, time1);
+ });
Composite filler3 = new Composite(fTimeAlignedComposite, SWT.NONE);
filler3.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
@@ -2533,19 +2510,16 @@ public class TimeGraphViewer extends Viewer implements ITimeDataProvider, IMarke
if (fMarkersMenu == null) {
fMarkersMenu = new MenuManager(Messages.TmfTimeGraphViewer_ShowMarkersMenuText);
fMarkersMenu.setRemoveAllWhenShown(true);
- fMarkersMenu.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- for (String category : fMarkerCategories) {
- final Action action = new Action(category, IAction.AS_CHECK_BOX) {
- @Override
- public void runWithEvent(Event event) {
- setMarkerCategoryVisible(getText(), isChecked());
- }
- };
- action.setChecked(!fHiddenMarkerCategories.contains(category));
- manager.add(action);
- }
+ fMarkersMenu.addMenuListener(manager -> {
+ for (String category : fMarkerCategories) {
+ final Action action = new Action(category, IAction.AS_CHECK_BOX) {
+ @Override
+ public void runWithEvent(Event event) {
+ setMarkerCategoryVisible(getText(), isChecked());
+ }
+ };
+ action.setChecked(!fHiddenMarkerCategories.contains(category));
+ manager.add(action);
}
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java
index 1f41c48b8f..089ce155cd 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphFilterDialog.java
@@ -293,20 +293,17 @@ public class TimeGraphFilterDialog extends SelectionStatusDialog {
@Override
public void create() {
- BusyIndicator.showWhile(null, new Runnable() {
- @Override
- public void run() {
- TimeGraphFilterDialog.super.create();
- fTree.setCheckedElements(getInitialElementSelections()
- .toArray());
- if (fExpandedElements != null) {
- fTree.getViewer().setExpandedElements(fExpandedElements);
- }
- for (TreeColumn column : fTree.getViewer().getTree().getColumns()) {
- column.pack();
- }
- updateOKStatus();
+ BusyIndicator.showWhile(null, () -> {
+ TimeGraphFilterDialog.super.create();
+ fTree.setCheckedElements(getInitialElementSelections()
+ .toArray());
+ if (fExpandedElements != null) {
+ fTree.getViewer().setExpandedElements(fExpandedElements);
+ }
+ for (TreeColumn column : fTree.getViewer().getTree().getColumns()) {
+ column.pack();
}
+ updateOKStatus();
});
}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java
index e1bae22236..15f780c447 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java
@@ -47,9 +47,7 @@ import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
@@ -422,12 +420,7 @@ public class TimeGraphLegend extends TitleAreaDialog {
fColor = fResourceManager.createColor(rgb);
setForeground(fColor);
- addListener(SWT.Paint, new Listener() {
- @Override
- public void handleEvent(Event event) {
- draw(event.gc);
- }
- });
+ addListener(SWT.Paint, event -> draw(event.gc));
}
public void setColor(RGB rgb) {
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/virtualtable/TmfVirtualTable.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/virtualtable/TmfVirtualTable.java
index 9367d7d7c6..a9905eba90 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/virtualtable/TmfVirtualTable.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/virtualtable/TmfVirtualTable.java
@@ -28,9 +28,6 @@ import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseWheelListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -115,18 +112,15 @@ public class TmfVirtualTable extends Composite {
} catch (InterruptedException e) {
}
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fSliderThrottler != SliderThrottler.this) {
- return;
- }
- fSliderThrottler = null;
- if (SliderThrottler.this.isInterrupted() || fTable.isDisposed()) {
- return;
- }
- refreshTable();
+ Display.getDefault().asyncExec(() -> {
+ if (fSliderThrottler != SliderThrottler.this) {
+ return;
}
+ fSliderThrottler = null;
+ if (SliderThrottler.this.isInterrupted() || fTable.isDisposed()) {
+ return;
+ }
+ refreshTable();
});
}
}
@@ -169,34 +163,25 @@ public class TmfVirtualTable extends Composite {
fSlider.setLayoutData(sliderGridData);
// Add the listeners
- fTable.addMouseWheelListener(new MouseWheelListener() {
- @Override
- public void mouseScrolled(MouseEvent event) {
- if (fTableItemCount <= fFullyVisibleRows || event.count == 0) {
- return;
- }
- fTableTopEventRank -= event.count;
- if (fTableTopEventRank < 0) {
- fTableTopEventRank = 0;
- }
- int latestFirstRowOffset = fTableItemCount - fFullyVisibleRows;
- if (fTableTopEventRank > latestFirstRowOffset) {
- fTableTopEventRank = latestFirstRowOffset;
- }
-
- fSlider.setSelection(fTableTopEventRank);
- refreshTable();
+ fTable.addMouseWheelListener(event -> {
+ if (fTableItemCount <= fFullyVisibleRows || event.count == 0) {
+ return;
}
- });
-
- fTable.addListener(SWT.MouseWheel, new Listener() {
- // disable mouse scroll of horizontal scroll bar
- @Override
- public void handleEvent(Event event) {
- event.doit = false;
+ fTableTopEventRank -= event.count;
+ if (fTableTopEventRank < 0) {
+ fTableTopEventRank = 0;
}
+ int latestFirstRowOffset = fTableItemCount - fFullyVisibleRows;
+ if (fTableTopEventRank > latestFirstRowOffset) {
+ fTableTopEventRank = latestFirstRowOffset;
+ }
+
+ fSlider.setSelection(fTableTopEventRank);
+ refreshTable();
});
+ fTable.addListener(SWT.MouseWheel, event -> event.doit = false);
+
fResizeListener = new ControlAdapter() {
@Override
public void controlResized(ControlEvent event) {
@@ -211,29 +196,26 @@ public class TmfVirtualTable extends Composite {
// Implement a "fake" tooltip
final String TOOLTIP_DATA_KEY = "_TABLEITEM"; //$NON-NLS-1$
- final Listener labelListener = new Listener() {
- @Override
- public void handleEvent (Event event) {
- Label label = (Label) event.widget;
- Shell shell = label.getShell();
- switch (event.type) {
- case SWT.MouseDown:
- Event e = new Event();
- e.item = (TableItem) label.getData(TOOLTIP_DATA_KEY);
- // Assuming table is single select, set the selection as if
- // the mouse down event went through to the table
- fTable.setSelection(new TableItem [] {(TableItem) e.item});
- fTable.notifyListeners(SWT.Selection, e);
- shell.dispose();
- fTable.setFocus();
- break;
- case SWT.MouseExit:
- case SWT.MouseWheel:
- shell.dispose();
- break;
- default:
- break;
- }
+ final Listener labelListener = event -> {
+ Label label = (Label) event.widget;
+ Shell shell = label.getShell();
+ switch (event.type) {
+ case SWT.MouseDown:
+ Event e = new Event();
+ e.item = (TableItem) label.getData(TOOLTIP_DATA_KEY);
+ // Assuming table is single select, set the selection as if
+ // the mouse down event went through to the table
+ fTable.setSelection(new TableItem [] {(TableItem) e.item});
+ fTable.notifyListeners(SWT.Selection, e);
+ shell.dispose();
+ fTable.setFocus();
+ break;
+ case SWT.MouseExit:
+ case SWT.MouseWheel:
+ shell.dispose();
+ break;
+ default:
+ break;
}
};
@@ -355,18 +337,15 @@ public class TmfVirtualTable extends Composite {
});
fTable.addListener(
- SWT.MouseDoubleClick, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (doubleClickListener != null) {
- TableItem item = fTable.getItem(new Point (event.x, event.y));
- if (item != null) {
- for (int i = 0; i < fTable.getColumnCount(); i++){
- Rectangle bounds = item.getBounds(i);
- if (bounds.contains(event.x, event.y)){
- doubleClickListener.handleDoubleClick(TmfVirtualTable.this, item, i);
- break;
- }
+ SWT.MouseDoubleClick, event -> {
+ if (doubleClickListener != null) {
+ TableItem item = fTable.getItem(new Point (event.x, event.y));
+ if (item != null) {
+ for (int i = 0; i < fTable.getColumnCount(); i++){
+ Rectangle bounds = item.getBounds(i);
+ if (bounds.contains(event.x, event.y)){
+ doubleClickListener.handleDoubleClick(TmfVirtualTable.this, item, i);
+ break;
}
}
}
@@ -382,14 +361,11 @@ public class TmfVirtualTable extends Composite {
* Also reset the top index to 0 if indicated by the flag that was set
* at table selection of a partially visible table item.
*/
- fTable.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- if (fTable.getTopIndex() != 0 || fResetTopIndex) {
- fTable.setTopIndex(0);
- }
- fResetTopIndex = false;
+ fTable.addPaintListener(e -> {
+ if (fTable.getTopIndex() != 0 || fResetTopIndex) {
+ fTable.setTopIndex(0);
}
+ fResetTopIndex = false;
});
}
@@ -611,36 +587,33 @@ public class TmfVirtualTable extends Composite {
fSlider.setVisible(false);
}
- fSlider.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event event) {
- switch (event.detail) {
- case SWT.ARROW_DOWN:
- case SWT.ARROW_UP:
- case SWT.END:
- case SWT.HOME:
- case SWT.PAGE_DOWN:
- case SWT.PAGE_UP: {
- fTableTopEventRank = fSlider.getSelection();
- refreshTable();
- break;
- }
- case SWT.DRAG:
- case SWT.NONE:
- /*
- * While the slider thumb is being dragged, only perform the
- * refresh periodically. The event detail during the drag is
- * SWT.DRAG on Windows and SWT.NONE on Linux.
- */
- fTableTopEventRank = fSlider.getSelection();
- if (fSliderThrottler == null) {
- fSliderThrottler = new SliderThrottler();
- fSliderThrottler.start();
- }
- break;
- default:
- break;
+ fSlider.addListener(SWT.Selection, event -> {
+ switch (event.detail) {
+ case SWT.ARROW_DOWN:
+ case SWT.ARROW_UP:
+ case SWT.END:
+ case SWT.HOME:
+ case SWT.PAGE_DOWN:
+ case SWT.PAGE_UP: {
+ fTableTopEventRank = fSlider.getSelection();
+ refreshTable();
+ break;
+ }
+ case SWT.DRAG:
+ case SWT.NONE:
+ /*
+ * While the slider thumb is being dragged, only perform the
+ * refresh periodically. The event detail during the drag is
+ * SWT.DRAG on Windows and SWT.NONE on Linux.
+ */
+ fTableTopEventRank = fSlider.getSelection();
+ if (fSliderThrottler == null) {
+ fSliderThrottler = new SliderThrottler();
+ fSliderThrottler.start();
}
+ break;
+ default:
+ break;
}
});

Back to the top