浙林龙哥

   :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
   id="bbbb"
   name="Bbbb Plug-in"
   version="1.0.0"
   provider-name=""
   class="bbbb.Activator">

   <runtime>
      <library name="bbbb.jar">
         <export name="*"/>
      </library>
   </runtime>

   <requires>
      <import plugin="org.eclipse.ui"/>
      <import plugin="org.eclipse.core.runtime"/>
      <import plugin="org.eclipse.core.resources"/>
      <import plugin="org.eclipse.jface.text"/>
      <import plugin="org.eclipse.ui.editors"/>
      <import plugin="org.eclipse.ui.workbench.texteditor"/>
      <import plugin="org.eclipse.ui.ide"/>
      <import plugin="org.eclipse.ui.intro"/>
      <import plugin="org.eclipse.ui.intro.universal"/>
   </requires>

// 项目的标识,就是出现在package explorer中的项目的图标的变化。BOTTOM_RIGHT是指把Icon加在项目图标的右下角。
   <extension
         point="org.eclipse.ui.decorators">
      <decorator
            lightweight="true"
            location="BOTTOM_RIGHT"
            adaptable="true"
            label="Resource Decorator"
            icon="icons/sample_decorator.gif"
            state="true"
            id="bbbb.decorator">
         <enablement>
            <and>
               <objectClass
                     name="org.eclipse.core.resources.IResource">
               </objectClass>
               <or>
                  <objectClass
                        name="org.eclipse.core.resources.IProject">
                  </objectClass>
                  <objectClass
                        name="org.eclipse.core.resources.IFile">
                  </objectClass>
               </or>
            </and>
         </enablement>
      </decorator>
   </extension>

// 编辑器,选中一个文件,点鼠标右键,Open As,会出现选择哪个编辑器进行编辑。extensions指明了只对哪些扩展名的文件有效。
   <extension
         point="org.eclipse.ui.editors">
      <editor
            name="Sample XML Editor"
            extensions="xml"
            icon="icons/sample.gif"
            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
            class="bbbb.editors.XMLEditor"
            id="bbbb.editors.XMLEditor">
      </editor>
      <editor
            name="Sample Multi-page Editor"
            extensions="mpe"
            icon="icons/sample.gif"
            contributorClass="bbbb.editors.MultiPageEditorContributor"
            class="bbbb.editors.MultiPageEditor"
            id="bbbb.editors.MultiPageEditor">
      </editor>
   </extension>


// 动作,menu定义了一个顶级菜单,action定义了一个动作其中class是指把消息发给哪个类去处理,menubarPath是指挂在哪个菜单下面,label是指在菜单上显示的标题
   <extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="Sample Action Set"
            visible="true"
            id="bbbb.actionSet">
         <menu
               label="Sample &amp;Menu"
               id="sampleMenu">
            <separator
                  name="sampleGroup">
            </separator>
         </menu>
         <action
               label="&amp;Sample Action"
               icon="icons/sample.gif"
               class="bbbb.actions.SampleAction"
               tooltip="Hello, Eclipse world"
               menubarPath="sampleMenu/sampleGroup"
               toolbarPath="sampleGroup"
               id="bbbb.actions.SampleAction">
         </action>
      </actionSet>
   </extension>

// 帮助,这个好懂的
   <extension
         point="org.eclipse.help.toc">
      <toc
            file="toc.xml">
      </toc>
      <toc
            file="testToc.xml"
            primary="true">
      </toc>
   </extension>

// import向导,在Fiel/Import...中,会加入一个我们自己做的向导,以下示例是导入一个文件
   <extension
         point="org.eclipse.ui.importWizards">
      <category
            name="Sample File Import"
            id="bbbb.importWizards.sampleCategory">
      </category>
      <wizard
            name="Import File"
            icon="icons/sample.gif"
            category="bbbb.importWizards.sampleCategory"
            class="bbbb.importWizards.ImportWizard"
            id="bbbb.importWizards.ImportWizard">
         <description>
            Import a file from the local file system into the workspace.
         </description>
      </wizard>
   </extension>

// new向导,在File/New...中,新建一个东西时,会加入一个我们自己做的向导
   <extension
         point="org.eclipse.ui.newWizards">
      <category
            name="Sample Wizards"
            id="bbbb">
      </category>
      <wizard
            name="Multi-page Editor file"
            icon="icons/sample.gif"
            category="bbbb"
            class="bbbb.wizards.SampleNewWizard"
            id="bbbb.wizards.SampleNewWizard">
      </wizard>
   </extension>

// 弹出菜单,menu定义了弹出菜单的样子,action里的class是按下menu后传递消息给这个类,让它执行动作
   <extension
         point="org.eclipse.ui.popupMenus">
      <objectContribution
            objectClass="org.eclipse.core.resources.IFile"
            nameFilter="plugin.xml"
            id="bbbb.contribution1">
         <menu
               label="New Submenu"
               path="additions"
               id="bbbb.menu1">
            <separator
                  name="group1">
            </separator>
         </menu>
         <action
               label="New Action"
               class="bbbb.popup.actions.NewAction"
               menubarPath="bbbb.menu1/group1"
               enablesFor="1"
               id="bbbb.newAction">
         </action>
      </objectContribution>
   </extension>

// preference页设置,在系统菜单[windows/preference...]弹出的对话框中加入
   <extension
         point="org.eclipse.ui.preferencePages">
      <page
            name="Sample Preferences"
            class="bbbb.preferences.SamplePreferencePage"
            id="bbbb.preferences.SamplePreferencePage">
      </page>
   </extension>
   <extension
         point="org.eclipse.core.runtime.preferences">
      <initializer
            class="bbbb.preferences.PreferenceInitializer">
      </initializer>
   </extension>

// 在package explorer中右击一个文件,看它的properties时,会在弹出的对话框中加入
   <extension
         point="org.eclipse.ui.propertyPages">
      <page
            objectClass="org.eclipse.core.resources.IFile"
            name="Sample Page"
            nameFilter="*.*"
            class="bbbb.properties.SamplePropertyPage"
            id="bbbb.properties.samplePropertyPage">
      </page>
   </extension>

// 以下这个不明白
   <extension
         point="org.eclipse.ui.intro.configExtension">
      <configExtension
            content="intro/sample.xml"
            configId="org.eclipse.ui.intro.universalConfig">
      </configExtension>
   </extension>

// 增加一个View,在[window/show view -> Other...]中,会加入一个View
   <extension
         point="org.eclipse.ui.views">
      <category
            name="Sample Category"
            id="bbbb">
      </category>
      <view
            name="Sample View"
            icon="icons/sample.gif"
            category="bbbb"
            class="bbbb.views.SampleView"
            id="bbbb.views.SampleView">
      </view>
   </extension>

// 扩展Perspective,以下是在资源perspective中加一个SampleView
   <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="org.eclipse.ui.resourcePerspective">
         <view
               ratio="0.5"
               relative="org.eclipse.ui.views.TaskList"
               relationship="right"
               id="bbbb.views.SampleView">
         </view>
      </perspectiveExtension>
   </extension>

</plugin>



说明:以上都是自己运行程序后想想的,不要当真

posted on 2006-09-23 15:49  浙林龙哥  阅读(1410)  评论(0编辑  收藏  举报