Bug 196166 - [usability][dnd] Changing the sort order of hosts in the SystemView should work by drag & drop
Summary: [usability][dnd] Changing the sort order of hosts in the SystemView should wo...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.1 M6   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2007-07-11 10:47 EDT by Martin Oberhuber CLA
Modified: 2009-02-03 11:55 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-07-11 10:47:27 EDT
Changing the sort order of hosts in the SystemView is awkward just using the contextmenu / up / down actions. It should be possible to use drag&drop for that -- when dragging a host, user feedback would already indicate that dropping the host between two other hosts were possible, but it does not work.

-----------Enter bugs above this line-----------
TM 2.0
installation : eclipse-SDK-3.3 (I20070625-1500), cdt-4.0.0, emf-2.3.0
RSE install  : workspace HEAD
java.runtime : Sun 1.6.0_01-b06
os.name:     : Windows XP 5.1, Service Pack 1
------------------------------------------------
systemtype   : Windows-local, Dstore-win, Dstore-linux
targetos     : Red Hat Enterprise Linux WS release 4 (Nahant Update 3)
targetuname  : Linux parser 2.6.9-34.EL #1 i686 athlon i386 GNU/Linux
targetvm     : Sun Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
------------------------------------------------
Comment 1 David McKnight CLA 2008-10-06 16:14:36 EDT
I've put a fix in for this in cvs.
Comment 2 Kevin Doyle CLA 2008-10-06 20:58:08 EDT
Sometimes when trying to move a host to the end of the list doesn't work.  In this case I had a second profile and a single host in that profile.  I was trying to move Local to the end of that profile's connection list.

Also is there a way to disable trying to drag a connection into a different profile connection area then it's from?  Trying to take Local to the bottom of the Remote Systems view doesn't work, but doesn't give any visual cue that it isn't suppose to work.
Comment 3 Martin Oberhuber CLA 2008-10-07 04:35:26 EDT
I think that the sort order in the Remote Systems View is independent of the profile that a host is from. Dragging a host should never change its profile association. 

I'm not sure if profile associations can even be changed, but if they can, then only in the Profiles View.
Comment 4 David McKnight CLA 2008-10-07 10:36:11 EDT
(In reply to comment #2)
> Sometimes when trying to move a host to the end of the list doesn't work.  In
> this case I had a second profile and a single host in that profile.  I was
> trying to move Local to the end of that profile's connection list.
> 

> 

The move api for the system registry is as follows:

/**
	 * Move existing connections a given number of positions in the same profile.
	 * 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 name must be unique in pool.
	 * <li>Fires a single ISystemResourceChangeEvent event of type EVENT_MOVE, if the pool is the private pool.
	 * </ul>
	 * @param conns Array of SystemConnections to move.
	 * @param delta new zero-based position for the connection
	 */
	public void moveHosts(String profileName, IHost conns[], int delta);

The position of a given IHost is relative to it's owning profile.  In the tree, I believe we display all connections of one profile followed by all connections of the next profile, etc.  Note also that the "Move Up" and "Move Down" actions for connections only apply within their own profiles.

> Also is there a way to disable trying to drag a connection into a different
> profile connection area then it's from?  Trying to take Local to the bottom of
> the Remote Systems view doesn't work, but doesn't give any visual cue that it
> isn't suppose to work.

The way we enable/disable drag and drop is based on the canDrop() adaptor method.  Unfortunately the method doesn't have enough information, without the source, to determine whether this is valid or not - only the target.  Instead of disabling a drop, we have to wait until the ISystemDragDropAdapter.validateDrop() call which occurs after the drop.  In the past, we considered doing this kind of validation of target AND source from ViewerDropAdapter.validateDrop() but it's potentially very expensive and the drop framework doesn't provide the source to this method either.  One improvement we could make to what we've got now is to display a message when our ISystemDragDropAdapter.validateDrop() fails.




Comment 5 Martin Oberhuber CLA 2008-10-07 10:41:54 EDT
How very ugly. The sort order of hosts should be a property of the View, and not a property of the Profile.
Comment 6 David McKnight CLA 2008-10-07 10:59:01 EDT
(In reply to comment #5)
> How very ugly. The sort order of hosts should be a property of the View, and
> not a property of the Profile.
> 

Agreed that there ought to be better model-view separation. I'm not sure what the implications of redesigning this infrastructure are as I'm not all that familiar with this profile code.  Dave D, can you see any use-case for sorting this stuff physically (i.e. within the profile) other than the effect it has on views?

Comment 7 David McKnight CLA 2009-02-03 11:55:24 EST
I'm going to mark this as fixed since the enhancement is in place now within confines of the current framework.  We should open a separate defect if we want to separate the profile order from the view order.