Java Code Examples for org.eclipse.core.resources.mapping.RemoteResourceMappingContext

The following are top voted examples for showing how to use org.eclipse.core.resources.mapping.RemoteResourceMappingContext. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: che   File: JavaElementResourceMapping.java   Source Code and License 6 votes vote down vote up
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}, IResource.DEPTH_ONE, 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}, IResource.DEPTH_INFINITE, 0));
        }
      }
    }
  }
  return res.toArray(new ResourceTraversal[res.size()]);
}
 
Example 2
Project: che   File: JavaElementResourceMapping.java   Source Code and License 6 votes vote down vote up
@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()]);
}
 
Example 3
Project: Eclipse-Postfix-Code-Completion   File: JavaElementResourceMapping.java   Source Code and License 6 votes vote down vote up
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}, IResource.DEPTH_ONE, 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 }, IResource.DEPTH_INFINITE, 0));
				}
			}
		}
	}
	return res.toArray(new ResourceTraversal[res.size()]);
}
 
Example 4
Project: Eclipse-Postfix-Code-Completion-Juno38   File: JavaElementResourceMapping.java   Source Code and License 6 votes vote down vote up
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}, IResource.DEPTH_ONE, 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 }, IResource.DEPTH_INFINITE, 0));
				}
			}
		}
	}
	return res.toArray(new ResourceTraversal[res.size()]);
}
 
Example 5
Project: che   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
@Override
public ResourceTraversal[] getTraversals(
    ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
  if (context instanceof RemoteResourceMappingContext) {
    return getRemotePackageFragmentTraversals(
        fPack, (RemoteResourceMappingContext) context, monitor);
  } else {
    return getPackageFragmentTraversals(fPack);
  }
}
 
Example 6
Project: Eclipse-Postfix-Code-Completion   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
	if (context instanceof RemoteResourceMappingContext) {
		return getRemotePackageFragmentTraversals(fPack, (RemoteResourceMappingContext)context, monitor);
	} else {
		return getPackageFragmentTraversals(fPack);
	}
}
 
Example 7
Project: Eclipse-Postfix-Code-Completion   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
@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()]);
}
 
Example 8
Project: Eclipse-Postfix-Code-Completion-Juno38   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
	if (context instanceof RemoteResourceMappingContext) {
		return getRemotePackageFragmentTraversals(fPack, (RemoteResourceMappingContext)context, monitor);
	} else {
		return getPackageFragmentTraversals(fPack);
	}
}
 
Example 9
Project: Eclipse-Postfix-Code-Completion-Juno38   File: JavaElementResourceMapping.java   Source Code and License 5 votes vote down vote up
@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()]);
}