blob: cb885875205619c6f7dd2d1151ab32d53cd14e13 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* 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:
* Pierre Allard,
* Regent L'Archeveque,
* Olivier L. Larouche - initial API and implementation
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.common.emf.ui.impl;
import org.eclipse.apogy.common.emf.transaction.ApogyCommonTransactionFacade;
import org.eclipse.apogy.common.emf.ui.EClassSettings;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
public class WizardPagesProviderCustomImpl extends WizardPagesProviderImpl {
@Override
public EList<WizardPage> getPages(EClass eClass, EClassSettings settings) {
this.eObject = createEObject(eClass, settings);
if (this.eObject.eResource() == null) {
ApogyCommonTransactionFacade.INSTANCE.addInTempTransactionalEditingDomain(this.eObject);
}
this.pages = instantiateWizardPages(this.eObject, settings);
return this.pages;
}
@Override
public EObject createEObject(EClass eClass, EClassSettings settings) {
this.eObject = EcoreUtil.create(eClass);
ApogyCommonTransactionFacade.INSTANCE.addInTempTransactionalEditingDomain(this.eObject);
return this.eObject;
}
@Override
public EList<WizardPage> instantiateWizardPages(EObject eObject, EClassSettings settings) {
return new BasicEList<WizardPage>();
}
@Override
public CompoundCommand getPerformFinishCommands(EObject eObject, EClassSettings settings,
EditingDomain editingDomain) {
return null;
}
@Override
public IWizardPage getNextPage(IWizardPage page) {
if (getPages().contains(page) && getPages().indexOf(page) + 1 < getPages().size()) {
return getPages().get(getPages().indexOf(page) + 1);
} else {
return null;
}
}
} // WizardPagesProviderImpl