private boolean handleDropCopy(final Object target) throws JavaModelException, InvocationTargetException, InterruptedException{ IJavaElement[] javaElements= ReorgUtils.getJavaElements(fElements); IResource[] resources= ReorgUtils.getResources(fElements); ReorgCopyStarter starter= ReorgCopyStarter.create(javaElements, resources, ReorgDestinationFactory.createDestination(target, getCurrentLocation())); if (starter != null) { starter.run(getShell()); return true; } return false; }
private boolean handleDropCopy(final Object target) throws JavaModelException, InvocationTargetException, InterruptedException{ IJavaElement[] javaElements= ReorgUtils.getJavaElements(fElements); IResource[] resources= ReorgUtils.getResources(fElements); ReorgCopyStarter starter= ReorgCopyStarter.create(javaElements, resources, ReorgDestinationFactory.createDestination(target, getCurrentLocation())); if (starter != null) { starter.run(getShell()); return true; } return false; }
private boolean handleDropMove(final Object target) throws JavaModelException, InvocationTargetException, InterruptedException{ IJavaElement[] javaElements= ReorgUtils.getJavaElements(fElements); IResource[] resources= ReorgUtils.getResources(fElements); ReorgMoveStarter starter= ReorgMoveStarter.create(javaElements, resources, ReorgDestinationFactory.createDestination(target, getCurrentLocation())); if (starter != null) return starter.run(getShell()); return false; }
private boolean handleDropMove(final Object target) throws JavaModelException, InvocationTargetException, InterruptedException{ IJavaElement[] javaElements= ReorgUtils.getJavaElements(fElements); IResource[] resources= ReorgUtils.getResources(fElements); ReorgMoveStarter starter= ReorgMoveStarter.create(javaElements, resources, ReorgDestinationFactory.createDestination(target, getCurrentLocation())); if (starter != null) return starter.run(getShell()); return false; }
private int handleValidateCopy(Object target) throws JavaModelException{ if (fCopyProcessor == null) { final ICopyPolicy policy= ReorgPolicyFactory.createCopyPolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements)); fCopyProcessor= policy.canEnable() ? new JavaCopyProcessor(policy) : null; } if (!canCopyElements()) return DND.DROP_NONE; if (fCopyProcessor == null) return DND.DROP_NONE; if (!fCopyProcessor.setDestination(ReorgDestinationFactory.createDestination(target, getCurrentLocation())).isOK()) return DND.DROP_NONE; return DND.DROP_COPY; }
private int handleValidateCopy(Object target) throws JavaModelException{ if (fCopyProcessor == null) { final ICopyPolicy policy= ReorgPolicyFactory.createCopyPolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements)); fCopyProcessor= policy.canEnable() ? new JavaCopyProcessor(policy) : null; } if (!canCopyElements()) return DND.DROP_NONE; if (fCopyProcessor == null) return DND.DROP_NONE; if (!fCopyProcessor.setDestination(ReorgDestinationFactory.createDestination(target, getCurrentLocation())).isOK()) return DND.DROP_NONE; return DND.DROP_COPY; }
private int handleValidateMove(Object target) throws JavaModelException{ if (fMoveProcessor == null) { IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements)); if (policy.canEnable()) fMoveProcessor= new JavaMoveProcessor(policy); } if (!canMoveElements()) return DND.DROP_NONE; if (fMoveProcessor == null) return DND.DROP_NONE; RefactoringStatus moveStatus= fMoveProcessor.setDestination(ReorgDestinationFactory.createDestination(target, getCurrentLocation())); if (moveStatus.hasError()) return DND.DROP_NONE; return DND.DROP_MOVE; }
private int handleValidateMove(Object target) throws JavaModelException{ if (fMoveProcessor == null) { IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements)); if (policy.canEnable()) fMoveProcessor= new JavaMoveProcessor(policy); } if (!canMoveElements()) return DND.DROP_NONE; if (fMoveProcessor == null) return DND.DROP_NONE; RefactoringStatus moveStatus= fMoveProcessor.setDestination(ReorgDestinationFactory.createDestination(target, getCurrentLocation())); if (moveStatus.hasError()) return DND.DROP_NONE; return DND.DROP_MOVE; }
private int internalDetermineOperation(Object target, int operation, int operations) { initializeSelection(); if (target == null) return DND.DROP_NONE; //Do not allow to drop on itself, bug 14228 if (getCurrentLocation() == LOCATION_ON) { IJavaElement[] javaElements= ReorgUtils.getJavaElements(fElements); if (contains(javaElements, target)) return DND.DROP_NONE; IResource[] resources= ReorgUtils.getResources(fElements); if (contains(resources, target)) return DND.DROP_NONE; } try { switch(operation) { case DND.DROP_DEFAULT: return handleValidateDefault(target, operations); case DND.DROP_COPY: return handleValidateCopy(target); case DND.DROP_MOVE: return handleValidateMove(target); } } catch (JavaModelException e){ ExceptionHandler.handle(e, PackagesMessages.SelectionTransferDropAdapter_error_title, PackagesMessages.SelectionTransferDropAdapter_error_message); } return DND.DROP_NONE; }
private int internalDetermineOperation(Object target, int operation, int operations) { initializeSelection(); if (target == null) return DND.DROP_NONE; //Do not allow to drop on itself, bug 14228 if (getCurrentLocation() == LOCATION_ON) { IJavaElement[] javaElements= ReorgUtils.getJavaElements(fElements); if (contains(javaElements, target)) return DND.DROP_NONE; IResource[] resources= ReorgUtils.getResources(fElements); if (contains(resources, target)) return DND.DROP_NONE; } try { switch(operation) { case DND.DROP_DEFAULT: return handleValidateDefault(target, operations); case DND.DROP_COPY: return handleValidateCopy(target); case DND.DROP_MOVE: return handleValidateMove(target); } } catch (JavaModelException e){ ExceptionHandler.handle(e, PackagesMessages.SelectionTransferDropAdapter_error_title, PackagesMessages.SelectionTransferDropAdapter_error_message); } return DND.DROP_NONE; }