You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2013/09/24 09:59:16 UTC

svn commit: r1525811 - /sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java

Author: stefanegli
Date: Tue Sep 24 07:59:16 2013
New Revision: 1525811

URL: http://svn.apache.org/r1525811
Log:
SLING-3093 : editing of values in the 'Connection' section of a (wst) server was clumsy due to curser-reset on each typed character. Fixed.

Modified:
    sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java

Modified: sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java
URL: http://svn.apache.org/viewvc/sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java?rev=1525811&r1=1525810&r2=1525811&view=diff
==============================================================================
--- sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java (original)
+++ sling/branches/tooling-ide-vlt/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ConnectionEditorSection.java Tue Sep 24 07:59:16 2013
@@ -54,6 +54,7 @@ public class ConnectionEditorSection ext
     private Text passwordText;
     private ISlingLaunchpadServer launchpadServer;
     private PropertyChangeListener serverListener;
+    private boolean updating = false;
 
     @Override
     public void createSection(Composite parent) {
@@ -128,18 +129,25 @@ public class ConnectionEditorSection ext
 
             @Override
             public void propertyChange(PropertyChangeEvent evt) {
-
-                if (ISlingLaunchpadServer.PROP_PORT.equals(evt.getPropertyName())) {
-                    portText.setText(((Integer) evt.getNewValue()).toString());
-                } else if (ISlingLaunchpadServer.PROP_DEBUG_PORT.equals(evt.getPropertyName())) {
-                    debugPortText.setText(((Integer) evt.getNewValue()).toString());
-                } else if (ISlingLaunchpadServer.PROP_CONTEXT_PATH.equals(evt.getPropertyName())) {
-                    contextPathText.setText((String) evt.getNewValue());
-                } else if (ISlingLaunchpadServer.PROP_USERNAME.equals(evt.getPropertyName())) {
-                    usernameText.setText((String) evt.getNewValue());
-                } else if (ISlingLaunchpadServer.PROP_PASSWORD.equals(evt.getPropertyName())) {
-                    passwordText.setText((String) evt.getNewValue());
-                }
+            	if (updating) {
+            		return;
+            	}
+            	updating = true;
+            	try{
+	                if (ISlingLaunchpadServer.PROP_PORT.equals(evt.getPropertyName())) {
+	                    portText.setText(((Integer) evt.getNewValue()).toString());
+	                } else if (ISlingLaunchpadServer.PROP_DEBUG_PORT.equals(evt.getPropertyName())) {
+	                    debugPortText.setText(((Integer) evt.getNewValue()).toString());
+	                } else if (ISlingLaunchpadServer.PROP_CONTEXT_PATH.equals(evt.getPropertyName())) {
+	                    contextPathText.setText((String) evt.getNewValue());
+	                } else if (ISlingLaunchpadServer.PROP_USERNAME.equals(evt.getPropertyName())) {
+	                    usernameText.setText((String) evt.getNewValue());
+	                } else if (ISlingLaunchpadServer.PROP_PASSWORD.equals(evt.getPropertyName())) {
+	                    passwordText.setText((String) evt.getNewValue());
+	                }
+            	} finally {
+            		updating = false;
+            	}
             }
         };
 
@@ -167,28 +175,36 @@ public class ConnectionEditorSection ext
         ModifyListener listener = new ModifyListener() {
             @Override
             public void modifyText(ModifyEvent e) {
-            	if (e.getSource() == portText) {
-                    try {
-                        int port = Integer.parseInt(portText.getText());
-                        execute(new SetServerPortCommand(server, port));
-                    } catch (NumberFormatException ex) {
-                        // shucks
-                    }
-                } else if (e.getSource() == debugPortText) {
-                    try {
-                        int debugPort = Integer.parseInt(debugPortText.getText());
-                        execute(new SetServerDebugPortCommand(server, debugPort));
-                    } catch (NumberFormatException ex) {
-                        // shucks
-                    	ex.printStackTrace();
-                    }
-                } else if (e.getSource() == contextPathText) {
-                    execute(new SetServerContextPathCommand(server, contextPathText.getText()));
-                } else if (e.getSource() == usernameText) {
-                    execute(new SetServerUsernameCommand(server, usernameText.getText()));
-                } else if (e.getSource() == passwordText) {
-                    execute(new SetServerPasswordCommand(server, passwordText.getText()));
-                }
+            	if (updating) {
+            		return;
+            	}
+            	updating = true;
+            	try{
+	            	if (e.getSource() == portText) {
+	                    try {
+	                        int port = Integer.parseInt(portText.getText());
+	                        execute(new SetServerPortCommand(server, port));
+	                    } catch (NumberFormatException ex) {
+	                        // shucks
+	                    }
+	                } else if (e.getSource() == debugPortText) {
+	                    try {
+	                        int debugPort = Integer.parseInt(debugPortText.getText());
+	                        execute(new SetServerDebugPortCommand(server, debugPort));
+	                    } catch (NumberFormatException ex) {
+	                        // shucks
+	                    	ex.printStackTrace();
+	                    }
+	                } else if (e.getSource() == contextPathText) {
+	                    execute(new SetServerContextPathCommand(server, contextPathText.getText()));
+	                } else if (e.getSource() == usernameText) {
+	                    execute(new SetServerUsernameCommand(server, usernameText.getText()));
+	                } else if (e.getSource() == passwordText) {
+	                    execute(new SetServerPasswordCommand(server, passwordText.getText()));
+	                }
+            	} finally {
+            		updating = false;
+            	}
             }
         };