Eclipse Forms and JFace Dialog [message #327207] |
Mon, 14 April 2008 03:38  |
Eclipse User |
|
|
|
Hi!
I want to create a JFace dialog which uses the Eclipse Forms in its dialog
area. But I can't managed it to get it working. The Scrolled Form area is
very small and does not fit into the dialog's area: when I resize the
dialog, the scrolled form does not resize either!
How can I set the default size of the dialog?
Here is my code:
public class MyPropertyDialogextends Dialog {
private FormToolkit toolkit;
private ScrolledForm form;
public MyPropertyDialog(Shell parentShell) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite parentComposite = (Composite)super.createDialogArea(parent);
toolkit = new FormToolkit(parent.getDisplay());
form = toolkit.createScrolledForm(parentComposite);
form.setText("Edit trigger");
Composite composite = form.getBody();
final GridLayout layout = new GridLayout(2, true);
composite.setLayout(layout);
GridData gd = new GridData();
Section cronSection = toolkit.createSection(composite,
Section.EXPANDED | Section.TWISTIE | Section.TITLE_BAR);
cronSection.addExpansionListener(new SectionExpansionAdapter());
cronSection.setText("Cron");
gd.horizontalSpan = 1;
cronSection.setLayoutData(gd);
cronSection.setClient(createCronSection(cronSection));
Section tableSection = toolkit.createSection(composite,
Section.TITLE_BAR | Section.EXPANDED);
tableSection.addExpansionListener(new SectionExpansionAdapter());
tableSection.setText("All");
tableSection.setLayoutData(gd);
tableSection.setClient(createTableSection(tableSection));
Section simpleSection = toolkit.createSection(composite,
Section.TWISTIE | Section.TITLE_BAR);
simpleSection.addExpansionListener(new SectionExpansionAdapter());
simpleSection.setText("Simple");
simpleSection.setLayoutData(gd);
simpleSection.setClient(createSimpleSection(simpleSection));
//parentComposite.getShell().setSize(400,400);
return parentComposite;
}
protected Composite createCronSection(Section section) {
Composite container = toolkit.createComposite(section);
return container;
}
protected Composite createSimpleSection(Section section) {
Composite container = toolkit.createComposite(section);
return container;
}
protected Composite createTableSection(Section section) {
Composite container = toolkit.createComposite(section);
return container;
}
class SectionExpansionAdapter extends ExpansionAdapter {
@Override
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
}
}
}
What am I doing wrong here?!?
Best regards,
Matthias
|
|
|
|
Re: Eclipse Forms and JFace Dialog [message #327268 is a reply to message #327215] |
Tue, 15 April 2008 02:27  |
Eclipse User |
|
|
|
Hello Tom!
Thank you for your answer!
I think the problem was that I havent set a layout data on the
(Scrolled)form (like new GridData(GridData.FILL_BOTH))!
But anyway now I am using the FormDialog which is a subclass from Dialog
and initializes the form (and some other stuff) for you...
Ok, problem solved, thanks!
Best regards,
Matthias
|
|
|
Powered by
FUDForum. Page generated in 0.05008 seconds