2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.ui
.dialog
;
12 import java
.io
.IOException
;
13 import java
.text
.SimpleDateFormat
;
14 import java
.util
.Date
;
15 import java
.util
.HashMap
;
16 import java
.util
.List
;
19 import org
.apache
.commons
.lang
.StringUtils
;
20 import org
.apache
.log4j
.Logger
;
21 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
22 import org
.eclipse
.core
.runtime
.IStatus
;
23 import org
.eclipse
.core
.runtime
.Status
;
24 import org
.eclipse
.core
.runtime
.jobs
.Job
;
25 import org
.eclipse
.core
.runtime
.preferences
.ConfigurationScope
;
26 import org
.eclipse
.core
.runtime
.preferences
.IEclipsePreferences
;
27 import org
.eclipse
.jface
.layout
.GridDataFactory
;
28 import org
.eclipse
.swt
.SWT
;
29 import org
.eclipse
.swt
.SWTException
;
30 import org
.eclipse
.swt
.custom
.StyledText
;
31 import org
.eclipse
.swt
.events
.KeyAdapter
;
32 import org
.eclipse
.swt
.events
.KeyEvent
;
33 import org
.eclipse
.swt
.events
.MouseAdapter
;
34 import org
.eclipse
.swt
.events
.MouseEvent
;
35 import org
.eclipse
.swt
.events
.SelectionAdapter
;
36 import org
.eclipse
.swt
.events
.SelectionEvent
;
37 import org
.eclipse
.swt
.graphics
.Point
;
38 import org
.eclipse
.swt
.layout
.FillLayout
;
39 import org
.eclipse
.swt
.layout
.GridData
;
40 import org
.eclipse
.swt
.layout
.GridLayout
;
41 import org
.eclipse
.swt
.widgets
.Button
;
42 import org
.eclipse
.swt
.widgets
.Combo
;
43 import org
.eclipse
.swt
.widgets
.Composite
;
44 import org
.eclipse
.swt
.widgets
.Dialog
;
45 import org
.eclipse
.swt
.widgets
.Display
;
46 import org
.eclipse
.swt
.widgets
.Label
;
47 import org
.eclipse
.swt
.widgets
.Shell
;
48 import org
.eclipse
.swt
.widgets
.Text
;
49 import org
.eclipse
.ui
.forms
.events
.ExpansionEvent
;
50 import org
.eclipse
.ui
.forms
.events
.IExpansionListener
;
51 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
52 import org
.eclipse
.ui
.progress
.IProgressConstants
;
53 import org
.eclipse
.wb
.swt
.SWTResourceManager
;
54 import org
.osgi
.service
.prefs
.BackingStoreException
;
55 import org
.osgi
.service
.prefs
.Preferences
;
56 import org
.springframework
.security
.authentication
.BadCredentialsException
;
57 import org
.springframework
.security
.authentication
.LockedException
;
58 import org
.springframework
.security
.authentication
.UsernamePasswordAuthenticationToken
;
60 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationRemoteConfiguration
;
61 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationState
;
62 import eu
.etaxonomy
.cdm
.api
.service
.IUserService
;
63 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmMetaData
;
64 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.permission
.Role
;
65 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
66 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
67 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
68 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
69 import eu
.etaxonomy
.taxeditor
.remoting
.server
.CDMServerException
;
70 import eu
.etaxonomy
.taxeditor
.remoting
.server
.CDMServerUtils
;
71 import eu
.etaxonomy
.taxeditor
.remoting
.source
.CdmRemoteSource
;
72 import eu
.etaxonomy
.taxeditor
.remoting
.source
.CdmServerInfo
;
73 import eu
.etaxonomy
.taxeditor
.remoting
.source
.CdmServerInfo
.CdmInstanceInfo
;
74 import eu
.etaxonomy
.taxeditor
.remoting
.source
.ICdmRemoteSource
;
75 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
76 import eu
.etaxonomy
.taxeditor
.store
.LoginManager
;
77 import eu
.etaxonomy
.taxeditor
.store
.internal
.TaxeditorStorePlugin
;
78 import eu
.etaxonomy
.taxeditor
.webapp
.CDMEmbeddedServerException
;
79 import eu
.etaxonomy
.taxeditor
.webapp
.CDMServer
;
80 import eu
.etaxonomy
.taxeditor
.webapp
.ICDMServerError
;
88 public class RemotingLoginDialog
extends Dialog
implements ICDMServerError
{
90 private Logger logger
= Logger
.getLogger(getClass());
92 private static final String DEFAULT_PASS
= "00000"; //$NON-NLS-1$
93 private static final String DEFAULT_USER
= "admin"; //$NON-NLS-1$
94 private static final String UBUNTU
= "Ubuntu"; //$NON-NLS-1$
95 protected Object result
;
96 protected Shell shlConnect
;
97 private Text txtCdmServerStatus
;
98 private Text txtCdmInstanceStatus
;
99 private Combo comboCdmServer
;
100 private Combo comboCdmInstance
;
101 private Button btnConnect
;
103 private final Map
<String
, CdmServerInfo
> csiiMap
= new HashMap
<String
, CdmServerInfo
>();
105 private final static String STATUS_AVAILABLE
= Messages
.RemotingLoginDialog_STATUS_AVAILABLE
;
106 private final static String STATUS_NOT_AVAILABLE
= Messages
.RemotingLoginDialog_STATUS_NOT_AVAILABLE
;
107 private final static String STATUS_STARTED
= Messages
.RemotingLoginDialog_STATUS_STARTED
;
108 private final static String STATUS_NOT_STARTED
= Messages
.RemotingLoginDialog_STATUS_NOT_STARTED
;
109 private final static String STATUS_RETRIEVING
= Messages
.RemotingLoginDialog_STATUS_RETRIEVING
;
110 private final static String STATUS_CHECKING_AVAILABILITY
= Messages
.RemotingLoginDialog_STATUS_CHECKING
;
111 private final static String STATUS_NO_INSTANCES
= Messages
.RemotingLoginDialog_STATUS_NO_INSTANCES_FOUND
;
112 private final static String STATUS_NOT_COMPATIBLE
= Messages
.RemotingLoginDialog_STATUS_NOT_COMPATIBLE
;
114 private final static String MESG_COMPATIBLE_EDITOR_OLD
= Messages
.RemotingLoginDialog_UPDATE_EDITOR
;
115 private final static String MESG_COMPATIBLE_SERVER_OLD
= Messages
.RemotingLoginDialog_CHOOSE_COMPATIBLE_CDM_SERVER
;
117 private final static String STORE_PREFERENCES_NODE
= "eu.etaxonomy.taxeditor.store"; //$NON-NLS-1$
119 private final static String LOGIN_NODE
= "login"; //$NON-NLS-1$
120 private final static String USERNAME_SUFFIX
= "_username"; //$NON-NLS-1$
121 private final static String PASSWORD_SUFFIX
= "_password"; //$NON-NLS-1$
123 private final static String LAST_SERVER_INSTANCE_NODE
= "lastServerInstance"; //$NON-NLS-1$
124 private final static String LAST_SERVER_KEY
= "lastServerKey"; //$NON-NLS-1$
125 private final static String LAST_INSTANCE_KEY
= "lastInstanceKey"; //$NON-NLS-1$
128 private Composite remotingComposite
;
129 private CdmServerInfo selectedCsii
;
130 private CdmInstanceInfo selectedCdmInstance
;
131 private Button btnCdmServerRefresh
;
132 private Button btnCdmInstanceRefresh
;
133 private Button btnStopServer
;
134 private Composite loginComposite
;
135 private Label lblLogin
;
136 private Text txtLogin
;
137 private Label lblPassword
;
138 private Text txtPassword
;
139 private Button btnRememberMe
;
140 private Composite compAdvanced
;
141 private Label lblPort
;
142 private Text txtPort
;
143 private Label lblServerVersion
;
144 private Text txtServerVersion
;
145 private ExpandableComposite xpndblcmpstAdvanced
;
146 private StyledText styledTxtMessage
;
149 private final int MIN_WIDTH
= 530;
150 private final int MIN_HEIGHT
= 220;
151 private final int MIN_EXP_HEIGHT
= 380;
152 private final int MESSAGE_HEIGHT
= 75;
153 private Label lblEditorVersion
;
154 private Text txtEditorVersion
;
155 private Label lblServerCDMVersion
;
156 private Text txtServerCDMVersion
;
157 private Label lblEditorCDMVersion
;
158 private Text txtEditorCDMVersion
;
160 private String serverName
, instanceName
;
161 private boolean autoConnect
= false;
162 private boolean loadLoginPrefs
= true;
163 private boolean isDevRemoteSource
= false;
164 private Job serverJob
;
170 public RemotingLoginDialog(Shell parent
, int style
) {
171 super(parent
, style
);
172 setText(Messages
.RemotingLoginDialog_LABEL_LOGIN
);
175 public Object
open(CdmRemoteSource source
, boolean loadLoginPrefs
, boolean autoConnect
) {
176 this.loadLoginPrefs
= loadLoginPrefs
;
177 this.serverName
= source
.getName();
178 String contextPath
= source
.getContextPath();
179 this.instanceName
= contextPath
.substring(contextPath
.lastIndexOf("/") + 1); //$NON-NLS-1$
180 return open(serverName
, instanceName
, loadLoginPrefs
, autoConnect
);
184 public Object
open(String serverName
, String instanceName
, boolean loadLoginPrefs
, boolean autoConnect
) {
185 this.serverName
= serverName
;
186 this.instanceName
= instanceName
;
187 this.loadLoginPrefs
= loadLoginPrefs
;
188 this.autoConnect
= autoConnect
;
196 public Object
open() {
199 if(serverName
== null && instanceName
== null) {
200 readPrefLastServerInstance();
204 populateCdmServerCombo();
208 xpndblcmpstAdvanced
.setExpanded(false);
210 Display display
= getParent().getDisplay();
212 while (!shlConnect
.isDisposed()) {
213 if (!display
.isDisposed()){
214 if (!display
.readAndDispatch()) {
224 * Create contents of the dialog.
226 private void createContents() {
227 shlConnect
= new Shell(getParent(), SWT
.DIALOG_TRIM
);
228 shlConnect
.setMinimumSize(new Point(MIN_WIDTH
, MIN_HEIGHT
));
229 shlConnect
.setSize(MIN_WIDTH
, MIN_HEIGHT
);
230 shlConnect
.setText(Messages
.RemotingLoginDialog_LABEL_CONNECT
);
231 shlConnect
.setLayout(new FillLayout(SWT
.HORIZONTAL
));
233 remotingComposite
= new Composite(shlConnect
, SWT
.NONE
);
234 remotingComposite
.setLayout(new GridLayout(1, false));
236 Composite cdmServerComposite
= new Composite(remotingComposite
, SWT
.NONE
);
237 GridData gd_cdmServerComposite
= new GridData(SWT
.LEFT
, SWT
.CENTER
, false, false, 1, 1);
238 gd_cdmServerComposite
.heightHint
= 68;
239 cdmServerComposite
.setLayoutData(gd_cdmServerComposite
);
240 cdmServerComposite
.setLayout(new GridLayout(4, false));
242 Label lblCdmServer
= new Label(cdmServerComposite
, SWT
.NONE
);
243 lblCdmServer
.setText(Messages
.RemotingLoginDialog_LABEL_CDM_SERVER
);
244 lblCdmServer
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
245 lblCdmServer
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
247 comboCdmServer
= new Combo(cdmServerComposite
, SWT
.READ_ONLY
);
248 comboCdmServer
.addSelectionListener(new SelectionAdapter() {
250 public void widgetSelected(SelectionEvent e
) {
255 GridData gd_comboCdmServer
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
256 gd_comboCdmServer
.widthHint
= 150;
257 comboCdmServer
.setLayoutData(gd_comboCdmServer
);
258 comboCdmServer
.select(0);
260 txtCdmServerStatus
= new Text(cdmServerComposite
, SWT
.BORDER
);
261 txtCdmServerStatus
.setBackground(SWTResourceManager
.getColor(SWT
.COLOR_INFO_BACKGROUND
));
262 txtCdmServerStatus
.setEditable(false);
263 GridData gd_txtCdmServerStatus
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1);
264 gd_txtCdmServerStatus
.widthHint
= 100;
265 txtCdmServerStatus
.setLayoutData(gd_txtCdmServerStatus
);
267 btnCdmServerRefresh
= new Button(cdmServerComposite
, SWT
.NONE
);
268 btnCdmServerRefresh
.addSelectionListener(new SelectionAdapter() {
270 public void widgetSelected(SelectionEvent e
) {
274 btnCdmServerRefresh
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1));
275 btnCdmServerRefresh
.setText(Messages
.RemotingLoginDialog_LABEL_REFRESH
);
277 Label lblCdmInstance
= new Label(cdmServerComposite
, SWT
.NONE
);
278 GridData gd_lblCdmInstance
= new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1);
279 gd_lblCdmInstance
.heightHint
= 30;
280 lblCdmInstance
.setLayoutData(gd_lblCdmInstance
);
281 lblCdmInstance
.setText(Messages
.RemotingLoginDialog_LABEL_CDM_INSTANCE
);
282 lblCdmInstance
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
284 comboCdmInstance
= new Combo(cdmServerComposite
, SWT
.READ_ONLY
);
285 comboCdmInstance
.addSelectionListener(new SelectionAdapter() {
287 public void widgetSelected(SelectionEvent e
) {
288 refreshCdmInstance();
291 GridData gd_comboCdmInstance
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
292 gd_comboCdmInstance
.widthHint
= 150;
293 comboCdmInstance
.setLayoutData(gd_comboCdmInstance
);
294 comboCdmInstance
.select(0);
296 txtCdmInstanceStatus
= new Text(cdmServerComposite
, SWT
.BORDER
);
297 txtCdmInstanceStatus
.setBackground(SWTResourceManager
.getColor(SWT
.COLOR_INFO_BACKGROUND
));
298 txtCdmInstanceStatus
.setEditable(false);
299 GridData gd_txtCdmInstanceStatus
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1);
300 gd_txtCdmInstanceStatus
.widthHint
= 100;
301 txtCdmInstanceStatus
.setLayoutData(gd_txtCdmInstanceStatus
);
303 btnCdmInstanceRefresh
= new Button(cdmServerComposite
, SWT
.FLAT
);
304 btnCdmInstanceRefresh
.addSelectionListener(new SelectionAdapter() {
306 public void widgetSelected(SelectionEvent e
) {
307 refreshCdmInstance();
310 GridData gd_btnCdmInstanceRefresh
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1);
311 gd_btnCdmInstanceRefresh
.widthHint
= 110;
312 gd_btnCdmInstanceRefresh
.heightHint
= 30;
313 btnCdmInstanceRefresh
.setLayoutData(gd_btnCdmInstanceRefresh
);
314 btnCdmInstanceRefresh
.setText(Messages
.RemotingLoginDialog_LABEL_REFRESH
);
316 loginComposite
= new Composite(remotingComposite
, SWT
.NONE
);
317 GridData gd_loginComposite
= new GridData(SWT
.LEFT
, SWT
.CENTER
, false, false, 1, 1);
318 gd_loginComposite
.widthHint
= 487;
319 gd_loginComposite
.heightHint
= 70;
320 loginComposite
.setLayoutData(gd_loginComposite
);
321 GridLayout gl_loginComposite
= new GridLayout(6, false);
322 gl_loginComposite
.marginTop
= 5;
323 loginComposite
.setLayout(gl_loginComposite
);
325 lblLogin
= new Label(loginComposite
, SWT
.CENTER
);
326 GridData gd_lblLogin
= new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1);
327 gd_lblLogin
.widthHint
= 50;
328 lblLogin
.setLayoutData(gd_lblLogin
);
329 lblLogin
.setText(Messages
.RemotingLoginDialog_LABEL_LOGIN_COLON
);
330 lblLogin
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
332 txtLogin
= new Text(loginComposite
, SWT
.BORDER
);
333 GridData gd_txtLogin
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
334 gd_txtLogin
.minimumWidth
= 80;
335 gd_txtLogin
.widthHint
= 80;
336 gd_txtLogin
.heightHint
= 15;
337 txtLogin
.setLayoutData(gd_txtLogin
);
339 lblPassword
= new Label(loginComposite
, SWT
.CENTER
);
340 lblPassword
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
341 lblPassword
.setText(Messages
.RemotingLoginDialog_LABEL_PASSWORD
);
342 lblPassword
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
344 txtPassword
= new Text(loginComposite
, SWT
.BORDER
| SWT
.PASSWORD
);
345 GridData gd_txtPassword
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
346 gd_txtPassword
.minimumWidth
= 80;
347 gd_txtPassword
.widthHint
= 80;
348 gd_txtPassword
.heightHint
= 15;
349 txtPassword
.setLayoutData(gd_txtPassword
);
350 new Label(loginComposite
, SWT
.NONE
);
351 txtPassword
.addKeyListener(new KeyAdapter() {
353 public void keyPressed(KeyEvent e
) {
354 if(e
.character
==SWT
.CR
){
355 connectButtonPressed();
360 btnConnect
= new Button(loginComposite
, SWT
.FLAT
);
361 btnConnect
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1));
362 btnConnect
.addSelectionListener(new SelectionAdapter() {
364 public void widgetSelected(SelectionEvent e
) {
365 connectButtonPressed();
368 btnConnect
.setText(Messages
.RemotingLoginDialog_LABEL_CONNECT
);
370 btnRememberMe
= new Button(loginComposite
, SWT
.CHECK
);
371 btnRememberMe
.setSelection(true);
372 GridData gd_btnRememberMe
= new GridData(SWT
.LEFT
, SWT
.CENTER
, false, false, 2, 1);
373 btnRememberMe
.setLayoutData(gd_btnRememberMe
);
374 btnRememberMe
.setText(Messages
.RemotingLoginDialog_LABEL_REMEMBER_ME
);
376 Label lblDefaultLogin
= new Label(loginComposite
, SWT
.NONE
);
377 GridDataFactory
.fillDefaults().span(4, 1).align(SWT
.TRAIL
, SWT
.CENTER
).applyTo(lblDefaultLogin
);
378 lblDefaultLogin
.setText(String
.format(Messages
.RemotingLoginDialog_DEFAULT_LOGIN
, DEFAULT_USER
, DEFAULT_PASS
));
380 styledTxtMessage
= new StyledText(remotingComposite
, SWT
.NONE
);
381 styledTxtMessage
.setBackground(SWTResourceManager
.getColor(SWT
.COLOR_INFO_BACKGROUND
));
382 styledTxtMessage
.setForeground(SWTResourceManager
.getColor(SWT
.COLOR_DARK_RED
));
383 styledTxtMessage
.setFont(SWTResourceManager
.getFont(UBUNTU
, 12, SWT
.BOLD
));
384 styledTxtMessage
.setSelectionBackground(SWTResourceManager
.getColor(SWT
.COLOR_LIST_SELECTION_TEXT
));
385 styledTxtMessage
.setSelectionForeground(SWTResourceManager
.getColor(SWT
.COLOR_DARK_RED
));
386 styledTxtMessage
.setDoubleClickEnabled(false);
387 styledTxtMessage
.setEditable(false);
388 GridData gd_styledTxtMessage
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
389 gd_styledTxtMessage
.exclude
= true;
390 gd_styledTxtMessage
.minimumHeight
= MESSAGE_HEIGHT
;
391 gd_styledTxtMessage
.heightHint
= MESSAGE_HEIGHT
;
392 styledTxtMessage
.setLayoutData(gd_styledTxtMessage
);
394 xpndblcmpstAdvanced
= new ExpandableComposite(remotingComposite
, SWT
.NONE
, ExpandableComposite
.TWISTIE
);
395 GridData gd_xpndblcmpstAdvanced
= new GridData(SWT
.FILL
, SWT
.FILL
, false, true, 1, 1);
396 gd_xpndblcmpstAdvanced
.heightHint
= 19;
397 xpndblcmpstAdvanced
.setLayoutData(gd_xpndblcmpstAdvanced
);
398 xpndblcmpstAdvanced
.addExpansionListener(new IExpansionListener() {
400 public void expansionStateChanged(ExpansionEvent e
) {
402 shlConnect
.setSize(MIN_WIDTH
, MIN_EXP_HEIGHT
);
404 shlConnect
.setSize(MIN_WIDTH
, MIN_HEIGHT
);
409 public void expansionStateChanging(ExpansionEvent e
) {
412 xpndblcmpstAdvanced
.setText(Messages
.RemotingLoginDialog_LABEL_ADVANCED
);
413 xpndblcmpstAdvanced
.setExpanded(true);
415 compAdvanced
= new Composite(xpndblcmpstAdvanced
, SWT
.NONE
);
416 xpndblcmpstAdvanced
.setClient(compAdvanced
);
417 compAdvanced
.setLayout(new GridLayout(4, false));
419 lblPort
= new Label(compAdvanced
, SWT
.CENTER
);
420 lblPort
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
421 lblPort
.setSize(0, 0);
422 lblPort
.setText(Messages
.RemotingLoginDialog_LABEL_PORT
);
423 lblPort
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
425 txtPort
= new Text(compAdvanced
, SWT
.BORDER
);
426 GridData gd_txtPort
= new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1);
427 gd_txtPort
.minimumWidth
= 50;
428 gd_txtPort
.widthHint
= 50;
429 txtPort
.setLayoutData(gd_txtPort
);
431 lblServerVersion
= new Label(compAdvanced
, SWT
.CENTER
);
432 lblServerVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
433 lblServerVersion
.setText(Messages
.RemotingLoginDialog_LABEL_SERVER_CDMLIB_VERSION
);
434 lblServerVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
436 txtServerVersion
= new Text(compAdvanced
, SWT
.BORDER
);
437 txtServerVersion
.setEditable(false);
438 txtServerVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1));
439 btnStopServer
= new Button(compAdvanced
, SWT
.FLAT
);
440 btnStopServer
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1));
441 btnStopServer
.addMouseListener(new MouseAdapter() {
443 public void mouseUp(MouseEvent e
) {
447 btnStopServer
.setText(Messages
.RemotingLoginDialog_LABEL_STOP_MANAGED_SERVER
);
449 lblEditorVersion
= new Label(compAdvanced
, SWT
.CENTER
);
450 lblEditorVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
451 lblEditorVersion
.setText(Messages
.RemotingLoginDialog_LABEL_EDITOR_CDMLIB_VERSION
);
452 lblEditorVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
454 txtEditorVersion
= new Text(compAdvanced
, SWT
.BORDER
);
455 txtEditorVersion
.setEditable(false);
456 txtEditorVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
457 new Label(compAdvanced
, SWT
.NONE
);
458 new Label(compAdvanced
, SWT
.NONE
);
460 lblServerCDMVersion
= new Label(compAdvanced
, SWT
.CENTER
);
461 lblServerCDMVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
462 lblServerCDMVersion
.setText(Messages
.RemotingLoginDialog_LABEL_SERVER_CDM_VERSION
);
463 lblServerCDMVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
465 txtServerCDMVersion
= new Text(compAdvanced
, SWT
.BORDER
);
466 txtServerCDMVersion
.setEditable(false);
467 txtServerCDMVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
468 new Label(compAdvanced
, SWT
.NONE
);
469 new Label(compAdvanced
, SWT
.NONE
);
471 lblEditorCDMVersion
= new Label(compAdvanced
, SWT
.CENTER
);
472 lblEditorCDMVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
473 lblEditorCDMVersion
.setText(Messages
.RemotingLoginDialog_LABEL_EDITOR_CDM_VERSION
);
474 lblEditorCDMVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
476 txtEditorCDMVersion
= new Text(compAdvanced
, SWT
.BORDER
);
477 txtEditorCDMVersion
.setEditable(false);
478 txtEditorCDMVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
482 private void connectButtonPressed() {
483 if(selectedCsii
.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
484 startManagedServer();
487 if (CdmStore
.isActive() && CdmStore
.currentAuthentiationHasOneOfRoles(Role
.ROLE_REMOTING
)){
488 PreferencesUtil
.setNomenclaturalCodePreferences();
494 private void populateCdmServerCombo() {
495 Job job
= new Job(Messages
.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES
) {
497 protected IStatus
run(IProgressMonitor monitor
) {
498 Display
.getDefault().syncExec(new Runnable() {
501 for(CdmServerInfo csii
: CdmServerInfo
.getCdmServers()) {
502 csiiMap
.put(csii
.getName(), csii
);
503 comboCdmServer
.add(csii
.getName());
505 int serverIndex
= -1;
506 if(serverName
!= null) {
507 serverIndex
= comboCdmServer
.indexOf(serverName
);
509 if(serverIndex
== -1) {
510 comboCdmServer
.select(0);
513 comboCdmServer
.select(serverIndex
);
515 CdmRemoteSource devRemoteSource
= CdmServerInfo
.getDevServerRemoteSource();
516 if(devRemoteSource
!= null) {
517 isDevRemoteSource
= true;
518 String username
= System
.getProperty("cdm.server.dev.username"); //$NON-NLS-1$
519 String password
= System
.getProperty("cdm.server.dev.password"); //$NON-NLS-1$
520 if(username
!= null && !username
.isEmpty() && password
!= null && !password
.isEmpty()) {
521 txtLogin
.setText(username
);
522 txtPassword
.setText(password
);
523 CdmStore
.connect(devRemoteSource
, RemotingLoginDialog
.this);
530 return Status
.OK_STATUS
;
537 private void refreshCdmServer() {
539 txtCdmServerStatus
.setText(STATUS_CHECKING_AVAILABILITY
);
540 clearOnServerChange();
542 updateSelectedCdmServer();
543 Display
.getDefault().asyncExec(new Runnable() {
546 checkSelectedCdmServer();
550 catch(SWTException e
){
551 //catch widget is disposed exception which may occurr if
552 //dialog is closed but the runnable tries to update
556 private void updateSelectedCdmServer() {
557 int selIndex
= comboCdmServer
.getSelectionIndex();
559 selectedCsii
= csiiMap
.get(comboCdmServer
.getItem(selIndex
));
563 private void updatePort() {
564 txtPort
.setText(""); //$NON-NLS-1$
565 if(selectedCsii
!= null) {
566 int port
= selectedCsii
.getPort();
567 if(port
== CdmServerInfo
.NULL_PORT
) {
568 txtPort
.setText(CdmServerInfo
.NULL_PORT_STRING
);
570 txtPort
.setText(String
.valueOf(port
));
575 private int getPort() {
576 int port
= CdmServerInfo
.NULL_PORT
;
578 port
= Integer
.valueOf(txtPort
.getText());
579 } catch (NumberFormatException nfe
) {
580 if(!CdmServerInfo
.NULL_PORT_STRING
.equals(txtPort
.getText())) {
581 setMessage(Messages
.RemotingLoginDialog_MESSAGE_PORT_SHOULD_BE_INTEGER
);
587 private void checkSelectedCdmServer() {
589 if(selectedCsii
!= null) {
590 if(selectedCsii
.isLocalhost()) {
591 txtPort
.setEditable(true);
592 txtPort
.setEnabled(true);
595 if(selectedCsii
.pingServer()) {
596 txtCdmServerStatus
.setText(STATUS_AVAILABLE
);
597 populateCdmInstanceCombo(true);
598 String serverVersionTimestamp
= generateLastModifiedTooltip(selectedCsii
.getCdmlibLastModified());
599 txtServerVersion
.setText(selectedCsii
.getCdmlibServicesVersion() + ":" + serverVersionTimestamp
); //$NON-NLS-1$
601 txtCdmServerStatus
.setText(STATUS_NOT_AVAILABLE
);
602 comboCdmInstance
.removeAll();
603 disableCdmInstanceControls("", ""); //$NON-NLS-1$ //$NON-NLS-2$
605 } catch (CDMServerException
| IOException e
) {
606 txtCdmServerStatus
.setText(STATUS_NOT_AVAILABLE
);
607 MessagingUtils
.warningDialog(Messages
.RemotingLoginDialog_CONNECTION_FAILED_TITLE
, this,
608 Messages
.RemotingLoginDialog_CONNECTION_FAILED_MESSAGE
);
609 logger
.warn(Messages
.RemotingLoginDialog_CONNECTION_FAILED_TITLE
, e
);
614 catch(SWTException e
){
615 //catch widget is disposed exception which may occurr if
616 //dialog is closed but the runnable tries to update
621 private void populateCdmInstanceCombo(final boolean forceRefresh
) {
622 comboCdmInstance
.removeAll();
623 comboCdmInstance
.setEnabled(false);
624 btnConnect
.setEnabled(false);
625 txtCdmInstanceStatus
.setText(STATUS_RETRIEVING
);
626 txtCdmInstanceStatus
.setToolTipText(""); //$NON-NLS-1$
628 serverJob
= new Job(Messages
.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES
) {
630 protected IStatus
run(IProgressMonitor monitor
) {
632 if(selectedCsii
!= null) {
634 selectedCsii
.refreshInstances();
636 final List
<CdmInstanceInfo
> instances
= selectedCsii
.getInstances();
637 Display
.getDefault().asyncExec(new Runnable() {
640 if(!instances
.isEmpty()) {
641 for(CdmInstanceInfo cdmInstance
: instances
) {
642 comboCdmInstance
.add(cdmInstance
.getName());
644 int instanceIndex
= -1;
645 if(instanceName
!= null) {
646 instanceIndex
= comboCdmInstance
.indexOf(instanceName
);
648 if(instanceIndex
== -1) {
649 comboCdmInstance
.select(0);
652 comboCdmInstance
.select(instanceIndex
);
654 refreshCdmInstance();
655 comboCdmInstance
.setEnabled(true);
661 txtCdmInstanceStatus
.setText(STATUS_NO_INSTANCES
);
662 btnConnect
.setEnabled(false);
667 } catch (final CDMServerException e
) {
668 MessagingUtils
.warn(getClass(), e
);
669 Display
.getDefault().asyncExec(new Runnable() {
672 disableCdmInstanceControls(STATUS_NOT_AVAILABLE
, e
.getMessage());
676 return Status
.OK_STATUS
;
680 if(txtCdmServerStatus
.getText().equals(STATUS_AVAILABLE
) && !isDevRemoteSource
) {
682 serverJob
.schedule();
686 private void disableCdmInstanceControls(String cdmInstanceStatus
, String tooltip
) {
687 txtCdmInstanceStatus
.setText(cdmInstanceStatus
);
688 txtCdmInstanceStatus
.setToolTipText(tooltip
);
689 comboCdmInstance
.setEnabled(false);
690 btnConnect
.setEnabled(false);
693 private void refreshCdmInstance() {
694 txtCdmInstanceStatus
.setText(STATUS_CHECKING_AVAILABILITY
);
695 clearOnInstanceChange();
696 updateSelectedCdmInstance();
697 checkSelectedCdmInstance();
698 updateManagedServerControls();
701 private void updateSelectedCdmInstance() {
702 int selIndex
= comboCdmInstance
.getSelectionIndex();
704 selectedCdmInstance
= selectedCsii
.getInstanceFromName(comboCdmInstance
.getItem(selIndex
));
706 if(loadLoginPrefs
&& !isDevRemoteSource
) {
707 readPrefCredentials();
712 private void updateManagedServerControls() {
713 if(selectedCsii
.isLocalhostMgd()) {
714 if(isSelectedCdmInstanceRunningInManagedServer()) {
715 txtCdmInstanceStatus
.setText(STATUS_STARTED
);
717 txtCdmInstanceStatus
.setText(STATUS_NOT_STARTED
);
719 btnConnect
.setEnabled(true);
720 selectedCsii
.setPort(getManagedServerPort());
725 if(isManagedServerRunning()) {
726 btnStopServer
.setEnabled(true);
728 btnStopServer
.setEnabled(false);
732 private boolean isManagedServerRunning() {
733 return CdmStore
.getManagedServer() != null && CdmStore
.getManagedServer().isAlive();
736 private boolean isSelectedCdmInstanceRunningInManagedServer() {
737 return CdmStore
.getManagedServer() != null &&
738 CdmStore
.getManagedServer().isAlive() &&
739 selectedCsii
.isLocalhostMgd() &&
740 CdmStore
.getManagedServer().getDataSourceName().equals(selectedCdmInstance
.getName());
743 private void startManagedServer() {
744 if(isManagedServerRunning()) {
745 if(CdmStore
.getManagedServer().getDataSourceName().equals(selectedCdmInstance
.getName())) {
748 Display
.getDefault().syncExec(new Runnable() {
758 Job job
= new Job(Messages
.RemotingLoginDialog_JOB_SERVER_LAUNCH
) {
761 public IStatus
run(IProgressMonitor monitor
) {
762 String mgdServerConfigFileName
= "mgd.datasources.xml"; //$NON-NLS-1$
763 String config
= CDMServerUtils
.convertEditorToServerConfig();
764 File managedServerConfigFile
;
766 monitor
.beginTask(Messages
.RemotingLoginDialog_TASK_LAUNCHING_SERVER
, maxUnits
);
768 monitor
.subTask(String
.format(Messages
.RemotingLoginDialog_GENERATING_CONFIG_FILE
, selectedCdmInstance
.getName()));
769 managedServerConfigFile
= CDMServerUtils
.writeManagedServerConfig(config
, mgdServerConfigFileName
);
771 CdmStore
.setManagedServer(new CDMServer(selectedCdmInstance
.getName(), managedServerConfigFile
));
772 monitor
.subTask(Messages
.RemotingLoginDialog_STARTING_MGD_SERVER
);
773 CdmStore
.getManagedServer().start(false, RemotingLoginDialog
.this);
776 // the following loop is a 'fake' progress monitoring where the progress
777 // bar is advanced by one unit every second until maxUnits -2
778 while(!CdmStore
.getManagedServer().isStarted() && !CdmStore
.getManagedServer().isFailed()) {
779 if(serverUnits
< maxUnits
- 2) {
782 } catch (InterruptedException e
) {
788 Display
.getDefault().asyncExec(new Runnable() {
792 updateManagedServerControls();
796 } catch (IOException ioe
) {
797 MessagingUtils
.errorDialog(Messages
.RemotingLoginDialog_ERROR_GENERATING_CONFIG_FILE
,
800 TaxeditorStorePlugin
.PLUGIN_ID
,
803 } catch (CDMEmbeddedServerException cse
) {
804 MessagingUtils
.errorDialog(Messages
.RemotingLoginDialog_ERROR_STARTING_SERVER
,
807 TaxeditorStorePlugin
.PLUGIN_ID
,
813 return Status
.OK_STATUS
;
818 job
.setProperty(IProgressConstants
.KEEP_PROPERTY
, true);
825 private void stopManagedServer() {
827 CdmStore
.getManagedServer().stop();
828 } catch (Exception e
) {
829 MessagingUtils
.errorDialog(Messages
.RemotingLoginDialog_ERROR_STOPPING_SERVER
,
831 String
.format(Messages
.RemotingLoginDialog_COULD_NOT_STOP_SERVER
, CdmStore
.getManagedServer().getPort()),
832 TaxeditorStorePlugin
.PLUGIN_ID
,
836 CdmStore
.setManagedServer(null);
837 updateManagedServerControls();
840 private int getManagedServerPort() {
841 return CdmStore
.getManagedServer() == null ? CdmServerInfo
.NULL_PORT
: CdmStore
.getManagedServer().getPort();
844 private void checkSelectedCdmInstance() {
845 boolean available
= false;
846 String status
= STATUS_NOT_AVAILABLE
;
847 String message
= null;
849 if(txtCdmServerStatus
.getText().equals(STATUS_AVAILABLE
)) {
851 if(selectedCsii
.pingInstance(selectedCdmInstance
, getPort())) {
852 status
= STATUS_AVAILABLE
;
855 status
= STATUS_NOT_AVAILABLE
;
860 txtServerCDMVersion
.setText(selectedCsii
.getCdmRemoteSource(selectedCdmInstance
, getPort()).getDbSchemaVersion());
861 int compareDbSchemaVersion
= selectedCsii
.compareDbSchemaVersion(selectedCdmInstance
, getPort());
862 int compareCdmlibServicesVersion
= 0;
863 boolean disableServicesApiTimestampCheck
=
864 PreferencesUtil
.getBooleanValue((IPreferenceKeys
.DISABLE_SERVICES_API_TIMESTAMP_CHECK
));
865 if(!disableServicesApiTimestampCheck
) {
866 compareCdmlibServicesVersion
= selectedCsii
.compareCdmlibServicesVersion();
868 if(compareDbSchemaVersion
> 0 || compareCdmlibServicesVersion
> 0) {
869 status
= STATUS_NOT_COMPATIBLE
;
871 message
= MESG_COMPATIBLE_EDITOR_OLD
;
872 } else if(compareDbSchemaVersion
< 0 || compareCdmlibServicesVersion
< 0) {
873 status
= STATUS_NOT_COMPATIBLE
;
875 message
= MESG_COMPATIBLE_SERVER_OLD
;
877 status
= STATUS_AVAILABLE
;
879 message
= ""; //$NON-NLS-1$
882 } catch (Exception e
) {
883 txtCdmInstanceStatus
.setToolTipText(e
.getMessage());
885 btnConnect
.setEnabled(available
);
886 txtCdmInstanceStatus
.setText(status
);
887 if(!StringUtils
.isBlank(message
)) {
894 private void connect() {
895 checkSelectedCdmInstance();
897 if(!txtCdmInstanceStatus
.getText().equals(STATUS_AVAILABLE
)) {
901 ICdmRemoteSource source
= selectedCsii
.getCdmRemoteSource(selectedCdmInstance
, getPort());
903 if(!validateLogin(source
)) {
908 CdmStore
.connect(source
, this);
909 } catch (Exception e
) {
910 // Do not expect anything to go wrong at this point, so we throw a runtime exception
912 throw new RuntimeException(e
);
918 public boolean isRememberMe() {
919 return btnRememberMe
.getSelection();
922 private void persistPrefLastServerInstance() {
923 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
924 Preferences lastServerInstancePrefs
= preferences
.node(LAST_SERVER_INSTANCE_NODE
);
926 lastServerInstancePrefs
.put(LAST_SERVER_KEY
, selectedCsii
.getName());
927 lastServerInstancePrefs
.put(LAST_INSTANCE_KEY
, selectedCdmInstance
.getName());
929 flushPreferences(lastServerInstancePrefs
);
932 private void persistPrefCredentials() {
933 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
934 Preferences credentialsPrefs
= preferences
.node(LOGIN_NODE
);
935 credentialsPrefs
.put(getUsernamePrefKey(), txtLogin
.getText());
936 credentialsPrefs
.put(getPasswordPrefKey(), txtPassword
.getText());
937 flushPreferences(credentialsPrefs
);
940 private void removePrefCredentials() {
941 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
942 Preferences credentialsPrefs
= preferences
.node(LOGIN_NODE
);
943 credentialsPrefs
.put(getUsernamePrefKey(), txtLogin
.getText());
944 credentialsPrefs
.put(getPasswordPrefKey(), txtPassword
.getText());
945 removePreferences(credentialsPrefs
);
947 private void removePreferences(Preferences prefs
) {
950 } catch (BackingStoreException bse
) {
951 setMessage(bse
.getMessage());
954 private void flushPreferences(Preferences prefs
) {
957 } catch (BackingStoreException bse
) {
958 setMessage(bse
.getMessage());
964 private void readPrefCredentials() {
965 String username
, password
;
966 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
967 Preferences credentialsPrefs
= preferences
.node(LOGIN_NODE
);
968 username
= credentialsPrefs
.get(getUsernamePrefKey(), ""); //$NON-NLS-1$
969 txtLogin
.setText(username
);
970 password
= credentialsPrefs
.get(getPasswordPrefKey(),""); //$NON-NLS-1$
971 txtPassword
.setText(password
);
972 if(username
.isEmpty() || password
.isEmpty()) {
977 private void readPrefLastServerInstance() {
978 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
979 Preferences lastServerInstancePrefs
= preferences
.node(LAST_SERVER_INSTANCE_NODE
);
981 serverName
= lastServerInstancePrefs
.get(LAST_SERVER_KEY
, null);
982 instanceName
= lastServerInstancePrefs
.get(LAST_INSTANCE_KEY
, null);
985 private void emptyCredentials() {
986 txtLogin
.setText(""); //$NON-NLS-1$
987 txtPassword
.setText(""); //$NON-NLS-1$
990 private String
getUsernamePrefKey() {
991 return selectedCsii
.toString(selectedCdmInstance
.getName(), getPort()) + USERNAME_SUFFIX
;
994 private String
getPasswordPrefKey() {
995 return selectedCsii
.toString(selectedCdmInstance
.getName(), getPort()) + PASSWORD_SUFFIX
;
998 private boolean validateLogin(ICdmRemoteSource remoteSource
) {
999 if(getUsername() == null || getUsername().isEmpty()) {
1000 setMessage(Messages
.RemotingLoginDialog_LOGIN_CANNOT_BE_EMPTY
);
1003 if(getPassword() == null || getPassword().isEmpty()) {
1004 setMessage(Messages
.RemotingLoginDialog_PASSWORD_CANNOT_BE_EMPTY
);
1010 IUserService userService
= CdmApplicationRemoteConfiguration
.getUserService(remoteSource
);
1011 UsernamePasswordAuthenticationToken token
= new UsernamePasswordAuthenticationToken(getUsername(), getPassword());
1012 CdmApplicationRemoteConfiguration
.getAuthenticationManager(userService
).authenticate(token
);
1013 } catch(BadCredentialsException e
){
1014 setMessage(LoginManager
.INCORRECT_CREDENTIALS_MESSAGE
);
1016 } catch(LockedException e
){
1017 setMessage(LoginManager
.ACCOUNT_LOCKED_MESSAGE
);
1019 } catch(IllegalArgumentException e
){
1020 setMessage(LoginManager
.INCORRECT_CREDENTIALS_MESSAGE
);
1026 public String
getUsername() {
1027 return txtLogin
.getText();
1030 public String
getPassword() {
1031 return txtPassword
.getText();
1034 public void setMessage(String message
) {
1035 if(message
!= null && !message
.isEmpty()) {
1036 // if(message.length() > 50) {
1037 // styledTxtMessage.setToolTipText(message);
1038 // message = message.substring(0,50) + "..."; //$NON-NLS-1$
1040 styledTxtMessage
.setText(message
);
1041 styledTxtMessage
.setVisible(true);
1042 ((GridData
)styledTxtMessage
.getLayoutData()).exclude
= false;
1043 shlConnect
.setSize(MIN_WIDTH
, getHeightWithoutMessage() + MESSAGE_HEIGHT
);
1044 shlConnect
.setMinimumSize(MIN_WIDTH
, getHeightWithoutMessage() + MESSAGE_HEIGHT
);
1046 if (!styledTxtMessage
.isDisposed()){
1047 styledTxtMessage
.setText(""); //$NON-NLS-1$
1048 styledTxtMessage
.setVisible(false);
1049 ((GridData
)styledTxtMessage
.getLayoutData()).exclude
= true;
1051 if(!shlConnect
.isDisposed()){
1052 shlConnect
.setSize(MIN_WIDTH
, getHeightWithoutMessage());
1053 shlConnect
.setMinimumSize(MIN_WIDTH
, getHeightWithoutMessage());
1056 if (!remotingComposite
.isDisposed()){
1057 remotingComposite
.layout();
1061 private int getHeightWithoutMessage() {
1062 if(xpndblcmpstAdvanced
.isExpanded()) {
1063 return MIN_EXP_HEIGHT
;
1070 public void hide(boolean isHidden
) {
1071 if (!shlConnect
.isDisposed()){
1072 if(shlConnect
!= null && shlConnect
.getDisplay() != null) {
1073 shlConnect
.setVisible(!isHidden
);
1077 public void dispose() {
1078 if (!shlConnect
.isDisposed()){
1079 if(shlConnect
!= null && shlConnect
.getDisplay() != null) {
1080 shlConnect
.dispose();
1085 public void onComplete() {
1086 Display
.getDefault().asyncExec(new Runnable() {
1089 if(!isDevRemoteSource
) {
1090 if(isRememberMe()) {
1091 persistPrefCredentials();
1093 removePrefCredentials();
1095 persistPrefLastServerInstance();
1102 private String
generateLastModifiedTooltip(String cdmlibLastModified
) {
1103 if(StringUtils
.isBlank(cdmlibLastModified
)) {
1104 return ""; //$NON-NLS-1$
1106 SimpleDateFormat sdf
= new SimpleDateFormat("yyyy.MM.dd.HH.mm.z"); //$NON-NLS-1$
1107 Date cdmlibLastModifiedDate
;
1108 String cdmlibLastModifiedTimestamp
= ""; //$NON-NLS-1$
1110 cdmlibLastModifiedDate
= new Date(Long
.valueOf(cdmlibLastModified
));
1111 cdmlibLastModifiedTimestamp
= sdf
.format(cdmlibLastModifiedDate
);
1113 return cdmlibLastModifiedTimestamp
;
1116 private void setEditorInfo() {
1117 txtEditorCDMVersion
.setText(CdmMetaData
.getDbSchemaVersion());
1118 String editorVersionTimestamp
= generateLastModifiedTooltip(CdmApplicationState
.getCdmlibLastModified());
1119 txtEditorVersion
.setText(CdmApplicationState
.getCdmlibVersion() + ":" + editorVersionTimestamp
); //$NON-NLS-1$
1122 private void clearOnServerChange() {
1123 setMessage(""); //$NON-NLS-1$
1124 txtServerCDMVersion
.setText(""); //$NON-NLS-1$
1125 txtServerVersion
.setText(""); //$NON-NLS-1$
1126 txtServerVersion
.setToolTipText(""); //$NON-NLS-1$
1127 txtServerCDMVersion
.setText(""); //$NON-NLS-1$
1128 comboCdmInstance
.removeAll();
1129 txtCdmInstanceStatus
.setText(""); //$NON-NLS-1$
1130 txtPort
.setEditable(false);
1131 txtPort
.setEnabled(false);
1134 private void clearOnInstanceChange() {
1135 setMessage(""); //$NON-NLS-1$
1136 txtServerCDMVersion
.setText(""); //$NON-NLS-1$
1143 public void handleError(final Throwable t
) {
1145 Display
.getDefault().syncExec(new Runnable() {
1150 String title
= Messages
.RemotingLoginDialog_SERVER_LAUNCH_ERROR
;
1151 String message
= t
.getMessage();
1154 MessagingUtils
.errorDialog(title
,
1157 TaxeditorStorePlugin
.PLUGIN_ID
,