super.setInput(input);
final ActivitiDiagramEditorInput adei = (ActivitiDiagramEditorInput) input;
final IFile dataFile = adei.getDataFile();
final Bpmn2MemoryModel model = new Bpmn2MemoryModel(getDiagramTypeProvider().getFeatureProvider(), dataFile);
ModelHandler.addModel(EcoreUtil.getURI(getDiagramTypeProvider().getDiagram()), model);
String filePath = dataFile.getLocationURI().getPath();
File bpmnFile = new File(filePath);
try {
if (bpmnFile.exists() == false) {
model.setBpmnModel(new BpmnModel());
model.addMainProcess();
bpmnFile.createNewFile();
dataFile.refreshLocal(IResource.DEPTH_INFINITE, null);
} else {
FileInputStream fileStream = new FileInputStream(bpmnFile);
XMLInputFactory xif = XMLInputFactory.newInstance();
InputStreamReader in = new InputStreamReader(fileStream, "UTF-8");
XMLStreamReader xtr = xif.createXMLStreamReader(in);
BpmnXMLConverter bpmnConverter = new BpmnXMLConverter();
bpmnConverter.setUserTaskFormTypes(PreferencesUtil.getStringArray(Preferences.ALFRESCO_FORMTYPES_USERTASK));
bpmnConverter.setStartEventFormTypes(PreferencesUtil.getStringArray(Preferences.ALFRESCO_FORMTYPES_STARTEVENT));
BpmnModel bpmnModel = bpmnConverter.convertToBpmnModel(xtr);
model.setBpmnModel(bpmnModel);
if (bpmnModel.getLocationMap().size() == 0) {
BpmnAutoLayout layout = new BpmnAutoLayout(bpmnModel);
layout.execute();
}