blob: fadd89a3363d776d26322c6b3b5e28d410356917 [file] [log] [blame]
/*
* Copyright (c) 2007, 2009 Borland Software Corporation
*
* 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:
* bblajer (Borland) - initial API and implementation
*/
«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
«EXTENSION xpt::editor::Wizard»
«EXTENSION xpt::editor::i18n»
«DEFINE wizardBannerStem FOR genmodel::GenClass»«genPackage.prefix»«ENDDEFINE»
«DEFINE wizardBannerStem FOR gmfgen::GenDiagram»«IF domainDiagramElement = null»«editorGen.diagramFileExtension»«ELSE»«EXPAND wizardBannerStem FOR domainDiagramElement»«ENDIF»«ENDDEFINE»
«DEFINE wizardBannerLocation FOR gmfgen::GenDiagram»icons/wizban/New«EXPAND wizardBannerStem FOR domainDiagramElement»Wizard.gif«ENDDEFINE»
«DEFINE CreationWizard FOR gmfgen::GenDiagram
«EXPAND xpt::Common::copyright FOR editorGen»
package «editorGen.editor.packageName»;
«EXPAND xpt::Common::generatedClassComment»
public class «creationWizardClassName» «EXPAND supertypes» {
«EXPAND diagramFile
«EXPAND page
«EXPAND addPages
«EXPAND _init
«EXPAND performFinish
«EXPAND getResult
«EXPAND additions
}
«ENDDEFINE»
«DEFINE supertypes FOR gmfgen::GenDiagram»extends «IF null = editorGen.application»org.eclipse.ui.wizards.newresource.BasicNewResourceWizard«ELSE»org.eclipse.jface.wizard.Wizard«ENDIF» implements org.eclipse.ui.INewWizard«ENDDEFINE»
«DEFINE diagramFile FOR gmfgen::GenDiagram
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND createdDiagramFileType» «EXPAND createdDiagramFileAttributeName»;
«ENDDEFINE»
«DEFINE page FOR gmfgen::GenDiagram
«EXPAND xpt::Common::generatedMemberComment»
private «getCreationWizardPageQualifiedClassName()» myPage;
«ENDDEFINE»
«DEFINE addPages FOR gmfgen::GenDiagram
«EXPAND xpt::Common::generatedMemberComment»
public void addPages() {
super.addPages();
if (myPage == null) {
myPage = new «getCreationWizardPageQualifiedClassName()»(«IF null = editorGen.application»getSelection()«ENDIF»);
}
addPage(myPage);
}
«ENDDEFINE»
«DEFINE _init FOR gmfgen::GenDiagram
«EXPAND xpt::Common::generatedMemberComment»
public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) {
«IF null = editorGen.application
super.init(workbench, selection);
«ENDIF
setWindowTitleEXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardWindowTitle(self)) FOR editorGen»);
setDefaultPageImageDescriptoreditorGen.plugin.getActivatorQualifiedClassName()».getBundledImageDescriptor("«EXPAND wizardBannerLocation»")); «EXPAND xpt::Common::nonNLS»
setNeedsProgressMonitor(true);
}
«ENDDEFINE»
«DEFINE performFinish FOR gmfgen::GenDiagram
«EXPAND xpt::Common::generatedMemberComment»
public boolean performFinish() {
boolean retVal = myPage.finish();
«EXPAND createdDiagramFileAttributeName» = myPageEXPAND xpt::editor::CreationWizardPage::createdDiagramFileMethodName»();
return retVal;
}
«ENDDEFINE»
«DEFINE getResult FOR gmfgen::GenDiagram
«EXPAND xpt::Common::generatedMemberComment('returns the diagram file'
public final «EXPAND createdDiagramFileType» «EXPAND createdDiagramFileMethodName»() {
return «EXPAND createdDiagramFileAttributeName»;
}
«ENDDEFINE»
«DEFINE createdDiagramFileAttributeName FOR gmfgen::GenDiagram»«IF isRichClientPlatform(selfmyCreatedDiagramFileURI«ELSE»myCreatedDiagramFile«ENDIF»«ENDDEFINE»
«DEFINE createdDiagramFileMethodName FOR gmfgen::GenDiagram»«IF isRichClientPlatform(selfgetCreatedDiagramFileURI«ELSE»getCreatedDiagramFile«ENDIF»«ENDDEFINE»
«DEFINE createdDiagramFileType FOR gmfgen::GenDiagram»«IF isRichClientPlatform(selforg.eclipse.emf.common.util.URI«ELSE»org.eclipse.core.resources.IFile«ENDIF»«ENDDEFINE»
«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
«DEFINE i18nAccessors FOR gmfgen::GenDiagram
«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardWindowTitle(self))-»
«ENDDEFINE»
«DEFINE i18nValues FOR gmfgen::GenDiagram
«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardWindowTitle(self), 'New ' + editorGen.domainGenModel.modelName + ' Diagram')-»
«ENDDEFINE»