#commands.control.enable.event=Enable
commands.control.enable.assign.description=Assign Event to Session and Channel and Enable Event
-commands.control.enable.event=Enable
+commands.control.enable.event=Enable Event
commands.control.enable.event.description=Enable Event
+commands.control.enable.eventOnDomain=Enable Event (default channel)
+commands.control.enable.eventOnDomain.description=Enable Event on Default Channel
+
commands.control.disable.event=Disable
commands.control.disable.event.description=Disable Event
id="org.eclipse.linuxtools.lttng.ui.commands.control.disable.event"
name="%commands.control.disable.event">
</command>
+ <command
+ categoryId="org.eclipse.linuxtools.lttng.ui.commands.control.category"
+ description="%commands.control.enable.event.description"
+ id="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnChannel"
+ name="%commands.control.enable.event">
+ </command>
+ <command
+ categoryId="org.eclipse.linuxtools.lttng.ui.commands.control.category"
+ description="%commands.control.enable.eventOnDomain.description"
+ id="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnDomain"
+ name="%commands.control.enable.eventOnDomain">
+ </command>
+ <command
+ categoryId="org.eclipse.linuxtools.lttng.ui.commands.control.category"
+ description="%commands.control.enable.eventOnDomain.description"
+ id="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnSession"
+ name="%commands.control.enable.eventOnDomain">
+ </command>
+
</extension>
<extension
point="org.eclipse.ui.menus">
<command
commandId="org.eclipse.linuxtools.lttng.ui.commands.control.destroySession"
icon="icons/elcl16/delete_trace.gif"
- label="%commands.control.destroy"
+ label="%commands.control.destroy.session"
style="push">
</command>
</with>
</visibleWhen>
</command>
+ <command
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.start"
+ icon="icons/elcl16/start_trace.gif"
+ label="%commands.control.start"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeMenuSelection">
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.stop"
+ icon="icons/elcl16/pause_trace.gif"
+ label="%commands.control.stop"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeMenuSelection">
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
<command
commandId="org.eclipse.linuxtools.lttng.ui.commands.control.destroySession"
icon="icons/elcl16/delete_trace.gif"
</with>
</visibleWhen>
</command>
+ <separator
+ name="org.eclipse.linuxtools.lttng.ui.views.control.popup.separator1"
+ visible="true">
+ </separator>
<command
commandId="org.eclipse.linuxtools.lttng.ui.commands.control.createChannelOnSession"
icon="icons/elcl16/add_button.gif"
</with>
</visibleWhen>
</command>
+ <command
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnSession"
+ icon="icons/elcl16/edit.gif"
+ label="%commands.control.enable.eventOnDomain"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeMenuSelection">
+ <and>
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent">
+ </instanceof>
+ </iterate>
+ <count
+ value="1">
+ </count>
+ </and>
+ </with>
+ </visibleWhen>
+ </command>
<command
commandId="org.eclipse.linuxtools.lttng.ui.commands.control.createChannelOnDomain"
icon="icons/elcl16/add_button.gif"
</visibleWhen>
</command>
<command
- commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enableChannel"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnDomain"
icon="icons/elcl16/edit.gif"
- label="%commands.control.enable.channel"
+ label="%commands.control.enable.eventOnDomain"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="activeMenuSelection">
- <iterate
- operator="or">
- <instanceof
- value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent">
- </instanceof>
- </iterate>
+ <and>
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent">
+ </instanceof>
+ </iterate>
+ <count
+ value="1">
+ </count>
+ </and>
</with>
</visibleWhen>
</command>
<command
- commandId="org.eclipse.linuxtools.lttng.ui.commands.control.disableChannel"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enableChannel"
icon="icons/elcl16/edit.gif"
- label="%commands.control.disable.channel"
+ label="%commands.control.enable.channel"
style="push">
<visibleWhen
checkEnabled="false">
</visibleWhen>
</command>
<command
- commandId="org.eclipse.linuxtools.lttng.ui.commands.control.start"
- icon="icons/elcl16/start_trace.gif"
- label="%commands.control.start"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.disableChannel"
+ icon="icons/elcl16/edit.gif"
+ label="%commands.control.disable.channel"
style="push">
<visibleWhen
checkEnabled="false">
<iterate
operator="or">
<instanceof
- value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent">
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent">
</instanceof>
</iterate>
</with>
</visibleWhen>
</command>
+
<command
- commandId="org.eclipse.linuxtools.lttng.ui.commands.control.stop"
- icon="icons/elcl16/pause_trace.gif"
- label="%commands.control.stop"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.assign.event"
+ icon="icons/elcl16/edit.gif"
+ label="%commands.control.enable.event"
style="push">
<visibleWhen
checkEnabled="false">
<iterate
operator="or">
<instanceof
- value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent">
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventComponent">
</instanceof>
</iterate>
</with>
</command>
<command
- commandId="org.eclipse.linuxtools.lttng.ui.commands.control.assign.event"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.event"
icon="icons/elcl16/edit.gif"
label="%commands.control.enable.event"
style="push">
<iterate
operator="or">
<instanceof
- value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventComponent">
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent">
</instanceof>
</iterate>
</with>
</command>
<command
- commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.event"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.disable.event"
icon="icons/elcl16/edit.gif"
- label="%commands.control.enable.event"
+ label="%commands.control.disable.event"
style="push">
<visibleWhen
checkEnabled="false">
</command>
<command
- commandId="org.eclipse.linuxtools.lttng.ui.commands.control.disable.event"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnChannel"
icon="icons/elcl16/edit.gif"
- label="%commands.control.disable.event"
+ label="%commands.control.enable.event"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="activeMenuSelection">
- <iterate
- operator="or">
- <instanceof
- value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent">
- </instanceof>
- </iterate>
+ <and>
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent">
+ </instanceof>
+ </iterate>
+ <count
+ value="1">
+ </count>
+ </and>
</with>
</visibleWhen>
</command>
+
+
</menuContribution>
</extension>
</with>
</activeWhen>
</handler>
-
+
+ <handler
+ class="org.eclipse.linuxtools.lttng.ui.views.control.handlers.EnableEventOnChannelHandler"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnChannel">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+
+ <handler
+ class="org.eclipse.linuxtools.lttng.ui.views.control.handlers.EnableEventOnDomainHandler"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnDomain">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.linuxtools.lttng.ui.views.control.handlers.EnableEventOnSessionHandler"
+ commandId="org.eclipse.linuxtools.lttng.ui.commands.control.enable.eventOnSession">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate
+ operator="or">
+ <instanceof
+ value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
</extension>
<!-- ======================================= -->
public static String TraceControl_EnableChannelDialogTitle;
public static String TraceControl_EnableChannelNameLabel;
- public static String TraceControl_EnableChannelNameLabelTooltip;
+ public static String TraceControl_EnableChannelNameTooltip;
public static String TraceControl_EnableChannelSubBufferSizeTooltip;
public static String TraceControl_EnableChannelNbSubBuffersTooltip;
public static String TraceControl_EnableChannelSwitchTimerTooltip;
public static String TraceControl_EnableEventsNoSessionError;
public static String TraceControl_EnableEventsNoChannelError;
-
-// public static String TraceControl_CreateSessionPathLabel;
-// public static String TraceControl_CreateSessionPathTooltip;
-// public static String TraceControl_SessionAlreadyExistsError;
-// public static String TraceControl_SessionPathAlreadyExistsError;
-// public static String TraceControl_InvalidSessionPathError;
-// public static String TraceControl_FileSubSystemError;
+ public static String TraceControl_EnableKernelEventsDialogTitle;
+ public static String TraceControl_EnableEventsTracepointGroupName;
+ public static String TraceControl_EnableEventsTracepointTreeTooltip;
+ public static String TraceControl_EnableEventsTracepointTreeAllLabel;
+ public static String TraceControl_EnableEventsSyscallName;
+ public static String TraceControl_EnableEventsSyscallTooltip;
+ public static String TraceControl_EnableEventsProbeGroupName;
+ public static String TraceControl_EnableEventsProbeEventNameLabel;
+ public static String TraceControl_EnableEventsProbeEventNameTooltip;
+ public static String TraceControl_EnableEventsProbeNameLabel;
+ public static String TraceControl_EnableEventsProbeNameTooltip;
+ public static String TraceControl_EnableEventsFucntionGroupName;
+ public static String TraceControl_EnableEventsFunctionEventNameTooltip;
+ public static String TraceControl_EnableEventsFunctionNameLabel;
+ public static String TraceControl_InvalidProbeNameError;
+
// Tree structure strings
public static String TraceControl_KernelDomainDisplayName;
public static String TraceControl_UstDisplayName;
Label channelNameLabel = new Label(fDialogComposite, SWT.RIGHT);
channelNameLabel.setText(Messages.TraceControl_EnableChannelNameLabel);
fChannelNameText = new Text(fDialogComposite, SWT.NONE);
- fChannelNameText.setToolTipText(Messages.TraceControl_EnableChannelNameLabelTooltip);
+ fChannelNameText.setToolTipText(Messages.TraceControl_EnableChannelNameTooltip);
Label subBufferSizeLabel = new Label(fDialogComposite, SWT.RIGHT);
subBufferSizeLabel.setText(Messages.TraceControl_SubBufferSizePropertyName);
}
// Check for invalid names
- if (!fChannelInfo.getName().matches("^[a-zA-Z0-9\\-\\_]{2,}$")) { //$NON-NLS-1$
+ if (!fChannelInfo.getName().matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableChannelDialogTitle,
Messages.TraceControl_InvalidChannelNameError + " (" + fChannelInfo.getName() + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
}
// Check for invalid names
- if (!fSessionName.matches("^[a-zA-Z0-9\\-\\_]{2,}$")) { //$NON-NLS-1$
+ if (!fSessionName.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$
MessageDialog.openError(getShell(),
Messages.TraceControl_CreateSessionDialogTitle,
Messages.TraceControl_InvalidSessionNameError + " (" + fSessionName + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.dialogs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
+import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
+import org.eclipse.linuxtools.lttng.ui.views.control.TraceControlContentProvider;
+import org.eclipse.linuxtools.lttng.ui.views.control.TraceControlLabelProvider;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.KernelProviderComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProviderGroup;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * <b><u>EnableKernelEventDialog</u></b>
+ * <p>
+ * Dialog box for collecting information kernel events to be enabled.
+ * </p>
+ */
+public class EnableKernelEventDialog extends Dialog implements IEnableKernelEventsDialog {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+ /**
+ * The icon file for this dialog box.
+ */
+ public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/edit.gif"; //$NON-NLS-1$
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /**
+ * The dialog composite.
+ */
+ private Composite fDialogComposite;
+ /**
+ * The goup for the list of available tracepoints.
+ */
+ private Group fTracepointsGroup;
+ /**
+ * A tree viewer for diplaying and selection of available tracepoints.
+ */
+ private CheckboxTreeViewer fTracepointsViewer;
+ /**
+ * The Group for Syscalls selection.
+ */
+ private Group fSyscallGroup;
+ /**
+ * The button to enable or disable all syscalls
+ */
+ private Button fSyscallButton;
+ /**
+ * The group for defining a dynamic probe.
+ */
+ private Group fProbeGroup;
+ /**
+ * The text field for the event name for the dynamic probe.
+ */
+ private Text fProbeEventNameText;
+ /**
+ * The text field for the dynamic probe.
+ */
+ private Text fProbeText;
+ /**
+ * The group for defining a dynamic function probe.
+ */
+ private Group fFunctionGroup;
+ /**
+ * The text field for the event name for the dynamic probe.
+ */
+ private Text fFunctionEventNameText;
+ /**
+ * The text field for the dynamic function entry/return probe.
+ */
+ private Text fFunctionText;
+ /**
+ * The referenced kernel provider component which contains a list of available tracepoints.
+ */
+ private KernelProviderComponent fKernelProvider;
+ /**
+ * The flag indicating that all tracepoints are selected.
+ */
+ private boolean fIsAllTracepoints;
+ /**
+ * The flag indicating that syscalls are selected.
+ */
+ private boolean fIsAllSysCalls;
+ /**
+ * The list of tracepoints to be enabled.
+ */
+ private List<String> fSelectedEvents;
+ /**
+ * The event name of the dynamic probe.
+ */
+ private String fProbeEventName;
+ /**
+ * The dynamic probe.
+ */
+ private String fProbeString;
+ /**
+ * The event name of the dynamic function entry/return probe.
+ */
+ private String fFunctionEventName;
+ /**
+ * The dynamic function entry/return probe.
+ */
+ private String fFunctionString;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ * @param shell - a shell for the display of the dialog
+ * @param kernelProvider - the kernel provider component
+ */
+ public EnableKernelEventDialog(Shell shell, KernelProviderComponent kernelProvider) {
+ super(shell);
+ fKernelProvider = kernelProvider;
+ setShellStyle(SWT.RESIZE);
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog#isAllTracePoints()
+ */
+ @Override
+ public boolean isAllTracePoints() {
+ return fIsAllTracepoints;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog#isAllSysCalls()
+ */
+ @Override
+ public boolean isAllSysCalls() {
+ return fIsAllSysCalls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog#getEventNames()
+ */
+ @Override
+ public List<String> getEventNames() {
+ return new ArrayList<String>(fSelectedEvents);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog#getProbeName()
+ */
+ @Override
+ public String getProbeName() {
+ return fProbeString;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog#getProbeEventName()
+ */
+ @Override
+ public String getProbeEventName() {
+ return fProbeEventName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog#getFunctionEventName()
+ */
+ @Override
+ public String getFunctionEventName() {
+ return fFunctionEventName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog#getFunction()
+ */
+ @Override
+ public String getFunction() {
+ return fFunctionString;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.TraceControl_EnableKernelEventsDialogTitle);
+ newShell.setImage(LTTngUiPlugin.getDefault().loadIcon(ENABLE_EVENT_ICON_FILE));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ // Main dialog panel
+ fDialogComposite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, true);
+ fDialogComposite.setLayout(layout);
+ fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // ------------------------------------------------------------------------
+ // Tracepoints Group
+ // ------------------------------------------------------------------------
+ fTracepointsGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ fTracepointsGroup.setText(Messages.TraceControl_EnableEventsTracepointGroupName);
+ layout = new GridLayout(1, true);
+ fTracepointsGroup.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ fTracepointsGroup.setLayoutData(data);
+
+ fTracepointsViewer = new CheckboxTreeViewer(fTracepointsGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ fTracepointsViewer.getTree().setToolTipText(Messages.TraceControl_EnableEventsTracepointTreeTooltip);
+ fTracepointsViewer.setContentProvider(new TraceControlContentProvider() {
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof TraceProviderGroup) {
+ List<ITraceControlComponent> children = ((ITraceControlComponent)parentElement).getChildren(KernelProviderComponent.class);
+ return (ITraceControlComponent[]) children.toArray(new ITraceControlComponent[children.size()]);
+ }
+ if (parentElement instanceof ITraceControlComponent) {
+ return ((ITraceControlComponent)parentElement).getChildren();
+ }
+ return new Object[0];
+ }
+ });
+
+ fTracepointsViewer.setLabelProvider(new TraceControlLabelProvider() {
+ @Override
+ public Image getImage(Object element) {
+ return null;
+ }
+ @Override
+ public String getText(Object element) {
+ if ((element != null) && (element instanceof KernelProviderComponent)) {
+ return Messages.TraceControl_EnableEventsTracepointTreeAllLabel;
+ }
+ return super.getText(element);
+ }
+ });
+
+ fTracepointsViewer.addCheckStateListener(new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getChecked()) {
+ if (event.getElement() instanceof KernelProviderComponent) {
+ fTracepointsViewer.setSubtreeChecked(event.getElement(), true);
+ }
+ } else {
+ if (event.getElement() instanceof KernelProviderComponent) {
+ fTracepointsViewer.setSubtreeChecked(event.getElement(), false);
+ } else {
+ ITraceControlComponent component = (ITraceControlComponent) event.getElement();
+ fTracepointsViewer.setChecked(component.getParent(), false);
+ }
+ }
+ }
+ });
+
+ fTracepointsViewer.setInput(fKernelProvider.getParent());
+ fTracepointsViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // ------------------------------------------------------------------------
+ // Syscalls Group
+ // ------------------------------------------------------------------------
+ fSyscallGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ layout = new GridLayout(4, true);
+ fSyscallGroup.setLayout(layout);
+ fSyscallGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ fSyscallButton = new Button(fSyscallGroup, SWT.CHECK);
+ fSyscallButton.setText(Messages.TraceControl_EnableEventsSyscallName);
+ fSyscallButton.setToolTipText(Messages.TraceControl_EnableEventsSyscallTooltip);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 4;
+ fSyscallButton.setLayoutData(data);
+
+ // ------------------------------------------------------------------------
+ // Dynamic Probe Group
+ // ------------------------------------------------------------------------
+ fProbeGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ fProbeGroup.setText(Messages.TraceControl_EnableEventsProbeGroupName);
+ layout = new GridLayout(4, true);
+ fProbeGroup.setLayout(layout);
+ fProbeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label probeNameLabel = new Label(fProbeGroup, SWT.LEFT);
+ probeNameLabel.setText(Messages.TraceControl_EnableEventsProbeEventNameLabel);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 1;
+ probeNameLabel.setLayoutData(data);
+
+ fProbeEventNameText = new Text(fProbeGroup, SWT.LEFT);
+ fProbeEventNameText.setToolTipText(Messages.TraceControl_EnableEventsProbeEventNameTooltip);
+
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ fProbeEventNameText.setLayoutData(data);
+
+ Label probeLabel = new Label(fProbeGroup, SWT.LEFT);
+ probeLabel.setText(Messages.TraceControl_EnableEventsProbeNameLabel);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 1;
+ probeLabel.setLayoutData(data);
+
+ fProbeText = new Text(fProbeGroup, SWT.LEFT);
+ fProbeText.setToolTipText(Messages.TraceControl_EnableEventsProbeNameTooltip);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ fProbeText.setLayoutData(data);
+
+ // ------------------------------------------------------------------------
+ // Dynamic Function Probe Group
+ // ------------------------------------------------------------------------
+ fFunctionGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+ fFunctionGroup.setText(Messages.TraceControl_EnableEventsFucntionGroupName);
+ layout = new GridLayout(4, true);
+ fFunctionGroup.setLayout(layout);
+ fFunctionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label functionNameLabel = new Label(fFunctionGroup, SWT.LEFT);
+ functionNameLabel.setText(Messages.TraceControl_EnableEventsProbeEventNameLabel);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 1;
+ functionNameLabel.setLayoutData(data);
+
+ fFunctionEventNameText = new Text(fFunctionGroup, SWT.LEFT);
+ fFunctionEventNameText.setToolTipText(Messages.TraceControl_EnableEventsFunctionEventNameTooltip);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ fFunctionEventNameText.setLayoutData(data);
+
+ Label functionLabel = new Label(fFunctionGroup, SWT.LEFT);
+ functionLabel.setText(Messages.TraceControl_EnableEventsFunctionNameLabel);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 1;
+ functionLabel.setLayoutData(data);
+
+ fFunctionText = new Text(fFunctionGroup, SWT.LEFT);
+ fFunctionText.setToolTipText(Messages.TraceControl_EnableEventsProbeNameTooltip);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ fFunctionText.setLayoutData(data);
+
+ fDialogComposite.layout();
+
+ return fDialogComposite;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ fIsAllTracepoints = fTracepointsViewer.getChecked(fKernelProvider);
+ fIsAllSysCalls = fSyscallButton.getSelection();
+
+ ITraceControlComponent[] events = fKernelProvider.getChildren();
+ fSelectedEvents = new ArrayList<String>();
+ for (int i = 0; i < events.length; i++) {
+ if (fTracepointsViewer.getChecked(events[i])) {
+ fSelectedEvents.add(events[i].getName());
+ }
+ }
+
+ // initialize probe string
+ fProbeEventName = null;
+ fProbeString = null;
+ String temp = fProbeEventNameText.getText();
+ if (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+ MessageDialog.openError(getShell(),
+ Messages.TraceControl_EnableKernelEventsDialogTitle,
+ Messages.TraceControl_InvalidProbeNameError + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return;
+ }
+
+ if(!fProbeText.getText().matches("\\s*")) { //$NON-NLS-1$
+ fProbeEventName = temp;
+ // fProbeString will be validated by lttng-tools
+ fProbeString = fProbeText.getText();
+ }
+
+ // initialize function string
+ fFunctionEventName = null;
+ fFunctionString = null;
+
+ temp = fFunctionEventNameText.getText();
+ if (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+ MessageDialog.openError(getShell(),
+ Messages.TraceControl_EnableKernelEventsDialogTitle,
+ Messages.TraceControl_InvalidProbeNameError + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return;
+ }
+
+ if(!fFunctionText.getText().matches("\\s*")) { //$NON-NLS-1$
+ fFunctionEventName = temp;
+ // fFunctionString will be validated by lttng-tools
+ fFunctionString = fFunctionText.getText();
+ }
+
+ // validation successful -> call super.okPressed()
+ super.okPressed();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ super.buttonPressed(buttonId);
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper methods
+ // ------------------------------------------------------------------------
+
+
+}
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
/**
super(shell);
fIsKernel = isKernel;
fSessions = Arrays.copyOf(sessions, sessions.length);
+ setShellStyle(SWT.RESIZE);
}
// ------------------------------------------------------------------------
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
- fDialogComposite.setLayout(layout);
- Label label = new Label(fDialogComposite, SWT.NONE);
- // a simple way to make dialog wider :-)
- label.setText(" "); //$NON-NLS-1$
+ fDialogComposite.setLayout(layout);
+ fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
fSessionsGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
fSessionsGroup.setText(Messages.TraceControl_EnableEventsSessionGroupName);
layout = new GridLayout(1, true);
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.dialogs;
+
+import java.util.List;
+
+/**
+ * <b><u>IEnableKernelEventsDialog</u></b>
+ * <p>
+ * Interface for collection information for enabling kernel events.
+ * </p>
+ */
+public interface IEnableKernelEventsDialog {
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return a flag indicating whether all tracepoints shall be enabled or not.
+ */
+ public boolean isAllTracePoints();
+
+ /**
+ * @return a flag indicating whether syscalls shall be enabled or not.
+ */
+ public boolean isAllSysCalls();
+
+ /**
+ * @return a list of event names to be enabled.
+ */
+ public List<String> getEventNames();
+
+ /**
+ * @return event name of the dynamic probe (or null if no dynamic probe).
+ */
+ public String getProbeEventName();
+
+ /**
+ * @return the dynamic probe (or null if no dynamic probe).
+ */
+ public String getProbeName();
+
+ /**
+ * @return event name of the dynamic function entry/exit probe (or null if no dynamic probe).
+ */
+ public String getFunctionEventName();
+
+ /**
+ * @return the dynamic function entry/exit probe (or null if no dynamic probe).
+ */
+ public String getFunction();
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+ /**
+ * @return the open return value
+ */
+ int open();
+}
\ No newline at end of file
if (hosts != null) {
fExistingHosts = Arrays.copyOf(hosts, hosts.length);
}
+ setShellStyle(SWT.RESIZE);
}
// ------------------------------------------------------------------------
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
- fDialogComposite.setLayout(layout);
+ fDialogComposite.setLayout(layout);
+ fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// Existing connections group
fComboGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
fComboGroup.setText(Messages.TraceControl_NewNodeExistingConnectionGroupName);
layout = new GridLayout(2, true);
fComboGroup.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
fComboGroup.setLayoutData(data);
fExistingHostsCombo = new CCombo(fComboGroup, SWT.READ_ONLY);
fExistingHostsCombo.setToolTipText(Messages.TraceControl_NewNodeComboToolTip);
- fExistingHostsCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1));
+ fExistingHostsCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
String items[] = new String[fExistingHosts.length];
for (int i = 0; i < items.length; i++) {
// Node information grop
fTextGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
- layout = new GridLayout(2, true);
+ layout = new GridLayout(3, true);
fTextGroup.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data = new GridData(GridData.FILL_HORIZONTAL);
fTextGroup.setLayoutData(data);
fButton = new Button(fTextGroup, SWT.CHECK);
- fButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1));
+ fButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
fButton.setText(Messages.TraceControl_NewNodeEditButtonName);
fButton.setEnabled(fExistingHosts.length > 0);
});
// layout widgets
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data = new GridData(GridData.FILL_HORIZONTAL);
fHostNameText.setText("666.666.666.666"); //$NON-NLS-1$
Point minSize = fHostNameText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
data.widthHint = minSize.x + 5;
+ data.horizontalSpan = 2;
fConnectionNameText.setLayoutData(data);
fHostNameText.setLayoutData(data);
TraceChannelComponent channel = dialog.getChannel();
if (channel == null) {
// enable events on default channel (which will be created by lttng-tools)
- dialog.getSession().enableEvent(eventNames, fIsKernel, monitor);
+ dialog.getSession().enableEvents(eventNames, fIsKernel, monitor);
} else {
- channel.enableEvent(eventNames, monitor);
+ channel.enableEvents(eventNames, monitor);
}
} catch (ExecutionException e) {
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <b><u>BaseControlViewHandler</u></b>
+ * <p>
+ * Abstract Command handler implementation for all control view handlers.
+ * </p>
+ */
+abstract public class BaseControlViewHandler extends AbstractHandler {
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+ /**
+ * @return returns the workbench page for the Control View
+ */
+ protected IWorkbenchPage getWorkbenchPage() {
+ // Check if we are closing down
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) {
+ return null;
+ }
+
+ // Check if we are in the Project View
+ IWorkbenchPage page = window.getActivePage();
+ if (page == null) {
+ return null;
+ }
+
+ IWorkbenchPart part = page.getActivePart();
+ if (!(part instanceof ControlView)) {
+ return null;
+ }
+ return page;
+ }
+}
\ No newline at end of file
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.window.Window;
+import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
+import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.EnableKernelEventDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableKernelEventsDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.KernelProviderComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TargetNodeComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProviderGroup;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * <b><u>EnableEventOnSessionHandler</u></b>
+ * <p>
+ * Command handler implementation to enable events for a known session and default channel 'channel0'
+ * (which will be created if doesn't exist).
+ * </p>
+ */
+abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /**
+ * The session component the command is to be executed on.
+ */
+ protected TraceSessionComponent fSession = null;
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ abstract void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException;
+ abstract void enableSyscalls(IProgressMonitor monitor) throws ExecutionException;
+ abstract void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException;
+ abstract void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+
+ if (window == null) {
+ return false;
+ }
+
+ TargetNodeComponent node = fSession.getTargetNode();
+ List<ITraceControlComponent> providers = node.getChildren(TraceProviderGroup.class);
+ List<ITraceControlComponent> kernelProvider = providers.get(0).getChildren(KernelProviderComponent.class);
+
+ final IEnableKernelEventsDialog dialog = new EnableKernelEventDialog(window.getShell(), (KernelProviderComponent)kernelProvider.get(0));
+
+ if (dialog.open() != Window.OK) {
+ return null;
+ }
+
+ Job job = new Job(Messages.TraceControl_ChangeEventStateJob) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ String errorString = null;
+
+ // Enable tracepoint events
+ try {
+ if (dialog.isAllTracePoints()) {
+ enableEvents(null, monitor);
+ } else {
+ List<String> eventNames = dialog.getEventNames();
+ if (eventNames.size() > 0) {
+ enableEvents(eventNames, monitor);
+ }
+ }
+ } catch (ExecutionException e) {
+ if (errorString == null) {
+ errorString = new String();
+ }
+ errorString += e.toString() + "\n"; //$NON-NLS-1$
+ }
+
+ // Enable syscall events
+ try {
+ if (dialog.isAllSysCalls()) {
+ enableSyscalls(monitor);
+ }
+ } catch (ExecutionException e) {
+ if (errorString == null) {
+ errorString = new String();
+ }
+ errorString += e.toString() + "\n"; //$NON-NLS-1$
+ }
+
+ // Enable dynamic probe
+ try {
+ if ((dialog.getProbeEventName() != null && dialog.getProbeName() != null)) {
+ enableProbe(dialog.getProbeEventName(), dialog.getProbeName(), monitor);
+ }
+ } catch (ExecutionException e) {
+ if (errorString == null) {
+ errorString = new String();
+ }
+ errorString += e.toString() + "\n"; //$NON-NLS-1$
+ }
+
+ // Enable dynamic function probe
+ try {
+ if ((dialog.getFunctionEventName() != null) && (dialog.getFunction() != null)) {
+ fSession.enableFunctionProbe(dialog.getFunctionEventName(), dialog.getFunction(), monitor);
+ }
+ } catch (ExecutionException e) {
+ if (errorString == null) {
+ errorString = new String();
+ }
+ errorString += e.toString() + "\n"; //$NON-NLS-1$
+ }
+
+ // get session configuration in all cases
+ try {
+ fSession.getConfigurationFromNode(monitor);
+ } catch (ExecutionException e) {
+ if (errorString == null) {
+ errorString = new String();
+ }
+ errorString += Messages.TraceControl_ListSessionFailure + ": " + e.toString(); //$NON-NLS-1$
+ }
+
+ if (errorString != null) {
+ return new Status(Status.ERROR, LTTngUiPlugin.PLUGIN_ID, errorString);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(true);
+ job.schedule();
+
+ return null;
+ }
+}
**********************************************************************/
package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TargetNodeComponent;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
/**
* <b><u>BaseNodeHandler</u></b>
* Command handler implementation to delete a target host.
* </p>
*/
-abstract public class BaseNodeHandler extends AbstractHandler {
+abstract public class BaseNodeHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
*/
@Override
public boolean isEnabled() {
- fTargetNode = null;
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
-
+ fTargetNode = null;
+
// Check if the node component is selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
}
return fTargetNode != null;
}
+
+
}
\ No newline at end of file
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
* Abstract command handler implementation to enable or disabling a trace channel.
* </p>
*/
-abstract public class ChangeChannelStateHandler extends AbstractHandler {
+abstract public class ChangeChannelStateHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
public boolean isEnabled() {
reset();
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
-
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
-
+
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
* Base Command handler implementation to enable or disabling a trace channel.
* </p>
*/
-abstract public class ChangeEventStateHandler extends AbstractHandler {
+abstract public class ChangeEventStateHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
*/
@Override
public boolean isEnabled() {
- reset();
-
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
+ reset();
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
* Abstract command handler implementation to start or stop one or more trace sessions.
* </p>
*/
-abstract public class ChangeSessionStateHandler extends AbstractHandler {
+abstract public class ChangeSessionStateHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
*/
@Override
public boolean isEnabled() {
- fSessions.clear();
-
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
+ fSessions.clear();
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
* Command handler implementation to create a trace channel for known domain.
* </p>
*/
-public class CreateChannelOnDomainHandler extends AbstractHandler {
+public class CreateChannelOnDomainHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
*/
@Override
public boolean isEnabled() {
- fDomain = null;
-
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
-
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
+ fDomain = null;
// Check if one domain is selected
ISelection selection = page.getSelection(ControlView.ID);
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
* (on session level).
* </p>
*/
-public class CreateChannelOnSessionHandler extends AbstractHandler {
+public class CreateChannelOnSessionHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
*/
@Override
public boolean isEnabled() {
- fSession = null;
-
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
+ fSession = null;
// Check if one session is selected
ISelection selection = page.getSelection(ControlView.ID);
**********************************************************************/
package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateSessionDialog;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
* Command handler implementation to create a trace session.
* </p>
*/
-public class CreateSessionHandler extends AbstractHandler {
+public class CreateSessionHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
*/
@Override
public boolean isEnabled() {
- fSessionGroup = null;
-
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
+ fSessionGroup = null;
// Check if the session group project is selected
ISelection selection = page.getSelection(ControlView.ID);
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
* Command handler implementation to destroy one or more trace sessions.
* </p>
*/
-public class DestroySessionHandler extends AbstractHandler {
+public class DestroySessionHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Attributes
*/
@Override
public boolean isEnabled() {
- fSessions.clear();
-
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return false;
- }
-
- // Check if we are in the Project View
- IWorkbenchPage page = window.getActivePage();
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return false;
}
-
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
+ fSessions.clear();
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
*/
@Override
protected void changeState(TraceChannelComponent channel, List<String> eventNames, IProgressMonitor monitor) throws ExecutionException{
- channel.enableEvent(eventNames, monitor);
+ channel.enableEvents(eventNames, monitor);
}
}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * <b><u>EnableEventOnChannelHandler</u></b>
+ * <p>
+ * Command handler implementation to enable events for a known channel.
+ * </p>
+ */
+public class EnableEventOnChannelHandler extends BaseEnableEventHandler {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /**
+ * The channel component the command is to be executed on.
+ */
+ private TraceChannelComponent fChannel = null;
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(java.util.List, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
+ fChannel.enableEvents(eventNames, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableSyscalls(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ fChannel.enableSyscalls(monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ fChannel.enableProbe(eventName, probe, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableFunctionProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ fChannel.enableFunctionProbe(eventName, probe, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
+ if (page == null) {
+ return false;
+ }
+
+ fChannel = null;
+ ISelection selection = page.getSelection(ControlView.ID);
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structered = ((StructuredSelection) selection);
+ for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
+ Object element = (Object) iterator.next();
+ if (element instanceof TraceChannelComponent) {
+ fChannel = (TraceChannelComponent) element;
+ fSession = fChannel.getSession();
+ }
+ }
+ }
+ return fChannel != null;
+ }
+
+}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * <b><u>EnableEventOnDomainHandler</u></b>
+ * <p>
+ * Command handler implementation to enable events for a known domain and default channel 'channel0'
+ * (which will be created if doesn't exist).
+ * </p>
+ */
+public class EnableEventOnDomainHandler extends BaseEnableEventHandler {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ /**
+ * The domain component the command is to be executed on.
+ */
+ private TraceDomainComponent fDomain = null;
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(java.util.List, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
+ fDomain.enableEvents(eventNames, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableSyscalls(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ fDomain.enableSyscalls(monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ fDomain.enableProbe(eventName, probe, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableFunctionProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ fDomain.enableFunctionProbe(eventName, probe, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
+ if (page == null) {
+ return false;
+ }
+
+ fDomain = null;
+ ISelection selection = page.getSelection(ControlView.ID);
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structered = ((StructuredSelection) selection);
+ for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
+ Object element = (Object) iterator.next();
+ if (element instanceof TraceDomainComponent) {
+ // Add only TraceSessionComponents is inactive and not destroyed
+ TraceDomainComponent domain = (TraceDomainComponent) element;
+ TraceSessionComponent session = domain.getSession();
+ if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed() && domain.isKernel()) {
+ fDomain = domain;
+ fSession = session;
+ }
+ }
+ }
+ }
+ return fDomain != null;
+ }
+}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * <b><u>EnableEventOnSessionHandler</u></b>
+ * <p>
+ * Command handler implementation to enable events for a known session and default channel 'channel0'
+ * (which will be created if doesn't exist).
+ * </p>
+ */
+public class EnableEventOnSessionHandler extends BaseEnableEventHandler {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ //-------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableEvents(java.util.List, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
+ fSession.enableEvents(eventNames, true, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableSyscalls(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ fSession.enableSyscalls(monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ fSession.enableProbe(eventName, probe, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableFunctionProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ fSession.enableFunctionProbe(eventName, probe, monitor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
+ if (page == null) {
+ return false;
+ }
+
+ fSession = null;
+
+ // Check if one session is selected
+ ISelection selection = page.getSelection(ControlView.ID);
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structered = ((StructuredSelection) selection);
+ for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
+ Object element = (Object) iterator.next();
+ if (element instanceof TraceSessionComponent) {
+ // Add only TraceSessionComponents is inactive and not destroyed
+ TraceSessionComponent session = (TraceSessionComponent) element;
+ if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) {
+ fSession = session;
+ }
+ }
+ }
+ }
+ return fSession != null;
+ }
+}
**********************************************************************/
package org.eclipse.linuxtools.lttng.ui.views.control.handlers;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.dialogs.MessageDialog;
* Command handler for creation new connection for trace control.
* </p>
*/
-public class NewConnectionHandler extends AbstractHandler {
+public class NewConnectionHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Constants
*/
@Override
public boolean isEnabled() {
- fRoot = null;
-
- // Check if we are closing down
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
+
+ // Get workbench page for the Control View
+ IWorkbenchPage page = getWorkbenchPage();
+ if (page == null) {
return false;
}
- // Check if we are in the Control View
- IWorkbenchPage page = window.getActivePage();
- if (page == null) return false;
- IWorkbenchPart part = page.getActivePart();
- if (!(part instanceof ControlView)) {
- return false;
- }
+ fRoot = null;
+ // no need to verify part because it has been already done in getWorkbenchPage()
+ IWorkbenchPart part = page.getActivePart();
fRoot = ((ControlView) part).getTraceControlRoot();
return (fRoot != null);
TraceControl_EnableChannelDialogTitle=Enable Channel
TraceControl_EnableChannelNameLabel=Channel Name
-TraceControl_EnableChannelNameLabelTooltip=The name of the channel to be enabled.
+TraceControl_EnableChannelNameTooltip=The name of the channel to be enabled.
TraceControl_EnableChannelSubBufferSizeTooltip=The sub-buffers size of the channel.
TraceControl_EnableChannelNbSubBuffersTooltip=The number of sub-buffers of the channel.
TraceControl_EnableChannelSwitchTimerTooltip=The switch timer interval in usec.
TraceControl_EnableEventsNoSessionError=No session from session list is selected.
TraceControl_EnableEventsNoChannelError=No channel from channel list is selected.
+TraceControl_EnableKernelEventsDialogTitle=Enable Kernel Events
+TraceControl_EnableEventsTracepointGroupName=Tracepoint Events
+TraceControl_EnableEventsTracepointTreeTooltip=List of available kernel tracepoint events
+TraceControl_EnableEventsTracepointTreeAllLabel=All
+TraceControl_EnableEventsSyscallName=All Syscalls
+TraceControl_EnableEventsSyscallTooltip=Enable all Syscalls
+TraceControl_EnableEventsProbeGroupName=Dynamic Probe
+TraceControl_EnableEventsProbeEventNameLabel=Event Name
+TraceControl_EnableEventsProbeEventNameTooltip=The name of the event for enabling a dynamic probe
+TraceControl_EnableEventsProbeNameLabel=Probe
+TraceControl_EnableEventsProbeNameTooltip=[addr | symbol | symbol+offset]\nAddr and offset can be octal (0NNN...),\ndecimal (NNN...) or hexadecimal (0xNNN...)
+TraceControl_EnableEventsFucntionGroupName=Dynamic Function Entry/Return Probe
+TraceControl_EnableEventsFunctionEventNameTooltip=The name of the event for enabling a dynamic function entry/return probe
+TraceControl_EnableEventsFunctionNameLabel=Function
+TraceControl_InvalidProbeNameError=The probe name is invalid
+
# Tree structure strings
TraceControl_KernelDomainDisplayName=Kernel
TraceControl_UstGlobalDomainDisplayName=UST global
return ((TraceDomainComponent)getParent()).isKernel();
}
+ /**
+ * @return the parent target node
+ */
+ public TargetNodeComponent getTargetNode() {
+ return ((TraceDomainComponent)getParent()).getTargetNode();
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
* @param eventNames - a list of event names to enabled.
* @throws ExecutionException
*/
- public void enableEvent(List<String> eventNames) throws ExecutionException {
- enableEvent(eventNames, new NullProgressMonitor());
+ public void enableEvents(List<String> eventNames) throws ExecutionException {
+ enableEvents(eventNames, new NullProgressMonitor());
}
/**
* @param monitor - a progress monitor
* @throws ExecutionException
*/
- public void enableEvent(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableEvent(getParent().getParent().getName(), getName(), eventNames, isKernel(), monitor);
+ public void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableEvents(getSessionName(), getName(), eventNames, isKernel(), monitor);
+ }
+
+ /**
+ * Enables all syscalls (for kernel domain)
+ * @throws ExecutionException
+ */
+ public void enableSyscalls() throws ExecutionException {
+ enableSyscalls(new NullProgressMonitor());
+ }
+
+ /**
+ * Enables all syscalls (for kernel domain)
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableSyscalls(getSessionName(), getName(), monitor);
+ }
+
+ /**
+ * Enables a dynamic probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, String probe) throws ExecutionException {
+ enableProbe(eventName, probe, new NullProgressMonitor());
+ }
+
+ /**
+ * Enables a dynamic probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableProbe(getSessionName(), getName(), eventName, probe, monitor);
+ }
+
+ /**
+ * Enables a dynamic function entry/return probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @throws ExecutionException
+ */
+ public void enableFunctionProbe(String eventName, String probe) throws ExecutionException {
+ enableFunctionProbe(eventName, probe, new NullProgressMonitor());
+ }
+
+ /**
+ * Enables a dynamic function entry/return probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableFunctionProbe(getSessionName(), getName(), eventName, probe, monitor);
}
/**
List<ITraceControlComponent> channels = getChildren(TraceChannelComponent.class);
return (TraceChannelComponent[])channels.toArray(new TraceChannelComponent[channels.size()]);
}
+
+ /**
+ * @return the parent target node
+ */
+ public TargetNodeComponent getTargetNode() {
+ return ((TraceSessionComponent)getParent()).getTargetNode();
+ }
// ------------------------------------------------------------------------
// Operations
* @throws ExecutionException
*/
public void enableChannels(List<String> channelNames, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableChannel(getParent().getName(), channelNames, isKernel(), info, monitor);
+ getControlService().enableChannels(getParent().getName(), channelNames, isKernel(), info, monitor);
}
/**
* Disables channels with given names which are part of this domain.
* @throws ExecutionException
*/
public void disableChannels(List<String> channelNames, IProgressMonitor monitor) throws ExecutionException {
- getControlService().disableChannel(getParent().getName(), channelNames, isKernel(), monitor);
+ getControlService().disableChannels(getParent().getName(), channelNames, isKernel(), monitor);
+ }
+
+ /**
+ * Enables a list of events with no additional parameters.
+ * @param eventNames - a list of event names to enabled.
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableEvents(getSessionName(), null, eventNames, isKernel(), monitor);
+ }
+
+ /**
+ * Enables all syscalls (for kernel domain)
+ * @throws ExecutionException
+ */
+ public void enableSyscalls() throws ExecutionException {
+ enableSyscalls(new NullProgressMonitor());
+ }
+
+ /**
+ * Enables all syscalls (for kernel domain)
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+
+ public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableSyscalls(getSessionName(), null, monitor);
+ }
+
+ /**
+ * Enables a dynamic probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, String probe) throws ExecutionException {
+ enableProbe(eventName, probe, new NullProgressMonitor());
+ }
+
+ /**
+ * Enables a dynamic probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableProbe(getSessionName(), null, eventName, probe, monitor);
+ }
+
+ /**
+ * Enables a dynamic function entry/return probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @throws ExecutionException
+ */
+ public void enableFunctionProbe(String eventName, String probe) throws ExecutionException {
+ enableFunctionProbe(eventName, probe, new NullProgressMonitor());
+ }
+
+ /**
+ * Enables a dynamic function entry/return probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableFunctionProbe(getSessionName(), null, eventName, probe, monitor);
}
}
return (TraceDomainComponent[])sessions.toArray(new TraceDomainComponent[sessions.size()]);
}
+ /**
+ * @return the parent target node
+ */
+ public TargetNodeComponent getTargetNode() {
+ return ((TraceSessionGroup)getParent()).getTargetNode();
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
* @throws ExecutionException
*/
public void enableEvent(List<String> eventNames, boolean isKernel) throws ExecutionException {
- enableEvent(eventNames, isKernel, new NullProgressMonitor());
+ enableEvents(eventNames, isKernel, new NullProgressMonitor());
}
/**
* @param monitor - a progress monitor
* @throws ExecutionException
*/
- public void enableEvent(List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
- getControlService().enableEvent(getName(), null, eventNames, isKernel, monitor);
+ public void enableEvents(List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableEvents(getName(), null, eventNames, isKernel, monitor);
+ }
+
+ /**
+ * Enables all syscalls (for kernel domain)
+ * @throws ExecutionException
+ */
+ public void enableSyscalls() throws ExecutionException {
+ enableSyscalls(new NullProgressMonitor());
+ }
+
+ /**
+ * Enables all syscalls (for kernel domain)
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableSyscalls(getName(), null, monitor);
+ }
+
+ /**
+ * Enables a dynamic probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, String probe) throws ExecutionException {
+ enableProbe(eventName, probe, new NullProgressMonitor());
+ }
+
+ /**
+ * Enables a dynamic probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableProbe(getName(), null, eventName, probe, monitor);
+ }
+
+ /**
+ * Enables a dynamic function entry/return probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @throws ExecutionException
+ */
+ public void enableFunctionProbe(String eventName, String probe) throws ExecutionException {
+ enableFunctionProbe(eventName, probe, new NullProgressMonitor());
+ }
+
+ /**
+ * Enables a dynamic function entry/return probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param probe - the actual probe
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableFunctionProbe(getName(), null, eventName, probe, monitor);
}
}
// Accessors
// ------------------------------------------------------------------------
+ /**
+ * @return the parent target node
+ */
+ public TargetNodeComponent getTargetNode() {
+ return (TargetNodeComponent)getParent();
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
* @param monitor - a progress monitor
* @throws ExecutionException
*/
- public void enableChannel(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException;
+ public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException;
/**
* Disables a list of channels for given session and given channel information (configuration).
* @param monitor - a progress monitor
* @throws ExecutionException
*/
- public void disableChannel(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
+ public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
/**
* Enables a list of events with no additional parameters.
* @param monitor - a progress monitor
* @throws ExecutionException
*/
- public void enableEvent(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
-
+ public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException;
+
+ /**
+ * Enables all syscall events.
+ * @param sessionName - a session name
+ * @param channelName - a channel name (null for default channel)
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException;
+
+ /**
+ * Enables a dynamic probe.
+ * @param sessionName - a session name
+ * @param channelName - a channel name (null for default channel)
+ * @param monitor - a progress monitor
+ * @param eventName - a event name
+ * @param probe - a dynamic probe information
+ * @throws ExecutionException
+ */
+ public void enableProbe(String sessionName, String channelName, String eventName, String probe, IProgressMonitor monitor) throws ExecutionException;
+
+ /**
+ * Enables a dynamic function entry/return probe.
+ * @param sessionName - a session name
+ * @param channelName - a channel name (null for default channel)
+ * @param monitor - a progress monitor
+ * @param eventName - a event name
+ * @param function - a dynamic function entry/return probe information
+ * @throws ExecutionException
+ */
+ public void enableFunctionProbe(String sessionName, String channelName, String eventName, String probe, IProgressMonitor monitor) throws ExecutionException;
+
/**
* Disables a list of events with no additional parameters.
* @param sessionName - a session name
* Command line option for specifying all events.
*/
private final static String OPTION_ALL = " -a "; //$NON-NLS-1$
+ /**
+ * Command line option for specifying tracepoint events.
+ */
+ private final static String OPTION_TRACEPOINT = " --tracepoint "; //$NON-NLS-1$
+ /**
+ * Command line option for specifying syscall events.
+ */
+ private final static String OPTION_SYSCALL = " --syscall "; //$NON-NLS-1$
+ /**
+ * Command line option for specifying a dynamic probe.
+ */
+ private final static String OPTION_PROBE = " --probe "; //$NON-NLS-1$
+ /**
+ * Command line option for specifying a dynamic function entry/return probe.
+ */
+ private final static String OPTION_FUNCTION_PROBE = " --function "; //$NON-NLS-1$
/**
* Optional command line option for configuring a channel's overwrite mode.
*/
* @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#enableChannel(java.lang.String, java.util.List, boolean, org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableChannel(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
+ public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException {
// no channels to enable
if (channelNames.size() == 0) {
* @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#disableChannel(java.lang.String, java.util.List, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void disableChannel(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
// no channels to enable
if (channelNames.size() == 0) {
* @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#enableEvent(java.lang.String, java.lang.String, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void enableEvent(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+ public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
String newSessionName = formatParameter(sessionName);
command.append(OPTION_CHANNEL);
command.append(channelName);
}
+
+ command.append(OPTION_TRACEPOINT);
+
+ ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor);
+
+ if (isError(result)) {
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + formatOutput(result.getOutput())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#enableSyscalls(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException {
+ String newSessionName = formatParameter(sessionName);
+
+ StringBuffer command = new StringBuffer(COMMAND_ENABLE_EVENT);
+
+ command.append(OPTION_ALL);
+ command.append(OPTION_KERNEL);
+
+ command.append(OPTION_SESSION);
+ command.append(newSessionName);
+
+ if (channelName != null) {
+ command.append(OPTION_CHANNEL);
+ command.append(channelName);
+ }
+
+ command.append(OPTION_SYSCALL);
+
ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor);
if (isError(result)) {
throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + formatOutput(result.getOutput())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#enableProbe(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void enableProbe(String sessionName, String channelName, String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ String newSessionName = formatParameter(sessionName);
+
+ StringBuffer command = new StringBuffer(COMMAND_ENABLE_EVENT);
+
+ command.append(eventName);
+ command.append(OPTION_KERNEL);
+
+ command.append(OPTION_SESSION);
+ command.append(newSessionName);
+
+ if (channelName != null) {
+ command.append(OPTION_CHANNEL);
+ command.append(channelName);
}
+
+ command.append(OPTION_PROBE);
+ command.append(probe);
+
+ ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor);
+
+ if (isError(result)) {
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + formatOutput(result.getOutput())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#enableFunctionProbe(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void enableFunctionProbe(String sessionName, String channelName, String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+ String newSessionName = formatParameter(sessionName);
+
+ StringBuffer command = new StringBuffer(COMMAND_ENABLE_EVENT);
+
+ command.append(eventName);
+ command.append(OPTION_KERNEL);
+
+ command.append(OPTION_SESSION);
+ command.append(newSessionName);
+
+ if (channelName != null) {
+ command.append(OPTION_CHANNEL);
+ command.append(channelName);
+ }
+
+ command.append(OPTION_FUNCTION_PROBE);
+ command.append(probe);
+
+ ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor);
+
+ if (isError(result)) {
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + formatOutput(result.getOutput())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#disableEvent(java.lang.String, java.lang.String, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor)