EOS 2  1.1.0
Einfache Objektbasierte Sprache
AutoCompleteEntry.java
gehe zur Dokumentation dieser Datei
1 package de.lathanda.eos.baseparser;
2 
9 public class AutoCompleteEntry implements AutoCompleteInformation {
13  public final Type cls;
17  public final String scantext;
21  public final String label;
25  public final String sort;
29  public final String tooltip;
33  public final String template;
38  public final int type;
39  public final int selectionStart;
40  public final int selectionLength;
41 
42  public AutoCompleteEntry(Type cls, String scantext, String label, String sort, String tooltip, String template, int type, int start, int length) {
43  this.cls = cls;
44  this.scantext = scantext;
45  this.label = label;
46  this.sort = sort;
47  this.tooltip = tooltip;
48  this.template = template;
49  this.type = type;
50  this.selectionStart = start;
51  this.selectionLength = length;
52  }
53 
54  public static AutoCompleteEntry createTemplateEntry(String sort, String label, String template, int start, int length) {
55  return new AutoCompleteEntry(
56  Type.getVoid(),
57  "",
58  label,
59  sort,
60  "",
61  template,
62  CODE,
63  start,
64  length
65  );
66  }
67  public static AutoCompleteEntry createClassEntry(Type type, String scan, String label, String tooltip) {
68  return new AutoCompleteEntry(
69  type,
70  scan,
71  label,
72  scan,
73  tooltip,
74  label,
75  CLASS,
76  label.length(),
77  0
78  );
79  }
80 
81  public static AutoCompleteEntry createMethodEntry(SystemType cls, String scan, String label, String[] parameters, String tooltip) {
82  StringBuilder template = new StringBuilder(label);
83  int start, length;
84  if (parameters.length == 0) {
85  template.append("()");
86  start = template.length();
87  length = 0;
88  } else {
89  template.append("(");
90  start = template.length();
91  length = parameters[0].length();
92  template.append(parameters[0]);
93  for(int i = 1; i < parameters.length; i++) {
94  template.append(", ");
95  template.append(parameters[i]);
96  }
97  template.append(")");
98 
99  }
100  return new AutoCompleteEntry(
101  cls,
102  scan,
103  label,
104  scan,
105  tooltip,
106  template.toString(),
107  METHOD,
108  start,
109  length
110  );
111  }
112 
113  public static AutoCompleteEntry createPropertyEntry(SystemType cls, String scan, String label, String tooltip) {
114  return new AutoCompleteEntry(
115  cls,
116  scan,
117  label,
118  scan,
119  tooltip,
120  label,
121  PROPERTY,
122  label.length(),
123  0
124  );
125  }
126 
127  @Override
128  public String getScantext() {
129  return scantext;
130  }
131 
133  return cls;
134  }
135 
136  public String getLabel() {
137  return label;
138  }
139 
140  public String getSort() {
141  return sort;
142  }
143 
144  public String getTooltip() {
145  return tooltip;
146  }
147 
148  public String getTemplate() {
149  return template;
150  }
151 
152  public int getType() {
153  return type;
154  }
155 
156  @Override
157  public int getSelectionStart() {
158  return selectionStart;
159  }
160 
161  @Override
162  public int getSelectionLength() {
163  return selectionLength;
164  }
165 
166 }
String getTooltip()
static AutoCompleteEntry createPropertyEntry(SystemType cls, String scan, String label, String tooltip)
AutoCompleteType getCls()
final Type cls
static AutoCompleteEntry createMethodEntry(SystemType cls, String scan, String label, String[] parameters, String tooltip)
String getTemplate()
String getSort()
final String scantext
int getSelectionLength()
String getScantext()
AutoCompleteEntry(Type cls, String scantext, String label, String sort, String tooltip, String template, int type, int start, int length)
final String label
final int selectionLength
final String tooltip
static AutoCompleteEntry createClassEntry(Type type, String scan, String label, String tooltip)
int getType()
final int type
int getSelectionStart()
static AutoCompleteEntry createTemplateEntry(String sort, String label, String template, int start, int length)
String getLabel()
final String sort
final int selectionStart
static SystemType getVoid()
Definition: Type.java:76
Impressum