~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/SelectionTransferDragAdapter.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2002, 2008 QNX Software Systems and others.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 * QNX Software Systems - Initial API and implementation
 
10
 *******************************************************************************/
 
11
 
 
12
package org.eclipse.cdt.internal.ui.cview;
 
13
 
 
14
import java.util.Iterator;
 
15
 
 
16
import org.eclipse.jface.viewers.ISelection;
 
17
import org.eclipse.jface.viewers.ISelectionProvider;
 
18
import org.eclipse.jface.viewers.IStructuredSelection;
 
19
 
 
20
import org.eclipse.cdt.core.model.ICElement;
 
21
import org.eclipse.cdt.core.model.ISourceReference;
 
22
 
 
23
import org.eclipse.cdt.internal.ui.dnd.BasicSelectionTransferDragAdapter;
 
24
 
 
25
public class SelectionTransferDragAdapter extends BasicSelectionTransferDragAdapter {
 
26
        
 
27
        public SelectionTransferDragAdapter(ISelectionProvider provider) {
 
28
                super(provider);
 
29
        }
 
30
        
 
31
        @Override
 
32
        protected boolean isDragable(ISelection selection) {
 
33
                if (selection instanceof IStructuredSelection) {
 
34
                        for (Iterator<?> iter= ((IStructuredSelection)selection).iterator(); iter.hasNext();) {
 
35
                                Object element= iter.next();
 
36
                                if (element instanceof ICElement) {
 
37
                                        if (!(element instanceof ISourceReference)) {
 
38
                                                return  false;
 
39
                                        }
 
40
                                }
 
41
                        }
 
42
                        return true;
 
43
                }
 
44
                return false;
 
45
        }
 
46
}