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.

65 lines
1.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.connor.jd.plm.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.connor.jd.plm.dialogs.CSXWHDialog;
import com.connor.jd.plm.utils.JDMethodUtil;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.MessageBox;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.stage.Stage;
public class CSXWHHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
TCSession session = (TCSession) app.getSession();
String[] userIdList = JDMethodUtil.getPrefStrArray("JD2_CSXWH", session);
Boolean tag = true;
try {
System.out.println("当前用户id" + session.getUser().getUserId());
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
for (int i = 0; i < userIdList.length; i++) {
try {
if (session.getUser().getUserId().equals(userIdList[i])) {
tag = false;
new Thread(() -> {
new JFXPanel();
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
try {
CSXWHDialog csxwh = new CSXWHDialog();
csxwh.start(new Stage());
} catch (Exception e) {
e.printStackTrace();
}
}
});
}).start();
}
} catch (TCException e) {
e.printStackTrace();
}
}
if (tag) {
MessageBox.post("没有开启权限,请联系管理员", "提示", MessageBox.INFORMATION);
}
return null;
}
}