Can't update TableViewer when Button is pressed [message #329488] |
Thu, 26 June 2008 04:51 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hardy.oei.gmail.com
dear all,
I have a Button class that add a AddUserListener class so that whenever
a user clicked on it, it will reload the database data into the
TableViewer model and refresh the TableViewer. But then, I'm unable to
do so. Something is wrong and I don't know why.
This is a snippet of my code:
public class AddUserListener implements SelectionListener{
..
..
public void widgetSelected(SelectionEvent e) {
if(passwordForm.getText().equals(confirmPasswordForm.getText ())){
DBConnection.openConnection();
DBConnection.update("Insert into USER Values('"
+ userNameForm.getText()+"','"
+ nameForm.getText()+"','"
+ passwordForm.getText()+"','"
+ emailForm.getText()+"','"
+ new Date(Calendar.getInstance().getTime().getTime())
+ "')");
DBConnection.closeConnection();
//When this is called the table
//should update itself using
//refresh();
userTableViewer.notifyViewer();
//the application never execute these lines below
String message = "User with "
+ userNameForm.getText()
+" Success"; MessageDialog.openInformation(
((Button)e.getSource()).getShell()
, "Add User Success", message);
userNameForm.setText("");
nameForm.setText("");
passwordForm.setText("");
confirmPasswordForm.setText("");
emailForm.setText("");
}
}
..
..
}
This is the content of userTableViewer.notifyViewer() in the
UserTableViewer class :
public void notifyViewer() {
Display display = PlatformUI.getWorkbench().getDisplay();
display.asyncExec(new Runnable(){
public void run(){
DBConnection.openConnection();
ResultSet rs;
final CachedRowSet crs;
try {
rs = DBConnection.query("SELECT * FROM USER");
crs = new CachedRowSetImpl();
crs.populate(rs);
userTableViewer.refresh(crs);
DBConnection.closeConnection();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
});
}
I try to debug my program using eclipse, butwhenever the debug cursor
reach userTableViewer.notifyViewer(); line, it always goes to the
EventTable class. It seems that the application never execute the
userTableViewer.notifyViewer() line.
public void sendEvent (Event event) {
if (types == null) return;
level += level >= 0 ? 1 : -1;
try {
for (int i=0; i<types.length; i++) {
if (event.type == SWT.None) return;
if (types [i] == event.type) {
Listener listener = listeners [i];
if (listener != null) listener.handleEvent (event);
}
}
//The debug cursor start at this line.
} finally {
boolean compact = level < 0;
level -= level >= 0 ? 1 : -1;
if (compact && level == 0) {
int index = 0;
for (int i=0; i<types.length; i++) {
if (types [i] != 0) {
types [index] = types [i];
listeners [index] = listeners [i];
index++;
}
}
for (int i=index; i<types.length; i++) {
types [i] = 0;
listeners [i] = null;
}
}
}
}
That's my problem. I would be very grateful if someone have a look at my
problem and give a solution on it.
Regards,
Hardy
|
|
|
|
Re: Can't update TableViewer when Button is pressed [message #329492 is a reply to message #329490] |
Thu, 26 June 2008 07:28 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hardy.oei.gmail.com
Tom Schindl wrote:
> [...]
>>
>> This is the content of userTableViewer.notifyViewer() in the
>> UserTableViewer class :
>>
>> public void notifyViewer() {
>> Display display = PlatformUI.getWorkbench().getDisplay();
>> display.asyncExec(new Runnable(){
>> public void run(){
>> DBConnection.openConnection();
>> ResultSet rs;
>> final CachedRowSet crs;
>> try {
>> rs = DBConnection.query("SELECT * FROM USER");
>> crs = new CachedRowSetImpl();
>> crs.populate(rs);
>> userTableViewer.refresh(crs);
>
> This is the offending code. You should call
> userTableViewer.setInput(crs). Your code simply tells the viewer to
> rebuild the structure consulting the current content provider with the
> current input (which is your original one).
>
> The reason the debugger goes not straight into your run() code is that
> you are adding an event to the event queue (Display#asyncExec).
>
> By the way your code is wrong IMHO because you are doing whole blocking
> operation inside the Runnable#run-method and this means the UI freezes
> until your DB-operation finished.
>
> The code is better written like this:
>
> public void notifyViewer() {
> Display display = PlatformUI.getWorkbench().getDisplay();
> DBConnection.openConnection();
> ResultSet rs;
> final CachedRowSet crs;
> try {
> rs = DBConnection.query("SELECT * FROM USER");
> crs = new CachedRowSetImpl();
> crs.populate(rs);
> DBConnection.closeConnection();
> display.asyncExec( new Runnable() {
> public void run() {
> userTableViewer.setInput(crs);
> }
> });
> } catch (SQLException ex) {
> ex.printStackTrace();
> }
> }
>
> Tom
>
Thank you for the reply. I have configured the notifyViewer just as the
way you suggest, but still the table won't refresh itself in the GUI. I
even try to call userTableViewer.refresh() after the
userTableViewer.setInput(crs). But it doesn't work also. One thing that
I don't understand is:
If I put the userTableViewer.notifyViewer() before calling the Message
Dialog. When I run the application, the Message Dialog never shows up,
as if the application never execute anything below the
userTableViewer.notifyViewer(). Why is that happening?
...
userTableViewer.notifyViewer();
String message = "User with "+ userNameForm.getText()+" added
successfully";
MessageDialog.openInformation(((Button)e.getSource()).getShe ll(), "Add
User Success", message);
userNameForm.setText("");
nameForm.setText("");
passwordForm.setText("");
confirmPasswordForm.setText("");
emailForm.setText("");
...
Regards,
Hardy
|
|
|
|
Re: Can't update TableViewer when Button is pressed [message #329496 is a reply to message #329493] |
Thu, 26 June 2008 07:44 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hardy.oei.gmail.com
Tom Schindl wrote:
> Is this an RCP/Platform Plugin? Then run with -consoleLog and see if an
> exception is logged to the console. This definately looks like a
> Runtime-Exception happing some where in the notifyViewer-method.
>
> Tom
>
It seems this line below cause the error:
userTableViewer.setInput(crs);
But I don't know what's wrong with it. Any ideas?
The following is the error log:
!SESSION 2008-06-26 15:40:56.406
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=in_ID
Framework arguments: -product com.blodstone.server.rcp.product
Command-line arguments: -product com.blodstone.server.rcp.product -data
C:\Documents and
Settings\Supervisor\workspace/../runtime-com.blodstone.serve r.rcp.application
-dev file:C:/Documents and
Settings/Supervisor/workspace/.metadata/.plugins/org.eclipse .pde.core/com.blodstone.server.rcp.application/dev.propertie s
-os win32 -ws win32 -arch x86 -consoleLog
!ENTRY org.eclipse.ui 4 0 2008-06-26 15:41:08.031
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
at
com.blodstone.server.rcp.views.listeners.AddUserListener.wid getSelected(AddUserListener.java:82)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at com.blodstone.server.rcp.Application.start(Application.java: 20)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:382)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Regards,
Hardy
|
|
|
|
Re: Can't update TableViewer when Button is pressed [message #329498 is a reply to message #329497] |
Thu, 26 June 2008 08:30 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hardy.oei.gmail.com
Tom Schindl wrote:
> What's the code at AddUserListener.java:82?
>
> Tom
>
I've rewrite UserTableViewer class so that I can know which code is
really giving me the error.
Here is the class snippet:
if(passwordForm.getText().equals(confirmPasswordForm.getText ())){
DBConnection.openConnection();
DBConnection.update("Insert into USER Values('"
+ userNameForm.getText()+"','"
+ nameForm.getText()+"','"
+ passwordForm.getText()+"','"
+ emailForm.getText()+"','"
+ new Date(Calendar.getInstance().getTime().getTime())
+ "')");
DBConnection.closeConnection();
Display display = PlatformUI.getWorkbench().getDisplay();
DBConnection.openConnection();
ResultSet rs;
final CachedRowSet crs;
try {
rs = DBConnection.query("SELECT * FROM USER");
crs = new CachedRowSetImpl();
crs.populate(rs);
userTableViewer.setInput(crs);
display.asyncExec(new Runnable(){
public void run(){
userTableViewer.setInput(crs);
userTableViewer.refresh(false);
}
});
DBConnection.closeConnection();
}catch (SQLException ex) {
ex.printStackTrace();
}
String message = "User with "+ userNameForm.getText()+" adding success";
MessageDialog.openInformation(
((Button)e.getSource()
).getShell(), "Add User Success", message); userNameForm.setText("");
nameForm.setText("");
passwordForm.setText("");
confirmPasswordForm.setText("");
emailForm.setText("");
}
}
It give me this error
(com.blodstone.server.rcp.views.listeners.AddUserListener.wi dgetSelected(AddUserListener.java:94)is
MessageDialog.openInformation(((Button)e.getSource()).getShe ll(),
"Add User Success", message); )
:
!SESSION 2008-06-26 16:16:23.078
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=in_ID
Framework arguments: -product com.blodstone.server.rcp.product
Command-line arguments: -product com.blodstone.server.rcp.product -data
C:\Documents and
Settings\Supervisor\workspace/../runtime-com.blodstone.serve r.rcp.application
-dev file:C:/Documents and
Settings/Supervisor/workspace/.metadata/.plugins/org.eclipse .pde.core/com.blodstone.server.rcp.application/dev.propertie s
-os win32 -ws win32 -arch x86 -consoleLog
!ENTRY org.eclipse.ui 4 0 2008-06-26 16:16:34.437
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:3777)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3800)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3425)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825 )
at org.eclipse.jface.window.Window.open(Window.java:801)
at
org.eclipse.jface.dialogs.MessageDialog.openInformation(Mess ageDialog.java:346)
at
com.blodstone.server.rcp.views.listeners.AddUserListener.wid getSelected(AddUserListener.java:94)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at com.blodstone.server.rcp.Application.start(Application.java: 20)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:382)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.NullPointerException
at
com.blodstone.server.rcp.views.listeners.AddUserListener$1.r un(AddUserListener.java:85)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:133)
... 32 more
Regards,
Hardy
|
|
|
Re: Can't update TableViewer when Button is pressed [message #329500 is a reply to message #329498] |
Thu, 26 June 2008 09:09 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Thomas Schindl![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=tom.schindl%40bestsolution.at) Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
My guess is that:
e.getSource() is null. You should use e.widget instead.
Tom
Hardy schrieb:
> Tom Schindl wrote:
>> What's the code at AddUserListener.java:82?
>>
>> Tom
>>
> I've rewrite UserTableViewer class so that I can know which code is
> really giving me the error.
>
> Here is the class snippet:
>
> if(passwordForm.getText().equals(confirmPasswordForm.getText ())){
> DBConnection.openConnection();
> DBConnection.update("Insert into USER Values('"
> + userNameForm.getText()+"','"
> + nameForm.getText()+"','"
> + passwordForm.getText()+"','"
> + emailForm.getText()+"','"
> + new Date(Calendar.getInstance().getTime().getTime())
> + "')");
> DBConnection.closeConnection();
> Display display = PlatformUI.getWorkbench().getDisplay();
> DBConnection.openConnection();
> ResultSet rs;
> final CachedRowSet crs;
> try {
> rs = DBConnection.query("SELECT * FROM USER");
> crs = new CachedRowSetImpl();
> crs.populate(rs);
> userTableViewer.setInput(crs);
> display.asyncExec(new Runnable(){
> public void run(){
> userTableViewer.setInput(crs);
> userTableViewer.refresh(false);
> }
> });
> DBConnection.closeConnection();
> }catch (SQLException ex) {
> ex.printStackTrace();
> }
> String message = "User with "+ userNameForm.getText()+" adding
> success";
> MessageDialog.openInformation(
> ((Button)e.getSource()
> ).getShell(), "Add User Success", message);
> userNameForm.setText("");
> nameForm.setText("");
> passwordForm.setText("");
> confirmPasswordForm.setText("");
> emailForm.setText("");
> }
> }
>
> It give me this error
> (com.blodstone.server.rcp.views.listeners.AddUserListener.wi dgetSelected(AddUserListener.java:94)is
>
> MessageDialog.openInformation(((Button)e.getSource()).getShe ll(), "Add
> User Success", message); )
>
> :
>
> !SESSION 2008-06-26 16:16:23.078
> -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.6.0_01
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=in_ID
> Framework arguments: -product com.blodstone.server.rcp.product
> Command-line arguments: -product com.blodstone.server.rcp.product -data
> C:\Documents and
> Settings\Supervisor\workspace/../runtime-com.blodstone.serve r.rcp.application
> -dev file:C:/Documents and
> Settings/Supervisor/workspace/.metadata/.plugins/org.eclipse .pde.core/com.blodstone.server.rcp.application/dev.propertie s
> -os win32 -ws win32 -arch x86 -consoleLog
>
> !ENTRY org.eclipse.ui 4 0 2008-06-26 16:16:34.437
> !MESSAGE Unhandled event loop exception
> !STACK 0
> org.eclipse.swt.SWTException: Failed to execute runnable
> (java.lang.NullPointerException)
> at org.eclipse.swt.SWT.error(SWT.java:3777)
> at org.eclipse.swt.SWT.error(SWT.java:3695)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:136)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3800)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3425)
> at org.eclipse.jface.window.Window.runEventLoop(Window.java:825 )
> at org.eclipse.jface.window.Window.open(Window.java:801)
> at
> org.eclipse.jface.dialogs.MessageDialog.openInformation(Mess ageDialog.java:346)
>
> at
> com.blodstone.server.rcp.views.listeners.AddUserListener.wid getSelected(AddUserListener.java:94)
>
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at com.blodstone.server.rcp.Application.start(Application.java: 20)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:382)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> Caused by: java.lang.NullPointerException
> at
> com.blodstone.server.rcp.views.listeners.AddUserListener$1.r un(AddUserListener.java:85)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:133)
>
> ... 32 more
>
>
> Regards,
> Hardy
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
Re: Can't update TableViewer when Button is pressed [message #329502 is a reply to message #329500] |
Thu, 26 June 2008 09:26 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hardy.oei.gmail.com
Tom Schindl wrote:
> My guess is that:
>
> e.getSource() is null. You should use e.widget instead.
>
> Tom
>
> Hardy schrieb:
I changed to
MessageDialog.openInformation(((Button)e.widget).getShell(), "Add User
Success", message);
I still give me the same error log. And the table still won't refresh
itself also.
regards,
Hardy
|
|
|
|
Re: Can't update TableViewer when Button is pressed [message #329505 is a reply to message #329503] |
Thu, 26 June 2008 10:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: hardy.oei.gmail.com
Tom Schindl wrote:
> Hardy please use a Debugger and step through the code and see which
> variable is null in your case. You could also add a NullPointerException
> rule this way you can run your code with any break points and can jump
> right to the line the NPE occurred and inspect the variables.
>
> Could it be that "e" is null?
>
> Tom
>
> Hardy schrieb:
>> Tom Schindl wrote:
>>> My guess is that:
>>>
>>> e.getSource() is null. You should use e.widget instead.
>>>
>>> Tom
>>>
>>> Hardy schrieb:
>>
>> I changed to
>> MessageDialog.openInformation(((Button)e.widget).getShell(), "Add User
>> Success", message);
>> I still give me the same error log. And the table still won't refresh
>> itself also.
>>
>> regards,
>> Hardy
>
>
I think the problem lies within setinput(crs); because whenever I reach
that line using my debug. When I reach that line, it always goes to the
infinite loop within the workbench class. It keeps executing these lines:
private void runEventLoop(Window.IExceptionHandler handler, Display
display) {
runEventLoop = true;
//The runEventLoop is always true
while (runEventLoop) {
try {
//This is always false
if (!display.readAndDispatch()) {
getAdvisor().eventLoopIdle(display);
}
} catch (Throwable t) {
handler.handleException(t);
// In case Display was closed under us
if (display.isDisposed())
runEventLoop = false;
}
}
}
Is this behavior normal?
Regards,
Hardy
|
|
|
|
Powered by
FUDForum. Page generated in 0.04480 seconds