<tfoot id='x6kPu'></tfoot>

          <bdo id='x6kPu'></bdo><ul id='x6kPu'></ul>
        <legend id='x6kPu'><style id='x6kPu'><dir id='x6kPu'><q id='x6kPu'></q></dir></style></legend>

        <small id='x6kPu'></small><noframes id='x6kPu'>

      1. <i id='x6kPu'><tr id='x6kPu'><dt id='x6kPu'><q id='x6kPu'><span id='x6kPu'><b id='x6kPu'><form id='x6kPu'><ins id='x6kPu'></ins><ul id='x6kPu'></ul><sub id='x6kPu'></sub></form><legend id='x6kPu'></legend><bdo id='x6kPu'><pre id='x6kPu'><center id='x6kPu'></center></pre></bdo></b><th id='x6kPu'></th></span></q></dt></tr></i><div id='x6kPu'><tfoot id='x6kPu'></tfoot><dl id='x6kPu'><fieldset id='x6kPu'></fieldset></dl></div>
      2. 想要在代码中打开一个 eclipse xml 文件并参考它的 IFile 导航到一个特定的行号

        时间:2023-08-23

      3. <i id='zNX4v'><tr id='zNX4v'><dt id='zNX4v'><q id='zNX4v'><span id='zNX4v'><b id='zNX4v'><form id='zNX4v'><ins id='zNX4v'></ins><ul id='zNX4v'></ul><sub id='zNX4v'></sub></form><legend id='zNX4v'></legend><bdo id='zNX4v'><pre id='zNX4v'><center id='zNX4v'></center></pre></bdo></b><th id='zNX4v'></th></span></q></dt></tr></i><div id='zNX4v'><tfoot id='zNX4v'></tfoot><dl id='zNX4v'><fieldset id='zNX4v'></fieldset></dl></div>
      4. <legend id='zNX4v'><style id='zNX4v'><dir id='zNX4v'><q id='zNX4v'></q></dir></style></legend>
          • <bdo id='zNX4v'></bdo><ul id='zNX4v'></ul>

            <small id='zNX4v'></small><noframes id='zNX4v'>

                <tbody id='zNX4v'></tbody>

                • <tfoot id='zNX4v'></tfoot>
                  本文介绍了想要在代码中打开一个 eclipse xml 文件并参考它的 IFile 导航到一个特定的行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我通过它的 IFile 实例在 Eclipse IDE 中引用了一个 xml 文件.我知道想在我的视图上添加一个操作,在 xml 编辑器中打开文件并导航到特定的行号.有人对如何解决这个问题有任何想法吗?

                  I have a reference to an xml file in eclipse IDE through its IFile instance. I know want to add an action on my view that opens the file in the xml editor and navigate to a specific line number. Anyone have any ideas on how to go about this?

                  推荐答案

                  假设你知道文件的 URL:

                  Assuming you know the file's URL:

                  IWorkbenchPage page = activeWorkbenchPage();
                  if (page == null) {
                      throw new RuntimeException();
                  }
                  
                  IFile file;
                  IFile[] files = ResourcesPlugin.getWorkspace().getRoot()
                              .findFilesForLocationURI(url.toURI());
                  file = files[0];
                  
                  IMarker marker;
                  marker = file.createMarker(IMarker.TEXT);
                  HashMap<String, Object> map = new HashMap<String, Object>();
                  map.put(IMarker.LINE_NUMBER, lineNumber);
                  marker.setAttributes(map);
                  IDE.openEditor(page, marker);
                  marker.delete();
                  

                  当然,您还需要捕获/抛出一些异常,但为了简单起见,我在这里省略了.

                  Of course you will need to catch/throw a couple of Exceptions as well, but I omitted this here for simplicity.

                  这篇关于想要在代码中打开一个 eclipse xml 文件并参考它的 IFile 导航到一个特定的行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:启动 Eclipse 插件模板 下一篇:编写 Eclipse 插件来修改编辑器首选项

                  相关文章

                  <small id='rnV1t'></small><noframes id='rnV1t'>

                    <bdo id='rnV1t'></bdo><ul id='rnV1t'></ul>
                      <i id='rnV1t'><tr id='rnV1t'><dt id='rnV1t'><q id='rnV1t'><span id='rnV1t'><b id='rnV1t'><form id='rnV1t'><ins id='rnV1t'></ins><ul id='rnV1t'></ul><sub id='rnV1t'></sub></form><legend id='rnV1t'></legend><bdo id='rnV1t'><pre id='rnV1t'><center id='rnV1t'></center></pre></bdo></b><th id='rnV1t'></th></span></q></dt></tr></i><div id='rnV1t'><tfoot id='rnV1t'></tfoot><dl id='rnV1t'><fieldset id='rnV1t'></fieldset></dl></div>
                      <legend id='rnV1t'><style id='rnV1t'><dir id='rnV1t'><q id='rnV1t'></q></dir></style></legend>

                      <tfoot id='rnV1t'></tfoot>