java - 如何使用自定义插件在 Eclipse RCP 中单击自定义菜单项时打开属性页

标签 java eclipse eclipse-plugin eclipse-rcp

我需要使用新插件单击自定义菜单项条目来打开属性页面。我需要添加哪些内容 我的plugins.xml

此plugin.xml 不会产生所需的结果。

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
     point="org.eclipse.ui.propertyPages">
   <page
        class="com.abc.gis.map.displayscale.DisplayPropertiesSummary"
        id="com.abc.gis.map.displayScale.page3"
        name="Test"
        objectClass="net.refractions.udig.project.IMap">
  </page>
  </extension>

   <extension
          point="org.eclipse.ui.handlers">
    <handler
          class="com.abc.gis.map.displayscale.DisplayPropertiesCommandHandler"
          commandId="com.abc.gis.map.displayscale.displayProperties">
       <enabledWhen>
          <iterate
                ifEmpty="false"
                operator="or">
             <adapt
                   type="net.refractions.udig.project.IMap">
             </adapt>
             <instanceof
                   value="net.refractions.udig.project.IMap">
             </instanceof>
          </iterate>
       </enabledWhen>
    </handler>
    </extension>

 </plugin>

我正在尝试打开一个简单的属性页面,其中包含我的用户输入工具,例如此属性页面中的单选按钮。单击我的自定义菜单项将打开此属性页面。

Custom Menu Item

最佳答案

您可以使用 org.eclipse.ui.dialogs.PreferencesUtilcreatePropertyDialogOn 方法来显示特定的属性页。像这样的东西:

PreferencesUtil.createPropertyDialogOn(getShell(), obj, id, new String[] {id}, input).open()

关于java - 如何使用自定义插件在 Eclipse RCP 中单击自定义菜单项时打开属性页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18847657/

相关文章:

java - Eclipse调试插件: Access underlying java object from IJavaObject of JDT

eclipse - 如何将我的 Eclipse 迁移到另一台计算机?

java - 无法使用 JComboBoxes 更改 JTextArea 中的字体和字体大小

java - 如何在JasperReports中映射键值?

java - 不同插件中单独的 DLL 和 native 调用

xml - Spring 数据 xml 配置模式验证错误

eclipse - 使用 eclipse 插件的新谷歌附加的空指针异常

使用英特尔 Fortran 调试器进行 eclipse

java - 将一串十进制数字转换为 BCD 的算法

java - 身份验证和 SSO 应用程序