【问题标题】:How can I restrict a string attribute in a RCP extension point?如何限制 RCP 扩展点中的字符串属性?
【发布时间】:2011-07-21 06:46:15
【问题描述】:

我正在为我的 Eclipse RCP 应用程序定义一个具有一些属性的扩展点。 其中一个属性是 string,它应该有 最多 3 个字母字符

目前我有以下定义:

<element name="type">
  <complexType>
     <attribute name="type_identifier" type="string" use="required">
        <annotation>
           <documentation>
              Dieser String sollte noch auf maximal 3 Zeichn begrenzt werden
           </documentation>
        </annotation>
     </attribute>
  </complexType> 
</element>

通过编辑器,我只能添加枚举限制,在 xml-source 中显示为:

<restriction base="string">
  <enumeration value="blubb">
  </enumeration>
</restriction>

但我想要的是这样的:

<restriction base="string">
  <pattern value="[A-Z]{3}">
  </pattern>
</restriction>

我可以将此模式通知用于我的扩展点吗?我目前无法测试该设置,因此我无法简单地“试一试”。 p>

【问题讨论】:

    标签: xml eclipse-rcp restriction


    【解决方案1】:

    AFAIK,现在没有办法做到这一点。如果此功能已进入 Eclipse,您可以这样做(通过添加工具支持):https://bugs.eclipse.org/bugs/show_bug.cgi?id=227055

    【讨论】:

    • 不是我喜欢的答案,但如果没有人反对,恐怕这是我的答案。 有人反对吗?请做! ;-)
    • 好的,所以没有反对意见。谢谢普拉卡什。
    猜你喜欢
    • 2017-04-17
    • 2021-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-29
    相关资源
    最近更新 更多