プラグイン(12) Export Wizard

忘れてた。IrenkaのHackはExport Wizard使って配布可能な形式を作ります。

再利用性考えて、ExporterのコアはEclipseに癒着しないように作らなきゃですが、とりあえずそれは後で考えればいいや。誰かがやってくれるかもしれないしね。

export画面の拡張ポイントを探す

  1. @PDE: Search > Plug-ins...
    1. Search string: *export*
    2. Search For: Extension Point
    3. Limit To: Declarations
    4. External Scope Enabled Plug-ins Only

結果は

  1. org.eclipse.hyades.analysis.engine.symptomExportHandler
  2. org.eclipse.hyades.exportViewers
  3. org.eclipse.tptp.platform.analysis.core.analysisExport
  4. org.eclipse.ui.exportWizards

たぶん一番下かな。プラグインが org.eclipse.ui だし。

Description:
This extension point is used to register export wizard extensions. Export wizards appear as choices within the "Export Dialog", and are used to export resources from the workbench.

Wizards may optionally specify a description subelement whose body should contain short text about the wizard.

ですよねー。

使ってみる

META-INF/MANIFEST.MF > Dependencies

  1. Add
    1. Select a Plug-in: org.eclipse.ui
    2. OK
  2. Add
    1. Select a Plug-in: org.eclipse.ui.views
    2. OK

META-INF/MANIFEST.MF > Extensions

  1. Add
    1. Extension Point filter: org.eclipse.ui.exportWizards
    2. select: org.eclipse.ui.exportWizards
    3. Finish

拡張ポイントに org.eclipse.ui.exportWizards が追加される。

とりあえずカテゴリ(Exportの種類一覧に出るフォルダ)を追加
org.eclipse.ui.exportWizardsを右クリック > New > category

  1. Extension Element Details
    1. id: org.ashikunep.irenka.packager.ui.exportIrenkaHack
    2. name: Irenka Hack

org.eclipse.ui.exportWizardsを右クリック > New > wizard

  1. Extension Element Details
    1. id: org.ashikunep.irenka.packager.ui.exportWizard
    2. name: Hack Export Wizard
    3. class: org.ashikunep.irenka.packager.ui.HackExportWizard
    4. category: org.ashikunep.irenka.packager.ui.exportIrenkaHack
    5. icon: icons/sample.gif (Eclipseマーク)

はまりポイント

java.lang.ClassCastException: org.eclipse.jdt.internal.core.JavaProject cannot be cast to org.eclipse.core.resources.IResource
at org.eclipse.ui.dialogs.WizardExportResourcesPage.setupBasedOnInitialSelections(WizardExportResourcesPage.java:532)

IStructuredSelectionがIResourceじゃない型で返してしまうので、IAdaptable#getAdapterしまくりな感じ?

地味に頭痛がひどい。土日にやろうかな