|
|
|
@ -209,7 +209,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private boolean needUpdate0(Connection origin, Connection connection) { |
|
|
|
|
return !connection.equals(origin) || !isEmbedConnection(connection); |
|
|
|
|
return !connection.equals(origin) || !isEmbedConnection(connection); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -257,12 +257,21 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) { |
|
|
|
|
final int remaining = ConnectionConfig.getInstance().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size()); |
|
|
|
|
try { |
|
|
|
|
return Configurations.modify(new WorkerFacade(ConnectionConfig.class) { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
removedConnNames.forEach(n -> ConnectionConfig.getInstance().removeConnection(n)); |
|
|
|
|
addedOrUpdatedConnections.forEach(cb -> ConnectionConfig.getInstance().addConnection(cb.getName(), cb.getConnection())); |
|
|
|
|
int innerRemaining = remaining; |
|
|
|
|
for (ConnectionBean cb : addedOrUpdatedConnections) { |
|
|
|
|
if (innerRemaining > 0) { |
|
|
|
|
ConnectionConfig.getInstance().addConnectionWithoutCheck(cb.getName(), cb.getConnection()); |
|
|
|
|
innerRemaining--; |
|
|
|
|
} else { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|