• <legend id='9UHrf'><style id='9UHrf'><dir id='9UHrf'><q id='9UHrf'></q></dir></style></legend>

      <small id='9UHrf'></small><noframes id='9UHrf'>

        <bdo id='9UHrf'></bdo><ul id='9UHrf'></ul>

      1. <i id='9UHrf'><tr id='9UHrf'><dt id='9UHrf'><q id='9UHrf'><span id='9UHrf'><b id='9UHrf'><form id='9UHrf'><ins id='9UHrf'></ins><ul id='9UHrf'></ul><sub id='9UHrf'></sub></form><legend id='9UHrf'></legend><bdo id='9UHrf'><pre id='9UHrf'><center id='9UHrf'></center></pre></bdo></b><th id='9UHrf'></th></span></q></dt></tr></i><div id='9UHrf'><tfoot id='9UHrf'></tfoot><dl id='9UHrf'><fieldset id='9UHrf'></fieldset></dl></div>
        <tfoot id='9UHrf'></tfoot>

        如何使用 IResourceChangeListener 检测文件重命名并动态设置 EditorPart 名称?

        How to use an IResourceChangeListener to detect a file rename and set the EditorPart name dynamically?(如何使用 IResourceChangeListener 检测文件重命名并动态设置 EditorPart 名称?)
        <i id='2Pft6'><tr id='2Pft6'><dt id='2Pft6'><q id='2Pft6'><span id='2Pft6'><b id='2Pft6'><form id='2Pft6'><ins id='2Pft6'></ins><ul id='2Pft6'></ul><sub id='2Pft6'></sub></form><legend id='2Pft6'></legend><bdo id='2Pft6'><pre id='2Pft6'><center id='2Pft6'></center></pre></bdo></b><th id='2Pft6'></th></span></q></dt></tr></i><div id='2Pft6'><tfoot id='2Pft6'></tfoot><dl id='2Pft6'><fieldset id='2Pft6'></fieldset></dl></div>

        <small id='2Pft6'></small><noframes id='2Pft6'>

            <tbody id='2Pft6'></tbody>
            <bdo id='2Pft6'></bdo><ul id='2Pft6'></ul>
          • <legend id='2Pft6'><style id='2Pft6'><dir id='2Pft6'><q id='2Pft6'></q></dir></style></legend>

                <tfoot id='2Pft6'></tfoot>

                  本文介绍了如何使用 IResourceChangeListener 检测文件重命名并动态设置 EditorPart 名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  IResourceChangeListener 侦听项目工作区中的更改,例如,如果编辑器部件文件名已更改.

                  IResourceChangeListener listens to changes in project workspace for example if the editor part file name has changed.

                  我想知道如何访问特定的 EditorPart 并相应地更改其标题名称(例如使用 .setPartName),或者可能刷新编辑器以使其显示新名称自动.

                  I want to know how to access that particular EditorPart and change its title name accordingly (e.g. with .setPartName), or maybe the refresh the editor so that it shows the new name automatically.

                  理想的情况是 IResourceChangeListener 具有 Rename 事件类型但似乎不是 案例.

                  Ideal would be if the IResourceChangeListener has a Rename event type but does not seem to be the case.

                  参考问题.

                  推荐答案

                  IResourceChangeListener 使用 REMOVED 类型和 MOVED_TO 标志).您可以在 IResourceDelta 中使用

                  The IResourceChangeListener does fire for rename/move events using a combination of the REMOVED kind and a MOVED_TO flag). You can test for that in the IResourceDelta with

                  @Override
                  public void resourceChanged(final IResourceChangeEvent event)
                  {
                    IResourceDelta delta = event.getDelta();
                  
                    // Look for change to our file
                  
                    delta = delta.findMember(IPath of file being edited);
                    if (delta == null)
                      return;
                  
                    if delta.getKind() == IResourceDelta.REMOVED
                     {
                       if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0)
                        {
                          IPath newPath = delta.getMovedToPath();
                  
                          ... handle new path
                        }
                     }
                  }
                  

                  处理新路径的代码可能类似于:

                  The code to handle the new path might be something like:

                  IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath);
                  if (file != null)
                   {
                     setInput(new FileEditorInput(file));
                  
                     setPartName(newPath.lastSegment());
                  
                     ... anything else required 
                   }
                  

                  这篇关于如何使用 IResourceChangeListener 检测文件重命名并动态设置 EditorPart 名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                  How can I specify the default JVM arguments for programs I run from eclipse?(如何为从 Eclipse 运行的程序指定默认 JVM 参数?)
                  Class JavaLaunchHelper is implemented in both ... libinstrument.dylib. One of the two will be used. Which one is undefined(JavaLaunchHelper 类在... libinstrument.dylib 中都实现了.将使用两者之一.哪个是未定义的) - IT屋-程序员软件开发技术分享
                  Running Eclipse on Windows 7 JRE and JDK not found(找不到在 Windows 7 JRE 和 JDK 上运行 Eclipse)
                  StringBuilder vs. .concat vs. quot;+quot; Operator relative performance different in eclipse than command line?(StringBuilder vs. .concat vs. “+eclipse中的操作员相对性能与命令行不同?)
                  Is there a maximum number you can set Xmx to when trying to increase jvm memory?(尝试增加 jvm 内存时,您可以将 Xmx 设置为最大数量吗?)
                    <i id='7WbIn'><tr id='7WbIn'><dt id='7WbIn'><q id='7WbIn'><span id='7WbIn'><b id='7WbIn'><form id='7WbIn'><ins id='7WbIn'></ins><ul id='7WbIn'></ul><sub id='7WbIn'></sub></form><legend id='7WbIn'></legend><bdo id='7WbIn'><pre id='7WbIn'><center id='7WbIn'></center></pre></bdo></b><th id='7WbIn'></th></span></q></dt></tr></i><div id='7WbIn'><tfoot id='7WbIn'></tfoot><dl id='7WbIn'><fieldset id='7WbIn'></fieldset></dl></div>
                      <tbody id='7WbIn'></tbody>
                      <bdo id='7WbIn'></bdo><ul id='7WbIn'></ul>
                        <tfoot id='7WbIn'></tfoot>

                        <small id='7WbIn'></small><noframes id='7WbIn'>

                            <legend id='7WbIn'><style id='7WbIn'><dir id='7WbIn'><q id='7WbIn'></q></dir></style></legend>