/**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Bernd Hufmann - Updated for support of LTTng Tools 2.1
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers;
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
+
/**
* The trace session group the command is to be executed on.
*/
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
+
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final TraceSessionGroup sessionGroup = fSessionGroup;
// Open dialog box for the node name and address
- ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog();
- dialog.setTraceSessionGroup(sessionGroup);
+ final ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog();
+ dialog.initialize(sessionGroup);
if (dialog.open() != Window.OK) {
return null;
}
- final String sessionName = dialog.getSessionName();
- final String sessionPath = dialog.isDefaultSessionPath() ? null : dialog.getSessionPath();
-
Job job = new Job(Messages.TraceControl_CreateSessionJob) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- sessionGroup.createSession(sessionName, sessionPath, monitor);
+ if (dialog.isStreamedTrace()) {
+ sessionGroup.createSession(dialog.getSessionName(), dialog.getNetworkUrl(), dialog.getControlUrl(),
+ dialog.getDataUrl(), dialog.isSnapshot(), monitor);
+ } else {
+ String sessionPath = dialog.isDefaultSessionPath() ? null : dialog.getSessionPath();
+ sessionGroup.createSession(dialog.getSessionName(), sessionPath, dialog.isSnapshot(), monitor);
+ }
} catch (ExecutionException e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e);
}
return null;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- */
@Override
public boolean isEnabled() {