Author: dgolovin
Date: 2008-01-03 20:54:47 -0500 (Thu, 03 Jan 2008)
New Revision: 5498
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1544
Need add @catalogProperty@@schemaProperty@ back to persistence.xml templates file in
seam-gen.
JUnit tests also added.
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-01-04
01:54:44 UTC (rev 5497)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2008-01-04
01:54:47 UTC (rev 5498)
@@ -12,9 +12,13 @@
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
@@ -108,4 +112,18 @@
return project;
}
+
+ public static boolean findLineInFile(IFile file, String pattern) throws CoreException,
IOException {
+ InputStream content = file.getContents(true);
+ LineNumberReader contentReader = new LineNumberReader(new InputStreamReader(content));
+ String line;
+ boolean patternIsFound = false;
+ do {
+ line = contentReader.readLine();
+ if(line!=null && !patternIsFound) {
+ patternIsFound = line.matches(pattern);
+ }
+ } while (line != null && !patternIsFound);
+ return patternIsFound;
+ }
}