Add further support for enabling kernel events
authorBernd Hufmann <bhufmann@gmail.com>
Tue, 28 Feb 2012 20:50:33 +0000 (15:50 -0500)
committerBernd Hufmann <bhufmann@gmail.com>
Tue, 28 Feb 2012 20:50:33 +0000 (15:50 -0500)
32 files changed:
org.eclipse.linuxtools.lttng.ui/plugin.properties
org.eclipse.linuxtools.lttng.ui/plugin.xml
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/Messages.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/CreateChannelDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/CreateSessionDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/EnableKernelEventDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/GetEventInfoDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IEnableKernelEventsDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/NewConnectionDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/AssignEventHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseControlViewHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseEnableEventHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseNodeHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/ChangeChannelStateHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/ChangeEventStateHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/ChangeSessionStateHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/CreateChannelOnDomainHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/CreateChannelOnSessionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/CreateSessionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/DestroySessionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnChannelHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnDomainHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnSessionHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/NewConnectionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/messages.properties
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceChannelComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceDomainComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceSessionComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceSessionGroup.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/service/ILttngControlService.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/service/LTTngControlService.java

index fd0743ebdc69788dc38c72aec6726a9b560b3205..2e51a180a176dc67008674d47cda53e26f8ab960 100644 (file)
@@ -95,9 +95,12 @@ commands.control.stop.description=Stop Trace Session
 #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
 
index ddf2340079db5a4598d6783b0337b35594668b1b..9d5d38d1e6ff0ff7b17fd1197a83ddff2addf5b9 100644 (file)
             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>
 
     <!-- ======================================= -->
index e96da01d05aa0f155f92498f37f1bd13e2f42289..bb2f695ff13c7ab0fd3a797ce9140a1faa032f92 100644 (file)
@@ -82,7 +82,7 @@ final public class Messages extends NLS {
     
     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;
@@ -101,15 +101,24 @@ final public class Messages extends NLS {
     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;
index a27af8513ed577ecb5cd725028f8ffa6be0d561a..1a062a9c4ab1ee63f7b7b7ebbf652d43b563d9ad 100644 (file)
@@ -197,7 +197,7 @@ public class CreateChannelDialog extends Dialog implements ICreateChannelOnSessi
         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);
@@ -303,7 +303,7 @@ public class CreateChannelDialog extends Dialog implements ICreateChannelOnSessi
         }
 
         // 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$
index 1a3073a8de8cb88ee68edd219cbcdae30d0938b2..ef66896e6c4c9ba1f8bbc38f42633321793966c4 100644 (file)
@@ -224,7 +224,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         }
 
         // 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$
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/EnableKernelEventDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/EnableKernelEventDialog.java
new file mode 100644 (file)
index 0000000..03f88ab
--- /dev/null
@@ -0,0 +1,469 @@
+/**********************************************************************
+ * 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
+    // ------------------------------------------------------------------------
+    
+    
+}
index 8729eb4f95e7eefdcc91297e63c612a8edd90342..639929f173faf2d28c30169d3a0765a3d2690461 100644 (file)
@@ -30,7 +30,6 @@ import org.eclipse.swt.layout.GridLayout;
 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;
 
 /**
@@ -106,6 +105,7 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
         super(shell);
         fIsKernel = isKernel;
         fSessions = Arrays.copyOf(sessions, sessions.length);
+        setShellStyle(SWT.RESIZE);
     }
 
     // ------------------------------------------------------------------------
@@ -153,10 +153,9 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
         // 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);
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IEnableKernelEventsDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IEnableKernelEventsDialog.java
new file mode 100644 (file)
index 0000000..7362eac
--- /dev/null
@@ -0,0 +1,70 @@
+/**********************************************************************
+ * 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
index 0adec5e0f170597450455df0eaba1e906cdd81ca..dd7edec72d49b3cfab5e3b726e7125ef78424835 100644 (file)
@@ -109,6 +109,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         if (hosts != null) {
             fExistingHosts = Arrays.copyOf(hosts, hosts.length);
         }
+        setShellStyle(SWT.RESIZE);
     }
 
     // ------------------------------------------------------------------------
@@ -156,19 +157,20 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         // 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++) {
@@ -180,13 +182,13 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
 
         // 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);
         
@@ -236,10 +238,11 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
         });
         
         // 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);
index b637ddde49dd6e701c7042b417b1c21aea5dc4ca..c169e4259cf02920e9cfac076af74c851ee466d9 100644 (file)
@@ -109,9 +109,9 @@ public class AssignEventHandler extends AbstractHandler {
                     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) {
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseControlViewHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseControlViewHandler.java
new file mode 100644 (file)
index 0000000..59e3a21
--- /dev/null
@@ -0,0 +1,54 @@
+/**********************************************************************
+ * 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
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseEnableEventHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseEnableEventHandler.java
new file mode 100644 (file)
index 0000000..713af55
--- /dev/null
@@ -0,0 +1,163 @@
+/**********************************************************************
+ * 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;
+    }
+}
index feecfb3f6a9663f39aa3a27d4e1ba65d1f0856cc..51813b37601f8a53161cd6b7cce0a697e5a75eda 100644 (file)
  **********************************************************************/
 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>
@@ -27,7 +23,7 @@ import org.eclipse.ui.PlatformUI;
  * Command handler implementation to delete a target host.
  * </p>
  */
-abstract public class BaseNodeHandler extends AbstractHandler {
+abstract public class BaseNodeHandler extends BaseControlViewHandler {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -46,25 +42,15 @@ abstract public class BaseNodeHandler extends AbstractHandler {
      */
     @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) {
@@ -73,4 +59,6 @@ abstract public class BaseNodeHandler extends AbstractHandler {
         }
         return fTargetNode != null;
     }
+
+    
 }
\ No newline at end of file
index ac1d2cc72dfccae22654f324356b50fc29701a2a..dd8912a0f9c51a88dd0118ac4cac315df35715a3 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 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;
@@ -32,7 +31,6 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComp
 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;
 
@@ -42,7 +40,7 @@ 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
@@ -171,23 +169,12 @@ abstract public class ChangeChannelStateHandler extends AbstractHandler {
     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) {
index 362734a9707ae66e00c76e6602b70a325d1e954a..a69f09808dcb4b5eb66bf64ae1a0ac07618615bb 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 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;
@@ -32,7 +31,6 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComp
 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;
 
@@ -42,7 +40,7 @@ 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
@@ -152,24 +150,13 @@ abstract public class ChangeEventStateHandler extends AbstractHandler {
      */
     @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);
index 08f28df4a632ace5755e799fa06b75f9b5f84f13..15b7dcce560781cda4e6b1e561dd685f2b9b33be 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 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;
@@ -30,7 +29,6 @@ import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
 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;
 
@@ -40,7 +38,7 @@ 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
@@ -114,24 +112,13 @@ abstract public class ChangeSessionStateHandler extends AbstractHandler {
      */
     @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);
index 30a8d8d9b9629e7343e1dad60442623781f19816..65adabe53dc9de77909740d01e796f2d2a61e9ae 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 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;
@@ -34,7 +33,6 @@ 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;
-import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 
@@ -44,7 +42,7 @@ 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
@@ -123,24 +121,13 @@ public class CreateChannelOnDomainHandler extends AbstractHandler {
      */
     @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);
index 6da2c81d149a1d1de44a2cbee1fa834b133eed38..8755b28b388d0019f3ef3047a9e496739ace5abc 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 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;
@@ -45,7 +44,7 @@ import org.eclipse.ui.PlatformUI;
  * (on session level).
  * </p>
  */
-public class CreateChannelOnSessionHandler extends AbstractHandler {
+public class CreateChannelOnSessionHandler extends BaseControlViewHandler {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -124,24 +123,13 @@ public class CreateChannelOnSessionHandler extends AbstractHandler {
      */
     @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);
index 77ecd2c9f462e3518ebc2c45b7277acd242b8db0..8d3f20addd9b1907dd615a0587dc6f8a13cd4fcc 100644 (file)
@@ -11,7 +11,6 @@
  **********************************************************************/
 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;
@@ -28,7 +27,6 @@ import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.CreateSessionDialog
 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;
 
@@ -38,7 +36,7 @@ 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
@@ -95,24 +93,14 @@ public class CreateSessionHandler extends AbstractHandler {
      */
     @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);
index 67a6d0146001d961bc09c53eed3732f8efa7d639..10baaac5ce80164801035e18c34d2c6a85dcc01e 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 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;
@@ -32,7 +31,6 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
 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;
 
@@ -42,7 +40,7 @@ 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
@@ -109,24 +107,12 @@ public class DestroySessionHandler extends AbstractHandler {
      */
     @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);
index e021cc535e213014a9470cc52ae48afaff818ebe..f6972f38204fcdf127cca4d3d4f91afac8d5d6f2 100644 (file)
@@ -47,6 +47,6 @@ public class EnableEventHandler extends ChangeEventStateHandler {
      */
     @Override
     protected void changeState(TraceChannelComponent channel, List<String> eventNames, IProgressMonitor monitor) throws ExecutionException{ 
-        channel.enableEvent(eventNames, monitor);
+        channel.enableEvents(eventNames, monitor);
     }
 }
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnChannelHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnChannelHandler.java
new file mode 100644 (file)
index 0000000..2c20bdd
--- /dev/null
@@ -0,0 +1,107 @@
+/**********************************************************************
+ * 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;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnDomainHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnDomainHandler.java
new file mode 100644 (file)
index 0000000..47b282f
--- /dev/null
@@ -0,0 +1,114 @@
+/**********************************************************************
+ * 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;
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnSessionHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnSessionHandler.java
new file mode 100644 (file)
index 0000000..52b8dee
--- /dev/null
@@ -0,0 +1,109 @@
+/**********************************************************************
+ * 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;
+    }
+}
index 118e8206c5ff7050f5e8d016dcbd8529012c6752..0fba7326ba2dcb693f185f65737d8f427bc9ed4d 100644 (file)
@@ -11,7 +11,6 @@
  **********************************************************************/
 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;
@@ -37,7 +36,7 @@ import org.eclipse.ui.PlatformUI;
  * Command handler for creation new connection for trace control.
  * </p>
  */
-public class NewConnectionHandler extends AbstractHandler {
+public class NewConnectionHandler extends BaseControlViewHandler {
 
     // ------------------------------------------------------------------------
     // Constants
@@ -137,22 +136,17 @@ public class NewConnectionHandler extends AbstractHandler {
      */
     @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);
index 00e6268e30bf754e2f236c75b3aa0c958cc81a52..1fedcabf75b7e0d1faa8e56f786bcd1dd13c42f4 100644 (file)
@@ -55,7 +55,7 @@ TraceControl_FileSubSystemError=File subsystem error in session creation dialog.
 
 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.
@@ -74,6 +74,22 @@ TraceControl_EnableEventsChannelsTooltip=List of available channels of selected
 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
index cfda00de562592f96093d052aab76fccb3635097..7e48a1a2c140091cd6edaeb0b9db8bcefbace630 100644 (file)
@@ -235,6 +235,13 @@ public class TraceChannelComponent extends TraceControlComponent {
         return ((TraceDomainComponent)getParent()).isKernel();
     }
     
+    /**
+     * @return the parent target node
+     */
+    public TargetNodeComponent getTargetNode() {
+        return ((TraceDomainComponent)getParent()).getTargetNode();
+    }
+    
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -243,8 +250,8 @@ public class TraceChannelComponent extends TraceControlComponent {
      * @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());
     }
 
     /**
@@ -253,8 +260,67 @@ public class TraceChannelComponent extends TraceControlComponent {
      * @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);
     }
     
     /**
index 5163df7606a569be2887544ce4068566a4549c49..5283d1f8f907a0a83d5e2caa937f397f861f5c57 100644 (file)
@@ -127,6 +127,13 @@ public class TraceDomainComponent extends TraceControlComponent {
         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
@@ -168,7 +175,7 @@ public class TraceDomainComponent extends TraceControlComponent {
      * @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. 
@@ -185,6 +192,76 @@ public class TraceDomainComponent extends TraceControlComponent {
      * @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);
     }
 }
index 96a28d1913b49c5943f376b29fd2791cf1b48a46..5279710e49dbf8f7c56f7b1e85e23475c899f8d3 100644 (file)
@@ -181,6 +181,13 @@ public class TraceSessionComponent extends TraceControlComponent {
         return (TraceDomainComponent[])sessions.toArray(new TraceDomainComponent[sessions.size()]);
     }
     
+    /**
+     * @return the parent target node
+     */
+    public TargetNodeComponent getTargetNode() {
+        return ((TraceSessionGroup)getParent()).getTargetNode();
+    }
+    
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -249,7 +256,7 @@ public class TraceSessionComponent extends TraceControlComponent {
      * @throws ExecutionException
      */
     public void enableEvent(List<String> eventNames, boolean isKernel) throws ExecutionException {
-        enableEvent(eventNames, isKernel, new NullProgressMonitor());
+        enableEvents(eventNames, isKernel, new NullProgressMonitor());
     }
 
     /**
@@ -259,7 +266,66 @@ public class TraceSessionComponent extends TraceControlComponent {
      * @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);
     }
 }
index bce872311a7ff264c5ca24e54966d0e729d56de3..5b1a5a5180b1ff3047afd2e82a141caa4acfcac2 100644 (file)
@@ -53,6 +53,13 @@ public class TraceSessionGroup extends TraceControlComponent {
     // Accessors
     // ------------------------------------------------------------------------
 
+    /**
+     * @return the parent target node
+     */
+    public TargetNodeComponent getTargetNode() {
+        return (TargetNodeComponent)getParent();
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
index 13a99e56112f4cb5ebdb3751436a57515e29c55f..a69d8aefe72dba79dbc7033a693aa945a13453f9 100644 (file)
@@ -110,7 +110,7 @@ public interface ILttngControlService {
       * @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). 
@@ -120,7 +120,7 @@ public interface ILttngControlService {
       * @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.
@@ -131,8 +131,39 @@ public interface ILttngControlService {
      * @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
index 4f6fac63ee0753bfd13ebcaf675feebefe4bfac0..2d1723714bdafe7f2ac33ea274711053c4ecd611 100644 (file)
@@ -116,6 +116,22 @@ public class LTTngControlService implements ILttngControlService {
      * 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.
      */
@@ -606,7 +622,7 @@ public class LTTngControlService implements ILttngControlService {
      * @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) {
@@ -672,7 +688,7 @@ public class LTTngControlService implements ILttngControlService {
      * @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) {
@@ -712,7 +728,7 @@ public class LTTngControlService implements ILttngControlService {
      * @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);
         
@@ -748,14 +764,108 @@ public class LTTngControlService implements ILttngControlService {
             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)
This page took 0.062832 seconds and 5 git commands to generate.