You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.0 KiB
68 lines
2.0 KiB
package cn.net.connor.createTempDrawings.handlers;
|
|
|
|
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.TCComponentFolder;
|
|
import com.teamcenter.rac.kernel.TCComponentItemRevision;
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
import cn.net.connor.createTempDrawings.dialogs.CreateTempDrawingDialog;
|
|
|
|
public class CreateTempDrawingHandler extends AbstractHandler {
|
|
|
|
@Override
|
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
|
System.out.println("创建临时图纸Handler···");
|
|
int flag = 0;
|
|
AbstractAIFApplication application = AIFUtility.getCurrentApplication();
|
|
//1.判断选中对象是否符合要求
|
|
InterfaceAIFComponent selectComponent = application.getTargetContext().getComponent();
|
|
|
|
System.out.println("当前选中对象类型为:"+selectComponent.getType());
|
|
try {
|
|
if (selectComponent instanceof TCComponentItemRevision) {
|
|
TCComponentItemRevision itemRevision = (TCComponentItemRevision) selectComponent;
|
|
String selectCompType = itemRevision.getStringProperty("object_type");
|
|
if (selectCompType.equals("SB6_SZLXDRevision") || selectCompType.equals("SB6_LSWTCLTZDRevision")) {
|
|
flag ++;
|
|
}
|
|
|
|
}else if (selectComponent instanceof TCComponentFolder) {
|
|
flag ++;
|
|
}
|
|
|
|
if (flag != 0) {
|
|
CreateTempDrawingDialog dialog = new CreateTempDrawingDialog(application);
|
|
|
|
new Thread(dialog).start();
|
|
}else {
|
|
MessageBox.post("请选择文件夹或试制联系单版本或临时问题处理通知单版本后执行创建临时图纸功能!" , "提示", MessageBox.INFORMATION);
|
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
// TODO: handle exception
|
|
System.out.println("选中对象异常:");
|
|
e.printStackTrace();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
}
|
|
|
|
}
|