/**********************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+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;
* The text widget for the node address (IP or DNS name)
*/
private Text fHostNameText = null;
+ /**
+ * The text widget for the IP port
+ */
+ private Text fPortText = null;
/**
* The parent where the new node should be added.
*/
* The node address (IP or DNS name) string.
*/
private String fHostName = null;
-
+ /**
+ * The IP port of the connection.
+ */
+ private int fPort = IRemoteSystemProxy.INVALID_PORT_NUMBER;
/**
* Input list of existing RSE hosts available for selection.
*/
return fHostName;
}
+ @Override
+ public int getPort() {
+ return fPort;
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.INewConnectionDialog#setTraceControlParent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent)
}
}
+ @Override
+ public void setPort(int port) {
+ fPort = port;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
fHostNameText.setToolTipText(Messages.TraceControl_NewNodeHostNameTooltip);
fHostNameText.setEnabled(fExistingHosts.length == 0);
+ Label portLabel = new Label(fTextGroup, SWT.RIGHT);
+ portLabel.setText(Messages.TraceControl_NewNodePortLabel);
+ fPortText = new Text(fTextGroup, SWT.NONE);
+ fPortText.setToolTipText(Messages.TraceControl_NewNodePortTooltip);
+ fPortText.setEnabled(fExistingHosts.length == 0);
+ fPortText.addVerifyListener(new VerifyListener() {
+ @Override
+ public void verifyText(VerifyEvent e) {
+ // only numbers are allowed.
+ e.doit = e.text.matches("[0-9]*"); //$NON-NLS-1$
+ }
+ });
+
fButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
fExistingHostsCombo.setEnabled(false);
fConnectionNameText.setEnabled(true);
fHostNameText.setEnabled(true);
+ fPortText.setEnabled(true);
} else {
fExistingHostsCombo.setEnabled(true);
fConnectionNameText.setEnabled(false);
fHostNameText.setEnabled(false);
+ fPortText.setEnabled(false);
}
}
int index = fExistingHostsCombo.getSelectionIndex();
fConnectionNameText.setText(fExistingHosts[index].getAliasName());
fHostNameText.setText(fExistingHosts[index].getHostName());
+ fPortText.setText(""); //$NON-NLS-1$
}
@Override
data = new GridData(GridData.FILL_HORIZONTAL);
fHostNameText.setText("666.666.666.666"); //$NON-NLS-1$
Point minSize = fHostNameText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- data.widthHint = minSize.x + 5;
+ int widthHint = minSize.x + 5;
+ data.widthHint = widthHint;
data.horizontalSpan = 2;
-
fConnectionNameText.setLayoutData(data);
+
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = widthHint;
+ data.horizontalSpan = 2;
fHostNameText.setLayoutData(data);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = widthHint;
+ data.horizontalSpan = 2;
+ fPortText.setLayoutData(data);
+
fHostNameText.setText(""); //$NON-NLS-1$
return fDialogComposite;
// Validate input data
fConnectionName = fConnectionNameText.getText();
fHostName = fHostNameText.getText();
+ fPort = (fPortText.getText().length() > 0) ? Integer.parseInt(fPortText.getText()) : IRemoteSystemProxy.INVALID_PORT_NUMBER;
if (!"".equals(fHostName)) { //$NON-NLS-1$
// If no node name is specified use the node address as name