Java Code Examples for org.eclipse.swt.widgets.TreeItem#isDisposed()

The following examples show how to use org.eclipse.swt.widgets.TreeItem#isDisposed() . 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: ExpressionTreeSupport.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Calculates the first available position according to the given item list.
 */
private int getIndex( TreeItem... items )
{
	if ( items != null )
	{
		for ( TreeItem ti : items )
		{
			if ( ti != null && !ti.isDisposed( ) )
			{
				return tree.indexOf( ti ) + 1;
			}
		}
	}

	return 0;
}
 
Example 2
Source File: ExpressionTreeSupport.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void clearTreeItem( TreeItem treeItem )
{
	if ( treeItem == null || treeItem.isDisposed( ) )
	{
		return;
	}
	treeItem.dispose( );
}
 
Example 3
Source File: ExpressionTreeSupport.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void clearSubTreeItem( TreeItem treeItem )
{
	if ( treeItem == null || treeItem.isDisposed( ) )
	{
		return;
	}
	TreeItem[] items = treeItem.getItems( );
	for ( int i = 0; i < items.length; i++ )
	{
		clearTreeItem( items[i] );
	}
}
 
Example 4
Source File: ReportPropertySheetPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param item
 */
private void activateCellEditor( TreeItem sel )
{

	if ( sel.isDisposed( ) )
		return;
	model = sel.getData( );

	// ensure the cell editor is visible
	tableTree.showSelection( );

	cellEditor = createCellEditor( model );

	if ( cellEditor == null )
		// unable to create the editor
		return;

	// set the created editor as current editor
	tableTreeEditor.setEditor( cellEditor.getControl( ) );

	// activate the cell editor
	cellEditor.activate( );

	// if the cell editor has no control we can stop now
	Control control = cellEditor.getControl( );
	if ( control == null )
	{
		cellEditor.deactivate( );
		cellEditor = null;
		return;
	}

	// add our editor listener
	cellEditor.addListener( editorListener );

	// set the layout of the table tree editor to match the cell editor
	CellEditor.LayoutData layout = cellEditor.getLayoutData( );
	tableTreeEditor.horizontalAlignment = layout.horizontalAlignment;
	tableTreeEditor.grabHorizontal = layout.grabHorizontal;
	tableTreeEditor.minimumWidth = layout.minimumWidth;
	tableTreeEditor.setEditor( control, sel, columnToEdit );

	// give focus to the cell editor
	cellEditor.setFocus( );

}
 
Example 5
Source File: AdvancePropertyDescriptor.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param item
 */
private void activateCellEditor( TreeItem sel )
{

	if ( sel.isDisposed( ) )
		return;
	model = sel.getData( );

	// ensure the cell editor is visible
	tableTree.showSelection( );

	cellEditor = createCellEditor( model );

	if ( cellEditor == null )
		// unable to create the editor
		return;

	// set the created editor as current editor
	tableTreeEditor.setEditor( cellEditor.getControl( ) );

	// activate the cell editor
	cellEditor.activate( );

	// if the cell editor has no control we can stop now
	Control control = cellEditor.getControl( );
	if ( control == null )
	{
		cellEditor.deactivate( );
		cellEditor = null;
		return;
	}

	// add our editor listener
	cellEditor.addListener( editorListener );

	// set the layout of the table tree editor to match the cell editor
	CellEditor.LayoutData layout = cellEditor.getLayoutData( );
	tableTreeEditor.horizontalAlignment = layout.horizontalAlignment;
	tableTreeEditor.grabHorizontal = layout.grabHorizontal;
	tableTreeEditor.minimumWidth = layout.minimumWidth;
	tableTreeEditor.setEditor( control, sel, columnToEdit );

	// give focus to the cell editor
	cellEditor.setFocus( );

}