Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@
import java.util.Map;
import java.util.Properties;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.core.builder.SourceFile;

import net.sf.j2s.core.CorePlugin;
import net.sf.j2s.core.astvisitors.Java2ScriptVisitor;
//import net.sf.j2s.core.builder.SourceFile;
//import net.sf.j2s.core.builder.SourceFileProxy;
//import net.sf.j2s.core.hotspot.InnerHotspotServer;

/**
* The main (and currently only operational) Java2Script compiler.
Expand All @@ -42,7 +36,11 @@
*/
@SuppressWarnings("restriction")
public class Java2ScriptCompiler {

/**
* The name of the J2S options file, aka as the "Dot-j2s" file.
*/
public static final String J2S_OPTIONS_FILE_NAME = ".j2s";

// BH: added "true".equals(getProperty(props,
// "j2s.compiler.allow.compression")) to ensure compression only occurs when
// desired
Expand Down Expand Up @@ -83,8 +81,8 @@ public class Java2ScriptCompiler {

public static boolean isActive(IProject project) {
try {
return new File(project.getProject().getLocation().toOSString(), ".J2S").exists();
} catch (Exception e) {
return new File(project.getProject().getLocation().toOSString(), J2S_OPTIONS_FILE_NAME).exists();
} catch (@SuppressWarnings("unused") Exception e) {
return false;
}
}
Expand Down Expand Up @@ -141,7 +139,7 @@ public boolean initializeProject(IProject project, boolean isCompilationParticip
projectFolder = project.getLocation().toOSString();
props = new Properties();
try {
File j2sFile = new File(projectFolder, ".j2s");
File j2sFile = new File(projectFolder, J2S_OPTIONS_FILE_NAME);
props.load(new FileInputStream(j2sFile));
String status = getProperty("j2s.compiler.status");
if (!"enable".equals(status) && !"enabled".equals(status)) {
Expand Down