Search in sources :

Example 1 with RunExportSelectionWizard

use of bndtools.wizards.bndfile.RunExportSelectionWizard in project bndtools by bndtools.

the class ExportAction method run.

@Override
public void run() {
    if (configElems == null || configElems.length == 0)
        return;
    if (editor.isDirty()) {
        if (MessageDialog.openConfirm(parentShell, "Export", "The editor content must be saved before exporting. Save now?")) {
            try {
                editor.getSite().getWorkbenchWindow().run(false, false, new IRunnableWithProgress() {

                    @Override
                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        editor.doSave(monitor);
                    }
                });
            } catch (Exception e) {
                ErrorDialog.openError(parentShell, "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error during save.", e));
                return;
            }
        } else {
            return;
        }
    }
    IFile targetResource = ResourceUtil.getFile(editor.getEditorInput());
    try {
        Run run = LaunchUtils.createRun(targetResource, Mode.EXPORT);
        RunExportSelectionWizard wizard = new RunExportSelectionWizard(configElems, model, run);
        WizardDialog dialog = new WizardDialog(parentShell, wizard);
        dialog.open();
        LaunchUtils.endRun(run);
    } catch (Exception e) {
        ErrorDialog.openError(parentShell, "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error deriving Bnd project.", e));
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IFile(org.eclipse.core.resources.IFile) RunExportSelectionWizard(bndtools.wizards.bndfile.RunExportSelectionWizard) Run(aQute.bnd.build.Run) WizardDialog(org.eclipse.jface.wizard.WizardDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

Run (aQute.bnd.build.Run)1 RunExportSelectionWizard (bndtools.wizards.bndfile.RunExportSelectionWizard)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IFile (org.eclipse.core.resources.IFile)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1