eclipse插件开发:创建向导和导航器配置
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.newWizards">
<category id="my.project" name="我的业务向导"></category>
<wizard
project="true"
category="my.project"
class="com.langsotech.studio.crueTest.wizard.MyProjectWizard4web"
icon="icons/p_2.png"
id="com.langsotech.studio.crueTest.wizard.MyProjectWizard4web"
name="CRUD测试工程向导">
</wizard>
</extension>
<!--======================================================================================-->
<!-- 创建项目(菜单) -->
<!--======================================================================================-->
<extension point="org.eclipse.ui.popupMenus">
<viewerContribution
id="com.langsotech.studio.crueTest"
targetID="com.langsotech.studio.crueTest.views.navigator">
<action
id="com.langsotech.studio.crueTest.action"
label="创建项目"
style="push"
menubarPath="common.new.menu"
icon="icons/p_2.png"
class="com.langsotech.studio.crueTest.wizard.CreateNewWizardAction">
</action>
</viewerContribution>
</extension>
<!--======================================================================================-->
<!-- 自定义视图 -->
<!--======================================================================================-->
<extension
point="org.eclipse.ui.views">
<category
id="com.langsotech.studio"
name="业务开发">
</category>
<view
category="com.langsotech.studio"
class="com.langsotech.studio.crueTest.views.MyJCommonNavigator"
icon="icons/p_2.png"
id="com.langsotech.studio.crueTest.views.navigator"
name="CRUD测试项目管理视图"
restorable="true">
</view>
</extension>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
label="CRUD测试项目管理视图"
visible="true"
id="com.langsotech.studio.crueTest.myView.actionSet">
<menu
label="项目管理视图"
id="myView4navigator">
<separator
name="myViewGroup">
</separator>
</menu>
<action
label="CRUD测试项目管理视图"
icon="icons/p_2.png"
class="com.langsotech.studio.crueTest.views.Action4OpenView"
tooltip="CRUD测试项目管理视图"
menubarPath="myView4navigator/myViewGroup"
toolbarPath="myViewGroup"
id="com.langsotech.studio.crueTest.views.Action4OpenView">
</action>
</actionSet>
</extension>
<!--======================================================================================-->
<!-- 自定义视图(viewerId - 匹配 org.eclipse.ui.views 扩展名中提供的标识的id) -->
<!--======================================================================================-->
<extension point="org.eclipse.ui.navigator.viewer">
<viewer viewerId="com.langsotech.studio.crueTest.views.navigator"></viewer>
<!--内容-->
<viewerContentBinding viewerId="com.langsotech.studio.crueTest.views.navigator">
<includes>
<contentExtension pattern="com.langsotech.studio.wizard.providers.Models"></contentExtension>
<contentExtension pattern="com.langsotech.studio.wizard.providers.JavaModelContent"></contentExtension>
<contentExtension pattern="org.eclipse.ui.navigator.resourceContent"></contentExtension>
<contentExtension pattern="org.eclipse.ui.navigator.resources.filters.*"></contentExtension>
<contentExtension pattern="org.eclipse.ui.navigator.resources.filters.endsWithClass"></contentExtension>
<contentExtension pattern="org.eclipse.ui.navigator.resources.WorkingSetActions"></contentExtension>
<contentExtension pattern="com.langsotech.studio.crueTest.filter.MyShowHideFilter"></contentExtension>
<!-- 关联编辑器和导航器,实现文件在导航器的定位 -->
<contentExtension pattern="org.eclipse.ui.navigator.resources.linkHelper"></contentExtension>
</includes>
</viewerContentBinding>
<!--平台提供的动作-->
<viewerActionBinding viewerId="com.langsotech.studio.crueTest.views.navigator">
<includes>
<!--<actionExtension pattern="com.langsotech.studio.crueTest.wizard.actions.EditActions"></actionExtension> -->
<actionExtension pattern="org.eclipse.ui.navigator.resources.OpenActions"></actionExtension>
<actionExtension pattern="org.eclipse.ui.navigator.resources.PortingActions"></actionExtension>
<actionExtension pattern="org.eclipse.ui.navigator.resources.WorkManagementActionProvider"></actionExtension>
<actionExtension pattern="org.eclipse.ui.navigator.resources.ResourceMgmtActions"></actionExtension>
<actionExtension pattern="org.eclipse.ui.navigator.resources.PropertiesActionProvider"></actionExtension>
<actionExtension pattern="org.eclipse.ui.navigator.resources.WorkingSetActions"></actionExtension>
</includes>
<excludes>
<actionExtension
pattern="org.eclipse.ui.navigator.resources.actions.EditActions">
</actionExtension>
</excludes>
</viewerActionBinding>
<!--自定义的动作-->
<viewerActionBinding viewerId="com.langsotech.studio.crueTest.views.navigator">
<includes>
<actionExtension pattern="com.langsotech.studio.crueTest.menu.MyCommonNavigatorNewActionProvider"></actionExtension>
</includes>
</viewerActionBinding>
</extension>
<!--======================================================================================-->
<!-- 自定义viewer显示修饰(更改文件夹、文件图片) -->
<!--======================================================================================-->
<extension point="org.eclipse.ui.decorators">
<decorator
id="com.langsotech.studio.crueTest.navigator.decorator"
label="my Decorator"
state="true"
class="com.langsotech.studio.crueTest.views.MyLabelDecorator">
<enablement>
<or>
<objectClass name="org.eclipse.core.resources.IFile"/>
<objectClass name="org.eclipse.core.resources.IFolder"/>
</or>
</enablement>
</decorator>
</extension>
<!--======================================================================================-->
<!-- 文件夹和对应类的适配,目的为了右键改文件夹的时,可以出现不同的菜单 -->
<!--======================================================================================-->
<extension point="org.eclipse.core.runtime.adapters">
<factory adaptableType="org.eclipse.core.resources.IFolder" class="com.langsotech.studio.crueTest.views.adapters.JAdapterFactory">
<adapter type="com.langsotech.studio.crueTest.model.Src"></adapter>
<adapter type="com.langsotech.studio.crueTest.model.WebContent"></adapter>
</factory>
</extension>
<!--======================================================================================-->
<!-- 过滤 id="com.langsotech.studio.wizard.navigatorFilters.HideSourceFolders" -->
<!-- 和org.eclipse.ui.navigator.viewer扩展点里面的内容显示过滤条件 -->
<!-- com.langsotech.studio.wizard.navigatorFilters. 匹配 -->
<!--======================================================================================-->
<extension point="org.eclipse.ui.navigator.navigatorContent">
<actionProvider class="com.langsotech.studio.crueTest.menu.MyCommonNavigatorNewActionProvider"
id="com.langsotech.studio.crueTest.menu.MyCommonNavigatorNewActionProvider" overrides="org.eclipse.ui.navigator.resources.NewActions"
priority="normal">
<enablement>
<or>
<!--===============================================================================================-->
<!-- 设置右键菜单,这些配置的目的 是什么文件夹对象要被挂上右键菜单 -->
<!--===============================================================================================-->
<adapt type="com.langsotech.studio.crueTest.model.Src"></adapt>
<adapt type="com.langsotech.studio.crueTest.model.WebContent"></adapt>
<adapt type="org.eclipse.core.resources.IResource"></adapt>
</or>
</enablement>
</actionProvider>
<!--======================================================================================-->
<!-- 自定义的文件夹的对应模型 -->
<!--======================================================================================-->
<!--======================================================================================-->
<!-- 工程自带的文件夹的对应模型 -->
<!--======================================================================================-->
<commonWizard menuGroupId="_src" type="new" wizardId="org.eclipse.ui.wizards.new.file">
<enablement>
<adapt type="com.langsotech.studio.crueTest.model.Src"></adapt>
</enablement>
</commonWizard>
<commonWizard menuGroupId="_src" type="new" wizardId="org.eclipse.ui.wizards.new.folder">
<enablement>
<adapt type="com.langsotech.studio.crueTest.model.Src"></adapt>
</enablement>
</commonWizard>
<commonWizard menuGroupId="_src" type="new" wizardId="org.eclipse.jdt.ui.wizards.NewPackageCreationWizard">
<enablement>
<adapt type="com.langsotech.studio.crueTest.model.Src"></adapt>
</enablement>
</commonWizard>
<commonWizard menuGroupId="_src" type="new" wizardId="org.eclipse.jdt.ui.wizards.NewClassCreationWizard">
<enablement>
<adapt type="com.langsotech.studio.crueTest.model.Src"></adapt>
</enablement>
</commonWizard>
<commonWizard menuGroupId="_src" type="new" wizardId="org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard">
<enablement>
<adapt type="com.langsotech.studio.crueTest.model.Src"></adapt>
</enablement>
</commonWizard>
<commonWizard menuGroupId="_webContent" type="new" wizardId="org.eclipse.ui.wizards.new.folder">
<enablement>
<adapt type="com.langsotech.studio.crueTest.model.WebContent"></adapt>
</enablement>
</commonWizard>
<commonWizard menuGroupId="_webContent" type="new" wizardId="org.eclipse.ui.wizards.new.file">
<enablement>
<adapt type="com.langsotech.studio.crueTest.model.WebContent"></adapt>
</enablement>
</commonWizard>
<!-- 过滤显示 -->
<commonFilter
activeByDefault="true"
class="com.langsotech.studio.crueTest.filter.MyShowHideFilter"
description=""
id="com.langsotech.studio.crueTest.filter.MyShowHideFilter"
name="folder file filter">
</commonFilter>
</extension>
<!--======================================================================================-->
<!-- 定义工程的性质,目的在于我们的工程管理视图可以过滤其他工程不被显示出来 -->
<!--======================================================================================-->
<extension id="projectnature" name="jProjectNature" point="org.eclipse.core.resources.natures">
<runtime>
<run class="com.langsotech.studio.navigator.base.wizard.ProjectNature"></run>
</runtime>
</extension>
</plugin>