1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 491356 - Modify behavior of CONNECTION_RENAMED events

Change-Id: Ia42fc1b1f9784a33442f4275e99bb373c40c2e06
Signed-off-by: Jonathan Williams <jonwilliams@qnx.com>
This commit is contained in:
Jonathan Williams 2016-04-08 16:24:41 -04:00
parent d68f0e3881
commit 79e687aa5d
2 changed files with 4 additions and 3 deletions

View file

@ -34,7 +34,8 @@ public class RemoteConnectionChangeEvent {
public static final int CONNECTION_ABORTED = 1 << 2;
/**
* Event indicating that the connection name was changed.
* Event indicating that the connection name will be changed. It is sent prior to the name change taking place.
* The event passes an IRemoteConnectionWorkingCopy so that the original and new name can be used by the listener.
*/
public static final int CONNECTION_RENAMED = 1 << 3;

View file

@ -189,7 +189,7 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
*/
@Override
public void fireConnectionChangeEvent(int type) {
if (original != null) {
if (original != null && type != RemoteConnectionChangeEvent.CONNECTION_RENAMED) {
original.fireConnectionChangeEvent(type);
} else {
RemoteConnectionChangeEvent event = new RemoteConnectionChangeEvent(this, type);
@ -273,7 +273,7 @@ public class RemoteConnectionWorkingCopy implements IRemoteConnectionWorkingCopy
public IRemoteConnection save() throws RemoteConnectionException {
if (newName != null && original != null) {
// rename, delete the old one
original.fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_RENAMED);
fireConnectionChangeEvent(RemoteConnectionChangeEvent.CONNECTION_RENAMED);
connectionType.removeConnection(original.getName());
original.rename(newName);
}