mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Bug 436880 - Only flag change if something has actually changed.
Change-Id: I56313985ea703c0c602166e4c1cb1fb1211cb702 Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
parent
0df67c311c
commit
79bf8fb436
2 changed files with 42 additions and 11 deletions
|
@ -45,6 +45,7 @@ import org.eclipse.ui.forms.widgets.ExpandableComposite;
|
|||
|
||||
public class JSchConnectionPage extends WizardPage {
|
||||
private class DataModifyListener implements ModifyListener {
|
||||
@Override
|
||||
public synchronized void modifyText(ModifyEvent e) {
|
||||
validateFields();
|
||||
getContainer().updateButtons();
|
||||
|
@ -90,6 +91,7 @@ public class JSchConnectionPage extends WizardPage {
|
|||
expComp.setExpanded(false);
|
||||
expComp.addExpansionListener(new IExpansionListener() {
|
||||
|
||||
@Override
|
||||
public void expansionStateChanged(ExpansionEvent e) {
|
||||
Point newSize = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
Point currentSize = parent.getSize();
|
||||
|
@ -100,6 +102,7 @@ public class JSchConnectionPage extends WizardPage {
|
|||
getShell().layout(true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expansionStateChanging(ExpansionEvent e) {
|
||||
// Ignore
|
||||
}
|
||||
|
@ -194,6 +197,7 @@ public class JSchConnectionPage extends WizardPage {
|
|||
fPublicKeyButton.setSelection(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createControl(Composite parent) {
|
||||
if (fConnection == null) {
|
||||
setDescription(Messages.JSchNewConnectionPage_New_connection_properties);
|
||||
|
@ -370,15 +374,35 @@ public class JSchConnectionPage extends WizardPage {
|
|||
}
|
||||
}
|
||||
if (fConnection != null) {
|
||||
fConnection.setName(fConnectionName.getText());
|
||||
if (!fConnection.getName().equals(fConnectionName.getText().trim())) {
|
||||
fConnection.setName(fConnectionName.getText().trim());
|
||||
}
|
||||
if (!fConnection.getAddress().equals(fHostText.getText().trim())) {
|
||||
fConnection.setAddress(fHostText.getText().trim());
|
||||
}
|
||||
if (!fConnection.getUsername().equals(fUserText.getText().trim())) {
|
||||
fConnection.setUsername(fUserText.getText().trim());
|
||||
}
|
||||
if (!fConnection.getPassword().equals(fPasswordText.getText().trim())) {
|
||||
fConnection.setPassword(fPasswordText.getText().trim());
|
||||
}
|
||||
if (!fConnection.getPassphrase().equals(fPassphraseText.getText().trim())) {
|
||||
fConnection.setPassphrase(fPassphraseText.getText().trim());
|
||||
}
|
||||
if (!fConnection.getKeyFile().equals(fFileWidget.getLocationPath())) {
|
||||
fConnection.setKeyFile(fFileWidget.getLocationPath());
|
||||
}
|
||||
if (fConnection.isPasswordAuth() != fPasswordButton.getSelection()) {
|
||||
fConnection.setIsPasswordAuth(fPasswordButton.getSelection());
|
||||
fConnection.setTimeout(Integer.parseInt(fTimeoutText.getText().trim()));
|
||||
fConnection.setPort(Integer.parseInt(fPortText.getText().trim()));
|
||||
}
|
||||
int timeout = Integer.parseInt(fTimeoutText.getText().trim());
|
||||
if (fConnection.getTimeout() != timeout) {
|
||||
fConnection.setTimeout(timeout);
|
||||
}
|
||||
int port = Integer.parseInt(fPortText.getText().trim());
|
||||
if (fConnection.getPort() != port) {
|
||||
fConnection.setPort(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
wizard.setConnection(copy);
|
||||
wizard.setInvalidConnectionNames(invalidConnectionNames());
|
||||
IRemoteConnectionWorkingCopy conn = wizard.open();
|
||||
if (conn != null) {
|
||||
if (conn != null && conn.isDirty()) {
|
||||
fWorkingCopies.put(copy.getName(), copy);
|
||||
fConnectionViewer.refresh();
|
||||
fIsDirty = true;
|
||||
|
@ -499,6 +499,10 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
return;
|
||||
}
|
||||
wc.save();
|
||||
/*
|
||||
* Replace working copy with original so that the correct version will be used in the future
|
||||
*/
|
||||
fWorkingCopies.put(conn.getName(), conn);
|
||||
}
|
||||
}
|
||||
IRemoteUIConnectionManager mgr = RemoteUIServices.getRemoteUIServices(conn.getRemoteServices())
|
||||
|
@ -533,7 +537,10 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
|
|||
*/
|
||||
for (IRemoteConnection conn : fWorkingCopies.values()) {
|
||||
if (conn instanceof IRemoteConnectionWorkingCopy) {
|
||||
((IRemoteConnectionWorkingCopy) conn).save();
|
||||
IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) conn;
|
||||
if (wc.isDirty()) {
|
||||
wc.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
initWorkingConnections();
|
||||
|
|
Loading…
Add table
Reference in a new issue