Skip to content

Commit 232ce43

Browse files
author
zhourenjian
committed
Fix bug that "new Shell((Display) null);" will throw exceptions.
1 parent 5042023 commit 232ce43

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

sources/net.sf.j2s.java.org.eclipse.jface/src/org/eclipse/jface/window/Window.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,12 @@ protected final Shell createShell() {
478478
}
479479

480480
//Create the shell
481-
Shell newShell = new Shell(newParent, getShellStyle());
481+
Shell newShell = null;
482+
if (newParent != null) {
483+
newShell = new Shell(newParent, getShellStyle());
484+
} else {
485+
newShell = new Shell((Shell) null, getShellStyle());
486+
}
482487

483488
resizeListener = new Listener() {
484489
public void handleEvent(Event e) {

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Shell.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ public class Shell extends Decorations {
163163
* </ul>
164164
*/
165165
public Shell () {
166-
this ((Display) null);
166+
//this ((Display) null);
167+
this (null, null, SWT.SHELL_TRIM, 0);
167168
}
168169

169170
/**
@@ -202,7 +203,8 @@ public Shell () {
202203
* @see SWT#SYSTEM_MODAL
203204
*/
204205
public Shell (int style) {
205-
this ((Display) null, style);
206+
//this ((Display) null, style);
207+
this (null, null, style, 0);
206208
}
207209

208210
/**
@@ -225,7 +227,8 @@ public Shell (int style) {
225227
* </ul>
226228
*/
227229
public Shell (Display display) {
228-
this (display, SWT.SHELL_TRIM);
230+
//this (display, SWT.SHELL_TRIM);
231+
this (display, null, SWT.SHELL_TRIM, 0);
229232
//this (display, OS.IsWinCE ? SWT.NONE : SWT.SHELL_TRIM);
230233
}
231234

@@ -328,7 +331,8 @@ public Shell (Display display, int style) {
328331
* </ul>
329332
*/
330333
public Shell (Shell parent) {
331-
this (parent, SWT.DIALOG_TRIM);
334+
//this (parent, SWT.DIALOG_TRIM);
335+
this (parent != null ? parent.display : null, parent, SWT.DIALOG_TRIM, 0);
332336
}
333337

334338
/**

sources/net.sf.j2s.lib/j2slib.zip

-58.6 KB
Binary file not shown.

sources/net.sf.j2s.lib/src/net/sf/j2s/lib/build/UTF8Concat.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void main(String[] args) {
4141
String j2sKeySig = "/* http://j2s.sf.net/ */";
4242
buf.append(j2sKeySig);
4343
System.out.println("To " + dest.getAbsolutePath());
44-
boolean isAllFileEarlier = dest.exists();
44+
boolean isAllFileEarlier = false; //dest.exists();
4545
if (isAllFileEarlier) {
4646
for (int i = 0; i < args.length - 1 - indexDelta; i++) {
4747
File src = new File(args[indexDelta], args[i + 1 + indexDelta]);
@@ -77,7 +77,6 @@ public static void main(String[] args) {
7777
buf.append(RegExCompress.regexCompress2(s));
7878
}
7979
//*/
80-
buf.append(s);
8180
} catch (FileNotFoundException e) {
8281
e.printStackTrace();
8382
return;

0 commit comments

Comments
 (0)