tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / dialogs / CreateSessionDialog.java
index f021a63cf8b137808c185c8d3cf3999fdd101d38..4669c9bf885d1c97982e9c897bd49c6a4e599c42 100644 (file)
@@ -26,8 +26,8 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys
 import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Point;
@@ -103,6 +103,10 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
      * The text widget for the session name
      */
     private Text fSessionNameText = null;
+    /**
+     * The label widget for the session path.
+     */
+    private Label fSessionPathLabel = null;
     /**
      * The text widget for the session path.
      */
@@ -119,6 +123,10 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
      * The composite with streaming configuration parameter.
      */
     private Composite fStreamingComposite = null;
+    /**
+     * The text widget for the trace path.
+     */
+    private Text fTracePathText = null;
     /**
      * The button to link data protocol/Address with control protocol.
      */
@@ -131,10 +139,14 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
      * A selection listener that copies the protocol from control to data when being linked.
      */
     private ControlProtocolSelectionListener fCopyProtocolSelectionListener;
-
+    /**
+     * A selection listener updates the control port text depending on the control protocol selected.
+     */
     private ProtocolComboSelectionListener fControlProtocolSelectionListener;
+    /**
+     * A selection listener updates the data port text depending on the data protocol selected.
+     */
     private ProtocolComboSelectionListener fDataProtocolSelectionListener;
-
     /**
      * The text box for the host/IP address of the control channel.
      */
@@ -142,7 +154,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
     /**
      * A key listener that copies the host address from control to data when being linked.
      */
-    private CopyKeyListener fControlUrlKeyListener;
+    private CopyModifyListener fControlUrlKeyListener;
     /**
      * The text box for the control port.
      */
@@ -159,14 +171,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
      * The text box for the data port.
      */
     private Text fDataPortText = null;
-    /**
-     * The button to not activate a consumer.
-     */
-    private Button fNoConsumerButton = null;
-    /**
-     * The button to disable the consumer.
-     */
-    private Button fDisableConsumerButton = null;
     /**
      * The parent where the new node should be added.
      */
@@ -203,13 +207,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
      */
     private String fDataUrl = null;
     /**
-     * Flag for not activating a consumer for this session.
-     */
-    private boolean fIsNoConsumer = false;
-    /**
-     * Flag for disabling a consumer for this session.
+     * The trace path string.
      */
-    private boolean fIsDisableConsumer = false;
+    private String fTracePath = null;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -226,37 +226,22 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
     // ------------------------------------------------------------------------
     // Accessors
     // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog#getSessionName()
-     */
+
     @Override
     public String getSessionName() {
         return fSessionName;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog#getSessionPath()
-     */
     @Override
     public String getSessionPath() {
         return fSessionPath;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog#isDefaultSessionPath()
-     */
     @Override
     public boolean isDefaultSessionPath() {
         return fIsDefaultPath;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSessionDialog#initialze(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionGroup)
-     */
     @Override
     public void initialize(TraceSessionGroup group) {
        fParent = group;
@@ -268,8 +253,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
        fNetworkUrl = null;
        fControlUrl = null;
        fDataUrl = null;
-       fIsNoConsumer = false;
-       fIsDisableConsumer = false;
     }
 
     @Override
@@ -289,24 +272,10 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         return fDataUrl;
     }
 
-    @Override
-    public boolean isNoConsumer() {
-        return fIsNoConsumer;
-    }
-
-    @Override
-    public boolean isDisableConsumer() {
-        return fIsDisableConsumer;
-    }
-
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
 
-
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
-     */
     @Override
     protected Control createContents(Composite parent) {
         fControl = super.createContents(parent);
@@ -318,10 +287,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
 
         return fControl;
     }
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
-     */
+
     @Override
     protected void configureShell(Shell newShell) {
         super.configureShell(newShell);
@@ -329,10 +295,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         newShell.setImage(Activator.getDefault().loadIcon(CREATE_SESSION_ICON_FILE));
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
-     */
     @Override
     protected Control createDialogArea(Composite parent) {
 
@@ -351,8 +313,8 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         fSessionNameText = new Text(sessionGroup, SWT.NONE);
         fSessionNameText.setToolTipText(Messages.TraceControl_CreateSessionNameTooltip);
 
-        Label sessionPath = new Label(sessionGroup, SWT.RIGHT);
-        sessionPath.setText(Messages.TraceControl_CreateSessionPathLabel);
+        fSessionPathLabel = new Label(sessionGroup, SWT.RIGHT);
+        fSessionPathLabel.setText(Messages.TraceControl_CreateSessionPathLabel);
         fSessionPathText = new Text(sessionGroup, SWT.NONE);
         fSessionPathText.setToolTipText(Messages.TraceControl_CreateSessionPathTooltip);
 
@@ -367,38 +329,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         fSessionPathText.setLayoutData(data);
 
         if (fParent.isNetworkStreamingSupported()) {
-            fNoConsumerButton = new Button(sessionGroup, SWT.CHECK);
-            fNoConsumerButton.setText(Messages.TraceControl_CreateSessionNoConsumertText);
-            fNoConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionNoConsumertTooltip);
-            data = new GridData(GridData.FILL_HORIZONTAL);
-            data.horizontalSpan = 2;
-            fNoConsumerButton.setLayoutData(data);
-
-            fDisableConsumerButton = new Button(sessionGroup, SWT.CHECK);
-            fDisableConsumerButton.setText(Messages.TraceControl_CreateSessionDisableConsumertText);
-            fDisableConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionDisableConsumertTooltip);
-            data = new GridData(GridData.FILL_HORIZONTAL);
-            data.horizontalSpan = 2;
-            fDisableConsumerButton.setLayoutData(data);
-
-            fNoConsumerButton.addSelectionListener(new SelectionAdapter() {
-                @Override
-                public void widgetSelected(SelectionEvent e) {
-                    if (fNoConsumerButton.getSelection()) {
-                        fDisableConsumerButton.setSelection(false);
-                    }
-                }
-            });
-
-            fDisableConsumerButton.addSelectionListener(new SelectionAdapter() {
-                @Override
-                public void widgetSelected(SelectionEvent e) {
-                    if (fDisableConsumerButton.getSelection()) {
-                        fNoConsumerButton.setSelection(false);
-                    }
-                }
-            });
-
             createAdvancedOptionsComposite();
         }
 
@@ -412,7 +342,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         fMainStreamingGroup.setLayout(new GridLayout(1, true));
 
         fConfigureStreamingButton = new Button(fMainStreamingGroup, SWT.PUSH);
-        fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$
+        fConfigureStreamingButton.setText(Messages.TraceControl_CreateSessionConfigureStreamingButtonText + " >>>"); //$NON-NLS-1$
         fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip);
         fConfigureStreamingButton.addSelectionListener(new SelectionAdapter() {
             @Override
@@ -421,11 +351,16 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
                     fIsStreamedTrace = false;
                     fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$
                     fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip);
+                    fSessionPathText.setEnabled(true);
+                    fSessionPathLabel.setText(Messages.TraceControl_CreateSessionPathLabel);
                     disposeConfigureStreamingComposite();
                 } else {
                     fIsStreamedTrace = true;
                     fConfigureStreamingButton.setText("<<< " + Messages.TraceControl_CreateSessionNoStreamingButtonText); //$NON-NLS-1$
                     fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionNoStreamingButtonTooltip);
+                    fSessionPathText.setEnabled(false);
+                    fSessionPathText.setText(""); //$NON-NLS-1$
+                    fSessionPathLabel.setText(""); //$NON-NLS-1$
                     createConfigureStreamingComposite();
                 }
 
@@ -450,10 +385,20 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
             urlGroup.setLayout(layout);
             urlGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
 
+            Label tracePathLabel = new Label(urlGroup, SWT.RIGHT);
+            tracePathLabel.setText(Messages.TraceControl_CreateSessionTracePathText);
+            fTracePathText = new Text(urlGroup, SWT.NONE);
+            fTracePathText.setToolTipText(Messages.TraceControl_CreateSessionTracePathTooltip);
+
+            // layout widgets
+            GridData data = new GridData(GridData.FILL_HORIZONTAL);
+            data.horizontalSpan = 6;
+            fTracePathText.setLayoutData(data);
+
             fLinkDataWithControlButton = new Button(urlGroup, SWT.CHECK);
             fLinkDataWithControlButton.setText(Messages.TraceControl_CreateSessionLinkButtonText);
             fLinkDataWithControlButton.setToolTipText(Messages.TraceControl_CreateSessionLinkButtonTooltip);
-            GridData data = new GridData(GridData.FILL_HORIZONTAL);
+            data = new GridData(GridData.FILL_HORIZONTAL);
             data.horizontalSpan = 7;
             fLinkDataWithControlButton.setLayoutData(data);
             fLinkDataWithControlButton.setSelection(true);
@@ -545,19 +490,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
 
             fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener);
 
-            fControlUrlKeyListener = new CopyKeyListener(fControlHostAddressText, fDataHostAddressText);
-            fControlHostAddressText.addKeyListener(fControlUrlKeyListener);
-
-//            InetAddress inet = null;
-//            try {
-//                inet = InetAddress.getLocalHost();
-//                inet = InetAddress.getByName(inet.getHostName());
-//            } catch (UnknownHostException e1) {
-//            }
-//            if (inet != null) {
-//                fControlUrlAddressText.setText(inet.getHostAddress());
-//                fDataUrlAddressText.setText(inet.getHostAddress());
-//            }
+            fControlUrlKeyListener = new CopyModifyListener(fControlHostAddressText, fDataHostAddressText);
+            fControlHostAddressText.addModifyListener(fControlUrlKeyListener);
+
             fControlProtocolCombo.select(DEFAULT_URL_INDEX);
             fDataProtocolCombo.select(DEFAULT_URL_INDEX);
 
@@ -575,7 +510,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
                         fControlProtocolCombo.removeSelectionListener(fControlProtocolSelectionListener);
                         fDataProtocolCombo.removeSelectionListener(fDataProtocolSelectionListener);
                         fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener);
-                        fControlHostAddressText.addKeyListener(fControlUrlKeyListener);
+                        fControlHostAddressText.addModifyListener(fControlUrlKeyListener);
 
                         // Get previous selection and validate
                         int currentSelection = fControlProtocolCombo.getSelectionIndex() <= COMMON_URL_LAST_INDEX ?
@@ -606,7 +541,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
                         fControlProtocolCombo.removeSelectionListener(fCopyProtocolSelectionListener);
                         fControlProtocolCombo.addSelectionListener(fControlProtocolSelectionListener);
                         fDataProtocolCombo.addSelectionListener(fDataProtocolSelectionListener);
-                        fControlHostAddressText.removeKeyListener(fControlUrlKeyListener);
+                        fControlHostAddressText.removeModifyListener(fControlUrlKeyListener);
 
                         // Update combo box items
                         int currentSelection = fControlProtocolCombo.getSelectionIndex();
@@ -655,20 +590,12 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
-     */
     @Override
     protected void createButtonsForButtonBar(Composite parent) {
         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() {
         // Validate input data
@@ -706,6 +633,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         fDataUrl = null;
 
         if (fIsStreamedTrace) {
+            // Validate input data
+            fTracePath = fTracePathText.getText();
+
             if (fControlProtocolCombo.getSelectionIndex() < 0) {
                 MessageDialog.openError(getShell(),
                         Messages.TraceControl_CreateSessionDialogTitle,
@@ -739,19 +669,19 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
                         fControlHostAddressText.getText(),
                         fControlPortText.getText(),
                         null,
-                        fSessionPath);
+                        fTracePath);
 
                 fDataUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()),
                         fDataHostAddressText.getText(),
                         null,
                         fDataPortText.getText(),
-                        fSessionPath);
+                        fTracePath);
             } else {
                 fNetworkUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()),
                         fControlHostAddressText.getText(),
                         fControlPortText.getText(),
                         fDataPortText.getText(),
-                        fSessionPath);
+                        fTracePath);
             }
         }
 
@@ -771,11 +701,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
             return;
         }
 
-        if (fParent.isNetworkStreamingSupported()) {
-            fIsNoConsumer = fNoConsumerButton.getSelection();
-            fIsDisableConsumer = fDisableConsumerButton.getSelection();
-        }
-
         // validation successful -> call super.okPressed()
         super.okPressed();
     }
@@ -804,17 +729,17 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         return stringBuilder.toString();
     }
 
-    private static class CopyKeyListener extends KeyAdapter {
+    private static class CopyModifyListener implements ModifyListener {
         private Text fSource;
         private Text fDestination;
 
-        public CopyKeyListener(Text source, Text destination) {
+        public CopyModifyListener(Text source, Text destination) {
             fSource = source;
             fDestination = destination;
         }
 
         @Override
-        public void keyReleased(KeyEvent e) {
+        public void modifyText(ModifyEvent e) {
             fDestination.setText(fSource.getText());
         }
     }
This page took 0.029576 seconds and 5 git commands to generate.