Skip to content

Commit 628c301

Browse files
authored
Merge pull request #35 from java2script/master
from java2script to BobHanson
2 parents af32092 + e88dcf9 commit 628c301

File tree

10 files changed

+4145
-3223
lines changed

10 files changed

+4145
-3223
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/compiler/Java2ScriptCompiler.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@
1818
import java.util.Map;
1919
import java.util.Properties;
2020

21-
import org.eclipse.core.resources.IContainer;
2221
import org.eclipse.core.resources.IFile;
2322
import org.eclipse.core.resources.IProject;
2423
import org.eclipse.jdt.core.JavaCore;
2524
import org.eclipse.jdt.core.dom.AST;
2625
import org.eclipse.jdt.core.dom.ASTParser;
2726
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;
3027

3128
import net.sf.j2s.core.CorePlugin;
3229
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;
3630

3731
/**
3832
* The main (and currently only operational) Java2Script compiler.
@@ -42,7 +36,11 @@
4236
*/
4337
@SuppressWarnings("restriction")
4438
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+
4644
// BH: added "true".equals(getProperty(props,
4745
// "j2s.compiler.allow.compression")) to ensure compression only occurs when
4846
// desired
@@ -83,8 +81,8 @@ public class Java2ScriptCompiler {
8381

8482
public static boolean isActive(IProject project) {
8583
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) {
8886
return false;
8987
}
9088
}
@@ -141,7 +139,7 @@ public boolean initializeProject(IProject project, boolean isCompilationParticip
141139
projectFolder = project.getLocation().toOSString();
142140
props = new Properties();
143141
try {
144-
File j2sFile = new File(projectFolder, ".j2s");
142+
File j2sFile = new File(projectFolder, J2S_OPTIONS_FILE_NAME);
145143
props.load(new FileInputStream(j2sFile));
146144
String status = getProperty("j2s.compiler.status");
147145
if (!"enable".equals(status) && !"enabled".equals(status)) {
118 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/JSUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static String getJavaResource(String resourceName, boolean isJavaPath,
169169
+ (ok ? "" + sdata.length() : sdata) + "]");
170170
return (!ok ? null : !doProcess ? sdata
171171
: path.endsWith(".css") ? JSUtil.processCSS(sdata, path) : path
172-
.endsWith(".js") ? JSUtil.processJS(sdata) : sdata);
172+
.endsWith(".js") ? JSUtil.processJS(sdata, resourceName) : sdata);
173173
}
174174

175175
static void cacheFileData(String path, Object data) {
@@ -231,11 +231,13 @@ static String processCSS(String css, String path) {
231231
return css;
232232
}
233233

234-
static String processJS(String js) {
234+
static String processJS(String js, String resourceName) {
235235
try {
236236
/**
237237
* @j2sNative
238238
*
239+
*
240+
* if (js.indexOf(";//# sourceURL=") < 0) js += ";//# sourceURL=" + thisApplet._j2sPath + "/" + resourceName;
239241
* eval(js);
240242
*
241243
*/

sources/net.sf.j2s.java.core/src/swingjs/jquery/JQueryUI.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)