Package org.eclipse.ui.actions

Examples of org.eclipse.ui.actions.CopyFilesAndFoldersOperation


            if (targetContainer == null)
                return Status.CANCEL_STATUS;

            getShell().forceActive();
            final Object data= FileTransfer.getInstance().nativeToJava(aDropAdapter.getCurrentTransfer());
            new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles((String[])data, targetContainer, aDropAdapter.getCurrentOperation());
            return Status.OK_STATUS;
        }
        return Status.CANCEL_STATUS;
       
       
View Full Code Here


                // do not support project pasting onto a jcr node
                MessageDialog.openInformation(null, "Cannot paste project(s)",
                        "Pasting of a project onto a (JCR) node is not possible");
                return;
            } else {
                CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(null);
                operation.copyResources(resourceData, getDropContainer());
            }
            return;
        }

        // try the file transfer
        String[] fileData = (String[]) clipboard.getContents(FileTransfer.getInstance());
        if (fileData != null) {
            CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(null);
            operation.copyFiles(fileData, getDropContainer());
            return;
        }
       
        // then try the text transfer
        String text = (String) clipboard.getContents(TextTransfer.getInstance());
View Full Code Here

    if (resourceData != null && resourceData.length > 0) {

      // resource always contains either projects or files and folders
      if (resourceData[0].getType() != IResource.PROJECT) {
        CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(mShell);
        operation.copyResources(resourceData, getNewParent());
      } else {
        for (IResource element : resourceData) {
            new CopyProjectOperation(mShell).copyProject((IProject) element);
        }
      }

      return;
    } else {

      String[] fileData = (String[]) mClipboard.getContents(FileTransfer.getInstance());

      if (fileData != null && fileData.length > 0) {
        new CopyFilesAndFoldersOperation(mShell).copyFiles(fileData, getNewParent());
      }
    }
  }
View Full Code Here

    if (resourceData != null && resourceData.length > 0) {

      // resource always contains either projects or files and folders
      if (resourceData[0].getType() != IResource.PROJECT) {
        CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(mShell);
        operation.copyResources(resourceData, getNewParent());
      } else {
        for (IResource element : resourceData) {
            new CopyProjectOperation(mShell).copyProject((IProject) element);
        }
      }

      return;
    } else {

      String[] fileData = (String[]) mClipboard.getContents(FileTransfer.getInstance());

      if (fileData != null && fileData.length > 0) {
        new CopyFilesAndFoldersOperation(mShell).copyFiles(fileData, getNewParent());
      }
    }
  }
View Full Code Here

                }
            } else {
                // enablement should ensure that we always have access to a container
                IContainer container = getContainer();

                CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(this.shell);
                operation.copyResources(resourceData, container);
            }
            return;
        }

        // try a file transfer
        FileTransfer fileTransfer = FileTransfer.getInstance();
        String[] fileData = (String[]) clipboard.getContents(fileTransfer);

        if (fileData != null) {
            // enablement should ensure that we always have access to a container
            IContainer container = getContainer();

            CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(this.shell);
            operation.copyFiles(fileData, container);
            return;
        }

        //Now, at last, try a text transfer (create a new file with the contents).
        TextTransfer instance = TextTransfer.getInstance();
View Full Code Here

            IResource[] selectedResources = getSelectedResources();

            if (selectedResources.length == 0) {
                message = WorkbenchNavigatorMessages.DropAdapter_dropOperationErrorOther;
            } else {
                CopyFilesAndFoldersOperation operation;
                if (aDropOperation == DND.DROP_COPY) {
                    if (DEBUG) {
                        System.out.println("ResourceDropAdapterAssistant.validateDrop validating COPY."); //$NON-NLS-1$
                    }

                    operation = new CopyFilesAndFoldersOperation(getShell());
                } else {
                    if (DEBUG) {
                        System.out.println("ResourceDropAdapterAssistant.validateDrop validating MOVE."); //$NON-NLS-1$
                    }
                    operation = new MoveFilesAndFoldersOperation(getShell());
                }
                message = operation.validateDestination(destination, selectedResources);
            }
        } // file import?
        else if (FileTransfer.getInstance().isSupportedType(transferType)) {
            String[] sourceNames = (String[]) FileTransfer.getInstance().nativeToJava(transferType);
            if (sourceNames == null) {
                // source names will be null on Linux. Use empty names to do
                // destination validation.
                // Fixes bug 29778
                sourceNames = new String[0];
            }
            CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation(getShell());
            message = copyOperation.validateImportDestination(destination, sourceNames);
        }
        if (message != null) {
            return WorkbenchNavigatorPlugin.createErrorStatus(0, message, null);
        }
        return Status.OK_STATUS;
View Full Code Here

                problems,
                validateTarget(getCurrentTarget(dropAdapter), dropAdapter.getCurrentTransfer(),
                        dropAdapter.getCurrentOperation()));

        IContainer target = getActualTarget((IResource) getCurrentTarget(dropAdapter));
        CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
        operation.copyResources(sources, target);

        return problems;
    }
View Full Code Here

        // Otherwise the drag source (e.g., Windows Explorer) will be blocked
        // while the operation executes. Fixes bug 16478.
        Display.getCurrent().asyncExec(new Runnable() {
            public void run() {
                getShell().forceActive();
                CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell());
                operation.copyFiles(names, target);
            }
        });
        return problems;
    }
View Full Code Here

            IResource[] selectedResources = getSelectedResources();

            if (selectedResources.length == 0) {
                message = WorkbenchNavigatorMessages.DropAdapter_dropOperationErrorOther;
            } else {
                CopyFilesAndFoldersOperation operation;
                if (dropOperation == DND.DROP_COPY) {
                    operation = new CopyFilesAndFoldersOperation(getShell());
                } else {
                    operation = new MoveFilesAndFoldersOperation(getShell());
                }
                message = operation.validateDestination(destination, selectedResources);
            }
        } // file import?
        else if (FileTransfer.getInstance().isSupportedType(transferType)) {
            String[] sourceNames = (String[]) FileTransfer.getInstance().nativeToJava(transferType);
            if (sourceNames == null) {
                // source names will be null on Linux. Use empty names to do
                // destination validation.
                // Fixes bug 29778
                sourceNames = new String[0];
            }
            CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation(getShell());
            message = copyOperation.validateImportDestination(destination, sourceNames);
        }
        if (message != null) {
            return WorkbenchNavigatorPlugin.createErrorStatus(message);
        }
        return Status.OK_STATUS;
View Full Code Here

    // Otherwise the drag source (e.g., Windows Explorer) will be blocked
    // while the operation executes. Fixes bug 16478.
    Display.getCurrent().asyncExec(new Runnable() {
      public void run() {
        getShell().forceActive();
        CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(
            getShell());
        operation.copyFiles(names, target);
      }
    });
    return problems;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.actions.CopyFilesAndFoldersOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.