[jbosstools-commits] JBoss Tools SVN: r43988 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Sep 25 07:25:13 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-09-25 07:25:12 -0400 (Tue, 25 Sep 2012)
New Revision: 43988

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
Log:
JBIDE-12709 to trunk

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java	2012-09-25 10:22:19 UTC (rev 43987)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java	2012-09-25 11:25:12 UTC (rev 43988)
@@ -40,11 +40,14 @@
  */
 public class ServerPasswordSection extends ServerEditorSection {
 
+	private static String PASSWORD_NOT_LOADED = "***jbt****"; //$NON-NLS-1$
+	
 	private ModifyListener nameModifyListener, passModifyListener;
 	private Text nameText, passText;
 	private ServerAttributeHelper helper;
 	
 	private String passwordString;
+	private boolean passwordChanged = false;
 	
 	public void init(IEditorSite site, IEditorInput input) {
 		super.init(site, input);
@@ -69,12 +72,11 @@
 		Label username = toolkit.createLabel(composite, Messages.swf_Username);
 		username.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
 		String n = ServerConverter.getJBossServer(server.getOriginal()).getUsername();
-		String p = ServerConverter.getJBossServer(server.getOriginal()).getPassword();
+		passwordString = PASSWORD_NOT_LOADED;
 		nameText = toolkit.createText(composite, n); 
 		Label password = toolkit.createLabel(composite, Messages.swf_Password);
 		password.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
-		passText = toolkit.createText(composite, p, SWT.SINGLE | SWT.PASSWORD);
-		passwordString = p;
+		passText = toolkit.createText(composite, passwordString, SWT.SINGLE | SWT.PASSWORD);
 		
 		d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
 		nameText.setLayoutData(d);
@@ -111,11 +113,12 @@
 		public SetPassCommand(IServerWorkingCopy server) {
 			super(server, Messages.EditorChangePasswordCommandName, passText, passText.getText(), 
 					IJBossToolingConstants.SERVER_PASSWORD, passModifyListener);
-			oldVal = passText.getText();
+			oldVal = passwordString;
 		}
 		
 		public void execute() {
 			passwordString = newVal;
+			passwordChanged = !PASSWORD_NOT_LOADED.equals(passwordString);
 		}
 		
 		public void undo() {
@@ -123,6 +126,7 @@
 			text.removeModifyListener(listener);
 			text.setText(oldVal);
 			text.addModifyListener(listener);
+			passwordChanged = !PASSWORD_NOT_LOADED.equals(passwordString);
 		}
 	}
 
@@ -131,9 +135,11 @@
 	 * @param monitor the progress monitor for the save operation.
 	 */
 	public void doSave(IProgressMonitor monitor) {
-		JBossServer jbs = (JBossServer)ServerConverter.getJBossServer(server.getOriginal());
-		jbs.setPassword(passwordString);
-		monitor.worked(100);
+		if( passwordChanged ) {
+			JBossServer jbs = (JBossServer)ServerConverter.getJBossServer(server.getOriginal());
+			jbs.setPassword(passwordString);
+			monitor.worked(100);
+		}
 	}
 
 }



More information about the jbosstools-commits mailing list