|
18 | 18 | import java.util.Map; |
19 | 19 | import java.util.Properties; |
20 | 20 |
|
21 | | -import org.eclipse.core.resources.IContainer; |
22 | 21 | import org.eclipse.core.resources.IFile; |
23 | 22 | import org.eclipse.core.resources.IProject; |
24 | 23 | import org.eclipse.jdt.core.JavaCore; |
25 | 24 | import org.eclipse.jdt.core.dom.AST; |
26 | 25 | import org.eclipse.jdt.core.dom.ASTParser; |
27 | 26 | import org.eclipse.jdt.core.dom.CompilationUnit; |
28 | | -import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; |
29 | | -import org.eclipse.jdt.internal.core.builder.SourceFile; |
30 | 27 |
|
31 | 28 | import net.sf.j2s.core.CorePlugin; |
32 | 29 | import net.sf.j2s.core.astvisitors.Java2ScriptVisitor; |
33 | | -//import net.sf.j2s.core.builder.SourceFile; |
34 | | -//import net.sf.j2s.core.builder.SourceFileProxy; |
35 | | -//import net.sf.j2s.core.hotspot.InnerHotspotServer; |
36 | 30 |
|
37 | 31 | /** |
38 | 32 | * The main (and currently only operational) Java2Script compiler. |
|
42 | 36 | */ |
43 | 37 | @SuppressWarnings("restriction") |
44 | 38 | public class Java2ScriptCompiler { |
45 | | - |
| 39 | + /** |
| 40 | + * The name of the J2S options file, aka as the "Dot-j2s" file. |
| 41 | + */ |
| 42 | + public static final String J2S_OPTIONS_FILE_NAME = ".j2s"; |
| 43 | + |
46 | 44 | // BH: added "true".equals(getProperty(props, |
47 | 45 | // "j2s.compiler.allow.compression")) to ensure compression only occurs when |
48 | 46 | // desired |
@@ -83,8 +81,8 @@ public class Java2ScriptCompiler { |
83 | 81 |
|
84 | 82 | public static boolean isActive(IProject project) { |
85 | 83 | try { |
86 | | - return new File(project.getProject().getLocation().toOSString(), ".J2S").exists(); |
87 | | - } catch (Exception e) { |
| 84 | + return new File(project.getProject().getLocation().toOSString(), J2S_OPTIONS_FILE_NAME).exists(); |
| 85 | + } catch (@SuppressWarnings("unused") Exception e) { |
88 | 86 | return false; |
89 | 87 | } |
90 | 88 | } |
@@ -141,7 +139,7 @@ public boolean initializeProject(IProject project, boolean isCompilationParticip |
141 | 139 | projectFolder = project.getLocation().toOSString(); |
142 | 140 | props = new Properties(); |
143 | 141 | try { |
144 | | - File j2sFile = new File(projectFolder, ".j2s"); |
| 142 | + File j2sFile = new File(projectFolder, J2S_OPTIONS_FILE_NAME); |
145 | 143 | props.load(new FileInputStream(j2sFile)); |
146 | 144 | String status = getProperty("j2s.compiler.status"); |
147 | 145 | if (!"enable".equals(status) && !"enabled".equals(status)) { |
|
0 commit comments