Eclipse ¥¨¥Ç¥£¥¿Ä´ººÊó¹ð½ñ

³ô¼°²ñ¼Ò ¥Ç¥å¥ª¥·¥¹¥Æ¥à¥º


目次
Eclipse¤Î¥¨¥Ç¥£¥¿
»öÁ°½àÈ÷
Eclipse¥½¡¼¥¹¥Ä¥ê¡¼¤Î¼è¤ê¹þ¤ß
Ëܥɥ­¥å¥á¥ó¥È¤òÆɤà¾å¤ÇɬÍפȤʤë¥×¥é¥°¥¤¥ó
Eclipse ¤Î¥Æ¥­¥¹¥ÈÊÔ½¸µ¡Ç½
Eclipse ¤Ç¤Î¥¨¥Ç¥£¥¿¤Î¹½À®
¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿
Eclipse ¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯
JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ë¥¨¥Ç¥£¥¿¤Îµ¡Ç½
JDT ¤Î Java ¥¨¥Ç¥£¥¿
Java ¥¨¥Ç¥£¥¿¤Î³µÍ×
Java ¥¨¥Ç¥£¥¿¤Î¼ÂÂÎ
Java ¥¨¥Ç¥£¥¿¤Î½ôµ¡Ç½¤Î¼ÂÁõ
Java ¥¨¥Ç¥£¥¿¤Î³ÈÄ¥
Eclipse ¤Î¥Ó¥ë¥É
³Ú´ÑŪ try ¤Ë´Ø¤¹¤ë³ÈÄ¥
¥Þ¥Ã¥×½é´ü²½»Ò¤Ë´Ø¤¹¤ë³ÈÄ¥
Java¥×¥í¥°¥é¥à¤òMixJuice¤Ë°Ü¿¢¤¹¤ë
Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
°Ü¿¢ºî¶È
define¤ò¤Ä¤±¤ë
¥á¥ó¥Ð̾¤òFQN¤Ç¤Ï¤Ê¤¯¥·¥ó¥×¥ë¥Í¡¼¥à¤Ç½ÐÎϤµ¤»¤ë
¥Ñ¥Ã¥±¡¼¥¸¤ò¥â¥¸¥å¡¼¥ë¤Ø
importʸ¤ò½üµî
¥Ç¥Õ¥©¥ë¥È¤Î¥³¥ó¥¹¥È¥é¥¯¥¿¤òÄɲÃ
¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤ò¥¤¥ó¥¹¥¿¥ó¥¹¥á¥½¥Ã¥É¤Ø
¥ê¥Õ¥ì¥¯¥·¥ç¥ó¤ò»ÈÍѤ·¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤òºî¤ëºÝ¡¢¥³¥ó¥¹¥È¥é¥¯¥¿¸Æ¤Ó½Ð¤·¤òÄɲ乤ë
ÆâÉô¥¯¥é¥¹¤Î³°Éô²½
super¤òoriginal¤ËÊѹ¹¤¹¤ë
C.class¤òClass.forName("C")¤ØÊѹ¹¤¹¤ë
interface¤ÇÄêµÁ¤·¤¿¥á¥½¥Ã¥É¤Î¼ÂÁõ
°Ü¿¢·ë²Ì
°Ü¿¢¾å¤ÎÌäÂêÅÀ
¾¥â¥¸¥å¡¼¥ë¤Î»²¾È
¥á¥ó¥Ð¤¬¤¹¤Ù¤Æpublic¤Ë¤Ê¤ë
¥É¥­¥å¥á¥ó¥Æ¡¼¥·¥ç¥ó¥Ä¡¼¥ë¤¬¤Ê¤¤

Eclipse¤Î¥¨¥Ç¥£¥¿

ËܾϤǤϡ¢Eclipse¤Î¥¨¥Ç¥£¥¿¤Î¹½Â¤¡¢¤ª¤è¤Ó¤½¤ÎÊѹ¹ÊýË¡¤Ë¤Ä¤¤ ¤Æµ­½Ò¤¹¤ë¡£ ¤Þ¤º¡¢»öÁ°½àÈ÷¤Ç¥½¡¼¥¹±ÜÍ÷¤Î¤¿¤á¤Î½àÈ÷¤Ë¤Ä¤¤¤Æ½Ò¤Ù ¤ë¡£Eclipse ¤Î¥Æ¥­¥¹¥ÈÊÔ½¸µ¡Ç½¤Ç¡¢Eclipse¤Î¥ï¡¼¥¯¥Ù ¥ó¥Á¤¬Ä󶡤¹¤ëÈÆÍÑ¥¨¥Ç¥£¥¿¤È¤½¤Î´ðËܵ¡Ç½¤ª¤è¤Ó¼ÂÁõ¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£ ¤½¤·¤Æ¡¢JDT ¤Î Java ¥¨¥Ç¥£¥¿¤Ç Java ÀìÍÑ¥¨¥Ç¥£¥¿¤Î¼ÂÁõ¤Ë¤Ä¤¤ ¤Æ¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥¨¥Ç¥£¥¿µ¡Ç½¤È¤Î´ØÏ¢¤ò¸ò¤¨¤ÆÀâÌÀ¤¹¤ë¡£ ºÇ¸å¤Ë¡¢ Java ¥¨¥Ç¥£¥¿¤Î³ÈÄ¥¤Ç¡¢Java ¥¨¥Ç¥£¥¿¤Ø¤Îµ¡Ç½Äɲäμ Áõ»öÎã¤ò¾Ò²ð¤¹¤ë¤È¤È¤â¤Ë¡¢pxml Âбþ Java ¥¨¥Ç¥£¥¿¤ò¼ÂÁõ¤¹¤ë¾å¤Ç¤Î²ÝÂê¤Ë ¤â¿¨¤ì¤ë¡£


»öÁ°½àÈ÷

Ëܥɥ­¥å¥á¥ó¥È¤òÍý²ò¤¹¤ë¤¦¤¨¤Ç¡¢Eclipse ¤Î¥½¡¼¥¹¤ª¤è¤Ó¡¢¤³¤ì¤ò¸úΨ¤è¤¯ ±ÜÍ÷¤¹¤ë¤¿¤á¤Î¥Ä¡¼¥ë¤¬É¬Í×ÉԲķç¤Ç¤¢¤ë¡£ ¤½¤³¤Ç¡¢Ëܥɥ­¥å¥á¥ó¥È¤òÆɤ߿ʤá¤Æ¤¤¤¯¾å¤Ç¤Î»öÁ°½àÈ÷¤È¤·¤Æ¡¢ËÜÀá¤Ç¤Ï Eclipse ¤Î¥½¡¼¥¹¥Ä¥ê¡¼¤ò Eclipse ¤Ç±ÜÍ÷¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£ ¤Ê¤ª¡¢ËÜÀá¤ÎÆâÍƤˤÏÁ°²ó¤ÎÄ´ººÊó¹ð¤ÎÆâÍƤȽÅÊ£¤¹¤ë¡£¼ê½çÅù¤Î¾ÜºÙ¤Ë¤Ä¤¤¤Æ ¤ÏÁ°²ó¤ÎÄ´ººÊó¹ð¤ò»²¾È¤¤¤¿¤À¤­¤¿¤¤¡£


Eclipse¥½¡¼¥¹¥Ä¥ê¡¼¤Î¼è¤ê¹þ¤ß

Ëܹà¤Ç¤Ï¡¢Eclipse ¤Î¥½¡¼¥¹¥Ä¥ê¡¼¤ò Eclipse ¤Î¥ï¡¼¥¯¥¹¥Ú¡¼¥¹¤Ë¥¤ ¥ó¥Ý¡¼¥È¤¹¤ëÊýË¡¤òÀâÌÀ¤¹¤ë¡£ ¥¤¥ó¥Ý¡¼¥Èºî¶È¤Ï²¼µ­¤Î¼ê½ç¤Ç¹Ô¤¦¡£

  1. Eclipse¤Î¥½¡¼¥¹¤òŸ³«¤¹¤ë¡£Å¸³«Àè(plugins¥Ç¥£¥ì¥¯¥È¥ê¤ò´Þ¤à¥Ç¥£¥ì¥¯¥È ¥ê)¤ò${ECLIPSESRC}¤È¤¹¤ë¡£

  2. Eclipse¤òµ¯Æ°¤·¡¢¥Õ¥¡¥¤¥ë (File)->¿·µ¬ (New)->¥×¥í¥¸¥§¥¯¥È (Project) ¤òÁªÂò¡£

  3. ¿·µ¬¥×¥í¥¸¥§¥¯¥È (new project) ¤¬É½¼¨¤µ¤ì¤¿¤é¡¢¥À¥¤¥¢¥í¥°¤Îº¸Â¦¤Ç¥·¥ó¥× ¥ë(Simple)¤òÁªÂò¤·¡¢±¦Â¦¤Ç¥×¥í¥¸¥§¥¯¥È(Project) ¤òÁªÂò¤¹¤ë¡£Next ¤ò¥¯¥ê¥Ã ¥¯¡£

  4. ¥×¥í¥¸¥§¥¯¥È»ØÄê¥À¥¤¥¢¥í¥°¤Ç¡¢¥Ç¥Õ¥©¥ë¥È¤Î»ÈÍÑ (Use default) ¤Î¥Á¥§¥Ã¥¯ ¤ò¤Ï¤º¤·¡¢${ECLIPSESRC}/plugins/<¥×¥é¥°¥¤¥ó̾> ¤òDirectory¤Ë»ØÄꤹ ¤ë¡£¥×¥í¥¸¥§¥¯¥È̾ (Project name) ¤Ë¤Ï¡¢<¥×¥é¥°¥¤¥ó̾>¤ò»ØÄꤹ¤ë¡£ Finish ¤ò¥¯¥ê¥Ã¥¯¡£

  5. °Ê¾å¤Îºî¶È¤ò¡¢É¬ÍפȤʤë¥×¥é¥°¥¤¥óÁ´¤Æ¤ËÂФ·¤Æ¹Ô¤¦¡£ °Í¸´Ø·¸¤Î¤¢¤ë¥×¥é¥°¥¤¥ó¤¬¼è¤ê¹þ¤Þ¤ì¤Æ¤¤¤Ê¤¤¤È¤È¥¨¥é¡¼¤¬É½¼¨¤µ¤ì¤ë¤¬¡¢¤³ ¤ì¤ÏɬÍפʥץ饰¥¤¥ó¤òÁ´¤Æ¼è¤ê¹þ¤à¤³¤È¤Çɽ¼¨¤µ¤ì¤Ê¤¯¤Ê¤ë¡£

  6. ¼è¤ê¹þ¤ß¸å¡¢¡ÖJava ¥Ö¥é¥¦¥º¡×¥Ñ¡¼¥¹¥Ú¥¯¥Æ¥£¥ÖÅù¤òÍøÍѤ¹¤ë¤³¤È¤Ç¡¢¸úΨŪ ¤Ë¥½¡¼¥¹¤¬±ÜÍ÷¤Ç¤­¤ë¡£

ティップ

Eclipse ¤Î¥½¡¼¥¹¤Ï¥×¥é¥°¥¤¥ó¤¬°ì¤Ä¤Î¥×¥í¥¸¥§¥¯¥È¤Ë¤Ê¤ë¤¿¤á,¥ï¡¼¥¯¥¹¥Ú¡¼ ¥¹¤¬ Eclipse ¥×¥é¥°¥¤¥ó¤Ç¤¤¤Ã¤Ñ¤¤¤Ë¤Ê¤Ã¤Æ¡¢¤½¤Î¾¤Î¥×¥í¥¸¥§¥¯¥È¤Î»²¾È À­¤¬²¼¤¬¤Ã¤Æ¤·¤Þ¤¦¡£ ¤³¤¦¤¤¤¦¤È¤­¤Ë¤Ï¡¢Ê£¿ô¤Î¥×¥í¥¸¥§¥¯¥È¤ò¤Þ¤È¤á¤Æ£±¤Ä¤Î ºî¶È¥»¥Ã¥È (working set) ¤ËÅÐÏ¿¤¹¤ë¤È¸ú²ÌŪ¤Ç¤¢¤ë¡£ »ÈÍÑÊýË¡¤Ï¡Ö¥ê¥½¡¼¥¹¡×¥Ñ¡¼¥¹¥Ú¥¯¥Æ¥£¥Ö¤Î¡Ö¥Ê¥Ó¥²¡¼¥¿¡×¥Ó¥å¡¼¤ä¡¢¡ÖJava¡× ¥Ñ¡¼¥¹¥Ú¥¯¥Æ¥£¥Ö¤Î¡Ö¥Ñ¥Ã¥±¡¼¥¸¡¦¥¨¥¯¥¹¥×¥í¡¼¥é¡¼¡×¥Ó¥å¡¼¡¢¡ÖJava¥Ö¥é¥¦¥º¡× ¥Ñ¡¼¥¹¥Ú¥¯¥Æ¥£¥Ö¤Î¡Ö¥Ê¥Ó¥²¡¼¥¿¡×¥Ó¥å¡¼¤Ê¤É¤Î±¦¾å¤Ë¤¢¤ë¢§¥á¥Ë¥å¡¼¤ò¥¯¥ê¥Ã ¥¯¤·¡¢¡Öºî¶È¥»¥Ã¥È¤ÎÁªÂò(select working set...)¡×¤Ê¤É¤òÁªÂò¤¹¤ë¡£


Ëܥɥ­¥å¥á¥ó¥È¤òÆɤà¾å¤ÇɬÍפȤʤë¥×¥é¥°¥¤¥ó

Ëܥɥ­¥å¥á¥ó¥È¤òÆɤ߿ʤá¤ë¾å¤ÇɬÍפȤʤë¥×¥é¥°¥¤¥ó¤Ï 図1¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

図 1. Java¥¨¥Ç¥£¥¿¤Ë´Ø·¸¤¹¤ë Eclipse¥×¥é¥°¥¤¥ó

警告

org.eclipse.swt ¥×¥é¥°¥¤¥ó¤ò¼è¤ê¹þ¤à¤È¡¢.classpath ¤¬¤Ê¤¤¤È¤¤¤¦¥¨¥é¡¼¤¬ ɽ¼¨¤µ¤ì¤ë¡£ org.eclipse.swt ¤Î¥×¥é¥°¥¤¥ó¥Ç¥£¥ì¥¯¥È¥êľ²¼¤Ë¤¢¤ë .classpath_<¥¦¥£ ¥ó¥É¥¦¥·¥¹¥Æ¥à̾> ¤ÎÃæ¤Î¤¤¤º¤ì¤«¤ò .classpath ¤Ë¥³¥Ô¡¼¤¹¤ë¤³¤È¤Ç¡¢¤³ ¤Î¥¨¥é¡¼¤Ïɽ¼¨¤µ¤ì¤Ê¤¯¤Ê¤ë¡£

% cd ${ECLIPSESRC}/plugins/org.eclipse.swt/
% ln -s .classpath_<¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à̾> .classpath

¤Ê¤ª¡¢図1¤Ë¤Ï°Í¸´Ø·¸¤¬¤¢¤ë¥Ñ¥Ã¥±¡¼¥¸¤ä¡¢¾­Íè Ū¤Ë¥¨¥Ç¥£¥¿³ÈÄ¥¤Î²áÄø¤ÇɬÍפȤʤ뤳¤È¤¬ÁÛÄꤵ¤ì¤ë¥×¥é¥°¥¤¥ó¤Ê¤É¤â°ìÉô´Þ ¤Þ¤ì¤Æ¤¤¤ë¡£½¾¤Ã¤Æ¡¢Ëܥɥ­¥å¥á¥ó¥ÈÃæ¤ËľÀÜÅо줹¤ë¥×¥é¥°¥¤¥ó¤Ï¤³¤Î¤¦¤Á¤Î ¤´¤¯°ìÉô¤Ç¤¢¤ë¡£


Eclipse ¤Î¥Æ¥­¥¹¥ÈÊÔ½¸µ¡Ç½

ËÜÀá¤Ç¤Ï Eclipse ¤Î¥ï¡¼¥¯¥Ù¥ó¥Á¤¬Ä󶡤¹¤ë¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿´ØÏ¢¤Î¥Õ¥ì¡¼ ¥à¥ï¡¼¥¯¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£


Eclipse ¤Ç¤Î¥¨¥Ç¥£¥¿¤Î¹½À®

¤Þ¤ººÇ½é¤Ë¡¢Eclipse ¤Ç¤Î¥¨¥Ç¥£¥¿¤¬¤É¤¦¤¤¤¦¹½À®¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤«¤Ë¤Ä¤¤¤Æ´Ê ñ¤ËÀâÌÀ¤¹¤ë¡£

Eclipse ¤Î¥¨¥Ç¥£¥¿¤Î¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤äÆ°ºî¤Ê¤É¤Ë´Ø¤¹¤ë´ðËܵ¡Ç½¤Ï¡¢ ¥ï¡¼¥¯¥Ù¥ó¥Á¤Ç¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤È¤·¤ÆÄ󶡤µ¤ì¤Æ¤¤¤ë¡£ ¤Þ¤¿¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¤Ï¤½¤ì¼«¿È¤¬´ðËÜŪ¤Ê¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤âÄ󶡤·¤Æ¤ª¤ê¡¢ ¥ï¡¼¥¯¥Ù¥ó¥Á¤¬Ä󶡤¹¤ë¤³¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Ï¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤È¸Æ¤Ð¤ì¤Æ ¤¤¤ë¡£ ¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î¡¢ºÇ¤â¥·¥ó¥×¥ë ¤ÊÍøÍÑÎã¤Èª¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£

ティップ

¥ï¡¼¥¯¥Ù¥ó¥Á¤È¤Ï¡¢Eclipse ¤Î¥³¥¢Éôʬ¤Î¤³¤È¤Ç¤¢¤ë¡£Eclipse ¤Ï¸À¸ì¤äÍÑ ÅӤ˴ؤï¤é¤ºÉ¬ÍפȤʤë°ìÈÌŪ¤Êµ¡Ç½¤ò¥ï¡¼¥¯¥Ù¥ó¥Á¤È¤·¤ÆÄ󶡤·¤Æ¤¤¤ë¡£°ìÊý ¤Ç¡¢Java ³«È¯´Ä¶­¤Ê¤ÉÆÃÄê¤Î¸À¸ì¤ä´Ä¶­¤Ë°Í¸¤·¤¿µ¡Ç½¤Ï¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¤È¤Ï ÆÈΩ¤·¤¿¥×¥é¥°¥¤¥ó¤È¤·¤Æ¼ÂÁõ¤·¡¢ Eclipse ¥ï¡¼¥¯¥Ù¥ó¥Á¤Ë¸Ä¡¹¤Î¥×¥é¥°¥¤ ¥ó¤òÄɲ乤뤳¤È¤Ç¡¢´Ä¶­°Í¸¤Îµ¡Ç½¤¬ÍøÍѤǤ­¤ë¤è¤¦¤Ë¤Ê¤ë¡£Eclipse ¤ÎÇÛ Éۥѥ屡¼¥¸¤Ë¤Ï¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¤Û¤«¤Ë JDT (Java Development Toolkit) ¥×¥é¥°¥¤¥ó¤È¡¢PDE (Plugin Development Environment) ¥×¥é¥°¥¤¥ó¤¬Æ±º­¤µ¤ì¤Æ¤¤¤ë¡£ ¤Ê¤ª¡¢¼ÂºÝ¤Ë¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¼«ÂΤâ¥×¥é¥°¥¤¥ó¤ÈƱÍͤι½À®¤ò¼è¤Ã¤Æ¤¤¤ë¤¿¤á¡¢ ²¼µ­¤Ç¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó¤È¤¤¤Ã¤¿É½µ­¤âÅо줹¤ë¡£ ¥ï¡¼¥¯¥Ù¥ó¥Á¤ä JDT, PDE ¤Ï²¿¤ì¤âµ¡Ç½¤¬Â¿´ô¤Ë¤ï¤¿¤ë¤¿¤á¡¢¼ÂºÝ¤Ë¤ÏÊ£¿ô¤Î¥× ¥é¥°¥¤¥ó¤Î½¸¹ç¤È¤·¤ÆÄ󶡤µ¤ì¤Æ¤¤¤ë¡£

°ìÊý¤Ç¡¢JDT ¤¬Ä󶡤¹¤ë Java ¥¨¥Ç¥£¥¿¤Ê¤É¡¢ÆÃÄê¤Î½ñ¼°¤Ë¥«¥¹¥¿¥Þ¥¤¥º¤µ¤ì ¤¿ÊÔ½¸Êä½õµ¡Ç½¤òÊÝÍ­¤¹¤ë¥¨¥Ç¥£¥¿¤Ï¡¢¸ÄÊ̤Υץ饰¥¤¥ó¤ÇÄ󶡤µ¤ì¤ë¡£ ¤³¤ì¤é¤Î¡¢¤³¤ì¤é¤Î¥«¥¹¥¿¥Þ¥¤¥º¤µ¤ì¤¿¥¨¥Ç¥£¥¿¤â¡¢¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤ÈƱÍÍ ¤Ë¥ï¡¼¥¯¥Ù¥ó¥Á¤¬Ä󶡤¹¤ë¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤òÍøÍѤ¹¤ë¤³¤È¤È¤Ê¤ë¤¬¡¢ ¤½¤ÎºÝ¤Ë¡¢ÂоݤȤ·¤Æ¤¤¤ë¥É¥­¥å¥á¥ó¥È¤Î½ñ¼°¤Ë°Í¸¤·¤¿ÍÍ¡¹¤Êµ¡Ç½¤òÉÕ²ÃŪ¤Ë ¼ÂÁõ¤·¤ÆÉÕ¤±²Ã¤¨¤ëɬÍפ¬¤¢¤ë¡£

¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤ä Java ¥¨¥Ç¥£¥¿¤È¡¢³Æ¼ï¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤È¤Î´Ø·¸ ¤òÀ°Íý¤·¤¿¿Þ¤¬ 図2¤Ç¤¢¤ë¡£ ¤³¤³¤Þ¤Ç¤Ï Eclipse ¤Î¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤È¤Ò¤È¤¯¤¯¤ê¤Ë¤·¤Æ¤­¤¿¤¬¡¢ ¼ÂºÝ¤Ë¤Ï¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ï£³¼ïÎà¤Î¥µ¥Ö¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤ë¡£ ¤½¤ì¤¾¤ì SWT ¤¬Ä󶡤¹¤ë´ðÁÃŪ¤Ê¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹¥Õ¥ì¡¼¥à¥ï¡¼¥¯¡¢ JFace ¤¬Ä󶡤¹¤ë¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ë Æò½¤·¤¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¡¢ ¤µ¤é¤Ë¥ï¡¼¥¯¥Ù¥ó¥Á¤¬Ä󶡤¹¤ëÊñ³çŪ¤Ê¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¢¤ë¡£

図 2. ¸Ä¡¹¤Î¥¨¥Ç¥£¥¿¤ª¤è¤Ó³Æ¼ï¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î´Ø·¸

ティップ

Eclipse ¤Ï¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹Íѥե졼¥à¥ï¡¼¥¯¤È¤·¤Æ Standard Widget Toolkit (SWT) ¤È JFace ¤Î£²¼ïÎà¤òÄ󶡤·¤Æ¤¤¤ë¡£ SWT ¤Ï²¼°Ì¥ì¥Ù¥ë¤Î¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹¥Ä¡¼¥ë¥­¥Ã¥È¤Ç¤¢¤ë¡£SWT ¤Ç¤Ï OS ¤ä ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤Ë°Í¸¤·¤Ê¤¤ API ¤òÄ󶡤¹¤ë¡£¤È¤¤¤Ã¤Æ¤â¡¢¥¦¥£¥ó¥É¥¦¥· ¥¹¥Æ¥à¤¬Ä󶡤¹¤ë¥¦¥£¥¸¥§¥Ã¥È¤ò±£Êä·¡¢¤½¤Î¾¤ÎÉôʬ¤Î¼ÂÁõ¤Î¥·¥¹¥Æ¥à¤Ø¤ÎÈó °Í¸À­¤òÊݾڤ¹¤ë¤Î¤¬¼çÍפʵ¡Ç½¤Ê¤Î¤Ç¡¢´ðËÜŪ¤Ë¤Ï½ô¡¹¤Î¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à ¤¬Ä󶡤¹¤ë¤ÈƱÅù¤Î¥ì¥Ù¥ë¤Î API ¤È¹Í¤¨¤Æ¤è¤¤¡£ °ìÊý¤Ç¡¢JFace ¤Ï SWT ¤è¤ê¤â¾å°Ì¤Î¥ì¥Ù¥ë¤Îµ¡Ç½¤òÄ󶡤¹¤ë¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§ ¥¤¥¹¥Ä¡¼¥ë¥­¥Ã¥È¤Ç¤¢¤ë¡£¶ñÂÎŪ¤Ë¤Ï¡¢¥À¥¤¥¢¥í¥°¤ä¥¦¥£¥¶¡¼¥É¡¢¥¢¥¯¥·¥ç¥ó¤Ê ¤É¤È¤¤¤Ã¤¿µ¡Ç½¤¬Ä󶡤µ¤ì¤ë¡£JFace ¤ÎËؤó¤É¤Îµ¡Ç½¤Ï SWT ¤ò¥Ù¡¼¥¹¤È¤·¤Æ¼Â Áõ¤µ¤ì¤Æ¤ª¤ê¡¢JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ë§¤Ã¤¿¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤òºîÀ®¤¹¤ë ¸Â¤ê¤Ë¤ª¤¤¤Æ¤Ï SWT ¤òËؤó¤É»²¾È¤¹¤ë¤³¤È¤Ê¤¯¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ò¹½ÃÛ¤¹ ¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£¤·¤«¤·¡¢JFace ¤Ï SWT ¤ò´°Á´¤Ë±£Ê乤ë¤â¤Î¤Ç¤Ï¤Ê¤¤¤Î ¤Ç¡¢É¬Íפ˱þ¤¸¤Æ SWT ¤òľÀÜÍøÍѤ¹¤ë¤³¤È¤â²Äǽ¤Ç¤¢¤ë¡£ ¤Ê¤ª¡¢JFace ¤Ï J ¤Ç»Ï¤Þ¤ë¤¬ Java ¥¨¥Ç¥£¥¿ÀìÍѤȤ¤¤¦¤ï¤±¤Ç¤Ï¤Ê¤¯¡¢ Eclipse ¤ÎÈÆÍѤΥե졼¥à¥ï¡¼¥¯¤Ç¤¢¤ë¡£

¤³¤ì¤é¤Î£³¼ïÎà¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î¤¦¤Á¡¢SWT ¤È JFace ¤Ë´Ø ¤¹¤ë¤â¤Î¤Ï¡¢¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡¢¤Ä¤Þ¤êÆþÎϤª¤è¤Óɽ¼¨¤Ë´Ø¤¹¤ëµ¡Ç½¤¬½¸Ìó ¤µ¤ì¤Æ¤¤¤ë¡£°ìÊý¤Ç¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ï¡¢É½¼¨¤Î ¤ß¤Ê¤é¤º¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤ÎÆ°ºî¤½¤Î¤â¤Î¤Ë´Ø¤¹¤ëµ¡Ç½¤òÄ󶡤·¤Æ¤¤¤ë¡£ ¤Þ¤¿¡¢É½¼¨¤Ë´Ø¤¹¤ë½ô¡¹¤Î¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ò½¸Ìó¤·¡¢¤è¤ê¼ÂÁõ¤¬¤·¤ä¤¹¤¤¤è¤¦¤Ë À°Íý¤µ¤ì¤Æ¤¤¤ë¡£

¤Ê¤ª¡¢¾åµ­¤Î¿Þ¤Ç¤Ï¤½¤ì¤¾¤ì¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤«¤é SWT ¤Ø¤ÎÀþ¤¬°ú¤«¤ì¤Æ¤¤¤ë ¤¬¡¢¼ÂºÝ¤Ï JFace ¤Î¥¨¥Ç¥£¥¿¤Î¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬ SWT ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î¤«¤Ê¤ê ¤ÎÉôʬ¤ò±£Ê䷤Ƥª¤ê¡¢¥¨¥Ç¥£¥¿µ¡Ç½¤Î¼ÂÁõ¤ò¹Ô¤¦²áÄø¤Ç SWT ¤Î¥¯¥é¥¹Åù¤òľ ÀÜ»²¾È¤¹¤ë¤³¤È¤Ï¤Þ¤º¤Ê¤¤¤È¤¤¤Ã¤Æ¤¤¤¤¡£ ¼ÂºÝ¡¢º£²ó¤ÎÄ´ººÊó¹ð¤Ç¤â SWT ¤Ë°¤¹¤ë¥¯¥é¥¹¤Ï°ìÀÚÅо줷¤Ê¤¤¡£

¼¡¹à°Ê¹ß¤Ç¤Ï¡¢¤Þ¤º Eclipse ¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ë¤Ä¤¤¤ÆÀâ ÌÀ¤·¤¿¾å¤Ç¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¤ª¤è¤Ó JFace ¤¬Ä󶡤¹¤ë¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ò ÀâÌÀ¤¹¤ë¡£


¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿

¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ï Eclipse ¤Ç¥Õ¥¡¥¤¥ëÅù¤ò³«¤¯ºÝ¤Ë¡¢¤½¤Î¥Õ¥¡¥¤¥ë¥¿¥¤ ¥×¤ËÂбþ¤¹¤ë³ÈÄ¥¥¨¥Ç¥£¥¿¤¬µ¬Äꤵ¤ì¤Æ¤¤¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¡¢»ÈÍѤµ¤ì¤ë¥¨¥Ç¥£¥¿ ¤Ç¤¢¤ë¡£ Eclipse ¤Ç .txt ¤Ê¤É¤Î¥Õ¥¡¥¤¥ë¤ò³«¤¤¤¿¤È¤­¤Ë¡¢ÆâÍƤÎɽ¼¨¤Ë»È¤ï¤ì¤Æ¤¤¤ë ¥¨¥Ç¥£¥¿¤¬¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ç¤¢¤ë¤È¹Í¤¨¤Æ´Ö°ã¤¤¤Ê¤¤¡£ ¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ï¡¢ËÜʸ¤Îɽ¼¨¤äÆþÎϤµ¤ì¤¿Ê¸»ú¤ÎÁÞÆþ¤Ï¤â¤È¤è¤ê¡¢ ÈÏ°ÏÁªÂò¤ä¥«¥Ã¥È¡õ¥Ú¡¼¥¹¥È¤Ê¤É¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤¬»ý¤Ã¤Æ¤¤¤ë´ðËÜŪ¤ÊÊÔ½¸ µ¡Ç½¤òÁ´¤ÆÄ󶡤·¤Æ¤¤¤ë¡£

¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Î¼ÂÂΤϥ¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó org.eclipse.ui.editors ¤Î org.eclipse.ui.editors.text ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤¢¤ë TextEditor.java ¤Ç¤¢¤ë¡£ ¤³¤Î¥½¡¼¥¹¤Ï org.eclipse.ui.editors ¥×¥é¥°¥¤¥ó ¤Î src/org/eclipse/ui/editors/text/TextEditor.java ¤Ë¤¢¤ë¡£

ティップ

Eclipse ¤ÇÊ£¿ô¤Î¥×¥í¥¸¥§¥¯¥È¤ÎÃ椫¤éÆÃÄê¤Î¥¯¥é¥¹¤ä¥á¥½¥Ã¥É¤ò¸¡º÷¤¹¤ëºÝ ¤Ë¤Ï¡¢¡Ö¸¡º÷(Search)¡×¥á¥Ë¥å¡¼¤Î¡Ö¸¡º÷(Search)¡×¤òÁªÂò¤·¡¢³«¤¤¤¿¥À¥¤ ¥¢¥í¥°¤Î¡ÖJava ¸¡º÷(Java Search)¡×¤ò³èÍѤ¹¤ë¤È¤è¤¤¡£ ¤Þ¤¿¡¢´û¤Ëɽ¼¨¤µ¤ì¤Æ¤¤¤ë¥½¡¼¥¹¥³¡¼¥É¤Î»²¾È¥¯¥é¥¹Åù¤ò¸«¤¿¤¤¾ì¹ç¤Ï¡¢¥½¡¼¥¹ Ãæ¤Î¥¯¥é¥¹¤ä¥á¥½¥Ã¥É¤òÁªÂò¤·¡¢±¦¥Ü¥¿¥ó¥á¥Ë¥å¡¼¤«¤é¡ÖÀë¸À¤ò³«¤¯(Open Declaration)¡×¤ä¡Ö¸¡º÷(Search)¡×¢ª¡Ö»²¾È(References) / Àë¸À(Declarations) / ¥¤¥ó¥×¥ê¥á¥ó¥¿¡¼(Implementors)¡×¢ª¡Ö¥ï¡¼¥¯¥¹¥Ú¡¼¥¹(Workspace)¡×¤Ê¤É¤ò ³èÍѤ¹¤ë¤È¤è¤¤¡£³Æ¼ï¥Ó¥å¡¼¤Ç¤â±¦¥Ü¥¿¥ó¥á¥Ë¥å¡¼¤«¤éƱÍͤθ¡º÷¤¬²Äǽ¤Ç¤¢¤ë¡£

¤³¤Î TextEditor ¥¯¥é¥¹¤Ï¡¢Eclipse ¤Î¥ï¡¼¥¯¥Ù¥ó¥Á¤¬Ä󶡤¹¤ë¥Æ¥­¥¹¥È¥¨¥Ç¥£ ¥¿ÍѤΥե졼¥à¥ï¡¼¥¯¤òËؤó¤É¤½¤Î¤Þ¤ÞÍѤ¤¤Æ¡¢¥ß¥Ë¥Þ¥à¤Î¥Æ¥­¥¹¥ÈÊÔ½¸µ¡Ç½¤ò »ý¤Ä¥¨¥Ç¥£¥¿¤È¤·¤Æ¼ÂÁõ¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£ ½¾¤Ã¤Æ¡¢¼ÂÁõ¤ÎËؤó¤É¤Ï¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿Íѥե졼¥à¥ï¡¼¥¯¤Î ¥¯¥é¥¹¤Ë°Í¸¤·¤Æ¤¤¤ë¡£ ¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¥¯¥é¥¹ TextEditor ¤Î¥¯¥é¥¹³¬Áؤò 図3 ¤Ë¼¨¤¹¡£

図 3. TextEditor¤Î¥¯¥é¥¹³¬ÁØ

¿ÞÃæ¤Î TextEditor ¤¬¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ç¤¢¤ë¡£¤Þ¤¿¡¢JavaEditor ¤Ï Java ¤ÎÊÔ½¸¤Î¤¿¤á¤ËÍÍ¡¹¤Êµ¡Ç½¤òÉղä·¤¿¥¨¥Ç¥£¥¿¤Ç¤¢¤ë¡£ ¤Ê¤ª¡¢JavaEditor ¤Ë¤Ä¤¤¤Æ¤Ï¡¢JDT ¤Î Java ¥¨¥Ç¥£¥¿¤Ç²òÀ⤹¤ë¡£

ティップ

¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó¤ò¤Ï¤¸¤á¤È¤·¤ÆËؤó¤ÉÁ´¤Æ¤Î¥×¥é¥°¥¤¥ó¤ÏÆâÉô¤ËÊ£¿ô¤Î Java ¥Ñ¥Ã¥±¡¼¥¸¤òÊÝÍ­¤·¤Æ¤¤¤ë¡£Î㤨¤Ð¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó org.eclipse.ui.editors ¤Ï²¼µ­¤Î¥Ñ¥Ã¥±¡¼¥¸¤ò´Þ¤ó¤Ç¤¤¤ë¡£

  • org.eclipse.ui.editors.text

  • org.eclipse.ui.internal.editors.text

  • org.eclipse.ui.texteditor

  • org.eclipse.ui.internal

¥×¥é¥°¥¤¥óÆâ¤Î¥Ñ¥Ã¥±¡¼¥¸¤¬¥×¥é¥°¥¤¥ó̾¤Î¥µ¥Ö¥Ñ¥Ã¥±¡¼¥¸¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤È¤Ï¸Â ¤é¤Ê¤¤¤Î¤ÇÃí°Õ¤¬É¬ÍפǤ¢¤ë¡£Î㤨¤Ð¡¢org.eclipse.ui.editors ¥Ñ¥Ã¥±¡¼¥¸¤Ë ¤Ï¾åµ­¤ÎÍÍ¤Ë org.eclipse.ui.texteditor ¥Ñ¥Ã¥±¡¼¥¸¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¡£

¤³¤Î¿Þ¤«¤é¡¢Eclipse ¤Î¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤ä Java ¥¨¥Ç¥£¥¿¤Ï¶¦Ä̤Υ¯¥é¥¹ StatusTextEditor ¤¬¥Ù¡¼¥¹¤È¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤¬¤ï¤«¤ë¡£ ¤³¤Î StatusTextEditor ¥¯¥é¥¹¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó org.eclipse.ui.workbench.text ¤Î org.eclipse.ui.texteditor ¥Ñ¥Ã¥±¡¼¥¸¤Ë °¤¹¤ë¥¯¥é¥¹¤Ç¤¢¤ë¡£ ¼ÂºÝ¤Ë¤Ï StatusTextEditor ¤ÏƱ¤¸¤¯ org.eclipse.ui.texteditor ¥Ñ¥Ã¥±¡¼¥¸¤Ë °¤¹¤ë AbstractTextEditor ¥¯¥é¥¹¤ò·Ñ¾µ¤·¤Æ¤ª¤ê¡¢¤³¤Î AbstractTextEditor ¤¬¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î´ðËܵ¡Ç½¤òÄ󶡤·¤Æ¤¤¤ë¡£

警告

TextEditor ¤Ï org.eclipse.ui.editors ¥×¥é¥°¥¤¥ó¤Î¥¯¥é¥¹¡£°ìÊý¤Ç StatusTextEditor Åù¤Ï org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤Ç¤¢ ¤ë¡£ ¤¿¤Á¤¬°­¤¤¤³¤È¤ËξÊý¤È¤âƱ¤¸ org.eclipse.ui.texteditor ¤È¤¤¤¦¥Ñ¥Ã¥±¡¼¥¸ ¤ò»ý¤Ã¤Æ¤¤¤ë¡£¥×¥é¥°¥¤¥ó¤Îº®Æ±¤ËÃí°Õ¡£

Eclipse ¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Ï¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ÎÃæ ¤ÎITextEditor ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤¬¡¢ITextEditor ¤Çµá¤á¤é¤ì¤ëµ¡Ç½¤Ï¶Ë¤á¤Æ¿¤¤¤¿¤á¡¢Eclipse ¤Î¥¨¥Ç¥£¥¿¤ò¼ÂÁõ¤¹¤ë¤¿¤á¤Ë¤Ï »ö¼Â¾å¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ò¥Ù¡¼¥¹¤È¤·¤Æ¹½ÃÛ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤ ¤È¤¤¤Ã¤Æ¤¤¤¤¡£図4¤Ë¤¢¤ë¤è ¤¦¤Ë¡¢AbstractTextEditor ¤¬ ITextEditor ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¥¯¥é¥¹¤È¤Ê¤Ã¤Æ¤¤¤ë¤¿¤á¡¢AbstractTextEditor ¤ä StatusTextEditor ¤ò·Ñ¾µ¤·¤¿¥¯¥é¥¹¤ò¼ÂÁõ¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¤³¤Î¾ò·ï¤âËþ¤¿¤» ¤ë¡£

図 4. StatusTextEditor ¤Î·Ñ¾µ¤ª¤è¤Ó¼ÂÁõ¤Î´Ø·¸¿Þ

µÕ¤Ë¤¤¤¦¤È¡¢Eclipse ¥ï¡¼¥¯¥Ù¥ó¥Á¤¬Ä󶡤¹¤ë¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿ÍѤΥե졼¥à ¥ï¡¼¥¯¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ë¸Â¤é¤º¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤ò¼Â¸½¤¹¤ë¾å¤ÇɬÍ× ¤È¤Ê¤ëÍÍ¡¹¤Êµ¡Ç½¤òÄ󶡤·¤Æ¤¤¤ë¡£½¾¤Ã¤Æ¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ò ³èÍѤ¹¤ë¤³¤È¤ÇÍÍ¡¹¤Ê³ÈÄ¥¥¨¥Ç¥£¥¿¤òÈæ³ÓŪÍưפ˼¸½¤¹¤ë¤³¤È¤¬²Äǽ¤È¤Ê¤ë¡£

¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤Ç¤â¡¢´ðËÜŪ¤Ê¥¨¥Ç¥£¥¿¤ÎÆ°ºî¤ÏÁ´¤Æ¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤ ¥ó org.eclipse.ui.workbench.texteditor ¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯ ¤Ë°Í¸¤·¤Æ¤¤¤ë¡£ TextEditor.java ¤Ç¤Ï¥Õ¥¡¥¤¥ë¤ÎÆɤ߽ñ¤­¤ä¥¢¥¯¥·¥ç¥ó¤ÎÀß Äê¡¢¥­¡¼¥Ð¥¤¥ó¥É¤ò¤Ï¤¸¤á¤È¤¹¤ë¥¨¥Ç¥£¥¿¤ÎÆ°ºî¤Î½ôÀßÄê¡¢¹ÔÈÖ¹æ¤Ê¤É¤òɽ¼¨¤¹ ¤ë¥ë¡¼¥é¡¼¤Î¼ÂÁõ¤òÊÝ»ý¤·¤Æ¤¤¤ë¤Ë²á¤®¤Ê¤¤¡£¤³¤ì¤é¤Ë¤Ä¤¤¤Æ¤âËؤó¤É¤Ï ¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Îµ¡Ç½¤òÍøÍѤ·¤Æ¤¤¤ë¤À¤±¤Ç¡¢TextEditor ¤Î ÆâÉô¤Ç¤ÏÀßÄê¤Î´ÉÍý¤ÈºÙ¤«¤ÊÆ°ºî¤Îµ­½Ò¤¬¤Ê¤µ¤ì¤Æ¤¤¤ë¤À¤±¤Ç¤¢¤ë¡£ ½¾¤Ã¤Æ¡¢TextEditor.java ¤ò¸«¤Æ¤â¡¢¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤ä¥Ý¥Ã¥×¥¢¥Ã¥×¤Ê¤É¤Î»ÅÁÈ ¤ß¤¬¤É¤¦¤Ê¤Ã¤Æ¤¤¤ë¤«¤ò¿Þ¤êÃΤë¤Î¤ÏÉÔ²Äǽ¤Ç¤¢¤ë¡£

°Ê¹ß¤Ç¤Ï¡¢¤Þ¤º¡¢ITextEditor ¤ä AbstractTextEditor ¤Ê¤É¤òÊñ´Þ¤¹¤ë org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤ò³µ´Ñ¤¹¤ë¡£ ¤½¤Î¸å¤Ç¡¢¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤ä¥Ý¥Ã¥×¥¢¥Ã¥×¤ÈľÀÜŪ¤Ë´Ø·¸¤¹¤ë JFace ´ØÏ¢¤Î¥× ¥é¥°¥¤¥ó¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ë¤Ä¤¤¤Æ³µ´Ñ¤¹¤ë¡£


Eclipse ¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯

Àè¤Ë½Ò¤Ù¤¿¤È¤ª¤ê¡¢Eclipse ¤Î¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤ò¤Ï¤¸¤á¤È¤¹¤ë¥Æ¥­¥¹¥È¥¨ ¥Ç¥£¥¿¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥óÅù¤¬Ä󶡤¹¤ëµ¡Ç½¤òÍøÍѤ·¤Æ¼Â¸½¤µ¤ì¤Æ¤¤¤ë¡£ Ëܹà¤Ç¤Ï¡¢Eclipse ¤¬Ä󶡤¹¤ë¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î¤¦¤Á¡¢ org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤Î¼çÍ×¥¯¥é¥¹¤Ë¤Ä¤¤¤Æ¡¢¹½À® ¤äµ¡Ç½Åù¤ò²òÀ⤹¤ë¡£ Æäˡ¢º£²ó¤ÎÄ´ºº¤Î¥¹¥³¡¼¥×¤È¤Î´ØÏ¢À­¤¬¹â¤¤Æ°ºîÀßÄê¤È¥¢¥¯¥·¥ç¥óÄêµÁ¤Ë¤Ä¤¤ ¤ÆÀâÌÀ¤¹¤ë¡£


¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î³µÍ×

Eclipse ¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ï¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥æ¡¼¥¶¥¤¥ó¥¿ ¥Õ¥§¥¤¥¹¥Õ¥ì¡¼¥à¥ï¡¼¥¯ JFace ¤¬Ä󶡤¹¤ë¥Æ¥­¥¹¥Èɽ¼¨µ¡Ç½Åù¤ò½¸Ìó¤·¡¢¤µ¤é ¤Ë¥¨¥Ç¥£¥¿¤È¤·¤Æ¤Î´ðËܵ¡Ç½¤òÉղä·¤¿¤â¤Î¤Ç¤¢¤ë¡£ Eclipse ¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó org.eclipse.ui.workbench.texteditor ¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£ Àè¤Ë¡¢Eclipse ¤Î¥¨¥Ç¥£¥¿¤Ï ITextEditor ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ò¼ÂÁõ¤·¤Ê¤±¤ì¤Ð ¤Ê¤é¤Ê¤¤¤È½Ò¤Ù¤¿¤¬¡¢¤³¤Î ITextEditor ¤â org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥óÆâ¤Î src/org/eclipse/ui/texteditor/ ¤Ë¤¢¤ë¡£¤Þ¤¿¡¢¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿ TextEditor ¥¯¥é¥¹¤Î¿Æ¥¯¥é¥¹ StatusTextEditor ¤â org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤Ë¤¢¤ë¥¯¥é¥¹¤Ç¡¢¥×¥é¥°¥¤¥ó ¤Î¥½¡¼¥¹¥Ä¥ê¡¼¤ÎÃæ¤Î src/org/eclipse/ui/texteditor/StatusTextEditor.java ¤Ë¤¢¤ë¡£

org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤Î org.eclipse.ui.texteditor ¥Ñ¥Ã¥±¡¼¥¸¤Ï¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤½¤Î¤â¤Î¤Î´ðÄ쥯 ¥é¥¹·²¤Î¤Û¤«¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Ë¤Þ¤Ä¤ï¤ë¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿ ¤ÎÆ°ºî¡Ê¥¢¥¯¥·¥ç¥ó¡Ë¤Î¼ÂÁõ¥¯¥é¥¹¡¦¥¤¥ó¥¿¥Õ¥§¥¤¥¹·²¡¢¤ª¤è¤Ó¤³¤ì¤é¤¬»ÈÍѤ¹ ¤ë¥¯¥é¥¹¤«¤é¹½À®¤µ¤ì¤Æ¤¤¤ë¡£


¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î¹½À®

Àè¤Ë½Ò¤Ù¤¿¤È¤ª¤ê¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤ËÄ󶡤¹¤ëµ¡Ç½¤ÎÂçÉôʬ¤Ï AbstractTextEditor ¥¯¥é¥¹¤Ë½¸Ì󤵤ì¤Æ¤¤¤ë¡£ AbstractTextEditor ¤Ç¤Ï¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤ò¹½À®¤¹¤ë¼çÍפʵ¡Ç½¤ò¼ÂÁõ¤·¤¿ ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òÊÝ»ý¤·¤Æ¤¤¤ë¡£ Ëܹà¤Ç¤Ï¡¢¤³¤Î AbstractTextEditor ¤¬´ÉÍý¤¹¤ë¥¤¥ó¥¹¥¿¥ó¥¹¤Î¤¦¤Á¡¢²¼µ­¤Ë¤Ä ¤¤¤Æ³µ´Ñ¤¹¤ë¡£

  • fSourceVeiwer

  • fSourceViewerConfiguration

  • fInternalDocumentProvider

  • fPreferenceStore

  • fActions

fSourceViewer ¤Ï ISourceViewer ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹ ¤Ç¤¢¤ë¡£ AbstractTextEditor ¤Î fSourceViewer ¤Ï¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤¬ ÊÔ½¸ÂоݤȤ·¤Æ¤¤¤ë¥É¥­¥å¥á¥ó¥È¤Îɽ¼¨¤òôÅö¤¹¤ë¡£ ISourceViewer ¤Î¼ÂÁõ¥¯¥é¥¹¤Ï¥½¡¼¥¹¥³¡¼¥É¤Îɽ¼¨¤Ë´Ø¤ï¤ëµ¡Ç½¤òÄ󶡤¹¤ë¥¯¥é ¥¹¤Ç¡¢org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text.source ¥Ñ¥Ã¥±¡¼¥¸¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£

ISourceViewer ¤Ï¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤Îɽ¼¨µ¡Ç½¤òÄ󶡤¹¤ë ITextViewer ¤ò·Ñ¾µ¤·¤¿¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ç¤¢¤ê¡¢Ä̾ï¤Î¥Æ¥­¥¹¥Èɽ¼¨µ¡Ç½¤Ë¡¢¥×¥í¥°¥é¥à¥½¡¼ ¥¹¤Îɽ¼¨¤ÇɬÍפȤʤ뵡ǽ¤òÄɲä·¤¿¤â¤Î¤Ç¤¢¤ë¡£ ITextViewer ¤Ï org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text ¥Ñ¥Ã¥±¡¼¥¸¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë¡£ ISourceViewer ¤ä ITextViewer ¤Ïɽ¼¨µ¡Ç½¤Î¤ß¤ò´É³í¤·¤Æ¤ª¤ê¡¢Ê¸»úÆþÎϤò ¤Ï¤¸¤á¤È¤¹¤ëÊÔ½¸µ¡Ç½¤ÏľÀÜŪ¤Ë¤ÏÊÝÍ­¤·¤Æ¤¤¤Ê¤¤¡£ ¤Á¤Ê¤ß¤Ë¡¢ITextViewer ¤Ï¡¢É½¼¨¤Î·Á¼°Åù¤ò´ÉÍý¡¦·èÄꤹ¤ë¥¯¥é¥¹ TextPresentation ¤òÆâÉô¤Ç´ÉÍý¤·¤Æ¤¤¤ë¡£

ITextViewer ¤Î¼ÂÁõ¥¯¥é¥¹¤È¤·¤Æ TextViewer ¥¯¥é¥¹¤¬¡¢¤Þ¤¿ ISourceViewer ¤Î¼ÂÁõ¥¯¥é¥¹¤È¤·¤Æ SourceViewer ¤¬¤½¤ì¤¾¤ì¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ÈƱ¤¸¥Ñ¥Ã¥±¡¼¥¸ Æâ¤ËÄ󶡤µ¤ì¤Æ¤¤¤ë¡£ ¥¯¥é¥¹¤Î·Ñ¾µ´Ø·¸Åù¤Ï図5¤ª¤è¤Ó 図6¤ò»²¾È¡£ Java ¥½¡¼¥¹¤Î¥Ó¥å¡¼¥¢¥¯¥é¥¹ JavaSourceViewer ¤â SourceViewer ¤ò·Ñ¾µ¤·¤¿ ¥¯¥é¥¹¤È¤·¤Æ¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡£

図 5. StatusViewer ¤Î¥¯¥é¥¹³¬ÁØ

図 6. StatusTextEditor ¤Î·Ñ¾µ¤ª¤è¤Ó¼ÂÁõ¤Î´Ø·¸¿Þ

fSourceViewerConfiguration ¤Ï ISourceViewer ¤Î¼ÂÁõ¥¯¥é¥¹¤ÎÀßÄê¤ò´ÉÍý¤¹¤ë ¥¯¥é¥¹¤Ç¤¢¤ë¡£ SourceViewerConfiguration ¤Ï org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text.source ¥Ñ¥Ã¥±¡¼¥¸¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£ ¤³¤Î¥¯¥é¥¹¤Ï JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ëÍÍ¡¹¤Ê³ÈÄ¥µ¡Ç½ ¤ÎÀßÄê¤ò°ì³ç¤·¤Æ´ÉÍý¤·¤Æ¤¤¤ë¥¯¥é¥¹¤Ç¤¢¤ë¡£ SourceViewerConfiguration ¤ò ISourceViewer ¤Î configure ¥á¥½¥Ã¥É¤ÇÅϤ·¤Æ ¤ä¤ë¤³¤È¤Ç¡¢SourceViewer ¼«¿È¤ÎɽÁؤòÄêµÁ¤·¤Æ¤¤¤ë¡£ ¤Ê¤ª¡¢JFace ¤¬Ä󶡤¹¤ë½ôµ¡Ç½¤Ë¤Ä¤¤¤Æ¤Ï¡¢JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ë¥¨¥Ç¥£¥¿¤Îµ¡Ç½ ¤ò»²¾È¤Î¤³¤È¡£

fInternalDocumentProvider ¤Ï¡¢IDocumentProvider ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¥¤¥ó ¥¹¥¿¥ó¥¹¤Ç¡¢TextEditor ¤ÈÊÔ½¸ÂоݤΥɥ­¥å¥á¥ó¥È¤Î¼ÂÂΡʥե¡¥¤¥ë¤Ê¤É¡Ë¤È ¤ÎÂбþÉÕ¤±¤ò¹Ô¤Ã¤Æ¤¤¤ë¡£ IDocumentProvider ¤Ï org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤Î org.eclipse.ui.texteditor ¥Ñ¥Ã¥±¡¼¥¸¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£ ½ô¡¹¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ç¥Õ¥¡¥¤¥ë¤Ê¤É¤òÂоݤȤ·¤¿¼ÂÁõ¥¯¥é¥¹¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë (図7)¡£

図 7. IDocumentProvider ¤Î¼ÂÁõ¥¯¥é¥¹³¬ÁØ¿Þ

fPreferenceStore ¤Ï IPreferenceStore ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¡¢ ¥¨¥Ç¥£¥¿¤Ë´Ø¤¹¤ëÍÍ¡¹¤ÊÀßÄê¤òÊÝ»ý¤·¤Æ¤¤¤ë¡£ IPreferenceStore ¤Ï°ì¼ï¤Î¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤Ç¡¢µ¡Ç½Åª¤Ë¤Ï java.util.Properties ¤ò¥ê¥Ã¥Á¤Ë¤·¤¿¤â¤Î¤È¹Í¤¨¤Æ¤è¤¤¡£¼ÂÂÎ¤Ï org.eclipse.jface ¥×¥é¥°¥¤¥ó¤Î org.eclise.jface.preference ¥Ñ¥Ã¥±¡¼¥¸¤Ë ¤¢¤ë¡£ AbstractEditor ¤Ç¤Ï¡¢¥¨¥Ç¥£¥¿¤ÎÀßÄê¤òÊÝ»ý¤¹¤ë¤¿¤á¤Ë¤³¤Î IPreferenceStore ¥¯¥é¥¹¤ò»ÈÍѤ·¤Æ¤¤¤ë¡£ ¤³¤³¤ÇÂоݤȤʤëÀßÄê¹àÌܤȤϡ¢Î㤨¤Ð¥¨¥Ç¥£¥¿¤Îɽ¼¨¿§»ØÄê¤ä¥­¡¼¥Ð¥¤¥ó¥É¤Ê ¤É¤Ç¤¢¤ë¡£ fPreferenceStore ¤¬ÊÝ»ý¤¹¤ëÆâÍƤϥ¨¥Ç¥£¥¿¤Î½ôµ¡Ç½¤Î¼ÂÁõÉôʬÅù¤«¤é»²¾È¤Ç ¤­¤ë¤¿¤á¡¢¥¨¥Ç¥£¥¿¤Î³ÈÄ¥µ¡Ç½¤ò¼ÂÁõ¤·¤¿ºÝ¤Ë¼ÂÁõ¤·¤¿µ¡Ç½¤Ë´ØÏ¢¤¹¤ëÀßÄê¤ò¿· ¤¿¤Ë fPreferenceStore ¤Ë»ý¤¿¤»¤ë¤³¤È¤â²Äǽ¤Ç¤¢¤ë¡£ ¤¿¤À¤·¡¢ÀßÄê¹àÌܤòÄɲä·¤¿¾ì¹ç¡¢¿·¤¿¤ËÄɲ䵤줿ÀßÄê¹àÌܤòÊѹ¹¤¹¤ë¥æ¡¼¥¶ ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤âɬÍפȤʤ롣

fActions ¤Ï AbstractEditor ¤¬´ÉÍý¤¹¤ë¥¢¥¯¥·¥ç¥ó¤Î°ìÍ÷¤òÊÝ»ý¤¹¤ë HashMap ¤Ç¤¢¤ë¡£ ¥¢¥¯¥·¥ç¥ó¤È¤Ï¡¢¥­¡¼Áàºî¤Ê¤É¤ËϢư¤·¤Æ¹Ô¤¦¥¨¥Ç¥£¥¿¤ÎÆ°ºî¤òÄêµÁ¤·¤¿¤â¤Î¤Ç¡¢ ¥«¥Ã¥È¥¢¥ó¥É¥Ú¡¼¥¹¥È¤ä¡¢¸¡º÷¡¢ÃÖ´¹¤Ê¤É¤¬¤½¤ÎÂåɽÎã¤Ç¤¢¤ë¡£ AbstractTextEditor ¤¬´ÉÍý¤¹¤ë¥¢¥¯¥·¥ç¥ó¤Ë¤Ä¤¤¤Æ¤Ï ¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î¥¢¥¯¥·¥ç¥óÄêµÁ¤ò»²¾È¡£


¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î¥¢¥¯¥·¥ç¥óÄêµÁ

¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Ï¡¢¥«¥Ã¥È¥¢¥ó¥É¥Ú¡¼¥¹¥È¡¢¸¡º÷¡¢ÃÖ´¹¤Ê¤É¡¢ ¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Ë´ØÏ¢¤¹¤ëÍÍ¡¹¤Ê´ðËÜÊÔ½¸ºî¤òÍÑ°Õ¤·¤Æ¤¤¤ë¡£¤³¤ì¤é¤ÎÆ°ºî¤Ï¡¢ org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤Î org.eclipse.ui.texteditor ¥Ñ¥Ã¥±¡¼¥¸¤Î¥¯¥é¥¹¤ä¡¢AbstractTextEditor ¤ÎÆâ Éô¥¯¥é¥¹¤Ê¤É¤È¤·¤ÆÄ󶡤µ¤ì¤Æ¤¤¤ë¡£

表1¤Ï¤½¤Î°ìÎã¤Ç¤¢¤ë¡£

表 1. ¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ë¥¢¥¯¥·¥ç¥ó¤ÎÎã

¥¢¥¯¥·¥ç¥ó¼ÂÁõ¥¯¥é¥¹
¹Ôñ°Ì¤Îºï½üDeleteLineAction
ʸ»úÎó¤Î¸¡º÷FindNextAction
ʸ»úÎó¤ÎÃÖ´¹FindReplaceAction
¥«¡¼¥½¥ë¤ò»ØÄꤵ¤ì¤¿¹Ô¤Ë°ÜÆ°¤¹¤ëGotoLineAction
¥¤¥ó¥¯¥ê¥á¥ó¥¿¥ë¥µ¡¼¥ÁIncrementalFindAction

図8 ¤Ë¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Ë´Ø¤¹¤ë¥¢¥¯¥·¥ç¥ó ¥¯¥é¥¹¤Î°ìÍ÷¤È·Ñ¾µ´Ø·¸¤ò¼¨¤¹¡£

図 8. ¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î¥¢¥¯¥·¥ç¥ó¥¯¥é¥¹¤Î·Ñ¾µ´Ø·¸

¤³¤ÎÃæ¤Î ResourceAction °Ê²¼¤Î¥¯¥é¥¹¤Ï¤¤¤º¤ì¤â org.eclipse.ui.texteditor ¥Ñ¥Ã¥±¡¼¥¸¤Î¥¯¥é¥¹¤Ç¤¢¤ë¡£ org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤ÇÄ󶡤µ¤ì¤ë¤³¤ì¤é¤Î¥¢¥¯¥·¥ç ¥ó¤Ï¡¢²¿¤ì¤â TextEditroAction ¤ä¤½¤Î¿Æ¥¯¥é¥¹¤Î ResourceAction ¤Ê¤É¤ò·Ñ¾µ ¤·¤Æ¤¤¤ë¤³¤È¤¬¤ï¤«¤ë¡£ Eclipse ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Ï¥­¡¼ÆþÎϤʤɤò¥Ï¥ó¥É¥ë¤¹¤ë Action ¤Ï IAction ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤Î³¬ÁؤÎÃæ¤Ç¤Ï Action ¥¯¥é ¥¹¤¬ IAction ¤ò¼ÂÁõ¤·¤¿¥¯¥é¥¹¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£

¤³¤ì¤é¤Î¥¢¥¯¥·¥ç¥ó¤Ï¡¢AbstractTextEditor ¥¯¥é¥¹¤Î createActions ¥á¥½¥Ã¥É ¤Ç¼ÂÂΤ¬ºîÀ®¤µ¤ì¡¢¥¨¥Ç¥£¥¿¤Î¥¢¥¯¥·¥ç¥ó¤È¤·¤Æ´ØÏ¢ÉÕ¤±¤¬¹Ô¤ï¤ì¤ë¡£

¤Ê¤ª¡¢¥«¥Ã¥È¡¢¥³¥Ô¡¼¡¢¥Ú¡¼¥¹¥È¤Ê¤É¤ÎÊÔ½¸µ¡Ç½¤Ë¤Ä¤¤¤Æ¤Ï¥³¥¢¥×¥é¥°¥¤¥ó org.eclipse.ui.workbench ¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£¤³¤ì¤é¤Ï¡¢ Eclipse UI/org/eclipse/ui/actions/ ¥Ç¥£¥ì¥¯¥È¥ê¤ÎÃæ¤Î TextActionHandler ¤ÎÆâÉô¥¯¥é¥¹¤È¤·¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£

注意

dabbrev ¤ò¼ÂÁõ¤¹¤ë¾ì¹ç¡¢¾åµ­¤Î¥¢¥¯¥·¥ç¥ó¤È·²¤ÈƱÍÍ¤Ë ResourceAction ¤â¤· ¤¯¤Ï TextEditorAction ¤ò·Ñ¾µ¤·¤¿¥¯¥é¥¹¤òºîÀ®¤·¡¢¤½¤ÎÃæ¤ËÆ°ºî¤òµ­½Ò¤¹ ¤ë¤³¤È¤Ë¤Ê¤ë¡£ dabbrev ¤Ç¤Ï¡¢Ä̾ï¶áÎ٤ιԤò¸¡º÷¤·ÆþÎϤµ¤ì¤¿Ê¸»úÎó¤Ë¥Þ¥Ã¥Á¤¹¤ë¹Ô¤ò¸¡º÷¤¹ ¤ë¤³¤È¤È¤Ê¤ë¡£½¾¤Ã¤Æ¡¢FindNextActoin ¤ä DeleteLineAction ¤Ê¤É¤Ï»²¹Í¤Ë¤Ê ¤ë²ÄǽÀ­¤¬¤¢¤ë¡£ ¤Þ¤¿¡¢dabbrev ¤ÎÁàºî¤Ç¤Ï¥¤¥ó¥¯¥ê¥á¥ó¥¿¥ë¥µ¡¼¥Á¤ÈƱÍͤˣ² ²ó°Ê¾åϢ³¤·¤Æ¥¢¥¯¥·¥ç¥ó¤¬¸Æ¤Ð¤ì¤¿¤È¤­¤ËÆ°ºî¤¬ÊѲ½¤¹¤ë(½ç°Ì¤ÎÄ㤤¸õÊä¤ò ɽ¼¨¤¹¤ë)¤Î¤Ç¡¢IncrementalFindAction ¥¯¥é¥¹¤ä¡¢Æ±¥¯¥é¥¹¤òÊä½õ¤·¤Æ¤¤¤ë IncrementalFindTarget ¥¯¥é¥¹¤Ê¤É¤¬»²¹Í¤Ë¤Ê¤ë¤â¤Î¤È»×¤ï¤ì¤ë¡£

ËÜÍè¤Ç¤¢¤ì¤Ð¡¢¤³¤Î¤Û¤«¤ÎÉôʬ¤Ë¤Ä¤¤¤Æ¤â¾ÜºÙ¤ÊÊó¹ð¤ò¤¹¤Ù¤­¤«¤â¤·¤ì¤Ê¤¤¤¬¡¢ º£²óÄ´ººÂоݤˤʤäƤ¤¤ëÉôʬ¤ÎËؤó¤É¤Ï org.eclipse.ui.workbench.texteditor ¥×¥é¥°¥¤¥ó¤Ç¤Ï¤Ê¤¯¡¢JFace ¥Õ¥ì¡¼¥à¥ï¡¼ ¥¯´ØÏ¢¤Î¥×¥é¥°¥¤¥ó¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£ ¤½¤³¤Ç¡¢org.eclipse.ui.workbench.texteditor ¤Î¥Õ¥ì¡¼¥à¥ï¡¼¥¯²òÀâ¤Ï¤³¤³¤Ç °ìö½ªÎ»¤·¡¢¼¡Àá¤Ç¤Ï JFace ¤ÎÄ󶡤¹¤ë¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ë¤Ä ¤¤¤ÆÀâÌÀ¤¹¤ë¡£


JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ë¥¨¥Ç¥£¥¿¤Îµ¡Ç½

Ä̾ï¤Î³ÈÄ¥¥¨¥Ç¥£¥¿¤Ï¡¢Eclipse ¤Î¥ï¡¼¥¯¥Ù¥ó¥Á¤¬Ä󶡤¹¤ë¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à ¥ï¡¼¥¯¤òÍøÍѤ·¤Æ¡¢ÂоݤȤʤë¥É¥­¥å¥á¥ó¥È¤Î¼ïÎà¤Ë±þ¤¸¤¿Æüì¤Ê¥¢¥¯¥·¥ç¥ó¤ä ÊÔ½¸µ¡Ç½¡¢É½¼¨µ¡Ç½¤Ê¤É¤òÄɲ乤뤳¤È¤Ç¼Â¸½¤µ¤ì¤ë¡£ Á°Àá¤Ç¤Ï¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤òÍѤ¤¤Æ¼Â¸½¤Ç¤­¤ë³ÈÄ¥µ¡Ç½¤È¤·¤Æ ¥¢¥¯¥·¥ç¥ó¤ÎÄɲäˤĤ¤¤Æ´Êñ¤Ë½Ò¤Ù¤¿¡£ ¤·¤«¤·¤Ê¤¬¤é¡¢º£²ó¤ÎÄ´ººÈϰϤε¡Ç½¤Î¤¦¤Á¡¢ÆÃÄê¸À¸ì¤ËÂбþ¤·¤¿¿§ÉÕ¤±¤ä¡¢¥Æ ¥­¥¹¥È¤Î¼«Æ°¥¤¥ó¥Ç¥ó¥È¡¢¥³¡¼¥É¥¢¥·¥¹¥È¤Ê¤É¤Îµ¡Ç½¤ËÂФ¹¤ë³ÈÄ¥¤Ï¡¢ ¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤è¤ê²¼°Ì¤Î JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ë¤è¤Ã¤ÆÄó ¶¡¤µ¤ì¤Æ¤¤¤ë¡£¥Ç¥Õ¥©¥ë¥È¥¨¥Ç¥£¥¿¤ä Java ¥¨¥Ç¥£¥¿¤â JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯ ¤òÍøÍѤ·¤Æ¿§¤Å¤±¤Ê¤É¤ò¹Ô¤Ã¤Æ¤¤¤ë¡£ ¤½¤³¤Ç¡¢ËÜÀá¤Ç¤Ï¡¢JFace ¤ÎÃæ¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Ë´Ø¤¹¤ë¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Äó ¶¡¤¹¤ë³ÈÄ¥ÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£


JFace ¥Æ¥­¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ëµ¡Ç½¤Î³µÍ×

Àè¤Ë¤â½Ò¤Ù¤¿¤¬ JFace ¤Ï Eclipse ¤ËÂФ·¤Æ¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹µ¡Ç½¤òÄó¶¡ ¤¹¤ë¹â°Ì¤Î¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤¢¤ê¡¢¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó¤Î°ìÉô¤È¤·¤ÆÄ󶡤µ ¤ì¤Æ¤¤¤ë¡£JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ÎÂçȾ¤Îµ¡Ç½¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó org.eclipse.jface ¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¤¬¡¢¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Ë´ØÏ¢¤·¤¿¥Õ¥ì¡¼¥à ¥ï¡¼¥¯¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó org.eclipse.jface.text ¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¡£

¥¨¥Ç¥£¥¿¤Î½ôµ¡Ç½¤Î¤¦¤Á JFace ¤Î¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤·¤Æ ¤¤¤ëµ¡Ç½¤Ï²¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

  • ¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤ä¥¹¥¿¥¤¥ë¤ÎÊѹ¹

    ¥Æ¥­¥¹¥ÈÃæ¤Ë¸½¤ì¤ëÆÃÄê¤Îʸ»ú¤äÈϰϤËÂФ·¤Æ¡¢»ØÄꤵ¤ì¤¿¾ò·ï¤Ë½¾¤Ã¤Æʸ»ú¿§ ¤ä¥Õ¥©¥ó¥È¡¢¥Õ¥©¥ó¥È¤Î¥¹¥¿¥¤¥ë¤òÊѹ¹¤¹¤ëµ¡Ç½¤òÄ󶡤¹¤ë¡£

  • ¥Æ¥­¥¹¥È¤ÎÀ°·Á¡Ê¥Õ¥©¡¼¥Þ¥Ã¥È¡Ë

    ʸ̮¤Ë±þ¤¸¤Æ¡¢¥Æ¥­¥¹¥ÈÃæ¤Ë¶õÇò¤ä²þ¹Ô¤òŬµ¹ÁÞÆþ¤·¥½¡¼¥¹¥³¡¼¥É¤ò¸«¤ä¤¹¤¯¤¹ ¤ëµ¡Ç½¤òÄ󶡤¹¤ë¡£

  • Êä´°¸õÊä¤Î½ÐÎÏ

    ʸ̮¤Ë±þ¤¸¤ÆÊä´°¸õÊä¤òɽ¼¨¡¢ÁªÂò¤¹¤ëµ¡Ç½¤òÄ󶡤¹¤ë¡£

  • ¥Ý¥Ã¥×¥¢¥Ã¥×¤Ë¤è¤ë¥Ø¥ë¥×Åù¤Îɽ¼¨

    ¥Þ¥¦¥¹¥«¡¼¥½¥ë¤Î°ÌÃ֤˱þ¤¸¤ÆŬÀڤʥ³¥á¥ó¥È¤ä¥Ø¥ë¥×¤ò¥Ý¥Ã¥×¥¢¥Ã¥×¥¦¥£¥ó¥É ¥¦¤Ëɽ¼¨¤¹¤ëµ¡Ç½¤Ç¤¢¤ë¡£Java ¥¨¥Ç¥£¥¿¤Î¾ì¹ç¤Ï¡¢¥¯¥é¥¹¤ä¥á¥½¥Ã¥ÉÅù¤Î JavaDoc ¥³¥á¥ó¥È¤ä¡¢ÊÑ¿ô¤Î·¿¡¢¥«¡¼¥½¥ë°ÌÃ֤˴ؤ¹¤ë¥¨¥é¡¼¤ä·Ù¹ð¤Î¥Ý¥Ã¥×¥¢¥Ã ¥×ɽ¼¨¤ËÍøÍѤµ¤ì¤Æ¤¤¤ë¡£

  • ³°Éô¤Î¥É¥­¥å¥á¥ó¥È¾ðÊó¤È¤ÎÏ¢·È

    ³°Éô¤Î¥É¥­¥å¥á¥ó¥È¾ðÊó¤È¤ÎÏ¢·È¤Ï¡¢¥¨¥Ç¥£¥¿°Ê³°¤ÎÉôʬ¤¬ÊÝ»ý¤·¤Æ¤¤¤ë¥É¥­¥å ¥á¥ó¥È¤Î¥Æ¥­¥¹¥È¤Ë´ØÏ¢¤·¤¿¾ðÊó¤È¤ÎÏ¢·È¤ò¹Ô¤¦¡£ Î㤨¤Ð¡¢Java ¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Î¾ì¹ç¡¢³°Éô¤Ç¥½¡¼¥¹¤Î¹½Ê¸ÌÚ¾ðÊó¤Ê¤É¤Î¥É¥­¥å ¥á¥ó¥È¥â¥Ç¥ë¥Ç¡¼¥¿¤ò´ÉÍý¤·¤Æ¤¤¤ë¤¬¡¢¥¨¥Ç¥£¥¿¤Ç Java ¥½¡¼¥¹¤òÊÔ½¸¤·¤¿ºÝ¤Ë ¤Ï¡¢Êѹ¹ÆâÍƤ˱þ¤¸¤Æ¹½Ê¸ÌÚ¾ðÊó¤ò½¤Àµ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ ¤³¤Îµ¡Ç½¤Ï¡¢¤³¤Î¤è¤¦¤Ê¥Æ¥­¥¹¥È¤ÎÊÔ½¸¤Ëȼ¤Ã¤ÆȯÀ¸¤¹¤ë¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿³° ¤Î¥É¥­¥å¥á¥ó¥È¾ðÊó¤Î½¤Àµ¤Î¥È¥ê¥¬¤È¤·¤ÆÍøÍѤµ¤ì¤ëµ¡Ç½¤Ç¤¢¤ë¡£

¼¡¹à°Ê¹ß¤Ç¤Ï¡¢¤³¤ì¤é JFace ¤Î¥Æ¥­¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ë½ôµ¡Ç½¤Î»Å ÁȤߤȳèÍÑÊýË¡¤Ë¤Ä¤¤¤Æ³µÀ⤹¤ë¡£


JFace ¥Æ¥­¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Î³ÈÄ¥µ¡Ç½ÀßÄê

¤Þ¤ººÇ½é¤Ë¡¢¤³¤³¤Ç¤Ï¾åµ­¤Î½ôµ¡Ç½¤Ë¶¦Ä̤¹¤ëÉôʬ¤È¤·¤Æ¡¢³ÈÄ¥µ¡Ç½¤ÎÀßÄêÊýË¡ ¤Ë¤Ä¤¤¤Æ³µÀ⤹¤ë¡£

JFace ¥Æ¥­¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ëµ¡Ç½¤Î³µÍפǽҤ٤¿¤è¤¦¤Ë¡¢jface ¤Î¥Æ¥­¥¹¥È¥Õ ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Ï¿¼ï¿Íͤʵ¡Ç½¤òÄ󶡤·¤Æ¤¤¤ë¡£ ¤³¤ì¤é¤Îµ¡Ç½¤Ï²¿¤ì¤âÂоݤȤʤë°ÌÃÖ¤Îʸ̮¤Ê¤É¡¢¥É¥­¥å¥á¥ó¥È¤Ë¤Þ¤Ä¤ï¤ë¾ò·ï ¤´¤È¤Ë¡¢¤½¤Î¾ò·ï²¼¤Ç¹Ô¤¦¤Ù¤­Æ°ºî¤ò»ØÄꤹ¤ëɬÍפ¬¤¢¤ë¡£ ¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤òÎã¤Ë¼è¤ë¤È¡¢¤³¤³¤Ç¤¤¤¦¾ò·ï¤È¤ÏÂоÝÉôʬ¤¬Ê¸»úÎó¤Ç¤¢¤ë¤«Í½ Ìó¸ì¤Ç¤¢¤ë¤«Ê¿Ê¸¤Ç¤¢¤ë¤«¡¢¤È¤¤¤Ã¤¿¤â¤Î¤Ç¤¢¤ê¡¢¤Þ¤¿Æ°ºî¤È¤Ïʸ»úÎó¤Ç¤¢¤ì¤Ð ÀÄ¿§¡¢¥³¥á¥ó¥È¤ÏÃ㿧¡¢ËÜʸ¤Ï´ðËܤϹõ¤À¤±¤ÉͽÌó¸ì¤À¤±¤ÏÂÀ»ú¤Î»ç¤Ë¤¹¤ë¡¢¤È ¤¤¤Ã¤¿¤â¤Î¤Ç¤¢¤ë¡£

½¾¤Ã¤Æ¡¢¤³¤Î¤è¤¦¤Ê¾ò·ï¤ÈÆ°ºî¤ÎÁȤ߹ç¤ï¤»¤òÍ¿¤¨¤Æ¤ä¤ë¤³¤È¤Ç¡¢¤³¤ì¤é¤Îµ¡Ç½ ¤ò¼Â¸½¤¹¤ë¤³¤È¤¬²Äǽ¤È¤Ê¤ë¡£ Eclipse ¤Î JFace ¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ÇÄ󶡤¹¤ëµ¡Ç½¤Ï¡¢¤¤¤º ¤ì¤â¤³¤Î¾ò·ï¤ÈÆ°ºî¤Î¥»¥Ã¥È¤ÇÄêµÁ¤µ¤ì¤ë¡£

¤³¤Î¤¦¤Á¾ò·ï¤ÏÆâÍƼïÊ̤òɽ¤¹ String ¤ÇÉÕÍ¿¤¹¤ë¡£Î㤨¤Ð¡¢Ê¸»úÎó¤Ï "QUOTED_STRING", ¥³¥á¥ó¥È¤Ï "COMMENT", ¤½¤ì°Ê³°¤Ï "OTHERS" ¤È¤¤¤¦Ì¾Á°¤ò ³ä¤êÅö¤Æ¤ë¡£ °ìÊý¤Ç¡¢Æ°ºî¤Ï¤½¤ì¤¾¤ì¤Îµ¡Ç½¤´¤È¤ËÆ°ºî¤òµ­½Ò¤·¤¿¥¯¥é¥¹¤òºîÀ®¤¹¤ë¡£ JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Ï¡¢¸ÄÊ̵¡Ç½¤´¤È¤Ë¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ä¥Æ¥ó¥×¥ì¡¼¥È¥¯¥é ¥¹¤¬ÍÑ°Õ¤µ¤ì¤Æ¤ª¤ê¡¢¸ÄÊ̤Υ¨¥Ç¥£¥¿¤Ç¤Ï¤³¤ì¤é¤ò·Ñ¾µ¤·¤¿¥¯¥é¥¹¤ò¼ÂÁõ¤¹¤ë¤³ ¤È¤ÇÆ°ºî¤òÉÕÍ¿¤¹¤ë¡£ ÆâÍƼïÊ̤Îʸ»úÎó¤ÈÆ°ºîµ­½Ò¥¯¥é¥¹¤È¤ÎÂбþ´Ø·¸¤Ï HashMap ¤¬ÊÝ»ý¤·¤Æ¤ª¤ê¡¢ ÆâÍƼïÊ̤òÍ¿¤¨¤ë¤³¤È¤Ç¼ÂºÝ¤ÎÆ°ºî¤ÎÄêµÁ¤ò¼èÆÀ¤¹¤ë¤³¤È¤¬²Äǽ¤È¤Ê¤ë¡£

¤³¤Î¤è¤¦¤Ê¹½À®¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ï¡¢ÊÔ½¸¥Æ¥­¥¹¥È¤ÎÉôʬ¤´¤È¤Ë¥Õ¥©¥ó¥ÈÁõ¾þ¤ä ¥Æ¥­¥¹¥ÈÀ°·Á¤Î¥¹¥È¥é¥Æ¥¸(Æ°ºî)¤¬Â礭¤¯°Û¤Ê¤ë¤¿¤á¤Ç¤Ï¤Ê¤¤¤«¤ÈÁÛÁü¤µ¤ì ¤ë¡£ Î㤨¤Ð Java ¤Î¥½¡¼¥¹¥³¡¼¥É¤Ë¤Ä¤¤¤Æ¹Í¤¨¤Æ¤ß¤ë¤È¡¢ÉáÄ̤Υ½¡¼¥¹¥³¡¼¥É¤ÎÉôʬ ¤È¥³¥á¥ó¥ÈÉôʬ¤Ç¤Ï¥Õ¥©¥ó¥ÈÁõ¾þ¤ä¥³¡¼¥É¥¢¥·¥¹¥È¤Î¥¹¥È¥é¥Æ¥¸¤ÏÁ´¤¯°ã¤Ã¤¿¤â ¤Î¤Ç¤¢¤ë¡£¤½¤³¤Ç¡¢ÆâÍƼïÊ̤´¤È¤ËÆ°ºî¤¬ÄêµÁ¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ç¤Ï¤Ê ¤¤¤«¤È»×¤ï¤ì¤ë¡£Î㤨¤Ð¡¢Java ¥¨¥Ç¥£¥¿¤Ç¤Ï¡¢²¼µ­¤Î£¶¼ïÎà¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó ¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£

  • °ì¹Ô¥³¥á¥ó¥È (// ¤Ç»Ï¤Þ¤ë¥³¥á¥ó¥È)

  • Ê£¿ô¹Ô¤Ë¤ï¤¿¤ë¥³¥á¥ó¥È(/* ¤«¤é */ ¤Þ¤Ç)

  • JavaDoc ¥³¥á¥ó¥È(/** ¤«¤é */ ¤Þ¤Ç)

  • ʸ»úÎóÄê¿ô(¥À¥Ö¥ë¥¯¥¦¥©¡¼¥È¤Ç°Ï¤Þ¤ì¤¿Éôʬ)

  • ʸ»úÄê¿ô(¥·¥ó¥°¥ë¥¯¥¦¥©¡¼¥È¤Ç°Ï¤Þ¤ì¤¿Éôʬ)

  • Java ¥×¥í¥°¥é¥àËÜʸ(¾åµ­°Ê³°)

¤Ê¤ª¡¢¤³¤ì¤é¤ÎÆâÍƼïÊ̤äÆ°ºî¤ÎÌò³ä¤È´Ø·¸¤Ï¡¢ JDT ¤Î Java ¥¨¥Ç¥£¥¿¤ÇÀâÌÀ¤¹¤ë¡£

¤µ¤Æ¡¢¼ÂºÝ¤Ë¤Ï¡¢ÆâÍƼïÊ̤ËÂбþ¤·¤¿Æ°ºîµ­½Ò¥¯¥é¥¹¤ò¼èÆÀ¤¹¤ëÁ°¤Ë¡¢ÂÐ¾Ý¤È¤Ê ¤ë¥É¥­¥å¥á¥ó¥È¤ò²òÀϤ·¡¢¥Æ¥­¥¹¥ÈÃæ¤Î¼ïÊ̤ζ­³¦¤ò·èÄꤷ¤¿¤ê¡¢¸ÄÊ̤ÎÉô ʬ¤´¤È¤Ë¥É¥­¥å¥á¥ó¥È¤ÎÆâÍƼïÊ̤òȽÊ̤¹¤ëɬÍפ¬¤¢¤ë¡£ ÆâÍƼïÊ̤Ȥ½¤Î¶­ÌܤξðÊó¤Ï¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤È¸Æ¤Ð¤ì¤Æ¤ª¤ê¡¢¤³¤ì¤é¤Î¥Ñ¡¼¥Æ¥£ ¥·¥ç¥ó¤ÎȽÄê¤Ë¤Ä¤¤¤Æ¤â¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¡£ ¤Ê¤ª¡¢¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Îʬ³ä¤ª¤è¤ÓÆâÍƼïÊ̤ÎȽÄê¤Î¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï ¥Æ¥­¥¹¥È¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó ¤ÇÀâÌÀ¤¹¤ë¡£

¥¨¥Ç¥£¥¿¤¬Ä󶡤¹¤ë½ôµ¡Ç½¤Ï¡¢Á´¤Æ org.eclipse.jface.text.source ¥Ñ¥Ã¥±¡¼ ¥¸¤Î SourceViewerConfiguration ¥¯¥é¥¹¤Ç°ì³ç´ÉÍý¤µ¤ì¤Æ¤¤¤ë¡£ ³ÈÄ¥µ¡Ç½¤ò¼ÂÁõ¤·¤¿¾ì¹ç¡¢¼ÂÁõ¤·¤¿³ÈÄ¥µ¡Ç½¤Î¥¯¥é¥¹¤ò SourceViewerConfiguration ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ËÅÐÏ¿¤·¡¢ ¤³¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò AbstractTextEditor ¤Î setSourceViewerConfiguration ¥á ¥½¥Ã¥É¤ËÅϤ·¤Æ¤ä¤ë¤³¤È¤Ç¡¢µ¡Ç½¤¬ÍøÍѤǤ­¤ë¤è¤¦¤Ë¤Ê¤ë¡£


¥Æ¥­¥¹¥È¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó

Ëܹà¤Ç¤Ï¥Æ¥­¥¹¥È¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£ ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤È¤Ï¡¢ÊÔ½¸Âоݥƥ­¥¹¥È¤ò¡¢ÆâÍƤʤɤ˱þ¤¸¤ÆÉôʬ¤´¤È¤Ëʬ³ä¤· ¤¿ºÝ¤Î¸Ä¡¹¤ÎÃÇÊҤΤ³¤È¤Ç¤¢¤ë¡£ JFace ¥Æ¥­¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Î³ÈÄ¥µ¡Ç½ÀßÄê¤Ç½Ò¤Ù¤¿¤è¤¦¤Ë¡¢Eclipse ¤Î¥¨ ¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Ï¡¢ÆâÍƼïÊ̤´¤È¤Ë¥Õ¥©¥ó¥ÈÁõ¾þ¤ä¥Æ¥­¥¹¥ÈÀ°·Á¤Î ¥¹¥È¥é¥Æ¥¸¤òÄêµÁ¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£ ¥Æ¥­¥¹¥È¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆÃħ¤Ï²¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

  • ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ï½ÅÊ£¤·¤Ê¤¤

  • ¥Æ¥­¥¹¥È¤ÎÁ´¤Æ¤Îʸ»ú¤Ïɬ¤º¤É¤ì¤«£±¤Ä¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ë°¤¹¤ë

  • ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ë¤Ïɬ¤º£±¤Ä¤ÎÆâÍƼïÊ̤¬³ä¤êÅö¤Æ¤é¤ì¤ë

JFace ¥Æ¥­¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Ï¡¢¤³¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ò¥¹¥­¥ã¥ó¤¹¤ë¤¿¤á¤Î µ¡Ç½¤òÄ󶡤·¤Æ¤¤¤ë¡£¤³¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤È¥¹¥­¥ã¥Ë¥ó¥°¤Î¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ï ¥ï¡¼¥¯¥Ù¥ó¥Á¥×¥é¥°¥¤¥ó org.eclipse.jface.text ¤Î org.eclipse.jface.text.rules ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤¢¤ë¡£ ¤³¤Î¥Ñ¥Ã¥±¡¼¥¸¤Ç¤Ï¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ë´Ø¤¹¤ë¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¤Û¤«¤Ë¡¢¥ë¡¼¥ë¥Ù¡¼ ¥¹¤Î¥¹¥­¥ã¥Ê¤Î¥Æ¥ó¥×¥ì¡¼¥È¤Ê¤É¤âÄ󶡤·¤Æ¤¤¤ë¡£ ¤Þ¤¿¡¢JFace ¥×¥é¥°¥¤¥ó¤¬Ä󶡤¹¤ëÁõ¾þ¤Ê¤É¤Îµ¡Ç½¤Ë¤Ä¤¤¤Æ¤â¡¢¥Æ¥ó¥×¥ì¡¼¥È¤È ¤Ê¤ë¥¯¥é¥¹¤òÄ󶡤·¤Æ¤¤¤ë¡£ ´ØÏ¢¤¹¤ë¥¯¥é¥¹¤ª¤è¤Ó¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ò表2 ¤Ë¼¨¤¹¡£

表 2. ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ë´Ø¤¹¤ë¥¯¥é¥¹

̾¾Î¼ïÊÌÌò³ä
IPartitionTokenScanner¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ò¥¹¥­¥ã¥ó¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ITokenScanner ¤ò·Ñ¾µ ¤·¤Æ¤¤¤ë¡£
ITokenScanner¥¤¥ó¥¿¥Õ¥§¥¤¥¹ IPartitionTokenScanner ¤Î¿Æ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£¼çÍפʥ᥽¥Ã¥É¤Ï nextToken¡£ nextToken ¤ò¼Â¹Ô¤¹¤ë¤È¡¢¼¡¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¾ðÊó¤òÊÖ¤¹¡£ ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¾ðÊó¤Ï IToken ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¥¯¥é¥¹¤Ë³ÊǼ¤¹¤ë¡£ ITokenScanner ¤Ç¤Ï¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³ä¤Ë¸Â¤é¤º¡¢°ìÈÌŪ¤Ê¥¹¥­¥ã¥Ë¥ó¥°¤ÎÍÑÅÓ ¤Ç»ÈÍѤǤ­¤ë¡£
RuleBasedPartitionScanner¥¯¥é¥¹ IPartitionTokenScanner ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¥¯¥é¥¹¡£¥ë¡¼¥ë¤Ë´ð¤Å¤¤¤¿¥Ñ¡¼¥Æ¥£ ¥·¥ç¥ó¤Î¥¹¥­¥ã¥óµ¡Ç½¤òÄ󶡤¹¤ë¡£ ¥ë¡¼¥ë¤Ï IRule ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¥¯¥é¥¹¤ÇÄêµÁ¤¹¤ë¡£ Ʊ¤¸¥Ñ¥Ã¥±¡¼¥¸Æâ¤Î BufferedRuleBasedScanner ¤ò·Ñ¾µ¡£
RuleBasedScanner¥¯¥é¥¹ RuleBasedPartitionScanner ¤Î¿Æ¥¯¥é¥¹(´Ö¤Ë BufferedRuleBasedScanner ¤¬¤¢ ¤ë¤¬)¤Ç¤¢¤ê IPartitionScanner ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¥¯¥é¥¹¡£ ¥ë¡¼¥ë¤Ë´ð¤Å¤¯´ðËÜŪ¤Ê¥¹¥­¥ã¥óµ¡Ç½¤òÄ󶡤¹¤ë¡£ ¥ë¡¼¥ë¤Ï RuleBasedPartitionScanner ¤ÈƱÍÍ¤Ë IRule ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¥¯ ¥é¥¹¤ÇÄêµÁ¤¹¤ë¡£
RuleBasedPartitioner¥¯¥é¥¹ RuleBasedParitionScanner ¤òÍøÍѤ·¤Æ¥É¥­¥å¥á¥ó¥È¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³ä¤ò¹Ô ¤¦¥¯¥é¥¹¡£org.eclipse.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text ¥Ñ¥Ã¥±¡¼ ¥¸¤Î IDocumentParitioner ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¡£
IToken¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆâÍƼïÊ̤ò³ÊǼ¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆâÍƼïÊÌʸ»úÎó¤Ï getData ¥á¥½¥Ã¥É ¤ÎÌá¤êÃͤò String ¤Ë¥­¥ã¥¹¥È¤¹¤ë¤³¤È¤Ç¼èÆÀ¤¹¤ë¡£
Token¥¯¥é¥¹ IToken ¤Î¼ÂÁõ¥¯¥é¥¹¡£
IRule, IPredicateRule¥¤¥ó¥¿¥Õ¥§¥¤¥¹ RuleBasedParitionScanner ¤ÇÍøÍѤ¹¤ë¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³äµ¬Â§¤òÄêµÁ¤¹¤ë¥¯¥é ¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£
NumberRule, WhiteSpaceRule, WordRule, PatternRule, MultiLineRule, SingleLineRule, EndOfLineRule, WordPatternRule ¥¯¥é¥¹IRule ¤Î¼ÂÁõ¥¯¥é¥¹·²¡£

´ðËÜŪ¤Ë¤Ï IPartitionTokenScanner ¤Î¼ÂÁõ¥¯¥é¥¹¤òÍÑ°Õ¤¹¤ì¤Ð¤è¤¤¡£ ¼ÂÁõ¥¯¥é¥¹¤Ï setRange ¤â¤·¤¯¤Ï setPartialRange ¤Ç¥¹¥­¥ã¥ó¤¹¤ëÈϰϤò»ØÄê ¤Ç¤­¡¢¤«¤Ä nextToken ¥á¥½¥Ã¥É¤ÇÈÏ°ÏÆâ¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ò½ç¼¡¼èÆÀ¤Ç¤­¤ë ¤è¤¦¤Ë¼ÂÁõ¤¹¤ëɬÍפ¬¤¢¤ë¡£ nextToken ¤ÎÌá¤êÃÍ¤Ï IToken ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ç¤¢¤ë¡£IToken ¤Ï is ·Ï¤Î¥á¥½¥Ã ¥É¤Ç¥È¡¼¥¯¥ó¤Î¼ïÊ̤¬¼èÆÀ¤Ç¤­¤ë¤Û¤«¡¢getData ¥á¥½¥Ã¥É¤ÎÌá¤êÃͤò String ¤Ë ¥­¥ã¥¹¥È¤¹¤ë¤³¤È¤ÇÆâÍƼïÊ̤ò¼èÆÀ¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ëɬÍפ¬¤¢¤ë¡£

IPartitionTokenScanner ¤Î¼ÂÁõ¥¯¥é¥¹¤È¤·¤Æ RuleBasedPartitionScanner ¤¬ÍÑ °Õ¤µ¤ì¤Æ¤¤¤ë¡£¤³¤Î¥¯¥é¥¹¤Ï IRule ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¥¯¥é¥¹¤Ë¤è¤Ã¤ÆÍ¿¤¨ ¤é¤ì¤ë¥ë¡¼¥ë¤òÁȤ߹ç¤ï¤»¤ë¤³¤È¤Ç¡¢¥Æ¥­¥¹¥È¤ò¥¹¥­¥ã¥ó¤¹¤ëµ¡Ç½¤ò¤è¤ê´Êñ¤Ë ¼ÂÁõ¤Ç¤­¤ë¡£Java ¥¨¥Ç¥£¥¿¤Ç¤Ï¡¢¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Î¥¹¥­¥ã¥ó¤Ë RuleBasedScanner ¤ò·Ñ¾µ¤·¤¿ JavaPartionScanner ¥¯¥é¥¹¤òÍøÍѤ·¤Æ¤¤¤ë (図9)¡£

図 9. IPartitionTokenScanner ¤Î¥¯¥é¥¹³¬ÁØ¿Þ

ティップ

¥½¡¼¥¹¤Î²òÀϤä¥È¡¼¥¯¥ó¤È¤¤¤¦¤È¡¢Á°²ó¤ÎÄ´ººÊó¹ð¤Ç½Ò¤Ù¤¿ Java ¥³¥ó¥Ñ¥¤¥é¤Î ¥½¡¼¥¹²òÀϵ¡Ç½ (org.eclise.jdt.core ¥×¥é¥°¥¤¥ó¤Î compilre ¥Ç¥£¥ì¥¯¥È¥ê¤Ë ¤¢¤ë org.eclipse.jdt.internal.compiler.parser.Scanner ¥¯¥é¥¹¤Ê¤É)¤ä¡¢¤½ ¤ÎºÝ¤ËÍøÍѤ¹¤ë¥È¡¼¥¯¥ó(org.eclipse.jdt.core ¥×¥é¥°¥¤¥ó¤Î dom ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Ë¤¢¤ë org.eclipse.jdt.core.dom.ASTNode ¥¯¥é¥¹ ¤ä model ¥Ç¥£¥ì¥¯¥È¥ê°Ê²¼¤Ë¤¢¤ë org.eclipse.jdt.core.IJavaElement ¤Ê¤É)¤È¤Î´Ø·¸ ¤¬µ¤¤Ë¤Ê¤ë¡£ ¤·¤«¤·¡¢»ÄÇ°¤Ê¤¬¤é JFace ¥Æ¥­¥¹¥È¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬ÍÑ°Õ¤¹¤ë¥¹¥­¥ã¥Ê¤ä¥È¡¼ ¥¯¥ó¤È¡¢JDT ¤Î¥³¥ó¥Ñ¥¤¥é¤Ë¤¢¤ë¤³¤ì¤é¤Î¥¯¥é¥¹¤È¤Ï°ìÀÚ̵´Ø·¸¤Ç¤¢¤ë¡£ ¥¹¥­¥ã¥Ê¤Ë¤Ä¤¤¤Æ¤Ï¡¢JDT ¤Ç¤Ï Java ¥¨¥Ç¥£¥¿ÀìÍѤΥȡ¼¥¯¥ó¤ª¤è¤Ó¥¹¥­¥ã¥Ê¤ò Java ¥³¥ó¥Ñ¥¤¥é¤È¤Ï´°Á´¤ËÆÈΩ¤·¤Æ¼ÂÁõ¤·¤Æ¤ª¤ê¡¢¥È¡¼¥¯¥ó¤Î¼èÆÀ¤Ë¤Ï¤³¤Î¥¹ ¥­¥ã¥Ê¤òÍøÍѤ·¤Æ¤¤¤ë¡£


¥Õ¥©¥ó¥È¤ÎÁõ¾þ

¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤Ë´Ø¤¹¤ëµ¡Ç½¤Ï org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text.presentation ¥Ñ¥Ã¥±¡¼¥¸¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ presentation ¥Ñ¥Ã¥±¡¼¥¸¤Î¥¯¥é¥¹¤Ï²¼µ­¤Î 4 ¤Ä¤Ç¤¢¤ë¡£

表 3. ¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤Ë´Ø¤¹¤ë¥¯¥é¥¹

̾¾Î¼ïÊÌÌò³ä
IPresentationDamager¥¤¥ó¥¿¥Õ¥§¥¤¥¹¥Æ¥­¥¹¥È¤ÎÁõ¾þ¤Î½¤ÀµÈϰϤòÆÃÄꤹ¤ë
IPresentationRepairer¥¤¥ó¥¿¥Õ¥§¥¤¥¹¥Æ¥­¥¹¥È¤ÎÁõ¾þ¤ò½¤Àµ¤¹¤ë
IPresentationReconciler¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ÆâÍƼïÊ̤´¤È¤Î IPresentationDamager ¤ª¤è¤Ó IPresentationRepairer ¤òÊÝ»ý ¤¹¤ë
PresentationReconciler¥¯¥é¥¹IPresentationReconciler ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ

¤³¤Îµ¡Ç½¤Ï¡¢Ê¸»úÆþÎϤʤɤˤè¤Ã¤ÆÀ¸¤¸¤¿¥Æ¥­¥¹¥È¤Ø¤ÎÊѹ¹¤ËÂФ·¡¢Á´ÂΤòºÆÉÁ ²è¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢±Æ¶Á¤¬Çȵڤ¹¤ëÈϰϤΤߤòºÆÉÁ²è¤¹¤ë¤³¤È¤òÁÛÄꤷ¤¿¼ÂÁõ¤Ë ¤Ê¤Ã¤Æ¤¤¤ë¡£ Î㤨¤Ð¡¢£±Ê¸»úÆþÎϤµ¤ì¤¿¾ì¹ç¡¢ÂçÄñ¤Ï¤½¤Îʸ»ú¡¢¤¢¤ë¤¤¤Ï¤»¤¤¤¼¤¤¤½ ¤Îñ¸ì¤Î¤ß¤òÊѹ¹¤¹¤ì¤Ð¤è¤¯¡¢¤½¤ì°Ê³°¤ÎÉôʬ¤Ë¤Ä¤¤¤Æ¤Ïʸ»ú¤¬ÆþÎϤµ¤ì¤ëÁ°¤Î ɽ¼¨¤¬¤½¤Î¤Þ¤ÞÍøÍѤǤ­¤ë¡£ ¤³¤Î¤è¤¦¤Ë¡¢¥Æ¥­¥¹¥ÈÁ´ÂΤòºÆÉÁ²è¤¹¤ëɬÍפ¬¤¢¤ë¥±¡¼¥¹¤Ï¤½¤ì¤Û¤É¿¤¯¤Ï¤Ê¤¤¡£ £±Ê¸»úÆþÎϤµ¤ì¤ë¤¿¤Ó¤Ë¥Æ¥­¥¹¥È¥Ó¥å¡¼¤òÁ´¤ÆºÆÉÁ²è¤·¤Æ¤·¤Þ¤¦¤È¶Ë¤á¤Æ¸úΨ¤¬ °­¤¯¤Ê¤ë¶²¤ì¤¬¤¢¤ë¤³¤È¤«¤é¡¢ ¥Æ¥­¥¹¥È¤¬Êѹ¹¤µ¤ì¤ëÅÔÅÙ¡¢Êѹ¹¤Ë¤è¤Ã¤Æɽ¼¨¤Î½¤Àµ¤¬É¬ÍפȤʤëɬÍ× ºÇÄã¸Â¤ÎÈϰϤòÆÃÄꤷ¡¢¤½¤ÎÉôʬ¤Î¤ß¤ò½¤Àµ¤¹¤ë¤³¤È¤ò°Õ¿Þ¤·¤Æ¤¤¤ë¤â¤Î¤È»×¤ï ¤ì¤ë¡£ ¤Ê¤ª¡¢ºÇ½é¤Ë¥Æ¥­¥¹¥È¤òɽ¼¨¤¹¤ë»þ¤Ë¤Ï¡¢¥Æ¥­¥¹¥ÈÁ´ÂΤ¬Êѹ¹¤µ¤ì¤¿¤â¤Î¤¹¤ë¤³ ¤È¤ÇÁ´ÂΤòÉÁ²è¤µ¤»¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£

jface.text.presentation ¥Ñ¥Ã¥±¡¼¥¸¤Î¤¦¤Á¡¢¥Æ¥­¥¹¥È½¤ÀµÆ°ºî¤ËľÀÜ´ØÏ¢¤¹¤ë ¤â¤Î¤Ï¡¢IPresentationDamager ¤È IPresentationRepairer ¤Ç¤¢¤ë¡£ IPresentationDamager ¥¤¥ó¥¿¥Õ¥§ ¥¤¥¹¤Ï¡¢¥Æ¥­¥¹¥È¤ÎÊѹ¹¤Ë¤è¤Ã¤Æɽ¼¨¤Î½¤Àµ¤¬É¬ÍפȤʤëÈϰϤòÆÃÄꤹ¤ë¥¯¥é ¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ç¤¢¤ë¡£ IPresentationDamager ¤¬ÆÃÄꤷ¤¿½¤ÀµÈϰϤËÂФ·¡¢¼ÂºÝ¤Ë¥Æ¥­¥¹¥È¤Î½¤Àµ¤ò¹Ô ¤¦¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤¬ IPresentationRepairer ¤Ç¤¢¤ë¡£

IPresentationDamager ¤Ï getDamageRegion ¤È¤¤¤¦¥á¥½¥Ã¥É¤ò»ý¤Ã¤Æ¤¤¤ë¡£ ¤³¤Î¥á¥½¥Ã¥É¤Ï¡¢ ¥Æ¥­¥¹¥È¤¬ÊÔ½¸¤Ê¤É¤Ë¤è¤êÊѹ¹¤µ¤ì¤¿ºÝ¤Ë¡¢Êѹ¹¤¬¹Ô¤ï¤ì¤¿ÈϰϤÈÊѹ¹ÆâÍƤò¼õ ¤±¤Æ¡¢¤½¤ÎÊѹ¹¤¬±Æ¶Á¤¹¤ëÈϰϤòÊÖ¤¹¡£ IPresentationRepairer ¤Ë¤Ï createPresentation ¤È¤¤¤¦¥á¥½¥Ã¥É¤¬¤¢¤ê¡¢¤³¤Î ¥á¥½¥Ã¥É¤Ï¡¢IPresentationDamager ¤Î getDamageRegion ¤ÎÊÖ¤·¤¿ÈϰϾðÊó¤È¡¢ ¤½¤ÎÉôʬ¤Ø¤Î¥Æ¥­¥¹¥Èɽ¼¨ÀßÄê¤ò¼õ¤±¼è¤ë¤È¡¢¥Æ¥­¥¹¥Èɽ¼¨ÀßÄê¤ÎÆâÍƤò¹¹¿·¤¹ ¤ë¡£

°ìÊý¤Ç IPresentationReconciler ¤Ï¡¢¥Æ¥­¥¹¥È¤ÎÆâÍƼïÊ̤ËÂФ·¤ÆŬÀÚ¤Ê IPresentationDamager ¤ª¤è¤Ó IPresentationRepairer ¤òÄ󶡤¹¤ë¡¢¤¤¤ï¤Ð HashMap Ū¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ç¤¢¤ë¡£jface.text.presentation ¥Ñ¥Ã ¥±¡¼¥¸¤Ç¤Ï¡¢IPresentationReconciler ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤È¤·¤Æ PresentationReconciler ¥¯¥é¥¹¤òÄ󶡤·¤Æ¤¤¤ë¡£ ÂçÄñ¤Î¥¨¥Ç¥£¥¿¤Ç¤Ï¡¢ PresentationReconciler ¤Ï³ÈÄ¥¤¹¤ë¤³¤È¤Ê¤¯¤½¤Î¤Þ¤ÞÍø ÍѲÄǽ¤Ç¤¢¤ë¡£¼ÂºÝ¤Ë¡¢Java ¥¨¥Ç¥£¥¿¤Ç¤â PresentationReconciler ¤¬¤½¤Î¤Þ¤Þ ÍøÍѤµ¤ì¤Æ¤¤¤ë¡£

IPresentationDamager ¤È IPresentationRepairer ¤Ë¤Ä¤¤¤Æ¤Ï¡¢ jface.text.presentation ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤Ï¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤·¤«¤Ê¤¤¤¬¡¢ org.eclipse.jface.text.rules ¥Ñ¥Ã¥±¡¼¥¸¤Ë¼ÂÁõ¥¯¥é¥¹¤¬¤¢¤ë¡£ RuleBasedDamagerRepairer ¤ª¤è¤Ó DefaultDamagerRepairer ¤¬³ºÅö¤¹¤ë¥¯¥é¥¹ ¤Ç¤¢¤ë(表4)¡£ ¤³¤Î¤¦¤Á¡¢RuleBasedDamagerRepairer ¤Ï DefaultDamagerRepairer ¤ò·Ñ¾µ ¤·¤¿¤À¤±¤Î¥¯¥é¥¹¤Ê¤Î¤Ç¡¢¼ÂºÝ¤Ë¤Ï DefaultDamagerRepairer ¤¬¼ÂÁõ¥¯¥é¥¹¤Î¼Â ÂΤǤ¢¤ë¡£ ¤³¤Î¥¯¥é¥¹¤Ï¡¢IPresentationDamager ¤È IPresentationRepairer ¤ÎξÊý¤ò¼ÂÁõ ¤·¤¿¥¯¥é¥¹¤Ç¤¢¤ë¡£ IPresentationDamager ¤È IPresentationRepairer ¤ÏÁê¸ß¤Ë¶¯¤¯°Í¸¤·¤Æ¤¤¤ë¤¿ ¤á¡¢Ã±°ì¤Î¥¯¥é¥¹¤ËξÊý¤Îµ¡Ç½¤ò¼ÂÁõ¤·¤¿¤â¤Î¤ÈÁÛÄꤵ¤ì¤ë¡£ DefaultDamagerRepairer ¤Ï¥³¥ó¥¹¥È¥é¥¯¥¿¤Î°ú¿ô¤È¤·¤Æ ITokenScanner ¤Ê¤É ¤òɬÍפȤ¹¤ë¤¬¡¢¤³¤ì¤Ï¥Ñ¡¼¥Æ¥£¥·¥ç¥óÆâ¤Î¹¹¤Ê¤ë¥È¡¼¥¯¥ó¤Î²òÀϤËÍøÍѤµ¤ì¤ë¡£ ¸å½Ò¤Î Java ¥¨¥Ç¥£¥¿¤Ç¤â¤³¤Î DefaultDamagerRepairer ¤ò»ÈÍѤ·¤Æ¤¤¤ë (¥Õ¥©¥ó¥ÈÁõ¾þ¤Î¼ÂÁõ»²¾È)¡£ ¾ÜºÙ¤òÍý²ò¤¹¤ë¤¿¤á¤Ë¤Ï Java ¥¨¥Ç¥£¥¿¤Ç¤Î¼ÂÁõ¤òÆɤà¤Î¤¬¤è¤¤¡£

表 4. IPresentationDamager ¤È IPresentationRepairer ¤Î¼ÂÁõ ¥¯¥é¥¹

̾¾ÎÌò³ä
DefaultDamagerRepairer Damager¤ÈRepairer¤ÎξÊý¤Î¼ÂÁõ¥¯¥é¥¹¡£
RuleBasedDamagerRepairer DefaultDamagerRepairer¤ò·Ñ¾µ¤·¤¿¤À¤±¤Î¥¯¥é¥¹¡£ ¥³¥ó¥¹¥È¥é¥¯¥¿°Ê³°¤Î¼ÂÁõ¤Ï»ý¤¿¤Ê¤¤¡£ ³°Éô¤«¤é¤Î»²¾È¤â¤Ê¤¤¡£

¤³¤Î¥¯¥é¥¹¤Ï¡¢¥Æ¥­¥¹¥È¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÇÀâÌÀ¤·¤¿ ITokenScanner ¤ò ÉÕÍ¿¤¹¤ë¤È¡¢¤³¤Î Scanner ¤òÍøÍѤ·¤Æ½¤ÀµÂоݤȤʤëÈϰϤòÃê½Ð¤·¡¢¤½¤ÎÉôʬ ¤Îɽ¼¨¤ò½¤Àµ¤µ¤»¤ë¡£ ½¤ÀµÈϰϤÎɽ¼¨ÆâÍƤÎÀ¸À®¤Ï AbstractTextEditor ¤¬ÊÝ»ý¤¹¤ë SourceCodeViewer ¤ËÍ¿¤¨¤é¤ì¤¿ TextPresentation ¤¬¹Ô¤¦ (¥Æ¥­¥¹¥È¥¨¥Ç¥£¥¿¤Î¹½À®»²¾È)¡£


¥Æ¥­¥¹¥È¤ÎÀ°·Á¤Ë´Ø¤¹¤ë¥¯¥é¥¹

¥Æ¥­¥¹¥È¤ÎÀ°·Á¤Ë´Ø¤¹¤ëµ¡Ç½¤Ï org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text.formatter ¥Ñ¥Ã¥±¡¼¥¸¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ formatter ¥Ñ¥Ã¥±¡¼¥¸¤Î¥¯¥é¥¹¤Ï²¼µ­¤Î 3 ¤Ä¤Ç¤¢¤ë¡£

表 5. ¥Æ¥­¥¹¥È¤ÎÀ°·Á¤Ë´Ø¤¹¤ë¥¯¥é¥¹

̾¾Î¼ïÊÌÌò³ä
IFormattingStrategy¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¥Æ¥­¥¹¥ÈÀ°·Á¤ÎÆ°ºî¤òÄêµÁ¤¹¤ë¤È¶¦¤Ë¡¢¼ÂºÝ¤Ë¥Æ¥­¥¹¥ÈÀ°·Á½èÍý¤ò¹Ô¤¦¥¯¥é¥¹¤Î ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£
IContentFormatter¥¤¥ó¥¿¥Õ¥§¥¤¥¹ IFormattingStrategy ¤ò´ÉÍý¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ÆâÍƼïÊ̤òÍ¿¤¨¤ë¤ÈÂбþ¤¹¤ë IFormattingStrategy ¤òÊÖ¤¹¡£
ContentFormatter¥¯¥é¥¹IContentFormatter ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¥¯¥é¥¹¡£

¤³¤Î¤¦¤Á¡¢¥Æ¥­¥¹¥È½¤ÀµÆ°ºî¤ËľÀÜ´ØÏ¢¤¹¤ë¤â¤Î¤Ï IFormattingStrategy ¤Ç¤¢ ¤ë¡£IFormattingStrategy ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ë¤Ï format ¤È¤¤¤¦¥á¥½¥Ã¥É¤¬¤¢¤ë¡£ ¤³¤Î¥á¥½¥Ã¥É¤Ï¡¢À°·ÁÂоݤÎʸ»úÎó¤ä¡¢¤½ ¤ÎÉôʬ¤Î¥¤¥ó¥Ç¥ó¥È¾ðÊó¤Ê¤É¤òÅϤ¹¤È¡¢¤½¤ÎÉôʬ¤òÀ°·Á¤·¤¿·ë²Ì¤Îʸ»úÎó¤òÊÖ¤¹¡£ À°·ÁÂоݤäÀ°·Á¸å¤Îʸ»úÎó¤Î¼õ¤±ÅϤ·¤Ë¤Ï String ¤òÍøÍѤ·¤Æ¤¤¤ë¡£ ¤³¤Î¤Û¤«¤Ë¡¢À°·Á¤Ë»þ´Ö¤òÍפ¹¤ë¥±¡¼¥¹¤òÁÛÄꤷ¤Æ¤«¡¢format ¤Î³«»Ï¤ª¤è¤ÓÄä »ß¤òÄÌÃΤ¹¤ë¥á¥½¥Ã¥É¤¬¤¢¤ë¡£

IFormattingStrategy ¤Ë¤Ä¤¤¤Æ¤Ï¡¢¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤ÏÍÑ°Õ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ ¤³¤ì¤Ï¡¢FormattingStrategy ¥¯¥é¥¹¤Î¼ÂÁõ¤Ï¡¢¥É¥­¥å¥á¥ó¥È¤Î¼ïÎà¤Ë¤è¤Ã¤Æ¿ ¼ï¿Íͤǡ¢¶Ë¤á¤Æ°ìÈ̲½¤·¤Ë¤¯¤¤¤¿¤á¤Ç¤Ï¤Ê¤¤¤«¤ÈÁÛÄꤵ¤ì¤ë¡£ ¤Ê¤ª¡¢Java ¥¨¥Ç¥£¥¿¤Ç¤ÏÆȼ«¤Ë IFormattingStrategy ¤Î¼ÂÁõ¥¯¥é¥¹ JavaFormattingStrategy ¤òÍÑ°Õ¤·¤Æ¤¤¤ë¡£

IContentFormatter ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ï¡¢¥Æ¥­¥¹¥È¤ÎÆâÍƼïÊ̤ËÂФ·¤ÆŬÀÚ¤Ê IFormattingStrategy ¤òÄ󶡤¹¤ë¥¯¥é¥¹¤Ç¤¢¤ë¡£ ¤³¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ÎÌò³ä¤Ï¡¢¥Õ¥©¥ó¥È¤ÎÁõ¾þµ¡Ç½¤Ë¤ª¤±¤ë IPresentationReconciler ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ÈƱÍͤǤ¢¤ê¡¢ÆâÍƼïÊÌʸ»úÎó¤ò¥­¡¼ ¤È¤¹¤ë HashMap ¤Î¤è¤¦¤Ê¤â¤Î¤Ç¤¢¤ë¡£ IContentFormatter ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤¬ ContentFormatter ¥¯¥é¥¹¤Ç¤¢¤ë¡£ ¥Õ¥©¥ó¥ÈÁõ¾þ¤Ç¤Î PresentationReconciler ¤ÈƱÍͤˡ¢´ðËÜŪ¤Ë¤Ï ContentFormatter ¤â¥¨¥Ç¥£¥¿Ëè¤Î¼ÂÁõ¤Ï¤¢¤Þ¤êɬÍפϤʤ¯¡¢ Java ¥¨¥Ç¥£¥¿¤Ç¤â ContentFormatter ¤¬¤½¤Î¤Þ¤ÞÍøÍѤµ¤ì¤Æ¤¤¤ë¡£


Êä´°¸õÊä¤Îɽ¼¨

Êä´°¸õÊä¤Îɽ¼¨¤Ë´Ø¤¹¤ëµ¡Ç½¤Ï org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text.contentassist ¥Ñ¥Ã¥±¡¼¥¸¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ contentassist ¥Ñ¥Ã¥±¡¼¥¸¤Î¥¯¥é¥¹¤ÏÈó¾ï¤Ë¿¤¤¤¬¡¢¤½¤Î¤¦¤Á¼çÍפʥ¯¥é¥¹¤Ï²¼ µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

表 6. Êä´°¸õÊä¤Îɽ¼¨¤Ë´Ø¤¹¤ë¥¯¥é¥¹

̾¾Î¼ïÊÌÌò³ä
IContentAssistProcessor¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ÆþÎϤµ¤ì¤¿Ê¸»úÎó¤ËÂФ·¤Æ¡¢Ä󼨤¹¤Ù¤­Êä´°¸õÊä¤Î°ìÍ÷¤ò´ÉÍý¡¦¼èÆÀ¤¹¤ë¥¯¥é¥¹ ¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ¤Þ¤¿¡¢¥á¥½¥Ã¥É¤Ê¤É¤òÊä´°¤·¤¿ºÇ¤ËÄ󼨤¹¤ë¥á¥½¥Ã¥É¤Î¥Ñ¥é¥á¡¼¥¿¤Î°ìÍ÷¾ðÊó¤â Ä󶡤¹¤ë¡£
ICompletionProposal, ICompletionProposalExtension, ICompletionProposalExtension2¥¤¥ó¥¿¥Õ¥§¥¤¥¹ £±¤Ä£±¤Ä¤ÎÊä´°¸õÊä¤Î¾ðÊó¤òÊÝ»ý¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ¤Þ¤¿¡¢Êä´°¸õÊä¤Ë´Ø¤¹¤ëÀâÌÀʸ¤âÊÝ»ý¤¹¤ë¡£
CompletionProposal¥¯¥é¥¹ICompletionProposal¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¥¯¥é¥¹¡£
IContextInformation, IContextInformationExtension¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¥á¥½¥Ã¥É¤Ê¤É¤òÊä´°¤·¤¿ºÝ¤Ë¡¢Â³¤±¤ÆÄ󼨤µ¤ì¤ë¥á¥½¥Ã¥É¤Î¥Ñ¥é¥á¡¼¥¿¤Î°ìÍ÷¾ð ÊóÅù¤ò´ÉÍý¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£
ContentInformation¥¯¥é¥¹IContextInformation¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¥¯¥é¥¹¡£
IContentAssistant¥¤¥ó¥¿¥Õ¥§¥¤¥¹ IContentAssistProcessor ¤ò´ÉÍý¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ÆâÍƼïÊ̤òÍ¿¤¨¤ë¤ÈÂбþ¤¹¤ë IContentAssistProcessor ¤òÊÖ¤¹¡£
ContentAssistant¥¯¥é¥¹IContentAssistant¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¥¯¥é¥¹¡£

Êä´°¸õÊä¤Ï IContentAssistProcessor ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¤¬´ÉÍý¤¹¤ë¡£ ¼ÂºÝ¤ÎÊä´°¸õÊä¤Ï¡¢£±¤Ä¤Å¤Ä ICompletionProposal ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¥¤¥ó¥¹¥¿ ¥ó¥¹¤Ë³ÊǼ¤µ¤ì¤Æ¤ª¤ê¡¢IConentAssistProcessor ¤Î computeCompletionProposals ¥á¥½¥Ã¥É¤ò¸Æ¤Ö¤³¤È¤Ç ICompletionProposal ¤ÎÇÛ Îó¤ò¼èÆÀ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ ¥á¥½¥Ã¥ÉÊä´°»þ¤Ê¤É¤Ëɽ¼¨¤µ¤ì¤ë¥Ñ¥é¥á¡¼¥¿¤Î°ìÍ÷¤â IContentAssistProcessor ¤¬´ÉÍý¤·¤Æ¤ª¤ê¡¢¤³¤Á¤é¤Ï IContextInformation ¤Ë³ÊǼ¤µ¤ì¤ë¡£ ¤³¤ì¤âƱÍÍ¤Ë IContentAssistProcessor ¤Î compilteContextInformation ¥á¥½¥Ã ¥É¤ò¸Æ¤Ö¤³¤È¤Ç¡¢ÇÛÎó¤ò¼èÆÀ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ IContentAssistProcessor ¤ª¤è¤Ó IContextInformation ¤Ï¤½¤ì¤¾¤ì¥Æ¥ó¥×¥ì¡¼¥È ¼ÂÁõ¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ ¤Ê¤ª¡¢IContentAssistProcessor ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤ÏÍÑ°Õ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£

IContentAssistant ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ï¡¢¥Æ¥­¥¹¥È¤ÎÆâÍƼïÊ̤ËÂФ·¤ÆŬÀÚ¤Ê IContentAssistProcessor ¤òÄ󶡤¹¤ë¥¯¥é¥¹¤Ç¤¢¤ë¡£ ¤³¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ÎÌò³ä¤Ï¡¢¤½¤Î¾¤Îµ¡Ç½¤ÈƱÍͤˡ¢ÆâÍƼïÊÌʸ»úÎó¤ò¥­¡¼ ¤È¤¹¤ë HashMap ¤Î¤è¤¦¤Ê¤â¤Î¤Ç¤¢¤ë¡£ IContentAssistant ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤¬ ContentAssistant ¥¯¥é¥¹¤Ç ¤¢¤ë¡£¤Ê¤ª¡¢Java ¥¨¥Ç¥£¥¿¤Ç¤Ï ContentAssistant ¥¯¥é¥¹¤È¡¢¤³¤Î¥¯¥é¥¹¤ò¤ò ·Ñ¾µ¤·¤¿ JavaCorrectionAssistant ¤Î£²¤Ä¤òÍøÍѤ·¤Æ¤¤¤ë¡£


¥Ý¥Ã¥×¥¢¥Ã¥×¤Îɽ¼¨

¥Ý¥Ã¥×¥¢¥Ã¥×¤Îɽ¼¨¤Ë´Ø¤¹¤ëµ¡Ç½¤Ï org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text.information ¥Ñ¥Ã¥±¡¼¥¸¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ information ¥Ñ¥Ã¥±¡¼¥¸¤Î¥¯¥é¥¹¤Ï²¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

表 7. ¥Ý¥Ã¥×¥¢¥Ã¥×¤Îɽ¼¨¤Ë´ØÏ¢¤¹¤ë¥¯¥é¥¹

̾¾Î¼ïÊÌÌò³ä
IInformationProvider¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¥Æ¥­¥¹¥ÈÃæ¤ÎÃíÌܤ·¤Æ¤¤¤ë¾ì½ê¾ðÊ󤫤顢¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨¤¹¤Ù¤­Ê¸»úÎó¤ò·èÄê ¤¹¤ë¡£
IInformationProviderExtension¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¥Æ¥­¥¹¥ÈÃæ¤ÎÃíÌܤ·¤Æ¤¤¤ë¾ì½ê¾ðÊ󤫤顢¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨¤¹¤Ù¤­ÆâÍƤòʸ»úÎó ¤Ç¤Ï¤Ê¤¯¥ª¥Ö¥¸¥§¥¯¥È¤ÇÊÖ¤¹¡£
IInformationPresentor¥¤¥ó¥¿¥Õ¥§¥¤¥¹ IInformationProvider ¤ò´ÉÍý¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ÆâÍƼïÊ̤òÍ¿¤¨¤ë¤ÈÂбþ¤¹¤ë IInformationProvider ¤òÊÖ¤¹¡£
InformationPresentor¥¯¥é¥¹ IInformationPresentor ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¥¯¥é¥¹¡£

ティップ

¤â¤È¤â¤È¤Ï¡¢¥Ý¥Ã¥×¥¢¥Ã¥×¤Î¾ðÊóÄ󼨤â org.eclipse.jface.text.contentassist ¥Ñ¥Ã¥±¡¼¥¸¤ÇÄ󶡤µ¤ì¤Æ¤¤¤¿¤¬¡¢org.eclipse.jface.text.information ¤¬¸å¤« ¤éÄɲ䵤줿¤è¤¦¤À¡£¸½ºß¤Ç¤â org.eclipse.jface.text.contentassist ¤Ë¤â¥Ý¥Ã ¥×¥¢¥Ã¥×¤Ë´ØÏ¢¤¹¤ë¥¯¥é¥¹¤¬»Ä¤Ã¤Æ¤ª¤ê¡¢¤³¤Á¤é¤Ç¤â¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨¤¬²Äǽ¤Ê ¤è¤¦¤Ç¤¢¤ë¡£

ɽ¼¨ÆâÍƤËľÀܴؤï¤ë¤â¤Î¤Ï IInformationProvider ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤È IInformationProviderExtension ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ç¤¢¤ë¡£ IInformationProvider ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ë¤Ï getSubject ¤È¤¤¤¦¥á¥½¥Ã¥É¤È getInformation ¤È¤¤¤¦¥á¥½¥Ã¥É¤¬¤¢¤ë¡£ getSubject ¥á¥½¥Ã¥É¤Ï¥Æ¥­¥¹¥ÈÃæ¤Î»ØÄꤵ¤ì¤¿¥Ý¥¤¥ó¥È¤ËÂФ·¤Æ¡¢Æ±¤¸¾ðÊó¤¬ É½¼¨¤µ¤ì¤ëÈϰϤòÊÖ¤¹¥á¥½¥Ã¥É¤Ç¤¢¤ë¡£ Î㤨¤Ð¡¢Java ¥½¡¼¥¹¥¨¥Ç¥£¥¿¤òÎã¤Ë¼è¤ë¤È¡¢¥á¥½¥Ã¥É̾¤ÎÉôʬ¤Ë¥Þ¥¦¥¹¥«¡¼¥½ ¥ë¤ò°ÜÆ°¤µ¤»¤ë¤È¡¢Æ±¤¸¥á¥½¥Ã¥É̾¤Î¾å¤ò¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬°ÜÆ°¤·¤Æ¤¤¤ë´Ö¤Ï¡¢ ¤½¤Î¥á¥½¥Ã¥É¤Ë´Ø¤¹¤ë¥Ý¥Ã¥×¥¢¥Ã¥×¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤·Â³¤±¤ë¤¬¡¢¥á¥½¥Ã¥É̾¤Î Éôʬ¤«¤é¥Þ¥¦¥¹¥«¡¼¥½¥ë¤¬³°¤ì¤ë¤È¥Ý¥Ã¥×¥¢¥Ã¥×¥á¥Ã¥»¡¼¥¸¤Ï¾ÃÌǤ¹¤ë¡£ ¤³¤Î¾ì¹ç¡¢getSubject ¤Ï¡¢¤³¤Î¥á¥½¥Ã¥É̾¤Î³«»Ï°ÌÃÖ¤«¤é½ªÎ»°ÌÃ֤ޤǤòɽ¼¨ ÈϰϤȤ·¤ÆÊÖ¤¹¡£ ¤â¤¦°ì¤Ä¤Î getInformation ¥á¥½¥Ã¥É¤Ï¡¢getSubject ¥á¥½¥Ã¥É¤¬ÊÖ¤·¤¿É½¼¨ÈÏ °Ï¤Ëɽ¼¨¤¹¤Ù¤­¥á¥Ã¥»¡¼¥¸¤òʸ»úÎó (String) ¤ÇÊÖ¤¹¡£ Î㤨¤Ð¡¢Java ¥½¡¼¥¹¥¨¥Ç¥£¥¿¤Ç¡¢getSubject ¤¬»Ø¤·¼¨¤·¤¿É½¼¨ÈϰϤ¬Ê¸»úÎó¤À¤Ã ¤¿¾ì¹ç¡¢getInformation ¥á¥½¥Ã¥É¤Ï¤½¤³¤Çɽ¼¨¤¹¤Ù¤­ÆâÍÆ¡¢¤Ä¤Þ¤ê¡¢¥á¥½¥Ã¥É ¤Î·¿ÄêµÁ¤È JavaDoc ¥³¥á¥ó¥È¤ÎËÁƬÉôʬ¤òÌá¤êÃͤȤ·¤ÆÊÖ¤¹¡£ IInformationProviderExtension ¤Ï¡¢IInformationProvider ¤Î getInformation ¤ÎÌá¤êÃͤò Object ¤Ë¤·¤¿ getInformation2 ¤È¤¤¤¦¥á¥½¥Ã¥É¤ò »ý¤Ã¤Æ¤¤¤ë¡£¤³¤ì¤Ï¡¢¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨¤ÎÆâÍƤ¬ String ¤À¤±¤Ç¤Ïɽ¸½¤·¤­¤ì¤Ê ¤¤¥±¡¼¥¹¤òÁÛÄꤷ¤ÆÍÑ°Õ¤µ¤ì¤¿¤â¤Î¤Ç¤¢¤ë¡£

IInformationProvide ¤ª¤è¤Ó IInformationProviderExtension ¤Î ¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤Ï¥ï¡¼¥¯¥Ù¥ó¥Á¤Ç¤ÏÍÑ°Õ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ Java ¥¨¥Ç¥£¥¿¤Ç¤ÏÆȼ«¤Ë¤³¤ì¤é¤Î¼ÂÁõ¥¯¥é¥¹ JavaElementProvider ¤ª¤è¤Ó JavaInformationProvider ¥¯¥é¥¹¤òÍÑ°Õ¤·¤Æ¤¤¤ë¡£

IInformationPresenter ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ï¡¢¥Æ¥­¥¹¥È¤ÎÆâÍƼïÊ̤ËÂФ·¤ÆŬÀÚ¤Ê IInformationProvider ¤òÄ󶡤¹¤ë¥¯¥é¥¹¤Ç¤¢¤ë¡£ ¤³¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ÎÌò³ä¤Ï¡¢¤½¤Î¾¤Îµ¡Ç½¤ÈƱÍͤˡ¢ÆâÍƼïÊÌʸ»úÎó¤ò¥­¡¼ ¤È¤¹¤ë HashMap ¤Î¤è¤¦¤Ê¤â¤Î¤Ç¤¢¤ë¡£ IInformationPresenter ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤¬ InformationPresenter ¥¯¥é¥¹¤Ç ¤¢¤ë¡£¤³¤ì¤â¤½¤Î¾¤Îµ¡Ç½¤ÈƱÍͤˡ¢¥¨¥Ç¥£¥¿Ëè¤Î¼ÂÁõ¤Ï¤¢¤Þ¤êɬÍפϤʤ¯¡¢ Java ¥¨¥Ç¥£¥¿¤Ç¤â InformationPresenter ¤¬¤½¤Î¤Þ¤ÞÍøÍѤµ¤ì¤Æ¤¤¤ë¡£


³°Éô¤Î¥É¥­¥å¥á¥ó¥È¾ðÊó¤È¤ÎÏ¢·È

³°Éô¤Î¥É¥­¥å¥á¥ó¥È¾ðÊó¤È¤ÎÏ¢·È¤Ë´Ø¤¹¤ëµ¡Ç½¤Ï org.eclipse.jface.text ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jface.text.reconciler ¥Ñ¥Ã¥±¡¼¥¸¤ËÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ reconciler ¥Ñ¥Ã¥±¡¼¥¸¤Î¼çÍ×¥¯¥é¥¹¤Ï²¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

表 8. ³°Éô¤Î¥É¥­¥å¥á¥ó¥È¾ðÊó¤È¤ÎÏ¢·È¤Ë´ØÏ¢¤·¤¿¥¯¥é¥¹

̾¾Î¼ïÊÌÌò³ä
IReconcilingStrategy¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ³°Éô¾ðÊó¤È¤ÎÏ¢·È½èÍý¤ò¼Â¹Ô¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£
IReconcilingStrategyExtension¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¼ç¤Ë»þ´Ö¤¬¤«¤«¤ë½èÍý¤òÂоݤȤ·¤¿³ÈÄ¥µ¡Ç½¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ¥×¥í¥°¥ì¥¹¥Ð¡¼¤Îɽ¼¨¤Ë´Ø¤¹¤ë¥á¥½¥Ã¥É¤ò»ý¤Ä¡£
IReconciler¥¤¥ó¥¿¥Õ¥§¥¤¥¹ IReconcilingStrategy ¤ò´ÉÍý¤¹¤ë¥¯¥é¥¹¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£ ÆâÍƼïÊ̤òÍ¿¤¨¤ë¤ÈÂбþ¤¹¤ë IReconcilingStrategy ¤òÊÖ¤¹¡£

³°Éô¤Î¥É¥­¥å¥á¥ó¥È¾ðÊó¤È¤ÎÏ¢·È½èÍý¤ËľÀÜ´ØÍ¿¤¹¤ë¤â¤Î¤Ï¡¢ IReconcilingStrategy ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤È IReconcilingStrategyExtension ¥¤¥ó ¥¿¥Õ¥§¥¤¥¹¤Ç¤¢¤ë¡£ IReconcilingStrategy ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ë¤Ï reconcile ¤È¤¤¤¦¥á¥½¥Ã¥É¤¬¤¢¤ê¡¢ ¤³¤Î¥á¥½¥Ã¥ÉÆâ¤Ë¤Ç¥É¥­¥å¥á¥ó¥È¤ÎÊѹ¹¤ËÂФ¹¤ë½èÍýÆâÍƤòµ­½Ò¤¹¤ë¡£ reconcile ¥á¥½¥Ã¥É¤Ï£²¤Ä¤¢¤ë¤¬¡¢ÊÒÊý¤¬Êѹ¹ÈϰϤ¬ÌÀ¤é¤«¤Ê¾ì¹ç¤ËÊѹ¹¤µ¤ì ¤Æ¤¤¤ëÈϰϤòÉÕÍ¿¤Ç¤­¤ë¤Î¤Ë¤¿¤¤¤·¡¢¤â¤¦ÊÒÊý¤ÏÊѹ¹ÈϰϤÏÆÃÄꤻ¤º¤ËºÆ¹½À®¤ò ¹Ô¤¦¥á¥½¥Ã¥É¤Ç¤¢¤ë¡£ IReconcilingStrategyExtension ¤Ë¤Ï setProgressMonitor ¤È¤¤¤¦¥á¥½¥Ã¥É¤¬¤¢ ¤ê¡¢¿ÊĽ¾õ¶·¤òɽ¼¨¤¹¤ë¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ê¤É¤ÈÏ¢·È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£ ¤³¤ì¤Ï¡¢¥É¥­¥å¥á¥ó¥È¾ðÊó¤È¤ÎÀ°¹çÀ­¤ò¤È¤ë½èÍý¤Ë¤Ï»þ´Ö¤òÍפ¹¤ë¤³¤È¤¬Â¿¤¤¤¿ ¤á¤È»×¤ï¤ì¤ë¡£

IReconciler ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ï¡¢¥Æ¥­¥¹¥È¤ÎÆâÍƼïÊ̤ËÂФ·¤ÆŬÀÚ¤Ê IReconcilerStrategy ¤òÄ󶡤¹¤ë¥¯¥é¥¹¤Ç¤¢¤ë¡£ ¤³¤Î¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ÎÌò³ä¤Ï¡¢¤½¤Î¾¤Îµ¡Ç½¤ÈƱÍͤËÆâÍƼïÊÌʸ»úÎó¤ò¥­¡¼ ¤È¤¹¤ë¥Ï¥Ã¥·¥å¥Þ¥Ã¥×¤Î¤è¤¦¤Ê¤â¤Î¤Ç¤¢¤ë¡£ IReconciler ¤Î¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤ÏÍÑÅӤ˱þ¤¸¤ÆÊ£¿ôÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ ¼ÂÁõ¥¯¥é¥¹°ìÍ÷¤ò図10¤Ë¼¨¤¹¡£ Reconciler ¤¬¥Õ¥ë¥¹¥Ú¥Ã¥¯¤Î¼ÂÁõ¤Ç¤¢¤ë¤Î¤ËÂФ·¡¢MonoReconciler ¤Ç¤ÏÆâÍƼï Ê̤ˤè¤é¤ºÆ±¤¸ IReconcilingStrategy ¤òÊÖ¤¹¡£ Java ¥¨¥Ç¥£¥¿¤Ç¤Ï¸å¼Ô¤Î MonoReconicler ¤ò·Ñ¾µ¤·¤¿ JavaReconciler ¤ò¼ÂÁõ ¤·¤Æ¤¤¤ë¡£

図 10. IReconciler ¤Î¥¯¥é¥¹³¬ÁØ¿Þ


JDT ¤Î Java ¥¨¥Ç¥£¥¿

ËÜÀá¤Ç¤Ï Eclipse ¤Î JDT (Java Development Toolkit) ¤¬Ä󶡤¹¤ë Java ¥½¡¼ ¥¹¥³¡¼¥É¥¨¥Ç¥£¥¿¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£


Java ¥¨¥Ç¥£¥¿¤Î³µÍ×

Eclipse ¤Ï Java ¥½¡¼¥¹¥Õ¥¡¥¤¥ëÊÔ½¸ÍѤΥ¨¥Ç¥£¥¿¤È¤·¤Æ Java ¥¨ ¥Ç¥£¥¿¤òÄ󶡤·¤Æ¤¤¤ë¡£Java ¥¨¥Ç¥£¥¿¤ÏÄ̾ï¤Î¥¨¥Ç¥£¥¿µ¡Ç½¤Ë²Ã¤¨ ¤Æ¡¢Java ¤ËÆò½¤·¤¿²¼µ­¤Îµ¡Ç½¤ò»ý¤Ã¤Æ¤¤¤ë¡£

  • ͽÌó¸ì¡¢¥³¥á¥ó¥È¡¢Ê¸»úÎó¤Ê¤É¤Îʸ»ú¿§¤ä¥Õ¥©¥ó¥È¤ÎÊѹ¹

  • ¼«Æ°¥¤¥ó¥Ç¥ó¥È

  • ¥½¡¼¥¹¥³¡¼¥É¤ÎÊä´°¸õÊäÄ󼨵¡Ç½

  • ¥¯¥é¥¹¤ä¥á¥½¥Ã¥É¤ÎÀâÌÀ¤Î¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨

  • ¼«Æ°¥³¥ó¥Ñ¥¤¥ë¤È¥¨¥é¡¼É½¼¨

  • ¤½¤Î¾½ô¡¹

¤³¤ì¤é¤Î Java ¥¨¥Ç¥£¥¿¤¬Ä󶡤¹¤ëµ¡Ç½¤Ï¡¢Eclipse ¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥Æ¥­¥¹¥È ¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤òÍѤ¤¤Æ¼Â¸½¤µ¤ì¤Æ¤¤¤ë¡£

Java ¥¨¥Ç¥£¥¿¤Î¼ÂÂÎ

Java ¥¨¥Ç¥£¥¿¤Î¼ÂÂÎ¤Ï org.eclipse.jdt.ui ¥×¥é¥°¥¤¥ó¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¥½¡¼ ¥¹¥Õ¥¡¥¤¥ë¤Ï¡¢org.eclipse.jdt.ui ¥×¥é¥°¥¤¥ó¤ÎÃæ¤Î ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java ¤Ç¤¢¤ë¡£¤³¤Î JavaEditor ¼«ÂΤϡ¢Java ¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Î´ðËÜŪ¤Êɽ¼¨¤ª¤è¤ÓÊÔ½¸µ¡Ç½¤òÄó ¶¡¤·¤Æ¤¤¤ë¤¬¡¢¼ÂÁõ¥¯¥é¥¹¤Ç¤Ï¤Ê¤¯Ãê¾Ý¥¯¥é¥¹¤È¤Ê¤Ã¤Æ¤¤¤ë¡£¼ÂÁõ¥¯¥é¥¹¤Ï¡¢ JavaEditor ¥¯¥é¥¹¤ò·Ñ¾µ¤·¤¿ ClassFileEditor ¥¯¥é¥¹¤È CompilationUnitEditor ¥¯¥é¥¹¤Ç¤¢¤ë¡£¥Õ¥¡¥¤¥ë¤Ï¤¤¤º¤ì¤â JavaEditor ¥¯¥é¥¹ ¤ÈƱ¤¸¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ë¡£ CompilationUnitEditor ¤¬ Java ¥½¡¼¥¹¥Õ¥¡¥¤¥ë (.java ¥Õ¥¡¥¤¥ë)¤òÊÔ½¸ÂоݤȤ·¤Æ¤¤¤ë¤Î¤ËÂФ·¤Æ¡¢ClassFileEditor ¥¯¥é¥¹¤Ï¡¢ ¥¯¥é¥¹¥Õ¥¡¥¤¥ë(.class ¥Õ¥¡¥¤¥ë)¤òÂоݤȤ·¤¿¤â¤Î¤Ç¤¢¤ë¡£

org.eclipse.jdt.ui ¥×¥é¥°¥¤¥ó¤Ë´Þ¤Þ¤ì¤ë Java ¥¨¥Ç¥£¥¿¤ÎÃæ³Ë¥¯¥é¥¹¤ò 表9¤Ë¼¨¤¹¡£

表 9. Java ¥¨¥Ç¥£¥¿¤ÎÃæ³Ë¥¯¥é¥¹

̾¾Î¥Ñ¥Ã¥±¡¼¥¸ÀâÌÀ
JavaEditororg.eclipse.jdt.internal.ui.javaeditor Java ¥¨¥Ç¥£¥¿ËÜÂΡ£StatusTextEditor ¤ò·Ñ¾µ¤·¤¿¥¯¥é¥¹¤Ç¡¢Java ¥¨¥Ç¥£¥¿¤Ë ´Ø¤¹¤ëµ¡Ç½¤Ï¤¹¤Ù¤Æ¤³¤Î¥¯¥é¥¹¤Ë½¸Ì󤵤ì¤Æ¤¤¤ë¡£¤¿¤À¤·¡¢¤³¤Î¥¯¥é¥¹¤ÏÃê¾Ý¥¯ ¥é¥¹¤Ç¤¢¤ê¡¢¼ÂÁõ¥¯¥é¥¹¤Ï ClassFileEditor ¤ª¤è¤Ó CompilationUnitEditor ¤Î £²¤Ä¤¬¤¢¤ë¡£
ClassFileEditororg.eclipse.jdt.internal.ui.javaeditor Java ¥¨¥Ç¥£¥¿¤Î¼ÂÁõ¥¯¥é¥¹¡£JavaEditor ¤ò·Ñ¾µ¤·¤Æ¤¤¤ë¡£ ¼ç¤Ë¡¢¥³¥ó¥Ñ¥¤¥ëºÑ¤ß¤Î¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ëÊÔ½¸µ¡Ç½¤òÄ󶡤¹¤ë¡£
ClassFileDocumentProviderorg.eclipse.jdt.internal.ui.javaeditor IDocumentProvider ¤Î¼ÂÁõ¥¯¥é¥¹¡£ ¥¨¥Ç¥£¥¿¤È¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤È¤ÎÏ¢·È¤ò¿Þ¤ë¡£
CompilationUnitEditororg.eclipse.jdt.internal.ui.javaeditor Java ¥¨¥Ç¥£¥¿¤Î¼ÂÁõ¥¯¥é¥¹¡£JavaEditor ¤ò·Ñ¾µ¤·¤Æ¤¤¤ë¡£ ¼ç¤Ë¡¢Java ¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ëÊÔ½¸µ¡Ç½¤òÄ󶡤¹¤ë¡£
CompilationUnitDocumentProviderorg.eclipse.jdt.internal.ui.javaeditor IDocumentProvider ¤Î¼ÂÁõ¥¯¥é¥¹¡£ ¥¨¥Ç¥£¥¿¤È Java ¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤È¤ÎÏ¢·È¤ò¿Þ¤ë¡£
JavaSourceViewerorg.eclipse.jdt.internal.ui.javaeditor SourceViewer ¤ò·Ñ¾µ¤·¤¿¥¯¥é¥¹¡£Java ¥×¥í¥°¥é¥à¤ËÆò½¤·¤¿¥Æ¥­¥¹¥Èɽ¼¨µ¡Ç½ ¤òÄ󶡤¹¤ë¡£
JavaSourceViewerConfigurationorg.eclipse.jdt.ui.text SourceViewerConfiguration ¤ò·Ñ¾µ¤·¤¿¥¯¥é¥¹¡£Java ¥½¡¼¥¹¤ËÆò½¤·¤¿ SourceViewer ¤ÎÀßÄê¤òÊÝ»ý¤¹¤ë¡£
JavaTextToolsorg.eclipse.jdt.ui.text ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¥¹¥­¥ã¥ÊÅù¤Î¥¤¥ó¥¹¥¿¥ó¥¹Åù¡¢ Java ¥×¥í¥°¥é¥à¤ÎʬÀϤ˴ØÏ¢¤·¤¿¥¯¥é¥¹¤ò°ì³ç¤·¤Æ´ÉÍý¤¹¤ë¡£ ¤³¤Î¥¯¥é¥¹¤Ï¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Î¥¹¥­¥ã¥Ê¤À¤±¤Ç¤Ï¤Ê¤¯¡¢Java ¤Î¥×¥í¥°¥é¥à¤ä¥³ ¥á¥ó¥È¤Ê¤É¤ÎÆâÉô¤ò¥¹¥­¥ã¥ó¤¹¤ë¥¯¥é¥¹¤â´ÉÍý¤·¤Æ¤¤¤ë¡£ ¤³¤ì¤é¤Î¥¯¥é¥¹¤Ï¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤Ê¤É¤ÇÍøÍѤµ¤ì¤Æ¤¤¤ë¡£

Java ¥¨¥Ç¥£¥¿¤Î½ôµ¡Ç½¤Î¼ÂÁõ

Ëܹà¤Ç¤Ï Java ¥¨¥Ç¥£¥¿¤Ç¼ÂÁõ¤µ¤ì¤Æ¤¤¤ëÍÍ¡¹¤Ê Java Æȼ«¤Îµ¡Ç½¤Ë¤Ä¤¤¤Æ¡¢ Eclipse ¥ï¡¼¥¯¥Ù¥ó¥Á¤Î¥¨¥Ç¥£¥¿¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤È¤Î´ØÏ¢¤òƧ¤Þ¤¨¤ÆÀâÌÀ¤¹¤ë¡£


¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³ä¤ÈÆâÍƼïÊ̤ÎȽÄê

Ëܹà¤Ç¤Ï JavaEditor ¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³ä¤Ë´ØÏ¢¤¹¤ë¥¯¥é¥¹¤ò³µ´Ñ¤¹¤ë¡£ ¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³ä¤Î¾ÜºÙ¤Ï¡¢¥Æ¥­¥¹¥È¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ò»²¾È¤Î¤³¤È¡£

Java ¥¨¥Ç¥£¥¿¤Ç¤Ï²¼µ­¤Î 6 ¼ïÎà¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤òÍÑ°Õ¤·¤Æ¤¤¤ë¡£

表 10. Java ¥¨¥Ç¥£¥¿¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥Ñ¡¼¥Æ¥£¥·¥ç¥ó

¥Ñ¡¼¥Æ¥£¥·¥ç¥ó̾¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆâÍÆ
JAVA_SINGLE_LINE_COMMENT "//" ¤Ç»Ï¤Þ¤ë£±¹Ô¥³¥á¥ó¥È¡£¹ÔËö¤Þ¤Ç¤¬Âоݡ£
JAVA_MULTI_LINE_COMMENT "/*" ¤È "*/" ¤Ç°Ï¤Þ¤ì¤¿Ê£¿ô¹Ô¤Ë¤Þ¤¿¤¬¤ë¥³¥á¥ó¥È¡£
JAVA_DOC Ê£¿ô¹Ô¥³¥á¥ó¥È¤Î¤¦¤Á "/**" ¤È "*/" ¤Ç°Ï¤Þ¤ì¤¿Éôʬ¤Ç¡¢JavaDoc ¤¬µ­½Ò¤µ¤ì ¤Æ¤¤¤ë¥³¥á¥ó¥È¡£Ê£¿ô¹Ô¤Ë¤Þ¤¿¤¬¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
JAVA_STRING " (¥À¥Ö¥ë¥¯¥¦¥©¡¼¥È)¤Ç°Ï¤Þ¤ì¤¿Ê¸»úÎó¡£ ´ðËÜŪ¤ËÊ£¿ô¹Ô¤Ë¤Þ¤¿¤¬¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
JAVA_CHARACTER ' (¥·¥ó¥°¥ë¥¯¥¦¥©¡¼¥È)¤Ç°Ï¤Þ¤ì¤¿Ê¸»ú¡£ Ê£¿ô¹Ô¤Ë¤Þ¤¿¤¬¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
¤½¤ì°Ê³°Java ¤Î¥×¥í¥°¥é¥àËÜʸ

¤³¤ì¤é¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆâÍƼïÊÌ¤Ï IJavaPartitions ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ç´ÉÍý ¤·¤Æ¤¤¤ë¡£

JavaEditor ¤Ç¤Ï¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Î¥¹¥­¥ã¥ó¤Ë¤Ï RuleBasedPartitionScanner ¤Ê ¤É¤ÏÍøÍѤ·¤Æ¤ª¤é¤º¡¢Æȼ«¤Ë¥¹¥­¥ã¥Ê¥¯¥é¥¹¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£ ¤³¤ì¤Ï¡¢¥ë¡¼¥ë¥Ù¡¼¥¹¤Î¥¹¥­¥ã¥Ê¤Ç¤Ï½½Ê¬¤ÊÀ­Ç½¤¬³ÎÊݤǤ­¤Ê¤«¤Ã¤¿¤¿¤á¤Ç¤Ï¤Ê ¤¤¤«¤ÈÁÛÄꤵ¤ì¤ë¡£ ¤Ê¤ª¡¢¥È¡¼¥¯¥ó¤Ë¤Ä¤¤¤Æ¤Ï JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î Token ¥¯¥é¥¹¤ò¤½¤Î¤Þ¤ÞÍø ÍѤ·¤Æ¤¤¤ë¡£ ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Î¥¹¥­¥ã¥ó¤Ë´Ø¤¹¤ë¥¯¥é¥¹¤Ï²¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

表 11. Java ¥¨¥Ç¥£¥¿¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¥¹¥­¥ã¥Ê´Ø·¸

̾¾Î¥Ñ¥Ã¥±¡¼¥¸ÀâÌÀ
IJavaPartitionsorg.eclipse.jdt.internal.ui.text Java ¤Î¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆâÍƼïÊÌʸ»úÎó¤òÊÝ»ý¤¹¤ë¥¤¥ó¥¿¥Õ¥§¥¤¥¹¡£
FastJavaPartitionScannerorg.eclipse.jdt.internal.ui.text IPartitionTokenScanner ¤Î¼ÂÁõ¥¯¥é¥¹¡£ Java ¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò²òÀϤ·¤Æ¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤Ëʬ³ä¤¹¤ëµ¡Ç½¤òÄ󶡤¹¤ë¡£

¥Õ¥©¥ó¥ÈÁõ¾þ¤Î¼ÂÁõ

Ëܹà¤Ç¤Ï JavaEditor ¤Î¥Õ¥©¥ó¥ÈÁõ¾þ¤Î¼ÂÁõ¤Ë¤Ä¤¤¤Æ³µ´Ñ¤¹¤ë¡£ ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤¬Ä󶡤¹¤ë ¥Õ¥©¥ó¥ÈÁõ¾þµ¡Ç½¤Î¾ÜºÙ¤Ï¡¢¥Õ¥©¥ó¥È¤ÎÁõ¾þ¤ò»²¾È ¤Î¤³¤È¡£ ¤Þ¤¿¡¢¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³ä¤ÈÆâÍƼïÊ̤ˤĤ¤¤Æ¤Ï´û¤Ë ¥Ñ¡¼¥Æ¥£¥·¥ç¥óʬ³ä¤ÈÆâÍƼïÊ̤ÎȽÄê¤Ç½Ò¤Ù¤¿¤È¤ª¤ê¤Ç¤¢¤ë¡£ ¤³¤³¤Ç¤Ï¡¢¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤´¤È¤ÎÆâÍƼïÊ̤ò·èÄꤷ¤¿¸å¤ÎÆ°ºî¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£

Java ¥¨¥Ç¥£¥¿¤Ç¤Ï¡¢ JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤ÇÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤ËÂФ·¤ÆÆä˳ÈÄ¥¤Î¼Â Áõ¤Ï¹Ô¤Ê¤Ã¤Æ¤ª¤é¤º¡¢¤½¤Î¤Þ¤ÞÍøÍѤ·¤Æ¤¤¤ë¡£ IPresentationDamager ¤ª¤è¤Ó IPresentationRepairer ¤Ï¡¢ DefaultDamagerRepairer ¤ò¡¢¤Þ¤¿ IPresentationReconciler ¤Ï PresentationReconciler ¤ò¤½¤ì¤¾¤ìÍøÍѤ·¤Æ¤¤¤ë¡£ Java ¥¨¥Ç¥£¥¿Æȼ«¤Î¼ÂÁõ¤È¤·¤Æ¤Ï¡¢IPresentationDamager ¤ª¤è¤Ó IPresentationRepairer ¤ÇÍøÍѤ¹¤ë¡¢¥Ñ¡¼¥Æ¥£¥·¥ç¥óÆâ¤Î¥È¡¼¥¯¥óʬÀÏÍѤΥ¹¥­¥ã ¥Ê·²¤Ç¤¢¤ë¡£ 表12 ¤Ë Java ¥¨¥Ç¥£¥¿¤¬ÍÑ°Õ¤·¤Æ¤¤¤ë¥Ñ¡¼ ¥Æ¥£¥·¥ç¥óÆâ¤Î¥È¡¼¥¯¥ó¤Î¥¹¥­¥ã¥Ê¥¯¥é¥¹¤ò¼¨¤¹¡£

表 12. Java ¥¨¥Ç¥£¥¿¤Î¿§¤Å¤±´Ø·¸

̾¾Î¥Ñ¥Ã¥±¡¼¥¸ÀâÌÀ
JavaCodeScannerorg.eclipse.jdt.internal.ui.text.java Java ¥×¥í¥°¥é¥à¤ÎËÜʸ¤ò¥¹¥­¥ã¥ó¤·¡¢Í½Ìó¸ì¤Ê¤É¤Ëʬ³ä¤¹¤ë¥¹¥­¥ã¥Ê
JavaCommentScannerorg.eclipse.jdt.internal.ui.text Java ¤ÎÊ£¿ô¹Ô¥³¥á¥ó¥È¤ª¤è¤Ó£±¹Ô¥³¥á¥ó¥ÈÉôʬ¤Î¤¿¤á¤Î¥¹¥­¥ã¥Ê¡£ Æäˤ¿¤¤¤·¤¿²òÀϤϹԤäƤ¤¤Ê¤¤¡£
JavaDocScannerorg.eclipse.jdt.internal.ui.text.javadoc JavaDoc ¥³¥á¥ó¥È¤ËÍøÍѤ¹¤ë¤¿¤á¤Î¥¹¥­¥ã¥Ê¡£ JavaCommentScanner ¤Îµ¡Ç½¤Ë²Ã¤¨¤Æ¡¢xml ¥¿¥°¾ðÊó¤Î¼è¤ê½Ð¤·¤ä¡¢@ ¤Ç»Ï¤Þ¤ë ɽµ­¤Ê¤É¤ò²òÀϤ·¤Æ¤¤¤ë¡£
SingleTokenJavaScannerorg.eclipse.jdt.internal.ui.text Java ¥×¥í¥°¥é¥àÃæ¤Îʸ»úÎóÄê¿ô¤äʸ»úÄê¿ôÉôʬ¤ËÂФ·¤ÆÍøÍѤ¹¤ë¥¹¥­¥ã¥Ê¡£ ¼ÂÁõ¤Ï¤Û¤Ü³§Ìµ¤Ç¤¢¤ë¡£

Java ¥¨¥Ç¥£¥¿¤Ç¤Ï¡¢¤³¤ì¤é¤Î¥¹¥­¥ã¥Ê¤ò¤½¤ì¤¾¤ì DefaultDamageRepairer ¤ËÍ¿ ¤¨¤ë¤³¤È¤Ë¤è¤ê¡¢Java ¥×¥í¥°¥é¥àËÜÂΤ䡢¥³¥á¥ó¥ÈÉôʬ¡¢JavaDoc ¤Ê¤É¤ËÆò½ ¤·¤¿ IPresentationDamager ¤ª¤è¤Ó IPresentationRepairer ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò ºîÀ®¤·¤Æ¤¤¤ë¡£ Damager ¤ª¤è¤Ó Repairer ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ÎÀ¸À®¤È¡¢IPresentationReconciler ¤Ø¤ÎÅÐÏ¿¤Ï¡¢ org.eclipse.jdt.ui.text ¥Ñ¥Ã¥±¡¼¥¸¤Î JavaSourceViewerConfiguration ¥¯¥é¥¹¤Î getPresentationReconciler ¥á¥½¥Ã¥É¤Ç¹Ô¤ï¤ì¤Æ¤¤¤ë¡£ ¤Þ¤¿¡¢¸Ä¡¹¤Î¥¹¥­¥ã¥Ê¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ï org.eclipse.jdt.ui.text ¥Ñ¥Ã¥±¡¼¥¸¤Î JavaTextTools ¥¯¥é¥¹¤Ç°ì³ç´ÉÍý¤µ¤ì ¤Æ¤¤¤ë¡£


¥¨¥é¡¼É½¼¨µ¡Ç½¤Î¼ÂÁõ

JDT ¤Î¥¨¥é¡¼É½¼¨¤Ï¥¨¥Ç¥£¥¿¤È¤Ï¤«¤Ê¤êÆÈΩ¤·¤¿µ¡Ç½¤È¤·¤ÆÄ󶡤µ¤ì¤Æ¤¤¤ë¡£ Java ¥½¡¼¥¹¤Î¥³¥ó¥Ñ¥¤¥ë·ë²Ì¤Ï org.eclipse.jdt.core ¥×¥é¥°¥¤¥ó¤Î dom ¥Ç¥£ ¥ì¥¯¥È¥êÆâ¤Î org.eclipse.jdt.core.dom ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤è¤Ã¤Æ²òÀϤµ¤ì¡¢ ¥¨¥é¡¼¤È¤·¤ÆÊó¹ð¤µ¤ì¤ë¡£ ¸Ä¡¹¤Î¥¨¥é¡¼¾ðÊó¤Ï IProblem ¥¯¥é¥¹¤Ë³ÊǼ¤µ¤ì¡¢IProblem ¤ÎÇÛÎó¤Ç´ÉÍý¤µ¤ì ¤ë¡£

JDT ¤Î¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¥¤¥¹Éôʬ¤Ç¤Ï¡¢core extension ¥Ç¥£¥ì¥¯¥È¥ê¤Î org.eclipse.jdt.internal.corext.dom ¥Ñ¥Ã¥±¡¼¥¸Åù¤ò²ò¤·¤Æ¡¢dom ¤¬À¸À®¤·¤¿ ¥¨¥é¡¼¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£ ¤³¤ì¤é¤Î¥¨¥é¡¼¾ðÊó¤Ï org.eclipse.jdt.internal.ui.text.correction ¥Ñ¥Ã¥±¡¼ ¥¸¤Ç¥Ï¥ó¥É¥ê¥ó¥°¤µ¤ì¡¢¥¨¥Ç¥£¥¿¤ÎÊä´°µ¡Ç½¤ä¥Þ¡¼¥«¡¼É½¼¨¤Ê¤É¤ËÈ¿±Ç¤µ¤ì¤ë¡£


¥½¡¼¥¹¥³¡¼¥ÉÀ°·Áµ¡Ç½¤Î¼ÂÁõ

Ëܹà¤Ç¤Ï JavaEditor ¤Î¥½¡¼¥¹¥³¡¼¥ÉÀ°·Á¤Ë´ØÏ¢¤¹¤ë¥¯¥é¥¹¤ò³µ´Ñ¤¹¤ë¡£ ¤Ê¤ª¥½¡¼¥¹¥³¡¼¥ÉÀ°·Á¤Î¾ÜºÙ¤Ï¡¢¥Æ¥­¥¹¥È¤ÎÀ°·Á¤Ë´Ø¤¹¤ë¥¯¥é¥¹¤ò»² ¾È¤Î¤³¤È¡£

JFace ¤¬Ä󶡤¹¤ëÀ°·Áµ¡Ç½¤Î¤¦¤Á¡¢¼çÍפʥ¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ï IFormattingStrategy ¤È IContentFormatter ¤Î£²¼ï¤Ç¤¢¤ë¡£ ¤³¤Î¤¦¤Á¡¢IFormattingStrategy ¤Ë¤Ä¤¤¤Æ¤Ï ¥Æ¥­¥¹¥È¤ÎÀ°·Á¤Ë´Ø¤¹¤ë¥¯¥é¥¹ ¤Ç½Ò¤Ù¤¿¤è¤¦¤Ë¥Æ¥ó¥×¥ì¡¼¥È¥¯¥é¥¹¤¬ ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Ê¤¤¤¿¤á¡¢Java ¥¨¥Ç¥£¥¿¤Ç¤ÏÆȼ«¤Î¼ÂÁõ¥¯¥é¥¹ JavaFormattingStrategy ¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£ ¤³¤Î¥¯¥é¥¹¤Î¼ÂÂΤϡ¢org.eclipse.jdt.ui ¥×¥é¥°¥¤¥ó¤Î org.eclipse.jdt.internal.text.java ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤¢¤ë¡£ ¤Ê¤ª¡¢JavaFormattingStrategy ¤ÎÆâÉô¤Ç¤Ï JDT ¤Î¥³¥¢Éôʬ¤¬ÍÑ°Õ¤¹¤ë¥³¡¼¥ÉÀ° ·Á¥¯¥é¥¹ICodeFormatter ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ¤·¤Æ¡¢¤½¤Á¤é¤Ë½èÍý¤ò°ÍÍꤷ¤Æ ¤¤¤ë¡£ ICodeFormatter ¤Ï org.eclipse.jdt.core ¥×¥é¥°¥¤¥ó¤Ë°¤·¤Æ¤ª¤ê¡¢ ¥³¥¢Éôʬ¤ÎÊÝ»ý¤·¤Æ¤¤¤ë Java ¥×¥í¥°¥é¥à¥Ñ¡¼¥µ¤òÍøÍѤ·¤ÆÀ°·Á¤ò¹Ô¤Ã¤Æ¤¤¤ë¡£

¤Ê¤ª¡¢IContentFormatter ¤Ë¤Ä¤¤¤Æ¤Ï¡¢JFace ¤¬ÍÑ°Õ¤·¤¿¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤ò¤½ ¤Î¤Þ¤ÞÍøÍѤ·¤Æ¤¤¤ë¡£ IContentFormatter ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ï JavaSourceViewerConfiguration ¤¬ÊÝ»ý ¤·¤Æ¤ª¤ê¡¢getContentFormatter ¥á¥½¥Ã¥É¤Ç¼èÆÀ¤Ç¤­¤ë¡£


Êä´°¸õÊäÄ󼨵¡Ç½¤Î¼ÂÁõ

Ëܹà¤Ç¤Ï JavaEditor ¤ÎÊä´°¸õÊäÄ󼨤˴ØÏ¢¤¹¤ë¥¯¥é¥¹¤ò³µ´Ñ¤¹¤ë¡£ ¤Ê¤ªÊä´°¸õÊäÄ󼨵¡Ç½¤Î¾ÜºÙ¤Ï¡¢Êä´°¸õÊä¤Îɽ¼¨¤ò»² ¾È¤Î¤³¤È¡£

Êä´°¸õÊä¤ÎÄ󼨤ˤϡ¢IContentAssistProcessor, ICompletionProposal, IContextInformation, IContentAssistant ¤Î³Æ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ò¼ÂÁõ¤¹¤ëɬÍ× ¤¬¤¢¤ë¡£ IContentAssistProcessor ¤ÏÆȼ«¤Î¼ÂÁõ¥¯¥é¥¹¤È¤·¤Æ JavaCompletionProcessor, JavaDocCompletionProcessor ¤ª¤è¤Ó JavaCorrectionProcessor ¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£ ¤³¤ì¤é¤Î¾ÜºÙ¤ò表13¤Ë¼¨¤¹¡£

表 13. Java ¥¨¥Ç¥£¥¿¤Î¥½¡¼¥¹¥³¡¼¥ÉÊä´°´Ø·¸

̾¾Î¥Ñ¥Ã¥±¡¼¥¸ÀâÌÀ
JavaCompletionProcessororg.eclipse.jdt.internal.ui.text.java IContentAssistProcessor ¤Î¼ÂÁõ¥¯¥é¥¹¡£ Java¥×¥í¥°¥é¥à¤ÎËÜʸ¡¢Ê¸»úÎóÄê¿ô¤ª¤è¤Ó°ì¹Ô¥³¥á¥ó¥È¤ËÂФ¹¤ëÊä´°¸õÊä¤òÄó¼¨ ¤¹¤ë¥¯¥é¥¹¡£
JavaDocCompletionProcessororg.eclipse.jdt.internal.ui.text.javadoc IContentAssistProcessor ¤Î¼ÂÁõ¥¯¥é¥¹¡£ JavaDoc ¥³¥á¥ó¥È¤ËÂФ¹¤ëÊä´°¸õÊä¤òÄ󼨤¹¤ë¥¯¥é¥¹¡£
JavaCorrectionProcessororg.eclipse.jdt.internal.ui.text.correction IContentAssistProcessor ¤Î¼ÂÁõ¥¯¥é¥¹¡£ ¥¨¥é¡¼½¤ÀµÅù¤Ë´Ø¤¹¤ëɽ¼¨¤Ë¤âÂбþ¡£

¤³¤Î¤Û¤«¤Ë¡¢ICompletionProposal ¤Î¼ÂÁõ¥¯¥é¥¹ (図11)¤ª¤è¤Ó IContextInformation ¤Î¼ÂÁõ¥¯¥é¥¹ (図12) ¤¬Â¿¿ôÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¡£ ¤³¤ì¤é¤Ï¿ô¤¬ËÄÂç¤Ê¤¿¤á¾ÜºÙ¤Ï³ä°¦¤¹¤ë¡£

図 11. ICompletionProposal ¤Î¼ÂÁõ¥¯¥é¥¹³¬ÁØ¿Þ

図 12. IContextInformation ¤Î¼ÂÁõ¥¯¥é¥¹³¬ÁØ¿Þ

IContentAssistant ¤Ë¤Ä¤¤¤Æ¤Ï¡¢JavaEditor ¤Ç¤Ï¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤Î ContentAssistant ¥¯¥é¥¹¤ò¤½¤Î¤Þ¤ÞÍøÍѤ·¤Æ¤¤¤ë¡£ ¤·¤«¤·¡¢JavaEditor ¤Î¼ÂÁõ¥¯¥é¥¹¤Ç¤¢¤ë CompilationUnitEditor ¤Ç¤Ï¡¢ ContentAssistant ¥¯¥é¥¹¤ò·Ñ¾µ¤·¤¿ JavaCorrectionAssistant ¤òÍøÍѤ·¤Æ¤¤¤ë¡£

JavaEditor ¤¬ÍøÍѤ·¤Æ¤¤¤ë ContentAssistant ¤Ï JavaSourceViewerConfiguration ¤¬ÊÝ»ý¤·¤Æ¤ª¤ê¡¢getContentAssistant ¥á¥½¥Ã ¥É¤Ç¼èÆÀ¤Ç¤­¤ë¡£ °ìÊý¤Ç CompilationUnitEditor ¤¬ÍøÍѤ¹¤ë JavaCorrectionAssistant ¤Ï CompletionUnitEditor ¤ÎÆâÉô¥¯¥é¥¹¤Î AdaptedSourceViewer ¤Ç´ÉÍý¤µ¤ì¤Æ¤¤ ¤ë¡£


¥½¡¼¥¹ÀâÌÀ¤Î¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨µ¡Ç½¤Î¼ÂÁõ

Ëܹà¤Ç¤Ï JavaEditor ¤Î¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨µ¡Ç½¤Ë´ØÏ¢¤¹¤ë¥¯¥é¥¹¤ò³µ´Ñ¤¹¤ë¡£ ¤Ê¤ª¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨¤Î¾ÜºÙ¤Ï¡¢¥Ý¥Ã¥×¥¢¥Ã¥×¤Îɽ¼¨¤ò»² ¾È¤Î¤³¤È¡£

JFace ¤¬Ä󶡤¹¤ë¥Ý¥Ã¥×¥¢¥Ã¥×µ¡Ç½¤Ï IInformationProvide ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤È IInformationPresenter ¥¤¥ó¥¿¥Õ¥§¥¤¥¹ ¤ò¼ÂÁõ¤¹¤ë¤³¤È¤ÇÍøÍѤǤ­¤ë¡£ ¤³¤Î¤¦¤Á IInformationProvide ¤Ë¤Ä¤¤¤Æ¤Ï ¥Ý¥Ã¥×¥¢¥Ã¥×¤Îɽ¼¨¤Ç¤â½Ò¤Ù¤¿¤è¤¦¤Ë JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤Ï¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ¤ÏÄ󶡤µ¤ì¤Æ¤¤¤Ê¤¤¡£ ¤½¤³¤Ç¡¢Java ¥¨¥Ç¥£¥¿¤Ç¤ÏÆȼ«¤Ë JavaElementProvider ¤ª¤è¤Ó JavaInformationProvider ¤Î¼ÂÁõ¥¯¥é¥¹¤òÍÑ°Õ¤·¤Æ¤¤¤ë¡£

表 14. Java ¥¨¥Ç¥£¥¿¤Î¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨´Ø·¸

̾¾Î¥Ñ¥Ã¥±¡¼¥¸ÀâÌÀ
JavaElementProviderorg.eclipse.jdt.internal.ui.text IInformationProvider ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Î¼ÂÁõ¥¯¥é¥¹¡£ ´ðËܵ¡Ç½¤Î¤ß¤òÄ󶡡£¥×¥í¥°¥é¥àËÜʸ¤ª¤è¤Ó JavaDoc Éôʬ¤Î¤ß¤ËŬÍѤµ¤ì¤ë¡£
JavaInformationProviderorg.eclipse.jdt.internal.ui.text.hover IInformationProvider ¤È IInformationProviderExtension ¤ÎξÊý¤Î¥¤¥ó¥¿¥Õ¥§ ¥¤¥¹¤ò¼ÂÁõ¤·¤¿¥¯¥é¥¹¡£ ¥½¡¼¥¹¥³¡¼¥É¤ÎÁ´¤Æ¤ÎÉôʬ¤ËŬÍѤµ¤ì¤Æ¤¤¤ë¡£

¤Ê¤ª¡¢IInformationPresenter ¤Ë¤Ä¤¤¤Æ¤Ï¡¢JFace ¤¬ÍÑ°Õ¤·¤¿¥Æ¥ó¥×¥ì¡¼¥È¼ÂÁõ ¤ò¤½¤Î¤Þ¤ÞÍøÍѤ·¤Æ¤¤¤ë¡£ IInformationPresenter ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ï JavaSourceViewerConfiguration ¤¬ ÊÝ»ý¤·¤Æ¤ª¤ê¡¢getInformationPresenter ¤ª¤è¤Ó getOutlinePresneter ¥á¥½¥Ã ¥É¤Ç¼èÆÀ¤Ç¤­¤ë¡£ getInformationPresenter ¤Ï JavaSourceViewerConfiguration ¤Î¿Æ¥¯¥é¥¹ SourceViewerConfiguration ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥á¥½¥Ã¥É¤Ç¤¢¤ê¡¢JFace ¤Î SourceViewer ¤ÎÀßÄê¤ËÍøÍѤµ¤ì¤ë¡£ °ìÊý¤Ç getOutlinePresenter ¤Ï JavaSourceViewerConfiguration ¤ÎÆȼ«¤Î¥á¥½¥Ã ¥É¤Ç¤¢¤ê¡¢JFace ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ç¤ÏÍøÍѤµ¤ì¤Ê¤¤¡£ ¤³¤Î¥á¥½¥Ã¥É¤Ï JavaSourceViewer ¤«¤é¸Æ¤Ð¤ì¤Æ¤ª¤ê¡¢Java ¥¨¥Ç¥£¥¿Æȼ«¤Î¥Ý¥Ã ¥×¥¢¥Ã¥×ɽ¼¨¤ËÍøÍѤµ¤ì¤Æ¤¤¤ë¡£


Java ¥¨¥Ç¥£¥¿¤Î³ÈÄ¥

ËÜÀá¤Ç¤Ï Java ¥¨¥Ç¥£¥¿¤Î³ÈÄ¥¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£¤³¤³¤Ç¤Ï¡¢°ÊÁ°¼ÂÁõ¤ò¹Ô¤Ã¤¿ ³Ú´ÑŪ try ʸ¤ª¤è¤Ó¥Þ¥Ã¥×½é´ü²½»Ò¤ËÂФ¹¤ë¿§¤Å¤±¤ò¼ÂÁõ¤¹¤ë¡£


Eclipse ¤Î¥Ó¥ë¥É

¼ÂÁõ¤Ë¤Ä¤¤¤Æ¤ÎÀâÌÀ¤ÎÁ°¤Ë¡¢Eclipse ¤Î¥Ó¥ë¥ÉÊýË¡¤Ë¤Ä¤ÆÀâÌÀ¤¹¤ë¡£ Ëܹà¤Ç¤Ï Eclipse Á´ÂΤò°ì³ç¤Ç¥Ó¥ë¥É¤¹¤ëÊýË¡¤Î¤Û¤«¤Ë¡¢ÆÃÄê¤Î¥×¥é¥°¥¤¥ó ¤Î¤ß¤ò¥Ó¥ë¥É¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤Æ¤âÀâÌÀ¤¹¤ë¡£


Eclipse ¤Î¥Õ¥ë¥Ó¥ë¥É

¤³¤³¤Ç¤Ï Eclipse ¤Î¥½¡¼¥¹Á´ÂΤ«¤é Eclipse ¤Î¥Ð¥¤¥È¥³¡¼¥É¤òÀ¸À®¤¹¤ëÊý Ë¡¤Ë¤Ä¤¤¤Æ½Ò¤Ù¤ë¡£¥½¡¼¥¹¤Ë²þÊѤò¹Ô¤Ã¤¿ Eclipse ¤Î¥Ð¥¤¥È¥³¡¼¥É¤òÀ¸À®¤¹ ¤ë¤¿¤á¤Ë¤Ïɬ¤º°ì²ó¤Ï¥Õ¥ë¥Ó¥ë¥É¤ò¹Ô¤¦É¬Íפ¬¤¢¤ë¡£

¥½¡¼¥¹¥Ä¥ê¡¼¤Î¥Õ¥ë¥Ó¥ë¥É¤ò¹Ô¤¦ºÝ¤Ï¡¢Eclipse ¥½¡¼¥¹¥Ä¥ê¡¼¤Î¥È¥Ã¥×¥Ç¥£¥ì ¥¯¥È¥ê¤Ç²¼µ­¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¡£

% cd ${eclipse}
% build -os <OS¼ïÊÌ> -ws <¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¼ïÊÌ> [ -bc <rt.jar¤Î¥Ñ¥¹> ]

¤³¤³¤Ç¡¢${eclipse} ¤Ï Eclipse ¤Î¥½¡¼¥¹¥Ä¥ê¡¼¤Î¥È¥Ã¥×¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë¡£ <rt.jar¤Î¥Ñ¥¹>¤Ë¤Ï Java ¤Î¥é¥ó¥¿¥¤¥à¥é¥¤¥Ö¥é¥ê(J2SDK¤Ë´Þ¤Þ¤ì¤ë rt.jar)¤ò»ØÄꤹ¤ë¡£¤Ê¤ª¡¢¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï¡¢-bc ¥ª¥×¥·¥ç¥ó ¤ÏÉÔÍפǤ¢¤ë¡£ ¤Þ¤¿¡¢<OS¼ïÊÌ>¤ª¤è¤Ó<¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¼ïÊÌ>¤Ë»ØÄꤹ¤ëÃͤò 表15¤Ë¼¨¤¹¡£

表 15. OS¤ª¤è¤Ó¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¤ÎÁȤ߹ç¤ï¤»

OS¼ïÊÌ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¼ïÊÌ
win32win32
linuxmotif
linuxgtk
solarismotif
aixmotif
hpuxmotif
qnxphoton

Eclipse ¤Î¥½¡¼¥¹¤ÏÁ´ÂΤǿô½½MByte ¤ËµÚ¤Ö¤¿¤á¡¢Eclipse Á´ÂΤò¥Ó¥ë¥É¤¹ ¤ë¤È½èÍý·Ï¤Ë¤è¤Ã¤Æ¤Ï£±»þ´Ö¶á¤¯¤«¤«¤Ã¤Æ¤·¤Þ¤¤¡¢¶Ë¤á¤Æ¸úΨ¤¬°­¤¤¡£ ¤½¤³¤Ç¡¢¥Õ¥ë¥Ó¥ë¥É¤ÎɬÍפ¬¤Ê¤¤¾ì¹ç¤Ï¡¢²Äǽ¤Ê¸Â¤ê¼¡¹à¤Ç½Ò¤Ù¤ë¥×¥é¥°¥¤¥ó¤´ ¤È¤Î¥Ó¥ë¥É¤ò¹Ô¤¦¤³¤È¤ò¿ä¾©¤¹¤ë¡£


¥×¥é¥°¥¤¥ó¤´¤È¤Î¥Ó¥ë¥É

¤³¤³¤Ç¤ÏÆÃÄê¤Î¥×¥é¥°¥¤¥ó¤Î¤ß¤òñÆȤǥӥë¥É¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£ ¸¶Â§Åª¤Ë¤Ï¡¢¸Ä¡¹¤Î¥×¥é¥°¥¤¥ó¤Ï¤½¤ì¤Û¤ÉÌ©¤Ê´Ø·¸¤Ë¤Ï¤Ê¤¤¤¿¤á¡¢³°Éô¤«¤é »²¾È²Äǽ¤Ê API ¤Î»ÅÍÍÊѹ¹¤¬¤Ê¤¤¾ì¹ç(¥×¥é¥°¥¤¥ó¤ÎÆâÉôŪ¤Ê¼ÂÁõ¤Î¤ß¤ÎÊѹ¹¤Î ¾ì¹ç)¤Ï¡¢¤¿¤¤¤Æ¤¤Êѹ¹¤ò¹Ô¤Ã¤¿¥×¥é¥°¥¤¥ó¤Î¤ß¤ÎºÆ¹½ÃÛ¤ÇÆ°ºî¤¹¤ë¡£ ⤷¡¢¤³¤Î¼ê½ç¤ÏÁ´¤Æ¤Î¾ì¹ç¤ËŬÍѲÄǽ¤Ç¤­¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£¾õ¶·¤Ë¤è¤Ã¤Æ¤Ï¥× ¥é¥°¥¤¥ó¤Î¤ß¤Î¥Ó¥ë¥É¤Ç¤ÏŬÀµ¤ËÆ°ºî¤»¤º¡¢Á´ÂΤò¥³¥ó¥Ñ¥¤¥ë¤·Ä¾¤¹É¬Íפ¬¤¢¤ë¡£

¤Ê¤ª¡¢Ëܹà¤ÇÀâÌÀ¤¹¤ë¤Î¤Ï¸·Ì©¤Ë¤Ï¥×¥é¥°¥¤¥óñÂΤǤΥӥë¥É¤Ç¤Ï¤Ê¤¯¡¢´ØÏ¢ À­¤Î¤¢¤ë¥×¥é¥°¥¤¥ó½¸¹ç¤Î¥Ó¥ë¥É¤Ç¤¢¤ë¡£

# cd ${ECLIPSE}/features/org.eclipse.jdt-feature/
# ant clean
# ant -buildfile build.xml -Dos=<OS¼ïÊÌ> -Dws=<¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¼ïÊÌ> -Dbootclasspath=<rt.jar¤Î¥Ñ¥¹>

<OS¼ïÊÌ>¡¢ <¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à¼ïÊÌ>¡¢<rt.jar¤Î¥Ñ¥¹>¤Ë ÀßÄꤹ¤ëÃͤˤĤ¤¤Æ¤ÏÁ°¹à¤ÈƱ¤¸¤Ç¤¢¤ë(表15Eclipse ¤Î¥Õ¥ë¥Ó¥ë¥É»²¾È)¡£ 2 ¹ÔÌÜ¤Ç clean ¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¤¬¡¢¤³¤ì¤Ï¡¢clean ¤ò¤»¤º¤Ë¥Ó¥ë¥É¤·¤¿¾ì¹ç¤Ë ¤¦¤Þ¤¯Æ°ºî¤·¤Ê¤¤¤³¤È¤¬¤¢¤Ã¤¿¤¿¤á¤Ç¤¢¤ë¡£¼ÂºÝ¤Ë¾ÜºÙ¤Ê¾ò·ï¤Ë¤Ä¤¤¤Æ¤ÏÄ´ºº¤ò ¹Ô¤Ã¤Æ¤¤¤Ê¤¤¤¬¡¢²þÊÑÆâÍƤˤè¤Ã¤Æ¤Ï clean ¤¬É¬ÍפȤʤë¤è¤¦¤Ç¤¢¤ë¡£


³Ú´ÑŪ try ¤Ë´Ø¤¹¤ë³ÈÄ¥

Ëܹà¤Ç¤Ï³Ú´ÑŪ try ¹½Ê¸¤ËÂФ¹¤ë¥³¡¼¥É¤Î³ÈÄ¥¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£


³Ú´ÑŪ try ¹½Ê¸¤Î³µÍ×

¤Þ¤º¤Ï¡¢³Ú´ÑŪ try ¹½Ê¸¤Ë¤Ä¤¤¤Æ´Êñ¤ËÀâÌÀ¤¹¤ë¡£ ¤Ê¤ª¡¢ËÜÀá¤ÇÂоݤȤ¹¤ë³Ú´ÑŪ try ¹½Ê¸¤ÏÁ°²ó¤ÎÄ´ººÊó¹ð¤Ç¼ÂÁõ¤ò¹Ô¤Ã¤¿¤â¤Î ¤ÈÁ´¤¯Æ±¤¸»ÅÍͤǤ¢¤ë¡£

³Ú´ÑŪ Try ¹½Ê¸¤Ï¡¢API ¥¤¥ó¥¿¥Õ¥§¥¤¥¹¾å¤ÏÎã³°¤¬È¯À¸¤·ÆÀ¤ë¤¬¡¢¼ÂºÝ¤Ë¤ÏÎã ³°¤¬È¯À¸¤·ÆÀ¤Ê¤¤¾ì¹ç¤Î¥³¡¼¥Ç¥£¥ó¥°¤ò³Ú¤Ë¤¹¤ë¥·¥ó¥¿¥Ã¥¯¥¹¥·¥å¥¬¡¼¤Ç¤¢¤ë¡£

ByteArrayOutputStream os = new ByteArrayOutputStream();
try __optimistic__ {
	os.close();
}

¤³¤ì¤Ï¡¢°Ọ̃Ū¤Ë¤Ï²¼µ­¤Î¥³¡¼¥É¤ÈÅù²Á¤Ç¤¢¤ë¡£

ByteArrayOutputStream os = new ByteArrayOutputStream();
try  {
	os.close();
} catch (Throwable th) {
}

¤Ä¤Þ¤ê¡¢__optimistic__¤òÉղä·¤¿tryʸ¤Ç¤Ï¡¢catchÀá¤äfinallyÀá¤ò¾Êά¤¹¤ë ¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£


³Ú´ÑŪ try ¹½Ê¸¤Î¿§ÉÕ¤±¤Î³ÈÄ¥

¤³¤³¤Ç¤Ï³Ú´ÑŪ try ¹½Ê¸¤ËÂФ·¤Æ¿§ÉÕ¤±¤Î³ÈÄ¥¤ò¹Ô¤¦ÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹¤ë¡£


»ÅÍÍ

¤³¤³¤Ç¼ÂÁõ¤¹¤ë³Ú´ÑŪ try ¹½Ê¸¤Î¿§ÉÕ¤±¤Î»ÅÍͤϲ¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

  • "__optimistic__" ¤ò¾¤ÎͽÌó¸ì¤ÈƱÍͤ理ª¤è¤Ó¥Õ¥©¥ó¥È¤Çɽ¼¨¤¹¤ë¡£

図13 ¤Ë¥µ¥ó¥×¥ë¤Î¥¨¥Ç¥£¥¿²èÌ̤ò¼¨¤¹¡£ ¤³¤Î¥¨¥Ç¥£¥¿¤Ç¤Ï¡¢Ä̾ï¤Î Java ¥¨¥Ç¥£¥¿¤Ç¤Ï¹õ»ú¤Çɽ¼¨¤µ¤ì¤ë __optimistic__ ¤¬¤½¤Î¾¤ÎͽÌó¸ì¤ÈƱ¤¸¥Õ¥©¥ó¥È¤Çɽ¼¨¤µ¤ì¤Æ¤¤¤ë¡£

図 13. ³Ú´ÑŪ Try ¤ËÂбþ¤·¤¿¥¨¥Ç¥£¥¿¤Î¥µ¥ó¥×¥ë


¼Â¸½ÊýË¡

__optimistic__ ¤òͽÌó¸ì¤ÈƱ¤¸¥Õ¥©¥ó¥È¤Çɽ¼¨¤¹¤ë¤¿¤á¤Ë¤Ï¡¢ Java ¤Î¥×¥í¥°¥é¥àÉôʬ¤Î¥Õ¥©¥ó¥ÈÁõ¾þ¤òôÅö¤·¤Æ¤¤¤ë JavaSourceViewerConfiguration ¤Î DefaultDamagerRepairer ¤Ç¤Ï JavaCodeScanner ¥¯¥é¥¹¤òÍøÍѤ·¤ÆͽÌó¸ì¤òȽÄꤷ¤Æ¤¤¤ë¡£ ¤½¤³¤Ç¡¢JavaCodeScanner ¥¯¥é¥¹¤ÎͽÌó¸ìȽÄêÉôʬ¤Ç "__optimistic__" ¤òͽÌó ¸ì¤ÈȽÄꤹ¤ë¤è¤¦Êѹ¹¤¹¤ë¤³¤È¤Ç¡¢ "__optimistic__" ¤Ë¿§ÉÕ¤±¤ò¹Ô¤¦¤³¤È¤¬¤Ç ¤­¤ë¡£


¼ÂÁõ

¤Ê¤ª¡¢º£²óÂоݤȤʤë Eclipse ¤Î¥½¡¼¥¹¥Ä¥ê¡¼¤ËÂФ·¤Æ¤Ï¡¢Á°²ó¤ÎÄ´ººÊó¹ð ¤Ëµ­½Ò¤·¤¿³Ú´ÑŪ try ¹½Ê¸¤Ë´Ø¤¹¤ë¥³¥ó¥Ñ¥¤¥é³ÈÄ¥¤¬´û¤ËŬÍѤµ¤ì¤Æ¤¤¤ë¤â¤Î ¤È¤¹¤ë¡£

ティップ

Êѹ¹¤¬Ì¤Å¬±þ¤Ç¤â³Ú´ÑŪ Try ¹½Ê¸¤Î¿§¤Å¤±¼«ÂΤϹԤï¤ì¤ë¤¬¡¢ ¥Ñ¡¼¥¹¤Ë¼ºÇÔ¤¹¤ë¤¿¤á¥¨¥é¡¼¤Ê¤É¤Î¥Þ¡¼¥«¡¼¤¬É½¼¨¤µ¤ì¤ë¡£

JavaCodeScanner ¤Ï org.eclipse.jdt.ui ¥×¥é¥°¥¤¥ó¤Î ui ¥Ç¥£¥ì¥¯¥È¥ê¤Î org.eclipse.jdt.internal.ui.text.java ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤¢¤ë¡£ ͽÌó¸ì¤ÎȽÄê¤Ï createRules ¥á¥½¥Ã¥É(139¹ÔÌÜ)¤ÎÃæ¤Ç¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥ó¥Ð¤Î String[] fgKeywords (83¹ÔÌÜ) ¤ÈÈæ³Ó¤¹¤ë¤³¤È¤Ç¹Ô¤Ã¤Æ¤¤¤ë¡£ ½¾¤Ã¤Æ¡¢fgKeywords ¤Ë "__optimistic__" ¤òÄɲ䷤Ƥä¤ì¤Ð¤è¤¤¡£ ²¼µ­¤ËÊѹ¹¤·¤¿¥½¡¼¥¹¤ò¼¨¤¹¡£

...

public final class JavaCodeScanner extends AbstractJavaScanner {

	...

	private static String[] fgKeywords= { 
		"abstract", //$NON-NLS-1$
		"break", //$NON-NLS-1$
		"case", "catch", "class", "const", "continue", //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
		"default", "do", //$NON-NLS-2$ //$NON-NLS-1$
		"else", "extends", //$NON-NLS-2$ //$NON-NLS-1$
		"final", "finally", "for", //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
		"goto", //$NON-NLS-1$
		"if", "implements", "import", "instanceof", "interface", //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
		"native", "new", //$NON-NLS-2$ //$NON-NLS-1$
		"package", "private", "protected", "public", //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
		"return", //$NON-NLS-1$
		"static", "super", "switch", "synchronized", //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
		"this", "throw", "throws", "transient", "try", //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
		"volatile", //$NON-NLS-1$
		"while", //$NON-NLS-1$
// ************** for optimistic try **************
		"__optimistic__"
// *************************************************
	};

	private static String[] fgNewKeywords= { "assert" }; //$NON-NLS-1$

	...

°Ê¾å¤ÎÊѹ¹¤òŬÍѤ·¤¿¾å¤Ç Eclipse ¤òºÆ¹½ÃÛ¤¹¤ë¤³¤È¤Ç¡¢ ³Ú´ÑŪ Try ¤ËÂбþ¤·¤¿ Eclipse ¤¬À¸À®¤µ¤ì¤ë¡£


²ÝÂê

¤³¤Î¤è¤¦¤Ë¡¢Í½Ìó¸ì¤ÎÄɲäÀ¤±¤Ç¤¢¤ì¤ÐÍưפËÂбþ¤Ç¤­¤ë¡£ ¤·¤«¤·¤Ê¤¬¤é¡¢¿§ÉÕ¤±¤Ë´ØÏ¢¤·¤¿Ê¸Ë¡µ¬Â§¤¬¥³¥ó¥Ñ¥¤¥é¤È¤ÏÆÈΩ¤·¤Æ¼ÂÁõ¤µ¤ì¤Æ ¤¤¤ë¤¿¤á¡¢Ê¸Ë¡³ÈÄ¥¤ÈÊ»ÍѤ·¤¿¾ì¹ç¤Ë¡¢³ÈÄ¥¤µ¤ì¤¿Ê¸Ë¡¤È¥¨¥Ç¥£¥¿´Ø·¸¤Î³È Ä¥Éôʬ¤È¤ÎÂбþ´ØÏ¢¤ò¤É¤Î¤è¤¦¤Ë¤·¤Æ´ÉÍý¤¹¤ë¤«¤¬²ÝÂê¤Ç¤¢¤ë¡£


¥Þ¥Ã¥×½é´ü²½»Ò¤Ë´Ø¤¹¤ë³ÈÄ¥

Ëܹà¤Ç¤Ï¥Þ¥Ã¥×½é´ü²½»Ò¹½Ê¸¤Ë´Ø¤¹¤ë Eclipse ¥¨¥Ç¥£¥¿¤Î³ÈÄ¥¤Ë¤Ä¤¤¤ÆÀâÌÀ¤¹ ¤ë¡£


¥Þ¥Ã¥×½é´ü²½»Ò¤Î³µÍ×

¥Þ¥Ã¥×½é´ü²½»Ò¤Ï¡¢´û¤ËÃͤ¬ÅÐÏ¿¤µ¤ì¤¿ Map ¥¤¥ó¥¹¥¿¥ó¥¹¤ò½é´ü²½¤¹¤ë¹½Ê¸¤ò Ä󶡤¹¤ë¤â¤Î¤Ç¤¢¤ë¡£

Map colors = %{
	"red" => new Integer(0xff0000),
	"green" => new Integer(0x00ff00),
	"blue" => new Integer(0x0000ff)
};

¾åµ­¤Î¤è¤¦¤Ëµ­½Ò¤¹¤ë¤È¡¢²¼µ­¤Î¥³¡¼¥É¤ÈƱ¤¸Æ°ºî¤ò¤¹¤ë¡£

Map colors = new HashMap();
colors.put("red", new Integer(0xff0000));
colors.put("green", new Integer(0x00ff00));
colors.put("blue", new Integer(0x0000ff));

¥Þ¥Ã¥×½é´ü²½»Ò¤Î¿§ÉÕ¤±¤Î³ÈÄ¥

¤³¤³¤Ç¤Ï¥Þ¥Ã¥×½é´ü²½»ÒÉôʬ¤Ë¤Ä¤¤¤Æ¤Î¿§ÉÕ¤±¤ò¹Ô¤¦¡£


»ÅÍÍ

¤³¤³¤Ç¼ÂÁõ¤¹¤ë¥Þ¥Ã¥×½é´ü²½»Ò¤Î¿§ÉÕ¤±¤Î»ÅÍͤϲ¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

  • ¥Þ¥Ã¥×½é´ü²½»Ò¤ÎÉôʬ¤ËÂФ·¤ÆÊ£¿ô¹Ô¥³¥á¥ó¥È¤ÈƱÍͤο§ÉÕ¤±¤ò¹Ô¤¦¡£

  • ¥Þ¥Ã¥×½é´ü²½»Ò¤ÎÈÏ°Ï¤Ï %{ ¤«¤é¡¢Ä¾¶á¤Î } ¤Þ¤Ç¤Î¶è´Ö¤Ç¤¢¤ë¤â¤Î¤È¤¹¤ë¡£

図14 ¤Ë¥µ¥ó¥×¥ë¤Î¥¨¥Ç¥£¥¿²èÌ̤ò¼¨¤¹¡£ ¤³¤Î¥¨¥Ç¥£¥¿¤Ç¤Ï¡¢%{ ¤«¤é } ¤Þ¤Ç¤ÎÉôʬ¤¬¥³¥á¥ó¥È¤ÈƱÍͤÎÇö¤¤Ã㿧¤Çɽ¸½¤µ ¤ì¤Æ¤¤¤ë¡£

図 14. ¥Þ¥Ã¥×½é´ü²½»Ò¤ËÂбþ¤·¤¿¥¨¥Ç¥£¥¿¤Î¥µ¥ó¥×¥ë


¼Â¸½ÊýË¡

¤³¤³¤Ç¤Ï¡¢¥Þ¥Ã¥×½é´ü²½»ÒÉôʬ¤òÄ̾ï¤Î Java ¥×¥í¥°¥é¥à¤È¤Ï°Û¤Ê¤ëÉôʬ¤È¸«Î© ¤Æ¤Æ¡¢¤³¤ÎÉôʬ¤òÀÚ¤ê½Ð¤¹ÊýË¡¤òºÎÍѤ¹¤ë¡£ ¤Ä¤Þ¤ê¡¢¥Þ¥Ã¥×½é´ü²½»ÒÉôʬ¤òÀÚ¤ê½Ð¤·¡¢¤³¤ÎÉôʬ¤òÆÈΩ¤·¤¿¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤È ¤·¤Æ¿·¤¿¤ÊÆâÍƼïÊ̤òÉÕÍ¿¤¹¤ë¡£

注意

¥Þ¥Ã¥×½é´ü²½»Ò¤Ï Java ¤Î¥×¥í¥°¥é¥à¥³¡¼¥É¤Î°ìÉô¤Ç¤¢¤ê¡¢¤½¤Î´Ö¤Ë¥³¥á ¥ó¥ÈÅù¤¬½Ð¸½¤·¤¦¤ë¤Î¤Ç¡¢¤³¤³¤ÇÀâÌÀ¤·¤¿¤è¤¦¤Ê¿·¤¿¤Ê¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤È¤·¤ÆÀÚ ¤ê½Ð¤¹¼êË¡¤ÏŬÀڤǤϤʤ¤¡£ ¤·¤«¤·¤Ê¤¬¤é¡¢º£²ó¤Ï pxml ¤ò¼ÂÁõ¤·¤¿¾ì¹ç¤òÁÛÄꤷ¡¢¿·¤¿¤Ê¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ò Äɲ乤ëÊýË¡¤Î»öÁ°Ä´ºº¤È¤¤¤¦°ÌÃ֤Ť±¤Ç¡¢¤¢¤¨¤Æ¥Þ¥Ã¥×½é´ü²½»ÒÉôʬ¤ò Java ¥×¥í¥°¥é¥àËÜʸ¤È¤Ï°Û¤Ê¤ë¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤È¤·¤ÆÀÚ¤ê½Ð¤¹ÊýË¡¤òÁªÂò¤·¤¿¡£

¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÈϰϤª¤è¤ÓÆâÍƼïÊ̤ÎȽÄê¤Ï JavaPartitionScanner ¤¬¹Ô¤Ã¤Æ ¤¤¤ë¡£º£²ó¤Ï¤µ¤é¤Ë IJavaPartitions ¤Ë¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆâÍƼïÊ̤òÄɲä·¤¿¡£ ¤¿¤À¤·¡¢¼ÂºÝ¤ËÆâÍƼïÊ̤òÄɲ䷤Ƥ·¤Þ¤¦¤È¡¢¿·¤¿¤ËÄɲ䵤줿¥Ñ¡¼¥Æ¥£¥·¥ç¥ó ¼ïÊ̤ËÂФ·¤Æ¡¢¥Õ¥©¥ó¥ÈÁõ¾þÅù¤ÎÆ°ºî¥¯¥é¥¹¤ò¼ÂÁõ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤º¡¢±Æ¶ÁÈÏ°Ï ¤¬Â礭¤¤¤¿¤á¡¢ÆâÍƼïÊ̤ÎÄêµÁʸ»úÎó¤Ï¥³¥á¥ó¥È¤ÈƱÍͤΤâ¤Î¤òÍøÍѤ¹¤ë¤³¤È¤È ¤·¤¿¡£


¼ÂÁõ

º£²óÂоݤȤʤë Eclipse ¤Î¥½¡¼¥¹¥Ä¥ê¡¼¤Ï¡¢Á°²ó¤ÎÄ´ººÊó¹ð ¤Ëµ­½Ò¤·¤¿¥Þ¥Ã¥×½é´ü²½»Ò¹½Ê¸¤Ë´Ø¤¹¤ë¥³¥ó¥Ñ¥¤¥é³ÈÄ¥¤¬´û¤ËŬÍѤµ¤ì¤Æ¤¤¤ë¤â ¤Î¤È¤¹¤ë¡£

ティップ

Êѹ¹¤¬Ì¤Å¬±þ¤Î¾ì¹ç¤Ç¤â¥Þ¥Ã¥×½é´ü²½»Ò¹½Ê¸¤Î¿§¤Å¤±¤Ï¹Ô¤ï¤ì¤ë¤¬¡¢ ¥Ñ¡¼¥¹¤Ë¼ºÇÔ¤¹¤ë¤¿¤á¥¨¥é¡¼¤Ê¤É¤Î¥Þ¡¼¥«¡¼¤¬É½¼¨¤µ¤ì¤ë¡£

Êѹ¹Âоݥե¡¥¤¥ë¤Ï¡¢ org.eclipse.jdt.ui ¥×¥é¥°¥¤¥ó¤Î ui ¥Ç¥£¥ì¥¯¥È¥ê¤Î org.eclipse.jdt.internal.ui.text ¥Ñ¥Ã¥±¡¼¥¸¤Ë¤¢¤ë¡¢ FastJavaPartitionScanner ¤ª¤è¤Ó IJavaPartitions ¤Ç¤¢¤ë¡£

IJavaPartitions ¤Ë¤Ï¿·¤¿¤Ê¥Ñ¡¼¥Æ¥£¥·¥ç¥óÆâÍƼïÊ̤Ȥ·¤Æ JAVA_MAP_INITIALIZER ¤òÄɲ乤롣¤¿¤À¤·¡¢¤³¤³¤Ç¤Ï¼ÂÂÎ¤Ï JAVA_MULTI_LINE_COMMENT ¤ÈƱ¤¸Êª¤òÂåÆþ¤¹¤ë¡£ ¥½¡¼¥¹¤Ï²¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

...

public interface IJavaPartitions {
	public final static String JAVA_SINGLE_LINE_COMMENT= "__java_singleline_comment"; //$NON-NLS-1$
	public final static String JAVA_MULTI_LINE_COMMENT= "__java_multiline_comment"; //$NON-NLS-1$
	public final static String JAVA_DOC= "__java_javadoc"; //$NON-NLS-1$
	public final static String JAVA_STRING= "__java_string"; //$NON-NLS-1$
	public final static String JAVA_CHARACTER= "__java_character";  //$NON-NLS-1$
// ************** for map initializer **************
	public final static String JAVA_MAP_INITIALIZER= JAVA_MULTI_LINE_COMMENT ;
// *************************************************
}

³¤¤¤Æ¡¢¼ÂºÝ¤Ë¥¹¥­¥ã¥ó¤·¤Æ¤¤¤ëÉôʬ¤Ç¤¢¤ë FastJavaPartitionScanner ¤ò½¤Àµ ¤¹¤ë¡£ ¤³¤³¤Ç¤Î½¤ÀµÅÀ¤Ï²¼µ­¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£

  • ¥¹¥¿¥Æ¥£¥Ã¥¯ÊÑ¿ô¤ÎÄɲÃ

    ¥¯¥é¥¹ËÁƬÉôʬ¤Ë¥¹¥¿¥Æ¥£¥Ã¥¯ÊÑ¿ô¤òÄɵ­¤¹¤ë¡£

    ...
    
    public class FastJavaPartitionScanner implements IPartitionTokenScanner, IJavaPartitions {	
    
    	// states
    	private static final int JAVA= 0;	
    	private static final int SINGLE_LINE_COMMENT= 1;
    	private static final int MULTI_LINE_COMMENT= 2;
    	private static final int JAVADOC= 3;
    	private static final int CHARACTER= 4;
    	private static final int STRING= 5;
    // ************** for map initializer **************
    	private static final int MAP_INITIALIZER = 6;
    // *************************************************
    	
    	// beginning of prefixes and postfixes
    	private static final int NONE= 0;
    	private static final int BACKSLASH= 1; // postfix for STRING and CHARACTER
    	private static final int SLASH= 2; // prefix for SINGLE_LINE or MULTI_LINE or JAVADOC
    	private static final int SLASH_STAR= 3; // prefix for MULTI_LINE_COMMENT or JAVADOC
    	private static final int SLASH_STAR_STAR= 4; // prefix for MULTI_LINE_COMMENT or JAVADOC
    	private static final int STAR= 5; // postfix for MULTI_LINE_COMMENT or JAVADOC
    	private static final int CARRIAGE_RETURN=6; // postfix for STRING, CHARACTER and SINGLE_LINE_COMMENT
    // ************** for map initializer **************
    	private static final int PERCENT=7;
    	private static final int PLUS=8;
    // *************************************************
    
    	
    	/** The scanner. */
    	private final BufferedDocumentScanner fScanner= new BufferedDocumentScanner(1000);	// faster implementation
    
    	...
    

  • IToken[] fTokens (63¹ÔÌÜ) ¤Ë¾åµ­¤ÇÄɲä·¤¿¥¹¥¿¥Æ¥£¥Ã¥¯ÊÑ¿ô¤òÄɲÃ

    	...
    	
    	private final IToken[] fTokens= new IToken[] {
    		new Token(null),
    		new Token(JAVA_SINGLE_LINE_COMMENT),
    		new Token(JAVA_MULTI_LINE_COMMENT),
    		new Token(JAVA_DOC),
    		new Token(JAVA_CHARACTER),
    		new Token(JAVA_STRING),
    // ************** for map initializer **************
    		new Token(JAVA_MAP_INITIALIZER)
    // *************************************************
    	};
    
    	...
    

  • nextToken ¥á¥½¥Ã¥É(75¹ÔÌÜ) ¤Î¥­¥ã¥é¥¯¥¿¤ÎȽÄêÉôʬ¤Ë¥Ñ¡¼¥»¥ó¥È¤òȽÄꤹ¤ë ¥³¡¼¥É¤òÄɲÃ(190¹ÔÌܶáÊÕ)

    	...
    
    	public IToken nextToken() {
    
    		...
    
    		while (true) {
    
    			...
    
    	 		switch (ch) {
    
    			...
    
    			default:
    				if (!fgEmulate && fLast == CARRIAGE_RETURN) {			
    					switch (fState) {
    					case SINGLE_LINE_COMMENT:
    					case CHARACTER:
    					case STRING:
    
    						int last;
    						int newState;
    						switch (ch) {
    						case '/':
    							last= SLASH;
    							newState= JAVA;
    							break;
    
    						case '*':
    							last= STAR;
    							newState= JAVA;
    							break;
    						
    						case '\'':
    							last= NONE;
    							newState= CHARACTER;
    							break;
    
    						case '"':
    							last= NONE;
    							newState= STRING;
    							break;
    
    			// ************** for map initializer **************
    						case '%':
    							last= PERCENT;
    							newState= JAVA;
    							break;
    			// *************************************************
    						case '\r':
    							last= CARRIAGE_RETURN;
    							newState= JAVA;
    							break;
    
    						case '\\':
    							last= BACKSLASH;
    							newState= JAVA;
    							break;
    
    						default:
    							last= NONE;
    							newState= JAVA;
    							break;
    						}
    						
    						fLast= NONE; // ignore fLast
    						return preFix(fState, newState, last, 1);
    
    					default:
    						break;
    					}
    				}
    			}
    
    			...
    

  • nextToken ¥á¥½¥Ã¥É(75¹ÔÌÜ) ¤Î Java ¥×¥í¥°¥é¥àÃæ¤Ë½Ð¸½¤¹¤ë¥Ñ¡¼¥Æ¥£¥·¥ç¥ó ³«»Ï°ÌÃÖ¤ÎȽÄêÉôʬ¤Ë¥³¡¼¥É¤òÄɲÃ(252¹ÔÌܶáÊÕ)

    			...
    
    			// states	 
    	 		switch (fState) {
    	 		case JAVA:
    				switch (ch) {
    				case '/':
    
    					...
    
    				case '*':
    					if (fLast == SLASH) {
    
    						...
    
    					} else {
    						consume();
    						break;
    					}
    					
    			// ************** for map initializer **************
    				case '%':
    					fTokenLength++;
    					fLast= PERCENT;
    					break;
    	
    				case '{':
    					if (fLast == PERCENT) {
    						if (fTokenLength - getLastLength(fLast) > 0)
    							return preFix(JAVA, MAP_INITIALIZER, PLUS, 2);
    						else {
    							preFix(JAVA, MAP_INITIALIZER, PLUS, 2);
    							fTokenOffset += fTokenLength;
    							fTokenLength= fPrefixLength;
    							break;
    						}
    
    					} else {
    						consume();
    						break;
    					}
    			// *************************************************
    				case '\'':
    					fLast= NONE; // ignore fLast
    					if (fTokenLength > 0)
    						return preFix(JAVA, CHARACTER, NONE, 1);
    					else {						
    						preFix(JAVA, CHARACTER, NONE, 1);
    						fTokenOffset += fTokenLength;
    						fTokenLength= fPrefixLength;
    						break;
    					}
    
    				case '"':
    
    					...
    	
    				default:
    					consume();
    					break;
    				}
    				break;
    
    	 		case SINGLE_LINE_COMMENT:
    				consume();
    				break;
    				
    	 		case JAVADOC:
    
    			...
    

  • nextToken ¥á¥½¥Ã¥É(75¹ÔÌÜ) ¤Ë¥Þ¥Ã¥×½é´ü²½»Ò¶è´Ö¤Î½ªÎ»È½Äê¤Î¾ò·ï¤òÄɲà (337¹ÔÌܶáÊÕ)

    			...
    
    	 		case JAVADOC:
    
    				...
    
    	 		case MULTI_LINE_COMMENT:
    				switch (ch) {
    				case '*':
    					if (fLast == SLASH_STAR) {
    						fLast= SLASH_STAR_STAR;
    						fTokenLength++;
    						fState= JAVADOC;
    					} else {
    						fTokenLength++;
    						fLast= STAR;
    					}
    					break;
    	
    				case '/':
    					if (fLast == STAR) {
    						return postFix(MULTI_LINE_COMMENT);
    					} else {
    						consume();
    						break;
    					}
    				default:
    					consume();
    					break;
    				}
    				break;
    		// ************** for map initializer **************
    			case MAP_INITIALIZER:
    				switch (ch) {
    				case '}':
    					return postFix(MAP_INITIALIZER);
    	
    				default:
    					consume();
    					break;			
    				}
    				break;
    		// *************************************************
    				
    	 		case STRING:
    	 			switch (ch) {
    	 			case '\\':
    					fLast= (fLast == BACKSLASH) ? NONE : BACKSLASH;
    					fTokenLength++;
    					break;
    					
    				case '\"':	 			 			
    	 				if (fLast != BACKSLASH) {
    	 					return postFix(STRING);
    
    		 			} else {
    						consume();
    						break; 					
    	 				}
    		 		
    		 		default:
    					consume();
    	 				break;
    	 			}
    	 			break;
    
    	 		case CHARACTER:
    
    				...
    
    	 		}
    		} 
     	}		
    
    	...
    

  • getState ¥á¥½¥Ã¥É(442¹ÔÌÜ) ¤ÎÆâÍƼïÊÌȽÄêÉôʬ¤Ë¥Þ¥Ã¥×½é´ü²½»Ò¤Ë´Ø¤¹¤ë¤â ¤Î¤òÄɲÃ(461¹ÔÌܶáÊÕ)¡£

    	...
    
    	private static final int getLastLength(int last) {
    		switch (last) {
    		default:
    			return -1;
    
    		case NONE:
    			return 0;
    			
    		case CARRIAGE_RETURN:
    		case BACKSLASH:
    		case SLASH:
    		case STAR:
    	// ************** for map initializer **************
    		case PERCENT:
    	// *************************************************
    			return 1;
    
    		case SLASH_STAR:
    			return 2;
    
    		case SLASH_STAR_STAR:
    			return 3;
    		}	
    	}
    
    	...
    

°Ê¾å¤ÎÊѹ¹¤òŬÍѤ·¤¿¾å¤Ç Eclipse ¤òºÆ¹½ÃÛ¤¹¤ë¤³¤È¤Ç¡¢ ¥Þ¥Ã¥×½é´ü²½»Ò¤ËÂбþ¤·¤¿ Eclipse ¤¬À¸À®¤µ¤ì¤ë¡£ ¤Ê¤ª¾ÜºÙ¤Ï¡¢ÅºÉդΥ½¡¼¥¹¤ò»²¾È¤µ¤ì¤¿¤·¡£


²ÝÂê

º£²ó¤Î¼ÂÁõÊýË¡¤Ë¤Ï²¼µ­¤Î¤è¤¦¤ÊÌäÂêÅÀ¤¬Â¸ºß¤¹¤ë¡£

  • º£²ó¤ÎÊýË¡¤Ç¤Ï¡¢¥Ñ¡¼¥Æ¥£¥·¥ç¥ó¤ÎÆâÍƼïÊ̤ÏÄɲä·¤¿¤¬¡¢ÆâÍƼïÊÌʸ»úÎó¤Ï Êص¹¤Î¤¿¤á¤ËÊ£¿ô¹Ô¥³¥á¥ó¥È¤ÈƱ¤¸ JAVA_MULTI_LINE_COMMENT ¤òÍøÍѤ·¤Æ¤¤¤ë¡£ ¤³¤ÎÊÀ³²¤È¤·¤Æ¡¢³°Éô¤«¤é setPartitionRange ¥á¥½¥Ã¥É¤ò¸Æ¤Ð¤ì¤¿ºÝ¤Ë¡¢ »ØÄꤵ¤ì¤¿²Õ½ê¤¬¤â¤È¤â¤ÈÊ£¿ô¹Ô¥³¥á¥ó¥È¤È¥Þ¥Ã¥×½é´ü²½»Ò¤Î²¿¤ì¤Ç¤¢¤Ã¤¿¤«¤¬ ȽÊ̤Ǥ­¤º¡¢Ìµ¾ò·ï¤ËÊ£¿ô¹Ô¥³¥á¥ó¥È¤ÈȽÃǤ¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë (getState ¥á¥½¥Ã¥É¤Ç JAVA_MAP_INITIALIZER ¤ÈÈæ³Ó¤¹¤ëÉôʬ¤òÄɲä·¤¿¤¬¡¢¼Â ºÝ¤Ë¤Ï¤³¤³°ÊÁ°¤Î JAVA_MULTI_LINE_COMMENT ¤ÈÈæ³Ó¤·¤Æ¤¤¤ëÉôʬ¤Ç¥Þ¥Ã¥Á¤·¤Æ ¤·¤Þ¤Ã¤Æ¤¤¤ë)¡£ ½¾¤Ã¤Æ¡¢¥Þ¥Ã¥×½é´ü²½»Ò¤Ç¤¢¤ë¤Ë¤â¤«¤«¤ï¤é¤ºÊ£¿ô¹Ô¥³¥á¥ó¥È¤ÈȽÄꤵ¤ì¤Æ¤·¤Þ ¤¤¡¢ÊÔ½¸Åù¤ò¹Ô¤Ã¤¿ºÝ¤Ë } °Ê¹ß¤âÊ£¿ô¹Ô¥³¥á¥ó¥È¤Î¿§¤Çɽ¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã ¤Æ¤·¤Þ¤¦¤³¤È¤¬¤¢¤ë¡£

  • ¤³¤³¤Ç¤Ï¡¢¥Þ¥Ã¥×½é´ü²½»Ò¤ËÂФ·¤ÆÊ£¿ô¹Ô¥³¥á¥ó¥È¤ÈƱ¤¸ÆâÍƼïÊ̤ò³ä¤êÅö¤Æ¤ë ¤³¤È¤Ç¡¢¥Õ¥©¥ó¥È¤Î¿§ÉÕ¤±¤ò¹Ô¤Ã¤Æ¤¤¤ë¤¬¡¢Àè¤Ë½Ò¤Ù¤¿¤È¤ª¤ê¡¢¥Þ¥Ã¥×½é´ü²½»Ò ¤ÎÃæ¤Ë¤Ï¥³¥á¥ó¥È¤ä JavaDoc ¤Ê¤É¤âÅо줷¤¦¤ë¡£ ¤·¤«¤·¤Ê¤¬¤é¡¢º£²ó¤ÎÊýË¡¤Ç¤Ï¥Þ¥Ã¥×½é´ü²½»ÒÁ´ÂΤò¥³¥á¥ó¥È¤È²ò¼á¤·¤Æ¤·¤Þ¤¦ ¤¿¤á¡¢¥Þ¥Ã¥×½é´ü²½»ÒÃæ¤Ë¸½¤ì¤ë¥³¥á¥ó¥È¤ä JavaDoc ¤ÏŬÀ­¤Ë¤ÏÉÁ²è¤µ¤ì¤Ê¤¯ ¤Ê¤Ã¤Æ¤·¤Þ¤¦¡£

  • º£²ó¤Ï¡¢¥Õ¥©¥ó¥ÈÁõ¾þ¤Î¤ß¤òÂоݤȤ·¤Æ¤¤¤ë¤¬¡¢Êѹ¹¤ò¹Ô¤Ã¤¿Éôʬ¤Ï¥Ñ¡¼¥Æ¥£¥·¥ç ¥ó¤ò¥¹¥­¥ã¥ó¤¹¤ëÉôʬ¤Ç¤¢¤ê¡¢¤³¤³¤Ø¤ÎÊѹ¹¤Ï¥Õ¥©¥ó¥ÈÁõ¾þ°Ê³°¤Î JFace ¤¬ Ä󶡤¹¤ëµ¡Ç½ (¥Ý¥Ã¥×¥¢¥Ã¥×¾ðÊóɽ¼¨¤ä¥³¡¼¥ÉÊä´°) ¤Ê¤É¤Ë¤âŬÍѤµ¤ì¤ë¡£ ¤Ä¤Þ¤ê¡¢¤³¤ÎÊѹ¹¤Ë¤è¤ê¥Ý¥Ã¥×¥¢¥Ã¥×ɽ¼¨¤Ê¤É¤ÎÆ°ºî¤âÄ̾ï¤Î Java ¥×¥í¥°¥é¥à Éôʬ¤Ç¤Ï¤Ê¤¯¥³¥á¥ó¥ÈÉôʬ¤ËÂФ¹¤ëÆ°ºî¤¬Å¬ÍѤµ¤ì¤Æ¤·¤Þ¤¦¡£

  • ¤³¤Î¼ÂÁõ¤Ç¤Ï¡¢¼ê´ÖÅù¤Î·ó¤Í¹ç¤¤¤«¤é¿·¤¿¤ÊÆâÍƼïÊ̤ò²Ã¤¨¤ë¤³¤È¤ò¤»¤º¡¢ ¤¤¤ï¤Ð´û¸¤Îµ¡Ç½¤ò´Ö¼Ú¤ê¤·¤¿¾õÂ֤ǤμÂÁõ¤È¤Ê¤Ã¤Æ¤¤¤ë¡£ ¤·¤«¤·¤Ê¤¬¤é¡¢pxml ¤Ê¤ÉËܳÊŪ¤Ë¿·¤¿¤ÊÆâÍƼïÊ̤òƳÆþ¤¹¤ë¾ì¹ç¡¢ º£²óÊÔ½¸¤·¤¿¥¯¥é¥¹¤Î¤Û¤«¤Ë¡¢¼ÂºÝ¤ÎÆ°ºî¤òÄêµÁ¤¹¤ë½ô¥¯¥é¥¹¤ò­¤¹ÍÑ°Õ¤¹¤ëɬ Íפ¬¤¢¤ë¡£ IJavaPartitions ¤ËÆâÍƼïÊ̤ò²Ã¤¨¤ë¤³¤È¤«¤é¤Ï¤¸¤Þ¤ê¡¢ ¿·¤¿¤ËÄɲä·¤¿ÆâÍƼïÊ̤ËÂбþ¤¹¤ë IPresentationDamagerRepairer, IInformationProvider, IFormattingStrategy Åù¡¢Âô»³¤Î¥¯¥é¥¹¤òºîÀ®¤â¤·¤¯¤Ï ½¤Àµ¤¹¤ëɬÍפ¬¤¢¤ë¡£


Java¥×¥í¥°¥é¥à¤òMixJuice¤Ë°Ü¿¢¤¹¤ë

Â絬ÌϤÊJava¥×¥í¥°¥é¥à¤òMixJuice¤Ë°Ü¿¢¤¹¤ë¤Î¤ËÈ÷¤¨¡¢°Ü¿¢¤ËɬÍ×¤Ê ºî¶È¤òÄ´ºº¤·¤¿¡£ËܾϤǤϤ½¤ÎÄ´ºº·ë²Ì¤ä¤½¤³¤ÇÆÀ¤é¤ì¤¿¥Î¥¦¥Ï¥¦¤ò½Ò¤Ù¤ë¡£


Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à

°Ê²¼¤Î4¤Ä¤ÎJava¥×¥í¥°¥é¥à¤òMixJuice¤Ë°Ü¿¢¤¹¤ëºî¶È¤òÄ̤¸¤Æ¡¢°Ü¿¢¤ËɬÍפʺî¶È¤òÀö¤¤½Ð¤¹¤³¤È¤È¤¹¤ë¡£

例 1. src/IJavaTest.java

package src;

import java.io.IOException;

public interface IJavaTest {
	final static int MIN = 0;
	final static int MAX = 100;
	final static int MID = (MAX + MIN) / 2;                       // (1)
	void doIO() throws IOException;
	IJavaTest intern();
	boolean equals(Object o);                                     // (2)
}
(1)
¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É¤Î½é´ü²½¤Ë¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É¤ò»ÈÍÑ¡£
(2)
Object¥¯¥é¥¹¤Ç¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¥á¥½¥Ã¥É¤òÄêµÁ¡£

例 2. src/IJavaTest2.java

package src;

public interface IJavaTest2 extends IJavaTest {
	void foo();                                                   // (1)
}
(1)
¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Ë¥á¥½¥Ã¥É¤òÄɲá£

例 3. src/Other.java

package src;

public class Other {
	public String toString() {
		return this.getClass().getName();
	}
}

例 4. src/JavaTest.java

package src;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

import other.Other;

public class JavaTest implements IJavaTest2, Serializable {           // (1)
	protected static int i = 0;                                   // (2)
	private static final Other other = new Other();               // (3)
	private int x;
	protected transient int xx;

	public static class IOException extends java.io.IOException { // (4)
		int errorI = i;                                       // (5)
		public String toString() {
			return super.toString() + "errorI: " + errorI;
		}
	}
	public static int getMax() {                                  // (6)
		return MAX;
	}
	protected JavaTest() throws InternalError {                   // (7)
		x = i++;
		xx = x * x;
		if (x % 2 == 0)
			throw new InternalError();
	}
	public static JavaTest getInstance()                          // (8)
		throws
			InstantiationException,
			IllegalAccessException {
		return (JavaTest) JavaTestSub.class.newInstance();    // (9)
	}
	public void finalize() throws Throwable {                     // (10)
		super.finalize();
		System.out.println("fin: " + x);
	}
	public IJavaTest intern() {
		return this;
	}
	public void doIO() throws IOException {                       // (11)
		throw new IOException();
	}
	public void foo() {
	}
	private void writeObject(ObjectOutputStream s) throws java.io.IOException { // (12)
		s.defaultWriteObject();
	}
	private void readObject(ObjectInputStream s)                  // (13)
		throws java.io.IOException, ClassNotFoundException {
		s.defaultReadObject();
		xx = x * x;
	}
	public String toString() {
		return "x: " + x + ", xx: " + xx;
	}
	public static void main(String[] args) {
		try {
			test1(test0());
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
		System.out.println(other);
	}
	public static JavaTest test0() {
		JavaTest last = null;
		for (int i = 0; i < MID; i++) {
			try {
				IJavaTest j = getInstance().intern();
				((IJavaTest2) j).foo();
				JavaTest jt = (JavaTest) j;
				jt.getMax();                          // (14)
				last = jt;
			} catch (InternalError e) {
			} catch (InstantiationException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
		}
		try {
			last.doIO();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.gc();
		return last;
	}
	private static void test1(JavaTest corg) throws Exception {
		final String file = "c:/removeMe.tmp";
		try {
			FileOutputStream fo = new FileOutputStream(file);
			ObjectOutputStream so = new ObjectOutputStream(fo);
			so.writeObject(corg);
			so.flush();
			so.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
		System.out.println("original: " + corg);

		JavaTest cnew;
		try {
			FileInputStream fi = new FileInputStream(file);
			ObjectInputStream si = new ObjectInputStream(fi);
			cnew = (JavaTest) si.readObject();
			si.close();
			System.out.println("new: " + cnew);
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}

class JavaTestSub extends JavaTest {
	private int x;                                                // (15)
	JavaTestSub() {
		x = xx / 2;
	}
	public String toString() {
		return super.toString() + ", sub.x: " + x;
	}
}
(1)
¥·¥ê¥¢¥é¥¤¥º²Äǽ¤Ê¥¯¥é¥¹¡£
(2)
¥¹¥¿¥Æ¥£¥Ã¥¯¤Ê¥Õ¥£¡¼¥ë¥É¤òÄêµÁ¡£
(3)
(¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ç¤Ï¤Ê¤¯)¼ÂÁõ¤ËɬÍפʾ¤Î¥Ñ¥Ã¥±¡¼¥¸¤Î¥¯¥é¥¹¤ò»²¾È¡£
(4)
ÆâÉô¥¯¥é¥¹¤òÄêµÁ¡£
(5)
³°Éô¥¯¥é¥¹¤Îprotected¤Ê¥Õ¥£¡¼¥ë¥É¤ò»²¾È¡£
(6)
¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤òÄêµÁ¡£
(7)
¥³¥ó¥¹¥È¥é¥¯¥È¤Ë¼ºÇÔ¤¹¤ë¤«¤â¤·¤ì¤Ê¤¤¥³¥ó¥¹¥È¥é¥¯¥¿¡£
(8)
¥Õ¥¡¥¯¥È¥ê¥á¥½¥Ã¥É¡£
(9)
¥¯¥é¥¹Ì¾.class¤È¤¤¤¦¹½Ê¸¤ò»ÈÍÑ¡£Class.newInstance()¥á¥½¥Ã¥É¤Ç¥¤¥ó¥¹¥¿¥ó¥¹À¸À®¡£
(10)
¥Õ¥¡¥¤¥Ê¥é¥¤¥¶¤ÎÄêµÁ¡£
(11)
src.IOException¤ò¥¹¥í¡¼¡£
(12)(13)
¥·¥ê¥¢¥é¥¤¥º/¥Ç¥·¥ê¥¢¥é¥¤¥º¤ÎÆ°ºî³Îǧ¡£
(14)
¥¤¥ó¥¹¥¿¥ó¥¹¤ò»ÈÍѤ·¤Æ¥¹¥¿¥Æ¥£¥Ã¥¯¤ò¸Æ¤Ó½Ð¤¹¡£
(15)
¥¹¡¼¥Ñ¡¼¥¯¥é¥¹¤ÈƱ¤¸¥Õ¥£¡¼¥ë¥É̾¤ò»ÈÍÑ¡£

例 5. other/Other.java

package other;

public class Other {                                                  // (1)
	public String toString() {
		return this.getClass().getName();
	}
}
(1)
Ê̥ѥ屡¼¥¸¤Ë例3¤ÈƱ̾¥¯¥é¥¹¤òÄêµÁ¡£


°Ü¿¢ºî¶È

¤³¤³¤Ç¤Ï¡¢¼ÂºÝ¤ËJava¤Î¥½¡¼¥¹¥³¡¼¥É¤òMixJuice¤Ë°Ü¿¢¤¹¤ë¤Î¤ËɬÍפʺî¶È¤òÎóµó¤¹¤ë¡£


define¤ò¤Ä¤±¤ë

MixJuice¤Ë°Ü¿¢¤¹¤ëºÝ¡¢¥¯¥é¥¹¡¢¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¡¢¥á¥½¥Ã¥É¤ËŬµ¹define¤òÉÕÍ¿¤¹¤ë¡£¥¹¡¼¥Ñ¡¼¥¯¥é¥¹¤Î¥á¥½¥Ã¥É¤ò¥ª¡¼¥Ð¥é¥¤¥É¤¹¤ëºÝ¤Ï¡¢define¤ÏÉÔÍפǤ¢¤ë¡£


¥á¥ó¥Ð̾¤òFQN¤Ç¤Ï¤Ê¤¯¥·¥ó¥×¥ë¥Í¡¼¥à¤Ç½ÐÎϤµ¤»¤ë

MixJuice¤Ç¤Ï¡¢¥¯¥é¥¹¤Î¥á¥ó¥Ð̾¤¬¥â¥¸¥å¡¼¥ë´Ö¤Ç½ÅÊ£¤·¤Ê¤¤¤è¤¦¤Ë¡¢FQN¤Î¡Ö.¡×¤ò¡Ö_¡×¤òÃÖ¤­´¹¤¨¤¿Java¼±Ê̻ҤËÊÑ´¹¤µ¤ì¤ë(Îã:mod¥â¥¸¥å¡¼¥ë¤ÇÄêµÁ¤µ¤ì¤¿m¤È¤¤¤¦¥á¥ó¥Ð¤Ç¤¢¤ì¤Ð¡¢mod_m)¡£¤·¤«¤·¡¢MixJuice¤Ç½ñ¤«¤ì¤¿¥³¡¼¥É¤òJava¤«¤é»²¾È¤¹¤ë¤³¤È¤ò¹Íθ¤¹¤ë¤È¡¢¥¯¥é¥¹¤Î¥á¥ó¥Ð̾¤¬Java¤«¤é¸«¤Æñ½ã̾(¥â¥¸¥å¡¼¥ë̾¤Î¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤¬ÉÕ¤«¤Ê¤¤¤â¤Î)¤Ç»²¾È¤Ç¤­¤¿¤Û¤¦¤¬¤è¤¤¡£mjc¤Ë¡Ö-J-Dmjc.noFQN=1¡×¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤ë¤³¤È¤Ë¤è¤ê¡¢Ã±½ã̾¤Ç¥á¥ó¥Ð̾¤ò»²¾È¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤ë¡£

¤¿¤À¤·¡¢¾åµ­¤Î¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤ë¤È¡¢¥â¥¸¥å¡¼¥ë¤òÊ£¿ôÁȤ߹ç¤ï¤»¤ëºÝ¡¢¥á¥ó¥Ð̾¤¬¾×Æͤ¹¤ë²ÄǽÀ­¤¬¤¢¤ë¤Î¤ÇÃí°Õ¤¬É¬ÍפǤ¢¤ë¡£

¤Þ¤¿MixJuice¤Î¥¨¥ó¥È¥ê¡¼¥Ý¥¤¥ó¥È¤òÄ󶡤¹¤ëmj.lang.ss.SS¥¯¥é¥¹¤Îinstance¥Õ¥£¡¼¥ë¥É¤Ï¡¢¾åµ­¤Î¥ª¥×¥·¥ç¥ó¤ò¤Ä¤±¤º¤Ë¥³¥ó¥Ñ¥¤¥ë¤·¤¿¤â¤Î¤¬jar¥Õ¥¡¥¤¥ë¤Ë¼ý¤á¤é¤ì¤Æ¤¤¤ë¤¿¤á¡¢¾åµ­¤Î¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤Æ¥³¥ó¥Ñ¥¤¥ë¤·¤¿¥×¥í¥°¥é¥à¤«¤é¤ÏÄ̾ï¤ÎÊýË¡¤Ç¤Ï»²¾È¤Ç¤­¤Ê¤¤¡£例6¤Î¤è¤¦¤Ë¥ê¥Õ¥ì¥¯¥·¥ç¥ó¤òÍøÍѤ·¤Æ»²¾È¤¹¤ë¡£

ティップmj.lang.ss.SS.instance½é´ü²½¤Î¥¿¥¤¥ß¥ó¥°
 

mj.lang.ss.SS.instance¤Ï¥¹¥¿¥Æ¥£¥Ã¥¯½é´ü²½»Ò¤Ç½é´ü²½¤µ¤ì¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢public void main(String[])¤Î¼Â¹Ô¤¬»Ï¤Þ¤Ã¤Æ¤«¤é½é´ü²½¤µ¤ì¤ë¡£¤·¤¿¤¬¤Ã¤Æ¡¢例6¤ÎSS.init()¥á¥½¥Ã¥É¤ò¥¹¥¿¥Æ¥£¥Ã¥¯½é´ü²½»Ò¤«¤é¸Æ¤Ó½Ð¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£

例 6. mj.lang.ss.SS.instance¤Î»²¾ÈÊýË¡

module mod {
	class SS {
		static SS singleton;
		define void init() {
			try {
				java.lang.reflect.Field f = Class.forName("mj.lang.ss._Delta_mj_lang_ss_SS").getDeclaredField("mj_lang_ss_instance");
				Object o = f.get(null);
				singleton = (SS)o;
			} catch (SecurityException e) {
				e.printStackTrace();
				assert false;
			} catch (NoSuchFieldException e) {
				e.printStackTrace();
				assert false;
			} catch (IllegalArgumentException e) {
				e.printStackTrace();
				assert false;
			} catch (IllegalAccessException e) {
				e.printStackTrace();
				assert false;
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
				assert false;
			}
		}
		void main(String[] args) {
			init();                                       // (1)
			System.out.println(singleton);                // (2)
		}
	}
}
(1)
singleton¤ò¡¢mj.lang.ss.SS.instance¤ò»²¾È¤¹¤ë¤è¤¦¤Ë½é´ü²½¤¹¤ë¡£
(2)
singleton¥Õ¥£¡¼¥ë¥É¤Ëmj.lang.ss.SS.instance¥¤¥ó¥¹¥¿¥ó¥¹¤Ø¤Î»²¾È¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢singleton¤ò»ÈÍѤ·¤Æ¥¢¥¯¥»¥¹¤¹¤ë¡£

¥Ñ¥Ã¥±¡¼¥¸¤ò¥â¥¸¥å¡¼¥ë¤Ø

MixJuice¤Î¥â¥¸¥å¡¼¥ë¤ÏJava¤Î¥Ñ¥Ã¥±¡¼¥¸¤ËÊÑ´¹¤µ¤ì¤ë¤Î¤Ç¡¢Java¤Î¥³¡¼¥É¤òMixJuice¤Ë°Ü¿¢¤¹¤ëºÝ¡¢¥Ñ¥Ã¥±¡¼¥¸Ì¾¤ÈƱ̾¤Î¥â¥¸¥å¡¼¥ë¤òÍÑ°Õ¤·¡¢¤½¤Î¥â¥¸¥å¡¼¥ë¤ÎÃæ¤Ë¥¯¥é¥¹¤ä¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤òÆþ¤ì¤ë¡£Java¤Îpackageʸ¤Ï½üµî¤¹¤ë¡£¤½¤ÎºÝ¡¢Ê£¿ô¤ÎJava¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò°ì¤Ä¤ÎMixJuice¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Ë¤Þ¤È¤á¤ëɬÍפ¬¤¢¤ë¡£


importʸ¤ò½üµî

MixJuice¤Ç¤Ïimportʸ¤¬Â¸ºß¤·¤Ê¤¤¤¿¤á¡¢Java¤Î¥½¡¼¥¹¤òMixJuice¤Î¥½¡¼¥¹¤Ë°Ü¿¢¤¹¤ëºÝ¡¢importʸ¤ò½üµî¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤·¤«¤·¡¢MixJuice¤Î¾¤Î¥â¥¸¥å¡¼¥ë¤Ç½ñ¤«¤ì¤¿¥¯¥é¥¹Åù¤ò»²¾È¤¹¤ë¤Ë¤Ï¡¢É¬¤ºimports/uses¤ò»ÈÍѤ·¤Æ¥¤¥ó¥Ý¡¼¥È¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤(Java¤Î¤è¤¦¤ËFQN¤Ç»²¾È¤Ç¤­¤Ê¤¤(Java¤Î¥¯¥é¥¹¤Ïimports/uses¤·¤Ê¤¯¤Æ¤âFQN¤Ç»²¾È¤Ç¤­¤ë))¡£

ティップMixJuice¤Ç¤Ï̾Á°¤Î¾×Æͤ¬µ¯¤­¤ä¤¹¤¤
 

MixJuice¤Ç¤Ï¡¢¥¤¥ó¥Ý¡¼¥È¤·¤¿Ì¾Á°¤Ï¡¢¥¤¥ó¥Ý¡¼¥È¤·¤¿¥â¥¸¥å¡¼¥ë¤Î¥µ¥Ö¥â¥¸¥å¡¼¥ë¤Ç¤â¼«Æ°Åª¤Ë¥¤¥ó¥Ý¡¼¥È¤µ¤ì¤ë¤¿¤á¡¢Ì¾Á°¤Î¾×Æͤ¬µ¯¤­¤ä¤¹¤¤¡£Î㤨¤Ð¡¢¥â¥¸¥å¡¼¥ëM1¤¬¼ÂÁõ¤Î¤¿¤á¤Ë(¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ë¤Ï»ÈÍѤ·¤Ê¤¤)¥â¥¸¥å¡¼¥ëMX¤ò¥¤¥ó¥Ý¡¼¥È¤·¤¿¤È¤¹¤ë¡£M1¤Î¥µ¥Ö¥â¥¸¥å¡¼¥ëM2¤Ç¡¢MXÆâ¤ÇÄêµÁ¤µ¤ì¤¿¥¯¥é¥¹¤Ê¤É¤ÈƱ¤¸Ì¾Á°¤ÎÊÌ¥¯¥é¥¹¤Ê¤É¤ò¡¢Ã±½ã̾¤Ç»²¾È¤Ç¤­¤Ê¤¯¤Ê¤ë(FQN¤ò»È¤¨¤Ð¤è¤¤)¡£

Java¤Î¥¯¥é¥¹Åù¤Ï¥¤¥ó¥Ý¡¼¥È¤Ê¤·¤Ç¤âFQN¤Ç»²¾È¤Ç¤­¤ë¤Î¤Ç¡¢¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ë¸½¤ì¤Ê¤¤(¼ÂÁõ¤Ë»ÈÍѤ¹¤ë)Java¤Î¥¯¥é¥¹Åù¤Ï¡¢¥¤¥ó¥Ý¡¼¥È¤·¤Ê¤¤Êý¤¬¤è¤¤¡£Eclipse¤ò»ÈÍѤ¹¤ë¾ì¹ç¡¢¥¤¥ó¥Ý¡¼¥È¤·¤Æñ½ã̾¤Ç¥³¡¼¥Ç¥£¥ó¥°¤¹¤ë¤Î¤¬ÉáÄ̤ʤΤǡ¢¤½¤Î¾ì¹ç¡¢Â¿¤¯¤Îñ½ã̾¤òFQN¤Ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£


¥Ç¥Õ¥©¥ë¥È¤Î¥³¥ó¥¹¥È¥é¥¯¥¿¤òÄɲÃ

MixJuice¤Ç¤Ï¥Ç¥Õ¥©¥ë¥È¤Î¥³¥ó¥¹¥È¥é¥¯¥¿¤ò¼«Æ°À¸À®¤·¤Ê¤¤¤Î¤Ç¡¢Java¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥³¥ó¥¹¥È¥é¥¯¥¿¼«Æ°À¸À®¤Ë°Í¸¤·¤¿¥³¡¼¥É¤¬¤¢¤ë¾ì¹ç¤Ï¡¢ÌÀ¼¨Åª¤Ë¥Ç¥Õ¥©¥ë¥È¥³¥ó¥¹¥È¥é¥¯¥¿¤òµ­½Ò¤¹¤ë¡£


¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤ò¥¤¥ó¥¹¥¿¥ó¥¹¥á¥½¥Ã¥É¤Ø

MixJuice¤Ç¤Ï¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤òÄêµÁ¤Ç¤­¤Ê¤¤¡£¥¤¥ó¥¹¥¿¥ó¥¹¥á¥½¥Ã¥É¤È¤·¤Æ¼ÂÁõ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤Ä¤Þ¤ê¡¢¸Æ¤Ó½Ð¤·¤Ë¤Ï¥¤¥ó¥¹¥¿¥ó¥¹¤¬É¬¿Ü¤È¤Ê¤ë¡£¤½¤³¤Ç¡¢例7¤Î¤è¤¦¤ËÊä½õ¥¯¥é¥¹(StaticHolder)¤ò»ÈÍѤ·¡¢Í£°ì¤Î¥¤¥ó¥¹¥¿¥ó¥¹(StaticHolder.instance)¤ò¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É¤ä¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¤È¤·¤Æ»ÈÍѤ¹¤ë¡£

¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·Éôʬ¤Ï¡¢ClassName.staticMethod()¤È¤¤¤¦¹½Ê¸¤À¤±¤Ç¤Ï¤Ê¤¯¡¢instance.staticMethod()¤È¤¤¤¦¹½Ê¸¤Çstatic¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤ëÉôʬ¤â˺¤ì¤º¤ËÊѹ¹¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£

MixJuice¤Ç¤Ï¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤òÄêµÁ¤Ç¤­¤Ê¤¤¤Î¤Ç¡¢¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤ò¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤È¤·¤ÆÄ󶡤¹¤ëJava¥Ñ¥Ã¥±¡¼¥¸¤ò¡¢¤½¤Î¥Ñ¥Ã¥±¡¼¥¸¤ò»²¾È¤·¤Æ¤¤¤ëJava¥³¡¼¥É¤ÎÊѹ¹¤Ê¤·¤Ç¡¢MixJuice²½¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£

例 7. ¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤Î°Ü¿¢Îã

module mod {
	define class StaticHolder {                                   // (1)
		int staticData = 1;

		define StaticHolder() {}
		define synchronized int get() {
			return staticData;
		}
		define synchronized void incr() {
			staticData += NonStatic.DELTA;                // (2)
		}
	}
	define class NonStatic {
		static final int DELTA = 1;
		static final StaticHolder staticHolder = new StaticHolder();
		define NonStatic() {}
		define int foo() {
			return staticHolder.get() * 10;               // (3)
		}
	}
	class SS {

		void main(String[] args) {
			System.out.println(new NonStatic().foo());
			NonStatic.staticHolder.incr();
			System.out.println(new NonStatic().foo());
		}
	}
}
(1)
Í£°ì¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ç¡¢¥·¥ê¥¢¥é¥¤¥¶¥Ö¥ë¤Ê¤É¤Ë¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¸å½Ò¤ÎÍýͳ¤Ç¡¢private Object readResolve(Object)¤òÄêµÁ¤Ç¤­¤Ê¤¤¤Î¤Ç¡¢¥·¥ê¥¢¥é¥¤¥¶¥Ö¥ë¤Ê¤É¤Ë¤¹¤ë¤ÈÍ£°ìÀ­¤òÊݾڤǤ­¤Ê¤¤¡£
(2)
̾Á°¶õ´Ö¤¬ÊѤï¤ë¤Î¤Ç¡¢NonStatic¥¯¥é¥¹Ì¾¤Ç½¤¾þ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
(3)
¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É¤ä¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£

ティップ¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É/¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¤ÏÈ󥷥ꥢ¥é¥¤¥¶¥Ö¥ë¤Ë
 

¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É/¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¤Ï¡¢Í£°ì¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ç¡¢¥·¥ê¥¢¥é¥¤¥¶¥Ö¥ë¤Ê¤É¤Ë¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¸å½Ò¤ÎÍýͳ¤Ç¡¢private Object readResolve(Object)¤òÄêµÁ¤Ç¤­¤Ê¤¤¤Î¤Ç¡¢¥·¥ê¥¢¥é¥¤¥¶¥Ö¥ë¤Ê¤É¤Ë¤¹¤ë¤ÈÍ£°ìÀ­¤òÊݾڤǤ­¤Ê¤¤¡£Æɤ߹þ¤ó¤ÀºÝ¤Ë¡¢¤â¤¦°ì¤Ä¥¤¥ó¥¹¥¿¥ó¥¹¤¬¤Ç¤­¤Æ¤·¤Þ¤¦¡£

ティップ¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É/¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¤ÏÇÓ¾¤Îñ°Ì¤Ë¤â¤Ê¤ë
 

MixJuice¤Ç¤Ï¤¹¤Ù¤Æ¤Î¥á¥½¥Ã¥É¤¬public¤Ç»²¾È´Ø·¸¤ÎÀ©Ìó¤¬Ìµ¤¤¤¿¤á¡¢¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É/¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¤Ï²¿¸Ä¤Ëʬ³ä¤·¤Æ¤â¤¤¤¤¤·¡¢Á´Éô°ì¤Ä¤Ë¤Þ¤È¤á¤Æ¤â¤¤¤¤¡£¤·¤«¤·¡¢synchronized¤Ê¥¹¥¿¥Æ¥£¥Ã¥¯¥á¥½¥Ã¥É¤¬¤¢¤Ã¤¿¾ì¹ç¡¢¥³¥ó¥Æ¥Ê¤ÏÇÓ¾À©¸æ¤Îñ°Ì¤Ë¤â¤Ê¤ë¤Î¤Ç¡¢Å¬ÀÚ¤ÊγÅ٤ǥ³¥ó¥Æ¥Ê¤òÍÑ°Õ¤¹¤Ù¤­¤Ç¤¢¤ë¡£¤â¤Á¤í¤ó¡¢²ÄÆÉÀ­¤â½ÅÍפǤ¢¤ë¡£

ティップ¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É/¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¤Ï¥¹¥¿¥Æ¥£¥Ã¥¯¤Ë½é´ü²½
 

Java¤Î¥³¡¼¥É¤ÈƱ¤¸Æ°ºî¤Ë¤¹¤ë¤Ë¤Ï¡¢¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É/¥á¥½¥Ã¥É¤Î¥³¥ó¥Æ¥Ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò¥¹¥¿¥Æ¥£¥Ã¥¯¤Ë½é´ü²½¤·¤¿Êý¤¬¤è¤¤¡£¤½¤Î¤¿¤áÎã³°¤¬È¯À¸¤·¤Ê¤¤¥³¥ó¥¹¥È¥é¥¯¥¿¤òÍÑ°Õ¤¹¤ë¤«¡¢¥¹¥¿¥Æ¥£¥Ã¥¯½é´ü²½»Ò¤Ç½é´ü²½(Îã³°¤òcatch¤¹¤ë)¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¥³¥ó¥Æ¥Ê¥¤¥ó¥¹¥¿¥ó¥¹¤ò»²¾È¤¹¤ë¤¿¤á¤Î¥¹¥¿¥Æ¥£¥Ã¥¯¥Õ¥£¡¼¥ë¥É¤Ïfinal¤Ë¤¹¤ë¡£mj.lang.ss.SS.instance¤Ï½é´ü²½¤Î¥¿¥¤¥ß¥ó¥°¤¬ÃÙ¤¹¤®¤ë¤Î¤Ç¡¢°ìÈÌŪ¤Ë¤Ï»È¤ï¤Ê¤¤Êý¤¬¤è¤¤¡£


¥ê¥Õ¥ì¥¯¥·¥ç¥ó¤ò»ÈÍѤ·¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤òºî¤ëºÝ¡¢¥³¥ó¥¹¥È¥é¥¯¥¿¸Æ¤Ó½Ð¤·¤òÄɲ乤ë

MixJuice¤Çµ­½Ò¤·¤¿¥³¥ó¥¹¥È¥é¥¯¥¿¤Ï¡¢Java¤ËÊÑ´¹¤µ¤ì¤¿ºÝ¥¤¥ó¥¹¥¿¥ó¥¹¥á¥½¥Ã¥É¤ËÊÑ´¹¤µ¤ì¤ë¡£¤½¤Î¤¿¤á¡¢¥ê¥Õ¥ì¥¯¥·¥ç¥ó¤ò»ÈÍѤ·¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤òºî¤ë¤è¤¦¤ÊJava¥³¡¼¥É¤òMixJuice¤Ë°Ü¿¢¤¹¤ëºÝ¡¢¥¤¥ó¥¹¥¿¥ó¥¹À¸À®¸åÌÀ¼¨Åª¤ËMixJuice¤Î¥³¥ó¥¹¥È¥é¥¯¥¿¤ò¸Æ¤Ó½Ð¤¹É¬Íפ¬¤¢¤ë¡£MixJuice¤Î¥³¥ó¥¹¥È¥é¥¯¥¿Ì¾¤Ï¡¢¥¯¥é¥¹Ì¾¤ÎÁ°¤Ë¡Ö_init_¡×¤È¤¤¤¦¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤ò¤Ä¤±¤¿Ì¾Á°¤ÎJava¥¤¥ó¥¹¥¿¥ó¥¹¥á¥½¥Ã¥É¤Ë¤Ê¤ë¡£


ÆâÉô¥¯¥é¥¹¤Î³°Éô²½

MixJuice¤Ç¤ÏÆâÉô¥¯¥é¥¹¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢ÆâÉô¥¯¥é¥¹¤ò³°Éô¤Ë½Ð¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤½¤ì¤Ëȼ¤¤¡¢ÆâÉô¥¯¥é¥¹¤È¤½¤ì¤ò´Þ¤ó¤Ç¤¤¤¿¥¯¥é¥¹´Ö¤Î̾Á°¶õ´Ö¤Î´Ø·¸¤¬¤Ê¤¯¤Ê¤ë¤Î¤Ç¡¢³°Éô²½¤µ¤ì¤¿ÆâÉô¥¯¥é¥¹Æâ¤Î¡¢³°Éô(outer)¥¯¥é¥¹¤Ë°Í¸¤·¤¿»²¾È¤òÊѹ¹¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£

ティップ¿Æ¥¯¥é¥¹¤Îprotected¤Ê¥á¥ó¥Ð¤Î»²¾È
 

MixJuice¤ÇÄêµÁ¤¹¤ë¥¯¥é¥¹M¤Î¿Æ¥¯¥é¥¹J¤¬Java¤Ç¼ÂÁõ¤µ¤ì¤Æ¤ª¤ê¡¢J¤¬protected¤Ê¥á¥ó¥ÐPM¤ò»ý¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢M¤ÎÆâÉô¥¯¥é¥¹I¤«¤é¤ÏPM¤ò»²¾È¤Ç¤­¤ë¡£¤·¤«¤·¡¢MixJuice¤Ç¤ÏÆâÉô¥¯¥é¥¹¤ò»ÈÍѤǤ­¤Ê¤¤¤Î¤Ç¡¢I¤ò³°Éô²½¤¹¤ë¤ÈPM¤ò»²¾È¤Ç¤­¤Ê¤¯¤Ê¤ë¡£¼ÂºÝ¤Ë¤Ï¡¢MixJuice¥³¡¼¥É¤Î¥³¥ó¥Ñ¥¤¥ë»þ¤Ë¡¢Java¥³¥ó¥Ñ¥¤¥é¤¬¥¨¥é¡¼¤ò½ÐÎϤ¹¤ë¡£例8¤È例9¤ÎJava¥³¡¼¥É¤ÎÆâ¡¢例9¤À¤±MixJuice²½¤¹¤ë¤È例10¤Î¤è¤¦¤Ë¤Ê¤ë¡£

例 8. MixJuice¤Ë°Ü¿¢¤¹¤ëJava¥³¡¼¥É¤¬»²¾È¤¹¤ëMixJuice²½¤·¤Ê¤¤Java¥Ñ¥Ã¥±¡¼¥¸

package javaImpl;

public class InnerTest {
	public final int ZERO = 0;
	protected int i = ZERO;                                       // (1)
	protected void close() {                                      // (2)
	}
}
(1)(2)
protected¤Ê¥á¥ó¥Ð

例 9. MixJuice¤Ë°Ü¿¢¤¹¤ëJava¥³¡¼¥É

package src;

import javaImpl.InnerTest;

public class Outer extends InnerTest {
	public static final int PI = 3;
	public class Closer {
		public void doClose() {
			if (i == ZERO)                                // (1)
				System.out.println(ZERO + PI);
			close(); // invoke Outer.close()              // (2)
		}
		protected void finalize() throws Throwable {
			super.finalize();
			doClose();
		}
	}
	public Closer getCloser() {
		return new Closer();
	}
	public static void main(String[] args) {
		Outer.Closer c = new Outer().getCloser();
		c.doClose();
	}
}
(1)(2)
Java¤Ç¼ÂÁõ¤µ¤ì¤¿¥á¥ó¥Ð¤ò»²¾È¡£

例 10. MixJuice¤Ë°Ü¿¢¤·¤¿¥³¡¼¥É

module src {
	class SS {
		public void main(String[] args) {
			Closer c = new Outer().getCloser();
			c.doClose();
		}
	}
	define public class Outer extends javaImpl.InnerTest {
		public static final int PI = 3;
		define Outer() {}
		define public Closer getCloser() {
			return new Closer(this);
		}
		define int getI() {                                   // (1)
			return i;
		}
		define void callClose() {                             // (2)
			close();
		}
	}
	define public class Closer {
		Outer outer;
		define Closer(Outer outerThis) {
			super();
			outer = outerThis;
		}
		define public void doClose() {
			if (outer.getI() == outer.ZERO)
				System.out.println(outer.ZERO + outer.PI);
			outer.callClose();
		}
		protected void FQN[java::finalize]() throws Throwable {
			original();
			doClose();
		}
	}

}
(1)(2)
¥¹¡¼¥Ñ¡¼¥¯¥é¥¹¤Îprotected¤Ê¥á¥ó¥Ð¤ò¡¢³°Éô²½¤·¤¿¸µÆâÉô¥¯¥é¥¹¤«¤é»²¾È¤Ç¤­¤ë¤è¤¦¤Ë¥á¥½¥Ã¥É¤òÄɲá£

super¤òoriginal¤ËÊѹ¹¤¹¤ë

¿Æ¥¯¥é¥¹¤Î¥á¥½¥Ã¥É¤ò»²¾È¤¹¤ë¤Î¤Ë»ÈÍѤ·¤Æ¤¤¤ëJava¤Î¡Ösuper.¥á¥½¥Ã¥É̾(°ú¿ô¥ê¥¹¥È)¡×¤ò¡¢¡Öoriginal(°ú¿ô¥ê¥¹¥È)¡×¤Ë½ñ¤­´¹¤¨¤ë¡£

ティップJava¤Ç¼ÂÁõ¤µ¤ì¤¿¿Æ¥¯¥é¥¹¤Î°ú¿ôÉÕ¤­¥³¥ó¥¹¥È¥é¥¯¥¿¤ò¸Æ¤Ù¤Ê¤¤
 

MixJuice¤Ç¤Ï¡¢Java¤Ç¼ÂÁõ¤µ¤ì¤¿¿Æ¥¯¥é¥¹¤Î°ú¿ôÉÕ¤­¥³¥ó¥¹¥È¥é¥¯¥¿¤ò¸Æ¤Ó½Ð¤»¤Ê¤¤¤Î¤Ç¡¢ Java¤Çµ­½Ò¤µ¤ì¤¿例11¡¢例12¤Î¤¦¤Á¡¢例12¤Î¤ßMixJuice¤Ë°Ü¿¢¤¹¤ë¤Î¤ÏÆñ¤·¤¤¡£

例 11. MixJuice¤Ë°Ü¿¢¤¹¤ëJava¥³¡¼¥É¤¬»²¾È¤¹¤ëMixJuice²½¤·¤Ê¤¤Java¥Ñ¥Ã¥±¡¼¥¸

package javaImpl;

public class OriginalTest {
	protected final int ZERO = 0;
	protected int i = ZERO;
	public OriginalTest(int x) {
		i = x;
	}
	public int getI() {
		return i;
	}
}

例 12. MixJuice¤Ë°Ü¿¢¤·¤¿¤¤Java¥³¡¼¥É

package src;

import javaImpl.OriginalTest;

public class SubClass extends OriginalTest {
	protected final float ZERO = 0.0F;
	public SubClass() {
		super(10);                                            // (1)
	}
	public int getI() {
		if (ZERO == super.ZERO)
			return 10;
		else
			return -10;
	}
	public int getOriginalI() {
		return super.getI();                                  // (2)
	}
}
(1)
MixJuice¤Ç¤Ï¡¢¥¹¡¼¥Ñ¡¼¥¯¥é¥¹¤Î°ú¿ôÉÕ¤­¥³¥ó¥¹¥È¥é¥¯¥¿¤ò¸Æ¤Ù¤Ê¤¤¡£
(2)
MixJuice¤Ç¤Ï¡¢¿Æ¥¯¥é¥¹¤ÎÊ̤Υ᥽¥Ã¥É¤ò¸Æ¤Ó½Ð¤»¤Ê¤¤¡£

ティップ¿Æ¥¯¥é¥¹¤ÎÊ̤Υ᥽¥Ã¥É¤ò¸Æ¤Ó½Ð¤»¤Ê¤¤
 

¡Ösuper.¥á¥½¥Ã¥É̾(°ú¿ô¥ê¥¹¥È)¡×¤ò¡Öoriginal(°ú¿ô¥ê¥¹¥È)¡×¤ËÃÖ¤­´¹¤¨¤ë¤È¤¤¤¦¤³¤È¤Ï¡¢¥á¥½¥Ã¥É̾¤ò»ØÄê¤Ç¤­¤Ê¤¤¤³¤È¤ò°ÕÌ£¤·¡¢例12¤Î(2)¤Ë¼¨¤·¤¿¤è¤¦¤Ë¡¢¿Æ¥¯¥é¥¹¤ÎÊ̤Υ᥽¥Ã¥É¤ò¸Æ¤Ó½Ð¤»¤Ê¤¤¡£

ティップƱ̾¥Õ¥£¡¼¥ë¥É¤ò¶èÊ̤Ǥ­¤Ê¤¤
 

Ʊ°ì¥â¥¸¥å¡¼¥ë¤ÇÄêµÁ¤µ¤ì¤¿·Ñ¾µ´Ø·¸¤ò»ý¤ÄÆó¤Ä¤Î¥¯¥é¥¹¤Ç¡¢Æ±Ì¾¤Î¥¤¥ó¥¹¥¿¥ó¥¹¥Õ¥£¡¼¥ë¥É¤¬¤¢¤Ã¤¿¾ì¹ç¡¢¤½¤ì¤é¤Î¥Õ¥£¡¼¥ë¥É¤ò»²¾È¤·Ê¬¤±¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£

例 13. Ʊ̾¥Õ¥£¡¼¥ë¥É¤ò¶èÊ̤Ǥ­¤Ê¤¤

module src {
	class SS {
		public void main(String[] args) {
			System.out.println(new SubClass().foo());
		}
	}
	define class SuperClass {
		int ZERO = 0;
		define SuperClass() {}
	}
	define class SubClass extends SuperClass {
		float ZERO = 1.0F;
		define SubClass() {
		}
		define float foo() {
			return FQN[src::ZERO];                        // (1)
		}
	}
}
(1)
¤É¤Á¤é¤ÎZERO¤âFQN[src::ZERO]¤È¤Ê¤ê¡¢SuperClass.ZERO¤ÈSubClass.ZERO¤ò¡¢¼«Í³¤Ë»²¾È¤·Ê¬¤±¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£

C.class¤òClass.forName("C")¤ØÊѹ¹¤¹¤ë

MixJuice¤Ç¤Ï¡ÖC.class¡×¤È¤¤¤¦¹½Ê¸¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢¡ÖClass.forName("C")¡×¤È¤¤¤¦½ñ¤­Êý¤ËÊѤ¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤½¤ì¤Ëȼ¤¤¡¢¡Öjava.lang.ClassNotFoundException¡×¤ò¥Ï¥ó¥É¥ê¥ó¥°¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¯¤Ê¤ë¡£¥¯¥é¥¹Ì¾¤òÊѹ¹¤·¤¿¤ê¡¢¥ß¥¹¥¿¥¤¥×¤¹¤ë¤³¤È¤â¤¢¤ë¤Î¤Ç¡¢¤³¤ÎÎã³°¤ò̵»ë¤¹¤ë¤Î¤Ï¹¥¤Þ¤·¤¯¤Ê¤¤¡£


interface¤ÇÄêµÁ¤·¤¿¥á¥½¥Ã¥É¤Î¼ÂÁõ

MixJuice¤Îinterface¤ÇÄêµÁ¤·¤¿¥á¥½¥Ã¥É¤Ï¡¢¤½¤ì¤ò¼ÂÁõ¤¹¤ë¥¯¥é¥¹¤Î¥¹¡¼¥Ñ¡¼¥¯¥é¥¹¤ÇƱ°ì¥·¥°¥Í¥Á¥ã¤Î¥á¥½¥Ã¥É¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Æ¤â¡¢ºÆÅÙ¼ÂÁõ¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ Î㤨¤Ð¡¢例1Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Î(2)¤ÎÎã¤Ç¤Ï¡¢equals¥á¥½¥Ã¥É¤ÏObject·¿¤Ç¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢Java¤Ç¤Ï¡¢IJavaTest¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤ò¼ÂÁõ¤¹¤ë¥¯¥é¥¹¤Çequals¥á¥½¥Ã¥É¤ò¼ÂÁõ¤¹¤ëɬÍפϤʤ¤¡£¤·¤«¤·¡¢MixJuice¤Ç¤Ï¼ÂÁõ¤¹¤ëɬÍפ¬¤¢¤ë¡£MixJuice¤ÇinterfaceÄêµÁ»þ¤Ë¡¢¡Öboolean FQN[java::equals](Object o);¡×¤Èµ­½Ò¤Ç¤­¤ì¤Ð¡¢¤³¤ÎÌäÂê¤Ï²óÈò¤Ç¤­¤ë¤«¤â¤·¤ì¤Ê¤¤¡£


°Ü¿¢·ë²Ì

Java¥×¥í¥°¥é¥à¤òMixJuice¤Ë°Ü¿¢¤¹¤ë¤ÎËÁƬ¤Ç¼¨¤·¤¿例1Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¡¢例2Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¡¢例3Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¡¢例4Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¡¢例5Java¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÎJava¥×¥í¥°¥é¥à¤òMixJuice¤Ë°Ü¿¢¤·¤¿·ë²Ì¤ò例14¤Ë¼¨¤¹¡£¤¿¤À¤·¡¢¸å½Ò¤Î¤è¤¦¤Ë°ìÉô°Ü¿¢ÉÔ²Äǽ¤ÊÉôʬ(¥·¥ê¥¢¥é¥¤¥º¤ä¾¥â¥¸¥å¡¼¥ë¤ÈƱ̾¤Î¥¯¥é¥¹ÄêµÁ¤Ê¤É)¤¬¤¢¤ë¤¿¤á¡¢¥ª¥ê¥¸¥Ê¥ë¤ÎJava¥×¥í¥°¥é¥à¤ÈƱ¤¸¿¶¤ëÉñ¤¤¤Ë¤Ï¤Ê¤Ã¤Æ¤¤¤Ê¤¤¡£

例 14. mj-port.java

module other {
define public class Other {
	define Other() {}
	public String toString() {
		return this.getClass().getName();
	}
}
}

module src uses other {
/* °Ü¿¢ÉÔ²Äǽ
define public class FQN[src::Other] {
	define Other() {}
	public String toString() {
		return this.getClass().getName();
	}
}
*/

define public interface IJavaTest {
	final static int MIN = 0;
	final static int MAX = 100;
	final static int MID = (MAX + MIN) / 2;
	define void doIO() throws java.io.IOException;
	define IJavaTest intern();
	define boolean equals(Object o);
}

define public interface IJavaTest2 extends IJavaTest {
	define void foo();
}

define public class IOException extends java.io.IOException {
	int errorI = JavaTest.staticHolder.i;
	define IOException() {}
	public String toString() {
		return original() + "errorI: " + errorI;
	}
}

define class JavaTestStatic {
	int i = 0;
	/* °Ü¿¢ÉÔ²Äǽ
	 * final other.Other other = new other.Other();
	 */

	define JavaTestStatic() {}
	define public static int getMax() {
		return JavaTest.MAX;
	}
	define public JavaTest getInstance()
		throws
			InstantiationException,
			IllegalAccessException {
		JavaTestSub jt = null;
		try {
			jt = (JavaTestSub)Class.forName("src.JavaTestSub").newInstance();
		} catch (ClassNotFoundException e) {
			assert false;
		}
		jt._init_JavaTestSub();
		return jt;
	}
	define public JavaTest test0() {
		JavaTest last = null;
		for (int i = 0; i < JavaTest.MID; i++) {
			try {
				IJavaTest j = getInstance().intern();
				((IJavaTest2) j).foo();
				JavaTest jt = (JavaTest) j;
				getMax();
				last = jt;
			} catch (InternalError e) {
			} catch (InstantiationException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
		}
		try {
			last.doIO();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.gc();
		return last;
	}
	define private void test1(JavaTest corg) throws Exception {
		final String file = "c:/removeMe.tmp";
		try {
			java.io.FileOutputStream fo = new java.io.FileOutputStream(file);
			java.io.ObjectOutputStream so = new java.io.ObjectOutputStream(fo);
			so.writeObject(corg);
			so.flush();
			so.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
		System.out.println("original: " + corg);

		JavaTest cnew;
		try {
			java.io.FileInputStream fi = new java.io.FileInputStream(file);
			java.io.ObjectInputStream si = new java.io.ObjectInputStream(fi);
			cnew = (JavaTest) si.readObject();
			si.close();
			System.out.println("new: " + cnew);
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}

define public class JavaTest implements IJavaTest2, java.io.Serializable {
	static final JavaTestStatic staticHolder = new JavaTestStatic();

	private int x;
	protected transient int xx;

	define protected JavaTest() throws InternalError {
		x = staticHolder.i++;
		xx = x * x;
		if (x % 2 == 0)
			throw new InternalError();
	}
	boolean FQN[src::equals](Object o) {
		return original(o);
	}
	public void finalize() throws Throwable {
		original();
		System.out.println("fin: " + x);
	}
	public IJavaTest intern() {
		return this;
	}
	public void doIO() throws IOException {
		throw new IOException();
	}
	public void foo() {
	}
	define private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
		s.defaultWriteObject();
	}
	define private void readObject(java.io.ObjectInputStream s)
		throws java.io.IOException, ClassNotFoundException {
		s.defaultReadObject();
		xx = x * x;
	}
	public String toString() {
		return "x: " + x + ", xx: " + xx;
	}
}

class SS {
	public void main(String[] args) {
		try {
			JavaTest.staticHolder.test1(JavaTest.staticHolder.test0());
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
		/* °Ü¿¢ÉÔ²Äǽ
		 * System.out.println(JavaTest.staticHolder.other);
		 */
	}
}

define class JavaTestSub extends JavaTest {
	private int sub_x;
	define JavaTestSub() {
		sub_x = xx / 2;
	}
	public String toString() {
		return original() + ", sub.x: " + sub_x;
	}
}

}

°Ü¿¢¾å¤ÎÌäÂêÅÀ

¤³¤³¤Ç¤Ï¡¢Á°½Ò¤·¤¿¤â¤Î°Ê³°¤Ë¡¢Java¤Çµ­½Ò¤µ¤ì¤¿¥³¡¼¥É¤òMixJuice¤Ë°Ü¿¢¤¹¤ëºÝ¡¢ÌäÂê¤È¤Ê¤êÆÀ¤ë»öÊÁ¤ò¤¤¤¯¤Ä¤«ÀâÌÀ¤¹¤ë¡£


¾¥â¥¸¥å¡¼¥ë¤Î»²¾È

Java¤Ç¾¤Î¥Ñ¥Ã¥±¡¼¥¸¤ò»²¾È¤¹¤ë¤³¤È¤Ï¤è¤¯¤¢¤ë¤¬¡¢ MixJuice¤Ç¤Ï¡¢¼¡¤Î¤è¤¦¤Ê¥³¡¼¥É¤Î¤¤¤º¤ì¤â¡¢¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤«¤Ã¤¿¡£

例 15. ¾¥â¥¸¥å¡¼¥ë¤Î»²¾È1

module other {
	define public class Other {
		define Other() {}
		public String toString() {
			return this.getClass().getName();
		}
	}
}

module src uses other {
	define public class Other {                                   // (1)
		define Other() {}
		public String toString() {
			return this.getClass().getName();
		}
	}
	class SS {
		void main(String[] args) {
			System.out.println(JavaTestStatic.other);
		}
	}
	define class JavaTestStatic {
		static final FQN[other::Other] other = new FQN[other::Other]();
	}
}
(1)
MJ: Ambiguous class name "Other" is used at module src

FQN[src::Other]¤ÈÊѹ¹¤·¤Æ¤â¥¨¥é¡¼

例 16. ¾¥â¥¸¥å¡¼¥ë¤Î»²¾È2

module other {
	define public class Other {
		define Other() {}
		public String toString() {
			return this.getClass().getName();
		}
	}
}

module src imports other {
	define public class Other {
		define Other() {}
		public String toString() {
			return this.getClass().getName();
		}
	}
	class SS {
		void main(String[] args) {
			System.out.println(JavaTestStatic.other);
		}
	}
	define class JavaTestStatic {
		static final FQN[other::Other] other = new FQN[other::Other](); // (1)
	}
}
(1)
Undefined type name: other.Other

other.Other¤ÈÊѹ¹¤·¤Æ¤â¥¨¥é¡¼

Other¤Ë¤¹¤ë¤È¡¢src.Other¤¬»²¾È¤µ¤ì¤ë¡£

例 17. ¾¥â¥¸¥å¡¼¥ë¤Î»²¾È3(¥×¥ê¥×¥í¥»¥¹Ãæ¤ËNullPointerException¤Ç¥³¥ó¥Ñ¥¤¥ëÄä»ß)

module other {
	define public class Other {
		public String toString() {
			return this.getClass().getName();
		}
	}
}

module src uses other {
	define public class FQN[src::Other] {
		public String toString() {
			return this.getClass().getName();
		}
	}
	class SS {
		void main(String[] args) {
			System.out.println(JavaTestStatic.other);
		}
	}
	define class JavaTestStatic {
		static final FQN[other::Other] other = new FQN[other::Other]();
	}
}


¥á¥ó¥Ð¤¬¤¹¤Ù¤Æpublic¤Ë¤Ê¤ë

MixJuice¤Ç¤Ï¥á¥½¥Ã¥É¤¬¤¹¤Ù¤Æpublic¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¡£¤·¤«¤·¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Î¥·¥ê¥¢¥é¥¤¥º¤ò¹Ô¤¦ºÝ¤ÎreadObject¥á¥½¥Ã¥É¤Ê¤É¤Ï¡¢private¤Ç¤¢¤ë¤³¤È¤Ë°ÕÌ£¤¬¤¢¤ë¡£¤·¤¿¤¬¤Ã¤Æ¡¢MixJuice¤Ç¤Ï¥ª¥Ö¥¸¥§¥¯¥È¤Î¥·¥ê¥¢¥é¥¤¥º¤Ê¤É¤Ë´Ø¤·¤Æ¡¢Æȼ«¤ÎÀ©¸æ¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£

°ìÉô¤Î¥Ä¡¼¥ë(JUnit¤äGUI¥Ó¥ë¥À¤Ê¤É)¤Ï¡¢¥ê¥Õ¥ì¥¯¥·¥ç¥ó¤òÍøÍѤ·¤Æpublic¤Ê¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¡£¤½¤ÎºÝ¡¢ËÜÍèpublic¤Ê°·¤¤¤Ç¤Ï¤Ê¤¤¥á¥½¥Ã¥É¤â¸Æ¤Ó½Ð¤µ¤ì¤ë¤¿¤á¤ËÉÔÅԹ礬À¸¤¸¤ë¤³¤È¤¬¤¢¤ë¡£

private void testFoo1() {...}
private void testFoo2() {...}
public void testBar() {testFoo1(); testFoo2();}

Î㤨¤Ð¡¢¾åµ­¤ÎJUnitÍѤΥ³¡¼¥É¤Ï²¼µ­¤Î¤è¤¦¤Ë½ñ¤­´¹¤¨¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£

define void privateTestFoo1() {...}
define void privateTestFoo2() {...}
define void testBar() {privateTestFoo1(); privateTestFoo2();}

¥É¥­¥å¥á¥ó¥Æ¡¼¥·¥ç¥ó¥Ä¡¼¥ë¤¬¤Ê¤¤

JavaDoc¤ËÁêÅö¤¹¤ë¥É¥­¥å¥á¥ó¥Æ¡¼¥·¥ç¥ó¥Ä¡¼¥ë¤¬Ìµ¤¤¤Î¤Ç¡¢¥Ö¥é¥Ã¥¯¥Ü¥Ã¥¯¥¹¤È¤·¤ÆMixJuice¥¯¥é¥¹¤òÍøÍѤ·¤¿¤¤¾ì¹ç¤Ç¤â¡¢¥½¡¼¥¹¤ò¸«¤ëɬÍפ¬¤¢¤ë¡£¤Þ¤¿¡¢¥â¡¼¥¸¥å¡¼¥ë¤ò³ÈÄ¥¤·¤¿¾ì¹ç¤Ë¡¢¥É¥­¥å¥á¥ó¥È¤Îº¹Ê¬¤ò¤É¤¦É½¸½¤¹¤ë¤«¤Î¸¡Æ¤¤¬É¬ÍפǤ¢¤ë¡£