コード例 #1
0
  /**
   * @param templateInfo may not be null
   * @throws TemplateInitializationException
   */
  protected TemplateCore(TemplateInfo templateInfo) throws TemplateInitializationException {
    this.templateInfo = templateInfo;
    URL descriptorURL;
    try {
      descriptorURL =
          TemplateEngineHelper.getTemplateResourceURL(
              templateInfo.getPluginId(), templateInfo.getTemplatePath());
    } catch (IOException ioe) {
      String msg =
          MessageFormat.format(
              TemplateEngineMessages.getString("TemplateCore.InitFailed"),
              new Object[] {templateInfo.getTemplatePath()}); // $NON-NLS-1$
      throw new TemplateInitializationException(msg);
    }
    if (descriptorURL == null)
      throw new TemplateInitializationException(
          "Unable to load project template. Location URL is null for "
              + templateInfo.getTemplateId()); // $NON-NLS-1$
    templateDescriptor = new TemplateDescriptor(descriptorURL, templateInfo.getPluginId());
    valueStore = new ValueStore<String>(this);
    valueStore.putAll(templateDescriptor.getTemplateDefaults(templateDescriptor.getRootElement()));
    valueStore.putAll(TemplateEngine.getSharedDefaults());
    valueStore.put("projectType", templateInfo.getProjectType()); // $NON-NLS-1$

    processHandler = new TemplateProcessHandler(this);
    allMacrosInProcesses = processHandler.getAllMacros();

    fireDirtyEvents = true;
  }
コード例 #2
0
 /** @return String, which contains the Label */
 public String getLabel() {
   if (label == null) {
     label = templateDescriptor.getRootElement().getAttribute(LABEL).trim();
   }
   return TemplateEngineHelper.externalizeTemplateString(templateInfo, label);
 }
コード例 #3
0
 /** @return String, which contains the id of the template */
 public String getTemplateId() {
   if (templateId == null) {
     templateId = templateDescriptor.getRootElement().getAttribute(ID).trim();
   }
   return templateId;
 }
コード例 #4
0
 /** @return String, which contains the id of the template */
 public String getTemplateType() {
   if (templateType == null) {
     templateType = templateDescriptor.getRootElement().getAttribute(TYPE).trim();
   }
   return templateType;
 }
コード例 #5
0
 /** @return String, which contains the description */
 public String getDescription() {
   if (description == null) {
     description = templateDescriptor.getRootElement().getAttribute(DESCRIPTION).trim();
   }
   return TemplateEngineHelper.externalizeTemplateString(templateInfo, description);
 }