Search in sources :

Example 1 with Script

use of com.centurylink.mdw.plugin.designer.model.Script 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

Script (com.centurylink.mdw.plugin.designer.model.Script)1 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)1 TempFileRemover (com.centurylink.mdw.plugin.workspace.TempFileRemover)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IFile (org.eclipse.core.resources.IFile)1 IFolder (org.eclipse.core.resources.IFolder)1 CoreException (org.eclipse.core.runtime.CoreException)1