Author: tchemit Date: 2008-08-04 19:02:59 +0000 (Mon, 04 Aug 2008) New Revision: 978 Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java Log: suppression du code de generation par annotation Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java 2008-08-04 17:18:14 UTC (rev 977) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java 2008-08-04 19:02:59 UTC (rev 978) @@ -97,19 +97,6 @@ public void init() { super.init(); filter = new I18nFilter(); - /*if (detectea) { - // in detect mode, we do not filter by ea, try all files - ea = false; - } - if (ea) { - // in ea mode, we do not detect anything - detectea = false; - }*/ - - /*if (ea || detectea) { - loader = initClassLoader(); - annotationClass = initAnnotations(); - }*/ } protected boolean isFileUptodate(File basedir, File file1, String file) { @@ -119,22 +106,6 @@ return clazz.exists() && file1.lastModified() < clazz.lastModified(); } - /*protected List<String> initAnnotations() { - return Collections.singletonList("org.codelutin.i18n.I18nable"); - }*/ - - /*@Override - protected String[] getFilesForEntry(SourceEntry entry) { - - if (detectea || !ea) { - // no filter take all files - return super.getFilesForEntry(entry); - } - - // filter by annotation - return entry.getIncludedFiles(getDefaultBasedir(), getDefaultIncludes(), loader, annotationClass, getLog()); - }*/ - /* * (non-Javadoc) * @see org.codelutin.i18n.plugin.core.Parser#parseFile(java.io.File) @@ -149,12 +120,6 @@ parseLine(srcFile, line); } - /*if (touchFile && detectea) { - Annotation annotation = currentEntry.getAnnotation(srcFile, loader, annotationClass, getLog()); - if (annotation == null) { - addAnnotation(srcFile); - } - }*/ } catch (Exception e) { throw new ParserException(e); } @@ -186,93 +151,4 @@ } } - /*private void addAnnotation(File srcFile) throws IOException { - - String classname = srcFile.getName(); - - classname = classname.substring(0, classname.length() - 5); - - getLog().info(getLogEntry("add annotation to class " + classname, 0, 0, 0)); - - BufferedWriter outputStream = null; - try { - - Pattern TYPE_PATTERN = Pattern.compile("^.*(class|interface|enum)\\s*" + classname + ".*"); - String str = FileUtil.readAsString(srcFile); - outputStream = new BufferedWriter(new FileWriter(srcFile)); - boolean foundDeclaration = false; - String[] lines = str.split("\n"); - int size = lines.length; - for (int i = 0; i < size; i++) { - String line = lines[i]; - if (!foundDeclaration) { - // test if the annotion already exist ? - String line2 = line.trim(); - if (line2.startsWith("@I18nable") || line2.startsWith("@org.codelutin.i18n.I18nable")) { - foundDeclaration = true; - } else if (TYPE_PATTERN.matcher(line2).matches()) { - foundDeclaration = true; - outputStream.write("@org.codelutin.i18n.I18nable\n"); - } - } - outputStream.write(line); - if (i < size - 1) { - outputStream.write("\n"); - } - } - } finally { - if (outputStream != null) { - outputStream.flush(); - outputStream.close(); - } - } - }*/ - - /*protected void parseFile0(File srcFile) throws IOException { - LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(srcFile))); - while (lnr.ready()) { - String line = lnr.readLine(); - parseLine(srcFile, line); - } - }*/ - - /*@SuppressWarnings({"unchecked"}) - private URLClassLoader initClassLoader() { - URLClassLoader loader = null; - if (project != null) { - URLClassLoader result; - try { - Set<Artifact> compileClasspathElements = project.getArtifacts(); - URL[] url = new URL[compileClasspathElements.size() + 1]; - url[0] = cp.toURI().toURL(); - int i = 1; - for (Artifact artifact : compileClasspathElements) { - File file = new File(artifact.getFile().getAbsolutePath()); - if (file.getName().endsWith(".jar")) { - url[i] = new URL("jar", "", file.toURI().toURL().toString() + "!/"); - } else { - url[i] = file.toURI().toURL(); - } - i++; - } - //ClassLoader parent = Thread.currentThread().getContextClassLoader(); - if (compileClasspathElements.size() == 0) { - result = new URLClassLoader(url, getClass().getClassLoader()); - } else { - result = new URLClassLoader(url); - } - } catch (MalformedURLException eee) { - throw new RuntimeException("Can't create ClassLoader for script, bad directory:" + cp + " for reason " + eee.getMessage(), eee); - } catch (IOException e) { - throw new RuntimeException("Can't create ClassLoader for script, bad directory: " + cp + " for reason " + e.getMessage(), e); - } - loader = result; - } - if (getLog().isDebugEnabled() && loader != null) { - for (URL entry : loader.getURLs()) { - getLog().info("cp url " + entry); - } - } - return loader; - }*/ } Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java 2008-08-04 17:18:14 UTC (rev 977) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java 2008-08-04 19:02:59 UTC (rev 978) @@ -50,16 +50,6 @@ return "java-action-config.getter"; } - /*@Override - protected List<String> initAnnotations() { - List<String> result = new ArrayList<String>(4); - result.add("org.codelutin.jaxx.action.ActionConfig"); - result.add("org.codelutin.jaxx.action.SelectActionConfig"); - result.add("org.codelutin.jaxx.action.TabContentConfig"); - result.add("org.codelutin.jaxx.action.ToggleActionConfig"); - return result; - }*/ - /* * (non-Javadoc) * @see org.codelutin.i18n.plugin.extension.XmlParser#extract(java.lang.String) Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java 2008-08-04 17:18:14 UTC (rev 977) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java 2008-08-04 19:02:59 UTC (rev 978) @@ -28,9 +28,4 @@ return "java-tab-config.getter"; } - /*@Override - protected java.util.List<String> initAnnotations() { - return Collections.singletonList("org.codelutin.i18n.I18nable"); - }*/ - }