Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 78477 Details for
Bug 176577
wrong enablement of "Move up/down" in connection context menu
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
fix for move up/down in host pool
patch-176557.txt (text/plain), 4.75 KB, created by
David Dykstal
on 2007-09-14 16:59:40 EDT
(
hide
)
Description:
fix for move up/down in host pool
Filename:
MIME Type:
Creator:
David Dykstal
Created:
2007-09-14 16:59:40 EDT
Size:
4.75 KB
patch
obsolete
>### 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.<p> >- * <ul> >- * <li>After the move, the pool containing the moved connection is saved to disk. >- * <li>The connection's alias name must be unique in pool. >- * </ul> >- * <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b> >- * @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<conns.length; idx++) >- oldPositions[idx] = getHostPosition(conns[idx]); >- if (delta > 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<conns.length; idx++) >- moveConnection(conns[idx], oldPositions[idx]+delta); >- >- commit(); >- } >+ * Move existing hosts a given number of positions in the same pool. >+ * If the delta is negative, they are all moved up (left) by the given amount. If >+ * positive, they are all moved down (right) by the given amount.<p> >+ * 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 >- * <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b> >- */ >- 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<conns.length; idx++) >- conns[idx] = getHost(names[idx]); >- connList.clear(); >- //System.out.println("Ordering connections within pool " + getName() + "..."); >- for (int idx=0; idx<conns.length; idx++) >- { >- connList.add(conns[idx]); >- //System.out.println(" '"+conns[idx].getAliasName()+"'"); >- } >- //System.out.println(); >- invalidateCache(); >- } >+ /** >+ * Order connections according to user preferences. >+ * Called after restore. >+ */ >+ public void orderHosts(String[] names) { >+ List connList = getHostList(); >+ IHost[] conns = new IHost[names.length]; >+ for (int idx = 0; idx < conns.length; idx++) { >+ conns[idx] = getHost(names[idx]); >+ } >+ connList.clear(); >+ for (int idx = 0; idx < conns.length; idx++) { >+ connList.add(conns[idx]); >+ } >+ invalidateCache(); >+ } > > /** > * Return the unqualified save file name with the extension .xmi
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 176577
:
78477