|
Lines 29-36
Link Here
|
| 29 |
|
29 |
|
| 30 |
import org.eclipse.jface.viewers.ISelection; |
30 |
import org.eclipse.jface.viewers.ISelection; |
| 31 |
import org.eclipse.jface.viewers.IStructuredSelection; |
31 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
|
32 |
import org.eclipse.jface.window.Window; |
| 32 |
|
33 |
|
| 33 |
import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; |
34 |
import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; |
|
|
35 |
import org.eclipse.ui.ide.dialogs.ImportTypeDialog; |
| 34 |
import org.eclipse.ui.navigator.CommonDropAdapter; |
36 |
import org.eclipse.ui.navigator.CommonDropAdapter; |
| 35 |
import org.eclipse.ui.navigator.CommonDropAdapterAssistant; |
37 |
import org.eclipse.ui.navigator.CommonDropAdapterAssistant; |
| 36 |
import org.eclipse.ui.views.navigator.LocalSelectionTransfer; |
38 |
import org.eclipse.ui.views.navigator.LocalSelectionTransfer; |
|
Lines 91-98
Link Here
|
| 91 |
return Status.CANCEL_STATUS; |
93 |
return Status.CANCEL_STATUS; |
| 92 |
|
94 |
|
| 93 |
getShell().forceActive(); |
95 |
getShell().forceActive(); |
|
|
96 |
CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell()); |
| 94 |
final Object data= FileTransfer.getInstance().nativeToJava(dropAdapter.getCurrentTransfer()); |
97 |
final Object data= FileTransfer.getInstance().nativeToJava(dropAdapter.getCurrentTransfer()); |
| 95 |
new CopyFilesAndFoldersOperation(getShell()).copyFiles((String[]) data, targetContainer); |
98 |
String[] names= (String[]) data; |
|
|
99 |
// if the target is a group and all sources are files, then |
| 100 |
// automatically create links |
| 101 |
int type; |
| 102 |
ImportTypeDialog dialog = new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), names, targetContainer); |
| 103 |
dialog.setResource(targetContainer); |
| 104 |
if (dialog.open() == Window.OK) |
| 105 |
type = dialog.getSelection(); |
| 106 |
else |
| 107 |
type = ImportTypeDialog.IMPORT_NONE; |
| 108 |
switch (type) { |
| 109 |
case ImportTypeDialog.IMPORT_COPY: |
| 110 |
operation.copyFiles(names, targetContainer); |
| 111 |
break; |
| 112 |
case ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS: |
| 113 |
if (dialog.getVariable() != null) |
| 114 |
operation.setRelativeVariable(dialog.getVariable()); |
| 115 |
operation.createGroupAndLinks(names, targetContainer); |
| 116 |
break; |
| 117 |
case ImportTypeDialog.IMPORT_LINK: |
| 118 |
if (dialog.getVariable() != null) |
| 119 |
operation.setRelativeVariable(dialog.getVariable()); |
| 120 |
operation.linkFiles(names, targetContainer); |
| 121 |
break; |
| 122 |
case ImportTypeDialog.IMPORT_NONE: |
| 123 |
break; |
| 124 |
} |
| 96 |
} catch (JavaModelException e) { |
125 |
} catch (JavaModelException e) { |
| 97 |
String title = PackagesMessages.DropAdapter_errorTitle; |
126 |
String title = PackagesMessages.DropAdapter_errorTitle; |
| 98 |
String message = PackagesMessages.DropAdapter_errorMessage; |
127 |
String message = PackagesMessages.DropAdapter_errorMessage; |