*
* Contributors:
* Patrick Tasse - Initial API and implementation
+ * Bernd Hufmann - Improved trace selection
*******************************************************************************/
package org.eclipse.linuxtools.internal.gdbtrace.ui.views.project.handlers;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
-import org.eclipse.linuxtools.internal.gdbtrace.trace.GdbTrace;
+import org.eclipse.linuxtools.internal.gdbtrace.core.trace.GdbTrace;
import org.eclipse.linuxtools.internal.gdbtrace.ui.views.project.dialogs.SelectTraceExecutableDialog;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.handlers.HandlerUtil;
/**
- * Handler for the Select Trace Excecutable command
+ * Handler for the Select Trace Executable command
* @author Patrick Tasse
*/
public class SelectTraceExecutableHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = HandlerUtil.getActiveShell(event);
+
+ // Get the selection before opening the dialog because otherwise the
+ // getCurrentSelection() call will always return null
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
SelectTraceExecutableDialog dialog = new SelectTraceExecutableDialog(shell);
dialog.open();
if (dialog.getReturnCode() != Window.OK) {
}
IPath tracedExecutable = dialog.getExecutablePath();
- ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
for (Object o : ((IStructuredSelection) selection).toList()) {
TmfTraceElement traceElement = (TmfTraceElement) o;