1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

[286230] [dnd] Dropping resources on host nodes leads to classcast exception

This commit is contained in:
David McKnight 2009-08-18 17:57:22 +00:00
parent 2ea1118c8a
commit dc8a850d37

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
* Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -35,6 +35,7 @@
* David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
* David McKnight (IBM) - [226324] Default user ID from preferences not inherited
* David McKnight (IBM) - [196166] [usability][dnd] Changing the sort order of hosts in the SystemView should work by drag & drop
* David McKnight (IBM) - [286230] [dnd] Dropping resources on host nodes leads to classcast exception
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -701,25 +702,28 @@ public class SystemViewConnectionAdapter
public Object doDrop(Object from, Object to, boolean sameSystemType,
boolean sameSystem, int srcType, IProgressMonitor monitor) {
IHost srcHost = (IHost)from;
IHost tgtHost = (IHost)to;
if (srcHost != null && tgtHost != null && srcHost != tgtHost){
ISystemProfile profile = tgtHost.getSystemProfile();
ISystemHostPool pool = tgtHost.getHostPool();
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
int tgtPosition = pool.getHostPosition(tgtHost);
int srcPosition = pool.getHostPosition(srcHost);
int delta = tgtPosition - srcPosition;
IHost[] conns = new IHost[1];
conns[0] = srcHost;
sr.moveHosts(profile.getName(),conns,delta);
}
return srcHost;
if (from instanceof IHost){
IHost srcHost = (IHost)from;
IHost tgtHost = (IHost)to;
if (srcHost != null && tgtHost != null && srcHost != tgtHost){
ISystemProfile profile = tgtHost.getSystemProfile();
ISystemHostPool pool = tgtHost.getHostPool();
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
int tgtPosition = pool.getHostPosition(tgtHost);
int srcPosition = pool.getHostPosition(srcHost);
int delta = tgtPosition - srcPosition;
IHost[] conns = new IHost[1];
conns[0] = srcHost;
sr.moveHosts(profile.getName(),conns,delta);
}
return srcHost;
}
return null;
}
/**