Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-02-22 09:39:13 +0000
committerWilliam Chen2012-02-22 09:40:10 +0000
commit57adb617750c286abc4432ea03009cf2eb543fb3 (patch)
tree5c6a54b428ff219afca63bf9c27441c42655ee3e
parent9c5cc6335f7d4adf4d3240887e9745e9af127784 (diff)
downloadorg.eclipse.tcf-57adb617750c286abc4432ea03009cf2eb543fb3.tar.gz
org.eclipse.tcf-57adb617750c286abc4432ea03009cf2eb543fb3.tar.xz
org.eclipse.tcf-57adb617750c286abc4432ea03009cf2eb543fb3.zip
Target Explorer: [372084][TCF][File System] Allow DnD from external
programs.
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/plugin.xml3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/CommonDnD.java297
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragAdapterAssistant.java39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragSourceListener.java39
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropAdapterAssistant.java123
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropTargetListener.java95
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/operations/FSUpload.java91
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLStreamHandlerService.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/CacheManager.java84
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.java4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.properties4
11 files changed, 575 insertions, 257 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/plugin.xml
index cdc256e2e..76af503d9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/plugin.xml
@@ -1782,6 +1782,9 @@
</operations>
<transferTypes>
<transferType name ="LocalSelectionTransfer" />
+ <transferType
+ name="FileTransfer">
+ </transferType>
</transferTypes>
</dropSupport>
</viewer>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/CommonDnD.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/CommonDnD.java
new file mode 100644
index 000000000..3423271af
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/CommonDnD.java
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.internal.dnd;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSCopy;
+import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSMove;
+import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSOperation;
+import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSRefresh;
+import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSUpload;
+import org.eclipse.tcf.te.tcf.filesystem.model.FSModel;
+import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.nls.Messages;
+import org.eclipse.ui.PlatformUI;
+/**
+ * Common DnD operations shared by File Explorer and Target Explorer.
+ */
+public class CommonDnD {
+
+ /**
+ * If the current selection is draggable.
+ *
+ * @param selection The currently selected nodes.
+ * @return true if it is draggable.
+ */
+ public boolean isDraggable(IStructuredSelection selection) {
+ if (selection.isEmpty()) {
+ return false;
+ }
+ Object[] objects = selection.toArray();
+ for (Object object : objects) {
+ if (!isDraggableObject(object)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * If the specified object is a draggable element.
+ *
+ * @param object The object to be dragged.
+ * @return true if it is draggable.
+ */
+ private boolean isDraggableObject(Object object) {
+ if (object instanceof FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) object;
+ return !node.isRoot() && (node.isWindowsNode() && !node.isReadOnly() || !node.isWindowsNode() && node.isWritable());
+ }
+ return false;
+ }
+
+ /**
+ * Perform the drop operation over dragged files to the specified target folder.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param files The files being dropped.
+ * @param operations the current dnd operations.
+ * @param target the target folder the files to be dropped to.
+ * @return true if the dropping is successful.
+ */
+ public boolean dropFiles(TreeViewer viewer, String[] files, int operations, FSTreeNode target) {
+ FSOperation operation = null;
+ if ((operations & DND.DROP_MOVE) != 0) {
+ String question;
+ if (files.length == 1) {
+ question = NLS.bind(Messages.FSDropTargetListener_MovingWarningSingle, files[0]);
+ }
+ else {
+ question = NLS.bind(Messages.FSDropTargetListener_MovingWarningMultiple, Integer.valueOf(files.length));
+ }
+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ if (MessageDialog.openQuestion(parent, Messages.FSDropTargetListener_ConfirmMoveTitle, question)) {
+ operation = new FSUpload(files, target, getMoveCallback(viewer, files, target));
+ }
+ }
+ else if ((operations & DND.DROP_COPY) != 0) {
+ operation = new FSUpload(files, target, getCopyCallback(viewer, files, target));
+ }
+ if (operation != null) {
+ IStatus status = operation.doit();
+ return status != null && status.isOK();
+ }
+ return false;
+ }
+
+ /**
+ * Get the callback that refresh and select the files being dragged when the dragging gesture is
+ * copying.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param files The files being dragged.
+ * @param target The target folder to drag the files to.
+ * @return callback that handles refreshing and selection.
+ */
+ private ICallback getCopyCallback(final TreeViewer viewer, final String[] files, final FSTreeNode target) {
+ return new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ FSRefresh refresh = new FSRefresh(target, getSelectionCallback(viewer, files, target));
+ refresh.doit();
+ }
+ };
+ }
+
+ /**
+ * Get the callback that delete the dragged source files, refresh and select the files being
+ * dragged when the dragging gesture is moving.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param files The files being dragged.
+ * @param target The target folder to drag the files to.
+ * @return callback that handles deletion, refreshing and selection.
+ */
+ private ICallback getMoveCallback(final TreeViewer viewer, final String[] files, final FSTreeNode target) {
+ return new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (status != null && status.isOK()) {
+ for (String path : files) {
+ File file = new File(path);
+ file.delete();
+ }
+ }
+ FSTreeNode root = FSModel.getFSModel(target.peerNode).getRoot();
+ FSRefresh refresh = new FSRefresh(root, getSelectionCallback(viewer, files, target));
+ refresh.doit();
+ }
+ };
+ }
+
+ /**
+ * Get the callback that refresh the files being dragged after moving or copying.
+ *
+ * @param viewer the tree viewer to be refreshed after dragging.
+ * @param paths The paths of the files being dragged.
+ * @param target The target folder to drag the files to.
+ * @return callback that handles refreshing and selection.
+ */
+ ICallback getSelectionCallback(final TreeViewer viewer, final String[] paths, final FSTreeNode target) {
+ return new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ List<FSTreeNode> nodes = new ArrayList<FSTreeNode>();
+ List<FSTreeNode> children = target.unsafeGetChildren();
+ for (String path : paths) {
+ File file = new File(path);
+ String name = file.getName();
+ for (FSTreeNode child : children) {
+ if (name.equals(child.name)) {
+ nodes.add(child);
+ break;
+ }
+ }
+ }
+ Assert.isNotNull(Display.getCurrent());
+ if (viewer != null) {
+ viewer.refresh(target);
+ IStructuredSelection selection = new StructuredSelection(nodes.toArray());
+ viewer.setSelection(selection, true);
+ }
+ }
+ };
+ }
+
+ /**
+ * Perform the drop operation over dragged selection.
+ *
+ * @param aTarget the target Object to be moved to.
+ * @param operations the current dnd operations.
+ * @param selection The local selection being dropped.
+ * @return true if the dropping is successful.
+ */
+ public boolean dropLocalSelection(FSTreeNode target, int operations, IStructuredSelection selection) {
+ List<FSTreeNode> nodes = selection.toList();
+ FSOperation operation = null;
+ if ((operations & DND.DROP_MOVE) != 0) {
+ operation = new FSMove(nodes, target);
+ }
+ else if ((operations & DND.DROP_COPY) != 0) {
+ FSTreeNode dest = getCopyDestination(target, nodes);
+ operation = new FSCopy(nodes, dest);
+ }
+ if (operation != null) {
+ IStatus status = operation.doit();
+ return status != null && status.isOK();
+ }
+ return false;
+ }
+
+ /**
+ * Return an appropriate destination directory for copying according to the specified hovered
+ * node. If the hovered node is a file, then return its parent directory. If the hovered node is
+ * a directory, then return its self if it is not a node being copied. Return its parent
+ * directory if it is a node being copied.
+ *
+ * @param hovered
+ * @param nodes
+ * @return
+ */
+ private FSTreeNode getCopyDestination(FSTreeNode hovered, List<FSTreeNode> nodes) {
+ if (hovered.isFile()) {
+ return hovered.parent;
+ }
+ else if (hovered.isDirectory()) {
+ for (FSTreeNode node : nodes) {
+ if (node == hovered) {
+ return hovered.parent;
+ }
+ }
+ }
+ return hovered;
+ }
+
+ /**
+ * Validate dropping when the elements being dragged are files.
+ *
+ * @param target The target object.
+ * @param operation The DnD operation.
+ * @param transferType The transfered data type.
+ * @return true if it is valid for dropping.
+ */
+ public boolean validateFilesDrop(Object target, int operation, TransferData transferType) {
+ FileTransfer transfer = FileTransfer.getInstance();
+ String[] elements = (String[]) transfer.nativeToJava(transferType);
+ if (elements.length > 0) {
+ boolean moving = (operation & DND.DROP_MOVE) != 0;
+ boolean copying = (operation & DND.DROP_COPY) != 0;
+ FSTreeNode hovered = (FSTreeNode) target;
+ if (hovered.isFile() && copying) {
+ hovered = hovered.parent;
+ }
+ return hovered.isDirectory() && hovered.isWritable() && (moving || copying);
+ }
+ return false;
+ }
+
+ /**
+ * Validate dropping when the elements being dragged are local selection.
+ *
+ * @param target The target object.
+ * @param operation The DnD operation.
+ * @param transferType The transfered data type.
+ * @return true if it is valid for dropping.
+ */
+ public boolean validateLocalSelectionDrop(Object target, int operation, TransferData transferType) {
+ FSTreeNode hovered = (FSTreeNode) target;
+ LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
+ IStructuredSelection selection = (IStructuredSelection) transfer.getSelection();
+ List<FSTreeNode> nodes = selection.toList();
+ boolean moving = (operation & DND.DROP_MOVE) != 0;
+ boolean copying = (operation & DND.DROP_COPY) != 0;
+ if (hovered.isDirectory() && hovered.isWritable() && (moving || copying)) {
+ FSTreeNode head = nodes.get(0);
+ String hid = head.peerNode.getPeerId();
+ String tid = hovered.peerNode.getPeerId();
+ if (hid.equals(tid)) {
+ for (FSTreeNode node : nodes) {
+ if (moving && node == hovered || node.isAncestorOf(hovered)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ else if (hovered.isFile() && copying) {
+ hovered = hovered.parent;
+ return validateLocalSelectionDrop(hovered, operation, transferType);
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragAdapterAssistant.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragAdapterAssistant.java
index b49810965..1b9d7dd18 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragAdapterAssistant.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragAdapterAssistant.java
@@ -13,18 +13,20 @@ import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
import org.eclipse.ui.navigator.CommonDragAdapterAssistant;
/**
* The drag assistant used by Target Explorer to extend its DnD support to FSTreeNode elements.
*/
public class FSDragAdapterAssistant extends CommonDragAdapterAssistant {
+ // The common dnd operation
+ CommonDnD dnd;
/**
* Create an instance.
*/
public FSDragAdapterAssistant() {
+ dnd = new CommonDnD();
}
/*
@@ -33,7 +35,7 @@ public class FSDragAdapterAssistant extends CommonDragAdapterAssistant {
*/
@Override
public void dragStart(DragSourceEvent anEvent, IStructuredSelection aSelection) {
- anEvent.doit = isDraggable(aSelection);
+ anEvent.doit = dnd.isDraggable(aSelection);
LocalSelectionTransfer.getTransfer().setSelection(aSelection);
}
@@ -54,37 +56,4 @@ public class FSDragAdapterAssistant extends CommonDragAdapterAssistant {
public boolean setDragData(DragSourceEvent anEvent, IStructuredSelection aSelection) {
return false;
}
-
- /**
- * If the current selection is draggable.
- *
- * @param selection The currently selected nodes.
- * @return true if it is draggable.
- */
- private boolean isDraggable(IStructuredSelection selection) {
- if (selection.isEmpty()) {
- return false;
- }
- Object[] objects = selection.toArray();
- for (Object object : objects) {
- if (!isDraggableObject(object)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * If the specified object is a draggable element.
- *
- * @param object The object to be dragged.
- * @return true if it is draggable.
- */
- private boolean isDraggableObject(Object object) {
- if (object instanceof FSTreeNode) {
- FSTreeNode node = (FSTreeNode) object;
- return !node.isRoot() && (node.isWindowsNode() && !node.isReadOnly() || !node.isWindowsNode() && node.isWritable());
- }
- return false;
- }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragSourceListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragSourceListener.java
index 3a6a6d578..15b469d63 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragSourceListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDragSourceListener.java
@@ -14,7 +14,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
/**
* The drag source listener for the file tree of Target Explorer.
@@ -22,6 +21,8 @@ import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
public class FSDragSourceListener implements DragSourceListener {
// The tree viewer in which the DnD gesture happens.
private TreeViewer viewer;
+ // The common dnd operation
+ CommonDnD dnd;
/**
* Create an FSDragSourceListener using the specified tree viewer.
@@ -30,6 +31,7 @@ public class FSDragSourceListener implements DragSourceListener {
*/
public FSDragSourceListener(TreeViewer viewer) {
this.viewer = viewer;
+ dnd = new CommonDnD();
}
/*
@@ -39,7 +41,7 @@ public class FSDragSourceListener implements DragSourceListener {
@Override
public void dragStart(DragSourceEvent event) {
IStructuredSelection aSelection = (IStructuredSelection) viewer.getSelection();
- event.doit = isDraggable(aSelection);
+ event.doit = dnd.isDraggable(aSelection);
LocalSelectionTransfer.getTransfer().setSelection(aSelection);
}
@@ -61,37 +63,4 @@ public class FSDragSourceListener implements DragSourceListener {
@Override
public void dragFinished(DragSourceEvent event) {
}
-
- /**
- * If the current selection is draggable.
- *
- * @param selection The currently selected nodes.
- * @return true if it is draggable.
- */
- private boolean isDraggable(IStructuredSelection selection) {
- if (selection.isEmpty()) {
- return false;
- }
- Object[] objects = selection.toArray();
- for (Object object : objects) {
- if (!isDraggableObject(object)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * If the specified object is a draggable element.
- *
- * @param object The object to be dragged.
- * @return true if it is draggable.
- */
- private boolean isDraggableObject(Object object) {
- if (object instanceof FSTreeNode) {
- FSTreeNode node = (FSTreeNode) object;
- return !node.isRoot() && (node.isWindowsNode() && !node.isReadOnly() || !node.isWindowsNode() && node.isWritable());
- }
- return false;
- }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropAdapterAssistant.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropAdapterAssistant.java
index 47a97378c..7d5d03825 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropAdapterAssistant.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropAdapterAssistant.java
@@ -9,30 +9,37 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.internal.dnd;
-import java.util.List;
-
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.DND;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSCopy;
-import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSMove;
-import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSOperation;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
+import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonDropAdapter;
import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
+import org.eclipse.ui.navigator.CommonNavigator;
/**
* The drop assistant used by Target Explorer to extend its DnD support to FSTreeNode elements.
*/
public class FSDropAdapterAssistant extends CommonDropAdapterAssistant {
+ // The common dnd operation
+ CommonDnD dnd;
+
/**
* Create an instance.
*/
public FSDropAdapterAssistant() {
+ dnd = new CommonDnD();
}
/*
@@ -41,33 +48,28 @@ public class FSDropAdapterAssistant extends CommonDropAdapterAssistant {
*/
@Override
public IStatus validateDrop(Object target, int operation, TransferData transferType) {
- LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
- if (transfer.isSupportedType(transferType) && target instanceof FSTreeNode) {
- FSTreeNode hovered = (FSTreeNode) target;
- IStructuredSelection selection = (IStructuredSelection) transfer.getSelection();
- List<FSTreeNode> nodes = selection.toList();
- boolean moving = (operation & DND.DROP_MOVE) != 0;
- boolean copying = (operation & DND.DROP_COPY) != 0;
- if (hovered.isDirectory() && hovered.isWritable() && (moving || copying)) {
- FSTreeNode head = nodes.get(0);
- String hid = head.peerNode.getPeerId();
- String tid = hovered.peerNode.getPeerId();
- if (hid.equals(tid)) {
- for (FSTreeNode node : nodes) {
- if (moving && node == hovered || node.isAncestorOf(hovered)) {
- return Status.CANCEL_STATUS;
- }
- }
- return Status.OK_STATUS;
- }
+ boolean valid = false;
+ if (target instanceof FSTreeNode) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ valid = dnd.validateLocalSelectionDrop(target, operation, transferType);
}
- else if (hovered.isFile() && copying) {
- hovered = hovered.parent;
- return validateDrop(hovered, operation, transferType);
+ else if(FileTransfer.getInstance().isSupportedType(transferType)) {
+ valid = dnd.validateFilesDrop(target, operation, transferType);
}
}
- return Status.CANCEL_STATUS;
- }
+ return valid ? Status.OK_STATUS : Status.CANCEL_STATUS;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#isSupportedType(org.eclipse.swt.dnd.TransferData)
+ */
+ @Override
+ public boolean isSupportedType(TransferData aTransferType) {
+ if(FileTransfer.getInstance().isSupportedType(aTransferType))
+ return true;
+ return super.isSupportedType(aTransferType);
+ }
/*
* (non-Javadoc)
@@ -75,44 +77,39 @@ public class FSDropAdapterAssistant extends CommonDropAdapterAssistant {
*/
@Override
public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) {
- Object data = aDropTargetEvent.data;
- int operations = aDropAdapter.getCurrentOperation();
- IStructuredSelection selection = (IStructuredSelection) data;
- List<FSTreeNode> nodes = selection.toList();
- FSOperation operation = null;
- if ((operations & DND.DROP_MOVE) != 0) {
- FSTreeNode dest = (FSTreeNode) aTarget;
- operation = new FSMove(nodes, dest);
+ boolean sucess = false;
+ TransferData transferType = aDropTargetEvent.currentDataType;
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ IStructuredSelection selection = (IStructuredSelection) aDropTargetEvent.data;
+ int operations = aDropAdapter.getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) aTarget;
+ sucess = dnd.dropLocalSelection(target, operations, selection);
}
- else if ((operations & DND.DROP_COPY) != 0) {
- FSTreeNode hovered = (FSTreeNode) aTarget;
- FSTreeNode dest = getCopyDestination(hovered, nodes);
- operation = new FSCopy(nodes, dest);
+ else if(FileTransfer.getInstance().isSupportedType(transferType)) {
+ String[] files = (String[]) aDropTargetEvent.data;
+ int operations = aDropAdapter.getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) aTarget;
+ sucess = dnd.dropFiles(getCommonViewer(), files, operations, target);
}
- return operation != null ? operation.doit() : Status.CANCEL_STATUS;
+ return sucess ? Status.OK_STATUS : Status.CANCEL_STATUS;
}
-
+
/**
- * Return an appropriate destination directory for copying according to
- * the specified hovered node. If the hovered node is a file, then return
- * its parent directory. If the hovered node is a directory, then return its
- * self if it is not a node being copied. Return its parent directory if it is
- * a node being copied.
- * @param hovered
- * @param nodes
- * @return
+ * Get the tree viewer of Target Explorer view.
+ *
+ * @return The tree viewer of Target Explorer view or null if the view is not found.
*/
- private FSTreeNode getCopyDestination(FSTreeNode hovered, List<FSTreeNode> nodes) {
- if (hovered.isFile()) {
- return hovered.parent;
- }
- else if (hovered.isDirectory()) {
- for (FSTreeNode node : nodes) {
- if (node == hovered) {
- return hovered.parent;
- }
+ private TreeViewer getCommonViewer() {
+ Assert.isNotNull(Display.getCurrent());
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ Assert.isNotNull(window);
+ IViewReference[] references = window.getActivePage().getViewReferences();
+ for(IViewReference reference : references) {
+ if(reference.getId().equals(IUIConstants.ID_EXPLORER)) {
+ CommonNavigator navigator = (CommonNavigator) reference.getPart(true);
+ return navigator.getCommonViewer();
}
}
- return hovered;
- }
+ return null;
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropTargetListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropTargetListener.java
index 65e1638ea..5bd700fe0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropTargetListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/dnd/FSDropTargetListener.java
@@ -9,24 +9,22 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.internal.dnd;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSCopy;
-import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSMove;
-import org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSOperation;
import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
/**
* The drop target listener for the file tree of Target Explorer.
*/
public class FSDropTargetListener extends ViewerDropAdapter {
+ // The tree viewer that the drop listener attached to.
+ TreeViewer viewer;
+ // The common dnd operation
+ CommonDnD dnd;
/**
* Create FSDropTargetListener using the viewer.
*
@@ -34,6 +32,8 @@ public class FSDropTargetListener extends ViewerDropAdapter {
*/
public FSDropTargetListener(TreeViewer viewer) {
super(viewer);
+ this.viewer = viewer;
+ dnd = new CommonDnD();
}
/*
@@ -42,29 +42,12 @@ public class FSDropTargetListener extends ViewerDropAdapter {
*/
@Override
public boolean validateDrop(Object target, int operation, TransferData transferType) {
- LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
- if (transfer.isSupportedType(transferType) && target instanceof FSTreeNode) {
- FSTreeNode hovered = (FSTreeNode) target;
- IStructuredSelection selection = (IStructuredSelection) transfer.getSelection();
- List<FSTreeNode> nodes = selection.toList();
- boolean moving = (operation & DND.DROP_MOVE) != 0;
- boolean copying = (operation & DND.DROP_COPY) != 0;
- if (hovered.isDirectory() && hovered.isWritable() && (moving || copying)) {
- FSTreeNode head = nodes.get(0);
- String hid = head.peerNode.getPeerId();
- String tid = hovered.peerNode.getPeerId();
- if (hid.equals(tid)) {
- for (FSTreeNode node : nodes) {
- if (moving && node == hovered || node.isAncestorOf(hovered)) {
- return false;
- }
- }
- return true;
- }
+ if (target instanceof FSTreeNode) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ return dnd.validateLocalSelectionDrop(target, operation, transferType);
}
- else if (hovered.isFile() && copying) {
- hovered = hovered.parent;
- return validateDrop(hovered, operation, transferType);
+ else if (FileTransfer.getInstance().isSupportedType(transferType)) {
+ return dnd.validateFilesDrop(target, operation, transferType);
}
}
return false;
@@ -76,48 +59,20 @@ public class FSDropTargetListener extends ViewerDropAdapter {
*/
@Override
public boolean performDrop(Object data) {
- Object aTarget = getCurrentTarget();
- int operations = getCurrentOperation();
- IStructuredSelection selection = (IStructuredSelection) data;
- List<FSTreeNode> nodes = selection.toList();
- FSOperation operation = null;
- if ((operations & DND.DROP_MOVE) != 0) {
- FSTreeNode dest = (FSTreeNode) aTarget;
- operation = new FSMove(nodes, dest);
- }
- else if ((operations & DND.DROP_COPY) != 0) {
- FSTreeNode hovered = (FSTreeNode) aTarget;
- FSTreeNode dest = getCopyDestination(hovered, nodes);
- operation = new FSCopy(nodes, dest);
- }
- if(operation != null) {
- IStatus status = operation.doit();
- return status != null && status.isOK();
- }
- return false;
- }
-
- /**
- * Return an appropriate destination directory for copying according to
- * the specified hovered node. If the hovered node is a file, then return
- * its parent directory. If the hovered node is a directory, then return its
- * self if it is not a node being copied. Return its parent directory if it is
- * a node being copied.
- * @param hovered
- * @param nodes
- * @return
- */
- private FSTreeNode getCopyDestination(FSTreeNode hovered, List<FSTreeNode> nodes) {
- if (hovered.isFile()) {
- return hovered.parent;
+ boolean success = false;
+ TransferData transferType = getCurrentEvent().currentDataType;
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
+ IStructuredSelection selection = (IStructuredSelection) data;
+ int operations = getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) getCurrentTarget();
+ success = dnd.dropLocalSelection(target, operations, selection);
}
- else if (hovered.isDirectory()) {
- for (FSTreeNode node : nodes) {
- if (node == hovered) {
- return hovered.parent;
- }
- }
+ else if(FileTransfer.getInstance().isSupportedType(transferType)) {
+ String[] files = (String[]) data;
+ int operations = getCurrentOperation();
+ FSTreeNode target = (FSTreeNode) getCurrentTarget();
+ success = dnd.dropFiles(viewer, files, operations, target);
}
- return hovered;
+ return success;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/operations/FSUpload.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/operations/FSUpload.java
new file mode 100644
index 000000000..76963e6a9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/operations/FSUpload.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.internal.operations;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.tcf.filesystem.internal.utils.CacheManager;
+import org.eclipse.tcf.te.tcf.filesystem.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.nls.Messages;
+
+/**
+ * Upload multiple files from local system to a remote system.
+ */
+public class FSUpload extends FSUIOperation {
+ // The source files to be uploaded.
+ String[] sourceFiles;
+ // The target folder to which these files are moved to.
+ FSTreeNode targetFolder;
+ // The callback invoked after uploading.
+ ICallback callback;
+
+ /**
+ * Create an instance with specified files, target folder and a callback.
+ *
+ * @param sourceFiles the source files being uploaded.
+ * @param targetFolder the target folder to upload the files to.
+ * @param callback the callback that is invoked after uploading.
+ */
+ public FSUpload(String[] sourceFiles, FSTreeNode targetFolder, ICallback callback) {
+ super(Messages.FSUpload_UploadTitle);
+ this.sourceFiles = sourceFiles;
+ this.targetFolder = targetFolder;
+ this.callback = callback;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSOperation#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ String message;
+ if(sourceFiles.length==1)
+ message = NLS.bind(Messages.CacheManager_UploadSingleFile, sourceFiles[0]);
+ else
+ message = NLS.bind(Messages.CacheManager_UploadNFiles, Long.valueOf(sourceFiles.length));
+ monitor.beginTask(message, 100);
+ File[] files = new File[sourceFiles.length];
+ URL[] urls = new URL[sourceFiles.length];
+ URL folderURL = targetFolder.getLocationURL();
+ for (int i=0;i<files.length;i++) {
+ files[i] = new File(sourceFiles[i]);
+ urls[i] = new URL(folderURL, files[i].getName());
+ }
+ CacheManager.getInstance().uploadFiles(monitor, files, urls);
+ if (monitor.isCanceled())
+ throw new InterruptedException();
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.filesystem.internal.operations.FSUIOperation#doit()
+ */
+ @Override
+ public IStatus doit() {
+ IStatus status = super.doit();
+ if(callback != null) {
+ callback.done(this, status);
+ }
+ return status;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLStreamHandlerService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLStreamHandlerService.java
index 571b2d42a..a238a666c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLStreamHandlerService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/url/TcfURLStreamHandlerService.java
@@ -39,32 +39,41 @@ public class TcfURLStreamHandlerService extends AbstractURLStreamHandlerService
*/
@Override
protected void parseURL(URL u, String spec, int start, int limit) {
- IllegalArgumentException errorFormat = new IllegalArgumentException(Messages.TcfURLStreamHandlerService_ErrorURLFormat);
- int end = spec.indexOf("/", start); //$NON-NLS-1$
- if (end == -1) throw errorFormat;
- start = end + 1;
- end = spec.indexOf("/", start); //$NON-NLS-1$
- if (end == -1) throw errorFormat;
- String peerId = spec.substring(start, end);
- if (peerId.trim().length() == 0) throw errorFormat;
- start = end + 1;
- String path = spec.substring(start);
- if (path.length() > 0) {
- if (path.matches(WINPATH_PATTERN)) {
- String pathext = path.substring(2); // Cut the path after ':'.
- if(pathext.length() == 0)
- throw new IllegalArgumentException(Messages.TcfURLStreamHandlerService_OnlyDiskPartError);
- pathext = pathext.substring(1); // Cut the path after the disk part.
- checkWinPath(pathext);
- }
- else {
- path = "/" + path; //$NON-NLS-1$
+ if (u.getPath() != null) {
+ String path = u.getPath();
+ if (!path.endsWith("/")) { //$NON-NLS-1$
+ path += "/"; //$NON-NLS-1$
}
+ path += spec;
+ setURL(u, u.getProtocol(), u.getHost(), u.getPort(), u.getAuthority(), u.getUserInfo(), path, u.getQuery(), u.getRef());
}
else {
- path = "/"; //$NON-NLS-1$
+ IllegalArgumentException errorFormat = new IllegalArgumentException(Messages.TcfURLStreamHandlerService_ErrorURLFormat);
+ int end = spec.indexOf("/", start); //$NON-NLS-1$
+ if (end == -1) throw errorFormat;
+ start = end + 1;
+ end = spec.indexOf("/", start); //$NON-NLS-1$
+ if (end == -1) throw errorFormat;
+ String peerId = spec.substring(start, end);
+ if (peerId.trim().length() == 0) throw errorFormat;
+ start = end + 1;
+ String path = spec.substring(start);
+ if (path.length() > 0) {
+ if (path.matches(WINPATH_PATTERN)) {
+ String pathext = path.substring(2); // Cut the path after ':'.
+ if (pathext.length() == 0) throw new IllegalArgumentException(Messages.TcfURLStreamHandlerService_OnlyDiskPartError);
+ pathext = pathext.substring(1); // Cut the path after the disk part.
+ checkWinPath(pathext);
+ }
+ else {
+ path = "/" + path; //$NON-NLS-1$
+ }
+ }
+ else {
+ path = "/"; //$NON-NLS-1$
+ }
+ setURL(u, TcfURLConnection.PROTOCOL_SCHEMA, peerId, -1, null, null, path, null, null);
}
- setURL(u, TcfURLConnection.PROTOCOL_SCHEMA, peerId, -1, null, null, path, null, null);
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/CacheManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/CacheManager.java
index a909a0737..419f0e6b0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/CacheManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/internal/utils/CacheManager.java
@@ -286,8 +286,8 @@ public class CacheManager {
else
message = NLS.bind(Messages.CacheManager_UploadNFiles, Long.valueOf(nodes.length));
monitor.beginTask(message, 100);
- boolean canceled = uploadFiles(monitor, sync, nodes);
- if (canceled)
+ uploadFiles(monitor, sync, nodes);
+ if (monitor.isCanceled())
throw new InterruptedException();
} catch (Exception e) {
throw new InvocationTargetException(e);
@@ -301,8 +301,7 @@ public class CacheManager {
dialog.run(true, true, runnable);
return true;
} catch (InvocationTargetException e) {
- // Something's gone wrong. Roll back the downloading and display the
- // error.
+ // Something's gone wrong. Roll back the downloading and display the error.
displayError(parent, e);
} catch (InterruptedException e) {
// It is canceled. Just roll back the downloading result.
@@ -334,19 +333,60 @@ public class CacheManager {
* The local files to be uploaded.
* @param monitor
* The monitor used to report the progress.
- * @return true if it is canceled or else false.
* @throws Exception
* an Exception thrown during downloading and storing data.
*/
- public boolean uploadFiles(IProgressMonitor monitor, final boolean sync, final FSTreeNode[] nodes) throws IOException {
+ void uploadFiles(IProgressMonitor monitor, final boolean sync, final FSTreeNode[] nodes) throws IOException {
+ File[] files = new File[nodes.length];
+ URL[] urls = new URL[nodes.length];
+ for (int i = 0; i < nodes.length; i++) {
+ files[i] = getCacheFile(nodes[i]);
+ urls[i] = nodes[i].getLocationURL();
+ }
+ try {
+ // Upload the files to the remote location by the specified URLs.
+ uploadFiles(monitor, files, urls);
+ }
+ finally {
+ // Once upload is successful, synchronize the modified time.
+ for (int i = 0; i < nodes.length; i++) {
+ final FSTreeNode node = nodes[i];
+ SafeRunner.run(new SafeRunnable() {
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+
+ @Override
+ public void run() throws Exception {
+ PersistenceManager.getInstance().setBaseTimestamp(node.getLocationURL(), node.attr.mtime);
+ if (sync) {
+ File file = getCacheFile(node);
+ file.setLastModified(node.attr.mtime);
+ }
+ StateManager.getInstance().refreshState(node);
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Upload the specified files using the monitor to report the progress.
+ *
+ * @param files The local file objects.
+ * @param urls The remote file's URL location.
+ * @param monitor The monitor used to report the progress.
+ * @throws Exception an Exception thrown during downloading and storing data.
+ */
+ public void uploadFiles(IProgressMonitor monitor, File[] files, URL[] urls) throws IOException {
BufferedInputStream input = null;
BufferedOutputStream output = null;
// The buffer used to download the file.
byte[] data = new byte[DEFAULT_CHUNK_SIZE];
// Calculate the total size.
long totalSize = 0;
- for (FSTreeNode node : nodes) {
- File file = getCachePath(node).toFile();
+ for (File file:files) {
totalSize += file.length();
}
// Calculate the chunk size of one percent.
@@ -355,10 +395,10 @@ public class CacheManager {
int percentRead = 0;
// The current length of read bytes.
long bytesRead = 0;
- for (int i = 0; i < nodes.length && !monitor.isCanceled(); i++) {
- File file = getCachePath(nodes[i]).toFile();
+ for (int i = 0; i < files.length && !monitor.isCanceled(); i++) {
+ File file = files[i];
try {
- URL url = nodes[i].getLocationURL();
+ URL url = urls[i];
TcfURLConnection connection = (TcfURLConnection) url.openConnection();
connection.setDoInput(false);
connection.setDoOutput(true);
@@ -395,28 +435,8 @@ public class CacheManager {
} catch (Exception e) {
}
}
- if(!monitor.isCanceled()){
- // Once upload is successful, synchronize the modified time.
- final FSTreeNode node = nodes[i];
- SafeRunner.run(new SafeRunnable() {
- @Override
- public void handleException(Throwable e) {
- // Ignore exception
- }
- @Override
- public void run() throws Exception {
- PersistenceManager.getInstance().setBaseTimestamp(node.getLocationURL(), node.attr.mtime);
- if(sync) {
- File file = getCacheFile(node);
- file.setLastModified(node.attr.mtime);
- }
- StateManager.getInstance().refreshState(node);
- }
- });
- }
}
}
- return monitor.isCanceled();
}
/**
@@ -483,7 +503,7 @@ public class CacheManager {
* The file size to be displayed.
* @return The string representation of the size.
*/
- private String formatSize(long size) {
+ private static String formatSize(long size) {
double kbSize = size / 1024.0;
if (kbSize < 1.0) {
return SIZE_FORMAT.format(size) + Messages.CacheManager_Bytes;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.java
index ca6c2b24a..912f21a2f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.java
@@ -210,6 +210,9 @@ public class Messages extends NLS {
public static String FSDelete_DeleteFileFolderTitle;
+ public static String FSDropTargetListener_ConfirmMoveTitle;
+ public static String FSDropTargetListener_MovingWarningMultiple;
+ public static String FSDropTargetListener_MovingWarningSingle;
public static String FSRename_CannotRename;
public static String FSRename_JobTitle;
public static String FSRename_RenameFileFolderTitle;
@@ -249,6 +252,7 @@ public class Messages extends NLS {
public static String FSRenamingAssistant_SpecifyNonEmptyName;
public static String FSRenamingAssistant_UnixIllegalCharacters;
public static String FSRenamingAssistant_WinIllegalCharacters;
+ public static String FSUpload_UploadTitle;
public static String SaveAllListener_Cancel;
public static String SaveAllListener_Merge;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.properties
index 10d9ffe82..7fc78eba4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem/src/org/eclipse/tcf/te/tcf/filesystem/nls/Messages.properties
@@ -143,6 +143,9 @@ FSCopy_CopyFileFolderTitle=Error Copying File or Folder
FSMove_MoveFileFolderTitle=Error Moving File or Folder
FSRename_RenameFileFolderTitle=Error Renaming File or Folder
FSDelete_DeleteFileFolderTitle=Error Deleting File or Folder
+FSDropTargetListener_ConfirmMoveTitle=Confirm Move
+FSDropTargetListener_MovingWarningMultiple=This operation will delete the files after moving. You can copy them without deletion by ctrl + dragging. \n\nAre you sure you want to move these {0} files/folders?
+FSDropTargetListener_MovingWarningSingle=This operation will delete the file after moving. You can copy it without deletion by ctrl + dragging. \n\nAre you sure you want to move {0}?
FSCopy_Copying=Copying {0} ...
FSCopy_CopyingFile=Copying files
FSMove_MovingFile=Moving files
@@ -244,6 +247,7 @@ UserManager_UserAccountTitle=User Account
FSOperation_CannotOpenDir=Cannot open directory {0} because {1}
FSOperation_CannotReadDir=Cannot read directory {0} because {1}
FSOperation_TimedOutWhenOpening=it has timed out when opening the directory\!
+FSUpload_UploadTitle=Upload Files
MergeEditorInput_CompareLeftAndRight=Compare {0} and {1}
MergeEditorInput_CompareWithLocalCache=Compare {0} with Local Cache
MergeEditorInput_LocalFile=Local: {0}

Back to the top