Project

General

Profile

« Previous | Next » 

Revision c15014c2

Added by Patrick Plitzner over 5 years ago

Add key listener to remote login dialog

  • pressing enter in the password field or selecting the connect button with the keyboard only will now also connect

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java
26 26
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
27 27
import org.eclipse.swt.SWT;
28 28
import org.eclipse.swt.custom.StyledText;
29
import org.eclipse.swt.events.KeyAdapter;
30
import org.eclipse.swt.events.KeyEvent;
29 31
import org.eclipse.swt.events.MouseAdapter;
30 32
import org.eclipse.swt.events.MouseEvent;
31 33
import org.eclipse.swt.events.SelectionAdapter;
......
340 342
        gd_txtPassword.heightHint = 15;
341 343
        txtPassword.setLayoutData(gd_txtPassword);
342 344
        new Label(loginComposite, SWT.NONE);
345
        txtPassword.addKeyListener(new KeyAdapter() {
346
        	@Override
347
        	public void keyPressed(KeyEvent e) {
348
        		if(e.character==SWT.CR){
349
        			connectButtonPressed();
350
        		}
351
        	}
352
        });
343 353

  
344 354
        btnConnect = new Button(loginComposite, SWT.FLAT);
345 355
        btnConnect.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
346
        btnConnect.addMouseListener(new MouseAdapter() {
347
            @Override
348
            public void mouseUp(MouseEvent e) {
349
                if(selectedCsii.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
350
                    startManagedServer();
351
                } else {
352
                    connect();
353
                }
354
            }
355
        });
356
        btnConnect.addSelectionListener(new SelectionAdapter() {
357
			@Override
358
			public void widgetSelected(SelectionEvent e) {
359
				connectButtonPressed();
360
			}
361
		});
356 362
        btnConnect.setText(Messages.RemotingLoginDialog_LABEL_CONNECT);
357 363

  
358 364
        btnRememberMe = new Button(loginComposite, SWT.CHECK);
......
468 474

  
469 475
    }
470 476

  
471

  
477
	private void connectButtonPressed() {
478
		if(selectedCsii.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
479
			startManagedServer();
480
		} else {
481
			connect();
482
		}
483
	}
472 484

  
473 485
    private void populateCdmServerCombo() {
474 486
        Job job = new Job(Messages.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES) {

Also available in: Unified diff