@Override public final ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException { if (fResourceTraversals == null) { final IProject[] projects= getProjects(); final ResourceTraversal[] traversals= new ResourceTraversal[projects.length]; for (int index= 0; index < projects.length; index++) traversals[index]= new ResourceTraversal(new IResource[] { projects[index].getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER)}, IResource.DEPTH_INFINITE, IResource.NONE); fResourceTraversals= traversals; } final ResourceTraversal[] traversals= new ResourceTraversal[fResourceTraversals.length]; System.arraycopy(fResourceTraversals, 0, traversals, 0, fResourceTraversals.length); return traversals; }
/** * Returns the associated resource. * * @return the associated resource, or <code>null</code> if the descriptor * contains no timestamp or project information */ public final IResource getResource() { try { final ResourceTraversal[] traversals= getTraversals(null, null); if (traversals.length > 0) { final IResource[] resources= traversals[0].getResources(); if (resources.length > 0) return resources[0]; } } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } return null; }
/** * Gets the refactoring represented by the specified proxy. * * @param scope * the synchronization scope * @param proxy * the refactoring descriptor proxy * @param set * the set of refactoring descriptor proxies */ private static void getRefactoring(final ISynchronizationScope scope, final RefactoringDescriptorProxy proxy, final Set set) { final ResourceMapping mapping= (ResourceMapping) proxy.getAdapter(ResourceMapping.class); if (mapping instanceof AbstractRefactoringDescriptorResourceMapping) { final AbstractRefactoringDescriptorResourceMapping extended= (AbstractRefactoringDescriptorResourceMapping) mapping; final IResource resource= extended.getResource(); if (resource != null && scope.contains(resource)) set.add(proxy); } }
/** * Returns the associated resource. * <p> * This method only returns a meaningful result if the history contains * refactorings of a single project. * </p> * * @return the associated resource, or <code>null</code> if the * refactoring history contains workspace refactoring descriptors * only, or if it contains refactoring descriptors from multiple * projects. */ public final IResource getResource() { try { final ResourceTraversal[] traversals= getTraversals(null, null); if (traversals.length > 0) { final IResource[] resources= traversals[0].getResources(); if (resources.length > 0) return resources[0]; } } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } return null; }
@Override public final ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException { if (fResourceTraversals == null) { fResourceTraversals= new ResourceTraversal[] {}; final long stamp= fDescriptor.getTimeStamp(); if (stamp >= 0) { final IPath path= RefactoringHistoryManager.stampToPath(stamp); if (path != null) { final IProject[] projects= getProjects(); if (projects != null && projects.length == 1 && projects[0] != null) { final IFolder folder= projects[0].getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER).getFolder(path); fResourceTraversals= new ResourceTraversal[] { new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_HISTORY_FILE)}, IResource.DEPTH_ZERO, IResource.NONE), new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_INDEX_FILE)}, IResource.DEPTH_ZERO, IResource.NONE)}; } } } } final ResourceTraversal[] traversals= new ResourceTraversal[fResourceTraversals.length]; System.arraycopy(fResourceTraversals, 0, traversals, 0, fResourceTraversals.length); return traversals; }
/** * Does the specified refactoring history contain any refactorings in the * scope? * * @param scope * the synchronization scope * @param history * the refactoring history * @return <code>true</code> if any refactorings are in the scope, * <code>false</code> otherwise */ private static boolean hasRefactorings(final ISynchronizationScope scope, final RefactoringHistory history) { final ResourceMapping mapping= (ResourceMapping) history.getAdapter(ResourceMapping.class); if (mapping instanceof AbstractRefactoringHistoryResourceMapping) { final AbstractRefactoringHistoryResourceMapping extended= (AbstractRefactoringHistoryResourceMapping) mapping; final IResource resource= extended.getResource(); if (resource != null) return scope.contains(resource); } return false; }
@Override public final ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException { if (fResourceTraversals == null) { final IProject[] projects= getProjects(); final ResourceTraversal[] traversals= new ResourceTraversal[projects.length]; for (int index= 0; index < projects.length; index++) traversals[index]= new ResourceTraversal(new IResource[] { projects[index].getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER)}, IResource.DEPTH_INFINITE, IResource.NONE); fResourceTraversals= traversals; } final ResourceTraversal[] traversals= new ResourceTraversal[fResourceTraversals.length]; System.arraycopy(fResourceTraversals, 0, traversals, 0, fResourceTraversals.length); return traversals; }
/** * Returns the associated resource. * * @return the associated resource, or <code>null</code> if the descriptor * contains no timestamp or project information */ public final IResource getResource() { try { final ResourceTraversal[] traversals= getTraversals(null, null); if (traversals.length > 0) { final IResource[] resources= traversals[0].getResources(); if (resources.length > 0) return resources[0]; } } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } return null; }
/** * Returns the associated resource. * <p> * This method only returns a meaningful result if the history contains * refactorings of a single project. * </p> * * @return the associated resource, or <code>null</code> if the * refactoring history contains workspace refactoring descriptors * only, or if it contains refactoring descriptors from multiple * projects. */ public final IResource getResource() { try { final ResourceTraversal[] traversals= getTraversals(null, null); if (traversals.length > 0) { final IResource[] resources= traversals[0].getResources(); if (resources.length > 0) return resources[0]; } } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } return null; }
@Override public final ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException { if (fResourceTraversals == null) { fResourceTraversals= new ResourceTraversal[] {}; final long stamp= fDescriptor.getTimeStamp(); if (stamp >= 0) { final IPath path= RefactoringHistoryManager.stampToPath(stamp); if (path != null) { final IProject[] projects= getProjects(); if (projects != null && projects.length == 1 && projects[0] != null) { final IFolder folder= projects[0].getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER).getFolder(path); fResourceTraversals= new ResourceTraversal[] { new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_HISTORY_FILE)}, IResource.DEPTH_ZERO, IResource.NONE), new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_INDEX_FILE)}, IResource.DEPTH_ZERO, IResource.NONE)}; } } } } final ResourceTraversal[] traversals= new ResourceTraversal[fResourceTraversals.length]; System.arraycopy(fResourceTraversals, 0, traversals, 0, fResourceTraversals.length); return traversals; }
/** * Gets the refactorings represented by the specified history. * * @param scope * the synchronization scope * @param history * the refactoring history * @param set * the set of refactoring descriptor proxies */ private static void getRefactorings(final ISynchronizationScope scope, final RefactoringHistory history, final Set set) { final ResourceMapping mapping= (ResourceMapping) history.getAdapter(ResourceMapping.class); if (mapping instanceof AbstractRefactoringHistoryResourceMapping) { final AbstractRefactoringHistoryResourceMapping extended= (AbstractRefactoringHistoryResourceMapping) mapping; final IResource resource= extended.getResource(); if (resource != null && scope.contains(resource)) set.addAll(Arrays.asList(history.getDescriptors())); } }
/** * Is the specified refactoring in the scope? * * @param scope * the synchronization scope * @param proxy * the refactoring descriptor proxy * @return <code>true</code> if the refactoring is in the scope, * <code>false</code> otherwise */ private static boolean hasRefactoring(final ISynchronizationScope scope, final RefactoringDescriptorProxy proxy) { final ResourceMapping mapping= (ResourceMapping) proxy.getAdapter(ResourceMapping.class); if (mapping instanceof AbstractRefactoringDescriptorResourceMapping) { final AbstractRefactoringDescriptorResourceMapping extended= (AbstractRefactoringDescriptorResourceMapping) mapping; final IResource resource= extended.getResource(); if (resource != null) return scope.contains(resource); } return false; }
/** * {@inheritDoc} */ public final ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException { if (fResourceTraversals == null) { final IProject[] projects= getProjects(); final ResourceTraversal[] traversals= new ResourceTraversal[projects.length]; for (int index= 0; index < projects.length; index++) traversals[index]= new ResourceTraversal(new IResource[] { projects[index].getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER)}, IResource.DEPTH_INFINITE, IResource.NONE); fResourceTraversals= traversals; } final ResourceTraversal[] traversals= new ResourceTraversal[fResourceTraversals.length]; System.arraycopy(fResourceTraversals, 0, traversals, 0, fResourceTraversals.length); return traversals; }
/** * Returns the associated resource. * * @return the associated resource, or <code>null</code> if the descriptor * contains no timestamp or project information */ public final IResource getResource() { try { final ResourceTraversal[] traversals= getTraversals(null, null); if (traversals.length > 0) { final IResource[] resources= traversals[0].getResources(); if (resources.length > 0) return resources[0]; } } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } return null; }
/** * Returns the associated resource. * <p> * This method only returns a meaningful result if the history contains * refactorings of a single project. * </p> * * @return the associated resource, or <code>null</code> if the * refactoring history contains workspace refactoring descriptors * only, or if it contains refactoring descriptors from multiple * projects. */ public final IResource getResource() { try { final ResourceTraversal[] traversals= getTraversals(null, null); if (traversals.length > 0) { final IResource[] resources= traversals[0].getResources(); if (resources.length > 0) return resources[0]; } } catch (CoreException exception) { RefactoringCorePlugin.log(exception); } return null; }
/** * {@inheritDoc} */ public final ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException { if (fResourceTraversals == null) { fResourceTraversals= new ResourceTraversal[] {}; final long stamp= fDescriptor.getTimeStamp(); if (stamp >= 0) { final IPath path= RefactoringHistoryManager.stampToPath(stamp); if (path != null) { final IProject[] projects= getProjects(); if (projects != null && projects.length == 1 && projects[0] != null) { final IFolder folder= projects[0].getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER).getFolder(path); fResourceTraversals= new ResourceTraversal[] { new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_HISTORY_FILE)}, IResource.DEPTH_ZERO, IResource.NONE), new ResourceTraversal(new IResource[] { folder.getFile(RefactoringHistoryService.NAME_INDEX_FILE)}, IResource.DEPTH_ZERO, IResource.NONE)}; } } } } final ResourceTraversal[] traversals= new ResourceTraversal[fResourceTraversals.length]; System.arraycopy(fResourceTraversals, 0, traversals, 0, fResourceTraversals.length); return traversals; }