当输入因文件重命名而更改时更改编辑器上的标题

发布于 2024-08-21 12:05:58 字数 198 浏览 4 评论 0 原文

当文件输入更改以反映新文件名时,我将如何更新 Eclipse 编辑器的标题栏?例如,当文件被重命名但您仍然在该文件上打开编辑器时。到目前为止,我所做的一切都失败了,即使遵循官方指南(使用特殊接口、类等)也是如此。 Java 编辑器似乎可以很好地做到这一点。如果我更新标题并发布状态更新,它只是不会更新。此后调用更新方法也不会更新编辑器标题。令人困惑。

干杯, 克里斯

how would I go about updating the title bar of an Eclipse editor when the file input changes to reflect the new filename? For instance, when the file is renamed but you still have an editor open on the file. Everything I've done so far has failed, even when following the official guidelines on doing this (using special interfaces, classes, etc). The Java editor can seemingly do this fine. If I update the title and post the status update, it just doesn't update. Calling the update methods after this also doesn't update the editor title. Confusing.

Cheers,
Chris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

玩物 2024-08-28 12:05:58

这可能不是您正在寻找的答案,但它确实有效。

将编辑器转换为 WorkbenchPart(不是 IWorkbenchPart)并调用 setPartName(String name)。

This probably isn't the answer you are looking for but it does work.

Cast your editor to WorkbenchPart (not IWorkbenchPart) and call setPartName(String name).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文