|
|
|
@ -1,117 +1,117 @@
|
|
|
|
|
//package com.langtech.plm.template;
|
|
|
|
|
//
|
|
|
|
|
//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.TCComponentItemRevision;
|
|
|
|
|
//import com.teamcenter.rac.kernel.TCComponentSchedule;
|
|
|
|
|
//import com.teamcenter.rac.kernel.TCComponentScheduleTask;
|
|
|
|
|
//import com.teamcenter.rac.kernel.TCException;
|
|
|
|
|
//import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
|
//import com.teamcenter.rac.util.MessageBox;
|
|
|
|
|
//
|
|
|
|
|
//public class TemplateHandler extends AbstractHandler{
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
|
|
|
|
// AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
|
|
|
|
// TCSession session = (TCSession) app.getSession();
|
|
|
|
|
// try {
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// new Thread() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void run() {
|
|
|
|
|
// InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
|
|
|
|
//
|
|
|
|
|
// String type = targetComponent.getType();
|
|
|
|
|
// System.out.println("type==========="+type);
|
|
|
|
|
// if(targetComponent instanceof TCComponentItemRevision) {
|
|
|
|
|
// try {
|
|
|
|
|
// String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject");
|
|
|
|
|
// String types = "";
|
|
|
|
|
// if(pref.length > 0) {
|
|
|
|
|
// types = pref[0];
|
|
|
|
|
// }else {
|
|
|
|
|
// MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// TCComponentItemRevision rev = (TCComponentItemRevision)targetComponent;
|
|
|
|
|
// String object_type = rev.getStringProperty("object_type");
|
|
|
|
|
// if(types.contains(object_type)) {
|
|
|
|
|
// new TemplateDialog(session,rev,object_type);
|
|
|
|
|
// }else {
|
|
|
|
|
// MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// // TODO Auto-generated catch block
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// }else if(type.equals("Mfg0BvrOperation")){
|
|
|
|
|
// TCComponent com = (TCComponent) targetComponent;
|
|
|
|
|
// try {
|
|
|
|
|
// TCComponent rev = com.getRelatedComponent("bl_line_object");
|
|
|
|
|
// if(rev instanceof TCComponentItemRevision) {
|
|
|
|
|
// try {
|
|
|
|
|
// String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject");
|
|
|
|
|
// String types = "";
|
|
|
|
|
// if(pref.length > 0) {
|
|
|
|
|
// types = pref[0];
|
|
|
|
|
// }else {
|
|
|
|
|
// MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// TCComponentItemRevision revision = (TCComponentItemRevision)rev;
|
|
|
|
|
// String object_type = rev.getStringProperty("object_type");
|
|
|
|
|
// if(types.contains(object_type)) {
|
|
|
|
|
// new TemplateDialog(session,revision,object_type);
|
|
|
|
|
// }else {
|
|
|
|
|
// MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// // TODO Auto-generated catch block
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (TCException e) {
|
|
|
|
|
// // TODO Auto-generated catch block
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// MessageBox.post("请选择版本对象!","提示",2);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }.start();
|
|
|
|
|
//
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// // TODO: handle exception
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//}
|
|
|
|
|
package com.langtech.plm.template;
|
|
|
|
|
|
|
|
|
|
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.TCComponentItemRevision;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentSchedule;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCComponentScheduleTask;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
|
|
|
|
|
|
|
public class TemplateHandler extends AbstractHandler{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
|
|
|
|
AbstractAIFApplication app = AIFUtility.getCurrentApplication();
|
|
|
|
|
TCSession session = (TCSession) app.getSession();
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Thread() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
InterfaceAIFComponent targetComponent = app.getTargetComponent();
|
|
|
|
|
|
|
|
|
|
String type = targetComponent.getType();
|
|
|
|
|
System.out.println("type==========="+type);
|
|
|
|
|
if(targetComponent instanceof TCComponentItemRevision) {
|
|
|
|
|
try {
|
|
|
|
|
String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject");
|
|
|
|
|
String types = "";
|
|
|
|
|
if(pref.length > 0) {
|
|
|
|
|
types = pref[0];
|
|
|
|
|
}else {
|
|
|
|
|
MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TCComponentItemRevision rev = (TCComponentItemRevision)targetComponent;
|
|
|
|
|
String object_type = rev.getStringProperty("object_type");
|
|
|
|
|
if(types.contains(object_type)) {
|
|
|
|
|
new TemplateDialog(session,rev,object_type);
|
|
|
|
|
}else {
|
|
|
|
|
MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}else if(type.equals("Mfg0BvrOperation")){
|
|
|
|
|
TCComponent com = (TCComponent) targetComponent;
|
|
|
|
|
try {
|
|
|
|
|
TCComponent rev = com.getRelatedComponent("bl_line_object");
|
|
|
|
|
if(rev instanceof TCComponentItemRevision) {
|
|
|
|
|
try {
|
|
|
|
|
String[] pref = session.getPreferenceService().getStringValues("LY6_MEOP_TemplateObject");
|
|
|
|
|
String types = "";
|
|
|
|
|
if(pref.length > 0) {
|
|
|
|
|
types = pref[0];
|
|
|
|
|
}else {
|
|
|
|
|
MessageBox.post("请配置首选项LY6_MEOP_TemplateObject!","提示",2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TCComponentItemRevision revision = (TCComponentItemRevision)rev;
|
|
|
|
|
String object_type = rev.getStringProperty("object_type");
|
|
|
|
|
if(types.contains(object_type)) {
|
|
|
|
|
new TemplateDialog(session,revision,object_type);
|
|
|
|
|
}else {
|
|
|
|
|
MessageBox.post("请选择首选项LY6_MEOP_TemplateObject中匹配的对象!","提示",2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (TCException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
MessageBox.post("请选择版本对象!","提示",2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}.start();
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|