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;
* 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.
*/
* 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.
*/
* 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.
*/
/**
* 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.
*/
* 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.
*/
*/
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
// ------------------------------------------------------------------------
// 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;
fNetworkUrl = null;
fControlUrl = null;
fDataUrl = null;
- fIsNoConsumer = false;
- fIsDisableConsumer = false;
}
@Override
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);
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);
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) {
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);
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();
}
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
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();
}
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);
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);
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 ?
fControlProtocolCombo.removeSelectionListener(fCopyProtocolSelectionListener);
fControlProtocolCombo.addSelectionListener(fControlProtocolSelectionListener);
fDataProtocolCombo.addSelectionListener(fDataProtocolSelectionListener);
- fControlHostAddressText.removeKeyListener(fControlUrlKeyListener);
+ fControlHostAddressText.removeModifyListener(fControlUrlKeyListener);
// Update combo box items
int currentSelection = fControlProtocolCombo.getSelectionIndex();
}
}
- /*
- * (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
fDataUrl = null;
if (fIsStreamedTrace) {
+ // Validate input data
+ fTracePath = fTracePathText.getText();
+
if (fControlProtocolCombo.getSelectionIndex() < 0) {
MessageDialog.openError(getShell(),
Messages.TraceControl_CreateSessionDialogTitle,
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);
}
}
return;
}
- if (fParent.isNetworkStreamingSupported()) {
- fIsNoConsumer = fNoConsumerButton.getSelection();
- fIsDisableConsumer = fDisableConsumerButton.getSelection();
- }
-
// validation successful -> call super.okPressed()
super.okPressed();
}
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());
}
}