Search in sources :

Example 91 with WizardDialog

use of org.eclipse.jface.wizard.WizardDialog in project tesb-studio-se by Talend.

the class ExportServiceAction method doRun.

@Override
protected void doRun() {
    try {
        if (!isAllOperationsAssignedJob(serviceItem)) {
            boolean isContinue = MessageDialog.openQuestion(shell, Messages.ExportServiceAction_noJobDialogTitle, Messages.ExportServiceAction_noJobDialogMsg);
            if (!isContinue) {
                return;
            }
        }
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    ServiceExportWizard processWizard = new ServiceExportWizard(serviceItem);
    IWorkbench workbench = getWorkbench();
    processWizard.setWindowTitle(EXPORT_SERVICE_LABEL);
    WizardDialog dialog = new WizardDialog(shell, processWizard);
    workbench.saveAllEditors(true);
    dialog.open();
}
Also used : ServiceExportWizard(org.talend.repository.services.ui.ServiceExportWizard) IWorkbench(org.eclipse.ui.IWorkbench) PersistenceException(org.talend.commons.exception.PersistenceException) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 92 with WizardDialog

use of org.eclipse.jface.wizard.WizardDialog in project tesb-studio-se by Talend.

the class NewAssignJobAction method doRun.

@Override
protected void doRun() {
    AssignJobWizard assignJobWizard = new AssignJobWizard(assignJobAction, newJobAction);
    WizardDialog wizardDialog = new AssignJobWizardDialog(getWorkbench().getActiveWorkbenchWindow().getShell(), assignJobWizard);
    wizardDialog.open();
}
Also used : AssignJobWizardDialog(org.talend.repository.services.ui.assign.AssignJobWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) AssignJobWizardDialog(org.talend.repository.services.ui.assign.AssignJobWizardDialog) AssignJobWizard(org.talend.repository.services.ui.assign.AssignJobWizard)

Example 93 with WizardDialog

use of org.eclipse.jface.wizard.WizardDialog in project sling by apache.

the class ExportContentAction method run.

private void run(ISelection selection) {
    if (!(selection instanceof IStructuredSelection)) {
        return;
    }
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    for (Iterator<?> it = structuredSelection.iterator(); it.hasNext(); ) {
        Object selected = it.next();
        if (selected instanceof IResource) {
            IResource resource = (IResource) selected;
            Shell activeShell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
            ExportWizard wiz = new ExportWizard();
            if (resource instanceof IProject) {
                resource = ProjectUtil.getSyncDirectory((IProject) resource);
            }
            wiz.init(PlatformUI.getWorkbench(), resource);
            WizardDialog dialog = new WizardDialog(activeShell, wiz);
            dialog.open();
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IResource(org.eclipse.core.resources.IResource) IProject(org.eclipse.core.resources.IProject)

Example 94 with WizardDialog

use of org.eclipse.jface.wizard.WizardDialog in project bndtools by bndtools.

the class BndEditor method doAutoResolveOnSave.

private void doAutoResolveOnSave(IProgressMonitor monitor) {
    final Shell shell = getEditorSite().getShell();
    final IFile file = ResourceUtil.getFile(getEditorInput());
    if (file == null) {
        MessageDialog.openError(shell, "Resolution Error", "Unable to run resolution because the file is not in the workspace. NB.: the file will still be saved.");
        reallySave(monitor);
        return;
    }
    // Create resolver job and pre-validate
    final ResolveJob job = new ResolveJob(model);
    IStatus validation = job.validateBeforeRun();
    if (!validation.isOK()) {
        String message = "Unable to run the resolver. NB.: the file will still be saved.";
        ErrorDialog.openError(shell, "Resolution Validation Problem", message, validation, IStatus.ERROR | IStatus.WARNING);
        reallySave(monitor);
        return;
    }
    // Add operation to perform at the end of resolution (i.e. display
    // results and actually save the file)
    final UIJob completionJob = new UIJob(shell.getDisplay(), "Display Resolution Results") {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
            ResolutionResult result = job.getResolutionResult();
            ResolutionWizard wizard = new ResolutionWizard(model, file, result);
            if (result.getOutcome() != ResolutionResult.Outcome.Resolved) /*|| !result.getResolve().getOptionalResources().isEmpty() */
            {
                WizardDialog dialog = new WizardDialog(shell, wizard);
                if (dialog.open() != Window.OK) {
                    if (!wizard.performFinish()) {
                        MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                    }
                }
            } else {
                if (!wizard.performFinish()) {
                    MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                }
            }
            reallySave(monitor);
            return Status.OK_STATUS;
        }
    };
    job.addJobChangeListener(new JobChangeAdapter() {

        @Override
        public void done(IJobChangeEvent event) {
            completionJob.schedule();
        }
    });
    // Start job
    job.setUser(true);
    job.schedule();
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IFile(org.eclipse.core.resources.IFile) ResolutionWizard(org.bndtools.core.resolve.ui.ResolutionWizard) ResolutionResult(org.bndtools.core.resolve.ResolutionResult) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) ResolveJob(org.bndtools.core.resolve.ResolveJob) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) Shell(org.eclipse.swt.widgets.Shell) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) UIJob(org.eclipse.ui.progress.UIJob) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 95 with WizardDialog

use of org.eclipse.jface.wizard.WizardDialog 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);
        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

WizardDialog (org.eclipse.jface.wizard.WizardDialog)115 ISelection (org.eclipse.jface.viewers.ISelection)26 Shell (org.eclipse.swt.widgets.Shell)26 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)25 IWorkbench (org.eclipse.ui.IWorkbench)14 IRepositoryNode (org.talend.repository.model.IRepositoryNode)13 RepositoryNode (org.talend.repository.model.RepositoryNode)13 IPath (org.eclipse.core.runtime.IPath)12 IStatus (org.eclipse.core.runtime.IStatus)10 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)10 IFile (org.eclipse.core.resources.IFile)9 Status (org.eclipse.core.runtime.Status)7 PartInitException (org.eclipse.ui.PartInitException)7 ArrayList (java.util.ArrayList)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 Composite (org.eclipse.swt.widgets.Composite)6 CoreException (org.eclipse.core.runtime.CoreException)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 File (java.io.File)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4