public boolean performFinish()

in eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/internal/ExportWizard.java [59:122]


    public boolean performFinish() {

        try {
            getContainer().run(true, false, new IRunnableWithProgress() {

                @Override
                public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    final SyncCommandFactory factory = Activator.getDefault().getCommandFactory();

                    final Repository[] selectedServer = new Repository[1];
                    Display.getDefault().syncExec(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                selectedServer[0] = ServerUtil.getConnectedRepository(exportPage.getServer(), monitor);
                            } catch (CoreException e) {
                                throw new RuntimeException(e);
                            }
                        }
                    });

                    try {

                        syncStartPoint.accept(new IResourceVisitor() {

                            @Override
                            public boolean visit(IResource resource) throws CoreException {
                                try {
                                    Command<?> command = factory.newCommandForAddedOrUpdatedResource(selectedServer[0],
                                            EclipseResources.create(resource));
                                    if (command == null) {
                                        return true;
                                    }
                                    Result<?> result = command.execute();
                                    if (!result.isSuccess()) {
                                        throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID,
                                                "Failed exporting: " + result.toString()));
                                    }
                                } catch (IOException e) {
                                    throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID,
                                            "Failed exporting: " + e.getMessage()));
                                }
                                return true;
                            }
                        });
                    } catch (CoreException e) {
                        throw new InvocationTargetException(e);
                    } catch (Throwable t) {
                        t.printStackTrace();
                        throw new InvocationTargetException(t);
                    }
                }
            });

            return true;
        } catch (RuntimeException | InterruptedException e) {
            exportPage.setErrorMessage(e.getMessage());
            return false;
        } catch (InvocationTargetException e) {
            exportPage.setErrorMessage(e.getCause().getMessage());
            return false;
        }

    }