Search in sources :

Example 1 with Convert

use of com.centurylink.mdw.cli.Convert in project mdw-designer by CenturyLinkCloud.

the class ConvertPropertiesToYaml method run.

@SuppressWarnings("restriction")
public void run(IAction action) {
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        if (structuredSelection.getFirstElement() instanceof IFile) {
            final IFile inputFile = (IFile) structuredSelection.getFirstElement();
            final WorkflowProject project = WorkflowProjectManager.getInstance().getWorkflowProject(inputFile.getProject().getName());
            BusyIndicator.showWhile(MdwPlugin.getActiveWorkbenchWindow().getShell().getDisplay(), new Runnable() {

                public void run() {
                    try {
                        Convert convert = new Convert(inputFile.getRawLocation().makeAbsolute().toFile());
                        convert.setConfigLoc(inputFile.getParent().getRawLocation().makeAbsolute().toFile().getAbsolutePath());
                        convert.run();
                        inputFile.getParent().refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
                    } catch (Exception ex) {
                        PluginMessages.uiError(shell, ex, "Convert Application Properties", project);
                    }
                }
            });
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) Convert(com.centurylink.mdw.cli.Convert) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

Convert (com.centurylink.mdw.cli.Convert)1 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)1 IFile (org.eclipse.core.resources.IFile)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1