1 package com.proalpha.pds.templates.jet;
3 import org.eclipse.core.runtime.IStatus;
4 import org.eclipse.core.runtime.Platform;
5 import org.eclipse.core.runtime.Status;
6 import org.osgi.framework.Bundle;
8 import com.proalpha.pds.templates.Activator;
12 private static final String COM_PROALPHA_PDS_TEMPLATES =
"com.proalpha.pds.templates";
13 private static final String JET_FOLDER =
".jet.";
14 private static final String TRUNK =
"trunk.";
15 private static final String VERSION =
"version";
17 private String proALPHAVersion;
29 String proALPHAVersion) {
30 if (factory ==
null) {
33 factory.proALPHAVersion = proALPHAVersion;
45 this.proALPHAVersion = proALPHAVersion;
67 .getSelectedTemplate(COM_PROALPHA_PDS_TEMPLATES
70 + getProalphaVersionNumber(factory.proALPHAVersion)
73 }
catch (ClassNotFoundException e) {
80 .getSelectedTemplate(COM_PROALPHA_PDS_TEMPLATES
81 + JET_FOLDER + TRUNK + instanceName);
84 }
catch (Exception e) {
93 private void logErrorMessage(Throwable exception) {
95 String message = (exception.getMessage().length() >= 0) ? exception
97 :
"The error message could not be extracted. Please check the error log.";
99 IStatus status =
new Status(IStatus.ERROR,
Activator.PLUGIN_ID, message);
112 private IpaTemplateGenerator getSelectedTemplate(String instanceName)
113 throws ClassNotFoundException, InstantiationException,
114 IllegalAccessException {
116 Bundle bundle = Platform
117 .getBundle(COM_PROALPHA_PDS_TEMPLATES);
118 Class<?> myClass = bundle.loadClass(instanceName);
119 IpaTemplateGenerator
template = (IpaTemplateGenerator) myClass
130 private String extractPointFromString(String proVersion) {
131 String proALPHANumber;
132 proALPHANumber = proVersion.replace(
".",
"");
133 proALPHANumber = proALPHANumber.substring(0, 2);
134 proALPHANumber = proALPHANumber +
".";
135 return proALPHANumber;
143 private String getProalphaVersionNumber(String proVersion) {
146 if (proVersion.contains(
"."))
147 proVersion = extractPointFromString(proVersion);
static Activator getDefault()
IpaTemplateGenerator getTemplate(String instanceName)
static JetTemplateFactory getFactoryInstance(String proALPHAVersion)