简体   繁体   English

在Eclipse中,如何判断哪个“向导”调用了实际的向导类

[英]In eclipse how to tell which 'wizard' invoked the actual wizard class

I have the following configuration in my plugin.xml 我的plugin.xml中有以下配置

   <extension
     point="org.eclipse.ui.newWizards">
  <category
        name="Oozie"
        id="com.myapp.wizards">
  </category>
  <wizard
        name="New file1"
        icon="icons/sample.gif"
        category="com.myapp.wizards"
        class="com.myapp.wizards.NewWizard"
        id="com.myapp.wizards.wizard1">
  </wizard>
  <wizard
        category="com.myapp.wizards"
        class="com.myapp.wizards.NewWizard"
        icon="icons/sample.gif"
        id="com.myapp.wizards.wizard2"
        name="New file 2">
  </wizard>

As you can see, both the wizards are pointing to the same class com.myapp.wizards.NewWizard. 如您所见,这两个向导都指向同一个类com.myapp.wizards.NewWizard。 When the class is invoked I want to know which of the above wizard invoked it so that I can take different action based on the caller. 调用该类时,我想知道上述向导中的哪个调用了它,以便我可以根据调用者采取不同的操作。 ie if wizard1 calls name the file 'file1' and if wizard2 calls it name the file 'file2'. 例如,如果向导1调用了文件“ file1”,向导2调用了文件“ file2”。

What would be the best way to achieve this. 什么是实现这一目标的最佳方法。 I cannot see a 'id' field or get method on either the 'Wizard' class or the INewWizard interface that my NewWizard class implements. 我在NewWizard类实现的“ Wizard”类或INewWizard接口上都看不到“ id”字段或get方法。

I am currently developing on Eclipse SDK 4.2.2 我目前正在使用Eclipse SDK 4.2.2进行开发

Thanks for the help 谢谢您的帮助

似乎没有直接的方法(您可以间接创建两个派生类并以不同的向导使用它)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM