### Eclipse Workspace Patch 1.0
#P org.eclipse.rse.core
Index: src/org/eclipse/rse/internal/core/model/SystemHostPool.java
===================================================================
RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemHostPool.java,v
retrieving revision 1.2
diff -u -r1.2 SystemHostPool.java
--- src/org/eclipse/rse/internal/core/model/SystemHostPool.java 24 May 2007 14:56:09 -0000 1.2
+++ src/org/eclipse/rse/internal/core/model/SystemHostPool.java 14 Sep 2007 20:56:39 -0000
@@ -406,68 +406,56 @@
}
/**
- * Move existing connections a given number of positions in the same pool.
- * If the delta is negative, they are all moved up by the given amount. If
- * positive, they are all moved down by the given amount.
- *
- * - After the move, the pool containing the moved connection is saved to disk.
- *
- The connection's alias name must be unique in pool.
- *
- * TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?
- * @param conns Array of SystemConnections to move.
- * @param delta the amount by which to move the connections
- */
- public void moveHosts(IHost conns[], int delta)
- {
- int[] oldPositions = new int[conns.length];
- for (int idx=0; idx 0) // moving down, process backwards
- for (int idx=conns.length-1; idx>=0; idx--)
- moveConnection(conns[idx], oldPositions[idx]+delta);
- else
- for (int idx=0; idx
+ * After the move, the pool containing the moved host is committed.
+ * @param conns an Array of hosts to move.
+ * @param delta the amount by which to move the hosts
+ */
+ public void moveHosts(IHost conns[], int delta) {
+ for (int idx = 0; idx < conns.length; idx++) {
+ moveConnection(conns[idx], delta);
+ }
+ commit();
+ }
/**
- * Move one connection to a new location
- * TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?
- */
- private void moveConnection(IHost conn, int newPos)
- {
- /*
- * DWD revisit, make sure that connections can be "moved", whatever that means.
- * It appears that connections can be moved up and down in the list which
- * probably provides for some rational for keeping this around.
- */
-// java.util.List connList = getHostList();
- //FIXME connList.move(newPos, conn);
- invalidateCache();
- }
+ * Move a host to a new location in the host pool.
+ * @param host the host to move. If not present then the list is not altered.
+ * @param newPos the amount by which to move the host. If outside the bounds of the list, the list is not altered.
+ * If 0 then the list is not altered.
+ */
+ private void moveConnection(IHost host, int delta) {
+ if (host == null) return;
+ List hostList = getHostList();
+ int oldPos = hostList.indexOf(host);
+ if (oldPos < 0) return;
+ if (delta == 0) return;
+ int newPos = oldPos + delta;
+ if (newPos < 0) return;
+ if (newPos > hostList.size()) return;
+ hostList.remove(oldPos);
+ hostList.add(newPos, host);
+ invalidateCache();
+ }
- /**
- * Order connections according to user preferences.
- * Called after restore.
- */
- public void orderHosts(String[] names)
- {
- java.util.List connList = getHostList();
- IHost[] conns = new IHost[names.length];
- for (int idx=0; idx