private String projectName;
public ProcessInstanceTabItem(CTabFolder folder, String processInstanceId, String processId, List<String> nodeIds, String projectName) {
this.projectName = projectName;
tabItem = new CTabItem(folder, SWT.NONE);
ProcessInfo processInfo = DroolsEclipsePlugin.getDefault().getProcessInfo(processId);
if (processInfo == null) {
throw new IllegalArgumentException(
"Could not find process with id " + processId);
}
tabItem.setText(processInstanceId + " = " + processInfo.getProcess().getName() + "[" + processInfo.getProcessId() + "]");
Composite composite = new Composite(folder, SWT.NONE);
composite.setLayout(new FillLayout());
tabItem.setControl(composite);
graphicalViewer = new ScrollingGraphicalViewer();
graphicalViewer.createControl(composite);
graphicalViewer.getControl().setBackground(ColorConstants.listBackground);
graphicalViewer.setRootEditPart(new ScalableRootEditPart());
IJavaProject javaProject = getJavaProject(projectName);
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] extensions =
reg.getConfigurationElementsFor(
"org.drools.eclipse.processExtension");
for (IConfigurationElement element: extensions) {
try {
ProcessExtension processExtension = (ProcessExtension)
element.createExecutableExtension("className");
Process process = (Process) processInfo.getProcess();
if (processExtension.acceptsProcess(process.getType())) {
ProcessEditPartFactory editPartFactory = processExtension.getProcessEditPartFactory();
editPartFactory.setProject(javaProject);
graphicalViewer.setEditPartFactory(editPartFactory);
ProcessWrapper processWrapper = processExtension.getProcessWrapperBuilder().getProcessWrapper(process, javaProject);