Commit 6612a255 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* moved filefinder into its own class

parent aebf0849
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
package org.etsi.mts.tdl.resources;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;

public abstract class FileFinder implements IResourceVisitor {
	
	public IFile file;

	@Override
	public boolean visit(IResource resource) throws CoreException {
		if (file != null)
			return false;
		if (resource.getType() != IResource.FILE)
			return true;
		if (mathces((IFile) resource)) {
			this.file = (IFile) resource;
		}
		return file == null;
	}
	
	abstract protected boolean mathces(IFile file);
}
+0 −18
Original line number Diff line number Diff line
@@ -349,24 +349,6 @@ public class ResourceHandler {
		return null;
	}

	abstract static class FileFinder implements IResourceVisitor {
		
		public IFile file;

		@Override
		public boolean visit(IResource resource) throws CoreException {
			if (file != null)
				return false;
			if (resource.getType() != IResource.FILE)
				return true;
			if (mathces((IFile) resource)) {
				this.file = (IFile) resource;
			}
			return file == null;
		}
		
		abstract protected boolean mathces(IFile file);
	}

	
}