package tool.wizards;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
import tool.ToolPlugin;
import tool.properties.ProjectPropertyPage;
import tool.repository.RepositorySync;
public class ExportToRepositoryWizard extends Wizard implements IExportWizard {
private ProjectPropertyPage _pageOne;
@Override
public void init(IWorkbench workBench, IStructuredSelection selection) {
setWindowTitle("Export to Repository Wizard"); //NON-NLS-1
setNeedsProgressMonitor(true);
_pageOne = new ProjectPropertyPage("Export Repository", selection);
_pageOne.setTitle("Tool repository details");
_pageOne.setDescription("Enter repository details'");
}
@Override
public void addPages() {
addPage(_pageOne);
}
@Override
public boolean performFinish() {
try {
final IWizardContainer container = getContainer();
container.run(true, true, new RepositorySync(_pageOne.getProject()));
} catch (InvocationTargetException e) {
ToolPlugin.showError("Error exporting to Tool repository",e);
} catch (InterruptedException e) {
ToolPlugin.showError("Error exporting to Tool repository",e);
}
return true;
}
}