@Override
  public IToolBehaviorProvider[] getAvailableToolBehaviorProviders() {
    if (toolBehaviorProviders == null) {
      DefaultBPMN2Editor editor = (DefaultBPMN2Editor) getDiagramEditor();
      TargetRuntime rt = editor.getTargetRuntime();
      IConfigurationElement[] config =
          Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.UI_EXTENSION_ID);
      Bpmn2ToolBehaviorProvider provider = null;
      try {
        for (IConfigurationElement e : config) {
          if (e.getName().equals("toolProvider")) { // $NON-NLS-1$
            String id = e.getAttribute("id"); // $NON-NLS-1$
            String runtimeId = e.getAttribute("runtimeId"); // $NON-NLS-1$
            if (rt != null && rt.getId().equals(runtimeId)) {
              String className = e.getAttribute("class"); // $NON-NLS-1$
              ClassLoader cl = rt.getRuntimeExtension().getClass().getClassLoader();
              Constructor ctor = null;
              Class providerClass = Class.forName(className, true, cl);
              ctor = providerClass.getConstructor(IDiagramTypeProvider.class);
              provider = (Bpmn2ToolBehaviorProvider) ctor.newInstance(this);
              break;
            }
          }
        }
      } catch (Exception ex) {
        Activator.logError(ex);
      }

      if (provider == null) provider = new Bpmn2ToolBehaviorProvider(this);
      toolBehaviorProviders = new IToolBehaviorProvider[] {provider};
    }
    return toolBehaviorProviders;
  }
 /**
  * Returns the Java class that implements a Work Item Editor dialog for the given BaseElement if
  * the WID file defines one.
  *
  * @param baseElement
  * @return a Work Item Editor dialog class or null if the BaseElement is not a custom task
  *     (defined by a WID file) or if the WID file does declare a "eclipse:customEditor" class.
  *     <p>TODO: make this return an object instance and make sure it implements the {@code
  *     WorkEditor} interface.
  */
 public static WorkEditor getWorkItemEditor(BaseElement baseElement) {
   String customTaskId = CustomElementFeatureContainer.findId(baseElement);
   TargetRuntime rt = TargetRuntime.getRuntime(baseElement);
   JBPM5RuntimeExtension rte = (JBPM5RuntimeExtension) rt.getRuntimeExtension();
   WorkItemDefinition wid = ((JBPM5RuntimeExtension) rte).getWorkItemDefinition(customTaskId);
   if (wid != null) {
     String customEditor = wid.getEclipseCustomEditor();
     if (customEditor != null && !customEditor.isEmpty()) {
       try {
         Resource res = ExtendedPropertiesAdapter.getResource(baseElement);
         URI uri = res.getURI();
         IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(uri.segment(1));
         JavaProjectClassLoader cl = new JavaProjectClassLoader(project);
         if (cl != null) {
           return new SampleCustomEditor(Display.getDefault().getActiveShell());
         }
       } catch (Exception ignore) {
       }
     }
   }
   return null;
 }