eclipse插件之plugin.xml

时间:2023-01-20 16:21:24

plugin.xml是什么?略去不提……


1. "org.eclipse.ui.perspectives"

写法:

   <extension  point="org.eclipse.ui.perspectives">
      <perspective
            class="a.b.c.MyPerspective"
            icon="icon/myperspective.gif"
            id="a.b.c.MyPerspective"
            name="%Perspective.name"/>
   </extension>


a.b.c.MyPerspective:一个实现了IPerspectiveFactory接口的类。

"%Perspective.name": 写在 plugin.properties 中的属性,用于eclipse的perspectives菜单的显示


2. "org.eclipse.ui.perspectiveExtensions"

写法:

<extension
         point="org.eclipse.ui.perspectiveExtensions">
               <perspectiveExtension
            targetID="a.b.c.MyPerspective">
         <view
               closeable="true"
               id="a.b.c.MyNavigator"
               moveable="true"
               ratio="0.25f"
               relationship="left"
               relative="org.eclipse.ui.editorss"
               showTitle="true"
               standalone="false"
               visible="true">
         </view>
         <view
               closeable="true"
               id="org.eclipse.ui.views.ContentOutline"
               moveable="true"
               ratio="0.5f"
               relationship="bottom"
               relative="a.b.c.MyNavigator"
               showTitle="true"
               standalone="false">
        </view>
        <view
               closeable="true"
               id="a.b.c.MyPropertiesView"
               moveable="true"
               ratio="0.5f"
               relationship="bottom"
               relative="org.eclipse.ui.editorss"
               showTitle="true"
               standalone="false"
               visible="true">
         </view>
  		<view
               closeable="true"
               id="org.eclipse.ui.views.ProblemView"
               moveable="true"
               relationship="bottom"
               relative="a.b.c.MyPropertiesView"
               showTitle="true"
               standalone="false"
               visible="true">
         </view>
    <view
          closeable="true"
          id="org.eclipse.ui.console.ConsoleView"
          moveable="true"
          relationship="stack"
          relative="org.eclipse.ui.views.ProblemView"
          showTitle="true"
          standalone="true"
          visible="true">
    </view>
    <actionSet
          id="a.b.c.MyActionSet">
    </actionSet>
    <perspectiveShortcut
          id="a.b.c.MyPerspective">
    </perspectiveShortcut>
    <perspectiveShortcut
          id="org.eclipse.jdt.ui.JavaPerspective">
    </perspectiveShortcut>
    <viewShortcut
          id="a.b.c.MyNavigator">
    </viewShortcut>
    <viewShortcut
          id="org.eclipse.ui.views.ContentOutline">
    </viewShortcut>
    <viewShortcut
          id="org.eclipse.ui.views.ProblemView">
    </viewShortcut>
    <viewShortcut
          id="org.eclipse.ui.console.ConsoleView">
    </viewShortcut>
    <viewShortcut
          id="a.b.c.MyPropertiesView">
    </viewShortcut>
         
      </perspectiveExtension>
   </extension>

a.b.c.MyNavigator:继承ViewPart

3. "org.eclipse.ui.editors"

写法:

<extension
         point="org.eclipse.ui.editors">
      <editor
            class="a.b.c.MyEditor"
            contributorClass="a.b.c.MyEditorActionBarContributor"
            icon="icon/<span style="font-family: Arial, Helvetica, sans-serif;">MyEditor</span><span style="font-family: Arial, Helvetica, sans-serif;">.gif"</span>
            id="a.b.c.MyEditor"
            name="%Editor.me"/>
   </extension>

"a.b.c.MyEditor":继承EditorPart
"a.b.c.MyEditorActionBarContributor" :继承<span style="font-family: Arial, Helvetica, sans-serif;">ActionBarContributor</span>

4. "org.eclipse.ui.newWizards"

写法:

    <extension
         name="%Perspective.name"
         point="org.eclipse.ui.newWizards">
      <category
            id="a.b.c.MyCategory"
            name="%Perspective.name">
      </category>
      <wizard
            category="a.b.c.MyCategory"
            class="a.b.c.MyNewProjectWizard"
            finalPerspective="a.b.c.MyPerspective"
            icon="icon/xxx.gif"
            id="a.b.c.MyNewProjectWizard"
            name="%Project.me"
            preferredPerspectives="a.b.c.MyPerspective"
            project="true">
         <description>
            %<span style="font-family: Arial, Helvetica, sans-serif;">MyNewProjectWizard</span>.description
         </description>
      </wizard>
   </extension>   
"a.b.c.MyNewProjectWizard" : 继承<span style="font-family: Arial, Helvetica, sans-serif;">Wizard ,INewWizard,</span><span style="font-family: Arial, Helvetica, sans-serif;">IExecutableExtension </span>

5. "org.eclipse.ui.views"

写法:

<extension
         point="org.eclipse.ui.views">
      <category
            id="a.b.c.MyViewCategory"
            name="%Category.view">
      </category>
      <view
            category="a.b.c.MyViewCategory"
            class="a.b.c.MyNavigator"
            icon="icon/xxx.gif"
            id="a.b.c.MyNavigator"
            name="%Navigator.view"  >
      </view>
      
       <view
             category=<span style="font-family: Arial, Helvetica, sans-serif;">"a.b.c.MyViewCategory"</span>
             class="a.b.c.MyPropertiesView"
             icon="icon/xxx.gif"
             id="a.b.c.MyPropertiesView"
             name="%Properties.view">
      </view>
   </extension>

6."org.eclipse.core.resources.natures"

写法:

   <extension
         id="a.b.c.nature"
         name="%Nature.me"
         point="org.eclipse.core.resources.natures">
      <runtime>
         <run class="a.b.c.MyProject"/>
      </runtime>
      <builder id="a.b.c.MyBuilder"/>
   </extension>
"a.b.c.MyProject":继承IProjectNature
<pre name="code" class="html">
 


7."org.eclipse.core.resources.builders"

写法:

   <extension
         id="a.b.c.MyBuilder"
         name="My Project Builder"
         point="org.eclipse.core.resources.builders">
      <builder hasNature="false">
         <run class="a.b.c.MyProjectBuilder"/>
      </builder>
   </extension>
"a.b.c.MyProjectBuilder":继承IncrementalProjectBuilder


8. "org.eclipse.core.resources.markers"

写法:

   <extension
         id="a.b.c.MyMarker"
         name="My Project Marker"
         point="org.eclipse.core.resources.markers">
      <super type="org.eclipse.core.resources.problemmarker"/>
      <super type="org.eclipse.core.resources.textmarker"/>
      <persistent value="true"/>
   </extension>


9."org.eclipse.ui.console.consoleFactories"

写法:

      <extension
            point="org.eclipse.ui.console.consoleFactories">
         <consoleFactory
               class="a.b.c.MyConsoleFactory"
               icon="icon/xxx.gif"
               label="%Console.view">
         </consoleFactory>
      </extension>
"a.b.c.MyConsoleFactory": 继承IConsoleFactory


10."org.eclipse.ui.actionSets"

写法:

      <extension
            point="org.eclipse.ui.actionSets">
         <actionSet
               id="a.b.c.MyActionSet"
               label="My ActionSet"
               visible="false">
            <menu
                  id="a.b.c.MyMenu"
                  label="%Menu.me">
               <separator
                     name="a.b.c.MySeparator">
               </separator>
            </menu>
            <action
                  allowLabelUpdate="true"
                  class="a.b.c.MyAction1"
                  disabledIcon="icon/xxx.gif"
                  icon="icon/xxx.gif"
                  id="a.b.c.MyAction1"
                  label="%Menu.action1"
                  menubarPath="a.b.c.MyMenu/a.b.c.MySeparator"
                  retarget="false"
                  style="push"
                  tooltip="%Menu.tip.<span style="font-family: Arial, Helvetica, sans-serif;">action1</span><span style="font-family: Arial, Helvetica, sans-serif;">"></span>
            </action>
         </actionSet>
      </extension>

11."org.eclipse.ui.propertyPages"

写法:

      <extension
            point="org.eclipse.ui.propertyPages">
         <page
               class="a.b.c.MyPropertyPage"
               id="a.b.c.MyPropertyPage"
               name="%Property.name">
            <enabledWhen>
               <instanceof
                     value="a.b.c.MyValue">
               </instanceof>
            </enabledWhen>
         </page>
      </extension>