IBM Korea Skip to main content
       IBM Ȩ    |  Á¦Ç° & ¼­ºñ½º  |  °í°´Áö¿ø & ´Ù¿î·Îµå  |  È¸¿ø°¡ÀÔ  

Eclipse Ç÷¯±×ÀÎ °³¹ßÇϱâ
Ç÷¯±×ÀÎ ±¸Çö, µð¹ö±×, ¼³Ä¡

Level: Introductory

David Gallardo
Software consultant
2002³â 12¿ù

David Gallardo´Â Plug-in Development EnvironmentÀÇ ÄÚµå »ý¼º À§Àڵ带 »ç¿ëÇÏ¿© Eclipse Ç÷¯±×ÀÎÀ» ¸¸µå´Â ¹æ¹ýÀ» ¼³¸íÇÑ´Ù. ·±Å¸ÀÓ ¿öÅ©º¥Ä¡¿¡¼­ Ç÷¯±×ÀÎÀ» ½ÇÇàÇÏ°í µð¹ö±ëÇÏ´Â ¹æ¹ýÀ» ºñ·ÔÇÏ¿© Eclipse¿¡ ¿Ïº®ÇÑ Ç÷¯±×ÀÎÀ» ¼³Ä¡ÇÏ´Â ¹æ¹ýÀ» ¹è¿ì°Ô µÉ °ÍÀÌ´Ù.

Ç÷¯±×ÀÎ ±â¹Ý ¾ÆÅ°ÅØÃÄ
Eclipse PlatformÀº IBMÀÌ °³¹ß¿¡ ½ñ¾Æ ºÎÀº 4õ¸¸ ´Þ·¯ ¶§¹®ÀÌ ¾Æ´Ï¶ó ±×·¯ÇÑ ÁöÃâ¿¡ ÇÕ´çÇÑ °á°ú¸¦ º¸¿©Áà¾ßÇÑ´Ù´Â ÀÌÀ¯·Î ÁÖ¸ñÀ» ¹Þ°í ÀÖ´Ù. ¼º¼÷ÇÏ°í, µðÀÚÀÎÀÌ Àß µÇ¾îÀÖ°í, È®Àå °¡´ÉÇÑ ¾ÆÅ°ÅØÃĸ¦ ±â´ëÇÏ°í ÀÖ´Ù. EclipseÀÇ °¡Ä¡´Â ¹«¾ùÀΰ¡? ÀÌ°ÍÀº ¿ÀÇ ¼Ò½º Ç÷§ÆûÀ¸·Î¼­ È®Àå °¡´ÉÇÑ ÅëÇÕ °³¹ß ȯ°æÀ» Á¦°øÇÑ´Ù. ÀÌ Ç÷§ÆûÀ¸·Î ´©±¸³ª ȯ°æ°ú ´Ù¸¥ ÅøÀ» ¿Ïº®ÇÏ°Ô ÅëÇÕÇÏ´Â ÅøÀ» ±¸ÇöÇÒ ¼ö ÀÖ´Ù.

Eclipse¿Í ÅøÀÇ ¿Ïº®ÇÑ ÅëÇÕÀÇ ¿­¼è´Â Ç÷¯±×ÀÎ(plug-in)ÀÌ´Ù. ÀÛÀº ·±Å¸ÀÓ Ä¿³ÎÀ» Á¦¿ÜÇÏ°í EclipseÀÇ ¸ðµç °ÍÀÌ Ç÷¯±×ÀÎÀÌ´Ù. µû¶ó¼­ ´ç½ÅÀÌ °³¹ßÇÏ´Â Ç÷¯±×ÀÎÀº ´Ù¸¥ Ç÷¯±×Àΰú °°Àº ¹æ½ÄÀ¸·Î Eclipse¿Í ÅëÇյȴÙ. ÀÌ·¯ÇÑ °üÁ¡¿¡¼­ º¼ ¶§ ¸ðµç ±â´ÉµéÀº µ¿µîÇÏ°Ô ¸¸µé¾îÁ³´Ù.

ÇÏÁö¸¸ ¾î¶² Ç÷¯±×ÀÎÀº ´Ù¸¥ ¾î¶² °Íµéº¸´Ù ´õ ºñ½ÁÇÏ´Ù. Workbench¿Í Workspace´Â Eclipse Ç÷§Æû¿¡ À־ ¾ø¾î¼­´Â ¾ÈµÉ Ç÷¯±×ÀÎÀÌ´Ù. ±×¸² 1 ó·³ ´ëºÎºÐÀÇ Ç÷¯±×Àο¡¼­ »ç¿ëµÇ´Â È®Àå Æ÷ÀÎÆ®¸¦ Á¦°øÇÑ´Ù. Ç÷¯±×ÀÎÀÌ ±â´ÉÀ» Çϱâ À§ÇØ Ç÷¯±×ÀÎ µÉ ¼ö ÀÖ´Â È®Àå Æ÷ÀÎÆ®°¡ ÇÊ¿äÇÏ´Ù.

±×¸²1. Eclipse Workbench¿Í Workspace: Çʼö Ç÷¯±×ÀÎ Áö¿ø
Eclipse Workbench

Workbench ÄÄÆ÷³ÍÆ®¿¡´Â È®Àå Æ÷ÀÎÆ®°¡ Æ÷ÇԵǾî ÀÖ¾î ´ç½ÅÀÇ Ç÷¯±×ÀÎÀÌ ¸Þ´º ¼±Åðú Åø¹Ù ¹öÆ°À» Æ÷ÇÔÇϵµ·Ï Eclipse »ç¿ëÀÚ ÀÎÅÍÆäÀ̽º¸¦ È®Àå½ÃÄÑ ´Ù¸¥ À¯ÇüÀÇ À̺¥Æ® °øÁö¸¦ ¿äûÇÏ°í »õ·Î¿î ºä¸¦ ¸¸µç´Ù. Workspace ÄÄÆ÷³ÍÆ®¿¡´Â È®Àå Æ÷ÀÎÆ®°¡ Æ÷ÇԵǾî ÀÖ¾î ÇÁ·ÎÁ§Æ®¿Í ÆÄÀÏÀ» Æ÷ÇÔÇÏ¿© ¸®¼Ò½ºµé°ú ÀÎÅÍ·¢Æà ÇÒ ¼ö ÀÖ´Ù.

Workbench¿Í Workspace´Â ´Ù¸¥ Ç÷¯±×Àο¡ ÀÇÇØ È®ÀåµÉ ¼ö ÀÖ´Â Eclipse ÄÄÆ÷³ÍÆ® ±× ÀÌ»óÀÌ´Ù. Debug ÄÄÆ÷³ÍÆ®·Î´Â Ç÷¯±×ÀÎÀÌ ÇÁ·Î±×·¥À» ½ÃÀÛÇÒ ¼ö ÀÖµµ·Ï ÇÏ°í ½ÇÇà ÇÁ·Î±×·¥°ú ÀÎÅÍ·¢ÆÃÇÏ¸ç ¿¡·¯¸¦ ó¸®ÇÑ´Ù. ÀÌ ¸ðµÎ´Â »ç½Ç»ó µð¹ö°Å¸¦ ¸¸µå´Âµ¥ ÇÊ¿äÇÑ °ÍµéÀÌ´Ù. ƯÁ¤ÇÑ ¾ÖÇø®ÄÉÀ̼ǿ¡ ÇÊ¿äÇÏÁö¸¸ µð¹ö±× ÄÄÆ÷³ÍÆ®´Â ´ëºÎºÐÀÇ ¾ÖÇø®ÄÉÀ̼ǿ¡´Â ÇÊ¿äÇÏÁö ¾Ê´Ù.

Team ÄÄÆ÷³ÍÆ®´Â Eclipse ¸®¼Ò½º·Î ÇÏ¿©±Ý ¹öÀü ÄÜÆ®·Ñ ½Ã½ºÅÛ(VCS)°ú ÀÎÅÍ·¢Æà ÇÒ ¼ö ÀÖµµ·Ï ÇÏÁö¸¸ VCS¿ë Eclipse Ŭ¶óÀ̾ðÆ®¸¦ ±¸ÇöÇÏÁö ¾ÊÀ» °æ¿ì¿¡¸¸ ±×·¸´Ù. Team ÄÄÆ÷³ÍÆ®´Â Debug ÄÄÆ÷³ÍÆ®¿Í ¸¶Âù°¡Áö·Î È®Àå ±â´ÉÀ» °®°íÀÖÁö ¾Ê´Ù.

¸¶Áö¸·À¸·Î Help ÄÄÆ÷³ÍÆ®·Î´Â ¾ÖÇø®ÄÉÀÌ¼Ç¿ë ¿Â¶óÀÎ ¹®¼­¿Í ÄÁÅؽºÆ® °ü·Ã µµ¿ò¸»À» Á¦°øÇÒ ¼ö ÀÖ´Ù. help ¹®¼­È­´Â Àü¹® ¾ÖÇø®ÄÉÀ̼ÇÀÇ Çʼö ¿ä¼ÒÀÌÁö¸¸ Ç÷¯±×ÀÎ ±â´É¿¡´Â ²À ±×·¸Áö ¾Ê´Ù.

À§ ÄÄÆ÷³ÍÆ®°¡ Á¦°øÇÏ´Â È®Àå Æ÷ÀÎÆ®´Â Eclipse Platform Help¿¡ ¹®¼­È­ µÈ´Ù. API ·¹ÆÛ·±½ºÀÇ Workbench ¼½¼ÇÀº óÀ½¿¡´Â ±â°¡ Á״´Ù. »ç¿ëÇÒ ¼ö ÀÖ´Â ¸¹Àº È®Àå Æ÷ÀÎÆ®ÀÇ ¼¼ºÎ»çÇ׿¡ Á¢±ÙÇϱ⠺¸´Ù´Â °£´ÜÇÑ Ç÷¯±×Àΰú ÄÄÆ÷³ÍÆ® ºÎÅÍ Á¢±ÙÇϵµ·Ï ÇÏ°Ú´Ù.

Ç÷¯±×ÀÎ ÀÔ¹®
Ç÷¯±×ÀÎÀ» ¸¸µå´Â °¡Àå ½¬¿î ¹æ¹ýÀº Plug-in Development Environment (PDE)¸¦ »ç¿ëÇÏ´Â °ÍÀÌ´Ù. PDE´Â Ç÷¯±×ÀÎÀ» ¸¸µé ¼ö ÀÖµµ·Ï µµ¿ÍÁÖ´Â À§Àڵ带 Á¦°øÇÑ´Ù.

Eclipse ¸Þ´º¿¡¼­, File=>New=>Other (¶Ç´Â Ctrl-NÀ» ´©¸¥´Ù)¸¦ ¼±ÅÃÇÏ°í Select ´ÙÀ̾ó·Î±×ÀÇ ¿ÞÂÊ¿¡ ÀÖ´Â Plug-in Development À§Àڵ带 ¼±ÅÃÇÑ´Ù. Select ´ÙÀ̾ó·Î±×ÀÇ ¿À¸¥ÂÊ¿¡¼­´Â, Plug-in Project¸¦ ¼±ÅÃÇÑ´Ù. Next¸¦ ´©¸¥´Ù. ´ÙÀ½ ½ºÅ©¸°¿¡¼­ ÇÁ·ÎÁ§Æ® À̸§À» ÀÔ·ÂÇÑ´Ù. ³ª´Â com.example.hello¸¦ ÀÔ·ÂÇß´Ù. ´Ù½Ã Next¸¦ ´©¸¥´Ù. ´ÙÀ½ ½ºÅ©¸°¿¡¼­, Ç÷¯±×ÀÎ ID°¡ ÇÁ·ÎÁ§Æ® À̸§°ú »óÀÀÇÑ´Ù´Â °ÍÀ» ¾Ë ¼ö ÀÖ´Ù. Ç÷¯±×ÀÎ ID·Î ÇÁ·ÎÁ§Æ® À̸§À» »ç¿ëÇÏ¸é ´Ù¸¥ Ç÷¯±×ÀÎ À̸§°ú Ãæµ¹ÇÒ ±âȸ°¡ ÁÙ¾îµç´Ù. ´Ù½Ã Next¸¦ ´©¸¥´Ù. ´ÙÀ½ ½ºÅ©¸°¿¡¼­´Â Ãʱâ Ç÷¯±×ÀÎ Äڵ带 ¼±ÅÃÇÒ °ÍÀÎÁö ¶Ç´Â ÄÚµå »ý¼º À§Àڵ带 ½ÇÇàÇÒ °ÍÀÎÁö¿¡ ´ëÇÑ ¼±ÅÃÀ» ÇÒ ¼ö ÀÖ´Ù. ÄÚµå »ý¼º À§Àڵ带 µðÆúÆ® »óÅ·ΠÇØ ³õ°í "Hello, World"¸¦ ¼±ÅÃÇÑ ´ÙÀ½ Next¸¦ ´©¸£¸é ±×¸² 2 ó·³ º¸ÀδÙ.

±×¸² 2. "Hello, World" ÄÚµå »ý¼º À§ÀÚµå ¼±ÅÃÇϱâ
New plug-in

´ÙÀ½ ½ºÅ©¸°¿¡¼­´Â Ãß°¡ Á¤º¸¸¦ ¿äûÇÑ´Ù. Ç÷¯±×ÀÎ À̸§, ¹öÀü ¼ýÀÚ, °ø±ÞÀÚ À̸§, Ŭ·¡½º À̸§ µîÀÌ´Ù. À̵éÀº Ç÷¯±×Àο¡ ´ëÇÑ Áß¿äÇÑ Á¤º¸µéÀÌ´Ù. À§Àڵ尡 Á¦°øÇÑ µðÆúÆ®¸¦ ¼ö¶ôÇÑ´Ù. Next¸¦ ´©¸¥´Ù. ´ÙÀ½ ½ºÅ©¸°¿¡¼­ ÆÐÅ°Áö À̸§, Ŭ·¡½º À̸§, ¸Þ½ÃÁö ÅؽºÆ®¿ë µðÆúÆ®¸¦ ¼ö¶ôÇÑ´Ù. üũ¹Ú½º¿¡ "Add the action set to the resource perspective"¶ó°í ¸¶Å·µÈ ä·Î µÐ´Ù. Finish¸¦ ´©¸¥´Ù.

À§Àڵ尡 ¿Ï·áµÇ±â À§Çؼ­´Â ´Ù¸¥ ƯÁ¤ÇÑ Ç÷¯±×ÀÎÀ» ½ÇÇàÇØ¾ß ÇÑ´Ù°í ³ª¿Â´Ù¸é OK¸¦ ´©¸¥´Ù.

À§Àڵ尡 ¿Ï·áµÇ¸é com.example.hello¶ó´Â À̸§ÀÇ »õ·Î¿î ÇÁ·ÎÁ§Æ®¸¦ °®°ÔµÈ´Ù(±×¸² 3).

±×¸² 3. PDE ¸ð½À: Welcome to Hello Plug-in
PDE perspective

Package ExplorerÀÇ ¿ÞÂÊ ¿öÅ©º¥Ä¡¿¡ À§Àڵ尡 ¸¸µç °ÍµéÀÌ º¸ÀδÙ. ÇÁ·ÎÁ§Æ® Ŭ·¡½º °æ·Î¿¡ Æ÷ÇÔµÈ ¸¹Àº .jar ÆÄÀϵé, Åø¹Ù ¹öÆ°¿ë ±×·¡ÇÈÀ» Æ÷ÇÔÇÏ°í ÀÖ´Â ¾ÆÀÌÄÜ Æú´õ, ÀÚµ¿ ±¸Çö ½ºÅ©¸³Æ®¿¡ ÀÇÇØ »ç¿ëµÇ´Â º¯¼ö°¡ Æ÷ÇÔµÈ build.properties ÆÄÀÏ µîÀÌ ÀÖ´Ù.

ÀÌÁß °¡Àå Èï¹Ì·Î¿î src Æú´õ¿¡´Â Ç÷¯±×ÀÎÀ» À§ÇÑ ¼Ò½º ÄÚµå¿Í plugin.xml ÆÄÀÏÀÌ µé¾îÀÖ´Ù. plugin.xml ºÎÅÍ »ìÆ캸ÀÚ.

Ç÷¯±×ÀÎ ÀûÇϸñ·Ï ÆÄÀÏ(plug-in manifest file)
Ç÷¯±×ÀÎ manifest ÆÄÀÏÀÎ plugin.xml¿¡´Â Eclipse°¡ Ç÷¯±×ÀÎÀ» ÇÁ·¹ÀÓ¿÷À¸·Î ÅëÇÕÇÒ ¶§ »ç¿ëÇÒ Á¤º¸µéÀÌ Æ÷ÇԵǾî ÀÖ´Ù. ±âº»ÀûÀ¸·Î, plugin.xmlÀº Ç÷¯±×ÀÎÀÌ Ã³À½ ¸¸µé¾îÁú ¶§, ÀûÇϸñ·Ï ÆíÁý ¿µ¿ª¿¡¼­ ¿­¸°´Ù. ¿¡µðÅÍÀÇ ¹Ø¿¡ ÀÖ´Â ÅÇ¿¡¼­ Ç÷¯±×Àο¡ ´ëÇÑ ´Ù¾çÇÑ Á¤º¸¸¦ ¼±ÅÃÇÒ ¼ö ÀÖ´Ù. Welcome ÅÇÀº "Welcome to Hello Plug-In" ¸Þ½ÃÁö¸¦ µð½ºÇ÷¹ÀÌÇÏ°í »ç¿ëµÈ ÅÛÇø´À» °£·«È÷ ¼Ò°³Çϸç Ç÷¯±×ÀÎ ±¸Çö ÆÁÀ» º¸¿©ÁØ´Ù. "Source" ÅÇÀ» ¼±ÅÃÇϸé plugin.xml ÆÄÀÏÀÇ Àüü ¼Ò½º¸¦ º¼ ¼ö ÀÖ´Ù.

Ç÷¯±×ÀÎ ÀûÇϸñ·Ï ÆÄÀÏÀÇ ´Ù¸¥ ºÎºÐÀ» »ìÆ캸ÀÚ. ¿ì¼±, À̸§, ¹öÀü ¼ýÀÚ, Ŭ·¡½º ÆÄÀÏ À̸§, .jar ÆÄÀÏ À̸§ÀÌ Æ÷ÇÔµÈ ÀÏ¹Ý Á¤º¸ ºÎÅÍ º¸µµ·ÏÇÏÀÚ.

Listing 1. Ç÷¯±×ÀÎ ÀûÇϸñ·Ï ÆÄÀÏ-- ÀÏ¹Ý Á¤º¸

  
<?xmlversion="1.0" encoding="UTF-8"?>
<plugin
   id="com.example.hello"
   name="Hello Plug-in"
   version="1.0.0"
   provider-name="EXAMPLE"
   class="com.example.hello.HelloPlugin">

   <runtime>
      <library name="hello.jar"/>
   </runtime>
  

´ÙÀ½Àº ¿ì¸®ÀÇ Ç÷¯±×ÀÎÀÌ ¿äûÇÑ Ç÷¯±×ÀεéÀÌ ³ª¿­µÈ´Ù:

Listing 2. Ç÷¯±×ÀÎ ÀûÇϸñ·Ï ÆÄÀÏ -- required plug-ins
 
    
   <requires>  
      <import plugin="org.eclipse.core.resources"/>
      <import plugin="org.eclipse.ui"/>
   </requires>

ù° ÁÙÀÇ org.eclipse.core.resources´Â ¿öÅ©½ºÆäÀ̽º Ç÷¯±×ÀÎÀÌÁö¸¸ ½ÇÁ¦·Î ¿ì¸®ÀÇ Ç÷¯±×Àο¡´Â ÇÊ¿äÇÏÁö ¾Ê´Ù. µÎ ¹ø° Ç÷¯±×ÀÎ, org.eclipse.ui´Â ¿öÅ©º¥Ä¡ÀÌ´Ù. µÎ °³ÀÇ È®Àå Æ÷ÀÎÆ®¸¦ È®ÀåÇÒ °ÍÀ̱⠶§¹®¿¡ ¿öÅ©º¥Ä¡ Ç÷¯±×ÀÎÀÌ ÇÊ¿äÇÏ´Ù.

ù ¹ø° È®Àå ű״ org.eclipse.ui.actionSets Æ÷ÀÎÆ® ¾ÖÆ®¸®ºäÆ®¸¦ °®°í ÀÖ´Ù. ÀÌ ¾×¼Ç ¼¼Æ®´Â Ç÷¯±×ÀÎÀÌ ¿öÅ©º¥Ä¡ À¯Àú ÀÎÅÍÆäÀ̽º¿¡ ±âÁõ(contribution)ÀÌ´Ù. ¾×¼ÇÀº ±×·ì ±â¿©¸¦ ¼³Á¤ÇÏ¿© »ç¿ëÀÚ°¡ ½±°Ô À̸¦ °ü¸®ÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù. ¿¹¸¦ µé¾î ¿ì¸®ÀÇ Hello Ç÷¯±×ÀÎ ¸Þ´º¿Í Åø¹Ù ¾ÆÀÌÅÛÀº Resource Perspective¿¡ ³ªÅ¸³­´Ù. ÄÚµå »ý¼º À§Àڵ带 ½ÇÇàÇÒ ¶§ À̸¦ ¼±ÅÃÇ߱⠶§¹®ÀÌ´Ù. »ç¿ëÀÚ´Â Window=>Customize Perspective ¸Þ´º ¿É¼ÇÀ» »ç¿ëÇؼ­ À̸¦ º¯°æÇÏ°í Resource Perspective¿¡ µð½ºÇ÷¹ÀÌµÈ ¾ÆÀÌÅÛ¿¡¼­ "Sample Action Set" ¸¦ Á¦°ÅÇÑ´Ù.

±×¸² 4. Resource Perspective Ä¿½ºÅ͸¶ÀÌ¡
Resource Perspective

¾×¼Ç ¼¼Æ®¿¡´Â µÎ °³ÀÇ Å±װ¡ Æ÷ÇԵǾî ÀÖ´Ù. menu tag´Â ¿ì¸®ÀÇ ¾ÆÀÌÅÛÀÌ workbench ¸Þ´º ¾îµð¿¡, ¾î¶»°Ô ³ªÅ¸³ª¾ß ÇÏ´ÂÁö¸¦ ¼³¸íÇÑ´Ù. action tag´Â ¹«¾ùÀ» ÇؾßÇÏ´ÂÁö¸¦ ¼³¸íÇÑ´Ù. ƯÈ÷ ÀÌ ¾×¼ÇÀ» ¼öÇàÇϴ Ŭ·¡½º¸¦ Á¤ÀÇÇÑ´Ù.

Listing 3. ¾×¼Ç ¼¼Æ®
   
  
    
   <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="Sample Action Set"
            visible="true"
            id="com.example.hello.actionSet">
         <menu
               label="Sample &Menu"
               id="sampleMenu">
            <separator
                  name="sampleGroup">
            </separator>
         </menu>
         <action 
               label="&Sample Action"
               icon="icons/sample.gif"
               class="com.example.hello.actions.SampleAction"
               tooltip="Hello, Eclipse world"
               menubarPath="sampleMenu/sampleGroup"
               toolbarPath="sampleGroup"
               id="com.example.hello.actions.SampleAction">
         </action>
      </actionSet>
   </extension>

¸Þ´º¿Í ¾×¼Ç ¾ÖÆ®¸®ºäÆ®ÀÇ ¸ñÀûÀº ºÐ¸íÇÏ´Ù. ¾×¼Ç ű×ÀÇ menubarPath¸¦ ÁÖ¸ñÇغ¸ÀÚ. ÀÌ ¾ÖÆ®¸®ºäÆ®´Â ¸Þ´º ű׿¡ Á¤ÀÇµÈ ¾î¶² ¸Þ´º ¾ÆÀÌÅÛÀÌ ¾×¼Ç ű׿¡ Á¤ÀÇµÈ ¾×¼ÇÀ» È£ÃâÇÏ´ÂÁö¸¦ ÁöÁ¤ÇÑ´Ù.

µÎ ¹ø° È®Àå ű״ Resource Perspective¿¡ Ç÷¯±×ÀÎÀ» Ãß°¡ÇϱâÀ§ÇØ ¼±ÅÃµÈ °á°ú·Î »ý°Ü³µ´Ù. ÀÌ Å±״ Eclipse°¡ Ç÷¯±×ÀÎÀ» ½ÃÀÛÇÏ°í ·ÎµùÇÒ ¶§ ¿ì¸®ÀÇ Ç÷¯±×ÀÎÀÌ Resource Perspective¿¡ Ãß°¡µÇµµ·Ï ÇÑ´Ù:

Listing 4. È®Àå ű×

  
   <extension  
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="org.eclipse.ui.resourcePerspective">
         <actionSet
               id="com.example.hello.actionSet">
         </actionSet>
      </perspectiveExtension>
   </extension>
</plugin>

ÀÌ ¸¶Áö¸· È®ÀåÀÌ »ý·«µÇ¾ú´Ù¸é »ç¿ëÀÚ´Â Window=>Customize PerspectiveÀ» »ç¿ëÇÏ¿© Resource (´Ù¸¥) Perspective¿¡ Ç÷¯±×ÀÎÀ» Ãß°¡½ÃÄÑ¾ß ÇßÀ» °ÍÀÌ´Ù.

Ç÷¯±×ÀÎ ¼Ò½º ÄÚµå
ÄÚµå »ý¼º À§ÀÚµå´Â µÎ °³ÀÇ ÀÚ¹Ù ¼Ò½º ÆÄÀÏÀ» ¸¸µé¾ú´Ù. PDE ÆÐÅ°Áö ÀͽºÇ÷η¯ÀÇ src Æú´õ¸¦ ¿­¾î º¼ ¼ö ÀÖ´Ù. ù ¹ø°, HelloPlugin.java´Â Ç÷¯±×ÀΠŬ·¡½ºÀÌ°í AbstractUIPlugin Ãß»ó Ŭ·¡½º¸¦ È®ÀåÇÑ´Ù. HelloPluginÀº Ç÷¯±×ÀÎÀÇ ¼ö¸íÀ» °ü¸®ÇÑ´Ù. Á»´õ È®ÀåµÈ ¾ÖÇø®ÄÉÀ̼ǿ¡¼­´Â ´ÙÀ̾ó·Î±× ¹Ú½º ¼¼Æðú À¯Àú ¼±È£µµ °°Àº °ÍÀ» °ü¸®ÇÑ´Ù. HelloPluginÀº ¸¹Àº °ÍÀ» ¼öÇàÇÏÁö ¾Ê´Â´Ù:

Listing 5. HelloPlugin

  
packagecom.example.hello.actions;

import org.eclipse.ui.plugin.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.resources.*;
import java.util.*;

/**
 * The main plugin class to be used in the desktop.
 */
public class HelloPlugin extends AbstractUIPlugin {
      //The shared instance.
      private static HelloPlugin plugin;
      //Resource bundle.
      private ResourceBundle resourceBundle;
      
      /**
       * The constructor.
       */
      public HelloPlugin(IPluginDescriptor descriptor) {
            super(descriptor);
            plugin = this;
            try {
                  resourceBundle= ResourceBundle.getBundle(
                       "com.example.hello.HelloPluginResources");
            } catch (MissingResourceException x) {
                  resourceBundle = null;
            }
      }

      /**
       * Returns the shared instance.
       */
      public static HelloPlugin getDefault() {
            return plugin;
      }

      /**
       * Returns the workspace instance.
       */
      public static IWorkspace getWorkspace() {
            return ResourcesPlugin.getWorkspace();
      }

      /**
       * Returns the string from the plugin's resource bundle,
       * or 'key' if not found.
       */
      public static String getResourceString(String key) {
            ResourceBundle bundle= HelloPlugin.getDefault().getResourceBundle();
            try {
                  return bundle.getString(key);
            } catch (MissingResourceException e) {
                  return key;
            }
      }

      /**
      * Returns the plugin's resource bundle,
      */
      public ResourceBundle getResourceBundle() {
          return resourceBundle;
      }
}

µÎ ¹ø° ¼Ò½º ÆÄÀÏÀÎ SampleAction.java¿¡´Â ÀûÇϸñ·Ï ÆÄÀÏÀÇ ¾×¼Ç ¼¼Æ®¿¡ ÁöÁ¤µÈ ¾×¼ÇÀ» ¼öÇàÇϴ Ŭ·¡½º°¡ Æ÷ÇԵǾîÀÖ´Ù. SampleAction´Â IWorkbenchWindowActionDelegate ÀÎÅÍÆäÀ̽º¸¦ ±¸ÇöÇϴµ¥, À̷μ­ Eclipse°¡ Ç÷¯±×ÀÎ ÇÁ·Ï½Ã¸¦ »ç¿ëÇÏ¿© Á¤¸»·Î ÇÊ¿äÇϱâ Àü¿¡´Â ·ÎµùÇÒ ÇÊ¿ä°¡ ¾ø´Ù. IWorkbenchWindowActionDelegate ÀÎÅÍÆäÀ̽º ¸Þ¼Òµå´Â Ç÷¯±×ÀÎÀÌ ±× ÇÁ·Ï½Ã¿Í ÀÎÅÍ·¢Æà ÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù:

Listing 6. IWorkbenchWindowActionDelegate ÀÎÅÍÆäÀ̽º ¸Þ¼Òµå

  
package com.example.hello.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.jface.dialogs.MessageDialog;

/**
 * Our sample action implements workbench action delegate.
 * The action proxy will be created by the workbench and
 * shown in the UI. When the user tries to use the action,
 * this delegate will be created and execution will be 
 * delegated to it.
 * @see IWorkbenchWindowActionDelegate
 */
public class SampleAction implements IWorkbenchWindowActionDelegate {
      private IWorkbenchWindow window;
      /**
       * The constructor.
       */
      public SampleAction() {
      }

      /**
       * The action has been activated. The argument of the
       * method represents the 'real' action sitting
       * in the workbench UI.
       * @see IWorkbenchWindowActionDelegate#run
       */
      public void run(IAction action) {
            MessageDialog.openInformation(
                  window.getShell(),
                  "Hello Plug-in",
                  "Hello, Eclipse world");
      }

      /**
       * Selection in the workbench has been changed. We 
       * can change the state of the 'real' action here
       * if we want, but this can only happen after 
       * the delegate has been created.
       * @see IWorkbenchWindowActionDelegate#selectionChanged
       */
      public void selectionChanged(IAction action, ISelection selection) {
      }

      /**
       * We can use this method to dispose of any system
       * resources we previously allocated.
       * @see IWorkbenchWindowActionDelegate#dispose
       */
      public void dispose() {
      }

      /**
       * We will cache window object in order to
       * be able to provide parent shell for the message dialog.
       * @see IWorkbenchWindowActionDelegate#init
       */
      public void init(IWorkbenchWindow window) {
            this.window = window;
      }
}

Ç÷¯±×ÀÎ ½ÇÇà°ú µð¹ö±×
Eclipse¿ë Ç÷¯±×ÀÎÀ» °³¹ßÇÒ ¶§ Eclipse¸¦ ²ô°í Å×½ºÆ®¿Í µð¹ö±×¸¦ À§ÇØ »õ·Î¿î Ç÷¯±×ÀÎÀ¸·Î Àç½ÃÀÛÇÏ´Â °ÍÀº ÀÌ»óÇÏ´Ù. EclipseÀÇ PDE´Â ´ÙÇàÈ÷µµ ÀÚ°¡ È£½ºÆà °³¹ß ȯ°æÀ» Á¦°øÇÏ°í Àֱ⠶§¹®¿¡ ¿öÅ©º¥Ä¡ÀÇ °³º° ÀνºÅϽº¿¡ ¼³Ä¡ÇÏÁö ¾Ê°í Ç÷¯±×ÀÎÀ» ½ÇÇàÇÒ ¼ö ÀÖ´Ù.

Hello Ç÷¯±×ÀÎÀ» ½ÇÇàÇÏ·Á¸é, Run=>Run As=>Run-time Workbench¸¦ ¼±ÅÃÇÏ°í Ãß°¡µÈ Ç÷¯±×ÀÎ ¸Þ´º ¼±Åðú Åø¹Ù°¡ ÀÖ´Â WorkbenchÀÇ ¶Ç ´Ù¸¥ ÀνºÅϽº¸¦ ½ÃÀÛÇÑ´Ù. (±×¸² 5)

±×¸² 5. ·±Å¸ÀÓ ¿öÅ©º¥Ä¡¿¡¼­ ½ÇÇàµÇ´Â Hello Ç÷¯±×ÀÎ
Hello plug-in

Åø¹Ù ¹öÆ°À» Ŭ¸¯Çϰųª "Sample Menu" ¸Þ´º¿¡¼­ Ç÷¯±×ÀÎÀ» È°¼ºÈ­½Ãų ¼ö ÀÖ´Ù. ±×·¸°Ô Çϸé "Hello Plug-in" ŸÀÌƲ°ú "Hello, Eclipse world" ³»¿ëÀÌ ³ªÅ¸³ª¸é OK ¹öÆ°À» ´©¸¥´Ù.

Run=>Debug As=>Run-time Workbench¸¦ ¼±ÅÃÇÏ¿© ºñ½ÁÇÑ ¹æ¹ýÀ¸·Î Ç÷¯±×ÀÎÀ» µð¹ö±×ÇÒ ¼ö ÀÖ´Ù.

Ç÷¯±×ÀÎ Å×½ºÆ®°¡ ¿Ï·áµÇ°í ¹èÆ÷ Áغñ¸¦ °®Ãè´Ù¸é ÆÐŰ¡ °úÁ¤¿¡ µ¹ÀÔÇÑ´Ù.

Ç÷¯±×ÀÎ ÆÐŰ¡
Eclipse´Â ¾î¶² Ç÷¯±×ÀÎÀÌ ·Îµù µÉ °ÍÀÎÁö¸¦ ½ÃÀÛÇÒ ¶§ Ç÷¯±×ÀÎ µð·ºÅ丮¸¦ º¸¸é¼­ °áÁ¤ÇÑ´Ù. Ç÷¯±×ÀÎÀ» ¼³Ä¡Çϱâ À§Çؼ­´Â Ç÷¯±×ÀÎ µð·ºÅ丮¿¡ ÇÏÀ§ µð·ºÅ丮¸¦ ¸¸µé¾î¼­ ÇÁ·Î±×·¥ ÆÄÀÏ°ú ÀûÇϸñ·Ï ÆÄÀÏ¿¡ º¹»çÇÑ´Ù. ÀÌ°ÍÀº ÇʼöÀûÀÎ ÀÏÀº ¾Æ´ÏÁö¸¸ µð·ºÅ丮 À̸§ÀÌ Ç÷¯±×ÀÎ ID¸¦ ³ªÅ¸³»°Ô ÇÏ°í ±× ´ÙÀ½¿¡ ¾ð´õ¹Ù¸¦ ÇÏ°í ¹öÀü ¼ýÀÚ¸¦ Ãß°¡ÇÑ´Ù. Eclipse°¡ C:\eclipse¿¡ ¼³Ä¡µÇ¸é µð·ºÅ丮¸¦ ¸¸µç´Ù:

C:\eclipse\plugins\com.example.hello_1.0.0.

¿ì¸®ÀÇ ÇÁ·Î±×·¥ ÆÄÀÏÀº ÀûÇϸñ·Ï ÆÄÀÏÀÎ .jar ÆÄÀÏ¿¡ ÀúÀåµÇ¾î¾ßÇÑ´Ù. :


   <runtime> 
      <library name="hello.jar"/>
   </runtime>

hello.jar ÆÄÀÏÀ» ¸¸µé±â À§Çؼ­´Â ÇÁ·ÎÁ§Æ® À̸§À» °­Á¶ÇÏ°í Eclipse ¸Þ´º¿¡¼­ File=>Export ¸¦ ¼±ÅÃÇÏ¿© Ç÷¯±×ÀÎ ÆÄÀÏÀ» ¹ÝÃâÇÒ ¼ö ÀÖ´Ù. ¸ñÀûÁö·Î JAR ÆÄÀÏÀ» ¼±ÅÃÇÏ°í Next¸¦ ´©¸¥´Ù. ±×·± ´ÙÀ½ À̸¦ À§ÇØ ¸¸µç µð·ºÅ丮¸¦ °Ë»öÇÑ´Ù. ±×¸®°í³ª¼­ plugin.xml ÆÄÀÏÀ» ÀÌ µð·ºÅ丮¿¡ º¹»çÇÑ´Ù. File=>Export ¸Þ´º ¼±ÅÃÀ» »ç¿ëÇÒ ¼ö ÀÖ´Ù.

Áö±Ý±îÁö°¡ Ç÷¯±×ÀÎÀ» ¼³Ä¡Çϴµ¥ ÇÊ¿äÇÑ ÀüºÎÀÌ´Ù. ÇÏÁö¸¸ »õ·Î¿î Ç÷¯±×ÀÎÀÌ Àνĵǵµ·Ï ÇÏ·Á¸é Eclipse¸¦ Á¤ÁöÇÏ°í Àç½ÃÀÛÇؾßÇÑ´Ù.

Ç÷¯±×ÀÎ ¹öÀü ¾÷µ¥ÀÌÆ®
µð·ºÅ丮 À̸§ÀÌ ¹öÀü ³Ñ¹ö¸¦ Ãß°¡ÇÏ´Â ¸ñÀûÀº ¿©·¯ ¹öÀüÀÇ Ç÷¯±×ÀÎÀÌ °°Àº ¸Ó½Å¿¡ °øÁ¸Çϵµ·Ï Çϱâ À§ÇÔÀÌ´Ù. Hello Ç÷¯±×ÀÎÀÇ ¾÷µ¥ÀÌÆ® ¹öÀüÀ» ¸¸µé¾î¼­ ¾î¶»°Ô ÀÛµ¿ÇÏ´ÂÁö¸¦ º¼ ¼ö ÀÖ´Ù.

Ç÷¯±×ÀÎ Á¶°¢(fragment)°ú Ư¼º(feature)
Eclipse´Â Ç÷¯±×Àεé·Î ±¸¼ºµÇ¾îÀÖÁö¸¸ Eclipse¿ë Ç÷¯±×ÀÎÀ» °³¹ßÇÒ ¶§ °í·ÁÇؾßÇÏ´Â µÎ °¡Áö ´Ù¸¥ ·¹º§ÀÇ ÄÄÆ÷³ÍÆ®°¡ ÀÖ´Ù.

Ç÷¯±×ÀÎ Á¶°¢(fragment)Àº ¿Ïº®ÇÑ Ç÷¯±×ÀÎ(Ÿ°Ù Ç÷¯±×ÀÎ)ÀÇ ºÎºÐÀ» Çü¼ºÇÑ´Ù. Á¶°¢µéÀÌ Á¦°øÇÏ´Â ±â´ÉµéÀº Ÿ°Ù Ç÷¯±×ÀÎÀÇ ±â´É¿¡ ÇÕº´µÈ´Ù. Á¶°¢Àº ´Ù¸¥ ¾ð¾î¸¦ À§ÇØ Ç÷¯±×ÀÎÀ» ·ÎÄöóÀÌ¡Çϴµ¥ »ç¿ëµÉ ¼ö ÀÖ´Ù. ¿ÏÀüÈ÷ »õ·Î¿î ¹èÆ÷ÆÇÀ» ¸¸µé ÇÊ¿ä ¾øÀÌ ±âÁ¸ Ç÷¯±×Àο¡ ±â´ÉÀ» Ãß°¡ÇÒ ¼ö ÀÖ´Ù. Á¶°¢Àº Ç÷¯±×Àΰú µ¿ÀÏÇÏ´Ù. ÁÖ¿ä Â÷ÀÌÁ¡Àº Á¶°¢Àº Ç÷¯±×ÀΠŬ·¡½º¸¦ °®Áö ¾Ê´Â´Ù´Â Á¡ÀÌ´Ù. Á¶°¢ÀÇ ¼ö¸í ÁÖ±â´Â Ÿ°Ù Ç÷¯±×Àο¡ ÀÇÇØ °ü¸®µÈ´Ù. ¶ÇÇÑ Á¶°¢ÀÇ ÀûÇϸñ·Ï ÆÄÀÏÀº Ÿ°Ù Ç÷¯±×ÀÎÀÇ ID¿Í ¹öÀü ³Ñ¹ö, Á¶°¢ÀÇ ID¿Í ¹öÀü ³Ñ¹ö¸¦ ¸®½ºÆÃÇÑ´Ù.

Ç÷¯±×ÀΠƯ¡(feature)Àº ÄÚµùÀ» ÀüÇô Æ÷ÇÔÇÏÁö ¾Ê´Â´Ù. Eclipse ¾ÆÅ°ÅØÃÄ ¿ë¾î¿¡¼­ Ư¡(feature)Àº Àüü Á¦Ç°À¸·Î °ü·Ã Ç÷¯±×ÀεéÀÇ ±×·ìÀ» ÆÐŰ¡ÇÏ´Â °ÍÀÌ´Ù. ¿¹¸¦ µé¾î, JDT´Â ÀÚ¹Ù ¿¡µðÅÍ, µð¹ö°Å, ÄַܼΠ±¸¼ºµÇ¾ú´Ù. ÀûÇϸñ·Ï ÆÄÀÏ(feature.xml)Àº Ư¡ ¾ÆÄ«À̺긦 ¼³¸íÇÑ´Ù.

´ÙÀ½´Ü°è
Âü°íÀÚ·á ¸¦ ÂüÁ¶Çϱ⠹ٶõ´Ù.

Âü°íÀÚ·á

¸ñ Â÷:
Ç÷¯±×ÀÎ ±â¹Ý ¾ÆÅ°ÅØÃÄ
Ç÷¯±×ÀÎ ÀÔ¹®
Ç÷¯±×ÀÎ ÀûÇϸñ·Ï ÆÄÀÏ
Ç÷¯±×ÀÎ ¼Ò½º ÄÚµå
Ç÷¯±×ÀÎ ½ÇÇà°ú µð¹ö±×
Ç÷¯±×ÀÎ ÆÐŰ¡
Ç÷¯±×ÀÎ ¹öÀü ¾÷µ¥ÀÌÆ®
Ç÷¯±×ÀÎ Á¶°¢(fragment)°ú Ư¼º(feature)
´ÙÀ½´Ü°è
Âü°í ÀÚ·á
ÇÊÀÚ ¼Ò°³
±â»ç¿¡ ´ëÇÑ Æò°¡
°ü·Ã dW ¸µÅ©:
Eclipse Platform ½ÃÀÛÇϱâ
Plug a Swing-based development tool into Eclipse
Internationalize your Eclipse plug-in
Subscribe to the developerWorks newsletter
US ¿ø¹® Àбâ
Also in the Java zone:
Tutorials
Tools and products
Code and components
Articles
ÇÊÀÚ¼Ò°³
David Gallardo´Â ¼ÒÇÁÆ®¿þ¾î ÄÁ¼³ÅÏÆ®ÀÌÀÚ ±¹Á¦È­, ÀÚ¹Ù À¥ ¾ÖÇø®ÄÉÀ̼Ç, µ¥ÀÌÅͺ£À̽º °³¹ß °ü·Ã ÀÛ°¡ÀÌ´Ù.
ÀÌ ±â»ç¿¡ ´ëÇÏ¿© ¾î¶»°Ô »ý°¢ÇϽʴϱî?

Á¤¸» ÁÁ´Ù (5) ÁÁ´Ù (4) ±×Àú±×·¸´Ù (3) ¼öÁ¤º¸¿ÏÀÌ ÇÊ¿äÇÏ´Ù(2) ÇüÆí¾ø´Ù (1)

  È¸»ç¼Ò°³  |  °³ÀÎÁ¤º¸ º¸È£Á¤Ã¥  |  ¹ý·ü  |  ¹®ÀÇ