Example usage for org.eclipse.jface.dialogs ProgressMonitorDialog close

List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog close

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs ProgressMonitorDialog close.

Prototype

@Override
public boolean close() 

Source Link

Document

The ProgressMonitorDialog implementation of this method only closes the dialog if there are no currently running runnables.

Usage

From source file:org.eclipse.scada.configuration.generator.ui.AbstractFileRunner.java

License:Open Source License

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final List<IFile> files = SelectionHelper.list(getSelection(), IFile.class);

    final ProgressMonitorDialog dlg = new ProgressMonitorDialog(getShell());

    dlg.open();//w w w. j  a  v  a  2s.c  om

    try {
        ModalContext.run(new IRunnableWithProgress() {

            @Override
            public void run(final IProgressMonitor monitor)
                    throws InvocationTargetException, InterruptedException {

                try {
                    monitor.beginTask("Running generator", files.size());
                    for (final IFile file : files) {
                        final SubProgressMonitor sub = new SubProgressMonitor(monitor, 1);
                        try {
                            runFile(file, sub);
                        } catch (final Exception e) {
                            throw new InvocationTargetException(e);
                        } finally {
                            sub.done();
                        }
                    }
                } finally {
                    monitor.done();
                }
            }

        }, true, dlg.getProgressMonitor(), getShell().getDisplay());
    } catch (final Exception e) {
        e.printStackTrace();
        ErrorDialog.openError(getShell(), null, null, StatusHelper.convertStatus(Activator.PLUGIN_ID, e));
    } finally {
        dlg.close();
    }

    return null;
}

From source file:org.eclipse.sirius.ui.tools.internal.actions.export.AbstractExportRepresentationsAction.java

License:Open Source License

/**
 * Display the export path and file format dialog and then export the
 * representations./*from ww  w  . j  a v a 2s . com*/
 * 
 * @param exportPath
 *            the default export path.
 * @param dRepresentationToExport
 *            the representation to export.
 * @param session
 *            the corresponding session.
 */
protected void exportRepresentation(IPath exportPath, Iterable<DRepresentation> dRepresentationToExport,
        Session session) {
    final Shell shell = Display.getCurrent().getActiveShell();

    final AbstractExportRepresentationsAsImagesDialog dialog;
    if (Iterables.size(dRepresentationToExport) > 1) {
        dialog = new ExportSeveralRepresentationsAsImagesDialog(shell, exportPath);
    } else {
        dialog = new ExportOneRepresentationAsImageDialog(shell, exportPath,
                dRepresentationToExport.iterator().next().getName());
    }

    if (dialog.open() == Window.OK) {
        List<DRepresentation> toExport = Lists.<DRepresentation>newArrayList(dRepresentationToExport);
        final ExportAction exportAction = new ExportAction(session, toExport, dialog.getOutputPath(),
                dialog.getImageFormat(), dialog.isExportToHtml());
        final ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
        try {
            pmd.run(false, false, exportAction);
        } catch (final InvocationTargetException e) {
            MessageDialog.openError(shell, "Error", e.getTargetException().getMessage());
        } catch (final InterruptedException e) {
            MessageDialog.openInformation(shell, "Cancelled", e.getMessage());
        } finally {
            pmd.close();
        }
    } else {
        dialog.close();
    }
}

From source file:org.eclipse.sirius.ui.tools.internal.actions.export.ExportRepresentationsFromFileAction.java

License:Open Source License

/**
 * {@inheritDoc}//from  w w w .  j a v  a  2s  .  c o m
 * 
 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
 */
public void run(final IAction action) {

    final Shell shell = Display.getCurrent().getActiveShell();
    final IPath targetPath = this.sessionResourceFile.getParent().getLocation();
    final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(),
            true);
    Session session = SessionManager.INSTANCE.getSession(sessionResourceURI,
            new SubProgressMonitor(new NullProgressMonitor(), 1));

    final Collection<DRepresentation> dRepresentationsToExportAsImage = DialectManager.INSTANCE
            .getAllRepresentations(session);
    if (!dRepresentationsToExportAsImage.isEmpty()) {
        final ExportSeveralRepresentationsAsImagesDialog dialog = new ExportSeveralRepresentationsAsImagesDialog(
                shell, targetPath);
        if (dialog.open() == Window.CANCEL) {
            dialog.close();
            return;
        }

        final IPath outputPath = dialog.getOutputPath();
        final ImageFileFormat imageFormat = dialog.getImageFormat();
        final boolean exportToHtml = dialog.isExportToHtml();

        IRunnableWithProgress exportAllRepresentationsRunnable = new WorkspaceModifyOperation() {

            @Override
            protected void execute(IProgressMonitor monitor)
                    throws CoreException, InvocationTargetException, InterruptedException {
                Session session = null;
                boolean isOpen = false;
                try {
                    monitor.beginTask("Export all representations to images", 10);
                    session = SessionManager.INSTANCE.getSession(sessionResourceURI,
                            new SubProgressMonitor(monitor, 1));
                    isOpen = session.isOpen();
                    if (!isOpen) {
                        session.open(new SubProgressMonitor(monitor, 1));
                    }

                    ExportAction exportAction = new ExportAction(session, dRepresentationsToExportAsImage,
                            outputPath, imageFormat, exportToHtml);
                    exportAction.run(new SubProgressMonitor(monitor, 7));

                } finally {
                    if (!isOpen && session != null) {
                        session.close(new SubProgressMonitor(monitor, 1));
                    }
                    monitor.done();
                }
            }
        };

        final ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
        try {
            pmd.run(false, false, exportAllRepresentationsRunnable);
        } catch (final InvocationTargetException e) {
            SiriusEditPlugin.getPlugin().getLog()
                    .log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e));
            MessageDialog.openError(shell, "Error", e.getTargetException().getMessage());
        } catch (final InterruptedException e) {
            SiriusEditPlugin.getPlugin().getLog()
                    .log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e));
            MessageDialog.openInformation(shell, "Cancelled", e.getMessage());
        } finally {
            pmd.close();

        }
    } else {
        MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Export representations",
                "The selected session do not contain any representation to export.");
    }

}

From source file:org.eclipse.ui.internal.dialogs.WorkbenchEditorsDialog.java

License:Open Source License

/**
 * Saves the specified editors// w  w w.  j  a  va2  s . c om
 */
private void saveItems(TableItem items[]) {
    if (items.length == 0) {
        return;
    }
    ProgressMonitorDialog pmd = new ProgressMonitorJobsDialog(getShell());
    pmd.open();
    for (int i = 0; i < items.length; i++) {
        Adapter editor = (Adapter) items[i].getData();
        editor.save(pmd.getProgressMonitor());
        updateItem(items[i], editor);
    }
    pmd.close();
    updateItems();
}

From source file:org.eclipse.wst.server.ui.internal.RuntimePreferencePage.java

License:Open Source License

/**
 * Create the preference options./*from  ww  w  .java  2 s . co m*/
 *
 * @param parent org.eclipse.swt.widgets.Composite
 * @return org.eclipse.swt.widgets.Control
 */
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ContextIds.PREF_GENERAL);

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
    layout.verticalSpacing = convertVerticalDLUsToPixels(3);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    composite.setLayoutData(data);

    Label label = new Label(composite, SWT.WRAP);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    label.setText(Messages.preferenceRuntimesDescription);

    label = new Label(composite, SWT.WRAP);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data.horizontalSpan = 2;
    data.verticalIndent = 5;
    label.setLayoutData(data);
    label.setText(Messages.preferenceRuntimesTable);

    runtimeComp = new RuntimeComposite(composite, SWT.NONE, new RuntimeComposite.RuntimeSelectionListener() {
        public void runtimeSelected(IRuntime runtime) {
            if (runtime == null) {
                edit.setEnabled(false);
                remove.setEnabled(false);
                pathLabel.setText("");
            } else {
                IStatus status = runtime.validate(new NullProgressMonitor());
                if (status != null && status.getSeverity() == IStatus.ERROR) {
                    Color c = pathLabel.getDisplay().getSystemColor(SWT.COLOR_RED);
                    pathLabel.setForeground(c);
                    pathLabel.setText(status.getMessage());
                } else if (runtime.getLocation() != null) {
                    pathLabel.setForeground(edit.getForeground());
                    pathLabel.setText(runtime.getLocation() + "");
                } else
                    pathLabel.setText("");

                if (runtime.isReadOnly()) {
                    edit.setEnabled(false);
                    remove.setEnabled(false);
                } else {
                    if (runtime.getRuntimeType() != null)
                        edit.setEnabled(ServerUIPlugin.hasWizardFragment(runtime.getRuntimeType().getId()));
                    else
                        edit.setEnabled(false);
                    remove.setEnabled(true);
                }
            }
        }
    });
    runtimeComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));

    Composite buttonComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(3);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    buttonComp.setLayout(layout);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    buttonComp.setLayoutData(data);

    Button add = SWTUtil.createButton(buttonComp, Messages.add);
    final RuntimeComposite runtimeComp2 = runtimeComp;
    add.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (showWizard(null) == Window.CANCEL)
                return;
            runtimeComp2.refresh();
        }
    });

    edit = SWTUtil.createButton(buttonComp, Messages.edit);
    edit.setEnabled(false);
    edit.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IRuntime runtime = runtimeComp2.getSelectedRuntime();
            if (runtime != null) {
                IRuntimeWorkingCopy runtimeWorkingCopy = runtime.createWorkingCopy();
                if (showWizard(runtimeWorkingCopy) != Window.CANCEL) {
                    try {
                        runtimeComp2.refresh(runtime);
                    } catch (Exception ex) {
                        // ignore
                    }
                }
            }
        }
    });

    remove = SWTUtil.createButton(buttonComp, Messages.remove);
    remove.setEnabled(false);
    remove.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IRuntime runtime = runtimeComp.getSelectedRuntime();
            if (removeRuntime(runtime))
                runtimeComp2.remove(runtime);
        }
    });

    Button search = SWTUtil.createButton(buttonComp, Messages.search);
    data = (GridData) search.getLayoutData();
    data.verticalIndent = 9;
    search.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            try {
                // select a target directory for the search
                DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
                directoryDialog.setMessage(Messages.dialogRuntimeSearchMessage);
                directoryDialog.setText(Messages.dialogRuntimeSearchTitle);

                String pathStr = directoryDialog.open();
                if (pathStr == null)
                    return;

                final IPath path = new Path(pathStr);

                final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
                dialog.setBlockOnOpen(false);
                dialog.setCancelable(true);
                dialog.open();
                final IProgressMonitor monitor = dialog.getProgressMonitor();
                final IRuntimeLocator[] locators = ServerPlugin.getRuntimeLocators();
                monitor.beginTask(Messages.dialogRuntimeSearchProgress, 100 * locators.length + 10);
                final List<IRuntimeWorkingCopy> list = new ArrayList<IRuntimeWorkingCopy>();

                final IRuntimeLocator.IRuntimeSearchListener listener = new IRuntimeLocator.IRuntimeSearchListener() {
                    public void runtimeFound(final IRuntimeWorkingCopy runtime) {
                        dialog.getShell().getDisplay().syncExec(new Runnable() {
                            public void run() {
                                monitor.subTask(runtime.getName());
                            }
                        });
                        list.add(runtime);
                    }
                };

                IRunnableWithProgress runnable = new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor2) {
                        int size = locators.length;
                        for (int i = 0; i < size; i++) {
                            if (!monitor2.isCanceled())
                                try {
                                    locators[i].searchForRuntimes(path, listener, monitor2);
                                } catch (CoreException ce) {
                                    if (Trace.WARNING) {
                                        Trace.trace(Trace.STRING_WARNING,
                                                "Error locating runtimes: " + locators[i].getId(), ce);
                                    }
                                }
                        }
                        if (Trace.INFO) {
                            Trace.trace(Trace.STRING_INFO, "Done search");
                        }
                    }
                };
                dialog.run(true, true, runnable);

                if (Trace.FINER) {
                    Trace.trace(Trace.STRING_FINER, "Found runtimes: " + list.size());
                }

                if (!monitor.isCanceled()) {
                    if (list.isEmpty()) {
                        EclipseUtil.openError(getShell(), Messages.infoNoRuntimesFound);
                        return;
                    }
                    monitor.worked(5);
                    if (Trace.FINER) {
                        Trace.trace(Trace.STRING_FINER, "Removing duplicates");
                    }
                    List<IRuntime> good = new ArrayList<IRuntime>();
                    Iterator iterator2 = list.iterator();
                    while (iterator2.hasNext()) {
                        boolean dup = false;
                        IRuntime wc = (IRuntime) iterator2.next();

                        IRuntime[] runtimes = ServerCore.getRuntimes();
                        if (runtimes != null) {
                            int size = runtimes.length;
                            for (int i = 0; i < size; i++) {
                                if (runtimes[i].getLocation() != null
                                        && runtimes[i].getLocation().equals(wc.getLocation()))
                                    dup = true;
                            }
                        }
                        if (!dup)
                            good.add(wc);
                    }
                    monitor.worked(5);

                    if (Trace.FINER) {
                        Trace.trace(Trace.STRING_FINER, "Adding runtimes: " + good.size());
                    }
                    Iterator iterator = good.iterator();
                    while (iterator.hasNext()) {
                        IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) iterator.next();
                        wc.save(false, monitor);
                    }
                    monitor.done();
                }
                dialog.close();
            } catch (Exception ex) {
                if (Trace.SEVERE) {
                    Trace.trace(Trace.STRING_SEVERE, "Error finding runtimes", ex);
                }
            }
            runtimeComp2.refresh();
        }
    });

    Button columnsButton = SWTUtil.createButton(buttonComp, Messages.actionColumns);
    data = (GridData) columnsButton.getLayoutData();
    final RuntimePreferencePage thisClass = this;
    columnsButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ConfigureColumns.forTable(runtimeComp.getTable(), thisClass);
        }
    });

    pathLabel = new Label(parent, SWT.NONE);
    pathLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.zest.examples.cloudio.application.actions.LoadFileAction.java

License:Open Source License

@Override
public void run(IAction action) {
    FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);

    dialog.setText("Select text file...");
    String sourceFile = dialog.open();
    if (sourceFile == null)
        return;/*from   ww w.j  a  v a2 s .  co  m*/
    ProgressMonitorDialog pd = new ProgressMonitorDialog(getShell());
    try {
        List<Type> types = TypeCollector.getData(new File(sourceFile), "UTF-8");
        pd.setBlockOnOpen(false);
        pd.open();
        pd.getProgressMonitor().beginTask("Generating cloud...", 200);
        TagCloudViewer viewer = getViewer();
        viewer.setInput(types, pd.getProgressMonitor());
        viewer.getCloud().layoutCloud(pd.getProgressMonitor(), false);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        pd.close();
    }
}

From source file:org.eclipse.zest.examples.cloudio.application.ui.TagCloudViewPart.java

License:Open Source License

private void createSideTab(SashForm form) {
    Composite parent = new Composite(form, SWT.NONE);
    parent.setLayout(new GridLayout());
    parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    options = new CloudOptionsComposite(parent, SWT.NONE, viewer) {

        protected Group addLayoutButtons(Composite parent) {
            Group buttons = super.addLayoutButtons(parent);

            Label l = new Label(buttons, SWT.NONE);
            l.setText("X Axis Variation");
            final Combo xAxis = new Combo(buttons, SWT.DROP_DOWN | SWT.READ_ONLY);
            xAxis.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
            xAxis.setItems(new String[] { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" });
            xAxis.select(2);//from ww  w. j a  v  a 2 s .  c  om
            xAxis.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    String item = xAxis.getItem(xAxis.getSelectionIndex());
                    layouter.setOption(DefaultLayouter.X_AXIS_VARIATION, Integer.parseInt(item));

                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });

            l = new Label(buttons, SWT.NONE);
            l.setText("Y Axis Variation");
            final Combo yAxis = new Combo(buttons, SWT.DROP_DOWN | SWT.READ_ONLY);
            yAxis.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
            yAxis.setItems(new String[] { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" });
            yAxis.select(1);
            yAxis.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    String item = yAxis.getItem(yAxis.getSelectionIndex());
                    layouter.setOption(DefaultLayouter.Y_AXIS_VARIATION, Integer.parseInt(item));
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });

            Button run = new Button(buttons, SWT.NONE);
            run.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            run.setText("Re-Position");
            run.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    final ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                            viewer.getControl().getShell());
                    dialog.setBlockOnOpen(false);
                    dialog.open();
                    dialog.getProgressMonitor().beginTask("Layouting tag cloud...", 100);
                    viewer.reset(dialog.getProgressMonitor(), false);
                    dialog.close();
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });
            Button layout = new Button(buttons, SWT.NONE);
            layout.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            layout.setText("Re-Layout");
            layout.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    ProgressMonitorDialog dialog = new ProgressMonitorDialog(viewer.getControl().getShell());
                    dialog.setBlockOnOpen(false);
                    dialog.open();
                    dialog.getProgressMonitor().beginTask("Layouting tag cloud...", 200);
                    viewer.setInput(viewer.getInput(), dialog.getProgressMonitor());
                    viewer.reset(dialog.getProgressMonitor(), false);
                    dialog.close();
                }

                @Override
                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });
            return buttons;
        };

    };
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    options.setLayoutData(gd);
}

From source file:org.elbe.relations.internal.actions.PrintAction.java

License:Open Source License

@Override
public void execute() {
    final PrintOutWizard lWizard = ContextInjectionFactory.make(PrintOutWizard.class, context);
    final WizardDialog lDialog = new WizardDialog(shell, lWizard);
    if (lDialog.open() == Window.OK) {
        if (lWizard.isInitNew()) {
            if (!printOutManager.initNew(lWizard.getPrintOutFileName(), lWizard.getPrintOutPlugin())) {
                return;
            }//from  w  w w . j a  va2  s.  c om
        } else {
            if (!printOutManager.initFurther(lWizard.getPrintOutFileName())) {
                return;
            }
        }
        printOutManager.setContentScope(lWizard.getPrintOutScope());
        printOutManager.setPrintOutReferences(lWizard.getPrintOutReferences());

        final PrintJob lJob = new PrintJob(printOutManager, browserManager.getSelectedModel());
        final ProgressMonitorDialog lMonitor = new ProgressMonitorJobsDialog(shell);
        lMonitor.open();
        try {
            lMonitor.run(true, true, lJob);
        } catch (final InvocationTargetException exc) {
            log.error(exc, exc.getMessage());
        } catch (final InterruptedException exc) {
            log.error(exc, exc.getMessage());
        } finally {
            lMonitor.close();
        }
    }
}

From source file:org.elbe.relations.internal.wizards.ExportToXML.java

License:Open Source License

@Override
public boolean performFinish() {
    final String lCatalog = dbSettings.getCatalog();
    final String lBackupFile = page.getFileName();
    statusLine.showStatusLineMessage(String.format(STATUS_MSG, lCatalog, lBackupFile));

    final ProgressMonitorDialog lDialog = new ProgressMonitorJobsDialog(shell);
    lDialog.open();//w w w.ja  va  2 s . co  m

    final ExporterJob lJob = new ExporterJob(page.getFileName());
    try {
        lDialog.run(true, true, lJob);
    } catch (final InvocationTargetException exc) {
        log.error(exc, exc.getMessage());
    } catch (final InterruptedException exc) {
        log.error(exc, exc.getMessage());
    } finally {
        lDialog.close();
    }
    return true;
}

From source file:org.elbe.relations.internal.wizards.ImportFromXML.java

License:Open Source License

private boolean createAndFill(final IDBChange inCreateDB, final String inImportFile) {
    final XMLImport lImport = inImportFile.endsWith(".zip") ? new ZippedXMLImport(inImportFile) //$NON-NLS-1$
            : new XMLImport(inImportFile);
    final int lWorkItemsCount = 6;

    // run catalog creation and data import with progress monitor
    IRunnableWithProgress lJob = new AbstractRunnableWithProgress() {
        @Override//from   w  w  w .j  av a  2 s  .com
        protected final Runnable getRunnableInitialize(final IProgressMonitor inMonitor) {
            return new Runnable() {
                @Override
                public void run() {
                    inMonitor.beginTask(
                            String.format(RelationsMessages.getString("ImportFromXML.job.import.start"), //$NON-NLS-1$
                                    inImportFile),
                            lWorkItemsCount);
                }
            };
        }

        /**
         * Create tables in database catalog - Parse XML file and create
         * table entries
         */
        @Override
        protected final int process(final IProgressMonitor inMonitor)
                throws InvocationTargetException, InterruptedException {
            int outNumberOfImported = 0;
            sync.syncExec(new Runnable() {
                @Override
                public void run() {
                    inCreateDB.execute();
                }
            });
            inMonitor.worked(1);
            if (inMonitor.isCanceled()) {
                throw new InterruptedException();
            }

            try {
                outNumberOfImported = lImport.processFile(inMonitor,
                        dbSettings.getDBConnectionConfig().canSetIdentityField());
                monitorWorked(inMonitor);
            } catch (final InterruptedException exc) {
                throw exc;
            } catch (final Exception exc) {
                throw new InvocationTargetException(exc);
            }
            return outNumberOfImported;
        }

        @Override
        protected final Runnable getRunnableFeedback(final int inNumberOfProcessed) {
            final String lFeedback = String.format(
                    RelationsMessages.getString("ImportFromXML.job.import.feedback"), inNumberOfProcessed); //$NON-NLS-1$
            return new Runnable() {
                @Override
                public void run() {
                    if (dbSettings.getDBConnectionConfig().canSetIdentityField()) {
                        MessageDialog.openInformation(shell,
                                RelationsMessages.getString("ImportFromXML.job.import.success"), lFeedback); //$NON-NLS-1$
                    } else {
                        statusLine.showStatusLineMessage(lFeedback);
                    }
                }
            };
        }
    };

    final ProgressMonitorDialog lImportDialog = new ProgressMonitorJobsDialog(shell);
    lImportDialog.open();
    try {
        lImportDialog.run(true, true, lJob);
    } catch (final InvocationTargetException exc) {
        log.error(exc, exc.getMessage());
        restorePrevious(inCreateDB);
        return false;
    } catch (final InterruptedException exc) {
        log.debug("Import of data interrupted by user."); //$NON-NLS-1$
        restorePrevious(inCreateDB);
        return false;
    } finally {
        lImportDialog.close();
    }

    if (!dbSettings.getDBConnectionConfig().canSetIdentityField()) {
        // run relation rebind with progress monitor
        final Collection<RelationReplaceHelper> lRelationsToRebind = lImport.getRelationsToRebind();

        lJob = new AbstractRunnableWithProgress() {
            @Override
            protected Runnable getRunnableInitialize(final IProgressMonitor inMonitor) {
                return new Runnable() {
                    @Override
                    public void run() {
                        inMonitor.beginTask(RelationsMessages.getString("ImportFromXML.job.rebind.start"), //$NON-NLS-1$
                                lRelationsToRebind.size());
                    }
                };
            }

            @Override
            protected int process(final IProgressMonitor inMonitor)
                    throws InvocationTargetException, InterruptedException {
                return processRebind(lRelationsToRebind, inMonitor);
            }

            @Override
            protected Runnable getRunnableFeedback(final int inNumberOfProcessed) {
                final String lFeedback = String.format(
                        RelationsMessages.getString("ImportFromXML.job.rebind.feedback"), inNumberOfProcessed); //$NON-NLS-1$
                return new Runnable() {
                    @Override
                    public void run() {
                        MessageDialog.openInformation(shell,
                                RelationsMessages.getString("ImportFromXML.job.rebind.success"), lFeedback); //$NON-NLS-1$
                    }
                };
            }
        };
        final ProgressMonitorDialog lRebindDialog = new ProgressMonitorJobsDialog(shell);
        lRebindDialog.open();
        try {
            lRebindDialog.run(true, true, lJob);
        } catch (final InvocationTargetException exc) {
            log.error(exc, exc.getMessage());
            return false;
        } catch (final InterruptedException exc) {
            return false;
        } finally {
            lRebindDialog.close();
        }
    }
    return true;
}