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.
55 lines
2.0 KiB
55 lines
2.0 KiB
package cn.net.connor.process.commands;
|
|
|
|
import javax.swing.JOptionPane;
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFApplication;
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
import com.teamcenter.rac.kernel.TCComponentBOPLine;
|
|
import com.teamcenter.rac.util.Registry;
|
|
|
|
import cn.net.connor.process.ProcessLocale;
|
|
import cn.net.connor.process.ProcessUtil;
|
|
import cn.net.connor.process.meopmodel.DesignModelOperation;
|
|
import cn.net.connor.process.meopmodel.MeopModelDialog;
|
|
import cn.net.connor.process.meopmodel.MeopModelDialogController;
|
|
import k.KCommand;
|
|
import k.util.KUtil;
|
|
|
|
public class MeopModelCommand extends KCommand {
|
|
|
|
private static final Registry REG = Registry.getRegistry(MeopModelDialog.class);
|
|
|
|
public MeopModelCommand(AbstractAIFApplication app, String commandId, String actionInfo) {
|
|
super(app, commandId, actionInfo);
|
|
}
|
|
|
|
@Override
|
|
protected void executeCommand() throws Exception {
|
|
InterfaceAIFComponent target = app.getTargetComponent();
|
|
System.out.println("Select: " + target);
|
|
String typeName = "";
|
|
if (target instanceof TCComponentBOPLine) {
|
|
typeName = ((TCComponentBOPLine) target).getItem().getType();
|
|
}
|
|
if (!ProcessUtil.isMEOP(typeName)) {
|
|
KUtil.info(null, ProcessLocale.getString("selectmeopline.INFO"));
|
|
return;
|
|
}
|
|
TCComponentBOPLine meopLine = (TCComponentBOPLine) target;
|
|
MeopModelDialog dialog = new MeopModelDialog(new MeopModelDialogController(app, meopLine));
|
|
int option = JOptionPane.showOptionDialog(dialog, REG.getString("meopmodeloption.MESSAGE"), "", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
|
|
new String[] { REG.getString("meopmodel"), REG.getString("designmodel") }, null);
|
|
if (option == JOptionPane.YES_OPTION) {
|
|
System.out.println("select meop model");
|
|
this.setRunnable(dialog);
|
|
} else if (option == JOptionPane.NO_OPTION) {
|
|
System.out.println("select design model");
|
|
this.setRunnable(new DesignModelOperation(app, REG.getString("designmodel.STATUS"), meopLine));
|
|
} else {
|
|
System.out.println("cancel");
|
|
}
|
|
super.executeCommand();
|
|
}
|
|
|
|
}
|