From b82a765a3f134921475dec5f269a72e397458209 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Thu, 20 Aug 2009 09:37:29 +0000 Subject: [PATCH] Bug 286922 - DND of a folder onto a file will cause exception --- .../navigator/CNavigatorDropAdapterAssistant.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java index dfcf096d363..4d590c33d42 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorDropAdapterAssistant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2009 Wind River Systems, Inc. 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 @@ -84,7 +84,7 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant { if (target instanceof ICContainer || target instanceof ICProject || target instanceof IContainer || - (event.detail == DND.DROP_COPY && ( + (dropAdapter.getCurrentOperation() == DND.DROP_COPY && ( target instanceof IFile || target instanceof ITranslationUnit))) { @@ -246,6 +246,11 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant { return Status.CANCEL_STATUS; if (target instanceof ISourceReference) { + for (ICElement cElement : cElements) { + if (cElement.getElementType() <= ICElement.C_UNIT) { + return Status.CANCEL_STATUS; + } + } return Status.OK_STATUS; } @@ -269,6 +274,11 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant { return Status.CANCEL_STATUS; } if (target instanceof ISourceReference) { + for (ICElement cElement : cElements) { + if (cElement.getElementType() <= ICElement.C_UNIT) { + return Status.CANCEL_STATUS; + } + } return Status.OK_STATUS; }