gpt4 book ai didi

java - JFace:如何获取 Action#run() 的调用者?

转载 作者:行者123 更新时间:2023-12-02 00:32:50 25 4
gpt4 key购买 nike

我有一个用于 TreeView 的 ContentProvider。我在那里添加了一些可以对树的项目执行的操作。该方法如下所示:

private void makeActions() {
action1 = new Action() {

@Override
public void runWithEvent(Event event) {
System.out.println(event);
System.out.println(event.data.getClass());
//How can I find the caller of runWithEvent?
}
};

如何找到导致调用 Action#runWithEvent 的树对象?

最佳答案

考虑使用新的命令 API 而不是旧的操作 API。在新的 API 中,您可以轻松访问命令处理程序中的相关信息。

关于java - JFace:如何获取 Action#run() 的调用者?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8562347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com