Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > subclipse commit: rev 77 - trunk/subclipse/ui/src/org/tigris/subversion/subclipse/ui/pending

subclipse
Discussion topic

Back to topic list

subclipse commit: rev 77 - trunk/subclipse/ui/src/org/tigris/subversion/subclipse/ui/pending

Author cchab
Full name chabanois cédric
Date 2003-07-22 12:45:09 PDT
Message Author: cchab
Date: Tue Jul 22 14:45:08 2003
New Revision: 77

Added:
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/pe​nding/PendingDropAda​pter.java
Modified:
   trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/pe​nding/PendingOperati​onsView.java
Log:
added drag and drop for pending operations view

Added: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/pe​nding/PendingDropAda​pter.java
====================​====================​====================​==================
--- (empty file)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/pe​nding/PendingDropAda​pter.java Tue Jul 22 14:45:08 2003
@@ -0,0 +1,75 @@
+/******************​********************​********************​********************​*
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.o​rg/legal/cpl-v10.htm​l
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Cédric Chabanois (cchabanois at ifrance dot com) - modified for Subversion
+ ********************​********************​********************​*******************/​
+package org.tigris.subversio​n.subclipse.ui.pendi​ng;
+
+
+import org.eclipse.core.res​ources.IContainer;
+import org.eclipse.core.res​ources.IResource;
+import org.eclipse.jface.vi​ewers.StructuredView​er;
+import org.eclipse.jface.vi​ewers.ViewerDropAdap​ter;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.​DropTargetEvent;
+import org.eclipse.swt.dnd.​TransferData;
+import org.eclipse.ui.part.​ResourceTransfer;
+import org.tigris.subversio​n.subclipse.core.SVN​Exception;
+
+/**
+ * Used to perform a drop of a file to HistoryView
+ */
+public class PendingDropAdapter extends ViewerDropAdapter {
+ PendingOperationsView view;
+
+ public PendingDropAdapter(S​tructuredViewer viewer, PendingOperationsView view) {
+ super(viewer);
+ this.view = view;
+ }
+ /*
+ * Override dragOver to slam the detail to DROP_LINK, as we do not
+ * want to really execute a DROP_MOVE, although we want to respond
+ * to it.
+ */
+ public void dragOver(DropTargetEvent event) {
+ if ((event.operations & DND.DROP_LINK) == DND.DROP_LINK) {
+ event.detail = DND.DROP_LINK;
+ }
+ super.dragOver(event);
+ }
+ /*
+ * Override drop to slam the detail to DROP_LINK, as we do not
+ * want to really execute a DROP_MOVE, although we want to respond
+ * to it.
+ */
+ public void drop(DropTargetEvent event) {
+ super.drop(event);
+ event.detail = DND.DROP_LINK;
+ }
+ public boolean performDrop(Object data) {
+ if (data == null) return false;
+ IResource[] sources = (IResource[])data;
+ if (sources.length == 0) return false;
+ IResource resource = sources[0];
+ if (!(resource instanceof IContainer)) return false;
+ try {
+ view.showPending((IC​ontainer)resource);
+ } catch (SVNException e) {
+ return false;
+ }
+ return true;
+ }
+ public boolean validateDrop(Object target, int operation, TransferData transferType) {
+ if (transferType != null && ResourceTransfer.get​Instance().isSupport​edType(transferType)​) {
+ return true;
+ }
+ return false;
+ }
+}
+

Modified: trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/pe​nding/PendingOperati​onsView.java
====================​====================​====================​==================
--- trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/pe​nding/PendingOperati​onsView.java (original)
+++ trunk/subclipse/ui/s​rc/org/tigris/subver​sion/subclipse/ui/pe​nding/PendingOperati​onsView.java Tue Jul 22 14:45:08 2003
@@ -37,6 +37,8 @@
 import org.eclipse.jface.vi​ewers.TableViewer;
 import org.eclipse.jface.vi​ewers.Viewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layo​ut.GridData;
 import org.eclipse.swt.widg​ets.Composite;
@@ -46,6 +48,7 @@
 import org.eclipse.swt.widg​ets.TableColumn;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IWork​benchActionConstants​;
+import org.eclipse.ui.part.​ResourceTransfer;
 import org.eclipse.ui.part.ViewPart;
 import org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener;
 import org.tigris.subversio​n.subclipse.core.ISV​NLocalResource;
@@ -299,6 +302,8 @@
         tableViewer.setConte​ntProvider(new EditorsContentProvider());
         tableViewer.setLabel​Provider(new EditorsLabelProvider());
         contributeActions();
+
+ initDragAndDrop();
     }
 
     /**
@@ -373,6 +378,15 @@
         // set F1 help
 // WorkbenchHelp.setHel​p(tableViewer.getCon​trol(), IHelpContextIds.CVS_​EDITORS_VIEW);
     }
+
+ /**
+ * Adds drag and drop support to the pending operations view.
+ */
+ void initDragAndDrop() {
+ int ops = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] {ResourceTransfer.ge​tInstance()};
+ tableViewer.addDropSupport(ops, transfers, new PendingDropAdapter(tableViewer, this));
+ }
     
     public void setInput(Status[] status) {
         tableViewer.setInput(status);

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@subc​lipse.tigris.org
For additional commands, e-mail: cvs-help at subclipse dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

subclipse commit: rev 77 - trunk/subclipse/ui/src/org/tigris/subversion/subclipse/ui/pending cchab chabanois cédric 2003-07-22 12:45:09 PDT
Messages per page: