org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/AptanaProjectsImportWizard.java
author Eugene Ostroukhov <eostroukhov@symbian.org>
Wed, 13 Jan 2010 15:13:10 -0800
changeset 33 71a6ac16b759
parent 14 e3d48d24826c
child 38 954dbf7baac6
permissions -rw-r--r--
WRT wizards will switch to JS perspective on completion

/**
 * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Symbian Foundation - initial contribution.
 * Contributors:
 * Description:
 * Overview:
 * Details:
 * Platforms/Drives/Compatibility:
 * Assumptions/Requirement/Pre-requisites:
 * Failures and causes:
 */
package org.symbian.tools.wrttools.wizards;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;

public class AptanaProjectsImportWizard extends Wizard implements
		IImportWizard, IExecutableExtension {

	private AptanaProjectLocationWizardPage mainPage;
	private IConfigurationElement config;

	public AptanaProjectsImportWizard() {
		setWindowTitle("Import Aptana Project");
		setNeedsProgressMonitor(true);
	}

	@Override
	public boolean performCancel() {
		mainPage.performCancel();
		return true;
	}

	@Override
	public boolean performFinish() {
		if (mainPage.createProjects()) {
			BasicNewProjectResourceWizard.updatePerspective(config);
			return true;
		} else {
			return false;
		}
	}

	@Override
	public void addPages() {
		mainPage = new AptanaProjectLocationWizardPage();
		addPage(mainPage);
	}

	@Override
	public void init(IWorkbench workbench, IStructuredSelection selection) {
		// Do nothing
	}

	@Override
	public void setInitializationData(IConfigurationElement config,
			String propertyName, Object data) throws CoreException {
		this.config = config;
	}
}