Search in sources :

Example 46 with WorkflowAsset

use of com.centurylink.mdw.plugin.designer.model.WorkflowAsset in project mdw-designer by CenturyLinkCloud.

the class ProjectConfigurator method loadGroovyScriptLibraries.

public void loadGroovyScriptLibraries(IProgressMonitor monitor) {
    // locally save all the groovy libraries
    for (WorkflowAsset asset : project.getTopLevelWorkflowAssets()) {
        if (asset instanceof Script && ((Script) asset).isGroovy()) {
            if (!asset.isLoaded())
                asset.load();
            try {
                IFolder folder = asset.getTempFolder();
                if (!folder.exists())
                    PluginUtil.createFoldersAsNeeded(project.getSourceProject(), folder, monitor);
                IFile tempFile = asset.getTempFile(folder);
                if (tempFile.exists())
                    new TempFileRemover(folder, tempFile).remove(monitor);
                tempFile.create(new ByteArrayInputStream(asset.getFileContent()), true, monitor);
                PluginMessages.log("Created groovy lib file: " + tempFile.getFullPath().toString());
            } catch (CoreException ex) {
                PluginMessages.uiError(ex, "Load Groovy Libraries", project);
            }
        }
    }
}
Also used : Script(com.centurylink.mdw.plugin.designer.model.Script) TempFileRemover(com.centurylink.mdw.plugin.workspace.TempFileRemover) IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) ByteArrayInputStream(java.io.ByteArrayInputStream) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)46 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)17 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)15 ArrayList (java.util.ArrayList)13 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)8 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)8 IFile (org.eclipse.core.resources.IFile)8 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)7 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)6 File (java.io.File)6 IOException (java.io.IOException)6 CoreException (org.eclipse.core.runtime.CoreException)6 IEditorPart (org.eclipse.ui.IEditorPart)5 DesignerProxy (com.centurylink.mdw.plugin.designer.DesignerProxy)4 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)4 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)4 List (java.util.List)4 IFolder (org.eclipse.core.resources.IFolder)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)3