1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

Bug 488419 - Make the NewSerialPortConnectionWizard public

Also changed a number of variables in the
NewSerialPortConnectionWizardPage to be private and use getters for
access.

Change-Id: Ib677be603efaf1cab57879c628991b86bc796f47
Signed-off-by: Jonathan Williams <jonwilliams@qnx.com>
This commit is contained in:
Jonathan Williams 2016-02-24 16:24:17 -05:00
parent 2269b3cf6d
commit ad4c9cf354
4 changed files with 44 additions and 15 deletions

View file

@ -14,3 +14,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.remote.serial.ui

View file

@ -20,6 +20,7 @@ import org.eclipse.remote.core.IRemoteConnection;
import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteConnectionType.Service;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.serial.ui.NewSerialPortConnectionWizard;
import org.eclipse.remote.ui.AbstractRemoteUIConnectionService;
import org.eclipse.remote.ui.IRemoteUIConnectionService;
import org.eclipse.remote.ui.IRemoteUIConnectionWizard;

View file

@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - initial contribution
*******************************************************************************/
package org.eclipse.remote.serial.internal.ui;
package org.eclipse.remote.serial.ui;
import java.util.Set;
@ -18,6 +18,7 @@ import org.eclipse.remote.core.IRemoteConnectionType;
import org.eclipse.remote.core.IRemoteConnectionWorkingCopy;
import org.eclipse.remote.core.exception.RemoteConnectionException;
import org.eclipse.remote.serial.core.ISerialPortService;
import org.eclipse.remote.serial.internal.ui.Activator;
import org.eclipse.remote.ui.IRemoteUIConnectionWizard;
import org.eclipse.swt.widgets.Shell;
@ -45,11 +46,11 @@ public class NewSerialPortConnectionWizard extends Wizard implements IRemoteUICo
return false;
}
workingCopy.setAttribute(ISerialPortService.PORT_NAME_ATTR, page.portName);
workingCopy.setAttribute(ISerialPortService.BAUD_RATE_ATTR, Integer.toString(page.baudRateIndex));
workingCopy.setAttribute(ISerialPortService.BYTE_SIZE_ATTR, Integer.toString(page.byteSizeIndex));
workingCopy.setAttribute(ISerialPortService.PARITY_ATTR, Integer.toString(page.parityIndex));
workingCopy.setAttribute(ISerialPortService.STOP_BITS_ATTR, Integer.toString(page.stopBitsIndex));
workingCopy.setAttribute(ISerialPortService.PORT_NAME_ATTR, page.getPortName());
workingCopy.setAttribute(ISerialPortService.BAUD_RATE_ATTR, Integer.toString(page.getBaudRateIndex()));
workingCopy.setAttribute(ISerialPortService.BYTE_SIZE_ATTR, Integer.toString(page.getByteSizeIndex()));
workingCopy.setAttribute(ISerialPortService.PARITY_ATTR, Integer.toString(page.getParityIndex()));
workingCopy.setAttribute(ISerialPortService.STOP_BITS_ATTR, Integer.toString(page.getStopBitsIndex()));
return true;
}
@ -68,7 +69,7 @@ public class NewSerialPortConnectionWizard extends Wizard implements IRemoteUICo
public IRemoteConnectionWorkingCopy getConnection() {
if (workingCopy == null) {
try {
workingCopy = connectionType.newConnection(page.name);
workingCopy = connectionType.newConnection(page.getName());
} catch (RemoteConnectionException e) {
Activator.log(e.getStatus());
}

View file

@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - initial contribution
*******************************************************************************/
package org.eclipse.remote.serial.internal.ui;
package org.eclipse.remote.serial.ui;
import java.io.IOException;
@ -18,6 +18,8 @@ import org.eclipse.cdt.serial.Parity;
import org.eclipse.cdt.serial.SerialPort;
import org.eclipse.cdt.serial.StopBits;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.remote.serial.internal.ui.Activator;
import org.eclipse.remote.serial.internal.ui.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
@ -32,12 +34,12 @@ import org.eclipse.swt.widgets.Text;
public class NewSerialPortConnectionWizardPage extends WizardPage {
String name;
String portName;
int baudRateIndex;
int byteSizeIndex;
int parityIndex;
int stopBitsIndex;
private String name;
private String portName;
private int baudRateIndex;
private int byteSizeIndex;
private int parityIndex;
private int stopBitsIndex;
private String[] portNames;
@ -48,7 +50,7 @@ public class NewSerialPortConnectionWizardPage extends WizardPage {
private Combo parityCombo;
private Combo stopBitsCombo;
protected NewSerialPortConnectionWizardPage() {
public NewSerialPortConnectionWizardPage() {
super(NewSerialPortConnectionWizardPage.class.getName());
setDescription(Messages.NewSerialPortConnectionWizardPage_Description);
setTitle(Messages.NewSerialPortConnectionWizardPage_Title);
@ -180,4 +182,28 @@ public class NewSerialPortConnectionWizardPage extends WizardPage {
setPageComplete(!name.isEmpty() && portName != null);
}
public String getName() {
return name;
}
public String getPortName() {
return portName;
}
public int getBaudRateIndex() {
return baudRateIndex;
}
public int getByteSizeIndex() {
return byteSizeIndex;
}
public int getParityIndex() {
return parityIndex;
}
public int getStopBitsIndex() {
return stopBitsIndex;
}
}