Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/ActionBarAdvisor.xpt266
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Application.xpt51
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Perspective.xpt45
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WizardNewFileCreationPage.xpt206
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchAdvisor.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchWindowAdvisor.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/extensions.xpt94
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/i18n.qvto63
8 files changed, 851 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/ActionBarAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/ActionBarAdvisor.xpt
new file mode 100644
index 000000000..cb8567652
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/ActionBarAdvisor.xpt
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«EXTENSION xpt::application::i18n»
+
+«DEFINE ActionBarAdvisor FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «actionBarAdvisorClassName» extends org.eclipse.ui.application.ActionBarAdvisor {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.actions.ActionFactory.IWorkbenchAction lockToolBarAction;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.actions.ActionFactory.IWorkbenchAction toggleCoolbarAction;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «actionBarAdvisorClassName»(org.eclipse.ui.application.IActionBarConfigurer configurer) {
+ super(configurer);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.IWorkbenchWindow getWindow() {
+ return getActionBarConfigurer().getWindowConfigurer().getWindow();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void makeActions(org.eclipse.ui.IWorkbenchWindow window) {
+ toggleCoolbarAction = org.eclipse.ui.actions.ActionFactory.TOGGLE_COOLBAR.create(window);
+ register(toggleCoolbarAction);
+ lockToolBarAction = org.eclipse.ui.actions.ActionFactory.LOCK_TOOL_BAR.create(window);
+ register(lockToolBarAction);
+ «EXPAND makeAction('window') FOREACH sharedContributionItems-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void fillMenuBar(org.eclipse.jface.action.IMenuManager menu) {
+ «EXPAND fill('menu') FOR mainMenu-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void fillCoolBar(org.eclipse.jface.action.ICoolBarManager toolBar) {
+ org.eclipse.jface.action.IMenuManager popUpMenu = new org.eclipse.jface.action.MenuManager();
+ popUpMenu.add(new org.eclipse.jface.action.ActionContributionItem(lockToolBarAction));
+ popUpMenu.add(new org.eclipse.jface.action.ActionContributionItem(toggleCoolbarAction));
+ toolBar.setContextMenuManager(popUpMenu);
+ «EXPAND fill('toolBar') FOR mainToolBar-»
+ }
+
+ «EXPAND openEditor FOR editorGen.editor-»
+
+ «EXPAND actions-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE openEditor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static boolean openEditor(org.eclipse.ui.IWorkbench workbench, org.eclipse.emf.common.util.URI fileURI) {
+ org.eclipse.ui.IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ org.eclipse.ui.IWorkbenchPage page = workbenchWindow.getActivePage();
+ org.eclipse.ui.IEditorDescriptor editorDescriptor =
+ workbench.getEditorRegistry().getDefaultEditor(fileURI.toFileString());
+ if (editorDescriptor == null) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(workbenchWindow.getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForDefaultFileEditorErrorDialog(editorGen.application))) FOR editorGen»,
+ org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForDefaultFileEditorErrorDialog(editorGen.application))) FOR editorGen»,
+ fileURI.toFileString()));
+ return false;
+ } else {
+ try {
+ page.openEditor(new org.eclipse.emf.common.ui.URIEditorInput(fileURI), editorDescriptor.getId());
+ } catch (org.eclipse.ui.PartInitException exception) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(
+ workbenchWindow.getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForDefaultEditorOpenErrorDialog(editorGen.application))) FOR editorGen»,
+ exception.getMessage());
+ return false;
+ }
+ }
+ return true;
+ }
+«ENDDEFINE»
+
+«DEFINE makeAction(windowVar : String) FOR gmfgen::GenContributionItem»
+ «ERROR 'Can not make action for ' + self.repr()»
+«ENDDEFINE»
+
+«DEFINE makeAction(windowVar : String) FOR gmfgen::GenActionFactoryContributionItem»
+ register(org.eclipse.ui.actions.ActionFactory.«name».create(«windowVar»));
+«ENDDEFINE»
+
+«DEFINE fill(managerVar : String) FOR gmfgen::GenContributionManager»
+ «EXPAND contribute(managerVar) FOREACH items-»
+«ENDDEFINE»
+
+«DEFINE contribute(managerVar : String) FOR gmfgen::GenContributionItem»
+ «ERROR 'Can not contribute item: ' + self.repr()»
+«ENDDEFINE»
+
+«DEFINE contribute(managerVar : String) FOR gmfgen::GenGroupMarker»
+ «managerVar».add(new org.eclipse.jface.action.GroupMarker(«groupName»));
+«ENDDEFINE»
+
+«DEFINE contribute(managerVar : String) FOR gmfgen::GenSeparator»
+ «managerVar».add(new org.eclipse.jface.action.Separator(«IF null <> groupName»«groupName»«ENDIF»));
+«ENDDEFINE»
+
+«DEFINE contribute(managerVar : String) FOR gmfgen::GenMenuManager»
+ «LET managerVar + 'X' AS menuVar-»
+ {
+ org.eclipse.jface.action.IMenuManager «menuVar» = new org.eclipse.jface.action.MenuManager(
+ «IF null <> name»«EXPAND xpt::Externalizer::accessorCall(i18nKeyForMenu(self)) FOR editorGen»«ELSE»null«ENDIF»«IF null <> iD», «iD»«ENDIF»);
+ «EXPAND contribute(menuVar) FOREACH items-»
+ «managerVar».add(«menuVar»);
+ }
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE contribute(managerVar : String) FOR gmfgen::GenToolBarManager»
+ «LET managerVar + 'X' AS toolBarVar-»
+ {
+ org.eclipse.jface.action.IToolBarManager «toolBarVar» = new org.eclipse.jface.action.ToolBarManager();
+ «EXPAND contribute(toolBarVar) FOREACH items-»
+ «managerVar».add(new org.eclipse.jface.action.ToolBarContributionItem(«toolBarVar»«IF null <> iD», «iD»«ENDIF»));
+ }
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE contribute(managerVar : String) FOR gmfgen::GenSharedContributionItem»
+ «EXPAND contributeShared(managerVar) FOR actualItem-»
+«ENDDEFINE»
+
+«DEFINE contributeShared(managerVar : String) FOR gmfgen::GenContributionItem»
+ «ERROR 'Can not contribute shared item: ' + self.repr()»
+«ENDDEFINE»
+
+«DEFINE contributeShared(managerVar : String) FOR gmfgen::GenActionFactoryContributionItem»
+ «managerVar».add(getAction(org.eclipse.ui.actions.ActionFactory.«name».getId()));
+«ENDDEFINE»
+
+«DEFINE actions FOR gmfgen::GenApplication»
+«EXPAND NewDiagramAction-»
+«EXPAND OpenUriAction-»
+«EXPAND OpenAction-»
+«EXPAND AboutAction-»
+«ENDDEFINE»
+
+«DEFINE NewDiagramAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class NewDiagramAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ «editorGen.diagram.getCreationWizardQualifiedClassName()» wizard =
+ new «editorGen.diagram.getCreationWizardQualifiedClassName()»();
+ wizard.init(getWindow().getWorkbench(), org.eclipse.jface.viewers.StructuredSelection.EMPTY);
+ org.eclipse.jface.wizard.WizardDialog wizardDialog =
+ new org.eclipse.jface.wizard.WizardDialog(getWindow().getShell(), wizard);
+ wizardDialog.open();
+ }
+ }
+
+«ENDDEFINE»
+
+«DEFINE OpenUriAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class OpenURIAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog =
+ new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(getWindow().getShell());
+ if (org.eclipse.jface.dialogs.Dialog.OK == loadResourceDialog.open()) {
+ for (java.util.Iterator i = loadResourceDialog.getURIs().iterator(); i.hasNext();) {
+ openEditor(getWindow().getWorkbench(), (org.eclipse.emf.common.util.URI) i.next());
+ }
+ }
+ }
+ }
+
+«ENDDEFINE»
+
+«DEFINE OpenAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class OpenAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.swt.widgets.FileDialog fileDialog =
+ new org.eclipse.swt.widgets.FileDialog(getWindow().getShell(), org.eclipse.swt.SWT.OPEN);
+ fileDialog.open();
+ if (fileDialog.getFileName() != null && fileDialog.getFileName().length() > 0) {
+ openEditor(getWindow().getWorkbench(), org.eclipse.emf.common.util.URI.createFileURI(
+ fileDialog.getFilterPath() + java.io.File.separator + fileDialog.getFileName()));
+ }
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE AboutAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class AboutAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.jface.dialogs.MessageDialog.openInformation(getWindow().getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForAboutDialog(self))) FOR editorGen»,
+ «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForAboutDialog(self))) FOR editorGen»
+ );
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForDefaultFileEditorErrorDialog(self)))-»
+«EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForDefaultFileEditorErrorDialog(self)))-»
+«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForDefaultEditorOpenErrorDialog(self)))-»
+«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForAboutDialog(self)))-»
+«EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForAboutDialog(self)))-»
+«IF null <> mainMenu-»
+«EXPAND internal_i18nAccessors FOR mainMenu-»
+«EXPAND internal_i18nAccessors FOREACH collectGenMenuManagers(mainMenu.items)-»
+«ENDIF»
+«EXPAND internal_i18nAccessors FOREACH collectGenMenuManagers(sharedContributionItems)-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nAccessors FOR gmfgen::GenMenuManager-»
+«IF null <> name»«EXPAND xpt::Externalizer::accessorField(i18nKeyForMenu(self))»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForDefaultFileEditorErrorDialog(self)), 'Error')-»
+«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForDefaultFileEditorErrorDialog(self)), 'There is no editor registered for the file "{0}"')-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForDefaultEditorOpenErrorDialog(self)), 'Open Editor')-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForAboutDialog(self)), 'About')-»
+«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForAboutDialog(self)), editorGen.modelID + ' Diagram Editor')-»
+«IF null <> mainMenu-»
+«EXPAND internal_i18nValues FOR mainMenu-»
+«EXPAND internal_i18nValues FOREACH collectGenMenuManagers(mainMenu.items)-»
+«ENDIF»
+«EXPAND internal_i18nValues FOREACH collectGenMenuManagers(sharedContributionItems)-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nValues FOR gmfgen::GenMenuManager-»
+«IF null <> name»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMenu(self), name)»«ENDIF-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Application.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Application.xpt
new file mode 100644
index 000000000..0543e7b46
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Application.xpt
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2006 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«DEFINE Application FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» implements org.eclipse.equinox.app.IApplication {
+
+«EXPAND run-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void stop() {
+ }
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenApplication-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Object start(org.eclipse.equinox.app.IApplicationContext context) throws Exception {
+ org.eclipse.swt.widgets.Display display = org.eclipse.ui.PlatformUI.createDisplay();
+ try {
+ int returnCode = org.eclipse.ui.PlatformUI.createAndRunWorkbench(display,
+ new «getWorkbenchAdvisorQualifiedClassName()»());
+ if (returnCode == org.eclipse.ui.PlatformUI.RETURN_RESTART) {
+ return org.eclipse.equinox.app.IApplication.EXIT_RESTART;
+ }
+ return org.eclipse.equinox.app.IApplication.EXIT_OK;
+ } finally {
+ display.dispose();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Perspective.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Perspective.xpt
new file mode 100644
index 000000000..3bdcfff58
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Perspective.xpt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2006 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«DEFINE Perspective FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «perspectiveClassName» implements org.eclipse.ui.IPerspectiveFactory {
+ «EXPAND createInitialLayout-»
+ «EXPAND additions-»
+«ENDDEFINE»
+«DEFINE createInitialLayout FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createInitialLayout(org.eclipse.ui.IPageLayout layout) {
+ layout.setEditorAreaVisible(true);
+ layout.addPerspectiveShortcut(«getWorkbenchAdvisorQualifiedClassName()».PERSPECTIVE_ID);
+ org.eclipse.ui.IFolderLayout right = layout.createFolder(
+ "right", org.eclipse.ui.IPageLayout.RIGHT, 0.6f, layout.getEditorArea()); «EXPAND xpt::Common::nonNLS»
+ right.addView(org.eclipse.ui.IPageLayout.ID_OUTLINE);
+ org.eclipse.ui.IFolderLayout bottomRight = layout.createFolder(
+ "bottomRight", org.eclipse.ui.IPageLayout.BOTTOM, 0.6f, "right"); «EXPAND xpt::Common::nonNLS» «EXPAND xpt::Common::nonNLS(2)»
+ bottomRight.addView(org.eclipse.ui.IPageLayout.ID_PROP_SHEET);
+ «EXPAND layoutAdditions-»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE layoutAdditions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WizardNewFileCreationPage.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WizardNewFileCreationPage.xpt
new file mode 100644
index 000000000..adec03972
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WizardNewFileCreationPage.xpt
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2006 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«EXTENSION xpt::application::i18n»
+
+«DEFINE WizardNewFileCreationPage FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class WizardNewFileCreationPage extends org.eclipse.jface.wizard.WizardPage {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.jface.viewers.IStructuredSelection currentSelection;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String initialFileName;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.core.runtime.IPath initialContainerFullPath;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.swt.widgets.Text fileNameEditor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public WizardNewFileCreationPage(String name, org.eclipse.jface.viewers.IStructuredSelection currentSelection) {
+ super(name);
+ this.currentSelection = currentSelection;
+ String home = System.getProperty("user.home"); //$NON-NLS-1$
+ if (home != null) {
+ initialContainerFullPath = new org.eclipse.core.runtime.Path(home);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.jface.viewers.IStructuredSelection getSelection() {
+ return currentSelection;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getFileName() {
+ if (fileNameEditor == null) {
+ return initialFileName;
+ }
+ org.eclipse.core.runtime.IPath path = getFilePath();
+ if (path == null || path.isEmpty() || path.hasTrailingSeparator()) {
+ return null;
+ }
+ return path.lastSegment();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setFileName(String fileName) {
+ if (fileNameEditor == null) {
+ initialFileName = fileName;
+ return;
+ }
+ setFilePath(getContainerFullPath(), fileName);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.core.runtime.IPath getContainerFullPath() {
+ if (fileNameEditor == null) {
+ return initialContainerFullPath;
+ }
+ org.eclipse.core.runtime.IPath path = getFilePath();
+ if (path == null || path.isEmpty()) {
+ return null;
+ }
+ if (path.hasTrailingSeparator()) {
+ return path;
+ }
+ path = path.removeLastSegments(1);
+ if (path.isEmpty()) {
+ return null;
+ }
+ return path.addTrailingSeparator();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setContainerFullPath(org.eclipse.core.runtime.IPath containerPath) {
+ if (fileNameEditor == null) {
+ initialContainerFullPath = containerPath;
+ return;
+ }
+ setFilePath(containerPath, getFileName());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.core.runtime.IPath getFilePath() {
+ String fileName = fileNameEditor.getText().trim();
+ if (fileName.length() == 0) {
+ return null;
+ }
+ return new org.eclipse.core.runtime.Path(fileNameEditor.getText());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setFilePath(org.eclipse.core.runtime.IPath containerPath, String fileName) {
+ if (fileName == null) {
+ fileName = ""; //$NON-NLS-1$
+ } else {
+ fileName = fileName.trim();
+ }
+ if (containerPath == null) {
+ fileNameEditor.setText(fileName);
+ } else {
+ if (!containerPath.hasTrailingSeparator()) {
+ containerPath = containerPath.addTrailingSeparator();
+ }
+ org.eclipse.core.runtime.IPath path = fileName.length() == 0 ? containerPath : containerPath.append(fileName);
+ fileNameEditor.setText(path.toOSString());
+ }
+ setPageComplete(validatePage());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createControl(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Composite plate = new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
+ plate.setLayout(new org.eclipse.swt.layout.GridLayout(2, false));
+ org.eclipse.swt.widgets.Label label = new org.eclipse.swt.widgets.Label(plate, org.eclipse.swt.SWT.NONE);
+ label.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardFileLabel(self)) FOR editorGen»);
+ label.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.BEGINNING, org.eclipse.swt.SWT.CENTER, false, false, 2, 1));
+ fileNameEditor = new org.eclipse.swt.widgets.Text(plate, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.BORDER);
+ fileNameEditor.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.FILL, org.eclipse.swt.SWT.CENTER, true, false));
+ org.eclipse.swt.widgets.Button button = new org.eclipse.swt.widgets.Button(plate, org.eclipse.swt.SWT.PUSH);
+ button.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardBrowseButton(self)) FOR editorGen»);
+ button.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.BEGINNING, org.eclipse.swt.SWT.CENTER, false, false));
+
+ // logic
+ fileNameEditor.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
+
+ public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ });
+ button.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
+
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
+ org.eclipse.swt.widgets.FileDialog dialog = new org.eclipse.swt.widgets.FileDialog(getShell(), org.eclipse.swt.SWT.SAVE);
+ dialog.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardSelectDialog(self)) FOR editorGen»);
+ dialog.setFileName(getFileName());
+ String fileName = dialog.open();
+ if (fileName != null) {
+ fileNameEditor.setText(fileName);
+ setPageComplete(validatePage());
+ }
+ }
+
+ public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
+ }
+ });
+
+ // init
+ setFilePath(initialContainerFullPath, initialFileName);
+ setControl(plate);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ String fileName = fileNameEditor.getText().trim();
+ if (fileName.length() == 0) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardEmpty(self)) FOR editorGen»);
+ return false;
+ }
+ if (!new org.eclipse.core.runtime.Path("").isValidPath(fileName)) { //$NON-NLS-1$
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardInvalid(self)) FOR editorGen»);
+ return false;
+ }
+ setErrorMessage(null);
+ return true;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardFileLabel(self), 'File:')-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardBrowseButton(self), 'Browse')-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardSelectDialog(self), 'Select new file')-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardEmpty(self), 'Specify file name')-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardInvalid(self), 'Invalid file name')-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardFileLabel(self))-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardBrowseButton(self))-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardSelectDialog(self))-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardEmpty(self))-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardInvalid(self))-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchAdvisor.xpt
new file mode 100644
index 000000000..925ca847a
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchAdvisor.xpt
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2006 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«DEFINE WorkbenchAdvisor FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «workbenchAdvisorClassName» extends org.eclipse.ui.application.WorkbenchAdvisor {
+«EXPAND perspectiveId-»
+
+«EXPAND getInitialWindowPerspectiveId-»
+
+«EXPAND initialize-»
+
+«EXPAND createWorkbenchWindowAdvisor-»
+
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE perspectiveId FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String PERSPECTIVE_ID = "«perspectiveId»"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE getInitialWindowPerspectiveId FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getInitialWindowPerspectiveId() {
+ return PERSPECTIVE_ID;
+ }
+«ENDDEFINE»
+
+«DEFINE initialize FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void initialize(org.eclipse.ui.application.IWorkbenchConfigurer configurer) {
+ super.initialize(configurer);
+ configurer.setSaveAndRestore(true);
+ }
+«ENDDEFINE»
+
+«DEFINE createWorkbenchWindowAdvisor FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.ui.application.WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
+ org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer) {
+ return new «getWorkbenchWindowAdvisorQualifiedClassName()»(configurer);
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchWindowAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchWindowAdvisor.xpt
new file mode 100644
index 000000000..0d3c81408
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchWindowAdvisor.xpt
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2006 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«EXTENSION xpt::application::i18n»
+
+«DEFINE WorkbenchWindowAdvisor FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «workbenchWindowAdvisorClassName» extends org.eclipse.ui.application.WorkbenchWindowAdvisor {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «workbenchWindowAdvisorClassName»(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer) {
+ super(configurer);
+ }
+
+ «EXPAND createActionBarAdvisor-»
+
+ «EXPAND preWindowOpen-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE createActionBarAdvisor FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.ui.application.ActionBarAdvisor createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer configurer) {
+ return new «getActionBarAdvisorQualifiedClassName()»(configurer);
+ }
+«ENDDEFINE»
+
+«DEFINE preWindowOpen FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void preWindowOpen() {
+ org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+ configurer.setInitialSize(new org.eclipse.swt.graphics.Point(1000, 700));
+ configurer.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForWindowTitle(self)) FOR editorGen»);
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForWindowTitle(self))-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForWindowTitle(self), title)-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/extensions.xpt
new file mode 100644
index 000000000..ddd2eb7e2
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/extensions.xpt
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«DEFINE extensions FOR gmfgen::GenApplication-»
+
+ <extension id="«iD»" point="org.eclipse.core.runtime.applications">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <application>
+ <run class="«getQualifiedClassName()»"/>
+ </application>
+ </extension>
+
+ <extension point="org.eclipse.ui.perspectives" id="rcp-perspective">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <perspective
+ id="«perspectiveId»"
+ name="%perspectiveName"
+ class="«getPerspectiveQualifiedClassName()»">
+ </perspective>
+ </extension>
+
+ <extension point="org.eclipse.ui.commands" id="rcp-menu-commands">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <command
+ name="%openURIActionLabel"
+ description="%openURIActionDescription"
+ categoryId="org.eclipse.ui.category.file"
+ id="«editorGen.plugin.iD».OpenURICommand"/>
+ <command
+ name="%openActionLabel"
+ description="%openActionDescription"
+ categoryId="org.eclipse.ui.category.file"
+ id="«editorGen.plugin.iD».OpenCommand"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings" id="rcp-command-bindings">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <key
+ commandId="«editorGen.plugin.iD».OpenURICommand"
+ sequence="M1+U"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
+ commandId="«editorGen.plugin.iD».OpenCommand"
+ sequence="M1+O"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.actionSets" id="rcp-actions">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <actionSet
+ label="%applicationActionSetLabel"
+ visible="true"
+ id="«editorGen.plugin.iD».ActionSet">
+ <action
+ label="%newDiagramActionLabel"
+ class="«getActionBarAdvisorQualifiedClassName()»$NewDiagramAction"
+ menubarPath="file/new/additions"
+ id="«editorGen.plugin.iD».NewDiagramAction">
+ </action>
+ <action
+ label="%aboutActionLabel"
+ class="«getActionBarAdvisorQualifiedClassName()»$AboutAction"
+ menubarPath="help/additions"
+ id="«editorGen.plugin.iD».AboutAction">
+ </action>
+ <action
+ label="%openURIActionLabel"
+ definitionId="«editorGen.plugin.iD».OpenURICommand"
+ class="«getActionBarAdvisorQualifiedClassName()»$OpenURIAction"
+ menubarPath="file/additions"
+ id="«editorGen.plugin.iD».OpenURIAction">
+ </action>
+ <action
+ label="%openActionLabel"
+ definitionId="«editorGen.plugin.iD».OpenCommand"
+ class="«getActionBarAdvisorQualifiedClassName()»$OpenAction"
+ menubarPath="file/additions"
+ id="«editorGen.plugin.iD».OpenAction">
+ </action>
+ </actionSet>
+ </extension>
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/i18n.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/i18n.qvto
new file mode 100644
index 000000000..db283db08
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/i18n.qvto
@@ -0,0 +1,63 @@
+modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
+
+library i18n;
+
+helper i18nKeyForDefaultFileEditorErrorDialog(app : genModel::GenApplication) : String {
+ return app.actionBarAdvisorClassName + '.DefaultFileEditor'
+}
+
+helper i18nKeyForDefaultEditorOpenErrorDialog(app : genModel::GenApplication) : String {
+ return app.actionBarAdvisorClassName + '.DefaultEditorOpenError'
+}
+
+helper i18nKeyForWindowTitle(app : genModel::GenApplication) : String {
+ return app.workbenchWindowAdvisorClassName + '.Title'
+}
+
+helper i18nKeyForAboutDialog(app : genModel::GenApplication) : String {
+ return app.actionBarAdvisorClassName + '.AboutDialog'
+}
+
+helper titleKey(dialogKey : String) : String {
+ return dialogKey + 'Title'
+}
+
+helper messageKey(dialogKey : String) : String {
+ return dialogKey + 'Message'
+}
+
+helper i18nKeyForMenu(menuManager : genModel::GenMenuManager) : String {
+ return 'ApplicationMenuName.' + menuManager.name
+}
+
+helper collectGenMenuManagers(allItems : Collection(genModel::GenContributionItem)) : Sequence(genModel::GenMenuManager) {
+ return (collectAllContributionItems(allItems))[genModel::GenMenuManager]
+}
+
+helper collectAllContributionItems(allItems : Collection(genModel::GenContributionItem)) : Sequence(genModel::GenContributionManager) {
+ return let managers = (allItems->collect(it | it))[genModel::GenContributionManager]->asSequence() in managers->union(managers->collect(item | collectAllContributionItems(item.items))->flatten())
+}
+
+helper i18nKeyForNewFileWizardFileLabel(app : genModel::GenApplication) : String {
+ return wizardNewFileCreationPageClassName(app) + '.FileLabel'
+}
+
+helper i18nKeyForNewFileWizardBrowseButton(app : genModel::GenApplication) : String {
+ return wizardNewFileCreationPageClassName(app) + '.BrowseButton'
+}
+
+helper i18nKeyForNewFileWizardSelectDialog(app : genModel::GenApplication) : String {
+ return wizardNewFileCreationPageClassName(app) + '.SelectNewFileDialog'
+}
+
+helper i18nKeyForNewFileWizardEmpty(app : genModel::GenApplication) : String {
+ return wizardNewFileCreationPageClassName(app) + '.EmptyFileNameError'
+}
+
+helper i18nKeyForNewFileWizardInvalid(app : genModel::GenApplication) : String {
+ return wizardNewFileCreationPageClassName(app) + '.InvalidFileNameError'
+}
+
+helper wizardNewFileCreationPageClassName(app : genModel::GenApplication) : String {
+ return 'WizardNewFileCreationPage'
+}

Back to the top