671 |
671 |
672 public boolean reconnect(IConnection2 connection) { |
672 public boolean reconnect(IConnection2 connection) { |
673 if (!connection.isDynamic()) |
673 if (!connection.isDynamic()) |
674 return false; |
674 return false; |
675 |
675 |
|
676 if (!connectionToConnectedServices.containsKey(connection)) // connection does not exist |
|
677 return false; |
|
678 |
676 // if not removed, transition out of disconnected state |
679 // if not removed, transition out of disconnected state |
677 // return not removed |
680 // return not removed |
678 IConnectionStatusChangedListener listener = connectionListenerMap.remove(connection); |
681 IConnectionStatusChangedListener listener = connectionListenerMap.remove(connection); |
679 if (listener != null) |
682 if (listener != null) { // is disconnected |
680 connection.removeStatusChangedListener(listener); |
683 connection.removeStatusChangedListener(listener); |
681 if (connectionToConnectedServices.containsKey(connection)) { |
684 if (connectionToConnectedServices.containsKey(connection)) { |
682 IConnectionStatus status; |
685 IConnectionStatus status; |
683 if (ConnectionUIUtils.isSomeServiceInUse(connection)) { |
686 if (ConnectionUIUtils.isSomeServiceInUse(connection)) { |
684 status = new ConnectionStatus(EConnectionStatus.IN_USE, |
687 status = new ConnectionStatus(EConnectionStatus.IN_USE, |
685 Messages.getString("ConnectionsView.InUseLabel"), //$NON-NLS-1$ |
688 Messages.getString("ConnectionsView.InUseLabel"), //$NON-NLS-1$ |
686 Messages.getString("ConnectionsView.InUseDesc")); //$NON-NLS-1$ |
689 Messages.getString("ConnectionsView.InUseDesc")); //$NON-NLS-1$ |
687 } |
690 } |
688 else { |
691 else { |
689 status = new ConnectionStatus(EConnectionStatus.NOT_READY, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ |
692 status = new ConnectionStatus(EConnectionStatus.NOT_READY, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ |
690 } |
693 } |
691 connection.setStatus(status); |
694 connection.setStatus(status); |
|
695 return true; |
|
696 } |
|
697 } |
|
698 else // connection is not disconnected |
692 return true; |
699 return true; |
693 } |
700 |
694 return false; |
701 return false; |
695 } |
702 } |
696 } |
703 } |