Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » M6 blocking Dialog and Virtual table
M6 blocking Dialog and Virtual table [message #45087] Tue, 04 September 2007 15:48 Go to next message
Andreas Krieg is currently offline Andreas KriegFriend
Messages: 5
Registered: July 2009
Junior Member
Hello all,

Isn't is possible to call two blocking Dialogs one after the other? The
second Dialog cannot be closed with OK or Cancel and the hole app hangs for
example:

boolean bRes = MessageDialog.openQuestion(null, "Test1", "My first
question");
if(bRes == true)
bRes = MessageDialog.openQuestion(null, "Test2", "My first second
question");

My second problem is Refreshing a Virtual table. I want to make an
application that get's the data from a Database (Jobs). I use a virtual
table because data can grow to many records. If the user now deletes a
record or changes an attribute, I want to refresh the table, which means the
table must call the SWT.SetData Event Handler. In my opinion the correct way
is to call table.clearAll() and then call table.setItemCount().

Now after these two functions, sometimes the table does display NOTHING when
scrolling up or down.

I made a Test ViewPart for this with the following code:

package raptest;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.part.ViewPart;

public class TableTestViewPart extends ViewPart {
private Table table;
private Action refresh;
private int jobSize = 25;
public TableTestViewPart() {
// TODO Auto-generated constructor stub
}

@Override
public void createPartControl(Composite parent) {
table = new Table(parent, SWT.MULTI|SWT.VIRTUAL);
for(int i=0;i<10;i++)
createColumn(table, "Column#" + i, 100);

table.setHeaderVisible(true);
table.setLinesVisible(true);

table.addListener( SWT.SetData, new Listener() {
public void handleEvent( final Event event ) {
System.out.println("SetData Event Start");
TableItem item = ( TableItem )event.item;
int index = table.indexOf( item );
System.out.println("GetData for row#" + index);
for(int i=0;i<table.getColumnCount();i++) {
item.setText(i, "row#" + index + " - item#"+i);
}
System.out.println("SetData Event End");
}
} );

makeActions();
contributeToActionBars();
table.setItemCount(25);
}

private void makeActions() {
refresh = new Action() {
public void run() {

boolean bRet = MessageDialog.openQuestion(null, "Refresh", "Refresh the
view?");
// if(bRet)
// bRet = MessageDialog.openQuestion(null, "Refresh", "Really Refresh
the view?");
if(bRet) {
long start = System.currentTimeMillis();
// needed for spring class loading
System.out.println("Refresh Start");
try {
table.clearAll();
jobSize += 10;
table.setItemCount(jobSize);
} catch (Exception ex) {
ex.printStackTrace();
} finally {
System.out.println("JobsSize:" + jobSize);
}
long end = System.currentTimeMillis();
System.out.println(">>> Refresh time: " + (end-start) + " ms");
//$NON-NLS-1$ //$NON-NLS-2$
System.out.println("Refresh JobList End");
}
}
};
refresh.setText("Refresh");
refresh.setToolTipText("Refresh the table");
refresh.setImageDescriptor(ImageDescriptor.createFromFile(Ac tivator.class,
"icons/refresh.gif"));

}

@Override
public void setFocus() {
table.setFocus();
}

public void createColumn(Table table, String header, int width) {
TableColumn col = new TableColumn(table, SWT.LEFT);
col.setText(header);
col.setWidth(width);
}

private void fillLocalToolBar(IToolBarManager manager) {
manager.add(new Separator());
manager.add(refresh);
manager.add(new Separator());
}

private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
fillLocalToolBar(bars.getToolBarManager());
}


}


What's wrong or is there a problem with the current table implementation?

Thanks,

Andreas
Re: M6 blocking Dialog and Virtual table [message #45211 is a reply to message #45087] Tue, 04 September 2007 18:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: b.muskalla.gmx.net

Hi Andreas,

nice to see new names here :-)

Answer are in your post...

Andreas Krieg wrote:
> Hello all,
>
> Isn't is possible to call two blocking Dialogs one after the other? The
> second Dialog cannot be closed with OK or Cancel and the hole app hangs for
> example:
>
> boolean bRes = MessageDialog.openQuestion(null, "Test1", "My first
> question");
> if(bRes == true)
> bRes = MessageDialog.openQuestion(null, "Test2", "My first second
> question");

I think there was a deadlock in such situations. Frank landed a fix in
CVS which is not released with M6. Maybe you could try it with CVS HEAD
to see if the problem persists. If so, please file a bug report with a
little snippet to reproduce.

>
> My second problem is Refreshing a Virtual table. I want to make an
> application that get's the data from a Database (Jobs). I use a virtual
> table because data can grow to many records. If the user now deletes a
> record or changes an attribute, I want to refresh the table, which means the
> table must call the SWT.SetData Event Handler. In my opinion the correct way
> is to call table.clearAll() and then call table.setItemCount().
>
> Now after these two functions, sometimes the table does display NOTHING when
> scrolling up or down.
>
> I made a Test ViewPart for this with the following code:
>
> package raptest;
>
> import org.eclipse.jface.action.Action;
> import org.eclipse.jface.action.IToolBarManager;
> import org.eclipse.jface.action.Separator;
> import org.eclipse.jface.dialogs.MessageDialog;
> import org.eclipse.jface.resource.ImageDescriptor;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Event;
> import org.eclipse.swt.widgets.Listener;
> import org.eclipse.swt.widgets.Table;
> import org.eclipse.swt.widgets.TableColumn;
> import org.eclipse.swt.widgets.TableItem;
> import org.eclipse.ui.IActionBars;
> import org.eclipse.ui.part.ViewPart;
>
> public class TableTestViewPart extends ViewPart {
> private Table table;
> private Action refresh;
> private int jobSize = 25;
> public TableTestViewPart() {
> // TODO Auto-generated constructor stub
> }
>
> @Override
> public void createPartControl(Composite parent) {
> table = new Table(parent, SWT.MULTI|SWT.VIRTUAL);
> for(int i=0;i<10;i++)
> createColumn(table, "Column#" + i, 100);
>
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
>
> table.addListener( SWT.SetData, new Listener() {
> public void handleEvent( final Event event ) {
> System.out.println("SetData Event Start");
> TableItem item = ( TableItem )event.item;
> int index = table.indexOf( item );
> System.out.println("GetData for row#" + index);
> for(int i=0;i<table.getColumnCount();i++) {
> item.setText(i, "row#" + index + " - item#"+i);
> }
> System.out.println("SetData Event End");
> }
> } );
>
> makeActions();
> contributeToActionBars();
> table.setItemCount(25);
> }
>
> private void makeActions() {
> refresh = new Action() {
> public void run() {
>
> boolean bRet = MessageDialog.openQuestion(null, "Refresh", "Refresh the
> view?");
> // if(bRet)
> // bRet = MessageDialog.openQuestion(null, "Refresh", "Really Refresh
> the view?");
> if(bRet) {
> long start = System.currentTimeMillis();
> // needed for spring class loading
> System.out.println("Refresh Start");
> try {
> table.clearAll();
> jobSize += 10;
> table.setItemCount(jobSize);
> } catch (Exception ex) {
> ex.printStackTrace();
> } finally {
> System.out.println("JobsSize:" + jobSize);
> }
> long end = System.currentTimeMillis();
> System.out.println(">>> Refresh time: " + (end-start) + " ms");
> //$NON-NLS-1$ //$NON-NLS-2$
> System.out.println("Refresh JobList End");
> }
> }
> };
> refresh.setText("Refresh");
> refresh.setToolTipText("Refresh the table");
> refresh.setImageDescriptor(ImageDescriptor.createFromFile(Ac tivator.class,
> "icons/refresh.gif"));
>
> }
>
> @Override
> public void setFocus() {
> table.setFocus();
> }
>
> public void createColumn(Table table, String header, int width) {
> TableColumn col = new TableColumn(table, SWT.LEFT);
> col.setText(header);
> col.setWidth(width);
> }
>
> private void fillLocalToolBar(IToolBarManager manager) {
> manager.add(new Separator());
> manager.add(refresh);
> manager.add(new Separator());
> }
>
> private void contributeToActionBars() {
> IActionBars bars = getViewSite().getActionBars();
> fillLocalToolBar(bars.getToolBarManager());
> }
>
>
> }
>
>
> What's wrong or is there a problem with the current table implementation?

Yes this looks strange. A little hint: If you scroll to the end of the
table it works again. But really looks like a bug in our table
implementation.

Just open a bug for it, attach the snippet and if time permits Rüdiger
will care for it.


>
> Thanks,
>
> Andreas
>
>
Greets
Benny
Re: M6 blocking Dialog and Virtual table [message #45360 is a reply to message #45211] Wed, 05 September 2007 09:05 Go to previous message
Andreas Krieg is currently offline Andreas KriegFriend
Messages: 5
Registered: July 2009
Junior Member
Hi Benny,

"Benjamin Muskalla" <b.muskalla@gmx.net> schrieb im Newsbeitrag
news:fbk9q1$rsu$1@build.eclipse.org...
> Hi Andreas,
>
> nice to see new names here :-)
>

Thanks for welcome! I played around with M1 version but then didn't have the
time to go deeper, but now I'm going to spend more time to RAP, and so, I
just can say, *Congratulations* to the RAP team for that great framework.

It's just a pleasure to take existing Dialogs and more code from RCP and see
it working in a browser with very small effort of porting the code!!

Ok, I checked out the current code and checked both problems, they are still
there and I filed out bugs #202237 and #202248.

Thanks and Greets from Stuttgart to Karlsruhe:-),
Andreas

> Answer are in your post...
>
> Andreas Krieg wrote:
>> Hello all,
>>
>> Isn't is possible to call two blocking Dialogs one after the other? The
>> second Dialog cannot be closed with OK or Cancel and the hole app hangs
>> for example:
>>
>> boolean bRes = MessageDialog.openQuestion(null, "Test1", "My first
>> question");
>> if(bRes == true)
>> bRes = MessageDialog.openQuestion(null, "Test2", "My first second
>> question");
>
> I think there was a deadlock in such situations. Frank landed a fix in CVS
> which is not released with M6. Maybe you could try it with CVS HEAD to see
> if the problem persists. If so, please file a bug report with a little
> snippet to reproduce.
>
>>
>> My second problem is Refreshing a Virtual table. I want to make an
>> application that get's the data from a Database (Jobs). I use a virtual
>> table because data can grow to many records. If the user now deletes a
>> record or changes an attribute, I want to refresh the table, which means
>> the table must call the SWT.SetData Event Handler. In my opinion the
>> correct way is to call table.clearAll() and then call
>> table.setItemCount().
>>
>> Now after these two functions, sometimes the table does display NOTHING
>> when scrolling up or down.
>>
>> I made a Test ViewPart for this with the following code:
>>
>> package raptest;
>>
>> import org.eclipse.jface.action.Action;
>> import org.eclipse.jface.action.IToolBarManager;
>> import org.eclipse.jface.action.Separator;
>> import org.eclipse.jface.dialogs.MessageDialog;
>> import org.eclipse.jface.resource.ImageDescriptor;
>> import org.eclipse.swt.SWT;
>> import org.eclipse.swt.widgets.Composite;
>> import org.eclipse.swt.widgets.Event;
>> import org.eclipse.swt.widgets.Listener;
>> import org.eclipse.swt.widgets.Table;
>> import org.eclipse.swt.widgets.TableColumn;
>> import org.eclipse.swt.widgets.TableItem;
>> import org.eclipse.ui.IActionBars;
>> import org.eclipse.ui.part.ViewPart;
>>
>> public class TableTestViewPart extends ViewPart {
>> private Table table;
>> private Action refresh;
>> private int jobSize = 25;
>> public TableTestViewPart() {
>> // TODO Auto-generated constructor stub
>> }
>>
>> @Override
>> public void createPartControl(Composite parent) {
>> table = new Table(parent, SWT.MULTI|SWT.VIRTUAL);
>> for(int i=0;i<10;i++)
>> createColumn(table, "Column#" + i, 100);
>>
>> table.setHeaderVisible(true);
>> table.setLinesVisible(true);
>>
>> table.addListener( SWT.SetData, new Listener() {
>> public void handleEvent( final Event event ) {
>> System.out.println("SetData Event Start");
>> TableItem item = ( TableItem )event.item;
>> int index = table.indexOf( item );
>> System.out.println("GetData for row#" + index);
>> for(int i=0;i<table.getColumnCount();i++) {
>> item.setText(i, "row#" + index + " - item#"+i);
>> }
>> System.out.println("SetData Event End");
>> }
>> } );
>>
>> makeActions();
>> contributeToActionBars();
>> table.setItemCount(25);
>> }
>>
>> private void makeActions() {
>> refresh = new Action() {
>> public void run() {
>>
>> boolean bRet = MessageDialog.openQuestion(null, "Refresh", "Refresh
>> the view?");
>> // if(bRet)
>> // bRet = MessageDialog.openQuestion(null, "Refresh", "Really Refresh
>> the view?");
>> if(bRet) {
>> long start = System.currentTimeMillis();
>> // needed for spring class loading
>> System.out.println("Refresh Start");
>> try {
>> table.clearAll();
>> jobSize += 10;
>> table.setItemCount(jobSize);
>> } catch (Exception ex) {
>> ex.printStackTrace();
>> } finally {
>> System.out.println("JobsSize:" + jobSize);
>> }
>> long end = System.currentTimeMillis();
>> System.out.println(">>> Refresh time: " + (end-start) + "
>> ms"); //$NON-NLS-1$ //$NON-NLS-2$
>> System.out.println("Refresh JobList End");
>> }
>> }
>> };
>> refresh.setText("Refresh");
>> refresh.setToolTipText("Refresh the table");
>>
>> refresh.setImageDescriptor(ImageDescriptor.createFromFile(Ac tivator.class,
>> "icons/refresh.gif"));
>>
>> }
>>
>> @Override
>> public void setFocus() {
>> table.setFocus();
>> }
>>
>> public void createColumn(Table table, String header, int width) {
>> TableColumn col = new TableColumn(table, SWT.LEFT);
>> col.setText(header);
>> col.setWidth(width);
>> }
>>
>> private void fillLocalToolBar(IToolBarManager manager) {
>> manager.add(new Separator());
>> manager.add(refresh);
>> manager.add(new Separator());
>> }
>>
>> private void contributeToActionBars() {
>> IActionBars bars = getViewSite().getActionBars();
>> fillLocalToolBar(bars.getToolBarManager());
>> }
>>
>>
>> }
>>
>>
>> What's wrong or is there a problem with the current table implementation?
>
> Yes this looks strange. A little hint: If you scroll to the end of the
> table it works again. But really looks like a bug in our table
> implementation.
>
> Just open a bug for it, attach the snippet and if time permits R
Previous Topic:Embedding a texteditor
Next Topic:custom widget with external JS
Goto Forum:
  


Current Time: Sat Apr 20 11:49:05 GMT 2024

Powered by FUDForum. Page generated in 0.03476 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top