/** @param text */ @SuppressWarnings("deprecation") protected void updateDeviceIpPort(String selectedDeviceName) { if (selectedDeviceName.equals(savedJtagDevice)) { return; } GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution(); IGDBJtagDevice selectedDevice = null; for (int i = 0; i < availableDevices.length; i++) { String name = availableDevices[i].getDeviceName(); if (name.equals(selectedDeviceName)) { selectedDevice = availableDevices[i].getDevice(); if (selectedDevice != null) { if (selectedDevice instanceof IGDBJtagConnection) { IGDBJtagConnection connectionDevice = (IGDBJtagConnection) selectedDevice; connection.setText(connectionDevice.getDefaultDeviceConnection()); } else { // support for deprecated TCP/IP based methods ipAddress.setText(selectedDevice.getDefaultIpAddress()); portNumber.setText(selectedDevice.getDefaultPortNumber()); } useRemoteChanged(); updateLaunchConfigurationDialog(); break; } } } }
private GDBJtagDeviceContribution findJtagDeviceByName(String name) { GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution(); for (GDBJtagDeviceContribution device : availableDevices) { if (device.getDeviceName().equals(name)) { return device; } } return null; }
private void createRemoteControl(Composite parent) { Group group = new Group(parent, SWT.NONE); GridLayout layout = new GridLayout(); group.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); group.setText(Messages.getString("GDBJtagDebuggerTab.remoteGroup_Text")); useRemote = new Button(group, SWT.CHECK); useRemote.setText(Messages.getString("GDBJtagDebuggerTab.useRemote_Text")); useRemote.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { useRemoteChanged(); updateLaunchConfigurationDialog(); } }); Composite comp = new Composite(group, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; comp.setLayout(layout); Label label = new Label(comp, SWT.NONE); label.setText(Messages.getString("GDBJtagDebuggerTab.jtagDeviceLabel")); jtagDevice = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); GDBJtagDeviceContribution[] availableDevices = GDBJtagDeviceContributionFactory.getInstance().getGDBJtagDeviceContribution(); for (int i = 0; i < availableDevices.length; i++) { jtagDevice.add(availableDevices[i].getDeviceName()); } jtagDevice.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { updateDeviceIpPort(jtagDevice.getText()); scheduleUpdateJob(); // provides much better performance for Text listeners } }); remoteConnectionParameters = new Composite(group, SWT.NO_TRIM | SWT.NO_FOCUS); remoteConnectParmsLayout = new StackLayout(); remoteConnectionParameters.setLayout(remoteConnectParmsLayout); // // Create entry fields for TCP/IP connections // { remoteTcpipBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS); layout = new GridLayout(); layout.numColumns = 2; remoteTcpipBox.setLayout(layout); remoteTcpipBox.setBackground(remoteConnectionParameters.getParent().getBackground()); label = new Label(remoteTcpipBox, SWT.NONE); label.setText(Messages.getString("GDBJtagDebuggerTab.ipAddressLabel")); // $NON-NLS-1$ ipAddress = new Text(remoteTcpipBox, SWT.BORDER); gd = new GridData(); gd.widthHint = 125; ipAddress.setLayoutData(gd); label = new Label(remoteTcpipBox, SWT.NONE); label.setText(Messages.getString("GDBJtagDebuggerTab.portNumberLabel")); // $NON-NLS-1$ portNumber = new Text(remoteTcpipBox, SWT.BORDER); gd = new GridData(); gd.widthHint = 125; portNumber.setLayoutData(gd); } // // Create entry fields for other types of connections // { remoteConnectionBox = new Composite(remoteConnectionParameters, SWT.NO_TRIM | SWT.NO_FOCUS); layout = new GridLayout(); layout.numColumns = 2; remoteConnectionBox.setLayout(layout); remoteConnectionBox.setBackground(remoteConnectionParameters.getParent().getBackground()); label = new Label(remoteConnectionBox, SWT.NONE); label.setText(Messages.getString("GDBJtagDebuggerTab.connectionLabel")); // $NON-NLS-1$ connection = new Text(remoteConnectionBox, SWT.BORDER); gd = new GridData(); gd.widthHint = 125; connection.setLayoutData(gd); } // // Add watchers for user data entry // ipAddress.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { scheduleUpdateJob(); // provides much better performance for Text listeners } }); portNumber.addVerifyListener( new VerifyListener() { public void verifyText(VerifyEvent e) { e.doit = Character.isDigit(e.character) || Character.isISOControl(e.character); } }); portNumber.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { scheduleUpdateJob(); // provides much better performance for Text listeners } }); connection.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { scheduleUpdateJob(); // provides much better performance for Text listeners } }); }