org.eclipse.core.resources.mapping.ResourceTraversal的实例源码

项目:subclipse    文件TeamAction.java   
/**
 * Returns the selected resources.
 * 
 * @return the selected resources
 */
protected IResource[] getSelectedResources() {
    ArrayList resourceArray = new ArrayList();
    IResource[] resources = (IResource[])getSelectedResources(IResource.class);
    for (int i = 0; i < resources.length; i++) resourceArray.add(resources[i]);
    ResourceMapping[] resourceMappings = (ResourceMapping[])getSelectedAdaptables(selection,ResourceMapping.class);
    for (int i = 0; i < resourceMappings.length; i++) {
        ResourceMapping resourceMapping = (ResourceMapping)resourceMappings[i];
        try {
            ResourceTraversal[] traversals = resourceMapping.getTraversals(null,null);
            for (int j = 0; j < traversals.length; j++) {
                IResource[] traversalResources = traversals[j].getResources();
                for (int k = 0; k < traversalResources.length; k++) {
                    if (!resourceArray.contains(traversalResources[k]))
                        resourceArray.add(traversalResources[k]);
                }
            }
        } catch (CoreException e) {
            SVNUIPlugin.log(IStatus.ERROR,e.getMessage(),e);
        }
    }       
    IResource[] selectedResources = new IResource[resourceArray.size()];
    resourceArray.toArray(selectedResources);
    return selectedResources;
}
项目:che    文件JavaElementResourceMapping.java   
private static ResourceTraversal[] getPackageFragmentTraversals(IPackageFragment pack)
    throws CoreException {
  ArrayList<ResourceTraversal> res = new ArrayList<ResourceTraversal>();
  IContainer container = (IContainer) pack.getResource();

  if (container != null) {
    res.add(new ResourceTraversal(new IResource[] {container},IResource.DEPTH_ONE,0));
    if (pack.exists()) { // folder may not exist any more,see
      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=269167
      Object[] nonJavaResources = pack.getNonJavaResources();
      for (int i = 0; i < nonJavaResources.length; i++) {
        Object resource = nonJavaResources[i];
        if (resource instanceof IFolder) {
          res.add(
              new ResourceTraversal(
                  new IResource[] {(IResource) resource},IResource.DEPTH_INFINITE,0));
        }
      }
    }
  }

  return res.toArray(new ResourceTraversal[res.size()]);
}
项目:che    文件JavaElementResourceMapping.java   
private static ResourceTraversal[] getRemotePackageFragmentTraversals(
    IPackageFragment pack,RemoteResourceMappingContext context,IProgressMonitor monitor)
    throws CoreException {
  ArrayList<ResourceTraversal> res = new ArrayList<ResourceTraversal>();
  IContainer container = (IContainer) pack.getResource();

  if (container != null) {
    res.add(new ResourceTraversal(new IResource[] {container},0));
    IResource[] remoteMembers = context.fetchRemoteMembers(container,monitor);
    if (remoteMembers == null) {
      remoteMembers = context.fetchMembers(container,monitor);
    }
    if (remoteMembers != null) {
      for (int i = 0; i < remoteMembers.length; i++) {
        IResource member = remoteMembers[i];
        if (member instanceof IFolder
            && JavaConventionsUtil.validatePackageName(member.getName(),pack).getSeverity()
                == IStatus.ERROR) {
          res.add(new ResourceTraversal(new IResource[] {member},0));
        }
      }
    }
  }
  return res.toArray(new ResourceTraversal[res.size()]);
}
项目:che    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(
    ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  List<ResourceTraversal> result = new ArrayList<ResourceTraversal>();
  if (context instanceof RemoteResourceMappingContext) {
    for (int i = 0; i < fFragments.length; i++) {
      result.addAll(
          Arrays.asList(
              getRemotePackageFragmentTraversals(
                  fFragments[i],(RemoteResourceMappingContext) context,monitor)));
    }
  } else {
    for (int i = 0; i < fFragments.length; i++) {
      result.addAll(Arrays.asList(getPackageFragmentTraversals(fFragments[i])));
    }
  }
  return result.toArray(new ResourceTraversal[result.size()]);
}
项目:APICloud-Studio    文件TeamAction.java   
/**
 * Returns the selected resources.
 * 
 * @return the selected resources
 */
protected IResource[] getSelectedResources() {
    ArrayList resourceArray = new ArrayList();
    IResource[] resources = (IResource[])getSelectedResources(IResource.class);
    for (int i = 0; i < resources.length; i++) resourceArray.add(resources[i]);
    ResourceMapping[] resourceMappings = (ResourceMapping[])getSelectedAdaptables(selection,e);
        }
    }       
    IResource[] selectedResources = new IResource[resourceArray.size()];
    resourceArray.toArray(selectedResources);
    return selectedResources;
}
项目:Eclipse-Postfix-Code-Completion    文件JavaElementResourceMapping.java   
private static ResourceTraversal[] getPackageFragmentTraversals(IPackageFragment pack) throws CoreException {
    ArrayList<ResourceTraversal> res= new ArrayList<ResourceTraversal>();
    IContainer container= (IContainer)pack.getResource();

    if (container != null) {
        res.add(new ResourceTraversal(new IResource[] { container },0));
        if (pack.exists()) { // folder may not exist any more,see https://bugs.eclipse.org/bugs/show_bug.cgi?id=269167
            Object[] nonJavaResources= pack.getNonJavaResources();
            for (int i= 0; i < nonJavaResources.length; i++) {
                Object resource= nonJavaResources[i];
                if (resource instanceof IFolder) {
                    res.add(new ResourceTraversal(new IResource[] { (IResource)resource },0));
                }
            }
        }
    }

    return res.toArray(new ResourceTraversal[res.size()]);
}
项目:Eclipse-Postfix-Code-Completion    文件JavaElementResourceMapping.java   
private static ResourceTraversal[] getRemotePackageFragmentTraversals(IPackageFragment pack,IProgressMonitor monitor) throws CoreException {
    ArrayList<ResourceTraversal> res= new ArrayList<ResourceTraversal>();
    IContainer container= (IContainer)pack.getResource();

    if (container != null) {
        res.add(new ResourceTraversal(new IResource[] {container},0));
        IResource[] remoteMembers= context.fetchRemoteMembers(container,monitor);
        if (remoteMembers == null) {
            remoteMembers= context.fetchMembers(container,monitor);
        }
        if (remoteMembers != null) {
            for (int i= 0; i < remoteMembers.length; i++) {
                IResource member= remoteMembers[i];
                if (member instanceof IFolder
                        && JavaConventionsUtil.validatePackageName(member.getName(),pack).getSeverity() == IStatus.ERROR) {
                    res.add(new ResourceTraversal(new IResource[] { member },0));
                }
            }
        }
    }
    return res.toArray(new ResourceTraversal[res.size()]);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaElementResourceMapping.java   
private static ResourceTraversal[] getPackageFragmentTraversals(IPackageFragment pack) throws CoreException {
    ArrayList<ResourceTraversal> res= new ArrayList<ResourceTraversal>();
    IContainer container= (IContainer)pack.getResource();

    if (container != null) {
        res.add(new ResourceTraversal(new IResource[] { container },0));
                }
            }
        }
    }

    return res.toArray(new ResourceTraversal[res.size()]);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaElementResourceMapping.java   
private static ResourceTraversal[] getRemotePackageFragmentTraversals(IPackageFragment pack,0));
                }
            }
        }
    }
    return res.toArray(new ResourceTraversal[res.size()]);
}
项目:che    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(
    ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  IJavaProject[] projects = fJavaModel.getJavaProjects();
  ResourceTraversal[] result = new ResourceTraversal[projects.length];
  for (int i = 0; i < projects.length; i++) {
    result[i] =
        new ResourceTraversal(
            new IResource[] {projects[i].getProject()},0);
  }
  return result;
}
项目:che    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(
    ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  return new ResourceTraversal[] {
    new ResourceTraversal(new IResource[] {fProject.getProject()},0)
  };
}
项目:che    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(
    ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  return new ResourceTraversal[] {
    new ResourceTraversal(new IResource[] {fRoot.getResource()},IProgressMonitor monitor) throws CoreException {
  if (context instanceof RemoteResourceMappingContext) {
    return getRemotePackageFragmentTraversals(
        fPack,monitor);
  } else {
    return getPackageFragmentTraversals(fPack);
  }
}
项目:che    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(
    ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
  return new ResourceTraversal[] {
    new ResourceTraversal(new IResource[] {fUnit.getResource()},IProgressMonitor monitor) throws CoreException {
  return new ResourceTraversal[] {
    new ResourceTraversal(new IResource[] {fClassFile.getResource()},0)
  };
}
项目:che    文件AbstractRefactoringHistoryResourceMapping.java   
/**
 * Returns the associated resource.
 *
 * <p>This method only returns a meaningful result if the history contains refactorings of a
 * single project.
 *
 * @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;
}
项目:che    文件AbstractRefactoringDescriptorResourceMapping.java   
/**
 * 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;
}
项目:che    文件AbstractRefactoringDescriptorResourceMapping.java   
/** {@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.NONE)
              };
        }
      }
    }
  }
  final ResourceTraversal[] traversals = new ResourceTraversal[fResourceTraversals.length];
  System.arraycopy(fResourceTraversals,traversals,fResourceTraversals.length);
  return traversals;
}
项目:Eclipse-Postfix-Code-Completion    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
    IJavaProject[] projects= fJavaModel.getJavaProjects();
    ResourceTraversal[] result= new ResourceTraversal[projects.length];
    for (int i= 0; i < projects.length; i++) {
        result[i]= new ResourceTraversal(new IResource[] {projects[i].getProject()},0);
    }
    return result;
}
项目:Eclipse-Postfix-Code-Completion    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
    if (context instanceof RemoteResourceMappingContext) {
        return getRemotePackageFragmentTraversals(fPack,(RemoteResourceMappingContext)context,monitor);
    } else {
        return getPackageFragmentTraversals(fPack);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
    List<ResourceTraversal> result= new ArrayList<ResourceTraversal>();
    if (context instanceof RemoteResourceMappingContext) {
        for (int i= 0; i < fFragments.length; i++) {
            result.addAll(Arrays.asList(getRemotePackageFragmentTraversals(fFragments[i],monitor)));
        }
    } else {
        for (int i= 0; i < fFragments.length; i++) {
            result.addAll(Arrays.asList(getPackageFragmentTraversals(fFragments[i])));
        }
    }
    return result.toArray(new ResourceTraversal[result.size()]);
}
项目:Eclipse-Postfix-Code-Completion    文件JavaSynchronizationContentProvider.java   
/**
 * Returns the resource traversals for the element.
 *
 * @param element
 *            the element to get the resource traversals
 * @return the resource traversals
 */
static ResourceTraversal[] getResourceTraversals(final Object element) {
    final ResourceMapping mapping= getResourceMapping(element);
    if (mapping != null)
        try {
            return mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT,new NullProgressMonitor());
        } catch (final CoreException exception) {
            JavaPlugin.log(exception);
        }
    return new ResourceTraversal[0];
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,0);
    }
    return result;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,monitor);
    } else {
        return getPackageFragmentTraversals(fPack);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,monitor)));
        }
    } else {
        for (int i= 0; i < fFragments.length; i++) {
            result.addAll(Arrays.asList(getPackageFragmentTraversals(fFragments[i])));
        }
    }
    return result.toArray(new ResourceTraversal[result.size()]);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaSynchronizationContentProvider.java   
/**
 * Returns the resource traversals for the element.
 *
 * @param element
 *            the element to get the resource traversals
 * @return the resource traversals
 */
static ResourceTraversal[] getResourceTraversals(final Object element) {
    final ResourceMapping mapping= getResourceMapping(element);
    if (mapping != null)
        try {
            return mapping.getTraversals(ResourceMappingContext.LOCAL_CONTEXT,new NullProgressMonitor());
        } catch (final CoreException exception) {
            JavaPlugin.log(exception);
        }
    return new ResourceTraversal[0];
}
项目:n4js    文件WorkingSetAdapter.java   
@Override
public ResourceTraversal[] getTraversals(final ResourceMappingContext context,final IProgressMonitor monitor)
        throws CoreException {

    return new ResourceTraversal[] { new ResourceTraversal(getProjects(),DEPTH_INFINITE,0) };
}
项目:Eclipse-Postfix-Code-Completion    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
    return new ResourceTraversal[] {
        new ResourceTraversal(new IResource[] {fProject.getProject()},0)
    };
}
项目:Eclipse-Postfix-Code-Completion    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
    return new ResourceTraversal[] {
        new ResourceTraversal(new IResource[] {fRoot.getResource()},IProgressMonitor monitor) throws CoreException {
    return new ResourceTraversal[] {
        new ResourceTraversal(new IResource[] {fUnit.getResource()},IProgressMonitor monitor) throws CoreException {
    return new ResourceTraversal[] {
        new ResourceTraversal(new IResource[] {fClassFile.getResource()},0)
    };
}
项目:Eclipse-Postfix-Code-Completion    文件HierarchicaldecorationContext.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,IProgressMonitor monitor) throws CoreException {
    return new ResourceTraversal[] {
        new ResourceTraversal(new IResource[] {fPack.getResource()},0)
    };
}
项目:Eclipse-Postfix-Code-Completion    文件JavaResourceMapping.java   
/**
 * {@inheritDoc}
 */
@Override
public ResourceTraversal[] getTraversals(final ResourceMappingContext context,final IProgressMonitor monitor) {
    return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { fResource },IResource.NONE) };
}
项目:Eclipse-Postfix-Code-Completion    文件JavaSynchronizationContentProvider.java   
/**
 * {@inheritDoc}
 */
@Override
protected ResourceTraversal[] getTraversals(final isynchronizationContext context,final Object object) {
    return getResourceTraversals(object);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,0)
    };
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaElementResourceMapping.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,0)
    };
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件HierarchicaldecorationContext.java   
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context,0)
    };
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件JavaResourceMapping.java   
/**
 * {@inheritDoc}
 */
@Override
public ResourceTraversal[] getTraversals(final ResourceMappingContext context,IResource.NONE) };
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...