1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.packageview;
13 import java.util.Iterator;
15 import net.sourceforge.phpdt.core.IJavaElement;
16 import net.sourceforge.phpdt.core.IPackageFragmentRoot;
18 import net.sourceforge.phpdt.internal.ui.dnd.BasicSelectionTransferDragAdapter;
19 import org.eclipse.jface.viewers.ISelection;
20 import org.eclipse.jface.viewers.ISelectionProvider;
21 import org.eclipse.jface.viewers.IStructuredSelection;
23 public class SelectionTransferDragAdapter extends BasicSelectionTransferDragAdapter {
25 public SelectionTransferDragAdapter(ISelectionProvider provider) {
29 protected boolean isDragable(ISelection selection) {
30 if (selection instanceof IStructuredSelection) {
31 for (Iterator iter= ((IStructuredSelection)selection).iterator(); iter.hasNext();) {
32 Object element= iter.next();
33 if (element instanceof IJavaElement) {
34 IPackageFragmentRoot root= (IPackageFragmentRoot)((IJavaElement)element).getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
35 if (root != null && root.isArchive())