|
|
@ -209,7 +209,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean needUpdate0(Connection origin, Connection connection) { |
|
|
|
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) { |
|
|
|
private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) { |
|
|
|
|
|
|
|
final int remaining = ConnectionConfig.getInstance().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
return Configurations.modify(new WorkerFacade(ConnectionConfig.class) { |
|
|
|
return Configurations.modify(new WorkerFacade(ConnectionConfig.class) { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
removedConnNames.forEach(n -> ConnectionConfig.getInstance().removeConnection(n)); |
|
|
|
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) { |
|
|
|
} catch (Exception e) { |
|
|
|