use of org.apache.sling.ide.eclipse.core.SetServerContextPathCommand in project sling by apache.
the class ConnectionEditorSection method initialize.
private void initialize() {
final ISlingLaunchpadConfiguration config = launchpadServer.getConfiguration();
portText.setText(String.valueOf(config.getPort()));
debugPortText.setText(String.valueOf(config.getDebugPort()));
contextPathText.setText(config.getContextPath());
usernameText.setText(config.getUsername());
passwordText.setText(config.getPassword());
ModifyListener listener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
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;
}
}
};
for (Text text : new Text[] { portText, debugPortText, contextPathText, usernameText, passwordText }) {
text.addModifyListener(listener);
}
}
Aggregations