Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Can't make JFace TreeViewer larger
Can't make JFace TreeViewer larger [message #538865] Tue, 08 June 2010 20:13 Go to next message
Simon is currently offline SimonFriend
Messages: 6
Registered: April 2010
Junior Member
Hello,
I want to create a JFace TreeViewer in a JFace WizardPage. My problem is that the viewer is too small.
I tried to extend the viewer over two columns of a GridLayout but it doesn't work. The viewer always has the same
size.

public class FileSelectionPage extends WizardPage implements ISelectionChangedListener {

. . .
. . .

public void createControl(Composite parent) {

Composite composite = new Composite(parent, SWT.NONE);
gl.numColumns = 2;
composite.setLayout(gl);

Label label = new Label(composite, SWT.NONE);
label.setText("Please select an axl file: ");

Label dummyLabel2 = new Label(composite, SWT.NONE);
dummyLabel2.setText(" ");

TreeViewer viewer = new TreeViewer(composite,SWT.BORDER);
viewer.setContentProvider(new FileTreeContentProvider());
viewer.setLabelProvider(new FileTreeLabelProvider());
File[] fileSystemRoots = File.listRoots();
viewer.setInput(fileSystemRoots);
viewer.addSelectionChangedListener(this);

GridData viewerGridData = new GridData();
viewerGridData.horizontalSpan = 2;
viewer.getControl().setLayoutData(viewerGridData);
setControl(composite);

//setControl(parent);

}
. . .
}

best regards

Simon
Re: Can't make JFace TreeViewer larger [message #538873 is a reply to message #538865] Tue, 08 June 2010 20:33 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
You need to tell GridData to use the complete space available.

Tom

Am 08.06.10 22:13, schrieb Simon:
> Hello,
> I want to create a JFace TreeViewer in a JFace WizardPage. My problem is
> that the viewer is too small.
> I tried to extend the viewer over two columns of a GridLayout but it
> doesn't work. The viewer always has the same
> size.
> public class FileSelectionPage extends WizardPage implements
> ISelectionChangedListener {
>
> . .
> . .
>
> public void createControl(Composite parent) {
>
> Composite composite = new Composite(parent, SWT.NONE);
> gl.numColumns = 2;
> composite.setLayout(gl);
>
> Label label = new Label(composite, SWT.NONE);
> label.setText("Please select an axl file: ");
>
> Label dummyLabel2 = new Label(composite, SWT.NONE);
> dummyLabel2.setText(" ");
>
> TreeViewer viewer = new TreeViewer(composite,SWT.BORDER);
> viewer.setContentProvider(new FileTreeContentProvider());
> viewer.setLabelProvider(new FileTreeLabelProvider());
> File[] fileSystemRoots = File.listRoots();
> viewer.setInput(fileSystemRoots);
> viewer.addSelectionChangedListener(this);
>
> GridData viewerGridData = new GridData();

GridData viewerGridData = new GridData(GridData.FILL_BOTH)

> viewerGridData.horizontalSpan = 2;
> viewer.getControl().setLayoutData(viewerGridData);
> setControl(composite);
>
> //setControl(parent);
>
> }
> . .
> }
>
> best regards
> Simon
Re: Can't make JFace TreeViewer larger [message #539442 is a reply to message #538873] Thu, 10 June 2010 17:54 Go to previous message
Simon is currently offline SimonFriend
Messages: 6
Registered: April 2010
Junior Member
Thank you Tom. It now works correctly.

best regards

Simon
Previous Topic:Scrolling JFace viewers on a white background (Linux/GTK)
Next Topic:get treeviewer from item
Goto Forum:
  


Current Time: Thu Dec 18 17:26:05 GMT 2014

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

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