package com.connor.bomCompare;

import java.io.File;
import java.sql.Date;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;


import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentPseudoFolder;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;


public class SJDBHandler extends AbstractHandler {

	@Override
	public Object execute(ExecutionEvent arg0) throws ExecutionException {
		// TODO Auto-generated method stub
		AbstractAIFApplication app = AIFUtility.getCurrentApplication();
		TCSession session = (TCSession) app.getSession();
		InterfaceAIFComponent comp;
		comp=app.getTargetComponent();
		try {
			
//			String type1=comp.getType();
//			System.out.println(type1);
//			if(type1.equals("PseudoFolder")) {
//				TCComponentPseudoFolder folder=(TCComponentPseudoFolder)comp;
////				String stringProperty = folder.getStringProperty("object_string");
//				String stringProperty2 = folder.getStringProperty("property_name");
//				System.out.println("stringProperty2"+stringProperty2);
//			}
			if(comp instanceof TCComponentBOMLine) {
				if(1>1){
					DDGYDialog Dialog=new DDGYDialog(session);
				}else if(1==1){
					CXGYWLDialog Dialog=new CXGYWLDialog(session);
				}else {
					MessageBox.post("请选择：订单BOM，订单工艺，产品工艺，产品BOM，产线工艺。", "错误", MessageBox.ERROR);
				}
				//String ssString=((TCComponentBOMLine)comp).getItem().getType();
				
				//System.out.print(ssString);
			}else {
				MessageBox.post("请在结构管理器或制造工艺规划器中选中BOMLine对象！", "错误", MessageBox.ERROR);
			}
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//MessageBox.post("1", "错误", MessageBox.ERROR);
		return null;
	}


}
