jBPM-Designer的不完全汉化

http://dapeng1525.iteye.com/blog/179909

前些天,在群JBPM Inside(25496693)里和AM大哥请教了关于jBPM-Designer的汉化问题,在AM大哥的耐心指导和帮助下,我完成了对其不完全的汉化。在此,非常感谢AM大哥的热心和耐心,谢谢!

  好了,下面就开始汉化了:

  一、推荐论坛内的系列文章fndcz的jBPM学习(一)至(八),本文重点涉及(六)中的插件安装部分。

  二、打开目录jbpm-starters-kit-3.1.4\jbpm-designer\jbpm-gpd-feature\eclipse\plugins,找到Jar包org.jbpm.gd.jpdl.ui_3.0.13.jar,修改里面的plugin.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
   
     <extension-point id="graphElements" name="Graph Element Extensions" schema="schema/graphElements.exsd"/>
   <extension-point id="editPolicies" name="Edit Policy Extensions" schema="schema/editPolicies.exsd"/>
   
  <extension point = "org.eclipse.ui.editors">
    <editor
          class="org.jbpm.ui.editor.DesignerEditor"
          contributorClass="org.jbpm.ui.editor.DesignerEditorActionBarContributor" 
          icon="icons/full/obj16/par_obj.gif"
          id="org.jbpm.ui.editor.DesignerEditor"
          matchingStrategy="org.jbpm.ui.editor.DesignerEditorMatchingStrategy"
          name="jBPM Graphical Process Designer">
        <contentTypeBinding contentTypeId="org.jbpm.gd.jpdl.ui.jpdl" /> 
        <contentTypeBinding contentTypeId="org.jbpm.gd.jpdl.ui.jpdl-gi" /> 
    </editor>
    <editor
          class="org.jbpm.ui.pageflow.editor.PageFlowEditor"
          contributorClass="org.jbpm.ui.pageflow.editor.PageFlowEditorActionBarContributor" 
          icon="icons/full/obj16/par_obj.gif"
          id="org.jbpm.ui.pageflow.editor.PageFlowEditor"
          matchingStrategy="org.jbpm.ui.pageflow.editor.PageFlowEditorMatchingStrategy"
          name="jBPM Pageflow Designer">
        <contentTypeBinding contentTypeId="org.jbpm.gd.jpdl.ui.pf" /> 
        <contentTypeBinding contentTypeId="org.jbpm.gd.jpdl.ui.pf-gi" /> 
    </editor> 
  </extension> 
  	
  <extension point="org.eclipse.core.runtime.contentTypes">
  	<content-type id="jpdl-gi" 	name="jpdl-gi"
		base-type="org.eclipse.core.runtime.xml"
		default-charset="UTF-8">
		<describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
			<parameter name="element" value="process-diagram"/>
		</describer>
	</content-type>
  	<content-type id="jpdl" 	name="jpdl"
		base-type="org.eclipse.core.runtime.xml"
		default-charset="UTF-8">
		<describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
			<parameter name="element" value="process-definition"/>
		</describer>
	</content-type>
  	<content-type id="pf-gi" 	name="pf-gi"
		base-type="org.eclipse.core.runtime.xml"
		default-charset="UTF-8">
		<describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
			<parameter name="element" value="pageflow-diagram"/>
		</describer>
	</content-type>
  	<content-type id="pf" 	name="pf"
		base-type="org.eclipse.core.runtime.xml"
		default-charset="UTF-8">
		<describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
			<parameter name="element" value="pageflow-definition"/>
		</describer>
	</content-type>
  </extension>  
  
  <extension point="org.eclipse.ui.popupMenus">
    <objectContribution id="org.jbpm.ui.addActions"
        objectClass="org.jbpm.ui.part.GraphElementEditPart">
      <filter
            name="canAddActions"
            value="true"/>
      <action
        class="org.jbpm.ui.action.AddActionDelegate"
        id="addAction"
        label="增加动作"
        menubarPath="org.eclipse.gef.group.edit"
        tooltip="Add an Action">
      </action>
    </objectContribution>
    <objectContribution id="org.jbpm.ui.addProcessEvents"
    	objectClass="org.jbpm.ui.part.GraphElementEditPart">
      <filter
            name="canAddProcessEvents"
            value="true"/>
    	<action
           class="org.jbpm.ui.action.AddActionDelegate"
           id="processEnd"
           label="流程结束"
           menubarPath="org.jbpm.ui.popup.addActions/additions"
           tooltip="增加一个Process End Action">
    	</action>
    	<action
           class="org.jbpm.ui.action.AddActionDelegate"
           id="processStart"
           label="流程开始"
           menubarPath="org.jbpm.ui.popup.addActions/additions"
           tooltip="增加一个Process Start Action">
    	</action>
    </objectContribution>
    <objectContribution id="org.jbpm.ui.addNodeEvents"
    	objectClass="org.jbpm.ui.part.GraphElementEditPart">
      <filter
            name="canAddNodeEvents"
            value="true"/>
     <menu
     	id="org.jbpm.ui.popup.addActions"
     	label="增加动作"
     	path="org.eclipse.gef.group.edit">
     	<separator name="additions" />
     </menu>
    	<action
           class="org.jbpm.ui.action.AddActionDelegate"
           id="nodeLeave"
           label="离开节点"
           menubarPath="org.jbpm.ui.popup.addActions/additions"
           tooltip="增加一个Node Leave Action">
    	</action>
    	<action
           class="org.jbpm.ui.action.AddActionDelegate"
           id="nodeEnter"
           label="进入节点"
           menubarPath="org.jbpm.ui.popup.addActions/additions"
           tooltip="增加一个Node Enter Action">
    	</action>
    	<action
           class="org.jbpm.ui.action.AddActionDelegate"
           id="afterSignal"
           label="提交信令后"
           menubarPath="org.jbpm.ui.popup.addActions/additions"
           tooltip="增加一个After Signal Action">
    	</action>
    	<action
           class="org.jbpm.ui.action.AddActionDelegate"
           id="beforeSignal"
           label="提交信令前"
           menubarPath="org.jbpm.ui.popup.addActions/additions"
           tooltip="增加一个Before Signal Action">
    	</action>
    </objectContribution>
    <objectContribution id="org.jbpm.ui.tasknode"
    	objectClass="org.jbpm.ui.part.GraphElementEditPart">
      <filter
            name="nodeTagEqualsTo"
            value="task-node"/> 
    	<action
           class="org.jbpm.ui.action.AddTaskDelegate"
           id="addTask"
           label="增加任务"
           menubarPath="org.eclipse.gef.group.edit"
           tooltip="增加一个Task">
    	</action>
    </objectContribution>
    <objectContribution id="org.jbpm.ui.startstate"
    	objectClass="org.jbpm.ui.part.GraphElementEditPart">
      <filter
            name="nodeTagEqualsTo"
            value="start-state"/> 
      <filter
            name="canAddTasks"
            value="true"/>
    	<action
           class="org.jbpm.ui.action.AddTaskDelegate"
           id="addTask"
           label="增加动作"
           menubarPath="org.eclipse.gef.group.edit"
           tooltip="增加一个Task">
    	</action>
    </objectContribution>
    <objectContribution
          adaptable="false"
          id="org.jbpm.ui.graphElement"
          objectClass="org.jbpm.ui.part.GraphElementEditPart">
       <filter
             name="nodeTagDifferentFrom"
             value="event"/>  
       <action
             class="org.jbpm.ui.action.PropertyDialogActionDelegate"
             id="properties"
             label="属性..."
             menubarPath="org.eclipse.gef.group.edit"
             tooltip="编辑图形元素的属性"/>
    </objectContribution>
  </extension>
  
   <extension
         point="org.eclipse.ui.newWizards">
      <category
            name="JBoss jBPM"
            id="org.jbpm.ui">
      </category>
      <category
            name="JBoss Seam"
            id="org.jboss.seam">
      </category> 
      <wizard
            name="过程定义"
            icon="icons/full/obj16/process16.gif"
            category="org.jbpm.ui"
            class="org.jbpm.ui.wizard.NewProcessDefinitionWizard"
            id="org.jbpm.ui.wizard.new.file">
         <description>
            向导:创建一个流程图
         </description>
         <selection
               class="org.eclipse.core.resources.IResource">
         </selection>
      </wizard>
      <wizard
            name="Page Flow"
            icon="icons/full/obj16/page.gif"
            category="org.jboss.seam"
            class="org.jbpm.ui.pageflow.wizard.NewPageFlowWizard"
            id="org.jboss.seam.ui.wizard.new.pageflow">
         <description>
            A wizard that creates a pageflow
         </description>
         <selection
               class="org.eclipse.core.resources.IResource">
         </selection>
      </wizard> 
      <wizard
            name="过程项目"
            icon="icons/full/obj16/process16.gif"
            category="org.jbpm.ui"
            class="org.jbpm.ui.wizard.NewProcessProjectWizard"
            id="org.jbpm.ui.wizard.new.project"
            project="true" >
         <description>
            向导:创建一个新jBPM项目
         </description>
         <selection
               class="org.eclipse.core.resources.IResource">
         </selection>
      </wizard>
   </extension>
   <extension
         point="org.jbpm.gd.jpdl.ui.graphElements">
      <graphElement
            name="transition"
            contributor="org.jbpm.ui.contributor.TransitionContributor">
         <entry
               category="org.jbpm.palette.3.BasicConnectionTools"
               id="org.jbpm.ui.palette.1.Transition"
               label="转移"
               tooltip="创建一个Transition"
               type="connection"/>
      </graphElement>
      <graphElement
            name="start-state"
            contributor="org.jbpm.ui.contributor.StartStateContributor">
         <entry
               category="org.jbpm.palette.1.BasicNodeTools"
               id="org.jbpm.ui.palette.1.StartState"
               label="开始"
               tooltip="创建一个Start节点"
               type="node"/>
      </graphElement>
      <graphElement
            name="state"
            contributor="org.jbpm.ui.contributor.StateContributor">
         <entry
               category="org.jbpm.palette.1.BasicNodeTools"
               id="org.jbpm.ui.palette.2.State"
               label="状态"
               tooltip="创建一个State节点"
               type="node"/>
      </graphElement>
      <graphElement
            name="end-state"
            contributor="org.jbpm.ui.contributor.EndStateContributor">
         <entry
               category="org.jbpm.palette.1.BasicNodeTools"
               id="org.jbpm.ui.palette.3.EndState"
               label="结束"
               tooltip="创建一个End节点"
               type="node"/>
      </graphElement>
      <graphElement
            name="fork"
            contributor="org.jbpm.ui.contributor.ForkContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.1.Fork"
               label="分支"
               tooltip="创建一个Fork节点"
               type="node"/>
      </graphElement>
      <graphElement
             name="join"
            contributor="org.jbpm.ui.contributor.JoinContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.2.Join"
               label="合并"
               tooltip="创建一个Join"
               type="node"/>
      </graphElement>
      <graphElement
            name="decision"
            contributor="org.jbpm.ui.contributor.DecisionContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.3.Decision"
               label="决策点"
               tooltip="创建一个Decision"
               type="node"/>
      </graphElement>
      <graphElement
            name="page"
            contributor="org.jbpm.ui.contributor.PageContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.35.Page"
               label="页"
               tooltip="创建一个Page"
               type="node"/>
      </graphElement>
      <graphElement
            name="start-page"
            contributor="org.jbpm.ui.contributor.StartPageContributor">
         <entry
               category="org.jbpm.palette.1.BasicNodeTools"
               id="org.jbpm.ui.palette.1.StartPage"
               label="开始"
               tooltip="创建一个Start page"
               type="node"/>
      </graphElement>
      <graphElement
            name="task-node"
            contributor="org.jbpm.ui.contributor.TaskNodeContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.4.TaskNode"
               label="任务节点"
               tooltip="创建一个Task Node"
               type="node"/>
      </graphElement>
      <graphElement
            name="process-state"
            contributor="org.jbpm.ui.contributor.ProcessStateContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.5.ProcessState"
               label="子流程"
               tooltip="创建一个Process State"
               type="node"/>
      </graphElement>
      <graphElement
            name="super-state"
            contributor="org.jbpm.ui.contributor.SuperStateContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.6.SuperState"
               label="Super State"
               tooltip="Creates a Super State"
               type="node"/>
      </graphElement>
      <graphElement
            name="node"
            contributor="org.jbpm.ui.contributor.NodeContributor">
         <entry
               category="org.jbpm.palette.2.AdvancedNodeTools"
               id="org.jbpm.ui.palette.4.Node"
               label="节点"
               tooltip="创建一个Node"
               type="node"/>
      </graphElement>
      <graphElement
            name="action"
            contributor="org.jbpm.ui.contributor.ActionContributor"/>
      <graphElement  
            name="event"
            contributor="org.jbpm.ui.contributor.EventContributor"/>
      <graphElement  
            name="task"
            contributor="org.jbpm.ui.contributor.TaskContributor"/>
      <graphElement  
            name="swimlane"
            contributor="org.jbpm.ui.contributor.SwimlaneContributor"/>
      <graphElement 
            name="process-definition"
            contributor="org.jbpm.ui.contributor.ProcessDefinitionContributor"/>
      <graphElement 
            name="pageflow-definition"
            contributor="org.jbpm.ui.contributor.ProcessDefinitionContributor"/>
      <graphElement
            contributor="org.jbpm.ui.contributor.TransitionLabelContributor"
            name="transitionLabel"/>
      <graphElement
            contributor="org.jbpm.ui.contributor.TaskListContributor"
            name="taskList"/>
   </extension>
   <extension
         point="org.eclipse.jdt.core.classpathContainerInitializer">
      <classpathContainerInitializer
            class="org.jbpm.ui.util.JbpmClasspathContainerInitializer"
            id="JBPM"/>
   </extension>
   
   <extension
         point="org.eclipse.ui.preferencePages">
      <page
            class="org.jbpm.ui.prefs.MainPage"
            id="org.jbpm.ui.prefs.main"
            name="JBoss jBPM"/>
      <page
            class="org.jbpm.ui.prefs.JbpmLocationsPage"
            id="org.jbpm.ui.prefs.jbpmLocations"
            name="运行时位置"
            category="org.jbpm.ui.prefs.main"/>
      <page
            class="org.jbpm.ui.prefs.ServerDeploymentPage"
            id="org.jbpm.ui.prefs.deployment"
            name="服务器部署"
            category="org.jbpm.ui.prefs.main"/>
   </extension>
   
   <extension point="org.eclipse.ui.propertyPages"> 
        <page 
            id="org.jbpm.ui.GraphElementGeneralPage" 
            name="普通设置" 
            objectClass="org.jbpm.ui.model.GraphElement" 
            class="org.jbpm.ui.properties.GraphElementGeneralPropertyPage"> 
        </page> 
        <page 
            id="org.jbpm.ui.TaskAssignmentPage" 
            name="分配" 
            objectClass="org.jbpm.ui.model.Task" 
            class="org.jbpm.ui.properties.TaskAssignmentPropertyPage"> 
        </page> 
        <page 
            id="org.jbpm.ui.TaskControllerPage" 
            name="变量" 
            objectClass="org.jbpm.ui.model.Task" 
            class="org.jbpm.ui.properties.TaskControllerPropertyPage"> 
        </page> 
        <page 
            id="org.jbpm.ui.TaskAdvancedPage" 
            name="高级设置" 
            objectClass="org.jbpm.ui.model.Task" 
            class="org.jbpm.ui.properties.TaskAdvancedPropertyPage"> 
        </page> 
        <page 
            id="org.jbpm.ui.ActionHandlerPage" 
            name="处理人" 
            objectClass="org.jbpm.ui.model.Action" 
            class="org.jbpm.ui.properties.ActionHandlerPropertyPage"> 
        </page> 
        <page
              class="org.jbpm.ui.properties.NodeActionPropertyPage"
              id="org.jbpm.ui.NodeActionPage"
              name="处理人"
              objectClass="org.jbpm.ui.model.Node">
           <filter
                 name="nodeTagEqualsTo"
                 value="node"/> 
        </page> 
    </extension>
   <extension
         point="org.jbpm.gd.jpdl.ui.editPolicies">
      <editPolicy
            id="org.jbpm.ui.tree.GraphElementComponentEditPolicy"
            part="org.jbpm.ui.part.tree.ElementTreeEditPart"
            policy="org.jbpm.ui.policy.GraphElementComponentEditPolicy"
            role="ComponentEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.tree.ProcessDefinitionComponentEditPolicy"
            part="org.jbpm.ui.part.tree.ProcessDefinitionTreeEditPart"
            policy="org.jbpm.ui.policy.ProcessDefinitionComponentEditPolicy"
            role="ComponentEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.tree.NodeComponentEditPolicy"
            part="org.jbpm.ui.part.tree.NodeTreeEditPart"
            policy="org.jbpm.ui.policy.NodeComponentEditPolicy"
            role="ComponentEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.NodeComponentEditPolicy"
            part="org.jbpm.ui.part.graph.NodeGraphicalEditPart"
            policy="org.jbpm.ui.policy.NodeComponentEditPolicy"
            role="ComponentEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.NodeGraphicalNodeEditPolicy"
            part="org.jbpm.ui.part.graph.NodeGraphicalEditPart"
            policy="org.jbpm.ui.policy.NodeGraphicalNodeEditPolicy"
            role="GraphicalNodeEditPolciy"/>
      <editPolicy
            id="org.jbpm.ui.NodeDirectEditPolicy"
            part="org.jbpm.ui.part.graph.NodeGraphicalEditPart"
            policy="org.jbpm.ui.policy.NodeDirectEditPolicy"
            role="DirectEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.TransitionConnectionEndpointsEditPolicy"
            part="org.jbpm.ui.part.graph.TransitionGraphicalEditPart"
            policy="org.jbpm.ui.policy.TransitionConnectionEndpointsEditPolicy"
            role="Connection Endpoint Policy"/>
      <editPolicy
            id="org.jbpm.ui.TransitionConnectionEditPolicy"
            part="org.jbpm.ui.part.graph.TransitionGraphicalEditPart"
            policy="org.jbpm.ui.policy.TransitionConnectionEditPolicy"
            role="ConnectionEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.TransitionConnectionBendpointEditPolicy"
            part="org.jbpm.ui.part.graph.TransitionGraphicalEditPart"
            policy="org.jbpm.ui.policy.TransitionConnectionBendpointEditPolicy"
            role="Connection Bendpoint Policy"/>
      <editPolicy
            id="org.jbpm.ui.ProcessDefinitionXYLayoutEditPolicy"
            part="org.jbpm.ui.part.graph.ProcessDefinitionGraphicalEditPart"
            policy="org.jbpm.ui.policy.ProcessDefinitionXYLayoutEditPolicy"
            role="LayoutEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.TransitionLabelGraphicalNodeEditPolicy"
            part="org.jbpm.ui.part.graph.TransitionLabelGraphicalEditPart"
            policy="org.jbpm.ui.policy.TransitionLabelGraphicalNodeEditPolicy"
            role="GraphicalNodeEditPolciy"/>
      <editPolicy
            id="org.jbpm.ui.TransitionLabelDirectEditPolicy"
            part="org.jbpm.ui.part.graph.TransitionLabelGraphicalEditPart"
            policy="org.jbpm.ui.policy.TransitionLabelDirectEditPolicy"
            role="DirectEditPolicy"/>
      <editPolicy
            id="org.jbpm.ui.TaskSelectionFeedbackEditPolicy"
            part="org.jbpm.ui.part.graph.TaskGraphicalEditPart"
            policy="org.jbpm.ui.policy.TaskSelectionFeedbackEditPolicy"
            role="Selection Feedback"/>
   </extension> 

</plugin>



三、打开Eclipse,找到菜单Help->Software Updates->Manage Configuration,打到相应插件,Disable一下,然后再Enable一下。

四、汉化效果如下:
jBPM-Designer的不完全汉化_第1张图片

五、对于其他版本的Designer,如果想对其进行不完全汉化的话,都可以通过修改Plugin.xml的方式来汉化,如果想进行完全的彻底的汉化,那就得改源码了。

  六、再次感谢AM大哥,谢谢您!

  七、由于我的技术基础很差,希望各位能多提宝贵意见,把您悟出的一些东西和大家分享一下,最好能详细地讲述一下这其中的技术原理和细节!谢谢!

  八、附件是包含了修改后的plugin.xml文件的Jar包。

  九、帖子写了两遍,第一次保存未成功,全部内容丢失,望各位引以为鉴!:(

下载: http://dl.iteye.com/topics/download/413cc0ad-8067-3ad3-85ef-ed1047c41524

你可能感兴趣的:(design)