Content of List disappear after click Finish [message #446190] |
Fri, 19 November 2004 20:23 |
hung Messages: 117 Registered: July 2009 |
Senior Member |
|
|
Hello,
I have an action class that invokes a wizard. This wizard has a
wizardpage. The wizardPage has a composite. This composite contains a
List. Whenever I click Finish on the Wizard, the content of the list
disappear. This only occurs if I use "setNeedsProgressMonitor(true)".
Is this a bug? It works fine if I take out this
"setNeedsProgressMonitor(true)". appreciate any help.
Here is my sample code :
public class ListComposite extends Composite
{
List selectionList;
public ListComposite(Composite parent, int style)
{
super(parent, style);
GridLayout layout = new GridLayout();
setLayout(new GridLayout());
setLayoutData(new GridData(GridData.FILL_BOTH));
selectionList = new List(this,SWT.BORDER | SWT.V_SCROLL |
SWT.SINGLE | SWT.H_SCROLL);
selectionList.setLayoutData(new GridData(GridData.FILL_VERTICAL));
fillData();
}
protected void fillData()
{
for ( int i = 0; i < 10; i++ )
{
selectionList.add("Test"+i);
}
}
}
public class ListWizardPage extends WizardPage
{
ListComposite listComposite;
public ListWizardPage(String pageName)
{
super(pageName);
}
public void createControl(Composite parent)
{
parent.setLayoutData(new GridData(GridData.FILL_BOTH));
listComposite = new ListComposite(parent,SWT.NONE);
setControl(listComposite);
}
}
public class ListWizard extends Wizard
{
ListWizardPage page;
public ListWizard()
{
super();
setNeedsProgressMonitor(true);
}
public void addPages()
{
super.addPages();
page = new ListWizardPage("Testing");
addPage(page);
}
public boolean performFinish()
{
page.setEnabled(false);
IRunnableWithProgress op = new IRunnableWithProgress()
{
public void run(IProgressMonitor monitor) throws
InvocationTargetException,InterruptedException
{
try
{
Thread.sleep(1500);
}
catch ( Exception e )
{
}
}
};
try
{
getContainer().run(false,true,op);
}
catch ( Exception e )
{
}
return true;
}
}
public class ListAction extends Action
{
public ListAction()
{
super();
}
public void run()
{
ListWizard wizard = new ListWizard();
WizardDialog dlg = new
WizardDialog(Display.getCurrent().getActiveShell(),wizard);
dlg.open();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03070 seconds