package interactivefeaturelocator.views;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;

import interactivefeaturelocator.model.DerivationManager;
import interactivefeaturelocator.model.DerivationUnit;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.ntlab.trace.MethodExecution;

public class InteractiveDerivationTabFolder extends CTabFolder {
	final public DerivationUnit iu = null;
	public HashSet<MethodExecution> methods; // 抽出結果(過程)
	
	public InteractiveDerivationTabFolder(Composite parent, int style, HashSet<MethodExecution> methods) {
		super(parent, style);
//		iu = new InferenceUnit(trace);
		setMethods(methods);
		createTab();
		// TODO Auto-generated constructor stub
	}
	
	private void createTab() {
		ArrayList<InteractiveDerivationSession> sessions = new ArrayList<>();
		int i = 1;
		for (MethodExecution me : getMethods()) {
			CTabItem session = new InteractiveDerivationSession(this, SWT.NONE, me);
			session.setText("Session " + i);
			sessions.add((InteractiveDerivationSession)session);
			i++;
		}
		
//		CTabItem taroTab = new CTabItem(this, SWT.NONE);
//		taroTab.setText("タロ(Mr.Taro)");
//		if (focusItem == null) {
//			focusItem = taroTab;
//		}
//		SelectMethodLayout taroLayout = new SelectMethodLayout(taroTab);
//		CTabItem jiroTab = new CTabItem(this, SWT.NONE);
//		jiroTab.setText("ジロ(Mr.Jiro)");
//		SelectMethodLayout jiroLayout = new SelectMethodLayout(jiroTab);
		
//		for (ThreadInstance ti : threadToMethods.keySet()) {
//			System.out.println("threadID: " + ti.getId());
//			HashSet<MethodExecution> set = threadToMethods.get(ti);
//			for (MethodExecution me : set) {
//				System.out.println("method: " + me.getSignature());
//			}
//		}		
	}
	
	public void showFolder() {
		
	}

	public HashSet<MethodExecution> getMethods() {
		return methods;
	}

	public void setMethods(HashSet<MethodExecution> methods) {
		this.methods = methods;
	}
}
