Revision 0f8ea4a2
Added by Cherian Mathew over 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java | ||
---|---|---|
233 | 233 |
@Override |
234 | 234 |
public void widgetSelected(SelectionEvent e) { |
235 | 235 |
refreshCdmServer(); |
236 |
updatePort(); |
|
236 |
|
|
237 | 237 |
} |
238 | 238 |
}); |
239 | 239 |
GridData gd_comboCdmServer = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); |
... | ... | |
487 | 487 |
CdmRemoteSource devRemoteSource = CdmServerInfo.getDevServerRemoteSource(); |
488 | 488 |
if(devRemoteSource != null) { |
489 | 489 |
isDevRemoteSource = true; |
490 |
} |
|
491 |
refreshCdmServer(); |
|
492 |
updatePort(); |
|
493 |
|
|
494 |
if(devRemoteSource != null) { |
|
495 | 490 |
String username = System.getProperty("cdm.server.dev.username"); |
496 | 491 |
String password = System.getProperty("cdm.server.dev.password"); |
497 | 492 |
if(username != null && !username.isEmpty() && password != null && !password.isEmpty()) { |
... | ... | |
499 | 494 |
txtPassword.setText(password); |
500 | 495 |
CdmStore.connect(devRemoteSource, RemotingLoginDialog.this); |
501 | 496 |
} |
497 |
} else { |
|
498 |
refreshCdmServer(); |
|
502 | 499 |
} |
503 | 500 |
} |
504 | 501 |
}); |
... | ... | |
510 | 507 |
|
511 | 508 |
|
512 | 509 |
private void refreshCdmServer() { |
513 |
txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY); |
|
514 |
updateSelectedCdmServer(); |
|
515 |
checkSelectedCdmServer(); |
|
510 |
Display.getDefault().asyncExec(new Runnable() { |
|
511 |
@Override |
|
512 |
public void run() { |
|
513 |
txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY); |
|
514 |
updateSelectedCdmServer(); |
|
515 |
checkSelectedCdmServer(); |
|
516 |
updatePort(); |
|
517 |
} |
|
518 |
}); |
|
516 | 519 |
} |
517 | 520 |
|
518 | 521 |
private void updateSelectedCdmServer() { |
... | ... | |
564 | 567 |
} else { |
565 | 568 |
txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE); |
566 | 569 |
comboCdmInstance.removeAll(); |
570 |
disableCdmInstanceControls("", ""); |
|
567 | 571 |
} |
568 | 572 |
} |
569 | 573 |
} |
... | ... | |
620 | 624 |
Display.getDefault().asyncExec(new Runnable() { |
621 | 625 |
@Override |
622 | 626 |
public void run() { |
623 |
txtCdmInstanceStatus.setText(STATUS_NOT_AVAILABLE); |
|
624 |
txtCdmInstanceStatus.setToolTipText(e.getMessage()); |
|
625 |
comboCdmInstance.setEnabled(false); |
|
626 |
btnConnect.setEnabled(false); |
|
627 |
disableCdmInstanceControls(STATUS_NOT_AVAILABLE, e.getMessage()); |
|
627 | 628 |
} |
628 | 629 |
}); |
629 | 630 |
} |
... | ... | |
635 | 636 |
// Start the Job |
636 | 637 |
serverJob.schedule(); |
637 | 638 |
} |
639 |
} |
|
638 | 640 |
|
641 |
private void disableCdmInstanceControls(String cdmInstanceStatus, String tooltip) { |
|
642 |
txtCdmInstanceStatus.setText(cdmInstanceStatus); |
|
643 |
txtCdmInstanceStatus.setToolTipText(tooltip); |
|
644 |
comboCdmInstance.setEnabled(false); |
|
645 |
btnConnect.setEnabled(false); |
|
639 | 646 |
|
640 | 647 |
} |
641 |
|
|
642 | 648 |
private void refreshCdmInstance() { |
643 | 649 |
txtCdmInstanceStatus.setText(STATUS_CHECKING_AVAILABILITY); |
644 | 650 |
clearOnInstanceChange(); |
... | ... | |
689 | 695 |
CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName()); |
690 | 696 |
} |
691 | 697 |
|
692 |
private boolean isActiveCdmInstanceRunningInManagedServer() { |
|
693 |
return CdmStore.getManagedServer() != null && |
|
694 |
CdmStore.getManagedServer().isAlive() && |
|
695 |
CdmStore.isActive() && |
|
696 |
CdmServerInfo.NAME_LOCALHOST_MGD.equals(CdmStore.getActiveCdmSource().getName()); |
|
697 |
} |
|
698 |
|
|
699 |
|
|
700 | 698 |
private void startManagedServer() { |
701 | 699 |
if(isManagedServerRunning()) { |
702 | 700 |
if(CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName())) { |
Also available in: Unified diff
Adds async refresh of server