Package: EmfParsleyProjectFilesGenerator

EmfParsleyProjectFilesGenerator

nameinstructionbranchcomplexitylinemethod
EmfParsleyProjectFilesGenerator()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
activatorName(String)
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
extFactoryName(String)
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
generateActivator(String)
M: 0 C: 366
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 135
100%
M: 0 C: 1
100%
moduleFileName(String)
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2013 RCP Vision (http://www.rcp-vision.com) and others.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * Lorenzo Bettini - initial API and implementation
10: */
11: package org.eclipse.emf.parsley.generator.common;
12:
13: import org.eclipse.emf.parsley.generator.common.EmfParsleyProjectFilesGeneratorUtil;
14: import org.eclipse.xtend2.lib.StringConcatenation;
15:
16: /**
17: * @author Lorenzo Bettini - initial API and implementation
18: */
19: @SuppressWarnings("all")
20: public class EmfParsleyProjectFilesGenerator {
21: public String moduleFileName(final String projectName) {
22: return EmfParsleyProjectFilesGeneratorUtil.buildClassNameFromProject(projectName);
23: }
24:
25: public CharSequence activatorName(final String projectName) {
26: StringConcatenation _builder = new StringConcatenation();
27: String _buildClassNameFromProject = EmfParsleyProjectFilesGeneratorUtil.buildClassNameFromProject(projectName);
28: _builder.append(_buildClassNameFromProject);
29: _builder.append("Activator");
30: return _builder;
31: }
32:
33: public CharSequence extFactoryName(final String projectName) {
34: StringConcatenation _builder = new StringConcatenation();
35: String _buildClassNameFromProject = EmfParsleyProjectFilesGeneratorUtil.buildClassNameFromProject(projectName);
36: _builder.append(_buildClassNameFromProject);
37: _builder.append("ExecutableExtensionFactory");
38: return _builder;
39: }
40:
41: public CharSequence generateActivator(final String projectName) {
42: StringConcatenation _builder = new StringConcatenation();
43: _builder.append("package ");
44: _builder.append(projectName);
45: _builder.append(";");
46: _builder.newLineIfNotEmpty();
47: _builder.newLine();
48: _builder.append("import org.osgi.framework.BundleContext;");
49: _builder.newLine();
50: _builder.append("import org.eclipse.ui.plugin.AbstractUIPlugin;");
51: _builder.newLine();
52: _builder.newLine();
53: _builder.append("/**");
54: _builder.newLine();
55: _builder.append(" ");
56: _builder.append("* The activator class controls the plug-in life cycle");
57: _builder.newLine();
58: _builder.append(" ");
59: _builder.append("*/");
60: _builder.newLine();
61: _builder.append("public class ");
62: CharSequence _activatorName = this.activatorName(projectName);
63: _builder.append(_activatorName);
64: _builder.append(" extends AbstractUIPlugin {");
65: _builder.newLineIfNotEmpty();
66: _builder.newLine();
67: _builder.append("\t");
68: _builder.append("// The plug-in ID");
69: _builder.newLine();
70: _builder.append("\t");
71: _builder.append("public static final String PLUGIN_ID = \"");
72: _builder.append(projectName, "\t");
73: _builder.append("\"; //$NON-NLS-1$");
74: _builder.newLineIfNotEmpty();
75: _builder.newLine();
76: _builder.append("\t");
77: _builder.append("// The shared instance");
78: _builder.newLine();
79: _builder.append("\t");
80: _builder.append("private static ");
81: CharSequence _activatorName_1 = this.activatorName(projectName);
82: _builder.append(_activatorName_1, "\t");
83: _builder.append(" plugin;");
84: _builder.newLineIfNotEmpty();
85: _builder.newLine();
86: _builder.append("\t");
87: _builder.append("public ");
88: CharSequence _activatorName_2 = this.activatorName(projectName);
89: _builder.append(_activatorName_2, "\t");
90: _builder.append("() {");
91: _builder.newLineIfNotEmpty();
92: _builder.append("\t");
93: _builder.append("}");
94: _builder.newLine();
95: _builder.newLine();
96: _builder.append("\t");
97: _builder.append("/*");
98: _builder.newLine();
99: _builder.append("\t ");
100: _builder.append("* (non-Javadoc)");
101: _builder.newLine();
102: _builder.append("\t ");
103: _builder.append("* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)");
104: _builder.newLine();
105: _builder.append("\t ");
106: _builder.append("*/");
107: _builder.newLine();
108: _builder.append("\t");
109: _builder.append("public void start(BundleContext context) throws Exception {");
110: _builder.newLine();
111: _builder.append("\t\t");
112: _builder.append("super.start(context);");
113: _builder.newLine();
114: _builder.append("\t\t");
115: _builder.append("plugin = this;");
116: _builder.newLine();
117: _builder.append("\t");
118: _builder.append("}");
119: _builder.newLine();
120: _builder.newLine();
121: _builder.append("\t");
122: _builder.append("/*");
123: _builder.newLine();
124: _builder.append("\t ");
125: _builder.append("* (non-Javadoc)");
126: _builder.newLine();
127: _builder.append("\t ");
128: _builder.append("* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)");
129: _builder.newLine();
130: _builder.append("\t ");
131: _builder.append("*/");
132: _builder.newLine();
133: _builder.append("\t");
134: _builder.append("public void stop(BundleContext context) throws Exception {");
135: _builder.newLine();
136: _builder.append("\t\t");
137: _builder.append("plugin = null;");
138: _builder.newLine();
139: _builder.append("\t\t");
140: _builder.append("super.stop(context);");
141: _builder.newLine();
142: _builder.append("\t");
143: _builder.append("}");
144: _builder.newLine();
145: _builder.newLine();
146: _builder.append("\t");
147: _builder.append("/**");
148: _builder.newLine();
149: _builder.append("\t ");
150: _builder.append("* Returns the shared instance");
151: _builder.newLine();
152: _builder.append("\t ");
153: _builder.append("*");
154: _builder.newLine();
155: _builder.append("\t ");
156: _builder.append("* @return the shared instance");
157: _builder.newLine();
158: _builder.append("\t ");
159: _builder.append("*/");
160: _builder.newLine();
161: _builder.append("\t");
162: _builder.append("public static ");
163: CharSequence _activatorName_3 = this.activatorName(projectName);
164: _builder.append(_activatorName_3, "\t");
165: _builder.append(" getDefault() {");
166: _builder.newLineIfNotEmpty();
167: _builder.append("\t\t");
168: _builder.append("return plugin;");
169: _builder.newLine();
170: _builder.append("\t");
171: _builder.append("}");
172: _builder.newLine();
173: _builder.newLine();
174: _builder.append("}");
175: _builder.newLine();
176: return _builder;
177: }
178: }