Skip to content

Commit 9031b03

Browse files
authored
Merge pull request #134 from BobHanson/master
Image.getScaledInstance, javax.annotation
2 parents 1fd5dda + 4e1e0f5 commit 9031b03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1525
-177
lines changed
8.7 KB
Binary file not shown.
1.11 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20191024113542
1+
20191025154731
8.7 KB
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20191024113542
1+
20191025154731

sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ public class CorePlugin extends Plugin {
2020
*
2121
*/
2222
public static String VERSION = "3.2.4.08";
23-
// BH 2019.10.24 support for multiple buildStart
23+
// BH 2019.10.25 -- 3.2.4.09 adds j2s.compiler.java.version (default 8)
24+
// BH 2019.10.25 -- 3.2.4.09 adds j2s.break.on.error (default false)
25+
// BH 2019.10.25 -- 3.2.4.09 fixes missing resource copy for git projects
26+
// BH 2019.10.24 -- 3.2.4.08 support for multiple buildStart
2427
// TODO/NOTE final static int FOO = (/**@j2sNative 5 || */3) stated but not recognized when used as its new value
2528
// BH 2/3/2019 -- 3.2.4.07 fixes "final static Float = (float)" missing definition
2629
// BH 1/2/2019 -- 3.2.4.06 fixes try(resources) with more than one resource missing semicolon

sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptCompilationParticipant.java

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.sf.j2s.core;
22

33
import java.util.ArrayList;
4+
import java.util.Date;
45

56
import org.eclipse.core.resources.IFile;
67
import org.eclipse.jdt.core.IJavaProject;
@@ -21,7 +22,7 @@ public class Java2ScriptCompilationParticipant extends org.eclipse.jdt.core.comp
2122
private static String isActiveNotified = "";
2223

2324
public Java2ScriptCompilationParticipant() {
24-
System.out.println("CompilationParticipant started");
25+
System.out.println("J2S CompilationParticipant started");
2526
}
2627

2728
/**
@@ -42,9 +43,11 @@ public Java2ScriptCompilationParticipant() {
4243
public boolean isActive(IJavaProject project) {
4344
boolean isj2s = Java2ScriptCompiler.isActive(project);
4445
String loc = " " + project.getProject().getLocation().toString() + " ";
45-
if (isActiveNotified.indexOf(loc) < 0) {
46-
System.out.println("j2s isActive " + isj2s + loc);
47-
isActiveNotified += loc;
46+
// notify only if changed
47+
if (isActiveNotified.indexOf(isj2s + loc) < 0) {
48+
System.out.println("J2S isActive " + isj2s + loc);
49+
isActiveNotified = isActiveNotified.replace((!isj2s) + loc, "");
50+
isActiveNotified += isj2s + loc;
4851
}
4952
return isj2s;
5053
}
@@ -66,7 +69,7 @@ public boolean isActive(IJavaProject project) {
6669
*/
6770
@Override
6871
public int aboutToBuild(IJavaProject project) {
69-
System.out.println("j2s aboutToBuild " + project.getProject().getName() + " " + project.getProject().getLocation());
72+
System.out.println("J2S aboutToBuild " + project.getProject().getName() + " " + project.getProject().getLocation());
7073
if (contexts == null)
7174
contexts = new ArrayList<>();
7275
return READY_FOR_BUILD;
@@ -82,7 +85,7 @@ public int aboutToBuild(IJavaProject project) {
8285
*/
8386
@Override
8487
public void cleanStarting(IJavaProject project) {
85-
System.out.println("j2s cleanStarting " + project.getProject().getLocation());
88+
System.out.println("J2S cleanStarting " + project.getProject().getLocation());
8689
isCleanBuild = true;
8790
}
8891

@@ -103,7 +106,7 @@ public void buildStarting(BuildContext[] files, boolean isBatch) {
103106
if (files.length == 0)
104107
return;
105108
contexts.add(files);
106-
System.out.println("j2s buildStarting " + files.length + " files, contexts.size() = " + contexts.size() + ", isBatch=" + isBatch);
109+
System.out.println("J2S buildStarting " + files.length + " files, contexts.size() = " + contexts.size() + ", isBatch=" + isBatch);
107110
}
108111

109112
/**
@@ -117,20 +120,20 @@ public void buildStarting(BuildContext[] files, boolean isBatch) {
117120
*/
118121
@Override
119122
public void buildFinished(IJavaProject project) {
120-
if (contexts != null) {
123+
if (contexts != null && contexts.size() > 0) {
121124
Java2ScriptCompiler j2sCompiler = new Java2ScriptCompiler();
122-
boolean breakOnError = j2sCompiler.doBreakOnError();
123125
j2sCompiler.startBuild(isCleanBuild);
124126
if (!j2sCompiler.initializeProject(project, true)) {
125-
System.out.println(".j2s disabled");
127+
System.out.println("J2S .j2s disabled");
126128
return;
127129
}
128-
System.out.println("j2s building JavaScript " + project.getProject().getName() + " "
129-
+ project.getProject().getLocation());
130+
boolean breakOnError = j2sCompiler.doBreakOnError();
131+
System.out.println("J2S building JavaScript " + project.getProject().getName() + " "
132+
+ project.getProject().getLocation() + " " + new Date());
130133
int ntotal = 0, nerror = 0;
131134
for (int j = 0; j < contexts.size(); j++) {
132135
BuildContext[] files = contexts.get(j);
133-
System.out.println("j2s building JavaScript for " + files.length + " file"+plural(files.length));
136+
System.out.println("J2S building JavaScript for " + files.length + " file"+plural(files.length));
134137

135138
for (int i = 0, n = files.length; i < n; i++) {
136139
// trying to keep the progess monitor running - didn't work
@@ -139,37 +142,38 @@ public void buildFinished(IJavaProject project) {
139142
// } catch (InterruptedException e) {
140143
// // ignore
141144
// }
142-
// System.out.println("j2s file"
145+
// System.out.println("J2S file"
143146
// + " name=" + files[i].getFile().getName()
144147
// + " fullpath=" + files[i].getFile().getFullPath()
145148
// + " location=" + files[i].getFile().getLocation());
146149
//
147150
IFile f = files[i].getFile();
148151
String filePath = f.getLocation().toString();
149152
if (j2sCompiler.excludeFile(f)) {
150-
System.out.println("j2s excluded " + filePath);
153+
System.out.println("J2S excluded " + filePath);
151154
} else {
152-
System.out.println("j2s transpiling (" + (i + 1) + "/" + n + ") " + filePath);
155+
System.out.println("J2S transpiling (" + (i + 1) + "/" + n + ") " + filePath);
153156
if (j2sCompiler.compileToJavaScript(f)) {
154157
ntotal++;
155158
} else {
156159
nerror++;
157-
System.out.println("j2s Error processing " + filePath);
160+
System.out.println("J2S Error processing " + filePath);
158161
if (breakOnError)
159162
break;
160163
}
161164
}
162165
}
163166
}
167+
j2sCompiler.finalizeProject();
164168
contexts = null;
165169
System.out.println(
166-
"j2s buildFinished " + ntotal + " file"+plural(ntotal) + " transpiled for " + project.getProject().getLocation());
167-
System.out.println("j2s buildFinished nerror = " + nerror);
170+
"J2S buildFinished " + ntotal + " file"+plural(ntotal) + " transpiled for " + project.getProject().getLocation());
171+
System.out.println("J2S buildFinished nerror = " + nerror + " " + new Date());
168172
}
169173
isCleanBuild = false;
170174
}
171175

172-
private static String plural(int n) {
176+
static String plural(int n) {
173177
return (n == 1 ? "" : "s");
174178
}
175179

0 commit comments

Comments
 (0)