我正在尝试使用 Java(和 Eclipse)从 Teamcenter 8 富客户端中的登录会话中获取会话参数,例如用户名。
public class SampleHandler extends AbstractHandler
{
public Object execute(ExecutionEvent event) throws ExecutionException
{
// good, but useless
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
// wrong
AbstractAIFSession a = AIFUtility.getSessionManager().getDefaultSession();
// wrong
AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
TCSession session = (TCSession)app.getSession();
// wrong
ISessionService iss = AifrcpPlugin.getSessionService();
session = (TCSession)iss.getSession("com.teamcenter.rac.kernel.TCSession");
return null;
}
}
该片段取自已编译的代码,当我运行我的插件并尝试调用AIFUtility
类中的某些方法时,AifrcpPlugin
会引发异常。
有谁知道如何获取当前会话的用户名?