/******************************************************************************* * Copyright (c) 2002-2006 Innoopract Informationssysteme GmbH. All rights * reserved. This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 which accompanies this * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html * Contributors: Innoopract Informationssysteme GmbH - initial API and * implementation ******************************************************************************/ package org.eclipse.rap.demo; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.lifecycle.IEntryPoint; import org.eclipse.swt.widgets.*; public class EntryPoint1 implements IEntryPoint { public Display createUI() { Display display = new Display(); final Shell shell = new Shell( display, SWT.SHELL_TRIM ); shell.setLayout( new FillLayout() ); shell.setBounds( 10, 10, 200, 100 ); final Text text = new Text( shell, SWT.MULTI ); final Tree tree = new Tree( shell, SWT.SINGLE ); for( int i = 0; i < 5; i++ ) { TreeItem t1 = new TreeItem( tree, SWT.NONE ); t1.setText( "foo" + i ); } Button b1 = new Button( shell, SWT.PUSH ); b1.setText( "dispose both (works not - text first)" ); b1.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { text.dispose(); tree.dispose(); } } ); Button b2 = new Button( shell, SWT.PUSH ); b2.setText( "dispose both (works - tree first)" ); b2.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { tree.dispose(); text.dispose(); } } ); shell.pack(); shell.open(); return display; } }