【问题标题】:How to handle spaces in launcher.ini file of RCP product configuration如何处理 RCP 产品配置的 launcher.ini 文件中的空格
【发布时间】:2020-05-07 07:53:03
【问题描述】:

我在我的 RCP 应用程序中使用 Eclipse 的 launcher.openfile 功能,因此我的产品的 .ini 文件包含:

--launcher.defaultAction
openFile

为了使这项工作与我的应用程序一起使用,启动器名称必须与我的 rcp 应用程序的主窗口名称相同。我的主窗口标签设置了产品名称。启动器名称通过我的产品配置文件的启动器选项卡设置为:

myLauncherName 在我的应用程序使用 maven 和 tycho 构建过程之后生成一个 myLauncherName.exe

我的产品名称中有空格:

我的产品应用

我不想要一个长的启动器名称,所以我必须在 .ini 文件中设置 -name 属性。因此,我将产品配置编辑器中的 Program Arguments 设置为:

--launcher.defaultAction
openFile
-name
My Product App

但是当我构建我的产品时,我会得到一个包含以下内容的 .ini 文件:

--launcher.defaultAction
openFile
-name
My
Product
App

在使用 maven 和 tycho 构建过程之后,如何防止 Program 参数中的空格被回车/换行符替换?我什至尝试插入 xml 空格符号( ),但没有任何运气。或者有没有办法在 .ini 文件中使用变量?像 ${product.name} 这样的东西总是和我的主窗口一样有相同的名字会很好。

【问题讨论】:

    标签: eclipse-rcp rcp ini


    【解决方案1】:

    RCP plugin.xml 中product 配置的appName 属性将应用程序名称设置为存在空格问题。

    <extension
          id="product"
          point="org.eclipse.core.runtime.products">
       <product
             name="%product.name"
             "org.eclipse.e4.ui.workbench.swt.E4Application">
          <property
                name="appName"
                value="%product.name">
          </property>
    

    这也是使用%xxx从bundle.properties中获取文本

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-18
      • 1970-01-01
      • 1970-01-01
      • 2016-04-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多