Java Code Examples for org.eclipse.swt.widgets.Composite#setParent()

The following examples show how to use org.eclipse.swt.widgets.Composite#setParent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VerticalList.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
public void add(Composite composite) {
	composite.setParent(this);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	composite.addDisposeListener(new DisposeListener() {
		
		@Override
		public void widgetDisposed(DisposeEvent e) {
			if( composite.getParent() == VerticalList.this ) {
				remove(composite);
			}
		}
	});
	
	notifyParentScrolledComposite();
}
 
Example 2
Source File: SearchView.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
public void addSearchTab(String title, ITab<?> view) {
	CTabItem tab = new CTabItem(searchTabs, SWT.NONE);
	tab.setText(title);

	Composite composite = view.getComposite();
	composite.setParent(searchTabs);

	tab.setControl(composite);

	searchTabs.setSelection(tab);

	// this part is a bit hacky, but there is no other way to notify the view about
	// the dispose
	tab.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			view.closed();
		}
	});
}
 
Example 3
Source File: ConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void mainLayout( Class<?> PKG, String prefix, Image img ) {
  display = parent.getDisplay();
  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX );
  props.setLook( shell );
  shell.setImage( img );
  shell.setLayout( new FormLayout() );
  shell.setText( BaseMessages.getString( PKG, prefix + ".Shell.Title" ) );

  scContainer = new ScrolledComposite( shell, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL );
  scContainer.setLayout( new FormLayout() );
  FormData fd = new FormData();
  fd.top = new FormAttachment( 0, Const.FORM_MARGIN );
  fd.bottom = new FormAttachment( 100, -Const.FORM_MARGIN );
  fd.left = new FormAttachment( 0, Const.FORM_MARGIN );
  fd.right = new FormAttachment( 100, -Const.FORM_MARGIN );
  scContainer.setLayoutData( fd );
  scContainer.setExpandHorizontal( true );
  scContainer.setExpandVertical( true );
  cContainer = new Composite( scContainer, SWT.NONE );
  scContainer.setContent( cContainer );
  cContainer.setLayout( new FormLayout() );
  cContainer.setBackground( shell.getBackground() );
  cContainer.setParent( scContainer );
}
 
Example 4
Source File: VerticalList.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
public void remove(Composite composite) {
	composite.setParent(new Shell());

	notifyParentScrolledComposite();
}