Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 76f4cf99e0880545c1e29771f68e293ae74312b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * 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:
 *    Boris Blajer (Borland) - initial API and implementation
 */

«IMPORT "http://www.eclipse.org/gmf/2006/GenModel"»
«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»

«AROUND openEditor FOR gmfgen::GenEditorView-»
«ENDAROUND»

«AROUND AboutAction FOR gmfgen::GenApplication-»
	«EXPAND xpt::Common::generatedMemberComment("About action for the RCP application.")»
	public static class AboutAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
		«EXPAND xpt::Common::generatedMemberComment("@see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)")»
		public void run(org.eclipse.jface.action.IAction action) {
			org.eclipse.jface.dialogs.MessageDialog.openInformation(getWindow().getShell(), getString("_UI_About_title"),	«EXPAND xpt::Common::nonNLS»
			getString("_UI_About_text"));	«EXPAND xpt::Common::nonNLS»
		}
	}
«ENDAROUND»

«AROUND OpenAction FOR gmfgen::GenApplication-»
	«EXPAND xpt::Common::generatedClassComment("Open action for the " + editorGen.domainGenModel.modelName + " diagram.")»
	public static class OpenAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
		«EXPAND xpt::Common::generatedMemberComment("Opens the editors for the files selected using the file dialog.")»
		public void run(org.eclipse.jface.action.IAction action) {
			String filePath = «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openFilePathDialog(getWindow().getShell(), "*.«editorGen.diagramFileExtension»", org.eclipse.swt.SWT.OPEN);	«EXPAND xpt::Common::nonNLS»
			if (filePath != null) {
«IF editorGen.editor.eclipseEditor-»
				«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openEditor(org.eclipse.emf.common.util.URI.createFileURI(filePath));
«ELSE-»
				«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».showView(org.eclipse.emf.common.util.URI.createFileURI(filePath));
«ENDIF-»
			}
		}
 	}
«ENDAROUND»

«AROUND OpenUriAction FOR gmfgen::GenApplication-»
	«EXPAND xpt::Common::generatedMemberComment("Open URI action for the " + editorGen.domainGenModel.modelName + " diagram.")»
	public static class OpenURIAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
		«EXPAND xpt::Common::generatedMemberComment("Opens the editors for the files selected using the LoadResourceDialog.")»
		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 it = loadResourceDialog.getURIs().iterator(); it.hasNext(); ) {
«IF editorGen.editor.eclipseEditor»
					«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openEditor((org.eclipse.emf.common.util.URI) it.next());
«ELSE»
					«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».showView((org.eclipse.emf.common.util.URI) it.next());
«ENDIF»
				}
			}
		}
	}
«ENDAROUND»

«AROUND additions FOR gmfgen::GenApplication-»
	«EXPAND xpt::Common::generatedMemberComment("Looks up a string in the plugin.properties file for the plugin.")»
	private static String getString(String key) {
		return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundleString(key);
	}
«ENDAROUND»

Back to the top