Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit56b6736

Browse files
author
zhourenjian
committed
Update to version 20080907:
1. Fix bug that running Java2Script applications may leave "processes" in Debug stack view2. Support exporting to *.jar in java 1.3 compatible mode.
1 parente73e20e commit56b6736

File tree

6 files changed

+135
-15
lines changed

6 files changed

+135
-15
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Wed Aug 29 20:57:36 CST 2007
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
5+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6+
org.eclipse.jdt.core.compiler.compliance=1.4
7+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
12+
org.eclipse.jdt.core.compiler.source=1.3

‎build.properties‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ bin.includes = META-INF/,\
55
plugin.xml,\
66
schema/,\
77
icons/
8+
javacSource = 1.3
9+
javacTarget = 1.2

‎src/net/sf/j2s/ui/launching/J2SLaunchConfigurationDelegate.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
packagenet.sf.j2s.ui.launching;
22

3+
importjava.io.File;
4+
35
importorg.eclipse.core.runtime.CoreException;
46
importorg.eclipse.core.runtime.IProgressMonitor;
57
importorg.eclipse.debug.core.ILaunch;
@@ -17,6 +19,13 @@ public void launch(ILaunchConfiguration configuration, String mode,
1719
if (configuration !=null) {
1820
try {
1921
J2SLaunchingUtil.launchingJ2SApp(configuration,mode,"html");
22+
StringmainType =J2SLaunchingUtil.getMainType(configuration);
23+
if (mainType !=null) {
24+
FileworkingDir =J2SLaunchingUtil.getWorkingDirectory(configuration);
25+
if (workingDir !=null) {
26+
launch.addProcess(newJ2SProcess(launch,newFile(workingDir,mainType +".html").getAbsolutePath()));
27+
}
28+
}
2029
}catch (CoreExceptione) {
2130
e.printStackTrace();
2231
}

‎src/net/sf/j2s/ui/launching/J2SLaunchingUtil.java‎

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
importjava.util.Properties;
1616
importjava.util.Set;
1717

18+
importnet.sf.j2s.core.astvisitors.ASTTigerVisitor;
19+
importnet.sf.j2s.core.astvisitors.ASTTypeVisitor;
1820
importnet.sf.j2s.core.astvisitors.DependencyASTVisitor;
1921
importnet.sf.j2s.core.hotspot.InnerHotspotServer;
2022
importnet.sf.j2s.ui.Java2ScriptUIPlugin;
@@ -152,10 +154,11 @@ public static void launchingJ2SUnit(ILaunchConfiguration configuration, String m
152154
}
153155
}
154156
}
157+
StringmainTypeName =newASTTypeVisitor().assureQualifiedName(mainType);
155158
if (isTestSuite) {
156-
buf.append("\t\t\t\tjunit.textui.TestRunner.run (" +mainType +".suite ());\r\n");
159+
buf.append("\t\t\t\tjunit.textui.TestRunner.run (" +mainTypeName +".suite ());\r\n");
157160
}else {
158-
buf.append("\t\t\t\tjunit.textui.TestRunner.run (" +mainType +");\r\n");
161+
buf.append("\t\t\t\tjunit.textui.TestRunner.run (" +mainTypeName +");\r\n");
159162
}
160163
buf.append("\t\t\t});\r\n");
161164
buf.append("\t\t});\r\n");
@@ -183,10 +186,11 @@ public static void launchingJ2SUnit(ILaunchConfiguration configuration, String m
183186
}
184187
}
185188
}
189+
StringmainTypeName =newASTTypeVisitor().assureQualifiedName(mainType);
186190
if (isTestSuite) {
187-
buf.append("\t\tjunit.textui.TestRunner.run (" +mainType +".suite ());\r\n");
191+
buf.append("\t\tjunit.textui.TestRunner.run (" +mainTypeName +".suite ());\r\n");
188192
}else {
189-
buf.append("\t\tjunit.textui.TestRunner.run (" +mainType +");\r\n");
193+
buf.append("\t\tjunit.textui.TestRunner.run (" +mainTypeName +");\r\n");
190194
}
191195
buf.append("\t});\r\n");
192196
buf.append("});\r\n");
@@ -292,7 +296,8 @@ public static void launchingJ2SApp(ILaunchConfiguration configuration, String mo
292296
grelativePath,mainType,workingDir,configuration);
293297

294298
buf.append("\t\tClazzLoader.loadClass (\"" +mainType +"\", function () {\r\n");
295-
buf.append("\t\t\t" +mainType +".main(" +ArgsUtil.wrapAsArgumentArray(args,true) +");\r\n");
299+
StringmainTypeName =newASTTypeVisitor().assureQualifiedName(mainType);
300+
buf.append("\t\t\t" +mainTypeName +".main(" +ArgsUtil.wrapAsArgumentArray(args,true) +");\r\n");
296301
buf.append("\t\t});\r\n");
297302

298303
buf.append("\t}\r\n");
@@ -305,7 +310,8 @@ public static void launchingJ2SApp(ILaunchConfiguration configuration, String mo
305310
isJUnit,grelativePath,workingDir,configuration);
306311

307312
buf.append("ClazzLoader.loadClass (\"" +mainType +"\", function () {\r\n");
308-
buf.append("\t" +mainType +".main(" +ArgsUtil.wrapAsArgumentArray(args,true) +");\r\n");
313+
StringmainTypeName =newASTTypeVisitor().assureQualifiedName(mainType);
314+
buf.append("\t" +mainTypeName +".main(" +ArgsUtil.wrapAsArgumentArray(args,true) +");\r\n");
309315
buf.append("});\r\n");
310316
}
311317

@@ -443,7 +449,15 @@ private static void generateFirefoxAddonPreJavaScript(StringBuffer buf,
443449
buf.append("\t/*forward : true,*/\r\n");
444450
buf.append("\tmode :\"dailybuild\",\r\n");
445451
buf.append("\tonload : function () {\r\n");
446-
452+
Stringj2xStr =J2SLaunchingUtil.generateClasspathJ2X(configuration,"j2slibPath",workingDir);
453+
if (j2xStr !=null &&j2xStr.length() !=0) {
454+
buf.append("\t\tvar o = window[\"j2s.lib\"];\r\n");
455+
buf.append("\t\tvar j2slibPath = o.base + (o.alias ? o.alias : o.version) +\"/\";\r\n");
456+
buf.append("\t\t");
457+
buf.append(j2xStr.replaceAll("\r\n","\r\n\t\t").trim());
458+
buf.append("\r\n");
459+
}
460+
447461
buf.append("\t\tClazzLoader.setPrimaryFolder (\"");
448462
buf.append(grelativePath);
449463
buf.append("\");\r\n");
@@ -459,7 +473,9 @@ private static String generatePreJavaScript(StringBuffer buf, String args,
459473
StringgrelativePath,Stringgj2sLibPath,booleanisJUnit,Stringmode,
460474
StringmainType,FileworkingDir,ILaunchConfigurationconfiguration)
461475
throwsCoreException {
462-
buf.append("<a class=\"alaa\" href=\"#"diff-1e6af5394313451ff7b8dbb93b07fbe10b2419cf605eb85a535fc714985524e8-462-476-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">
476+
buf.append("<a class=\"alaa\" title=\"Launch ");
477+
buf.append(mainType);
478+
buf.append("\" href=\"#"diff-1e6af5394313451ff7b8dbb93b07fbe10b2419cf605eb85a535fc714985524e8-463-479-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">463
479
buf.append(mainType);
464480
buf.append('@');
465481
buf.append(grelativePath);
@@ -481,6 +497,7 @@ private static String generatePreJavaScript(StringBuffer buf, String args,
481497
buf.append(gj2sLibPath);
482498
buf.append("j2slib.z.js';(typeof x[t]=='undefined')?x.onload=f:x[t]=f;" +
483499
"d.getElementsByTagName('HEAD')[0].appendChild(x);void(0);}\">");
500+
buf.append("<span class=\"alaa-icon\"></span>");
484501
buf.append(mainType);
485502
buf.append("</a>\r\n\r\n");
486503

@@ -490,7 +507,7 @@ private static String generatePreJavaScript(StringBuffer buf, String args,
490507
buf.append("<script type=\"text/javascript\">\r\n");
491508

492509
J2SCyclicProjectUtils.emptyTracks();
493-
Stringj2xStr =J2SLaunchingUtil.generateClasspathJ2X(configuration,mainType,workingDir);
510+
Stringj2xStr =J2SLaunchingUtil.generateClasspathJ2X(configuration,null,workingDir);
494511

495512
if ("debug".equals(mode)) {
496513
buf.append("window[\"j2s.script.debugging\"] = true;\r\n");
@@ -549,13 +566,20 @@ private static void generateJ2SHeaderHTML(StringBuffer buf,
549566
"\twidth:1em;\r\n" +
550567
"\toverflow-x:visible;\r\n" +
551568
"\ttext-decoration:none;\r\n" +
552-
"\tborder-left:1em solid rgb(57,61,254);\r\n" +
553-
"\tpadding-left:4px;\r\n" +
569+
"\tpadding-left:32px;\r\n" +
554570
"\tmargin:2em;\r\n" +
555571
"\tcolor:navy;\r\n" +
556572
"\tcursor:pointer;\r\n" +
557573
"\tcursor:hand;\r\n");
558574
buf.append("}\r\n");
575+
buf.append("span.alaa-icon {\r\n");
576+
buf.append("\tdisplay:block;\r\n" +
577+
"\tposition:absolute;\r\n" +
578+
"\twidth:16px;\r\n" +
579+
"\theight:16px;\r\n" +
580+
"\tmargin:2px 8px 0 -24px;\r\n" +
581+
"\tbackground-color:rgb(57,61,254);\r\n");
582+
buf.append("}\r\n");
559583
buf.append("</style>\r\n");
560584
buf.append("</head>\r\n");
561585
buf.append("<body>\r\n");
@@ -667,7 +691,7 @@ static String generateClasspathHTML(
667691
* Append the *.js in classpath
668692
*/
669693
staticStringgenerateClasspathJ2X(
670-
ILaunchConfigurationconfiguration,StringmainType,FileworkingDir)
694+
ILaunchConfigurationconfiguration,StringvarName,FileworkingDir)
671695
throwsCoreException {
672696
booleanisUseGlobalURL =configuration.getAttribute(IJ2SLauchingConfiguration.USE_GLOBAL_ALAA_URL,false);
673697
StringBufferbuf =newStringBuffer();
@@ -783,7 +807,7 @@ public boolean accept(File pathname) {
783807
keyPkg.add(pkg);
784808
buf.append("ClazzLoader.packageClasspath (\"");
785809
buf.append(pkg);
786-
buf.append("\",\"");
810+
buf.append("\", ");
787811
Stringj2slibPath =FileUtil.toRelativePath(f.getParent(),workingDir.getAbsolutePath());
788812
Stringgj2sLibPath =j2slibPath;
789813
if (isUseGlobalURL) {
@@ -795,8 +819,13 @@ public boolean accept(File pathname) {
795819
gj2sLibPath +="/";
796820
}
797821
}
798-
buf.append(gj2sLibPath);
799-
buf.append("\"");
822+
if (varName ==null) {
823+
buf.append("\"");
824+
buf.append(gj2sLibPath);
825+
buf.append("\"");
826+
}else {
827+
buf.append(varName);
828+
}
800829
FilepkgFile =newFile(f.getParentFile(),pkg.replace('.','/') +"/package.js");
801830
if (pkgFile.exists()) {
802831
buf.append(", true");
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
packagenet.sf.j2s.ui.launching;
2+
3+
importorg.eclipse.debug.core.DebugException;
4+
importorg.eclipse.debug.core.ILaunch;
5+
importorg.eclipse.debug.core.model.IProcess;
6+
importorg.eclipse.debug.core.model.IStreamsProxy;
7+
8+
publicclassJ2SProcessimplementsIProcess {
9+
10+
privateILaunchlaunch;
11+
12+
privateStringlabel;
13+
14+
publicJ2SProcess(ILaunchlaunch,Stringlabel) {
15+
super();
16+
this.launch =launch;
17+
this.label =label;
18+
}
19+
20+
publicStringgetAttribute(Stringkey) {
21+
returnnull;
22+
}
23+
24+
publicintgetExitValue()throwsDebugException {
25+
return0;
26+
}
27+
28+
publicStringgetLabel() {
29+
returnlabel;
30+
}
31+
32+
publicILaunchgetLaunch() {
33+
returnlaunch;
34+
}
35+
36+
publicIStreamsProxygetStreamsProxy() {
37+
returnnull;
38+
}
39+
40+
publicvoidsetAttribute(Stringkey,Stringvalue) {
41+
}
42+
43+
publicObjectgetAdapter(Classadapter) {
44+
returnnull;
45+
}
46+
47+
publicbooleancanTerminate() {
48+
returntrue;
49+
}
50+
51+
publicbooleanisTerminated() {
52+
// J2S process is terminated already as there is no way to monitor it
53+
returntrue;
54+
}
55+
56+
publicvoidterminate()throwsDebugException {
57+
}
58+
59+
}

‎src/net/sf/j2s/ui/launching/J2SUnitConfigurationDelegate.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
packagenet.sf.j2s.ui.launching;
22

3+
importjava.io.File;
4+
35
importorg.eclipse.core.runtime.CoreException;
46
importorg.eclipse.core.runtime.IProgressMonitor;
57
importorg.eclipse.debug.core.ILaunch;
@@ -17,6 +19,13 @@ public void launch(ILaunchConfiguration configuration, String mode,
1719
if (configuration !=null) {
1820
try {
1921
J2SLaunchingUtil.launchingJ2SUnit(configuration,mode,"junit.html");
22+
StringmainType =J2SLaunchingUtil.getMainType(configuration);
23+
if (mainType !=null) {
24+
FileworkingDir =J2SLaunchingUtil.getWorkingDirectory(configuration);
25+
if (workingDir !=null) {
26+
launch.addProcess(newJ2SProcess(launch,newFile(workingDir,mainType +".junit.html").getAbsolutePath()));
27+
}
28+
}
2029
}catch (CoreExceptione) {
2130
e.printStackTrace();
2231
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp