Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 160049 Details for
Bug 301187
[package explorer] support new drag and drop import dialog when dragging from OS shell
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for handling file system drop
patch.txt (text/plain), 5.24 KB, created by
Serge Beauchamp
on 2010-02-24 06:37:08 EST
(
hide
)
Description:
Patch for handling file system drop
Filename:
MIME Type:
Creator:
Serge Beauchamp
Created:
2010-02-24 06:37:08 EST
Size:
5.24 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/navigator/JavaDropAdapterAssistant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/navigator/JavaDropAdapterAssistant.java,v >retrieving revision 1.12 >diff -u -r1.12 JavaDropAdapterAssistant.java >--- ui/org/eclipse/jdt/internal/ui/navigator/JavaDropAdapterAssistant.java 2 Mar 2009 15:41:56 -0000 1.12 >+++ ui/org/eclipse/jdt/internal/ui/navigator/JavaDropAdapterAssistant.java 24 Feb 2010 11:24:54 -0000 >@@ -29,8 +29,10 @@ > > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.window.Window; > > import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; >+import org.eclipse.ui.ide.dialogs.ImportTypeDialog; > import org.eclipse.ui.navigator.CommonDropAdapter; > import org.eclipse.ui.navigator.CommonDropAdapterAssistant; > import org.eclipse.ui.views.navigator.LocalSelectionTransfer; >@@ -91,8 +93,35 @@ > return Status.CANCEL_STATUS; > > getShell().forceActive(); >+ CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell()); > final Object data= FileTransfer.getInstance().nativeToJava(dropAdapter.getCurrentTransfer()); >- new CopyFilesAndFoldersOperation(getShell()).copyFiles((String[]) data, targetContainer); >+ String[] names= (String[]) data; >+ // if the target is a group and all sources are files, then >+ // automatically create links >+ int type; >+ ImportTypeDialog dialog = new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), names, targetContainer); >+ dialog.setResource(targetContainer); >+ if (dialog.open() == Window.OK) >+ type = dialog.getSelection(); >+ else >+ type = ImportTypeDialog.IMPORT_NONE; >+ switch (type) { >+ case ImportTypeDialog.IMPORT_COPY: >+ operation.copyFiles(names, targetContainer); >+ break; >+ case ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS: >+ if (dialog.getVariable() != null) >+ operation.setRelativeVariable(dialog.getVariable()); >+ operation.createGroupAndLinks(names, targetContainer); >+ break; >+ case ImportTypeDialog.IMPORT_LINK: >+ if (dialog.getVariable() != null) >+ operation.setRelativeVariable(dialog.getVariable()); >+ operation.linkFiles(names, targetContainer); >+ break; >+ case ImportTypeDialog.IMPORT_NONE: >+ break; >+ } > } catch (JavaModelException e) { > String title = PackagesMessages.DropAdapter_errorTitle; > String message = PackagesMessages.DropAdapter_errorMessage; >Index: ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java,v >retrieving revision 1.38 >diff -u -r1.38 FileTransferDropAdapter.java >--- ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java 22 Apr 2009 12:53:24 -0000 1.38 >+++ ui/org/eclipse/jdt/internal/ui/packageview/FileTransferDropAdapter.java 24 Feb 2010 11:24:54 -0000 >@@ -23,8 +23,10 @@ > > import org.eclipse.jface.util.TransferDropTargetListener; > import org.eclipse.jface.viewers.StructuredViewer; >+import org.eclipse.jface.window.Window; > > import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; >+import org.eclipse.ui.ide.dialogs.ImportTypeDialog; > > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IJavaProject; >@@ -109,7 +111,7 @@ > */ > public boolean performDrop(final Object data) { > try { >- int operation= getCurrentOperation(); >+ final int operation= getCurrentOperation(); > > if (data == null || !(data instanceof String[]) || operation != DND.DROP_COPY) > return false; >@@ -124,7 +126,34 @@ > Display.getCurrent().asyncExec(new Runnable() { > public void run() { > getShell().forceActive(); >- new CopyFilesAndFoldersOperation(getShell()).copyFiles((String[]) data, target); >+ CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation(getShell()); >+ String[] names= (String[]) data; >+ // if the target is a group and all sources are files, then >+ // automatically create links >+ int type; >+ ImportTypeDialog dialog = new ImportTypeDialog(getShell(), operation, names, target); >+ dialog.setResource(target); >+ if (dialog.open() == Window.OK) >+ type = dialog.getSelection(); >+ else >+ type = ImportTypeDialog.IMPORT_NONE; >+ switch (type) { >+ case ImportTypeDialog.IMPORT_COPY: >+ copyOperation.copyFiles(names, target); >+ break; >+ case ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS: >+ if (dialog.getVariable() != null) >+ copyOperation.setRelativeVariable(dialog.getVariable()); >+ copyOperation.createGroupAndLinks(names, target); >+ break; >+ case ImportTypeDialog.IMPORT_LINK: >+ if (dialog.getVariable() != null) >+ copyOperation.setRelativeVariable(dialog.getVariable()); >+ copyOperation.linkFiles(names, target); >+ break; >+ case ImportTypeDialog.IMPORT_NONE: >+ break; >+ } > } > }); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 301187
:
160048
|
160049
|
165622
|
165627