Eclipseplugins
pADestructor.java
1 package com.proalpha.pds.templates.jet.openEdge;
2 
3 import com.openedge.pdt.core.template.ITemplateGenerator;
4 import com.openedge.pdt.core.template.TemplateGenerationException;
5 import com.openedge.pdt.text.template.OETemplateUtil;
6 import com.openedge.pdt.core.template.ITemplateArgs;
7 
8 import com.openedge.core.metadata.Destructor;
9 
10 public class pADestructor implements ITemplateGenerator
11  {
12  protected static String nl;
13  public static synchronized pADestructor create(String lineSeparator)
14  {
15  nl = lineSeparator;
16  pADestructor result = new pADestructor();
17  nl = null;
18  return result;
19  }
20 
21  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
22  protected final String TEXT_1 = " destructor public ";
23  protected final String TEXT_2 = " ( ):" + NL + " /* Description -----------------------------------------------------------*/" + NL + " /* */" + NL + " /* */" + NL + " /* */" + NL + " /* Notes -----------------------------------------------------------------*/" + NL + " /* */" + NL + " /* */" + NL + " /* */" + NL + " /* Parameters ------------------------------------------------------------*/" + NL + " /* */" + NL + " /* <none> */" + NL + " /* */" + NL + " /* Examples --------------------------------------------------------------*/" + NL + " /* */" + NL + " /* */" + NL + " /* */" + NL + " /*------------------------------------------------------------------------*/" + NL + "" + NL + " /* Variables -------------------------------------------------------------*/" + NL + " /*------------------------------------------------------------------------*/" + NL + "" + NL + " /* Buffers ---------------------------------------------------------------*/" + NL + "" + NL + " /*------------------------------------------------------------------------*/" + NL + " /* Processing */" + NL + " /*------------------------------------------------------------------------*/";
24  protected final String TEXT_3 = NL;
25 
26 /* (non-javadoc)
27  * @see ITemplateGenerator#generate(Object)
28  */
29 public String generate(ITemplateArgs argument) throws TemplateGenerationException
30  {
31  final StringBuffer stringBuffer = new StringBuffer();
32 
33  Destructor destructor = (Destructor) argument.getObj("destructor");
34  String className = (String) argument.get("class");
35  if (destructor != null) {
36  className = destructor.getName();
37  }
38 
39  stringBuffer.append(TEXT_1);
40  stringBuffer.append( className );
41  stringBuffer.append(TEXT_2);
42 
43  if (destructor != null) {
44  stringBuffer.append(destructor.getMethodCode());
45  }
46 
47  stringBuffer.append(TEXT_3);
48 
49  return stringBuffer.toString();
50  }
51 }