Update enable channel and event dialogs and handlers
authorBernd Hufmann <bhufmann@gmail.com>
Mon, 23 Apr 2012 19:21:19 +0000 (15:21 -0400)
committerBernd Hufmann <bhufmann@gmail.com>
Mon, 23 Apr 2012 19:21:19 +0000 (15:21 -0400)
22 files changed:
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java
org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java
org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateChannelDialogStub.java [deleted file]
org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/icons/elcl16/disable_event.gif [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/icons/elcl16/enable_event.gif [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/plugin.properties
org.eclipse.linuxtools.lttng2.ui/plugin.xml
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateChannelDialog.java [deleted file]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/GetEventInfoDialog.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateChannelDialog.java [deleted file]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/TraceControlDialogFactory.java
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseCreateChannelHandler.java [deleted file]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateChannelOnDomainHandler.java [deleted file]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateChannelOnSessionHandler.java [deleted file]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnDomainHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java [new file with mode: 0644]

index ac70305cedaf3058a77c4b57eabd8beb58ff6f45..4843b4f9f984fe94964a254fba5096172293f889 100644 (file)
@@ -23,7 +23,7 @@ import junit.framework.TestSuite;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.AddContextDialogStub;
-import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateChannelDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableEventsDialogStub;
@@ -173,13 +173,13 @@ public class TraceControlKernelSessionTests extends TestCase {
         fProxy.setScenario(SCEN_SCENARIO3_TEST);
         
         // ------------------------------------------------------------------------
-        // Create channel on session
+        // Enable channel on session
         // ------------------------------------------------------------------------
-        CreateChannelDialogStub channelStub = new CreateChannelDialogStub();
+        EnableChannelDialogStub channelStub = new EnableChannelDialogStub();
         channelStub.setIsKernel(true);
-        TraceControlDialogFactory.getInstance().setCreateChannelDialog(channelStub);
+        TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
 
-        fFacility.executeCommand(session, "createChannelOnSession");
+        fFacility.executeCommand(session, "enableChannelOnSession");
         
         // Verify that Kernel domain was created
         ITraceControlComponent[] domains = session.getChildren();
@@ -216,7 +216,7 @@ public class TraceControlKernelSessionTests extends TestCase {
         info.setReadTimer(200);
         channelStub.setChannelInfo(info);
         
-        fFacility.executeCommand(domains[0], "createChannelOnDomain");
+        fFacility.executeCommand(domains[0], "enableChannelOnDomain");
         
         // Get Kernel domain component instance
         domains = session.getChildren();
index 0994ffe057df5d6e9b66ce8916482b1fb5b24c06..3aeba2ab3913e86bc164046b552758ada0268d54 100644 (file)
@@ -20,7 +20,7 @@ import junit.framework.TestSuite;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateChannelDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.GetEventInfoDialogStub;
@@ -183,18 +183,18 @@ public class TraceControlUstProviderTests extends TestCase {
         assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
         
         // ------------------------------------------------------------------------
-        // Create Channel on UST global domain
+        // Enable Channel on UST global domain
         // ------------------------------------------------------------------------
         fProxy.setScenario(SCEN_SCENARIO2_TEST);
-        CreateChannelDialogStub channelDialogStub = new CreateChannelDialogStub();
+        EnableChannelDialogStub channelDialogStub = new EnableChannelDialogStub();
         channelDialogStub.setIsKernel(false);
         channelDialogStub.getChannelInfo().setOverwriteMode(false);
         channelDialogStub.getChannelInfo().setSwitchTimer(200);
         channelDialogStub.getChannelInfo().setReadTimer(100);
         channelDialogStub.getChannelInfo().setNumberOfSubBuffers(2);
-        TraceControlDialogFactory.getInstance().setCreateChannelDialog(channelDialogStub);
+        TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelDialogStub);
 
-        fFacility.executeCommand(session, "createChannelOnSession");
+        fFacility.executeCommand(session, "enableChannelOnSession");
         
         // Verify that UST domain was created
         ITraceControlComponent[] domains = session.getChildren();
index 5b6d3206304691d1e295d846af18855de0a9d5b6..d5189bddd35169ac5dca932d8ad5eed7f729d18d 100644 (file)
@@ -22,7 +22,7 @@ import junit.framework.TestSuite;
 
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateChannelDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableEventsDialogStub;
@@ -170,11 +170,11 @@ public class TraceControlUstSessionTests extends TestCase {
         // ------------------------------------------------------------------------
         // Enable default channel on created session above
         // ------------------------------------------------------------------------
-        CreateChannelDialogStub channelStub = new CreateChannelDialogStub();
+        EnableChannelDialogStub channelStub = new EnableChannelDialogStub();
         channelStub.setIsKernel(false);
-        TraceControlDialogFactory.getInstance().setCreateChannelDialog(channelStub);
+        TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
 
-        fFacility.executeCommand(session, "createChannelOnSession");
+        fFacility.executeCommand(session, "enableChannelOnSession");
         
         // Verify that Kernel domain was created
         ITraceControlComponent[] domains = session.getChildren();
@@ -211,7 +211,7 @@ public class TraceControlUstSessionTests extends TestCase {
         info.setReadTimer(200);
         channelStub.setChannelInfo(info);
         
-        fFacility.executeCommand(domains[0], "createChannelOnDomain");
+        fFacility.executeCommand(domains[0], "enableChannelOnDomain");
 
         // Get Kernel domain component instance
         domains = session.getChildren();
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateChannelDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateChannelDialogStub.java
deleted file mode 100644 (file)
index 187f9cc..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/**********************************************************************
- * 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.internal.lttng2.stubs.dialogs;
-
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.ChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
-
-/**
- * Create channel dialog stub implementation. 
- */
-public class CreateChannelDialogStub implements ICreateChannelDialog {
-    
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    private TraceDomainComponent fDomain;
-    private ChannelInfo fChannelInfo;
-    private boolean fIsKernel;
-    
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-    public CreateChannelDialogStub() {
-        fChannelInfo = new ChannelInfo("mychannel"); //$NON-NLS-1$
-        fChannelInfo.setNumberOfSubBuffers(4);
-        fChannelInfo.setOverwriteMode(true);
-        fChannelInfo.setReadTimer(200);
-        fChannelInfo.setSwitchTimer(100);
-        fChannelInfo.setSubBufferSize(16384);
-    }
-   
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-    public void setIsKernel(boolean isKernel) {
-        fIsKernel = isKernel;
-    }
-    
-    @Override
-    public IChannelInfo getChannelInfo() {
-        return fChannelInfo;
-    }
-
-    @Override
-    public void setDomainComponent(TraceDomainComponent domain) {
-        fDomain = domain;
-        if (fDomain != null) {
-            fIsKernel = fDomain.isKernel();
-        }
-    }
-
-    @Override
-    public int open() {
-        return 0;
-    }
-
-    @Override
-    public boolean isKernel() {
-        return fIsKernel;
-    }
-    
-    public void setChannelInfo(ChannelInfo info) {
-        fChannelInfo = info;
-    }
-}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java
new file mode 100644 (file)
index 0000000..532d5f4
--- /dev/null
@@ -0,0 +1,76 @@
+/**********************************************************************
+ * 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.internal.lttng2.stubs.dialogs;
+
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableChannelDialog;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.ChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
+
+/**
+ * Create channel dialog stub implementation. 
+ */
+public class EnableChannelDialogStub implements IEnableChannelDialog {
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    private TraceDomainComponent fDomain;
+    private ChannelInfo fChannelInfo;
+    private boolean fIsKernel;
+    
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+    public EnableChannelDialogStub() {
+        fChannelInfo = new ChannelInfo("mychannel"); //$NON-NLS-1$
+        fChannelInfo.setNumberOfSubBuffers(4);
+        fChannelInfo.setOverwriteMode(true);
+        fChannelInfo.setReadTimer(200);
+        fChannelInfo.setSwitchTimer(100);
+        fChannelInfo.setSubBufferSize(16384);
+    }
+   
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+    public void setIsKernel(boolean isKernel) {
+        fIsKernel = isKernel;
+    }
+    
+    @Override
+    public IChannelInfo getChannelInfo() {
+        return fChannelInfo;
+    }
+
+    @Override
+    public void setDomainComponent(TraceDomainComponent domain) {
+        fDomain = domain;
+        if (fDomain != null) {
+            fIsKernel = fDomain.isKernel();
+        }
+    }
+
+    @Override
+    public int open() {
+        return 0;
+    }
+
+    @Override
+    public boolean isKernel() {
+        return fIsKernel;
+    }
+    
+    public void setChannelInfo(ChannelInfo info) {
+        fChannelInfo = info;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng2.ui/icons/elcl16/disable_event.gif b/org.eclipse.linuxtools.lttng2.ui/icons/elcl16/disable_event.gif
new file mode 100644 (file)
index 0000000..2966a28
Binary files /dev/null and b/org.eclipse.linuxtools.lttng2.ui/icons/elcl16/disable_event.gif differ
diff --git a/org.eclipse.linuxtools.lttng2.ui/icons/elcl16/enable_event.gif b/org.eclipse.linuxtools.lttng2.ui/icons/elcl16/enable_event.gif
new file mode 100644 (file)
index 0000000..06d0079
Binary files /dev/null and b/org.eclipse.linuxtools.lttng2.ui/icons/elcl16/enable_event.gif differ
index e99ca54713b190b0c83c9fd5bb2ee7b47830b596..6009a23ad8da4a4345224e566c9ef1261bd40aa1 100644 (file)
@@ -90,8 +90,11 @@ commands.control.create.session.description=Create a Trace Session
 commands.control.destroy.session=Destroy Session...
 commands.control.destroy.session.description=Destroy a Trace Session
 
-commands.control.create.channel=Create Channel...
-commands.control.create.channel.description=Create a Trace Channel
+commands.control.enable.channelOnSession=Enable Channel...
+commands.control.enable.channelOnSession.description=Enable a Trace Channel
+
+commands.control.enable.channelOnDomain=Enable Channel...
+commands.control.enable.channelOnDomain.description=Enable a Trace Channel
 
 commands.control.enable.channel=Enable Channel
 commands.control.enable.channel.description=Enable a Trace Channel
index 48379557b50242ca206a4aecaf075c1d7a3348b3..e686aa0ae47d27917c369e8761dc04d647ea96a0 100644 (file)
       </command>
       <command
             categoryId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.category"
-            description="%commands.control.create.channel.description"
-            id="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.createChannelOnSession"
-            name="%commands.control.create.channel">
+            description="%commands.control.enable.channelOnSession.description"
+            id="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableChannelOnSession"
+            name="%commands.control.enable.channelOnSession">
       </command>
       <command
             categoryId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.category"
-            description="%commands.control.create.channel.description"
-            id="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.createChannelOnDomain"
-            name="%commands.control.create.channel">
+            description="%commands.control.enable.channelOnDomain.description"
+            id="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableChannelOnDomain"
+            name="%commands.control.enable.channelOnDomain">
       </command>
       <command
             categoryId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.category"
                visible="true">
          </separator>
          <command
-               commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.createChannelOnSession"
+               commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableChannelOnSession"
                icon="icons/elcl16/add_button.gif"
-               label="%commands.control.create.channel"
+               label="%commands.control.enable.channelOnSession"
                style="push">
             <visibleWhen
                   checkEnabled="false">
          </command>
          <command
                commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableEventOnSession"
-               icon="icons/elcl16/enable.gif"
+               icon="icons/obj16/event_enabled.gif"
                label="%commands.control.enable.eventOnDomain"
                style="push">
             <visibleWhen
             </visibleWhen>
          </command>
          <command
-               commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.createChannelOnDomain"
+               commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableChannelOnDomain"
                icon="icons/elcl16/add_button.gif"
-               label="%commands.control.create.channel"
+               label="%commands.control.enable.channelOnDomain"
                style="push">
             <visibleWhen
                   checkEnabled="false">
          </command>
          <command
                commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableEventOnDomain"
-               icon="icons/elcl16/enable.gif"
+               icon="icons/elcl16/enable_event.gif"
                label="%commands.control.enable.eventOnDomain"
                style="push">
             <visibleWhen
 
          <command
                commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.assign.event"
-               icon="icons/elcl16/enable.gif"
+               icon="icons/elcl16/enable_event.gif"
                label="%commands.control.assign.event"
                style="push">
             <visibleWhen
 
          <command
                commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableEvent"
-               icon="icons/elcl16/enable.gif"
+               icon="icons/elcl16/enable_event.gif"
                label="%commands.control.enable.event"
                style="push">
             <visibleWhen
 
          <command
                commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.disableEvent"
-               icon="icons/elcl16/disable.gif"
+               icon="icons/elcl16/disable_event.gif"
                label="%commands.control.disable.event"
                style="push">
             <visibleWhen
          </command>
          <command
                commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableEventOnChannel"
-               icon="icons/elcl16/enable.gif"
+               icon="icons/elcl16/enable_event.gif"
                label="%commands.control.enable.eventOnChannel"
                style="push">
             <visibleWhen
          </activeWhen>
       </handler>
       <handler
-            class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CreateChannelOnSessionHandler"
-            commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.createChannelOnSession">
+            class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.EnableChannelOnSessionHandler"
+            commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableChannelOnSession">
          <activeWhen>
             <with
                   variable="selection">
          </activeWhen>
       </handler>
       <handler
-            class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CreateChannelOnDomainHandler"
-            commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.createChannelOnDomain">
+            class="org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.EnableChannelOnDomainHandler"
+            commandId="org.eclipse.linuxtools.internal.lttng2.ui.commands.control.enableChannelOnDomain">
          <activeWhen>
             <with
                   variable="selection">
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateChannelDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateChannelDialog.java
deleted file mode 100644 (file)
index b250711..0000000
+++ /dev/null
@@ -1,373 +0,0 @@
-/**********************************************************************
- * 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.internal.lttng2.ui.views.control.dialogs;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.ChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Point;
-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>CreateChannelDialog</u></b>
- * <p>
- * Dialog box for collecting channel creation information.
- * </p>
- */
-public class CreateChannelDialog extends Dialog implements ICreateChannelDialog {
-
-    // ------------------------------------------------------------------------
-    // Constants
-    // ------------------------------------------------------------------------
-    /**
-     * The icon file for this dialog box.
-     */
-    public static final String ENABLE_CHANNEL_ICON_FILE = "icons/elcl16/add_button.gif"; //$NON-NLS-1$ 
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    /**
-     * The dialog composite.
-     */
-    private Composite fDialogComposite = null;
-    /**
-     * The text widget for the channel name
-     */
-    private Text fChannelNameText = null;
-    /**
-     * The discard mode of the channel.
-     */
-    private Button fDiscardModeButton = null;
-    /**
-     * The overwrite mode of the channel.
-     */
-    private Button fOverwriteModeButton = null;
-    /**
-     * The sub-buffer size of the channel.
-     */
-    private Text fSubBufferSizeText = null;
-    /**
-     * The number of sub-buffers of the channel.
-     */
-    private Text fNumberOfSubBuffersText = null;
-    /**
-     * The switch timer interval of the channel.
-     */
-    private Text fSwitchTimerText = null;
-    /**
-     * The read timer interval of the channel.
-     */
-    private Text fReadTimerText = null;
-    /**
-     * Group composite for domain selection.
-     */
-    private Group fDomainGroup = null;
-    /**
-     * Radio button for selecting kernel domain.
-     */
-    private Button fKernelButton = null;
-    /**
-     * Radio button for selecting UST domain.
-     */
-    private Button fUstButton = null;
-    /**
-     * The parent domain component where the channel node should be added. 
-     * Null in case of creation on session level.
-     */
-    private TraceDomainComponent fDomain = null;
-    /**
-     * Common verify listener for numeric text input.  
-     */
-    private VerifyListener fVerifyListener = null;
-    /**
-     * Output channel information.
-     */
-    private IChannelInfo fChannelInfo = null;
-    /**
-     * Output domain information. True in case of Kernel domain. False for UST.     
-     */
-    private boolean fIsKernel;
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     * @param shell - a shell for the display of the dialog
-     */
-    public CreateChannelDialog(Shell shell) {
-       super(shell);
-       fIsKernel = true;
-
-        // Common verify listener
-        fVerifyListener = new VerifyListener() {
-            @Override
-            public void verifyText(VerifyEvent e) {
-                // only numbers are allowed.
-                e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
-            }
-        };
-    }
-
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog#getChannelInfo()
-     */
-    @Override
-    public IChannelInfo getChannelInfo() {
-        return fChannelInfo;
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog#setDomainComponent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent)
-     */
-    @Override
-    public void setDomainComponent(TraceDomainComponent domain) {
-        fDomain = domain;
-        if (fDomain != null) {
-            fIsKernel = fDomain.isKernel();
-        } else {
-            fIsKernel = true;
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog#isKernel()
-     */
-    @Override
-    public boolean isKernel() {
-        return fIsKernel;
-    }
-
-    // ------------------------------------------------------------------------
-    // 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_EnableChannelDialogTitle);
-        newShell.setImage(Activator.getDefault().loadIcon(ENABLE_CHANNEL_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(2, true);
-        fDialogComposite.setLayout(layout); 
-
-        Label channelNameLabel = new Label(fDialogComposite, SWT.RIGHT);
-        channelNameLabel.setText(Messages.TraceControl_EnableChannelNameLabel);
-        fChannelNameText = new Text(fDialogComposite, SWT.NONE);
-        fChannelNameText.setToolTipText(Messages.TraceControl_EnableChannelNameTooltip);
-        
-        Label subBufferSizeLabel = new Label(fDialogComposite, SWT.RIGHT);
-        subBufferSizeLabel.setText(Messages.TraceControl_SubBufferSizePropertyName);
-        fSubBufferSizeText = new Text(fDialogComposite, SWT.NONE);
-        fSubBufferSizeText.setToolTipText(Messages.TraceControl_EnableChannelSubBufferSizeTooltip);
-        fSubBufferSizeText.addVerifyListener(fVerifyListener);
-        
-        Label numSubBufferLabel = new Label(fDialogComposite, SWT.RIGHT);
-        numSubBufferLabel.setText(Messages.TraceControl_NbSubBuffersPropertyName);
-        fNumberOfSubBuffersText = new Text(fDialogComposite, SWT.NONE);
-        fNumberOfSubBuffersText.setToolTipText(Messages.TraceControl_EnableChannelNbSubBuffersTooltip);
-        fNumberOfSubBuffersText.addVerifyListener(fVerifyListener);
-
-        Label switchTimerLabel = new Label(fDialogComposite, SWT.RIGHT);
-        switchTimerLabel.setText(Messages.TraceControl_SwitchTimerPropertyName);
-        fSwitchTimerText = new Text(fDialogComposite, SWT.NONE);
-        fSwitchTimerText.setToolTipText(Messages.TraceControl_EnableChannelSwitchTimerTooltip);
-        fSwitchTimerText.addVerifyListener(fVerifyListener);
-
-        Label readTimerLabel = new Label(fDialogComposite, SWT.RIGHT);
-        readTimerLabel.setText(Messages.TraceControl_ReadTimerPropertyName);
-        fReadTimerText = new Text(fDialogComposite, SWT.NONE);
-        fReadTimerText.setToolTipText(Messages.TraceControl_EnableChannelReadTimerTooltip);
-        fReadTimerText.addVerifyListener(fVerifyListener);
-
-        Group discardModeGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
-        discardModeGroup.setText(Messages.TraceControl_EnableChannelDiscardModeGroupName);
-        layout = new GridLayout(2, true);
-        discardModeGroup.setLayout(layout); 
-
-        fDiscardModeButton = new  Button(discardModeGroup, SWT.RADIO);
-        fDiscardModeButton.setText(Messages.TraceControl_EnableChannelDiscardModeLabel);
-        fDiscardModeButton.setToolTipText(Messages.TraceControl_EnableChannelDiscardModeTooltip);
-        fDiscardModeButton.setSelection(true);
-        
-        fOverwriteModeButton = new Button(discardModeGroup, SWT.RADIO);
-        fOverwriteModeButton.setText(Messages.TraceControl_EnableChannelOverwriteModeLabel);
-        fOverwriteModeButton.setToolTipText(Messages.TraceControl_EnableChannelOverwriteModeTooltip);
-        fOverwriteModeButton.setSelection(false);
-
-        fDomainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
-        fDomainGroup.setText(Messages.TraceControl_DomainDisplayName);
-        layout = new GridLayout(2, true);
-        fDomainGroup.setLayout(layout); 
-        
-        fKernelButton = new Button(fDomainGroup, SWT.RADIO);
-        fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName);
-        fKernelButton.setSelection(fIsKernel);
-        fUstButton = new Button(fDomainGroup, SWT.RADIO);
-        fUstButton.setText(Messages.TraceControl_UstDisplayName);
-        fUstButton.setSelection(!fIsKernel);
-
-        if (fDomain != null) {
-            fKernelButton.setEnabled(false);
-            fUstButton.setEnabled(false);
-        }
-
-        // layout widgets
-        GridData data = new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1);
-        discardModeGroup.setLayoutData(data);
-        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
-        fDiscardModeButton.setLayoutData(data);
-        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
-        fOverwriteModeButton.setLayoutData(data);
-        
-        data = new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1);
-        fDomainGroup.setLayoutData(data);
-
-        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
-        fKernelButton.setLayoutData(data);
-        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
-        fUstButton.setLayoutData(data);
-        
-        data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
-        fSubBufferSizeText.setText("666.666.666.666"); //$NON-NLS-1$
-        Point minSize = fSubBufferSizeText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-        data.widthHint = minSize.x + 5;
-
-        fChannelNameText.setLayoutData(data);
-        fSubBufferSizeText.setLayoutData(data);
-        fNumberOfSubBuffersText.setLayoutData(data);
-        fSwitchTimerText.setLayoutData(data);
-        fReadTimerText.setLayoutData(data);
-
-        fSubBufferSizeText.setText(""); //$NON-NLS-1$
-
-        setDefaults();
-
-        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.DETAILS_ID, "&Default", true); //$NON-NLS-1$
-        createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$
-        createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
-     */
-    @Override
-    protected void okPressed() {
-        // Set channel information
-        fChannelInfo = new ChannelInfo(fChannelNameText.getText());
-        fChannelInfo.setSubBufferSize(Long.parseLong(fSubBufferSizeText.getText()));
-        fChannelInfo.setNumberOfSubBuffers(Integer.parseInt(fNumberOfSubBuffersText.getText()));
-        fChannelInfo.setSwitchTimer(Long.parseLong(fSwitchTimerText.getText()));
-        fChannelInfo.setReadTimer(Long.parseLong(fReadTimerText.getText()));
-        fChannelInfo.setOverwriteMode(fOverwriteModeButton.getSelection());
-
-        fIsKernel = fKernelButton.getSelection();
-
-        // Check for invalid names
-        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$
-            return;
-        }
-
-        // Check for duplicate names
-        if (fDomain != null && fDomain.containsChild(fChannelInfo.getName())) {
-            MessageDialog.openError(getShell(),
-                    Messages.TraceControl_EnableChannelDialogTitle,
-                    Messages.TraceControl_ChannelAlreadyExistsError + " (" + fChannelInfo.getName() + ") \n");  //$NON-NLS-1$ //$NON-NLS-2$
-            return;
-        }
-
-        // validation successful -> call super.okPressed()
-        super.okPressed();
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
-     */
-    @Override
-    protected void buttonPressed(int buttonId) {
-        if (buttonId == IDialogConstants.DETAILS_ID) {
-            setDefaults();
-            return;
-        }
-        super.buttonPressed(buttonId);
-    }
-
-    // ------------------------------------------------------------------------
-    // Helper methods
-    // ------------------------------------------------------------------------
-    /**
-     * Sets default value depending on Kernel or UST
-     */
-    private void setDefaults() {
-        fSwitchTimerText.setText(String.valueOf(IChannelInfo.DEFAULT_SWITCH_TIMER));
-        fReadTimerText.setText(String.valueOf(IChannelInfo.DEFAULT_READ_TIMER));
-        fOverwriteModeButton.setSelection(IChannelInfo.DEFAULT_OVERWRITE_MODE);
-        if (fKernelButton.getSelection()) {
-            fSubBufferSizeText.setText(String.valueOf(IChannelInfo.DEFAULT_SUB_BUFFER_SIZE_KERNEL));
-            fNumberOfSubBuffersText.setText(String.valueOf(IChannelInfo.DEFAULT_NUMBER_OF_SUB_BUFFERS_KERNEL));
-        } else {
-            fSubBufferSizeText.setText(String.valueOf(IChannelInfo.DEFAULT_SUB_BUFFER_SIZE_UST));
-            fNumberOfSubBuffersText.setText(String.valueOf(IChannelInfo.DEFAULT_NUMBER_OF_SUB_BUFFERS_UST));
-        }
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java
new file mode 100644 (file)
index 0000000..0d8e030
--- /dev/null
@@ -0,0 +1,369 @@
+/**********************************************************************
+ * 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.internal.lttng2.ui.views.control.dialogs;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.ChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+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>EnableChannelDialog</u></b>
+ * <p>
+ * Dialog box for collecting channel information when enabling a channel (which will be created).
+ * </p>
+ */
+public class EnableChannelDialog extends Dialog implements IEnableChannelDialog {
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+    /**
+     * The icon file for this dialog box.
+     */
+    public static final String ENABLE_CHANNEL_ICON_FILE = "icons/elcl16/add_button.gif"; //$NON-NLS-1$ 
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    /**
+     * The dialog composite.
+     */
+    private Composite fDialogComposite = null;
+    /**
+     * The text widget for the channel name
+     */
+    private Text fChannelNameText = null;
+    /**
+     * The discard mode of the channel.
+     */
+    private Button fDiscardModeButton = null;
+    /**
+     * The overwrite mode of the channel.
+     */
+    private Button fOverwriteModeButton = null;
+    /**
+     * The sub-buffer size of the channel.
+     */
+    private Text fSubBufferSizeText = null;
+    /**
+     * The number of sub-buffers of the channel.
+     */
+    private Text fNumberOfSubBuffersText = null;
+    /**
+     * The switch timer interval of the channel.
+     */
+    private Text fSwitchTimerText = null;
+    /**
+     * The read timer interval of the channel.
+     */
+    private Text fReadTimerText = null;
+    /**
+     * Group composite for domain selection.
+     */
+    private Group fDomainGroup = null;
+    /**
+     * Radio button for selecting kernel domain.
+     */
+    private Button fKernelButton = null;
+    /**
+     * Radio button for selecting UST domain.
+     */
+    private Button fUstButton = null;
+    /**
+     * The parent domain component where the channel node should be added. 
+     * Null in case of creation on session level.
+     */
+    private TraceDomainComponent fDomain = null;
+    /**
+     * Common verify listener for numeric text input.  
+     */
+    private VerifyListener fVerifyListener = null;
+    /**
+     * Output channel information.
+     */
+    private IChannelInfo fChannelInfo = null;
+    /**
+     * Output domain information. True in case of Kernel domain. False for UST.     
+     */
+    private boolean fIsKernel;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     * @param shell - a shell for the display of the dialog
+     */
+    public EnableChannelDialog(Shell shell) {
+       super(shell);
+       fIsKernel = true;
+
+        // Common verify listener
+        fVerifyListener = new VerifyListener() {
+            @Override
+            public void verifyText(VerifyEvent e) {
+                // only numbers are allowed.
+                e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+            }
+        };
+        setShellStyle(SWT.RESIZE);
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog#getChannelInfo()
+     */
+    @Override
+    public IChannelInfo getChannelInfo() {
+        return fChannelInfo;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog#setDomainComponent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent)
+     */
+    @Override
+    public void setDomainComponent(TraceDomainComponent domain) {
+        fDomain = domain;
+        if (fDomain != null) {
+            fIsKernel = fDomain.isKernel();
+        } else {
+            fIsKernel = true;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog#isKernel()
+     */
+    @Override
+    public boolean isKernel() {
+        return fIsKernel;
+    }
+
+    // ------------------------------------------------------------------------
+    // 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_EnableChannelDialogTitle);
+        newShell.setImage(Activator.getDefault().loadIcon(ENABLE_CHANNEL_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(3, true);
+        fDialogComposite.setLayout(layout); 
+
+        Label channelNameLabel = new Label(fDialogComposite, SWT.RIGHT);
+        channelNameLabel.setText(Messages.TraceControl_EnableChannelNameLabel);
+        fChannelNameText = new Text(fDialogComposite, SWT.NONE);
+        fChannelNameText.setToolTipText(Messages.TraceControl_EnableChannelNameTooltip);
+        
+        Label subBufferSizeLabel = new Label(fDialogComposite, SWT.RIGHT);
+        subBufferSizeLabel.setText(Messages.TraceControl_SubBufferSizePropertyName);
+        fSubBufferSizeText = new Text(fDialogComposite, SWT.NONE);
+        fSubBufferSizeText.setToolTipText(Messages.TraceControl_EnableChannelSubBufferSizeTooltip);
+        fSubBufferSizeText.addVerifyListener(fVerifyListener);
+        
+        Label numSubBufferLabel = new Label(fDialogComposite, SWT.RIGHT);
+        numSubBufferLabel.setText(Messages.TraceControl_NbSubBuffersPropertyName);
+        fNumberOfSubBuffersText = new Text(fDialogComposite, SWT.NONE);
+        fNumberOfSubBuffersText.setToolTipText(Messages.TraceControl_EnableChannelNbSubBuffersTooltip);
+        fNumberOfSubBuffersText.addVerifyListener(fVerifyListener);
+
+        Label switchTimerLabel = new Label(fDialogComposite, SWT.RIGHT);
+        switchTimerLabel.setText(Messages.TraceControl_SwitchTimerPropertyName);
+        fSwitchTimerText = new Text(fDialogComposite, SWT.NONE);
+        fSwitchTimerText.setToolTipText(Messages.TraceControl_EnableChannelSwitchTimerTooltip);
+        fSwitchTimerText.addVerifyListener(fVerifyListener);
+
+        Label readTimerLabel = new Label(fDialogComposite, SWT.RIGHT);
+        readTimerLabel.setText(Messages.TraceControl_ReadTimerPropertyName);
+        fReadTimerText = new Text(fDialogComposite, SWT.NONE);
+        fReadTimerText.setToolTipText(Messages.TraceControl_EnableChannelReadTimerTooltip);
+        fReadTimerText.addVerifyListener(fVerifyListener);
+
+        Group discardModeGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+        discardModeGroup.setText(Messages.TraceControl_EnableChannelDiscardModeGroupName);
+        layout = new GridLayout(2, true);
+        discardModeGroup.setLayout(layout); 
+
+        fDiscardModeButton = new  Button(discardModeGroup, SWT.RADIO);
+        fDiscardModeButton.setText(Messages.TraceControl_EnableChannelDiscardModeLabel);
+        fDiscardModeButton.setToolTipText(Messages.TraceControl_EnableChannelDiscardModeTooltip);
+        fDiscardModeButton.setSelection(true);
+        
+        fOverwriteModeButton = new Button(discardModeGroup, SWT.RADIO);
+        fOverwriteModeButton.setText(Messages.TraceControl_EnableChannelOverwriteModeLabel);
+        fOverwriteModeButton.setToolTipText(Messages.TraceControl_EnableChannelOverwriteModeTooltip);
+        fOverwriteModeButton.setSelection(false);
+
+        fDomainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
+        fDomainGroup.setText(Messages.TraceControl_DomainDisplayName);
+        layout = new GridLayout(2, true);
+        fDomainGroup.setLayout(layout); 
+        
+        fKernelButton = new Button(fDomainGroup, SWT.RADIO);
+        fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName);
+        fKernelButton.setSelection(fIsKernel);
+        fUstButton = new Button(fDomainGroup, SWT.RADIO);
+        fUstButton.setText(Messages.TraceControl_UstDisplayName);
+        fUstButton.setSelection(!fIsKernel);
+
+        if (fDomain != null) {
+            fKernelButton.setEnabled(false);
+            fUstButton.setEnabled(false);
+        }
+
+        // layout widgets
+        GridData data = new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1);
+        discardModeGroup.setLayoutData(data);
+        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
+        fDiscardModeButton.setLayoutData(data);
+        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
+        fOverwriteModeButton.setLayoutData(data);
+        
+        data = new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1);
+        fDomainGroup.setLayoutData(data);
+
+        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
+        fKernelButton.setLayoutData(data);
+        data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
+        fUstButton.setLayoutData(data);
+        
+        data = new GridData(GridData.FILL_HORIZONTAL);
+        data.horizontalSpan = 2;
+
+        fChannelNameText.setLayoutData(data);
+        fSubBufferSizeText.setLayoutData(data);
+        fNumberOfSubBuffersText.setLayoutData(data);
+        fSwitchTimerText.setLayoutData(data);
+        fReadTimerText.setLayoutData(data);
+
+        setDefaults();
+
+        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.DETAILS_ID, "&Default", true); //$NON-NLS-1$
+        createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$
+        createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
+    @Override
+    protected void okPressed() {
+        // Set channel information
+        fChannelInfo = new ChannelInfo(fChannelNameText.getText());
+        fChannelInfo.setSubBufferSize(Long.parseLong(fSubBufferSizeText.getText()));
+        fChannelInfo.setNumberOfSubBuffers(Integer.parseInt(fNumberOfSubBuffersText.getText()));
+        fChannelInfo.setSwitchTimer(Long.parseLong(fSwitchTimerText.getText()));
+        fChannelInfo.setReadTimer(Long.parseLong(fReadTimerText.getText()));
+        fChannelInfo.setOverwriteMode(fOverwriteModeButton.getSelection());
+
+        fIsKernel = fKernelButton.getSelection();
+
+        // Check for invalid names
+        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$
+            return;
+        }
+
+        // Check for duplicate names
+        if (fDomain != null && fDomain.containsChild(fChannelInfo.getName())) {
+            MessageDialog.openError(getShell(),
+                    Messages.TraceControl_EnableChannelDialogTitle,
+                    Messages.TraceControl_ChannelAlreadyExistsError + " (" + fChannelInfo.getName() + ") \n");  //$NON-NLS-1$ //$NON-NLS-2$
+            return;
+        }
+
+        // validation successful -> call super.okPressed()
+        super.okPressed();
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
+    @Override
+    protected void buttonPressed(int buttonId) {
+        if (buttonId == IDialogConstants.DETAILS_ID) {
+            setDefaults();
+            return;
+        }
+        super.buttonPressed(buttonId);
+    }
+
+    // ------------------------------------------------------------------------
+    // Helper methods
+    // ------------------------------------------------------------------------
+    /**
+     * Sets default value depending on Kernel or UST
+     */
+    private void setDefaults() {
+        fSwitchTimerText.setText(String.valueOf(IChannelInfo.DEFAULT_SWITCH_TIMER));
+        fReadTimerText.setText(String.valueOf(IChannelInfo.DEFAULT_READ_TIMER));
+        fOverwriteModeButton.setSelection(IChannelInfo.DEFAULT_OVERWRITE_MODE);
+        if (fKernelButton.getSelection()) {
+            fSubBufferSizeText.setText(String.valueOf(IChannelInfo.DEFAULT_SUB_BUFFER_SIZE_KERNEL));
+            fNumberOfSubBuffersText.setText(String.valueOf(IChannelInfo.DEFAULT_NUMBER_OF_SUB_BUFFERS_KERNEL));
+        } else {
+            fSubBufferSizeText.setText(String.valueOf(IChannelInfo.DEFAULT_SUB_BUFFER_SIZE_UST));
+            fNumberOfSubBuffersText.setText(String.valueOf(IChannelInfo.DEFAULT_NUMBER_OF_SUB_BUFFERS_UST));
+        }
+    }
+}
index 53cd10c3ed4ae06e252a3e0057fcdaade9cd267d..f10b89ad16d43adb4effd3518f427fb9e8480f85 100644 (file)
@@ -48,7 +48,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog  {
     /**
      * The icon file for this dialog box.
      */
-    public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable.gif"; //$NON-NLS-1$ 
+    public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$ 
 
     // ------------------------------------------------------------------------
     // Attributes
index e2ad1fb9a4b977f670929dfce26bbb8c9103a98f..f43905cbe0fe15d046e93d0431f930a27efa0d55 100644 (file)
@@ -47,7 +47,7 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
     /**
      * The icon file for this dialog box.
      */
-    public static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/enable.gif"; //$NON-NLS-1$ 
+    public static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$ 
 
     // ------------------------------------------------------------------------
     // Attributes
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateChannelDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateChannelDialog.java
deleted file mode 100644 (file)
index 49679e8..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/**********************************************************************
- * 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.internal.lttng2.ui.views.control.dialogs;
-
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
-
-/**
- * <b><u>ICreateChannelDialog</u></b>
- * <p>
- * Interface for the create channel dialog when domain is known.
- * </p>
- */
-public interface ICreateChannelDialog {
-    
-    // ------------------------------------------------------------------------
-    // Accessors
-    // ------------------------------------------------------------------------
-    /**
-     * @return the configuration info for the new channel.
-     */
-    public IChannelInfo getChannelInfo();
-    
-    /**
-     * Sets the domain component
-     * @param domain - the trace domain component
-     */
-    public void setDomainComponent(TraceDomainComponent domain);
-    
-    /**
-     * @return true for Kernel domain. False for UST.
-     */
-    public boolean isKernel();
-
-    
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    /**
-     * @return the open return value
-     */
-    int open();
-}
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java
new file mode 100644 (file)
index 0000000..84b7416
--- /dev/null
@@ -0,0 +1,52 @@
+/**********************************************************************
+ * 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.internal.lttng2.ui.views.control.dialogs;
+
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
+
+/**
+ * <b><u>IEnableChannelDialog</u></b>
+ * <p>
+ * Interface for the enable channel dialog when domain is known.
+ * </p>
+ */
+public interface IEnableChannelDialog {
+    
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+    /**
+     * @return the configuration info for the new channel.
+     */
+    public IChannelInfo getChannelInfo();
+    
+    /**
+     * Sets the domain component
+     * @param domain - the trace domain component
+     */
+    public void setDomainComponent(TraceDomainComponent domain);
+    
+    /**
+     * @return true for Kernel domain. False for UST.
+     */
+    public boolean isKernel();
+
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /**
+     * @return the open return value
+     */
+    int open();
+}
index 695a0f7ca8b02f88af4143c6033c295f9b2a087a..8ef9e7c261c06292e760977ee44fa5eb0bd5a48d 100644 (file)
@@ -20,9 +20,9 @@ final public class TraceControlDialogFactory {
     private INewConnectionDialog fNewConnectionDialog;
     
     /**
-     * The create channel dialog (on domain level)
+     * The enable channel dialog
      */
-    private ICreateChannelDialog fCreateChannelDialog;
+    private IEnableChannelDialog fEnableChannelDialog;
     
     /**
      * The create session dialog.
@@ -102,21 +102,21 @@ final public class TraceControlDialogFactory {
     }
     
     /**
-     * @return create channel dialog (on domain level)
+     * @return enable channel dialog
      */
-    public ICreateChannelDialog getCreateChannelDialog() {
-        if (fCreateChannelDialog == null) {
-            fCreateChannelDialog = new CreateChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+    public IEnableChannelDialog getEnableChannelDialog() {
+        if (fEnableChannelDialog == null) {
+            fEnableChannelDialog = new EnableChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
         }
-        return fCreateChannelDialog;
+        return fEnableChannelDialog;
     }
 
     /**
-     * Sets a create channel dialog implementation (on domain level).
-     * @param createChannelDialog - a create channel dialog implementation
+     * Sets a enable channel dialog implementation.
+     * @param createEnableDialog - a create channel dialog implementation
      */
-    public void setCreateChannelDialog(ICreateChannelDialog createChannelDialog) {
-        fCreateChannelDialog = createChannelDialog;
+    public void setEnableChannelDialog(IEnableChannelDialog createEnableDialog) {
+        fEnableChannelDialog = createEnableDialog;
     }
     
     /**
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseCreateChannelHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseCreateChannelHandler.java
deleted file mode 100644 (file)
index 1bb2298..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/**********************************************************************
- * 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.internal.lttng2.ui.views.control.handlers;
-
-import java.util.ArrayList;
-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.internal.lttng2.ui.Activator;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateChannelDialog;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
-
-/**
- * <b><u>BaseCreateChannelHandler</u></b>
- * <p>
- * Base implementation of aCommand handler implementation to create a trace channel.  
- * </p>
- */
-abstract class BaseCreateChannelHandler extends BaseControlViewHandler {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    protected CommandParameter fParam;
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    /**
-     * Enables channels with given names which are part of this domain. If a given channel 
-     * doesn't exists it creates a new channel with the given parameters (or default values 
-     * if given parameter is null). 
-     * @param - a parameter instance with data for the command execution
-     * @param channelNames - a list of channel names to enable on this domain
-     * @param info - channel information to set for the channel (use null for default)
-     * @param isKernel -  a flag for indicating kernel or UST.
-     * @param monitor - a progress monitor
-     * @throws ExecutionException
-     */
-    abstract public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; 
-    
-    /**
-     * @param - a parameter instance with data for the command execution
-     * @return returns the relevant domain (null if domain is not known)
-     */
-    abstract public TraceDomainComponent getDomain(CommandParameter param);
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-     */
-    @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-        fLock.lock();
-        try {
-            final CommandParameter param = fParam.clone();
-
-            final ICreateChannelDialog dialog =  TraceControlDialogFactory.getInstance().getCreateChannelDialog();
-            dialog.setDomainComponent(getDomain(param));
-
-            if (dialog.open() != Window.OK) {
-                return null;
-            }
-
-            Job job = new Job(Messages.TraceControl_CreateChannelStateJob) {
-                @Override
-                protected IStatus run(IProgressMonitor monitor) {
-                    Exception error = null;
-
-                    List<String> channelNames = new ArrayList<String>();                    
-                    channelNames.add(dialog.getChannelInfo().getName());
-
-                    try {
-                        enableChannel(param, channelNames, dialog.getChannelInfo(), dialog.isKernel(), monitor);
-                    } catch (ExecutionException e) {
-                        error = e;
-                    }
-
-                    // refresh in all cases
-                    refresh(param);
-
-                    if (error != null) {
-                        return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error);
-                    }
-                    return Status.OK_STATUS;
-                }
-            };
-            job.setUser(true);
-            job.schedule();
-        } finally {
-            fLock.unlock();
-        }
-        return null;
-    }
-
-}
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java
new file mode 100644 (file)
index 0000000..9bcd440
--- /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.internal.lttng2.ui.views.control.handlers;
+
+import java.util.ArrayList;
+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.internal.lttng2.ui.Activator;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableChannelDialog;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
+
+/**
+ * <b><u>BaseEnableChannelHandler</u></b>
+ * <p>
+ * Base implementation of a command handler to enable a trace channel.  
+ * </p>
+ */
+abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    protected CommandParameter fParam;
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /**
+     * Enables channels with given names which are part of this domain. If a given channel 
+     * doesn't exists it creates a new channel with the given parameters (or default values 
+     * if given parameter is null). 
+     * @param - a parameter instance with data for the command execution
+     * @param channelNames - a list of channel names to enable on this domain
+     * @param info - channel information to set for the channel (use null for default)
+     * @param isKernel -  a flag for indicating kernel or UST.
+     * @param monitor - a progress monitor
+     * @throws ExecutionException
+     */
+    abstract public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; 
+    
+    /**
+     * @param - a parameter instance with data for the command execution
+     * @return returns the relevant domain (null if domain is not known)
+     */
+    abstract public TraceDomainComponent getDomain(CommandParameter param);
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+     */
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        fLock.lock();
+        try {
+            final CommandParameter param = fParam.clone();
+
+            final IEnableChannelDialog dialog =  TraceControlDialogFactory.getInstance().getEnableChannelDialog();
+            dialog.setDomainComponent(getDomain(param));
+
+            if (dialog.open() != Window.OK) {
+                return null;
+            }
+
+            Job job = new Job(Messages.TraceControl_CreateChannelStateJob) {
+                @Override
+                protected IStatus run(IProgressMonitor monitor) {
+                    Exception error = null;
+
+                    List<String> channelNames = new ArrayList<String>();                    
+                    channelNames.add(dialog.getChannelInfo().getName());
+
+                    try {
+                        enableChannel(param, channelNames, dialog.getChannelInfo(), dialog.isKernel(), monitor);
+                    } catch (ExecutionException e) {
+                        error = e;
+                    }
+
+                    // refresh in all cases
+                    refresh(param);
+
+                    if (error != null) {
+                        return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error);
+                    }
+                    return Status.OK_STATUS;
+                }
+            };
+            job.setUser(true);
+            job.schedule();
+        } finally {
+            fLock.unlock();
+        }
+        return null;
+    }
+
+}
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateChannelOnDomainHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateChannelOnDomainHandler.java
deleted file mode 100644 (file)
index 56b51c1..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/**********************************************************************
- * 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.internal.lttng2.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.internal.lttng2.ui.views.control.ControlView;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * <b><u>CreateChannelOnDomainHandler</u></b>
- * <p>
- * Command handler implementation to create a trace channel for known domain.
- * </p>
- */
-public class CreateChannelOnDomainHandler extends BaseCreateChannelHandler {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#enableChannel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo, boolean, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
-        if (param instanceof DomainCommandParameter) {
-            ((DomainCommandParameter)param).getDomain().enableChannels(channelNames, info, monitor);
-        }
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
-     */
-    @Override
-    public TraceDomainComponent getDomain(CommandParameter param) {
-        if (param instanceof DomainCommandParameter) {
-            return ((DomainCommandParameter)param).getDomain();
-        }
-        return null;
-    }
-
-    /*
-     * (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;
-        }
-        
-        TraceDomainComponent domain = null;
-        TraceSessionComponent session = null;
-        
-        // Check if one domain 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 TraceDomainComponent) {
-                    TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
-                    session = (TraceSessionComponent) tmpDomain.getParent();
-                    
-                    // Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed
-                    if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) {
-                        domain = tmpDomain;
-                    }
-                }
-            }
-        }
-        
-        boolean isEnabled = domain != null;
-        
-        fLock.lock();
-        try {
-            fParam = null;
-            if (isEnabled) {
-                fParam = new DomainCommandParameter(session, domain);
-            }
-        } finally {
-            fLock.unlock();
-        }
-        
-        return isEnabled;
-    }
-    
-}
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateChannelOnSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateChannelOnSessionHandler.java
deleted file mode 100644 (file)
index 425d814..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/**********************************************************************
- * 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.internal.lttng2.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.internal.lttng2.ui.views.control.ControlView;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * <b><u>CreateChannelOnSessionHandler</u></b>
- * <p>
- * Command handler implementation to create a trace channel for unknown domain 
- * (on session level).
- * </p>
- */
-public class CreateChannelOnSessionHandler extends BaseCreateChannelHandler {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#enableChannel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo, boolean, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
-        param.getSession().enableChannels(channelNames, info, isKernel, monitor);
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
-     */
-    @Override
-    public TraceDomainComponent getDomain(CommandParameter param) {
-        return null;
-    }
-
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /*
-     * (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;
-        }
-
-        TraceSessionComponent session = 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 that are inactive and not destroyed
-                    TraceSessionComponent tmpSession = (TraceSessionComponent) element;
-                    if ((tmpSession.getSessionState() == TraceSessionState.INACTIVE) && (!tmpSession.isDestroyed())) {
-                        session = tmpSession;
-                    }
-                }
-            }
-        }
-        boolean isEnabled = session != null;
-        
-        fLock.lock();
-        try {
-            fParam = null;
-            if (isEnabled) {
-                fParam = new CommandParameter(session);
-            }
-        } finally {
-            fLock.unlock();
-        }
-        
-        return isEnabled;
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnDomainHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnDomainHandler.java
new file mode 100644 (file)
index 0000000..3b925a0
--- /dev/null
@@ -0,0 +1,115 @@
+/**********************************************************************
+ * 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.internal.lttng2.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.internal.lttng2.ui.views.control.ControlView;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * <b><u>EnableChannelOnDomainHandler</u></b>
+ * <p>
+ * Command handler implementation to enable a trace channel for known domain.
+ * </p>
+ */
+public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#enableChannel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo, boolean, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+        if (param instanceof DomainCommandParameter) {
+            ((DomainCommandParameter)param).getDomain().enableChannels(channelNames, info, monitor);
+        }
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
+     */
+    @Override
+    public TraceDomainComponent getDomain(CommandParameter param) {
+        if (param instanceof DomainCommandParameter) {
+            return ((DomainCommandParameter)param).getDomain();
+        }
+        return null;
+    }
+
+    /*
+     * (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;
+        }
+        
+        TraceDomainComponent domain = null;
+        TraceSessionComponent session = null;
+        
+        // Check if one domain 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 TraceDomainComponent) {
+                    TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
+                    session = (TraceSessionComponent) tmpDomain.getParent();
+                    
+                    // Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed
+                    if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) {
+                        domain = tmpDomain;
+                    }
+                }
+            }
+        }
+        
+        boolean isEnabled = domain != null;
+        
+        fLock.lock();
+        try {
+            fParam = null;
+            if (isEnabled) {
+                fParam = new DomainCommandParameter(session, domain);
+            }
+        } finally {
+            fLock.unlock();
+        }
+        
+        return isEnabled;
+    }
+    
+}
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java
new file mode 100644 (file)
index 0000000..8602661
--- /dev/null
@@ -0,0 +1,104 @@
+/**********************************************************************
+ * 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.internal.lttng2.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.internal.lttng2.ui.views.control.ControlView;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * <b><u>EnableChannelOnSessionHandler</u></b>
+ * <p>
+ * Command handler implementation to enable a trace channel for unknown domain 
+ * (on session level).
+ * </p>
+ */
+public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#enableChannel(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter, java.util.List, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo, boolean, org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+        param.getSession().enableChannels(channelNames, info, isKernel, monitor);
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
+     */
+    @Override
+    public TraceDomainComponent getDomain(CommandParameter param) {
+        return null;
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (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;
+        }
+
+        TraceSessionComponent session = 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 that are inactive and not destroyed
+                    TraceSessionComponent tmpSession = (TraceSessionComponent) element;
+                    if ((tmpSession.getSessionState() == TraceSessionState.INACTIVE) && (!tmpSession.isDestroyed())) {
+                        session = tmpSession;
+                    }
+                }
+            }
+        }
+        boolean isEnabled = session != null;
+        
+        fLock.lock();
+        try {
+            fParam = null;
+            if (isEnabled) {
+                fParam = new CommandParameter(session);
+            }
+        } finally {
+            fLock.unlock();
+        }
+        
+        return isEnabled;
+    }
+}
This page took 0.051839 seconds and 5 git commands to generate.