diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/META-INF/MANIFEST.MF b/lttng/org.eclipse.tracecompass.lttng2.control.ui/META-INF/MANIFEST.MF index 2978ac5ae2..8a36528034 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/META-INF/MANIFEST.MF +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor -Bundle-Version: 1.4.1.qualifier +Bundle-Version: 1.5.0.qualifier Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.tracecompass.lttng2.control.ui;singleton:=true Bundle-Activator: org.eclipse.tracecompass.internal.lttng2.control.ui.Activator @@ -42,6 +42,7 @@ Export-Package: org.eclipse.tracecompass.internal.lttng2.control.ui;x-friends:=" org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl;x-friends:="org.eclipse.tracecompass.lttng2.control.ui.tests,org.eclipse.tracecompass.lttng2.control.ui.swtbot.tests", org.eclipse.tracecompass.internal.lttng2.control.ui.views.preferences;x-friends:="org.eclipse.tracecompass.lttng2.control.ui.tests", org.eclipse.tracecompass.internal.lttng2.control.ui.views.property;x-friends:="org.eclipse.tracecompass.lttng2.control.ui.tests", - org.eclipse.tracecompass.internal.lttng2.control.ui.views.service;x-friends:="org.eclipse.tracecompass.lttng2.control.ui.tests,org.eclipse.tracecompass.lttng2.control.ui.swtbot.tests" + org.eclipse.tracecompass.internal.lttng2.control.ui.views.service;x-friends:="org.eclipse.tracecompass.lttng2.control.ui.tests,org.eclipse.tracecompass.lttng2.control.ui.swtbot.tests", + org.eclipse.tracecompass.lttng2.control.ui.views.signals Import-Package: com.google.common.collect Automatic-Module-Name: org.eclipse.tracecompass.lttng2.control.ui diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StartHandler.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StartHandler.java index 5e2ae8e704..59a9bf290a 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StartHandler.java +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StartHandler.java @@ -15,8 +15,15 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.widgets.Display; import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceSessionState; +import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator; import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent; +import org.eclipse.tracecompass.lttng2.control.ui.views.signals.ExternalTraceStartSignal; +import org.eclipse.tracecompass.lttng2.control.ui.views.signals.LTTngSessionStartSignal; +import org.eclipse.tracecompass.lttng2.control.ui.views.signals.LTTngSessionStopSignal; +import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler; +import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; /** *
@@ -27,6 +34,20 @@ */ public class StartHandler extends ChangeSessionStateHandler { + /** + * Constructor + */ + public StartHandler() { + super(); + TmfSignalManager.register(this); + } + + @Override + public void dispose() { + TmfSignalManager.deregister(this); + super.dispose(); + } + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -43,5 +64,35 @@ public TraceSessionState getNewState() { @Override public void changeState(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException { session.startSession(monitor); + TmfSignalManager.dispatchSignal( + new LTTngSessionStartSignal(session)); + } + + /** + * Handle the external trace start signal + * @param signal contains the information of the start external trace + */ + @TmfSignalHandler + public void handle(ExternalTraceStartSignal signal) { + Display.getDefault().asyncExec(() -> { + try { + execute(null); + } catch (ExecutionException e) { + Activator.getDefault().logError("Failed to synchronize with the external trace start signal", e); //$NON-NLS-1$ + } + }); + } + + /** + * Handle the LTTng session stop signal + * @param signal contains the information of the stop LTTng session + */ + @TmfSignalHandler + public void handle(LTTngSessionStopSignal signal) { + Display.getDefault().asyncExec(() -> { + if (signal.getSource() instanceof TraceSessionComponent session && !this.fSessions.contains(session)) { + this.fSessions.add(session); + } + }); } } diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StopHandler.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StopHandler.java index a9baba2cda..b67298c85c 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StopHandler.java +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/StopHandler.java @@ -15,8 +15,15 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.widgets.Display; import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceSessionState; +import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator; import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent; +import org.eclipse.tracecompass.lttng2.control.ui.views.signals.ExternalTraceStopSignal; +import org.eclipse.tracecompass.lttng2.control.ui.views.signals.LTTngSessionStartSignal; +import org.eclipse.tracecompass.lttng2.control.ui.views.signals.LTTngSessionStopSignal; +import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler; +import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; /** *
@@ -27,6 +34,20 @@ */ public class StopHandler extends ChangeSessionStateHandler { + /** + * Constructor + */ + public StopHandler() { + super(); + TmfSignalManager.register(this); + } + + @Override + public void dispose() { + TmfSignalManager.deregister(this); + super.dispose(); + } + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -43,5 +64,35 @@ public TraceSessionState getNewState() { @Override public void changeState(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException { session.stopSession(monitor); + TmfSignalManager.dispatchSignal( + new LTTngSessionStopSignal(session)); + } + + /** + * Handle the external trace stop signal + * @param signal contains the information of the stop external trace + */ + @TmfSignalHandler + public void handle(ExternalTraceStopSignal signal) { + Display.getDefault().asyncExec(() -> { + try { + execute(null); + } catch (ExecutionException e) { + Activator.getDefault().logError("Failed to synchronize with the external trace stop signal", e); //$NON-NLS-1$ + } + }); + } + + /** + * Handle the LTTng session start signal + * @param signal contains the information of the start LTTng session + */ + @TmfSignalHandler + public void handle(LTTngSessionStartSignal signal) { + Display.getDefault().asyncExec(() -> { + if (signal.getSource() instanceof TraceSessionComponent session && !this.fSessions.contains(session)) { + this.fSessions.add(session); + } + }); } } diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/ExternalTraceStartSignal.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/ExternalTraceStartSignal.java new file mode 100644 index 0000000000..4fb5a2ad30 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/ExternalTraceStartSignal.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2026 Renesas Electronics Corp. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Tuan Can - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.tracecompass.lttng2.control.ui.views.signals; + +import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; + +/** + * Signal notify that the External trace have been started + * @since 1.5 + */ +public class ExternalTraceStartSignal extends TmfSignal{ + + private final String sessionName; + + /** + * Constructor + * @param source input source + * @param sessionName external trace + */ + public ExternalTraceStartSignal(Object source, String sessionName) { + super(source); + this.sessionName = sessionName; + } + + /** + * Get the name of the external trace + * @return External trace name + */ + public String getSessionName() { + return sessionName; + } +} diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/ExternalTraceStopSignal.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/ExternalTraceStopSignal.java new file mode 100644 index 0000000000..070f2141e6 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/ExternalTraceStopSignal.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2026 Renesas Electronics Corp. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Tuan Can - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.tracecompass.lttng2.control.ui.views.signals; + +import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; + +/** + * Signal notify that the External trace have been stopped + * @since 1.5 + */ +public class ExternalTraceStopSignal extends TmfSignal{ + + private final String sessionName; + + /** + * Constructor + * @param source input source + * @param sessionName external trace + */ + public ExternalTraceStopSignal(Object source, String sessionName) { + super(source); + this.sessionName = sessionName; + } + + /** + * Get the name of the external trace + * @return External trace name + */ + public String getSessionName() { + return sessionName; + } +} diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionDestroySignal.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionDestroySignal.java new file mode 100644 index 0000000000..3bd5d3332c --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionDestroySignal.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2026 Renesas Electronics Corp. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Tuan Can - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.tracecompass.lttng2.control.ui.views.signals; + +import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; + +/** + * Signal notify that the LTTng session have been destroyed + * @since 1.5 + */ +public class LTTngSessionDestroySignal extends TmfSignal{ + + private final String sessionName; + + /** + * Constructor + * @param source input source + * @param sessionName LTTng session name + */ + public LTTngSessionDestroySignal(Object source, String sessionName) { + super(source); + this.sessionName = sessionName; + } + + /** + * Get the name of the LTTng session + * @return LTTng session name + */ + public String getSessionName() { + return sessionName; + } +} diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionStartSignal.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionStartSignal.java new file mode 100644 index 0000000000..3b214f2119 --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionStartSignal.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2026 Renesas Electronics Corp. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Tuan Can - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.tracecompass.lttng2.control.ui.views.signals; + +import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; + +/** + * Signal notify that the LTTng session have been started + * @since 1.5 + */ +public class LTTngSessionStartSignal extends TmfSignal{ + + + /** + * Constructor + * @param source input source + */ + public LTTngSessionStartSignal(Object source) { + super(source); + } +} diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionStopSignal.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionStopSignal.java new file mode 100644 index 0000000000..82e82e5dae --- /dev/null +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/lttng2/control/ui/views/signals/LTTngSessionStopSignal.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2026 Renesas Electronics Corp. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Tuan Can - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.tracecompass.lttng2.control.ui.views.signals; + +import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; + +/** + * Signal notify that the LTTng session have been stopped + * @since 1.5 + */ +public class LTTngSessionStopSignal extends TmfSignal{ + + /** + * Constructor + * @param source input source + */ + public LTTngSessionStopSignal(Object source) { + super(source); + } +} diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/project/AddProjectNatureTest.java b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/project/AddProjectNatureTest.java index 164dbaa11a..70f68cc5c2 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/project/AddProjectNatureTest.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/project/AddProjectNatureTest.java @@ -251,4 +251,4 @@ private static void toggleFilters(boolean checked) { shell.bot().button(APPLY_BUTTON).click(); } -} +} \ No newline at end of file