-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update document. Extension Scaffold.
- Loading branch information
Showing
11 changed files
with
206 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
拡張機能の雛形プロジェクトのセットアップ | ||
==================== | ||
|
||
まずは拡張機能を開発するための準備をしましょう。 | ||
|
||
拡張機能の雛形プロジェクトダウンロード | ||
------------------- | ||
|
||
tmdmaker\_extensionsのダウンロードサイトから | ||
拡張機能の雛形プロジェクト、 `tmdmaker_extension_scaffold_x.y.z.zip <https://tmdmaker/ddlutils/>`_ をダウンロードします。 | ||
|
||
解凍後にフォルダを任意の名前に変更してください。拡張機能の名前と合わせた方が分かりやすいです。 | ||
|
||
Eclipseセットアップ | ||
------------- | ||
|
||
Eclise 4.x系であれば多分大丈夫ですが、なるべく最新版をご利用ください。 | ||
|
||
|
||
拡張機能プロジェクトの取り込み | ||
--------------- | ||
|
||
EclipseのFile-ImportからExisting projects into WorkspaceでNextを選び | ||
Select root directoryで拡張機能のフォルダを選択してFinishを選択します。 | ||
インポート後にプロジェクトフォルダをリファクタリングして拡張機能に名前を付けます。 | ||
|
||
拡張機能の依存関係解決 | ||
----------- | ||
|
||
まだプロジェクトにエラーが出ていますのTMD-Makerの必須プラグインとの依存関係を解決しましょう。 | ||
プロジェクトフォルダ直下のplugin-development.targetを開き | ||
右上のReload Target Platformをクリックしてください。 | ||
しばらく待つとエラーが消えます。 | ||
|
||
お疲れ様でした。拡張機能の開発準備が整いました。 | ||
|
||
雛形の説明 | ||
----- | ||
雛形には以下のクラスが既に用意されています。これらのクラスはplugin.xmlで関連付けされています。 | ||
|
||
- tmdmaker.extensions.scaffold.Actovator | ||
|
||
拡張機能起動時に呼び出されます。雛形では特に何もやっていません。 | ||
|
||
- tmdmaker.extensions.scaffold.importer.FileImporter1 | ||
|
||
tmdmaker.importersを実装するインターフェースを継承したクラス。今回は特に紹介しませんが、興味があれば挑戦してみてください。 | ||
|
||
- tmdmaker.extensions.scaffold.generator.Generator1 | ||
|
||
tmdmaker.generatorsを実装するインターフェースを継承したクラス。これからサンプルを実装します。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Generator拡張機能作成 | ||
=============== | ||
|
||
それでは拡張機能を開発していきましょう。 | ||
まずはGeneratorを拡張した簡単なファイル出力サンプルを作成します。 | ||
|
||
コンテキストメニューに表示する名前を決める | ||
--------------------- | ||
|
||
以下のメソッドをオーバーライドするとコンテキストメニューに表示する名前が決まります。グループ名はコンテキストメニュー表示される順番に影響します。:: | ||
|
||
@Override | ||
public String getGeneratorName() { | ||
return "エンティティ一覧"; | ||
} | ||
|
||
@Override | ||
public String getGroupName() { | ||
// TODO Auto-generated method stub | ||
return "雛形グループ"; | ||
} | ||
|
||
モデルの情報をファイルに出力する | ||
---------------- | ||
|
||
以下が実行時の処理です。ファイルを作成してモデルの情報を出力しています。:: | ||
|
||
@Override | ||
public void execute(String rootDir, List<AbstractEntityModel> models) { | ||
File file = new File(rootDir, "entity_name.txt"); | ||
PrintWriter writer = null; | ||
try { | ||
writer = new PrintWriter(file, "UTF-8"); | ||
for (AbstractEntityModel model : models) { | ||
writer.print(model.getName()); | ||
writer.print(","); | ||
writer.println(model.getEntityType()); | ||
} | ||
} catch (Exception e) { | ||
// TODO: 例外をthrow | ||
} finally { | ||
if (writer != null) { | ||
writer.flush(); | ||
writer.close(); | ||
} | ||
} | ||
} | ||
|
||
|
||
これだけです。モデルの構成やEclipse Pluginの仕組みを理解すれば、より高度なデータ出力が実現可能です。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Generator拡張機能実行 | ||
=============== | ||
|
||
最後に作成した拡張機能を実行します。 | ||
拡張機能のjarファイルを作成してTMD-Makerにインストールして拡張機能を動かしてみましょう。 | ||
|
||
サンプル拡張機能をエクスポート | ||
--------------- | ||
|
||
1. plugin.xmlを開きます。 | ||
2. Overviewタブの右下、Export Wizardをクリックします。 | ||
3. DestinationタブのDirectoryで任意の出力先を指定してFinishボタンをクリックします。 | ||
4. 出力先のpluginsフォルダ内にjarファイルが作成されます。 | ||
|
||
サンプル拡張機能をインストール | ||
--------------- | ||
|
||
TMD-Makerのフォルダ配下のdropinsフォルダにjarファイルを配置した後、TMD-Makerを実行します。 | ||
|
||
TMD-Makerで動作確認 | ||
-------------- | ||
|
||
エディタ内で右クリックした時にコンテキストメニューに表示された拡張機能選択してみましょう。 | ||
ファイルが出力されましたか? | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
拡張機能まとめ | ||
======= | ||
|
||
今回はGeneratorのサンプルを作成してみました。 | ||
FileImporterについても興味があれば是非挑戦してみてください。 | ||
|
||
またTMD-Makerのモデル自体や他の機能も公開されていますので | ||
皆でTMD-Makerをより良いものにしていきましょう。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
リファレンス | ||
============= | ||
TMD-Makerの機能を拡張する | ||
================= | ||
|
||
このパートでは、TMD-Makerの機能拡張の作成方法を説明します。 | ||
|
||
TMD-Makerは機能を拡張できるポイントをいくつか持っています。 | ||
この機能拡張ポイントを利用して独自の機能拡張を作成することができます。 | ||
現在利用可能な機能拡張ポイントは以下の通りです。 | ||
|
||
1. tmdmaker.generators | ||
|
||
TMD-Makerのモデルから、別フォーマットのファイルを生成できます。 | ||
htmlやDDL、Sphinx、csv形式のドキュメント出力機能もこの拡張ポイントを使っています。 | ||
|
||
2. tmdmaker.importers | ||
|
||
別フォーマットのファイルからTMD-Makerのモデルを生成できます。 | ||
csv形式からTMD-Makerへのインポート機能もこの拡張ポイントを使っています。 | ||
|
||
TMD-MakerはEclipse Pluginで作成されていますが、 | ||
紹介する雛形のプロジェクトを利用すればEclipse Pluginが分からなくても、Javaが書ければ多分大丈夫! | ||
是非挑戦してみてください。 | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
rcp | ||
database | ||
csvformat | ||
faq | ||
p3-ch1 | ||
p3-ch2 | ||
p3-ch3 | ||
p3-ch4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
TMD-Makerの開発に参加する | ||
================= | ||
|
||
このパートでは、TMD-Makerの開発方法を説明します。 | ||
|
||
TMD-Makerはosdnを利用しています。 | ||
|
||
開発に必要な情報は以下に記載しています。随時更新してます。 | ||
|
||
https://osdn.net/projects/tmdmaker/wiki/Development | ||
|
||
osdnは無料なのでアカウント登録したら是非以下のページからメンバー参加してみてください。 | ||
|
||
https://osdn.net/projects/tmdmaker/memberlist/ | ||
|
||
.. toctree:: | ||
:maxdepth: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
リファレンス | ||
============= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
rcp | ||
database | ||
csvformat | ||
faq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters