Dead Zone

Stand alone.

新規PHPファイル作成用テンプレートの追加方法

2012-02-23 18:55:28 | Eclipse/PDT

新規PHPファイル作成用テンプレートの追加方法

1. Preferences>PHP>Code Style>Code Templatesを開く
2. 'Simple php file'を編集する(改行を追加する程度で十分です)
3. 設定画面を閉じてEclipseを終了する
4. テキストエディタで以下のファイルを開く
workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.php.ui.prefs
5. 以下の行を探す
org.eclipse.php.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="php_new_file_context" deleted\="false" description\="Simple php file" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.author" name\="New simple PHP file"><?php\r\n//\r\n${cursor}</template></templates>
6. 該当行を編集する
・descriptionを適当に変更 ("Simple php file" => お好きなように)
・nameを適当に変更 ("New simple PHP file" => お好きなように)
・「id\="org.eclipse.php.ui.editor.templates.php.author"」を削除
(さらに追加したい場合は<template>...</template>をコピー)
7. 保存してエディタを終了する
8. Eclipseを起動する
9. Preferences>PHP>Code Style>Code Templatesを開く
10. 新しく追加されたテンプレートを編集する

既知の問題:
1. 追加されたテンプレートをエクスポートはできますが、インポートはできません(インポートはビルトイン・テンプレートしか受け付けないようになっているため)


HOW TO add new template to code templates

1. Open Preferences>PHP>Code Style>Code Templates
2. Edit 'Simple php file' (e.g. insert "//")
3. Close preferences and exit Eclipse
4. Open following file with text editor
workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.php.ui.prefs
5. Find following line
org.eclipse.php.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="php_new_file_context" deleted\="false" description\="Simple php file" enabled\="true" id\="org.eclipse.php.ui.editor.templates.php.author" name\="New simple PHP file"><?php\r\n//\r\n${cursor}</template></templates>
6. Edit the line
modify description, "Simple php file" => as you like
modify name, "New simple PHP file" => as you like
delete 'id\="org.eclipse.php.ui.editor.templates.php.author"'
(if you want to add more templates, copy <template>...</template>)
7. Save it and exit editor
8. Start Eclipse
9. Open Preferences>PHP>Code Style>Code Templates
10. Edit new template which you made

Known issue:
1. Added templates can be exported but cannot be imported.

ジャンル:
ソフトウェア
キーワード
インポート ビルトイン エクスポート
コメント (0) |  トラックバック (0) |  この記事についてブログを書く
Messenger この記事をはてなブックマークに追加 mixiチェック シェア
« おやぁ?びっくり... | トップ | Indigo SR2 »

コメント

コメントはありません。

コメントを投稿


コメント利用規約に同意の上コメント投稿を行ってください。
※文字化け等の原因になりますので、顔文字の利用はお控えください。
下記数字4桁を入力し、投稿ボタンを押してください。この数字を読み取っていただくことで自動化されたプログラムによる投稿でないことを確認させていただいております。
数字4桁

トラックバック

この記事のトラックバック  Ping-URL
  • 30日以上前の記事に対するトラックバックは受け取らないよう設定されております。
  • 送信元の記事内容が半角英数のみのトラックバックは受け取らないよう設定されております。
  • このブログへのリンクがない記事からのトラックバックは受け取らないよう設定されております。
  • ※ブログ管理者のみ、編集画面で設定の変更が可能です。

あわせて読む