package org.yamcs.studio.ui.archive;

import java.util.List;

import javax.swing.SwingUtilities;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.handlers.HandlerUtil;
import org.yamcs.studio.core.TimeCatalogue;

public class CreateReplayHandler extends AbstractHandler {

    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
        SwingUtilities.invokeLater(() -> {
            ArchiveView view = (ArchiveView) part;
            long missionTime = TimeCatalogue.getInstance().getMissionTime(true);
            TimeInterval interval = TimeInterval.starting(missionTime);
            List<String> packets = view.archivePanel.getSelectedPackets("tm");
            List<String> pps = view.archivePanel.getSelectedPackets("pp");
            Display.getDefault().asyncExec(() -> {
                CreateReplayDialog dialog = new CreateReplayDialog(Display.getCurrent().getActiveShell());
                dialog.initialize(interval, packets, pps);
                dialog.open();
            });
        });

        return null;
    }
}

@@ -802,24 +802,62 @@
 Time(true);%0A
+            missionTime -= 30 * 1000;%0A
             

Add negative delta to avoid stopping the processor immediately