use of org.apache.sling.ide.eclipse.ui.internal.ImportRepositoryContentAction in project sling by apache.
the class ImportWizard method performFinish.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
public boolean performFinish() {
if (!mainPage.isPageComplete()) {
return false;
}
final IServer server = mainPage.getServer();
IResource resource = mainPage.getResource();
final IProject project = resource.getProject();
final IPath projectRelativePath = resource.getProjectRelativePath();
try {
getContainer().run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// following this change ( see org.apache.sling.ide.core.ResourceUtil )
try {
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
try {
new ImportRepositoryContentAction(server, projectRelativePath, project, serializationManager).run(monitor);
} catch (SerializationException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Import failed", e));
} catch (InvocationTargetException e) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Import failed", e.getCause()));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
serializationManager.destroy();
}
}
}, project, IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
});
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
mainPage.setErrorMessage("Import error : " + cause.getMessage() + " . Please see the error log for details.");
Activator.getDefault().getPluginLogger().error("Repository import failed", cause);
return false;
} catch (OperationCanceledException | InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
return true;
}
use of org.apache.sling.ide.eclipse.ui.internal.ImportRepositoryContentAction in project sling by apache.
the class ContentImportTest method runImport.
private void runImport(IProject contentProject) throws SerializationException, InvocationTargetException, InterruptedException, CoreException {
ImportRepositoryContentAction action = new ImportRepositoryContentAction(wstServer.getServer(), Path.fromPortableString("/content/test-root"), contentProject, Activator.getDefault().getSerializationManager());
action.run(new NullProgressMonitor());
}
Aggregations