diff options
Diffstat (limited to 'lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal')
10 files changed, 129 insertions, 226 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java index f021a63cf8..fb61d3d1ee 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java @@ -26,8 +26,8 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; -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.Point; @@ -104,6 +104,10 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog */ private Text fSessionNameText = null; /** + * The label widget for the session path. + */ + private Label fSessionPathLabel = null; + /** * The text widget for the session path. */ private Text fSessionPathText = null; @@ -120,6 +124,10 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog */ private Composite fStreamingComposite = null; /** + * The text widget for the trace path. + */ + private Text fTracePathText = null; + /** * The button to link data protocol/Address with control protocol. */ private Button fLinkDataWithControlButton = null; @@ -131,10 +139,14 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog * A selection listener that copies the protocol from control to data when being linked. */ private ControlProtocolSelectionListener fCopyProtocolSelectionListener; - + /** + * A selection listener updates the control port text depending on the control protocol selected. + */ private ProtocolComboSelectionListener fControlProtocolSelectionListener; + /** + * A selection listener updates the data port text depending on the data protocol selected. + */ private ProtocolComboSelectionListener fDataProtocolSelectionListener; - /** * The text box for the host/IP address of the control channel. */ @@ -142,7 +154,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog /** * A key listener that copies the host address from control to data when being linked. */ - private CopyKeyListener fControlUrlKeyListener; + private CopyModifyListener fControlUrlKeyListener; /** * The text box for the control port. */ @@ -160,14 +172,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog */ private Text fDataPortText = null; /** - * The button to not activate a consumer. - */ - private Button fNoConsumerButton = null; - /** - * The button to disable the consumer. - */ - private Button fDisableConsumerButton = null; - /** * The parent where the new node should be added. */ private TraceSessionGroup fParent = null; @@ -203,13 +207,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog */ private String fDataUrl = null; /** - * Flag for not activating a consumer for this session. - */ - private boolean fIsNoConsumer = false; - /** - * Flag for disabling a consumer for this session. + * The trace path string. */ - private boolean fIsDisableConsumer = false; + private String fTracePath = null; // ------------------------------------------------------------------------ // Constructors @@ -268,8 +268,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fNetworkUrl = null; fControlUrl = null; fDataUrl = null; - fIsNoConsumer = false; - fIsDisableConsumer = false; } @Override @@ -289,16 +287,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog return fDataUrl; } - @Override - public boolean isNoConsumer() { - return fIsNoConsumer; - } - - @Override - public boolean isDisableConsumer() { - return fIsDisableConsumer; - } - // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -351,8 +339,8 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fSessionNameText = new Text(sessionGroup, SWT.NONE); fSessionNameText.setToolTipText(Messages.TraceControl_CreateSessionNameTooltip); - Label sessionPath = new Label(sessionGroup, SWT.RIGHT); - sessionPath.setText(Messages.TraceControl_CreateSessionPathLabel); + fSessionPathLabel = new Label(sessionGroup, SWT.RIGHT); + fSessionPathLabel.setText(Messages.TraceControl_CreateSessionPathLabel); fSessionPathText = new Text(sessionGroup, SWT.NONE); fSessionPathText.setToolTipText(Messages.TraceControl_CreateSessionPathTooltip); @@ -367,38 +355,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fSessionPathText.setLayoutData(data); if (fParent.isNetworkStreamingSupported()) { - fNoConsumerButton = new Button(sessionGroup, SWT.CHECK); - fNoConsumerButton.setText(Messages.TraceControl_CreateSessionNoConsumertText); - fNoConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionNoConsumertTooltip); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - fNoConsumerButton.setLayoutData(data); - - fDisableConsumerButton = new Button(sessionGroup, SWT.CHECK); - fDisableConsumerButton.setText(Messages.TraceControl_CreateSessionDisableConsumertText); - fDisableConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionDisableConsumertTooltip); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - fDisableConsumerButton.setLayoutData(data); - - fNoConsumerButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (fNoConsumerButton.getSelection()) { - fDisableConsumerButton.setSelection(false); - } - } - }); - - fDisableConsumerButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (fDisableConsumerButton.getSelection()) { - fNoConsumerButton.setSelection(false); - } - } - }); - createAdvancedOptionsComposite(); } @@ -412,7 +368,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fMainStreamingGroup.setLayout(new GridLayout(1, true)); fConfigureStreamingButton = new Button(fMainStreamingGroup, SWT.PUSH); - fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$ + fConfigureStreamingButton.setText(Messages.TraceControl_CreateSessionConfigureStreamingButtonText + " >>>"); //$NON-NLS-1$ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip); fConfigureStreamingButton.addSelectionListener(new SelectionAdapter() { @Override @@ -421,11 +377,16 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fIsStreamedTrace = false; fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip); + fSessionPathText.setEnabled(true); + fSessionPathLabel.setText(Messages.TraceControl_CreateSessionPathLabel); disposeConfigureStreamingComposite(); } else { fIsStreamedTrace = true; fConfigureStreamingButton.setText("<<< " + Messages.TraceControl_CreateSessionNoStreamingButtonText); //$NON-NLS-1$ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionNoStreamingButtonTooltip); + fSessionPathText.setEnabled(false); + fSessionPathText.setText(""); //$NON-NLS-1$ + fSessionPathLabel.setText(""); //$NON-NLS-1$ createConfigureStreamingComposite(); } @@ -450,10 +411,20 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog urlGroup.setLayout(layout); urlGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); + Label tracePathLabel = new Label(urlGroup, SWT.RIGHT); + tracePathLabel.setText(Messages.TraceControl_CreateSessionTracePathText); + fTracePathText = new Text(urlGroup, SWT.NONE); + fTracePathText.setToolTipText(Messages.TraceControl_CreateSessionTracePathTooltip); + + // layout widgets + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 6; + fTracePathText.setLayoutData(data); + fLinkDataWithControlButton = new Button(urlGroup, SWT.CHECK); fLinkDataWithControlButton.setText(Messages.TraceControl_CreateSessionLinkButtonText); fLinkDataWithControlButton.setToolTipText(Messages.TraceControl_CreateSessionLinkButtonTooltip); - GridData data = new GridData(GridData.FILL_HORIZONTAL); + data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 7; fLinkDataWithControlButton.setLayoutData(data); fLinkDataWithControlButton.setSelection(true); @@ -545,19 +516,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener); - fControlUrlKeyListener = new CopyKeyListener(fControlHostAddressText, fDataHostAddressText); - fControlHostAddressText.addKeyListener(fControlUrlKeyListener); - -// InetAddress inet = null; -// try { -// inet = InetAddress.getLocalHost(); -// inet = InetAddress.getByName(inet.getHostName()); -// } catch (UnknownHostException e1) { -// } -// if (inet != null) { -// fControlUrlAddressText.setText(inet.getHostAddress()); -// fDataUrlAddressText.setText(inet.getHostAddress()); -// } + fControlUrlKeyListener = new CopyModifyListener(fControlHostAddressText, fDataHostAddressText); + fControlHostAddressText.addModifyListener(fControlUrlKeyListener); + fControlProtocolCombo.select(DEFAULT_URL_INDEX); fDataProtocolCombo.select(DEFAULT_URL_INDEX); @@ -575,7 +536,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlProtocolCombo.removeSelectionListener(fControlProtocolSelectionListener); fDataProtocolCombo.removeSelectionListener(fDataProtocolSelectionListener); fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener); - fControlHostAddressText.addKeyListener(fControlUrlKeyListener); + fControlHostAddressText.addModifyListener(fControlUrlKeyListener); // Get previous selection and validate int currentSelection = fControlProtocolCombo.getSelectionIndex() <= COMMON_URL_LAST_INDEX ? @@ -606,7 +567,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlProtocolCombo.removeSelectionListener(fCopyProtocolSelectionListener); fControlProtocolCombo.addSelectionListener(fControlProtocolSelectionListener); fDataProtocolCombo.addSelectionListener(fDataProtocolSelectionListener); - fControlHostAddressText.removeKeyListener(fControlUrlKeyListener); + fControlHostAddressText.removeModifyListener(fControlUrlKeyListener); // Update combo box items int currentSelection = fControlProtocolCombo.getSelectionIndex(); @@ -706,6 +667,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fDataUrl = null; if (fIsStreamedTrace) { + // Validate input data + fTracePath = fTracePathText.getText(); + if (fControlProtocolCombo.getSelectionIndex() < 0) { MessageDialog.openError(getShell(), Messages.TraceControl_CreateSessionDialogTitle, @@ -739,19 +703,19 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlHostAddressText.getText(), fControlPortText.getText(), null, - fSessionPath); + fTracePath); fDataUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()), fDataHostAddressText.getText(), null, fDataPortText.getText(), - fSessionPath); + fTracePath); } else { fNetworkUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()), fControlHostAddressText.getText(), fControlPortText.getText(), fDataPortText.getText(), - fSessionPath); + fTracePath); } } @@ -771,11 +735,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog return; } - if (fParent.isNetworkStreamingSupported()) { - fIsNoConsumer = fNoConsumerButton.getSelection(); - fIsDisableConsumer = fDisableConsumerButton.getSelection(); - } - // validation successful -> call super.okPressed() super.okPressed(); } @@ -804,17 +763,17 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog return stringBuilder.toString(); } - private static class CopyKeyListener extends KeyAdapter { + private static class CopyModifyListener implements ModifyListener { private Text fSource; private Text fDestination; - public CopyKeyListener(Text source, Text destination) { + public CopyModifyListener(Text source, Text destination) { fSource = source; fDestination = destination; } @Override - public void keyReleased(KeyEvent e) { + public void modifyText(ModifyEvent e) { fDestination.setText(fSource.getText()); } } diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java index c7f6b10803..066b1458a6 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java @@ -77,16 +77,6 @@ public interface ICreateSessionDialog { */ public String getDataUrl(); - /** - * @return for not activating a consumer for this session - */ - public boolean isNoConsumer(); - - /** - * @return for disabling a consumer for this session - */ - public boolean isDisableConsumer(); - // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java index aaaefe96ba..a53477ed42 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java @@ -80,4 +80,4 @@ public interface IEnableUstEvents { */ public String getFilterExpression(); -}
\ No newline at end of file +} diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java index 2377ac3043..e42d9c31f4 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java @@ -74,11 +74,10 @@ public class CreateSessionHandler extends BaseControlViewHandler { try { if (dialog.isStreamedTrace()) { sessionGroup.createSession(dialog.getSessionName(), dialog.getNetworkUrl(), dialog.getControlUrl(), - dialog.getDataUrl(), dialog.isNoConsumer(), dialog.isDisableConsumer(), monitor); + dialog.getDataUrl(), monitor); } else { String sessionPath = dialog.isDefaultSessionPath() ? null : dialog.getSessionPath(); - sessionGroup.createSession(dialog.getSessionName(), sessionPath, dialog.isNoConsumer(), - dialog.isDisableConsumer(), monitor); + sessionGroup.createSession(dialog.getSessionName(), sessionPath, monitor); } } catch (ExecutionException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e); diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java index 61afa31d15..cad9d6b7db 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java @@ -103,6 +103,8 @@ final public class Messages extends NLS { public static String TraceControl_CreateSessionConfigureStreamingButtonTooltip; public static String TraceControl_CreateSessionNoStreamingButtonText; public static String TraceControl_CreateSessionNoStreamingButtonTooltip; + public static String TraceControl_CreateSessionTracePathText; + public static String TraceControl_CreateSessionTracePathTooltip; public static String TraceControl_CreateSessionLinkButtonText; public static String TraceControl_CreateSessionLinkButtonTooltip; public static String TraceControl_CreateSessionProtocolLabelText; diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties index e6a89c578a..0001a33226 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties @@ -82,10 +82,12 @@ TraceControl_CreateSessionNameTooltip=The name of the session to be created. TraceControl_CreateSessionPathLabel=Session Path TraceControl_CreateSessionPathTooltip=The session path (keep empty for default location) -TraceControl_CreateSessionConfigureStreamingButtonText=Configure Streaming -TraceControl_CreateSessionConfigureStreamingButtonTooltip=Configure streaming parameters -TraceControl_CreateSessionNoStreamingButtonText=Remove Streaming -TraceControl_CreateSessionNoStreamingButtonTooltip=Remove streaming configuration +TraceControl_CreateSessionConfigureStreamingButtonText=Advanced +TraceControl_CreateSessionConfigureStreamingButtonTooltip=Configure advanced options +TraceControl_CreateSessionNoStreamingButtonText=Basic +TraceControl_CreateSessionNoStreamingButtonTooltip=Use basic options +TraceControl_CreateSessionTracePathText=Trace Path +TraceControl_CreateSessionTracePathTooltip=The trace path (keep empty for default location) TraceControl_CreateSessionLinkButtonText=Synchronize data with control configuration TraceControl_CreateSessionLinkButtonTooltip=Synchronize data protocol and host address with control channel configuration TraceControl_CreateSessionProtocolLabelText=Protocol diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java index 20e315d99a..8dea7aeb06 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java @@ -1,5 +1,5 @@ /********************************************************************** - * 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 @@ -8,6 +8,7 @@ * * 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.model.impl; @@ -108,15 +109,11 @@ public class TraceSessionGroup extends TraceControlComponent { * - a session name to create * @param sessionPath * - a path for storing the traces (use null for default) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer) throws ExecutionException { - createSession(sessionName, sessionPath, noConsumer, disableConsumer, new NullProgressMonitor()); + public void createSession(String sessionName, String sessionPath) throws ExecutionException { + createSession(sessionName, sessionPath, new NullProgressMonitor()); } /** @@ -126,17 +123,13 @@ public class TraceSessionGroup extends TraceControlComponent { * - a session name to create * @param sessionPath * - a path for storing the traces (use null for default) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @param monitor * - a progress monitor * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException { - ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, noConsumer, disableConsumer, monitor); + public void createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException { + ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, monitor); if (sessionInfo != null) { TraceSessionComponent session = new TraceSessionComponent( @@ -158,15 +151,11 @@ public class TraceSessionGroup extends TraceControlComponent { * - a URL for control channel (networkUrl has to be null, dataUrl has to be set) * @param dataUrl * - a URL for data channel (networkUrl has to be null, controlUrl has to be set) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer) throws ExecutionException { - createSession(sessionName, networkUrl, controlUrl, dataUrl, noConsumer, disableConsumer, new NullProgressMonitor()); + public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl) throws ExecutionException { + createSession(sessionName, networkUrl, controlUrl, dataUrl, new NullProgressMonitor()); } /** @@ -181,17 +170,13 @@ public class TraceSessionGroup extends TraceControlComponent { * - a URL for control channel (networkUrl has to be null, dataUrl has to be set) * @param dataUrl * - a URL for data channel (networkUrl has to be null, controlUrl has to be set) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @param monitor * - a progress monitor * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException { - ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, noConsumer, disableConsumer, monitor); + public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException { + ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, monitor); if (sessionInfo != null) { TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this); diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java index b07196028b..cecee4fd6d 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java @@ -118,29 +118,7 @@ public interface ILttngControlService { * @throws ExecutionException * If the command fails */ - public ISessionInfo createSession(String sessionName, String sessionPath, - IProgressMonitor monitor) throws ExecutionException; - - /** - * Creates a session with given session name and location. - * - * @param sessionName - * - a session name to create - * @param sessionPath - * - a path for storing the traces (use null for default) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer - * @param monitor - * - a progress monitor - * @return the session information - * @throws ExecutionException - * If the command fails - */ - public ISessionInfo createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer, - IProgressMonitor monitor) throws ExecutionException; - + public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException; /** * Creates a session with given session name and location. @@ -154,18 +132,13 @@ public interface ILttngControlService { * - a URL for control channel (networkUrl has to be null, dataUrl has to be set) * @param dataUrl * - a URL for data channel (networkUrl has to be null, controlUrl has to be set) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @param monitor * - a progress monitor * @return the session information * @throws ExecutionException * If the command fails */ - public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer, - IProgressMonitor monitor) throws ExecutionException; + public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException; /** * Destroys a session with given session name. diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java index c31c31e872..fd056175be 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java @@ -201,34 +201,42 @@ public class LTTngControlService implements ILttngControlService { if (matcher.matches()) { // Create Domain IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_KernelDomainDisplayName); - sessionInfo.addDomain(domainInfo); // in domain kernel ArrayList<IChannelInfo> channels = new ArrayList<IChannelInfo>(); index = parseDomain(result.getOutput(), index, channels); - // set channels - domainInfo.setChannels(channels); + if (channels.size() > 0) { + // add domain + sessionInfo.addDomain(domainInfo); - // set kernel flag - domainInfo.setIsKernel(true); + // set channels + domainInfo.setChannels(channels); + + // set kernel flag + domainInfo.setIsKernel(true); + } continue; } matcher = LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(line); if (matcher.matches()) { IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_UstGlobalDomainDisplayName); - sessionInfo.addDomain(domainInfo); // in domain UST ArrayList<IChannelInfo> channels = new ArrayList<IChannelInfo>(); index = parseDomain(result.getOutput(), index, channels); - // set channels - domainInfo.setChannels(channels); + if (channels.size() > 0) { + // add domain + sessionInfo.addDomain(domainInfo); + + // set channels + domainInfo.setChannels(channels); - // set kernel flag - domainInfo.setIsKernel(false); + // set kernel flag + domainInfo.setIsKernel(false); + } continue; } index++; @@ -355,12 +363,6 @@ public class LTTngControlService implements ILttngControlService { */ @Override public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException { - return createSession(sessionName, sessionPath, false, false, monitor); - } - - @Override - public ISessionInfo createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer, - IProgressMonitor monitor) throws ExecutionException { String newName = formatParameter(sessionName); String newPath = formatParameter(sessionPath); @@ -372,12 +374,6 @@ public class LTTngControlService implements ILttngControlService { command.append(newPath); } - if (noConsumer) { - command.append(LTTngControlServiceConstants.OPTION_NO_CONSUMER); - } else if (disableConsumer) { - command.append(LTTngControlServiceConstants.OPTION_DISABLE_CONSUMER); - } - ICommandResult result = executeCommand(command.toString(), monitor); //Session myssession2 created. @@ -405,27 +401,25 @@ public class LTTngControlService implements ILttngControlService { SessionInfo sessionInfo = new SessionInfo(name); - if (!noConsumer) { - // Get and verify session path - matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]); - String path = null; + // Get and verify session path + matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]); + String path = null; - if (matcher.matches()) { - path = String.valueOf(matcher.group(1).trim()); - } else { - // Output format not expected - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ - formatOutput(result)); - } + if (matcher.matches()) { + path = String.valueOf(matcher.group(1).trim()); + } else { + // Output format not expected + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ + formatOutput(result)); + } - if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) { - // Unexpected path - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$ - } - sessionInfo.setSessionPath(path); + if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) { + // Unexpected path + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$ } + sessionInfo.setSessionPath(path); return sessionInfo; @@ -433,11 +427,10 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#createSession(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor) + * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#createSession(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) */ @Override - public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, - String dataUrl, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException { + public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException { String newName = formatParameter(sessionName); StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_CREATE_SESSION, newName); @@ -453,12 +446,6 @@ public class LTTngControlService implements ILttngControlService { command.append(dataUrl); } - if (noConsumer) { - command.append(LTTngControlServiceConstants.OPTION_NO_CONSUMER); - } else if (disableConsumer) { - command.append(LTTngControlServiceConstants.OPTION_DISABLE_CONSUMER); - } - ICommandResult result = executeCommand(command.toString(), monitor); //Session myssession2 created. @@ -482,7 +469,7 @@ public class LTTngControlService implements ILttngControlService { String path = null; SessionInfo sessionInfo = new SessionInfo(name); - if (!noConsumer && (networkUrl != null)) { + if (networkUrl != null) { if (matcher.matches()) { path = String.valueOf(matcher.group(1).trim()); } else { @@ -1005,6 +992,8 @@ public class LTTngControlService implements ILttngControlService { String line = output[index]; Matcher outerMatcher = LTTngControlServiceConstants.CHANNELS_SECTION_PATTERN.matcher(line); + Matcher noKernelChannelMatcher = LTTngControlServiceConstants.DOMAIN_NO_KERNEL_CHANNEL_PATTERN.matcher(line); + Matcher noUstChannelMatcher = LTTngControlServiceConstants.DOMAIN_NO_UST_CHANNEL_PATTERN.matcher(line); if (outerMatcher.matches()) { IChannelInfo channelInfo = null; while (index < output.length) { @@ -1069,6 +1058,10 @@ public class LTTngControlService implements ILttngControlService { } index++; } + } else if (noKernelChannelMatcher.matches() || noUstChannelMatcher.matches()) { + // domain indicates that no channels were found -> return + index++; + return index; } index++; } diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java index ac50f4fa36..79295b5fad 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java +++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java @@ -214,14 +214,6 @@ public class LTTngControlServiceConstants { * Command line option for configuring the streaming data URL. */ public final static String OPTION_DATA_URL = " -D "; //$NON-NLS-1$ - /** - * Command line option for configuring of no consumer. - */ - public final static String OPTION_NO_CONSUMER = " --no-consumer "; //$NON-NLS-1$ - /** - * Command line option for disabling the consumer. - */ - public final static String OPTION_DISABLE_CONSUMER = " --disable-consumer "; //$NON-NLS-1$ // ------------------------------------------------------------------------ // Parsing constants @@ -247,9 +239,10 @@ public class LTTngControlServiceConstants { */ public final static Pattern TRACE_SESSION_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$ /** - * Patter to match session path for network tracing (lttng list <session>) + * Pattern to match session path for network tracing (lttng list <session>) + * Note: file for protocol is not considered as network trace since local consumer will be used. */ - public final static Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net6|file|tcp|tcp6|)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$ + public final static Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net6|tcp|tcp6|)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$ /** * Pattern to match for kernel domain information (lttng list <session>) */ @@ -259,6 +252,14 @@ public class LTTngControlServiceConstants { */ public final static Pattern DOMAIN_UST_GLOBAL_PATTERN = Pattern.compile("=== Domain: UST global ==="); //$NON-NLS-1$ /** + * Pattern to match for matching warning about no kernel channel + */ + public final static Pattern DOMAIN_NO_KERNEL_CHANNEL_PATTERN = Pattern.compile("\\s*Warning\\:\\s+No kernel\\s+channel.*"); //$NON-NLS-1$ + /** + * Pattern to match for matching warning about no UST channel + */ + public final static Pattern DOMAIN_NO_UST_CHANNEL_PATTERN = Pattern.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*"); //$NON-NLS-1$ + /** * Pattern to match for channels section (lttng list <session>) */ public final static Pattern CHANNELS_SECTION_PATTERN = Pattern.compile("\\s*Channels\\:"); //$NON-NLS-1$ @@ -329,7 +330,6 @@ public class LTTngControlServiceConstants { /** * Pattern to match event fields */ - // field: content (string) public final static Pattern EVENT_FIELD_PATTERN = Pattern.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$ /** * Pattern to match for UST provider information (lttng list -u) |