1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

[196582] fix ClassCastException when doing copy/paste

This commit is contained in:
Xuan Chen 2007-08-09 03:46:28 +00:00
parent 97ab7c9494
commit 6ff91851ea
4 changed files with 27 additions and 14 deletions

View file

@ -13,12 +13,13 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Kevin Doyle (IBM) - [188637] Handle the caught exception in DeleteJob.run when file fails to be deleted * Kevin Doyle (IBM) - [188637] Handle the caught exception in DeleteJob.run when file fails to be deleted
* Kevin Doyle (IBM) - [196582] ClassCastException when doing copy/paste with Remote Search view open
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.actions; package org.eclipse.rse.internal.ui.actions;
import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -110,8 +111,8 @@ public class SystemCommonDeleteAction
public IStatus run(IProgressMonitor monitor) public IStatus run(IProgressMonitor monitor)
{ {
boolean ok = true; boolean ok = true;
List localDeletedObjects = new ArrayList(); List localDeletedObjects = new Vector();
List remoteDeletedObjects = new ArrayList(); List remoteDeletedObjects = new Vector();
// local delete is pretty straight-forward // local delete is pretty straight-forward
for (int l = 0; l < _localResources.size() && ok; l++) for (int l = 0; l < _localResources.size() && ok; l++)
@ -190,7 +191,7 @@ public class SystemCommonDeleteAction
setProcessAllSelections(true); setProcessAllSelections(true);
setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE); setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
setHelp(RSEUIPlugin.HELPPREFIX+"actn0021"); //$NON-NLS-1$ setHelp(RSEUIPlugin.HELPPREFIX+"actn0021"); //$NON-NLS-1$
_setList = new ArrayList(); _setList = new Vector();
} }
/** /**
@ -280,7 +281,7 @@ public class SystemCommonDeleteAction
if (selection instanceof IStructuredSelection) if (selection instanceof IStructuredSelection)
{ {
// keep track of the current set // keep track of the current set
List localSet = new ArrayList(); List localSet = new Vector();
// divide up all objects to delete // divide up all objects to delete
IStructuredSelection ssel = (IStructuredSelection)selection; IStructuredSelection ssel = (IStructuredSelection)selection;

View file

@ -1428,8 +1428,8 @@ public class SystemTableTreeView
} }
/** /**
* Returns the implementation of ISystemRemoteElement for the given * Returns the implementation of ISystemRemoteElementAdapter for the given
* object. Returns null if this object does not adaptable to this. * object. Returns null if this object is not adaptable to this.
*/ */
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
{ {
@ -1445,7 +1445,10 @@ public class SystemTableTreeView
/** /**
* Returns the implementation of IRemoteObjectIdentifier for the given * Returns the implementation of IRemoteObjectIdentifier for the given
* object. Returns null if this object does not adaptable to this. * object. Returns null if this object is not adaptable to this.
*
* @deprecated should use getViewAdapter(Object) as IRemoteObjectIdentifier
* is not defined in the adapter factories
*/ */
protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o) protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o)
{ {

View file

@ -38,6 +38,7 @@
* Tobias Schwarz (Wind River) - [197484] Provide ContextObject for queries on all levels * Tobias Schwarz (Wind River) - [197484] Provide ContextObject for queries on all levels
* David McKnight (IBM) - [196662] Avoid main thread query to check exists when remote refreshing * David McKnight (IBM) - [196662] Avoid main thread query to check exists when remote refreshing
* Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children * Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
* Kevin Doyle (IBM) - [196582] Depreciated getRemoteObjectIdentifier
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
@ -1349,14 +1350,21 @@ public class SystemView extends SafeTreeViewer
} }
} }
/**
* Returns the implementation of IRemoteObjectIdentifier for the given
* object. Returns null if this object is not adaptable to this.
*
* @deprecated should use getViewAdapter(Object) as IRemoteObjectIdentifier
* is not defined in the adapter factories
*/
protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o) protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o)
{ {
return (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class); return (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class);
} }
/** /**
* Returns the implementation of IRemoteObjectIdentifier for the given * Returns the implementation of ISystemRemoteElementAdapter for the given
* object. Returns null if this object does not adaptable to this. * object. Returns null if this object is not adaptable to this.
*/ */
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o) protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
{ {

View file

@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Kevin Doyle (IBM) - [177587] Made MonitorViewPart a SelectionProvider * Kevin Doyle (IBM) - [177587] Made MonitorViewPart a SelectionProvider
* Kevin Doyle (IBM) - [160378] Subset action should be disabled when there are no tabs in Monitor * Kevin Doyle (IBM) - [160378] Subset action should be disabled when there are no tabs in Monitor
* Kevin Doyle (IBM) - [196582] ClassCastException when doing copy/paste
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view.monitor; package org.eclipse.rse.internal.ui.view.monitor;
@ -926,11 +927,11 @@ class SubSetAction extends BrowseAction
int eventType = event.getEventType(); int eventType = event.getEventType();
Object remoteResource = event.getResource(); Object remoteResource = event.getResource();
Vector remoteResourceNames = null; java.util.List remoteResourceNames = null;
if (remoteResource instanceof Vector) if (remoteResource instanceof java.util.List)
{ {
remoteResourceNames = (Vector) remoteResource; remoteResourceNames = (java.util.List) remoteResource;
remoteResource = remoteResourceNames.elementAt(0); remoteResource = remoteResourceNames.get(0);
} }
Object child = event.getResource(); Object child = event.getResource();