Skip to: Site menu | Main content

GumTree

An integrated scientific workbench

Eclipse Resources Print

Eclipse Programming Tips

How to hide the sash form separator from form?

SashForm sashForm = new SashForm(parent, SWT.NONE);
getToolkit().adapt(sashForm);

How to load an editor input into an EMF object

Resource resource = SDOUtil.createResourceSet().createResource(EditUIUtil.getURI(getEditorInput()));
resource.load(null);
Object content = resource.getContents().get(0);

How to hide SWT widget using GridLayout

Set data height or width to 0 (-1 is reserved as default size) and run layout()

this.setLayout(new GridLayout());
title = new Label(this, SWT.NONE);
title.setText("Title");
titleData = new GridData(SWT.CENTER, SWT.CENTER, true, false);
title.setLayoutData(titleData);
composite = new Composite(this, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
render(composite);
		
b = new Button(this, SWT.CHECK);
b.setText("hide");
b.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
b.setSelection(false);
b.addListener(SWT.Selection, new Listener() {
	public void handleEvent(Event e) {
		if(b.getSelection()) {
			titleData.heightHint = 0;
		} else {
			titleData.heightHint = -1;
		}
		layout();
	}
});