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.

40 lines
1.4 KiB

package com.connor.mbd.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.connor.mbd.dialogs.ModifymaturityDialog;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
public class ModifymaturityHandler extends AbstractHandler {
TCSession session = (TCSession) AIFUtility.getCurrentApplication().getSession();
AbstractAIFUIApplication application = AIFUtility.getCurrentApplication();
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
new Thread(() -> {
InterfaceAIFComponent[] targets = AIFUtility.getCurrentApplication().getTargetComponents();
if (targets.length == 0) {
MessageBox.post("未选择对象", "", MessageBox.ERROR);
return;
}
if(targets[0] instanceof TCComponentBOMLine) {
new ModifymaturityDialog(targets, false);
}else if(targets[0] instanceof TCComponentItemRevision) {
new ModifymaturityDialog(targets, true);
}else {
MessageBox.post("请选择BOM行或零件版本对象", "", MessageBox.ERROR);
return;
}
}).start();
return null;
}
}