Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

SOA/BPMN Modeler/Hiding the property tabs


Maybe you are one of those developers like me, who wants to take control of the standard property tabs of the BPMN modeler. I'm developing an RCP application and the "Advanced" tab contains too much information and reaches to deep into the model, so I have to remove it. The Advanced tab

But doing customization in the modeler itself would force me to make my changes available to everyone. Just removing one tab isn't important enough for making a patch out of it. So Antoine pointed me to a good way of making it on my side of the code.

This is how it works: First you want to make your own editor by subclassing the BpmnDiagramEditor class in the org.eclipse.stp.bpmn.diagram.part package. You might follow the instructions in the EclipseCon2008 tutorial in order to get your own editor. After you have subclassed the BpmnDiagramEditor, you have to make your own ID and override the public String getContributorId() method to make it return your own editor ID.

public class BugBpmnEditor extends BpmnDiagramEditor {
 
    public static final String ID = "org.eclipse.stp.bpmn.sample.bugeditor.editor";
 
    static {
 
        PlatformUI.getWorkbench().getEditorRegistry().
            setDefaultEditor("*.bpmn_diagram", ID); //$NON-NLS-1$
    }
 
    public String getContributorId() {
        return ID;
    }
}

(Code taken from the EclipseCon2008 tutorial)

If you open a diagram with your own editor you might notice that all properties are missing. Now we have control over all tabs to be shown or not. If you have taken the EclipseCon2007 tutorial you might notice, that even your participant tab is missing. Now change the contributorId in the extension points (all 3) from "org.eclipse.gmf.runtime.diagram.ui.properties" to your editor ID, start your application, open a diagram with your own editor and you will see: Your tab is back. The new contributor extension point:

   <extension
         point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
      <propertyContributor
            contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
         <propertyCategory category="Participants"/>
      </propertyContributor>
   </extension>

The new tab definition:

<extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
      <propertyTabs contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
         <propertyTab
               category="Participants"
               id="Participants"
               indented="false"
               label="Participants"/>
      </propertyTabs>
    </extension>

The new section definition:

    <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
      <propertySections contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
         <propertySection
               class="org.eclipse.stp.samples.eclipsecon2007.participant.properties.ParticipantPropertySection"
               id="ParticipantsSection"
               tab="Participants">
            <input type="org.eclipse.stp.bpmn.Activity"/>
            <input type="java.lang.Object"/>
         </propertySection>
      </propertySections>
    </extension>

To add the "Appearance" and the "Rulers & Grid" tabs you have to add the set of propertyContributor, propertySections and propertyTabs to the extensions and set (like above for the EclipsCon2007 tutorial) the contributorId to the one of your own editor and the classes for the propertySection to "org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection" for the "Appearance" tab and "org.eclipse.gmf.runtime.diagram.ui.properties.sections.grid.RulerGridPropertySection" for the "Rulers & Grid" tab. (listing see below)

To add the "Annotation" tab just copy the extensions from org.eclipse.stp.bpmn.diagram plugin.xml and change the contributorId to the one of your own editor.

Now you have all the tabs you know from the standard BPMN modeler minus the "Advanced" tab and you have the total control over the ones you would like to show up.

The "Appearance" tab extension points:

 <extension
       point="org.eclipse.ui.views.properties.tabbed.propertySections">
    <propertySections
          contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
       <propertySection
             class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection"
             id="Appearance"
             tab="Appearance">
          <input
                type="java.lang.Object">
          </input>
       </propertySection>
    </propertySections>
 </extension>
 <extension
       point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
    <propertyTabs
          contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
       <propertyTab
             category="Appearance"
             id="Appearance"
             indented="false"
             label="Appearance">
       </propertyTab>
    </propertyTabs>
 </extension>
 <extension
       point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
    <propertyContributor
          contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
       <propertyCategory
             category="Appearance"></propertyCategory>
    </propertyContributor>
 </extension>


The "Ruler & Grid" tab extension points:

 <extension
       point="org.eclipse.ui.views.properties.tabbed.propertySections">
    <propertySections
          contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
       <propertySection
             class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.grid.RulerGridPropertySection"
             id="Ruler &amp; Grid"
             tab="Ruler &amp; Grid">
          <input
                type="java.lang.Object">
          </input>
       </propertySection>
    </propertySections>
 </extension>
 <extension
       point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
    <propertyTabs
          contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
       <propertyTab
             category="Ruler &amp; Grid"
             id="Ruler &amp; Grid"
             label="Ruler &amp; Grid">
       </propertyTab>
    </propertyTabs>
 </extension>
 <extension
       point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
    <propertyContributor
          contributorId="org.eclipse.stp.bpmn.sample.bugeditor.editor">
       <propertyCategory
             category="Ruler &amp; Grid">
       </propertyCategory>
    </propertyContributor>
 </extension>

Back to the top