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
.eclipse
.core
.runtime
.IProgressMonitor
;
21 import org
.eclipse
.core
.runtime
.IStatus
;
22 import org
.eclipse
.core
.runtime
.Status
;
23 import org
.eclipse
.core
.runtime
.jobs
.Job
;
24 import org
.eclipse
.core
.runtime
.preferences
.ConfigurationScope
;
25 import org
.eclipse
.core
.runtime
.preferences
.IEclipsePreferences
;
26 import org
.eclipse
.swt
.SWT
;
27 import org
.eclipse
.swt
.SWTException
;
28 import org
.eclipse
.swt
.custom
.StyledText
;
29 import org
.eclipse
.swt
.events
.KeyAdapter
;
30 import org
.eclipse
.swt
.events
.KeyEvent
;
31 import org
.eclipse
.swt
.events
.MouseAdapter
;
32 import org
.eclipse
.swt
.events
.MouseEvent
;
33 import org
.eclipse
.swt
.events
.SelectionAdapter
;
34 import org
.eclipse
.swt
.events
.SelectionEvent
;
35 import org
.eclipse
.swt
.graphics
.Point
;
36 import org
.eclipse
.swt
.layout
.FillLayout
;
37 import org
.eclipse
.swt
.layout
.GridData
;
38 import org
.eclipse
.swt
.layout
.GridLayout
;
39 import org
.eclipse
.swt
.widgets
.Button
;
40 import org
.eclipse
.swt
.widgets
.Combo
;
41 import org
.eclipse
.swt
.widgets
.Composite
;
42 import org
.eclipse
.swt
.widgets
.Dialog
;
43 import org
.eclipse
.swt
.widgets
.Display
;
44 import org
.eclipse
.swt
.widgets
.Label
;
45 import org
.eclipse
.swt
.widgets
.Shell
;
46 import org
.eclipse
.swt
.widgets
.Text
;
47 import org
.eclipse
.ui
.forms
.events
.ExpansionEvent
;
48 import org
.eclipse
.ui
.forms
.events
.IExpansionListener
;
49 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
50 import org
.eclipse
.ui
.progress
.IProgressConstants
;
51 import org
.eclipse
.wb
.swt
.SWTResourceManager
;
52 import org
.osgi
.service
.prefs
.BackingStoreException
;
53 import org
.osgi
.service
.prefs
.Preferences
;
54 import org
.springframework
.security
.authentication
.BadCredentialsException
;
55 import org
.springframework
.security
.authentication
.LockedException
;
56 import org
.springframework
.security
.authentication
.UsernamePasswordAuthenticationToken
;
58 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationRemoteConfiguration
;
59 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationState
;
60 import eu
.etaxonomy
.cdm
.api
.service
.IUserService
;
61 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmMetaData
;
62 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
63 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
64 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
65 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
66 import eu
.etaxonomy
.taxeditor
.remoting
.server
.CDMServerException
;
67 import eu
.etaxonomy
.taxeditor
.remoting
.server
.CDMServerUtils
;
68 import eu
.etaxonomy
.taxeditor
.remoting
.source
.CdmRemoteSource
;
69 import eu
.etaxonomy
.taxeditor
.remoting
.source
.CdmServerInfo
;
70 import eu
.etaxonomy
.taxeditor
.remoting
.source
.CdmServerInfo
.CdmInstanceInfo
;
71 import eu
.etaxonomy
.taxeditor
.remoting
.source
.ICdmRemoteSource
;
72 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
73 import eu
.etaxonomy
.taxeditor
.store
.LoginManager
;
74 import eu
.etaxonomy
.taxeditor
.store
.internal
.TaxeditorStorePlugin
;
75 import eu
.etaxonomy
.taxeditor
.webapp
.CDMEmbeddedServerException
;
76 import eu
.etaxonomy
.taxeditor
.webapp
.CDMServer
;
77 import eu
.etaxonomy
.taxeditor
.webapp
.ICDMServerError
;
85 public class RemotingLoginDialog
extends Dialog
implements ICDMServerError
{
87 private static final String UBUNTU
= "Ubuntu"; //$NON-NLS-1$
88 protected Object result
;
89 protected Shell shlConnect
;
90 private Text txtCdmServerStatus
;
91 private Text txtCdmInstanceStatus
;
92 private Combo comboCdmServer
;
93 private Combo comboCdmInstance
;
94 private Button btnConnect
;
96 private final Map
<String
, CdmServerInfo
> csiiMap
= new HashMap
<String
, CdmServerInfo
>();
98 private final static String STATUS_AVAILABLE
= Messages
.RemotingLoginDialog_STATUS_AVAILABLE
;
99 private final static String STATUS_NOT_AVAILABLE
= Messages
.RemotingLoginDialog_STATUS_NOT_AVAILABLE
;
100 private final static String STATUS_STARTED
= Messages
.RemotingLoginDialog_STATUS_STARTED
;
101 private final static String STATUS_NOT_STARTED
= Messages
.RemotingLoginDialog_STATUS_NOT_STARTED
;
102 private final static String STATUS_RETRIEVING
= Messages
.RemotingLoginDialog_STATUS_RETRIEVING
;
103 private final static String STATUS_CHECKING_AVAILABILITY
= Messages
.RemotingLoginDialog_STATUS_CHECKING
;
104 private final static String STATUS_NO_INSTANCES
= Messages
.RemotingLoginDialog_STATUS_NO_INSTANCES_FOUND
;
105 private final static String STATUS_ERROR
= Messages
.RemotingLoginDialog_STATUS_ERROR
;
106 private final static String STATUS_REMOTING_NOT_ACTIVATED
= Messages
.RemotingLoginDialog_STATUS_REMOTING_NOT_ACTIVATED
;
107 private final static String STATUS_NOT_COMPATIBLE
= Messages
.RemotingLoginDialog_STATUS_NOT_COMPATIBLE
;
109 private final static String MESG_COMPATIBLE_EDITOR_OLD
= Messages
.RemotingLoginDialog_UPDATE_EDITOR
;
110 private final static String MESG_COMPATIBLE_SERVER_OLD
= Messages
.RemotingLoginDialog_CHOOSE_COMPATIBLE_CDM_SERVER
;
112 private final static String STORE_PREFERENCES_NODE
= "eu.etaxonomy.taxeditor.store"; //$NON-NLS-1$
114 private final static String LOGIN_NODE
= "login"; //$NON-NLS-1$
115 private final static String USERNAME_SUFFIX
= "_username"; //$NON-NLS-1$
116 private final static String PASSWORD_SUFFIX
= "_password"; //$NON-NLS-1$
118 private final static String LAST_SERVER_INSTANCE_NODE
= "lastServerInstance"; //$NON-NLS-1$
119 private final static String LAST_SERVER_KEY
= "lastServerKey"; //$NON-NLS-1$
120 private final static String LAST_INSTANCE_KEY
= "lastInstanceKey"; //$NON-NLS-1$
122 private final static String REFRESH_LABEL
= Messages
.RemotingLoginDialog_LABEL_REFRESH
;
124 private Composite remotingComposite
;
125 private CdmServerInfo selectedCsii
;
126 private CdmInstanceInfo selectedCdmInstance
;
127 private Button btnCdmServerRefresh
;
128 private Button btnCdmInstanceRefresh
;
129 private Button btnStopServer
;
130 private Composite loginComposite
;
131 private Label lblLogin
;
132 private Text txtLogin
;
133 private Label lblPassword
;
134 private Text txtPassword
;
135 private Button btnRememberMe
;
136 private Composite compAdvanced
;
137 private Label lblPort
;
138 private Text txtPort
;
139 private Label lblServerVersion
;
140 private Text txtServerVersion
;
141 private ExpandableComposite xpndblcmpstAdvanced
;
142 private StyledText styledTxtMessage
;
145 private final int MIN_WIDTH
= 530;
146 private final int MIN_HEIGHT
= 220;
147 private final int MIN_EXP_HEIGHT
= 380;
148 private final int MESSAGE_HEIGHT
= 25;
149 private Label lblEditorVersion
;
150 private Text txtEditorVersion
;
151 private Label lblServerCDMVersion
;
152 private Text txtServerCDMVersion
;
153 private Label lblEditorCDMVersion
;
154 private Text txtEditorCDMVersion
;
156 private String serverName
, instanceName
;
157 private boolean autoConnect
= false;
158 private boolean loadLoginPrefs
= true;
159 private boolean isDevRemoteSource
= false;
160 private Job serverJob
;
166 public RemotingLoginDialog(Shell parent
, int style
) {
167 super(parent
, style
);
168 setText(Messages
.RemotingLoginDialog_LABEL_LOGIN
);
171 public Object
open(CdmRemoteSource source
, boolean loadLoginPrefs
, boolean autoConnect
) {
172 this.loadLoginPrefs
= loadLoginPrefs
;
173 this.serverName
= source
.getName();
174 String contextPath
= source
.getContextPath();
175 this.instanceName
= contextPath
.substring(contextPath
.lastIndexOf("/") + 1); //$NON-NLS-1$
176 return open(serverName
, instanceName
, loadLoginPrefs
, autoConnect
);
180 public Object
open(String serverName
, String instanceName
, boolean loadLoginPrefs
, boolean autoConnect
) {
181 this.serverName
= serverName
;
182 this.instanceName
= instanceName
;
183 this.loadLoginPrefs
= loadLoginPrefs
;
184 this.autoConnect
= autoConnect
;
192 public Object
open() {
195 if(serverName
== null && instanceName
== null) {
196 readPrefLastServerInstance();
200 populateCdmServerCombo();
204 xpndblcmpstAdvanced
.setExpanded(false);
206 Display display
= getParent().getDisplay();
208 while (!shlConnect
.isDisposed()) {
209 if (!display
.readAndDispatch()) {
218 * Create contents of the dialog.
220 private void createContents() {
221 shlConnect
= new Shell(getParent(), SWT
.DIALOG_TRIM
);
222 shlConnect
.setMinimumSize(new Point(MIN_WIDTH
, MIN_HEIGHT
));
223 shlConnect
.setSize(MIN_WIDTH
, MIN_HEIGHT
);
224 shlConnect
.setText(Messages
.RemotingLoginDialog_LABEL_CONNECT
);
225 shlConnect
.setLayout(new FillLayout(SWT
.HORIZONTAL
));
227 remotingComposite
= new Composite(shlConnect
, SWT
.NONE
);
228 remotingComposite
.setLayout(new GridLayout(1, false));
230 Composite cdmServerComposite
= new Composite(remotingComposite
, SWT
.NONE
);
231 GridData gd_cdmServerComposite
= new GridData(SWT
.LEFT
, SWT
.CENTER
, false, false, 1, 1);
232 gd_cdmServerComposite
.heightHint
= 68;
233 cdmServerComposite
.setLayoutData(gd_cdmServerComposite
);
234 cdmServerComposite
.setLayout(new GridLayout(4, false));
236 Label lblCdmServer
= new Label(cdmServerComposite
, SWT
.NONE
);
237 lblCdmServer
.setText(Messages
.RemotingLoginDialog_LABEL_CDM_SERVER
);
238 lblCdmServer
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
239 lblCdmServer
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
241 comboCdmServer
= new Combo(cdmServerComposite
, SWT
.READ_ONLY
);
242 comboCdmServer
.addSelectionListener(new SelectionAdapter() {
244 public void widgetSelected(SelectionEvent e
) {
249 GridData gd_comboCdmServer
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
250 gd_comboCdmServer
.widthHint
= 150;
251 comboCdmServer
.setLayoutData(gd_comboCdmServer
);
252 comboCdmServer
.select(0);
254 txtCdmServerStatus
= new Text(cdmServerComposite
, SWT
.BORDER
);
255 txtCdmServerStatus
.setBackground(SWTResourceManager
.getColor(SWT
.COLOR_INFO_BACKGROUND
));
256 txtCdmServerStatus
.setEditable(false);
257 GridData gd_txtCdmServerStatus
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1);
258 gd_txtCdmServerStatus
.widthHint
= 100;
259 txtCdmServerStatus
.setLayoutData(gd_txtCdmServerStatus
);
261 btnCdmServerRefresh
= new Button(cdmServerComposite
, SWT
.NONE
);
262 btnCdmServerRefresh
.addSelectionListener(new SelectionAdapter() {
264 public void widgetSelected(SelectionEvent e
) {
268 btnCdmServerRefresh
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1));
269 btnCdmServerRefresh
.setText(Messages
.RemotingLoginDialog_LABEL_REFRESH
);
271 Label lblCdmInstance
= new Label(cdmServerComposite
, SWT
.NONE
);
272 GridData gd_lblCdmInstance
= new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1);
273 gd_lblCdmInstance
.heightHint
= 30;
274 lblCdmInstance
.setLayoutData(gd_lblCdmInstance
);
275 lblCdmInstance
.setText(Messages
.RemotingLoginDialog_LABEL_CDM_INSTANCE
);
276 lblCdmInstance
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
278 comboCdmInstance
= new Combo(cdmServerComposite
, SWT
.READ_ONLY
);
279 comboCdmInstance
.addSelectionListener(new SelectionAdapter() {
281 public void widgetSelected(SelectionEvent e
) {
282 refreshCdmInstance();
285 GridData gd_comboCdmInstance
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
286 gd_comboCdmInstance
.widthHint
= 150;
287 comboCdmInstance
.setLayoutData(gd_comboCdmInstance
);
288 comboCdmInstance
.select(0);
290 txtCdmInstanceStatus
= new Text(cdmServerComposite
, SWT
.BORDER
);
291 txtCdmInstanceStatus
.setBackground(SWTResourceManager
.getColor(SWT
.COLOR_INFO_BACKGROUND
));
292 txtCdmInstanceStatus
.setEditable(false);
293 GridData gd_txtCdmInstanceStatus
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1);
294 gd_txtCdmInstanceStatus
.widthHint
= 100;
295 txtCdmInstanceStatus
.setLayoutData(gd_txtCdmInstanceStatus
);
297 btnCdmInstanceRefresh
= new Button(cdmServerComposite
, SWT
.FLAT
);
298 btnCdmInstanceRefresh
.addSelectionListener(new SelectionAdapter() {
300 public void widgetSelected(SelectionEvent e
) {
301 refreshCdmInstance();
304 GridData gd_btnCdmInstanceRefresh
= new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1);
305 gd_btnCdmInstanceRefresh
.widthHint
= 110;
306 gd_btnCdmInstanceRefresh
.heightHint
= 30;
307 btnCdmInstanceRefresh
.setLayoutData(gd_btnCdmInstanceRefresh
);
308 btnCdmInstanceRefresh
.setText(Messages
.RemotingLoginDialog_LABEL_REFRESH
);
310 loginComposite
= new Composite(remotingComposite
, SWT
.NONE
);
311 GridData gd_loginComposite
= new GridData(SWT
.LEFT
, SWT
.CENTER
, false, false, 1, 1);
312 gd_loginComposite
.widthHint
= 487;
313 gd_loginComposite
.heightHint
= 70;
314 loginComposite
.setLayoutData(gd_loginComposite
);
315 GridLayout gl_loginComposite
= new GridLayout(6, false);
316 gl_loginComposite
.marginTop
= 5;
317 loginComposite
.setLayout(gl_loginComposite
);
319 lblLogin
= new Label(loginComposite
, SWT
.CENTER
);
320 GridData gd_lblLogin
= new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1);
321 gd_lblLogin
.widthHint
= 50;
322 lblLogin
.setLayoutData(gd_lblLogin
);
323 lblLogin
.setText(Messages
.RemotingLoginDialog_LABEL_LOGIN_COLON
);
324 lblLogin
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
326 txtLogin
= new Text(loginComposite
, SWT
.BORDER
);
327 GridData gd_txtLogin
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
328 gd_txtLogin
.minimumWidth
= 80;
329 gd_txtLogin
.widthHint
= 80;
330 gd_txtLogin
.heightHint
= 15;
331 txtLogin
.setLayoutData(gd_txtLogin
);
333 lblPassword
= new Label(loginComposite
, SWT
.CENTER
);
334 lblPassword
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
335 lblPassword
.setText(Messages
.RemotingLoginDialog_LABEL_PASSWORD
);
336 lblPassword
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
338 txtPassword
= new Text(loginComposite
, SWT
.BORDER
| SWT
.PASSWORD
);
339 GridData gd_txtPassword
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
340 gd_txtPassword
.minimumWidth
= 80;
341 gd_txtPassword
.widthHint
= 80;
342 gd_txtPassword
.heightHint
= 15;
343 txtPassword
.setLayoutData(gd_txtPassword
);
344 new Label(loginComposite
, SWT
.NONE
);
345 txtPassword
.addKeyListener(new KeyAdapter() {
347 public void keyPressed(KeyEvent e
) {
348 if(e
.character
==SWT
.CR
){
349 connectButtonPressed();
354 btnConnect
= new Button(loginComposite
, SWT
.FLAT
);
355 btnConnect
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1));
356 btnConnect
.addSelectionListener(new SelectionAdapter() {
358 public void widgetSelected(SelectionEvent e
) {
359 connectButtonPressed();
362 btnConnect
.setText(Messages
.RemotingLoginDialog_LABEL_CONNECT
);
364 btnRememberMe
= new Button(loginComposite
, SWT
.CHECK
);
365 btnRememberMe
.setSelection(true);
366 GridData gd_btnRememberMe
= new GridData(SWT
.LEFT
, SWT
.CENTER
, false, false, 2, 1);
367 btnRememberMe
.setLayoutData(gd_btnRememberMe
);
368 btnRememberMe
.setText(Messages
.RemotingLoginDialog_LABEL_REMEMBER_ME
);
369 new Label(loginComposite
, SWT
.NONE
);
370 new Label(loginComposite
, SWT
.NONE
);
371 new Label(loginComposite
, SWT
.NONE
);
372 new Label(loginComposite
, SWT
.NONE
);
374 styledTxtMessage
= new StyledText(remotingComposite
, SWT
.NONE
);
375 styledTxtMessage
.setBackground(SWTResourceManager
.getColor(SWT
.COLOR_INFO_BACKGROUND
));
376 styledTxtMessage
.setForeground(SWTResourceManager
.getColor(SWT
.COLOR_DARK_RED
));
377 styledTxtMessage
.setFont(SWTResourceManager
.getFont(UBUNTU
, 12, SWT
.BOLD
));
378 styledTxtMessage
.setSelectionBackground(SWTResourceManager
.getColor(SWT
.COLOR_LIST_SELECTION_TEXT
));
379 styledTxtMessage
.setSelectionForeground(SWTResourceManager
.getColor(SWT
.COLOR_DARK_RED
));
380 styledTxtMessage
.setDoubleClickEnabled(false);
381 styledTxtMessage
.setEditable(false);
382 GridData gd_styledTxtMessage
= new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 1, 1);
383 gd_styledTxtMessage
.exclude
= true;
384 gd_styledTxtMessage
.minimumHeight
= MESSAGE_HEIGHT
;
385 gd_styledTxtMessage
.heightHint
= MESSAGE_HEIGHT
;
386 styledTxtMessage
.setLayoutData(gd_styledTxtMessage
);
388 xpndblcmpstAdvanced
= new ExpandableComposite(remotingComposite
, SWT
.NONE
, ExpandableComposite
.TWISTIE
);
389 GridData gd_xpndblcmpstAdvanced
= new GridData(SWT
.FILL
, SWT
.FILL
, false, true, 1, 1);
390 gd_xpndblcmpstAdvanced
.heightHint
= 19;
391 xpndblcmpstAdvanced
.setLayoutData(gd_xpndblcmpstAdvanced
);
392 xpndblcmpstAdvanced
.addExpansionListener(new IExpansionListener() {
394 public void expansionStateChanged(ExpansionEvent e
) {
395 GridData gridData
= (GridData
) xpndblcmpstAdvanced
.getLayoutData();
397 shlConnect
.setSize(MIN_WIDTH
, MIN_EXP_HEIGHT
);
399 shlConnect
.setSize(MIN_WIDTH
, MIN_HEIGHT
);
404 public void expansionStateChanging(ExpansionEvent e
) {
407 xpndblcmpstAdvanced
.setText(Messages
.RemotingLoginDialog_LABEL_ADVANCED
);
408 xpndblcmpstAdvanced
.setExpanded(true);
410 compAdvanced
= new Composite(xpndblcmpstAdvanced
, SWT
.NONE
);
411 xpndblcmpstAdvanced
.setClient(compAdvanced
);
412 compAdvanced
.setLayout(new GridLayout(4, false));
414 lblPort
= new Label(compAdvanced
, SWT
.CENTER
);
415 lblPort
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
416 lblPort
.setSize(0, 0);
417 lblPort
.setText(Messages
.RemotingLoginDialog_LABEL_PORT
);
418 lblPort
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
420 txtPort
= new Text(compAdvanced
, SWT
.BORDER
);
421 GridData gd_txtPort
= new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1);
422 gd_txtPort
.minimumWidth
= 50;
423 gd_txtPort
.widthHint
= 50;
424 txtPort
.setLayoutData(gd_txtPort
);
426 lblServerVersion
= new Label(compAdvanced
, SWT
.CENTER
);
427 lblServerVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
428 lblServerVersion
.setText(Messages
.RemotingLoginDialog_LABEL_SERVER_CDMLIB_VERSION
);
429 lblServerVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
431 txtServerVersion
= new Text(compAdvanced
, SWT
.BORDER
);
432 txtServerVersion
.setEditable(false);
433 txtServerVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, false, false, 1, 1));
434 btnStopServer
= new Button(compAdvanced
, SWT
.FLAT
);
435 btnStopServer
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false, 2, 1));
436 btnStopServer
.addMouseListener(new MouseAdapter() {
438 public void mouseUp(MouseEvent e
) {
442 btnStopServer
.setText(Messages
.RemotingLoginDialog_LABEL_STOP_MANAGED_SERVER
);
444 lblEditorVersion
= new Label(compAdvanced
, SWT
.CENTER
);
445 lblEditorVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
446 lblEditorVersion
.setText(Messages
.RemotingLoginDialog_LABEL_EDITOR_CDMLIB_VERSION
);
447 lblEditorVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
449 txtEditorVersion
= new Text(compAdvanced
, SWT
.BORDER
);
450 txtEditorVersion
.setEditable(false);
451 txtEditorVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
452 new Label(compAdvanced
, SWT
.NONE
);
453 new Label(compAdvanced
, SWT
.NONE
);
455 lblServerCDMVersion
= new Label(compAdvanced
, SWT
.CENTER
);
456 lblServerCDMVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
457 lblServerCDMVersion
.setText(Messages
.RemotingLoginDialog_LABEL_SERVER_CDM_VERSION
);
458 lblServerCDMVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
460 txtServerCDMVersion
= new Text(compAdvanced
, SWT
.BORDER
);
461 txtServerCDMVersion
.setEditable(false);
462 txtServerCDMVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
463 new Label(compAdvanced
, SWT
.NONE
);
464 new Label(compAdvanced
, SWT
.NONE
);
466 lblEditorCDMVersion
= new Label(compAdvanced
, SWT
.CENTER
);
467 lblEditorCDMVersion
.setLayoutData(new GridData(SWT
.RIGHT
, SWT
.CENTER
, false, false, 1, 1));
468 lblEditorCDMVersion
.setText(Messages
.RemotingLoginDialog_LABEL_EDITOR_CDM_VERSION
);
469 lblEditorCDMVersion
.setFont(SWTResourceManager
.getFont(UBUNTU
, 9, SWT
.NORMAL
));
471 txtEditorCDMVersion
= new Text(compAdvanced
, SWT
.BORDER
);
472 txtEditorCDMVersion
.setEditable(false);
473 txtEditorCDMVersion
.setLayoutData(new GridData(SWT
.FILL
, SWT
.CENTER
, true, false, 1, 1));
477 private void connectButtonPressed() {
478 if(selectedCsii
.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
479 startManagedServer();
482 if (CdmStore
.isActive()){
483 PreferencesUtil
.setNomenclaturalCodePreferences();
489 private void populateCdmServerCombo() {
490 Job job
= new Job(Messages
.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES
) {
492 protected IStatus
run(IProgressMonitor monitor
) {
493 Display
.getDefault().syncExec(new Runnable() {
496 for(CdmServerInfo csii
: CdmServerInfo
.getCdmServers()) {
497 csiiMap
.put(csii
.getName(), csii
);
498 comboCdmServer
.add(csii
.getName());
500 int serverIndex
= -1;
501 if(serverName
!= null) {
502 serverIndex
= comboCdmServer
.indexOf(serverName
);
504 if(serverIndex
== -1) {
505 comboCdmServer
.select(0);
508 comboCdmServer
.select(serverIndex
);
510 CdmRemoteSource devRemoteSource
= CdmServerInfo
.getDevServerRemoteSource();
511 if(devRemoteSource
!= null) {
512 isDevRemoteSource
= true;
513 String username
= System
.getProperty("cdm.server.dev.username"); //$NON-NLS-1$
514 String password
= System
.getProperty("cdm.server.dev.password"); //$NON-NLS-1$
515 if(username
!= null && !username
.isEmpty() && password
!= null && !password
.isEmpty()) {
516 txtLogin
.setText(username
);
517 txtPassword
.setText(password
);
518 CdmStore
.connect(devRemoteSource
, RemotingLoginDialog
.this);
525 return Status
.OK_STATUS
;
532 private void refreshCdmServer() {
534 txtCdmServerStatus
.setText(STATUS_CHECKING_AVAILABILITY
);
535 clearOnServerChange();
537 updateSelectedCdmServer();
538 Display
.getDefault().asyncExec(new Runnable() {
541 checkSelectedCdmServer();
545 catch(SWTException e
){
546 //catch widget is disposed exception which may occurr if
547 //dialog is closed but the runnable tries to update
551 private void updateSelectedCdmServer() {
552 int selIndex
= comboCdmServer
.getSelectionIndex();
554 selectedCsii
= csiiMap
.get(comboCdmServer
.getItem(selIndex
));
558 private void updatePort() {
560 if(selectedCsii
!= null) {
561 int port
= selectedCsii
.getPort();
562 if(port
== CdmServerInfo
.NULL_PORT
) {
563 txtPort
.setText(CdmServerInfo
.NULL_PORT_STRING
);
565 txtPort
.setText(String
.valueOf(port
));
570 private int getPort() {
571 int port
= CdmServerInfo
.NULL_PORT
;
573 port
= Integer
.valueOf(txtPort
.getText());
574 } catch (NumberFormatException nfe
) {
575 if(!CdmServerInfo
.NULL_PORT_STRING
.equals(txtPort
.getText())) {
576 setMessage(Messages
.RemotingLoginDialog_MESSAGE_PORT_SHOULD_BE_INTEGER
);
582 private void checkSelectedCdmServer() {
583 if(selectedCsii
!= null) {
584 if(selectedCsii
.isLocalhost()) {
585 txtPort
.setEditable(true);
586 txtPort
.setEnabled(true);
588 if(selectedCsii
.pingServer()) {
589 txtCdmServerStatus
.setText(STATUS_AVAILABLE
);
590 populateCdmInstanceCombo(true);
591 String serverVersionTimestamp
= generateLastModifiedTooltip(selectedCsii
.getCdmlibLastModified());
592 txtServerVersion
.setText(selectedCsii
.getCdmlibServicesVersion() + ":" + serverVersionTimestamp
); //$NON-NLS-1$
594 txtCdmServerStatus
.setText(STATUS_NOT_AVAILABLE
);
595 comboCdmInstance
.removeAll();
596 disableCdmInstanceControls("", "");
603 private void populateCdmInstanceCombo(final boolean forceRefresh
) {
604 comboCdmInstance
.removeAll();
605 comboCdmInstance
.setEnabled(false);
606 btnConnect
.setEnabled(false);
607 txtCdmInstanceStatus
.setText(STATUS_RETRIEVING
);
608 txtCdmInstanceStatus
.setToolTipText("");
610 serverJob
= new Job(Messages
.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES
) {
612 protected IStatus
run(IProgressMonitor monitor
) {
614 if(selectedCsii
!= null) {
616 selectedCsii
.refreshInstances();
618 final List
<CdmInstanceInfo
> instances
= selectedCsii
.getInstances();
619 Display
.getDefault().asyncExec(new Runnable() {
622 if(!instances
.isEmpty()) {
623 for(CdmInstanceInfo cdmInstance
: instances
) {
624 comboCdmInstance
.add(cdmInstance
.getName());
626 int instanceIndex
= -1;
627 if(instanceName
!= null) {
628 instanceIndex
= comboCdmInstance
.indexOf(instanceName
);
630 if(instanceIndex
== -1) {
631 comboCdmInstance
.select(0);
634 comboCdmInstance
.select(instanceIndex
);
636 refreshCdmInstance();
637 comboCdmInstance
.setEnabled(true);
643 txtCdmInstanceStatus
.setText(STATUS_NO_INSTANCES
);
644 btnConnect
.setEnabled(false);
649 } catch (final CDMServerException e
) {
650 MessagingUtils
.warn(getClass(), e
);
651 Display
.getDefault().asyncExec(new Runnable() {
654 disableCdmInstanceControls(STATUS_NOT_AVAILABLE
, e
.getMessage());
658 return Status
.OK_STATUS
;
662 if(txtCdmServerStatus
.getText().equals(STATUS_AVAILABLE
) && !isDevRemoteSource
) {
664 serverJob
.schedule();
668 private void disableCdmInstanceControls(String cdmInstanceStatus
, String tooltip
) {
669 txtCdmInstanceStatus
.setText(cdmInstanceStatus
);
670 txtCdmInstanceStatus
.setToolTipText(tooltip
);
671 comboCdmInstance
.setEnabled(false);
672 btnConnect
.setEnabled(false);
675 private void refreshCdmInstance() {
676 txtCdmInstanceStatus
.setText(STATUS_CHECKING_AVAILABILITY
);
677 clearOnInstanceChange();
678 updateSelectedCdmInstance();
679 checkSelectedCdmInstance();
680 updateManagedServerControls();
683 private void updateSelectedCdmInstance() {
684 int selIndex
= comboCdmInstance
.getSelectionIndex();
686 selectedCdmInstance
= selectedCsii
.getInstanceFromName(comboCdmInstance
.getItem(selIndex
));
688 if(loadLoginPrefs
&& !isDevRemoteSource
) {
689 readPrefCredentials();
694 private void updateManagedServerControls() {
695 if(selectedCsii
.isLocalhostMgd()) {
696 if(isSelectedCdmInstanceRunningInManagedServer()) {
697 txtCdmInstanceStatus
.setText(STATUS_STARTED
);
699 txtCdmInstanceStatus
.setText(STATUS_NOT_STARTED
);
701 btnConnect
.setEnabled(true);
702 selectedCsii
.setPort(getManagedServerPort());
707 if(isManagedServerRunning()) {
708 btnStopServer
.setEnabled(true);
710 btnStopServer
.setEnabled(false);
714 private boolean isManagedServerRunning() {
715 return CdmStore
.getManagedServer() != null && CdmStore
.getManagedServer().isAlive();
718 private boolean isSelectedCdmInstanceRunningInManagedServer() {
719 return CdmStore
.getManagedServer() != null &&
720 CdmStore
.getManagedServer().isAlive() &&
721 selectedCsii
.isLocalhostMgd() &&
722 CdmStore
.getManagedServer().getDataSourceName().equals(selectedCdmInstance
.getName());
725 private void startManagedServer() {
726 if(isManagedServerRunning()) {
727 if(CdmStore
.getManagedServer().getDataSourceName().equals(selectedCdmInstance
.getName())) {
730 Display
.getDefault().syncExec(new Runnable() {
740 Job job
= new Job(Messages
.RemotingLoginDialog_JOB_SERVER_LAUNCH
) {
743 public IStatus
run(IProgressMonitor monitor
) {
744 String mgdServerConfigFileName
= "mgd.datasources.xml"; //$NON-NLS-1$
745 String config
= CDMServerUtils
.convertEditorToServerConfig();
746 File managedServerConfigFile
;
748 monitor
.beginTask(Messages
.RemotingLoginDialog_TASK_LAUNCHING_SERVER
, maxUnits
);
750 monitor
.subTask(String
.format(Messages
.RemotingLoginDialog_GENERATING_CONFIG_FILE
, selectedCdmInstance
.getName()));
751 managedServerConfigFile
= CDMServerUtils
.writeManagedServerConfig(config
, mgdServerConfigFileName
);
753 CdmStore
.setManagedServer(new CDMServer(selectedCdmInstance
.getName(), managedServerConfigFile
));
754 monitor
.subTask(Messages
.RemotingLoginDialog_STARTING_MGD_SERVER
);
755 CdmStore
.getManagedServer().start(false, RemotingLoginDialog
.this);
758 // the following loop is a 'fake' progress monitoring where the progress
759 // bar is advanced by one unit every second until maxUnits -2
760 while(!CdmStore
.getManagedServer().isStarted() && !CdmStore
.getManagedServer().isFailed()) {
761 if(serverUnits
< maxUnits
- 2) {
764 } catch (InterruptedException e
) {
770 Display
.getDefault().asyncExec(new Runnable() {
774 updateManagedServerControls();
778 } catch (IOException ioe
) {
779 MessagingUtils
.errorDialog(Messages
.RemotingLoginDialog_ERROR_GENERATING_CONFIG_FILE
,
782 TaxeditorStorePlugin
.PLUGIN_ID
,
785 } catch (CDMEmbeddedServerException cse
) {
786 MessagingUtils
.errorDialog(Messages
.RemotingLoginDialog_ERROR_STARTING_SERVER
,
789 TaxeditorStorePlugin
.PLUGIN_ID
,
795 return Status
.OK_STATUS
;
800 job
.setProperty(IProgressConstants
.KEEP_PROPERTY
, true);
807 private void stopManagedServer() {
809 CdmStore
.getManagedServer().stop();
810 } catch (Exception e
) {
811 MessagingUtils
.errorDialog(Messages
.RemotingLoginDialog_ERROR_STOPPING_SERVER
,
813 String
.format(Messages
.RemotingLoginDialog_COULD_NOT_STOP_SERVER
, CdmStore
.getManagedServer().getPort()),
814 TaxeditorStorePlugin
.PLUGIN_ID
,
818 CdmStore
.setManagedServer(null);
819 updateManagedServerControls();
822 private int getManagedServerPort() {
823 return CdmStore
.getManagedServer() == null ? CdmServerInfo
.NULL_PORT
: CdmStore
.getManagedServer().getPort();
826 private void checkSelectedCdmInstance() {
827 boolean available
= false;
828 String status
= STATUS_NOT_AVAILABLE
;
829 String message
= null;
831 if(txtCdmServerStatus
.getText().equals(STATUS_AVAILABLE
)) {
833 if(selectedCsii
.pingInstance(selectedCdmInstance
, getPort())) {
834 status
= STATUS_AVAILABLE
;
837 status
= STATUS_NOT_AVAILABLE
;
842 txtServerCDMVersion
.setText(selectedCsii
.getCdmRemoteSource(selectedCdmInstance
, getPort()).getDbSchemaVersion());
843 int compareDbSchemaVersion
= selectedCsii
.compareDbSchemaVersion(selectedCdmInstance
, getPort());
844 int compareCdmlibServicesVersion
= 0;
845 boolean disableServicesApiTimestampCheck
=
846 PreferencesUtil
.getPreferenceStore().getBoolean((IPreferenceKeys
.DISABLE_SERVICES_API_TIMESTAMP_CHECK
));
847 if(!disableServicesApiTimestampCheck
) {
848 compareCdmlibServicesVersion
= selectedCsii
.compareCdmlibServicesVersion();
850 if(compareDbSchemaVersion
> 0 || compareCdmlibServicesVersion
> 0) {
851 status
= STATUS_NOT_COMPATIBLE
;
853 message
= MESG_COMPATIBLE_EDITOR_OLD
;
854 } else if(compareDbSchemaVersion
< 0 || compareCdmlibServicesVersion
< 0) {
855 status
= STATUS_NOT_COMPATIBLE
;
857 message
= MESG_COMPATIBLE_SERVER_OLD
;
859 status
= STATUS_AVAILABLE
;
861 message
= ""; //$NON-NLS-1$
864 } catch (Exception e
) {
865 txtCdmInstanceStatus
.setToolTipText(e
.getMessage());
867 btnConnect
.setEnabled(available
);
868 txtCdmInstanceStatus
.setText(status
);
869 if(!StringUtils
.isBlank(message
)) {
876 private void connect() {
877 checkSelectedCdmInstance();
879 if(!txtCdmInstanceStatus
.getText().equals(STATUS_AVAILABLE
)) {
883 ICdmRemoteSource source
= selectedCsii
.getCdmRemoteSource(selectedCdmInstance
, getPort());
885 if(!validateLogin(source
)) {
890 CdmStore
.connect(source
, this);
891 } catch (Exception e
) {
892 // Do not expect anything to go wrong at this point, so we throw a runtime exception
894 throw new RuntimeException(e
);
900 public boolean isRememberMe() {
901 return btnRememberMe
.getSelection();
904 private void persistPrefLastServerInstance() {
905 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
906 Preferences lastServerInstancePrefs
= preferences
.node(LAST_SERVER_INSTANCE_NODE
);
908 lastServerInstancePrefs
.put(LAST_SERVER_KEY
, selectedCsii
.getName());
909 lastServerInstancePrefs
.put(LAST_INSTANCE_KEY
, selectedCdmInstance
.getName());
911 flushPreferences(lastServerInstancePrefs
);
914 private void persistPrefCredentials() {
915 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
916 Preferences credentialsPrefs
= preferences
.node(LOGIN_NODE
);
917 credentialsPrefs
.put(getUsernamePrefKey(), txtLogin
.getText());
918 credentialsPrefs
.put(getPasswordPrefKey(), txtPassword
.getText());
919 flushPreferences(credentialsPrefs
);
922 private void removePrefCredentials() {
923 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
924 Preferences credentialsPrefs
= preferences
.node(LOGIN_NODE
);
925 credentialsPrefs
.put(getUsernamePrefKey(), txtLogin
.getText());
926 credentialsPrefs
.put(getPasswordPrefKey(), txtPassword
.getText());
927 removePreferences(credentialsPrefs
);
929 private void removePreferences(Preferences prefs
) {
932 } catch (BackingStoreException bse
) {
933 setMessage(bse
.getMessage());
936 private void flushPreferences(Preferences prefs
) {
939 } catch (BackingStoreException bse
) {
940 setMessage(bse
.getMessage());
946 private void readPrefCredentials() {
947 String username
, password
;
948 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
949 Preferences credentialsPrefs
= preferences
.node(LOGIN_NODE
);
950 username
= credentialsPrefs
.get(getUsernamePrefKey(), ""); //$NON-NLS-1$
951 txtLogin
.setText(username
);
952 password
= credentialsPrefs
.get(getPasswordPrefKey(),""); //$NON-NLS-1$
953 txtPassword
.setText(password
);
954 if(username
.isEmpty() || password
.isEmpty()) {
959 private void readPrefLastServerInstance() {
960 IEclipsePreferences preferences
= ConfigurationScope
.INSTANCE
.getNode(STORE_PREFERENCES_NODE
);
961 Preferences lastServerInstancePrefs
= preferences
.node(LAST_SERVER_INSTANCE_NODE
);
963 serverName
= lastServerInstancePrefs
.get(LAST_SERVER_KEY
, null);
964 instanceName
= lastServerInstancePrefs
.get(LAST_INSTANCE_KEY
, null);
967 private void emptyCredentials() {
968 txtLogin
.setText("");
969 txtPassword
.setText("");
972 private String
getUsernamePrefKey() {
973 return selectedCsii
.toString(selectedCdmInstance
.getName(), getPort()) + USERNAME_SUFFIX
;
976 private String
getPasswordPrefKey() {
977 return selectedCsii
.toString(selectedCdmInstance
.getName(), getPort()) + PASSWORD_SUFFIX
;
980 private boolean validateLogin(ICdmRemoteSource remoteSource
) {
981 if(getUsername() == null || getUsername().isEmpty()) {
982 setMessage(Messages
.RemotingLoginDialog_LOGIN_CANNOT_BE_EMPTY
);
985 if(getPassword() == null || getPassword().isEmpty()) {
986 setMessage(Messages
.RemotingLoginDialog_PASSWORD_CANNOT_BE_EMPTY
);
992 IUserService userService
= CdmApplicationRemoteConfiguration
.getUserService(remoteSource
);
993 UsernamePasswordAuthenticationToken token
= new UsernamePasswordAuthenticationToken(getUsername(), getPassword());
994 CdmApplicationRemoteConfiguration
.getAuthenticationManager(userService
).authenticate(token
);
995 } catch(BadCredentialsException e
){
996 setMessage(LoginManager
.INCORRECT_CREDENTIALS_MESSAGE
);
998 } catch(LockedException e
){
999 setMessage(LoginManager
.ACCOUNT_LOCKED_MESSAGE
);
1001 } catch(IllegalArgumentException e
){
1002 setMessage(LoginManager
.INCORRECT_CREDENTIALS_MESSAGE
);
1008 public String
getUsername() {
1009 return txtLogin
.getText();
1012 public String
getPassword() {
1013 return txtPassword
.getText();
1016 public void setMessage(String message
) {
1017 if(message
!= null && !message
.isEmpty()) {
1018 if(message
.length() > 60) {
1019 styledTxtMessage
.setToolTipText(message
);
1020 message
= message
.substring(0, 60) + "..."; //$NON-NLS-1$
1022 styledTxtMessage
.setText(message
);
1023 styledTxtMessage
.setVisible(true);
1024 ((GridData
)styledTxtMessage
.getLayoutData()).exclude
= false;
1025 shlConnect
.setSize(MIN_WIDTH
, getHeightWithoutMessage() + MESSAGE_HEIGHT
);
1026 shlConnect
.setMinimumSize(MIN_WIDTH
, getHeightWithoutMessage() + MESSAGE_HEIGHT
);
1028 styledTxtMessage
.setText(""); //$NON-NLS-1$
1029 styledTxtMessage
.setVisible(false);
1030 ((GridData
)styledTxtMessage
.getLayoutData()).exclude
= true;
1031 shlConnect
.setSize(MIN_WIDTH
, getHeightWithoutMessage());
1032 shlConnect
.setMinimumSize(MIN_WIDTH
, getHeightWithoutMessage());
1034 remotingComposite
.layout();
1037 private int getHeightWithoutMessage() {
1038 if(xpndblcmpstAdvanced
.isExpanded()) {
1039 return MIN_EXP_HEIGHT
;
1046 public void hide(boolean isHidden
) {
1047 if(shlConnect
!= null && shlConnect
.getDisplay() != null) {
1048 shlConnect
.setVisible(!isHidden
);
1051 public void dispose() {
1052 if(shlConnect
!= null && shlConnect
.getDisplay() != null) {
1053 shlConnect
.dispose();
1057 public void onComplete() {
1058 Display
.getDefault().asyncExec(new Runnable() {
1061 if(!isDevRemoteSource
) {
1062 if(isRememberMe()) {
1063 persistPrefCredentials();
1065 removePrefCredentials();
1067 persistPrefLastServerInstance();
1074 private String
generateLastModifiedTooltip(String cdmlibLastModified
) {
1075 if(StringUtils
.isBlank(cdmlibLastModified
)) {
1076 return ""; //$NON-NLS-1$
1078 SimpleDateFormat sdf
= new SimpleDateFormat("yyyy.MM.dd.HH.mm.z"); //$NON-NLS-1$
1079 Date cdmlibLastModifiedDate
;
1080 String cdmlibLastModifiedTimestamp
= ""; //$NON-NLS-1$
1082 cdmlibLastModifiedDate
= new Date(Long
.valueOf(cdmlibLastModified
));
1083 cdmlibLastModifiedTimestamp
= sdf
.format(cdmlibLastModifiedDate
);
1085 return cdmlibLastModifiedTimestamp
;
1088 private void setEditorInfo() {
1089 txtEditorCDMVersion
.setText(CdmMetaData
.getDbSchemaVersion());
1090 String editorVersionTimestamp
= generateLastModifiedTooltip(CdmApplicationState
.getCdmlibLastModified());
1091 txtEditorVersion
.setText(CdmApplicationState
.getCdmlibVersion() + ":" + editorVersionTimestamp
); //$NON-NLS-1$
1094 private void clearOnServerChange() {
1095 setMessage(""); //$NON-NLS-1$
1096 txtServerCDMVersion
.setText(""); //$NON-NLS-1$
1097 txtServerVersion
.setText(""); //$NON-NLS-1$
1098 txtServerVersion
.setToolTipText(""); //$NON-NLS-1$
1099 txtServerCDMVersion
.setText(""); //$NON-NLS-1$
1100 comboCdmInstance
.removeAll();
1101 txtCdmInstanceStatus
.setText(""); //$NON-NLS-1$
1102 txtPort
.setEditable(false);
1103 txtPort
.setEnabled(false);
1106 private void clearOnInstanceChange() {
1107 setMessage(""); //$NON-NLS-1$
1108 txtServerCDMVersion
.setText(""); //$NON-NLS-1$
1115 public void handleError(final Throwable t
) {
1117 Display
.getDefault().syncExec(new Runnable() {
1122 String title
= Messages
.RemotingLoginDialog_SERVER_LAUNCH_ERROR
;
1123 String message
= t
.getMessage();
1126 MessagingUtils
.errorDialog(title
,
1129 TaxeditorStorePlugin
.PLUGIN_ID
,