Transfer[] types = new Transfer[] { FileTransfer.getInstance()}; treeViewer.addDropSupport(operations, types, new SiteDropListener(projectName ,document, treeViewer));
Transfer[] types = new Transfer[] { FileTransfer.getInstance() };  treeViewer.addDropSupport(operations, types, new DropTargetListener() {  public void dragEnter(DropTargetEvent event) {   }  public void dragLeave(DropTargetEvent event) {   }  public void dragOperationChanged(DropTargetEvent event) {   }  public void dragOver(DropTargetEvent event) {   }   public void drop(DropTargetEvent event) { if (event.data instanceof String[]) { String[] files = (String[]) event.data; File strFilename; String filePath = null; String relativePath = null; for (int i = 0; i < files.length; i++) { strFilename = new File(files[i]); filePath = strFilename.getPath(); Node insertionElement = (Element) event.item.getData(); Element element = document.createElement("NewElement"); relativePath = filePath.substring(xDocPath.length()); element.setAttribute("href", relativePath); element.setAttribute("description", relativePath); element.setAttribute("label", relativePath); insertionElement.appendChild(element); treeViewer.refresh(); } } }  public void dropAccept(DropTargetEvent event) {   }  });
	public void createPartControl(Composite parent) {		treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);		getSite().setSelectionProvider(treeViewer);		int operations = DND.DROP_COPY | DND.DROP_MOVE;		Transfer[] types = new Transfer[] { FileTransfer.getInstance()};		treeViewer.addDropSupport(operations, types, new SiteDropListener(projectName ,document, treeViewer));		treeViewer.setContentProvider(new ITreeContentProvider() {			public Object[] getChildren(Object element) {				ArrayList ch = new ArrayList();				NodeList nl = ((Node) element).getChildNodes();				for (int i = 0; i < nl.getLength(); i++)					if (nl.item(i).getNodeType() == Node.ELEMENT_NODE)						ch.add(nl.item(i));				return ch.toArray();			}			public Object getParent(Object element) {				return ((Node) element).getParentNode();			}			public Object[] getElements(Object element) {				return getChildren(element);			}			public boolean hasChildren(Object element) {				return getChildren(element).length > 0;			}			public void dispose() {			}			public void inputChanged(Viewer viewer, Object old_input,					Object new_input) {			}		});		treeViewer.setLabelProvider(new LabelProvider() {			public String getText(Object element) {				if (element instanceof Attr)					return "@" + ((Attr) element).getNodeName() + " " +((Attr) element).getNodeValue();				else					return ((Node) element).getNodeName();			}		});		getViewSite().getPage().addSelectionListener(this);						treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {				public void selectionChanged(SelectionChangedEvent event) {					if (event.getSelection() instanceof IStructuredSelection) {					IStructuredSelection selection = (IStructuredSelection) event							.getSelection();					treeSelection = selection;				}			}		});			//System.out.println(document.toString());		treeViewer.setInput(document);		makeActions();		hookContextMenu();	}