Revision 0593eae4
Added by Andreas Müller almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java | ||
---|---|---|
79 | 79 |
import eu.etaxonomy.taxeditor.webapp.CDMServer; |
80 | 80 |
import eu.etaxonomy.taxeditor.webapp.ICDMServerError; |
81 | 81 |
|
82 |
|
|
83 | 82 |
/** |
84 | 83 |
* @author cmathew |
85 | 84 |
* @date 20 Jan 2015 |
86 |
* |
|
87 | 85 |
*/ |
88 | 86 |
public class RemotingLoginDialog extends Dialog implements ICDMServerError { |
89 | 87 |
|
... | ... | |
124 | 122 |
private final static String LAST_SERVER_KEY = "lastServerKey"; //$NON-NLS-1$ |
125 | 123 |
private final static String LAST_INSTANCE_KEY = "lastInstanceKey"; //$NON-NLS-1$ |
126 | 124 |
|
127 |
|
|
128 | 125 |
private Composite remotingComposite; |
129 | 126 |
private CdmServerInfo selectedCsii; |
130 | 127 |
private CdmInstanceInfo selectedCdmInstance; |
... | ... | |
145 | 142 |
private ExpandableComposite xpndblcmpstAdvanced; |
146 | 143 |
private StyledText styledTxtMessage; |
147 | 144 |
|
148 |
|
|
149 | 145 |
// private final int MIN_WIDTH = 530; |
150 | 146 |
// private final int MIN_HEIGHT = 220; |
151 | 147 |
// private final int MIN_EXP_HEIGHT = 380; |
... | ... | |
457 | 453 |
txtEditorCDMVersion = new Text(compAdvanced, SWT.BORDER); |
458 | 454 |
txtEditorCDMVersion.setEditable(false); |
459 | 455 |
txtEditorCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
460 |
|
|
461 |
|
|
462 | 456 |
} |
463 | 457 |
|
464 | 458 |
private void connectButtonPressed() { |
... | ... | |
469 | 463 |
if (CdmStore.isActive() && CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_REMOTING)){ |
470 | 464 |
PreferencesUtil.setNomenclaturalCodePreferences(); |
471 | 465 |
} |
472 |
|
|
473 | 466 |
} |
474 | 467 |
} |
475 | 468 |
|
... | ... | |
607 | 600 |
} |
608 | 601 |
} |
609 | 602 |
|
610 |
|
|
611 | 603 |
private void populateCdmInstanceCombo(final boolean forceRefresh) { |
612 | 604 |
comboCdmInstance.removeAll(); |
613 | 605 |
comboCdmInstance.setEnabled(false); |
... | ... | |
680 | 672 |
btnConnect.setEnabled(false); |
681 | 673 |
|
682 | 674 |
} |
675 |
|
|
683 | 676 |
private void refreshCdmInstance() { |
684 | 677 |
txtCdmInstanceStatus.setText(STATUS_CHECKING_AVAILABILITY); |
685 | 678 |
clearOnInstanceChange(); |
... | ... | |
711 | 704 |
updatePort(); |
712 | 705 |
} |
713 | 706 |
|
714 |
|
|
715 | 707 |
if(isManagedServerRunning()) { |
716 | 708 |
btnStopServer.setEnabled(true); |
717 | 709 |
} else { |
... | ... | |
744 | 736 |
} |
745 | 737 |
} |
746 | 738 |
|
747 |
|
|
748 | 739 |
Job job = new Job(Messages.RemotingLoginDialog_JOB_SERVER_LAUNCH) { |
749 | 740 |
|
750 | 741 |
@Override |
... | ... | |
819 | 810 |
job.schedule(); |
820 | 811 |
} |
821 | 812 |
|
822 |
|
|
823 | 813 |
@Override |
824 | 814 |
public void handleError(final Throwable t) { |
825 | 815 |
|
... | ... | |
844 | 834 |
String title = Messages.RemotingLoginDialog_SERVER_LAUNCH_ERROR; |
845 | 835 |
String message = t.getMessage(); |
846 | 836 |
|
847 |
|
|
848 | 837 |
MessagingUtils.errorDialog(title, |
849 | 838 |
this, |
850 | 839 |
message, |
... | ... | |
945 | 934 |
// if any problems |
946 | 935 |
throw new RuntimeException(e); |
947 | 936 |
} |
948 |
|
|
949 | 937 |
} |
950 | 938 |
|
951 | 939 |
public boolean isRememberMe() { |
... | ... | |
976 | 964 |
credentialsPrefs.put(getUsernamePrefKey(), txtLogin.getText()); |
977 | 965 |
credentialsPrefs.put(getPasswordPrefKey(), txtPassword.getText()); |
978 | 966 |
removePreferences(credentialsPrefs); |
979 |
} |
|
967 |
} |
|
968 |
|
|
980 | 969 |
private void removePreferences(Preferences prefs) { |
981 | 970 |
try { |
982 | 971 |
prefs.removeNode(); |
... | ... | |
984 | 973 |
setMessage(bse.getMessage()); |
985 | 974 |
} |
986 | 975 |
} |
976 |
|
|
987 | 977 |
private void flushPreferences(Preferences prefs) { |
988 | 978 |
try { |
989 | 979 |
prefs.flush(); |
... | ... | |
992 | 982 |
} |
993 | 983 |
} |
994 | 984 |
|
995 |
|
|
996 |
|
|
997 | 985 |
private void readPrefCredentials() { |
998 | 986 |
String username, password; |
999 | 987 |
IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE); |
... | ... | |
1038 | 1026 |
return false; |
1039 | 1027 |
} |
1040 | 1028 |
|
1041 |
|
|
1042 | 1029 |
try { |
1043 | 1030 |
IUserService userService = CdmApplicationRemoteConfiguration.getUserService(remoteSource); |
1044 | 1031 |
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(getUsername(), getPassword()); |
... | ... | |
1098 | 1085 |
// } |
1099 | 1086 |
// } |
1100 | 1087 |
|
1101 |
|
|
1102 | 1088 |
public void hide(boolean isHidden) { |
1103 | 1089 |
if (!shlConnect.isDisposed()){ |
1104 | 1090 |
if(shlConnect != null && shlConnect.getDisplay() != null) { |
... | ... | |
1106 | 1092 |
} |
1107 | 1093 |
} |
1108 | 1094 |
} |
1095 |
|
|
1109 | 1096 |
public void dispose() { |
1110 | 1097 |
if (!shlConnect.isDisposed()){ |
1111 | 1098 |
if(shlConnect != null && shlConnect.getDisplay() != null) { |
... | ... | |
1167 | 1154 |
setMessage(""); //$NON-NLS-1$ |
1168 | 1155 |
txtServerCDMVersion.setText(""); //$NON-NLS-1$ |
1169 | 1156 |
} |
1170 |
|
|
1171 |
|
|
1172 | 1157 |
} |
Also available in: Unified diff
cleanup