### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.ide Index: src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java,v retrieving revision 1.21 diff -u -r1.21 NavigatorDropAdapter.java --- src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java 11 May 2010 16:26:30 -0000 1.21 +++ src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java 25 Mar 2011 00:01:56 -0000 @@ -22,6 +22,7 @@ import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; @@ -39,6 +40,8 @@ import org.eclipse.ui.actions.ReadOnlyStateChecker; import org.eclipse.ui.dialogs.IOverwriteQuery; import org.eclipse.ui.ide.dialogs.ImportTypeDialog; +import org.eclipse.ui.internal.ide.IDEInternalPreferences; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; import org.eclipse.ui.internal.views.navigator.ResourceNavigatorMessages; import org.eclipse.ui.part.PluginDropAdapter; import org.eclipse.ui.part.ResourceTransfer; @@ -328,19 +331,26 @@ } // if all sources are either links or groups, copy then normally, don't show the dialog if (!allSourceAreLinksOrGroups) { - ImportTypeDialog dialog = new ImportTypeDialog(getShell(), getCurrentOperation(), sources, target); - dialog.setResource(target); - if (dialog.open() == Window.OK) { - if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS) - operation.setVirtualFolders(true); - if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK) - operation.setCreateLinks(true); - if (dialog.getVariable() != null) - operation.setRelativeVariable(dialog.getVariable()); - operation.copyResources(sources, target); + IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore(); + String dndPreference= store.getString(target.isVirtual() ? IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE : IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE); + + if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) { + ImportTypeDialog dialog = new ImportTypeDialog(getShell(), getCurrentOperation(), sources, target); + dialog.setResource(target); + if (dialog.open() == Window.OK) { + if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS) + operation.setVirtualFolders(true); + if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK) + operation.setCreateLinks(true); + if (dialog.getVariable() != null) + operation.setRelativeVariable(dialog.getVariable()); + operation.copyResources(sources, target); + } + else + return problems; } else - return problems; + operation.copyResources(sources, target); } else operation.copyResources(sources, target); #P org.eclipse.ui.navigator.resources Index: src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java,v retrieving revision 1.16 diff -u -r1.16 ResourceDropAdapterAssistant.java --- src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java 23 Apr 2010 13:16:03 -0000 1.16 +++ src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java 25 Mar 2011 00:01:57 -0000 @@ -39,6 +39,7 @@ import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -49,6 +50,8 @@ import org.eclipse.ui.actions.MoveFilesAndFoldersOperation; import org.eclipse.ui.actions.ReadOnlyStateChecker; import org.eclipse.ui.ide.dialogs.ImportTypeDialog; +import org.eclipse.ui.internal.ide.IDEInternalPreferences; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; import org.eclipse.ui.internal.navigator.Policy; import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorMessages; import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin; @@ -422,18 +425,25 @@ // if all sources are either links or groups, copy then normally, // don't show the dialog if (!allSourceAreLinksOrVirtualFolders) { - ImportTypeDialog dialog = new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), sources, target); - dialog.setResource(target); - if (dialog.open() == Window.OK) { - if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS) - operation.setVirtualFolders(true); - if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK) - operation.setCreateLinks(true); - if (dialog.getVariable() != null) - operation.setRelativeVariable(dialog.getVariable()); + IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore(); + String dndPreference= store.getString(target.isVirtual() ? IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE : IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE); + + if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) { + ImportTypeDialog dialog = new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), sources, target); + dialog.setResource(target); + if (dialog.open() == Window.OK) { + if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS) + operation.setVirtualFolders(true); + if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK) + operation.setCreateLinks(true); + if (dialog.getVariable() != null) + operation.setRelativeVariable(dialog.getVariable()); + operation.copyResources(sources, target); + } else + return problems; + } + else operation.copyResources(sources, target); - } else - return problems; } else operation.copyResources(sources, target); }