Search in sources :

Example 6 with BusinessProcess

use of org.talend.designer.business.model.business.BusinessProcess in project tdi-studio-se by Talend.

the class SaveAsBusinessModelWizard method performFinish.

public boolean performFinish() {
    boolean ok = false;
    try {
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        DiagramResourceManager diagramResourceManager = new DiagramResourceManager(page, new NullProgressMonitor());
        file = diagramResourceManager.createDiagramFile();
        isUpdate = isUpdate();
        if (isUpdate) {
            update();
        } else {
            property.setId(repositoryFactory.getNextId());
            diagramResourceManager.updateFromResource(businessProcessItem, file);
            BusinessProcess businessProcess = BusinessFactory.eINSTANCE.createBusinessProcess();
            businessProcessItem.setSemantic(businessProcess);
            // don't set these values directly
            // businessProcessItem.setSemantic(oldItem.getSemantic());
            // businessProcessItem.setNotation(oldItem.getNotation());
            // businessProcessItem.setNotationHolder(oldItem.getNotationHolder());
            repositoryFactory.create(businessProcessItem, mainPage.getDestinationPath());
        }
        ok = true;
    } catch (Exception e) {
        MessageDialog.openError(getShell(), "Error", "Business model could not be saved" + " : " + e.getMessage());
        ExceptionHandler.process(e);
    }
    return ok;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) CoreException(org.eclipse.core.runtime.CoreException) PersistenceException(org.talend.commons.exception.PersistenceException) BusinessProcess(org.talend.designer.business.model.business.BusinessProcess)

Aggregations

BusinessProcess (org.talend.designer.business.model.business.BusinessProcess)6 Diagram (org.eclipse.gmf.runtime.notation.Diagram)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ExecutionException (org.eclipse.core.commands.ExecutionException)2 CoreException (org.eclipse.core.runtime.CoreException)2 EObject (org.eclipse.emf.ecore.EObject)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 EditPart (org.eclipse.gef.EditPart)2 DiagramEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart)2 IEditorPart (org.eclipse.ui.IEditorPart)2 BusinessItem (org.talend.designer.business.model.business.BusinessItem)2 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 IFile (org.eclipse.core.resources.IFile)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1