6806224: PIT : Getting java.lang.NullPointerException while opening Filedialog

Reviewed-by: art, dav
This commit is contained in:
Dmitry Cherepanov 2009-02-19 14:10:19 +03:00
parent c59552fc2d
commit a1117d31b6
2 changed files with 14 additions and 22 deletions

View File

@ -166,7 +166,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
enableLog.log(Level.FINE, "Initial enable state: {0}", new Object[] {Boolean.valueOf(enabled)}); enableLog.log(Level.FINE, "Initial enable state: {0}", new Object[] {Boolean.valueOf(enabled)});
if (target.isVisible()) { if (target.isVisible()) {
show(); setVisible(true);
} }
} }
@ -496,10 +496,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
xSetVisible(b); xSetVisible(b);
} }
public void show() {
setVisible(true);
}
public void hide() { public void hide() {
setVisible(false); setVisible(false);
} }

View File

@ -739,7 +739,17 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
this.filter = filter; this.filter = filter;
} }
public void show() {
public void dispose() {
FileDialog fd = (FileDialog)fileDialog;
if (fd != null) {
fd.removeAll();
}
super.dispose();
}
// 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
public void setVisible(boolean b){
if (fileDialog == null) { if (fileDialog == null) {
init((FileDialog)target); init((FileDialog)target);
} }
@ -754,34 +764,20 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
setFile(savedFile); setFile(savedFile);
} }
super.show();
selectionField.requestFocusInWindow();
}
public void dispose() {
FileDialog fd = (FileDialog)fileDialog;
if (fd != null) {
fd.removeAll();
}
super.dispose();
}
// 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
public void setVisible(boolean b){
super.setVisible(b); super.setVisible(b);
if (b == true){ if (b == true){
// See 6240074 for more information // See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.addXChoicePeerListener(this); choicePeer.addXChoicePeerListener(this);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
}else{ }else{
// See 6240074 for more information // See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.removeXChoicePeerListener(); choicePeer.removeXChoicePeerListener();
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this); KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
} }
selectionField.requestFocusInWindow();
} }
/* /*