TDI-30302: review util functions to help for the junits

This commit is contained in:
nrousseau
2014-10-08 23:50:03 +08:00
parent 8acdb1c05e
commit bcfe3cb951
2 changed files with 7 additions and 1 deletions

View File

@@ -28,9 +28,11 @@ public class ResourceUtil {
private static final String BUNDLERESOURCE = "bundleresource"; //$NON-NLS-1$
private static final String BUNDLEENTRY = "bundleentry"; //$NON-NLS-1$
public static File convertResourceToFile(URL resource) throws IOException, URISyntaxException {
File fileDir = null;
if (BUNDLERESOURCE.equals(resource.getProtocol())) {
if (BUNDLERESOURCE.equals(resource.getProtocol()) || BUNDLEENTRY.equals(resource.getProtocol())) {
URL unescapedURL = FileLocator.toFileURL(resource);
URI escapedURI = new URI(unescapedURL.getProtocol(), unescapedURL.getPath(), unescapedURL.getQuery());
fileDir = URIUtil.toFile(escapedURI);

View File

@@ -14,6 +14,7 @@ package org.talend.repository.viewer.content;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.CoreException;
@@ -93,6 +94,9 @@ public class VisitResourceHelper {
IResourceDelta[] affectedChildren = delta.getAffectedChildren();
IResource res = delta.getResource();
if (res instanceof IProject && delta.getKind() == IResourceDelta.REMOVED) {
return false;
}
IPath path = delta.getFullPath();
boolean noChild = (affectedChildren == null || (affectedChildren.length == 0));