/*******************************************************************************
* Copyright (c) 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package tool.importWizards;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import tool.ToolPlugin;
import tool.properties.ProjectPropertyPage;
import tool.repository.CreateRepository;
import tool.repository.ImportWex;
public class WEXImportWizard extends ToolImportWizard {
protected final StringBuilder parseErrors = new StringBuilder();
protected int parseErrorCount = 0;
private WizardWEXFileSelectionPage wexSelectionPage;
public WEXImportWizard() {
super();
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
setNeedsProgressMonitor(true);
projectCreationPage = new WizardNewProjectCreationPage("New Tool Project from WEX");
wexSelectionPage = new WizardWEXFileSelectionPage("WEX file");
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#addPages()
*/
public void addPages() {
addPage(projectCreationPage);
addPage(wexSelectionPage);
}
public String fromWhere(){
return "a WEX file";
}
@Override
public void createRepos(IProject project) {
// try {
IWizardContainer container = getContainer();
File wexFile = this.wexSelectionPage.getWexFile();
CreateRepository creator = new CreateRepository(project, project.getName());
creator.run(new NullProgressMonitor()) ;
ImportWex importer = new ImportWex(project, wexFile);
//container.run(true, true, importer);
importer.run(new NullProgressMonitor());
// } catch (InvocationTargetException e) {
// ToolPlugin.showError("Error creating local repository", e);
// } catch (InterruptedException e) {
// ToolPlugin.showError("Error creating local repository", e);
// }
}
}