/** * 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; }