1
0
Fork 0
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:
Greg Watson 2014-06-06 15:16:45 -04:00
parent 0df67c311c
commit 79bf8fb436
2 changed files with 42 additions and 11 deletions

View file

@ -45,6 +45,7 @@ import org.eclipse.ui.forms.widgets.ExpandableComposite;
public class JSchConnectionPage extends WizardPage { public class JSchConnectionPage extends WizardPage {
private class DataModifyListener implements ModifyListener { private class DataModifyListener implements ModifyListener {
@Override
public synchronized void modifyText(ModifyEvent e) { public synchronized void modifyText(ModifyEvent e) {
validateFields(); validateFields();
getContainer().updateButtons(); getContainer().updateButtons();
@ -90,6 +91,7 @@ public class JSchConnectionPage extends WizardPage {
expComp.setExpanded(false); expComp.setExpanded(false);
expComp.addExpansionListener(new IExpansionListener() { expComp.addExpansionListener(new IExpansionListener() {
@Override
public void expansionStateChanged(ExpansionEvent e) { public void expansionStateChanged(ExpansionEvent e) {
Point newSize = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT); Point newSize = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point currentSize = parent.getSize(); Point currentSize = parent.getSize();
@ -100,6 +102,7 @@ public class JSchConnectionPage extends WizardPage {
getShell().layout(true, true); getShell().layout(true, true);
} }
@Override
public void expansionStateChanging(ExpansionEvent e) { public void expansionStateChanging(ExpansionEvent e) {
// Ignore // Ignore
} }
@ -194,6 +197,7 @@ public class JSchConnectionPage extends WizardPage {
fPublicKeyButton.setSelection(false); fPublicKeyButton.setSelection(false);
} }
@Override
public void createControl(Composite parent) { public void createControl(Composite parent) {
if (fConnection == null) { if (fConnection == null) {
setDescription(Messages.JSchNewConnectionPage_New_connection_properties); setDescription(Messages.JSchNewConnectionPage_New_connection_properties);
@ -370,15 +374,35 @@ public class JSchConnectionPage extends WizardPage {
} }
} }
if (fConnection != null) { 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()); fConnection.setAddress(fHostText.getText().trim());
}
if (!fConnection.getUsername().equals(fUserText.getText().trim())) {
fConnection.setUsername(fUserText.getText().trim()); fConnection.setUsername(fUserText.getText().trim());
}
if (!fConnection.getPassword().equals(fPasswordText.getText().trim())) {
fConnection.setPassword(fPasswordText.getText().trim()); fConnection.setPassword(fPasswordText.getText().trim());
}
if (!fConnection.getPassphrase().equals(fPassphraseText.getText().trim())) {
fConnection.setPassphrase(fPassphraseText.getText().trim()); fConnection.setPassphrase(fPassphraseText.getText().trim());
}
if (!fConnection.getKeyFile().equals(fFileWidget.getLocationPath())) {
fConnection.setKeyFile(fFileWidget.getLocationPath()); fConnection.setKeyFile(fFileWidget.getLocationPath());
}
if (fConnection.isPasswordAuth() != fPasswordButton.getSelection()) {
fConnection.setIsPasswordAuth(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);
}
} }
} }

View file

@ -379,7 +379,7 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
wizard.setConnection(copy); wizard.setConnection(copy);
wizard.setInvalidConnectionNames(invalidConnectionNames()); wizard.setInvalidConnectionNames(invalidConnectionNames());
IRemoteConnectionWorkingCopy conn = wizard.open(); IRemoteConnectionWorkingCopy conn = wizard.open();
if (conn != null) { if (conn != null && conn.isDirty()) {
fWorkingCopies.put(copy.getName(), copy); fWorkingCopies.put(copy.getName(), copy);
fConnectionViewer.refresh(); fConnectionViewer.refresh();
fIsDirty = true; fIsDirty = true;
@ -499,6 +499,10 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
return; return;
} }
wc.save(); 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()) IRemoteUIConnectionManager mgr = RemoteUIServices.getRemoteUIServices(conn.getRemoteServices())
@ -533,7 +537,10 @@ public class ConnectionsPreferencePage extends PreferencePage implements IWorkbe
*/ */
for (IRemoteConnection conn : fWorkingCopies.values()) { for (IRemoteConnection conn : fWorkingCopies.values()) {
if (conn instanceof IRemoteConnectionWorkingCopy) { if (conn instanceof IRemoteConnectionWorkingCopy) {
((IRemoteConnectionWorkingCopy) conn).save(); IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) conn;
if (wc.isDirty()) {
wc.save();
}
} }
} }
initWorkingConnections(); initWorkingConnections();