Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9afcaab3d851afbf06a1f99ca8bc5ffab3e672ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2003, 2006 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
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.j2ee.navigator.internal.dnd;

import org.eclipse.swt.dnd.TransferData;
import org.eclipse.ui.navigator.CommonDropAdapter;
import org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant;

/**
 * @author mdelder
 *  
 */
public class AddExternalUtilityJarDropAction extends ResourceDropAdapterAssistant {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.workbench.navigator.dnd.ResourceDropAction#validateDrop(org.eclipse.wst.common.navigator.internal.views.navigator.dnd.CommonNavigatorDropAdapter,
	 *      java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
	 */
	public boolean validateDrop(CommonDropAdapter dropAdapter, Object target, int operation, TransferData transferType) {
		//TODO redo with components
//		if (FileTransfer.getInstance().isSupportedType(transferType)) {
//			IProject project = (IProject) AdaptabilityUtility.getAdapter(target, IProject.class);
//			try {
//				if (project.hasNature(IEARNatureConstants.NATURE_ID)) {
//					String[] sourceNames = (String[]) FileTransfer.getInstance().nativeToJava(transferType);
//					if (sourceNames == null)
//						return true;
//
//					boolean result = true;
//					for (int i = 0; i < sourceNames.length; i++)
//						if (!(result = sourceNames[0].endsWith(".jar")))break; //$NON-NLS-1$
//					return result;
//				}
//				return false;
//			} catch (CoreException e) {
//				return false;
//			}
//		}
		return false;
	}
}

Back to the top