Added command support for enabling/disabling events (first part)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / control / handlers / CreateChannelOnDomainHandler.java
index e66d1d069c6fcaeda53a654d59a8e29a162295de..30a8d8d9b9629e7343e1dad60442623781f19816 100644 (file)
@@ -73,43 +73,47 @@ public class CreateChannelOnDomainHandler extends AbstractHandler {
         // Get channel information from user
         final ICreateChannelDialog dialog = new CreateChannelDialog(window.getShell(), fDomain);
 
-        if (dialog.open() == Window.OK) {
-
-            Job job = new Job(Messages.TraceControl_EnableChannelJob) {
-                @Override
-                protected IStatus run(IProgressMonitor monitor) {
-                    String errorString = null;
-
-                    List<String> channelNames = new ArrayList<String>();
-                    channelNames.add(dialog.getChannelInfo().getName());
-
-                    try {
-                        fDomain.enableChannels(channelNames, dialog.getChannelInfo(), monitor);
-                    } catch (ExecutionException e) {
-                        if (errorString == null) {
-                            errorString = new String();
-                        } 
-                        errorString += e.toString() + "\n"; //$NON-NLS-1$
-                    }
+        if (dialog.open() != Window.OK) {
+            return null;
+        }
+
+        Job job = new Job(Messages.TraceControl_ChangeChannelStateJob) {
+            @Override
+            protected IStatus run(IProgressMonitor monitor) {
+                String errorString = null;
 
-                    // get session configuration in all cases
-                    try {
-                        fDomain.getConfigurationFromNode(monitor);
-                    } catch (ExecutionException e) {
-                        if (errorString == null) {
-                            errorString = new String();
-                        }
-                        errorString += Messages.TraceControl_ListSessionFailure + ": " + e.toString();  //$NON-NLS-1$ 
+                List<String> channelNames = new ArrayList<String>();
+                channelNames.add(dialog.getChannelInfo().getName());
+
+                try {
+                    fDomain.enableChannels(channelNames, dialog.getChannelInfo(), monitor);
+                } catch (ExecutionException e) {
+                    if (errorString == null) {
+                        errorString = new String();
                     } 
+                    errorString += e.toString() + "\n"; //$NON-NLS-1$
+                }
 
-                    if (errorString != null) {
-                        return new Status(Status.ERROR, LTTngUiPlugin.PLUGIN_ID, errorString);
+                // get session configuration in all cases
+                try {
+                    fDomain.getConfigurationFromNode(monitor);
+                } catch (ExecutionException e) {
+                    if (errorString == null) {
+                        errorString = new String();
                     }
-                    return Status.OK_STATUS;
-                }};
-                job.setUser(true);
-                job.schedule();
-        }
+                    errorString += Messages.TraceControl_ListSessionFailure + ": " + e.toString();  //$NON-NLS-1$ 
+                } 
+
+                if (errorString != null) {
+                    return new Status(Status.ERROR, LTTngUiPlugin.PLUGIN_ID, errorString);
+                }
+                return Status.OK_STATUS;
+            }
+        };
+        
+        job.setUser(true);
+        job.schedule();
+            
         return null;
     }
 
This page took 0.02612 seconds and 5 git commands to generate.