Skip to content

Commit 034ff6e

Browse files
author
zhourenjian
committed
Fixed bug for those projects with default source or binary folder
1 parent e125879 commit 034ff6e

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SConsoleOptionsTab.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public J2SConsoleOptionsTab() {
6969

7070
public void createControl(Composite parent) {
7171
Font font = parent.getFont();
72-
Composite comp = new Composite(parent, parent.getStyle());
72+
Composite comp = new Composite(parent, SWT.NONE);
7373
GridLayout layout = new GridLayout(1, true);
7474
comp.setLayout(layout);
7575
comp.setFont(font);
@@ -294,7 +294,7 @@ private String getCurrentBinPath(ILaunchConfiguration configuration) {
294294
}
295295
String path = javaProject.getOutputLocation().toString();
296296
int idx = path.indexOf('/', 2);
297-
String relativePath = "";
297+
String relativePath = "./";
298298
if (idx != -1) {
299299
relativePath = path.substring(idx + 1);
300300
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ public boolean accept(File pathname) {
283283
String gj2sLibPath = j2slibPath;
284284
if (isUseGlobalURL) {
285285
gj2sLibPath = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_J2SLIB_URL, j2slibPath);
286+
if (gj2sLibPath.length() == 0) {
287+
gj2sLibPath = "./";
288+
}
286289
if (!gj2sLibPath.endsWith("/")) {
287290
gj2sLibPath += "/";
288291
}
@@ -415,6 +418,9 @@ private static String generateClasspathExistedClasses (
415418
String glastLocation = lastLocation;
416419
if (isUseGlobalURL) {
417420
glastLocation = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_BINARY_URL, lastLocation);
421+
if (glastLocation.length() == 0) {
422+
glastLocation = "./";
423+
}
418424
if (!glastLocation.endsWith("/")) {
419425
glastLocation += "/";
420426
}
@@ -455,6 +461,9 @@ private static String generateClasspathExistedClasses (
455461
String glastLocation = lastLocation;
456462
if (isUseGlobalURL) {
457463
glastLocation = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_BINARY_URL, lastLocation);
464+
if (glastLocation.length() == 0) {
465+
glastLocation = "./";
466+
}
458467
if (!glastLocation.endsWith("/")) {
459468
glastLocation += "/";
460469
}
@@ -643,6 +652,9 @@ private static String generateHTML(ILaunchConfiguration configuration,
643652
String gj2sLibPath = j2sLibPath;
644653
if (isUseGlobalURL) {
645654
gj2sLibPath = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_J2SLIB_URL, j2sLibPath);
655+
if (gj2sLibPath.length() == 0) {
656+
gj2sLibPath = "./";
657+
}
646658
if (!gj2sLibPath.endsWith("/")) {
647659
gj2sLibPath += "/";
648660
}
@@ -705,6 +717,9 @@ private static String generateHTML(ILaunchConfiguration configuration,
705717
String grelativePath = relativePath;
706718
if (isUseGlobalURL) {
707719
grelativePath = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_BINARY_URL, relativePath);
720+
if (grelativePath.length() == 0) {
721+
grelativePath = "./";
722+
}
708723
if (!grelativePath.endsWith("/")) {
709724
grelativePath += "/";
710725
}

sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SUnitLaunchingUtil.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ public boolean accept(File pathname) {
284284
String gj2sLibPath = j2slibPath;
285285
if (isUseGlobalURL) {
286286
gj2sLibPath = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_J2SLIB_URL, j2slibPath);
287+
if (gj2sLibPath.length() == 0) {
288+
gj2sLibPath = "./";
289+
}
287290
if (!gj2sLibPath.endsWith("/")) {
288291
gj2sLibPath += "/";
289292
}
@@ -416,6 +419,9 @@ private static String generateClasspathExistedClasses (
416419
String glastLocation = lastLocation;
417420
if (isUseGlobalURL) {
418421
glastLocation = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_BINARY_URL, lastLocation);
422+
if (glastLocation.length() == 0) {
423+
glastLocation = "./";
424+
}
419425
if (!glastLocation.endsWith("/")) {
420426
glastLocation += "/";
421427
}
@@ -456,6 +462,9 @@ private static String generateClasspathExistedClasses (
456462
String glastLocation = lastLocation;
457463
if (isUseGlobalURL) {
458464
glastLocation = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_BINARY_URL, lastLocation);
465+
if (glastLocation.length() == 0) {
466+
glastLocation = "./";
467+
}
459468
if (!glastLocation.endsWith("/")) {
460469
glastLocation += "/";
461470
}
@@ -644,6 +653,9 @@ private static String generateHTML(ILaunchConfiguration configuration,
644653
String gj2sLibPath = j2sLibPath;
645654
if (isUseGlobalURL) {
646655
gj2sLibPath = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_J2SLIB_URL, j2sLibPath);
656+
if (gj2sLibPath.length() == 0) {
657+
gj2sLibPath = "./";
658+
}
647659
if (!gj2sLibPath.endsWith("/")) {
648660
gj2sLibPath += "/";
649661
}
@@ -706,6 +718,9 @@ private static String generateHTML(ILaunchConfiguration configuration,
706718
String grelativePath = relativePath;
707719
if (isUseGlobalURL) {
708720
grelativePath = configuration.getAttribute(IJ2SLauchingConfiguration.GLOBAL_BINARY_URL, relativePath);
721+
if (grelativePath.length() == 0) {
722+
grelativePath = "./";
723+
}
709724
if (!grelativePath.endsWith("/")) {
710725
grelativePath += "/";
711726
}

0 commit comments

Comments
 (0)