/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * 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:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.designer.ui.views.attributes;

import java.util.List;

import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;

/**
 * DefaultPageGenerator removes all <code>TabPage</code> from
 * <code>TabFolder</code>.
 */
public class DefaultPageGenerator implements IPageGenerator
{

	/**
	 * Creates attribute pages
	 * 
	 * @param tabFolder
	 *            The attribute tabFolder.
	 * @param input
	 *            The current selection.
	 */
	public void createTabItems( TabFolder tabFolder, List input )
	{
		TabItem[] oldPages = tabFolder.getItems( );
		for ( int i = 0; i < oldPages.length; i++ )
		{
			if ( oldPages[i].getControl( ) != null )
			{
				oldPages[i].getControl( ).dispose( );
			}
			oldPages[i].dispose( );
		}
	}
}