Package: VdmElementLabels

VdmElementLabels

nameinstructionbranchcomplexitylinemethod
VdmElementLabels()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getClassDefinitionLabel(SClassDefinition, long)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getExplicitFunctionDefinitionLabel(AExplicitFunctionDefinition)
M: 98 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 20 C: 0
0%
M: 1 C: 0
0%
getExplicitOperationDefinitionLabel(AExplicitOperationDefinition)
M: 103 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 21 C: 0
0%
M: 1 C: 0
0%
getImplicitFunctionDefinitionLabel(AImplicitFunctionDefinition)
M: 102 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 21 C: 0
0%
M: 1 C: 0
0%
getImplicitOperationDefinitionLabel(AImplicitOperationDefinition)
M: 103 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 21 C: 0
0%
M: 1 C: 0
0%
getImportFromModuleLabel(AFromModuleImports)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getImportLabel(PImport)
M: 119 C: 0
0%
M: 12 C: 0
0%
M: 7 C: 0
0%
M: 23 C: 0
0%
M: 1 C: 0
0%
getImportedDefinitionLabel(Object, long)
M: 45 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%
getInheritedDefinition(AInheritedDefinition, long)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getInstanceVariableDefinitionLabel(AInstanceVariableDefinition)
M: 25 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getLocalDefinitionLabel(ALocalDefinition)
M: 54 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
getModuleLabel(AModuleModules, long)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getNamedTraceDefinitionLabel(ANamedTraceDefinition)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getPerSyncDefinitionLabel(APerSyncDefinition)
M: 17 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getRenamedDefinitionLabel(ARenamedDefinition, long)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSimpleTypeString(PType)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getStyledTextLabel(Object, long)
M: 188 C: 0
0%
M: 40 C: 0
0%
M: 21 C: 0
0%
M: 51 C: 0
0%
M: 1 C: 0
0%
getTextLabel(Object, long)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getTypeDefinitionLabel(ATypeDefinition)
M: 54 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
getUntypedDefinition(AUntypedDefinition)
M: 143 C: 0
0%
M: 22 C: 0
0%
M: 12 C: 0
0%
M: 34 C: 0
0%
M: 1 C: 0
0%
processUnresolved(PType)
M: 27 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.ui
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.ide.ui.internal.viewsupport;
23:
24: import java.util.HashMap;
25: import java.util.List;
26: import java.util.Map;
27:
28: import org.eclipse.jface.viewers.StyledString;
29: import org.overture.ast.definitions.AExplicitFunctionDefinition;
30: import org.overture.ast.definitions.AExplicitOperationDefinition;
31: import org.overture.ast.definitions.AImplicitFunctionDefinition;
32: import org.overture.ast.definitions.AImplicitOperationDefinition;
33: import org.overture.ast.definitions.AImportedDefinition;
34: import org.overture.ast.definitions.AInheritedDefinition;
35: import org.overture.ast.definitions.AInstanceVariableDefinition;
36: import org.overture.ast.definitions.ALocalDefinition;
37: import org.overture.ast.definitions.ANamedTraceDefinition;
38: import org.overture.ast.definitions.APerSyncDefinition;
39: import org.overture.ast.definitions.ARenamedDefinition;
40: import org.overture.ast.definitions.ATypeDefinition;
41: import org.overture.ast.definitions.AUntypedDefinition;
42: import org.overture.ast.definitions.AValueDefinition;
43: import org.overture.ast.definitions.PDefinition;
44: import org.overture.ast.definitions.SClassDefinition;
45: import org.overture.ast.intf.lex.ILexLocation;
46: import org.overture.ast.modules.AAllImport;
47: import org.overture.ast.modules.AFromModuleImports;
48: import org.overture.ast.modules.AModuleImports;
49: import org.overture.ast.modules.AModuleModules;
50: import org.overture.ast.modules.ATypeImport;
51: import org.overture.ast.modules.PImport;
52: import org.overture.ast.modules.SValueImport;
53: import org.overture.ast.types.AFieldField;
54: import org.overture.ast.types.AFunctionType;
55: import org.overture.ast.types.ANamedInvariantType;
56: import org.overture.ast.types.AOperationType;
57: import org.overture.ast.types.AProductType;
58: import org.overture.ast.types.ARecordInvariantType;
59: import org.overture.ast.types.AUnresolvedType;
60: import org.overture.ast.types.AVoidType;
61: import org.overture.ast.types.PType;
62:
63: public class VdmElementLabels {
64:
65:         /**
66:          * Specifies to apply color styles to labels. This flag only applies to
67:          * methods taking or returning a {@link StyledString}.
68:          *
69:          * @since 3.4
70:          */
71:         public final static long COLORIZE = 1L << 55;
72:
73:         /**
74:          * Default options (M_PARAMETER_TYPES, M_APP_TYPE_PARAMETERS &
75:          * T_TYPE_PARAMETERS enabled)
76:          */
77:         public final static long ALL_DEFAULT = 1231;
78:
79: //        /**
80: //         * Returns the styled string for the given resource. The returned label is
81: //         * BiDi-processed with {@link TextProcessor#process(String, String)}.
82: //         *
83: //         * @param resource
84: //         * the resource
85: //         * @return the styled string
86: //         * @since 3.4
87: //         */
88:         // private static StyledString getStyledResourceLabel(IResource resource) {
89:         // StyledString result = new StyledString(resource.getName());
90:         // return Strings.markLTR(result);
91:         // }
92:
93:         // TODO: this map should be deleted when the AST fix is made
94:         // so that definitions contain a reference to the module they belong
95:         static Map<String, AModuleModules> activeModule = new HashMap<String, AModuleModules>();
96:
97:         public static StyledString getStyledTextLabel(Object element, long flags) {
98:                 // if (element instanceof IVdmElement) {
99:                 // return getElementLabel((IVdmElement) element, flags);
100:                 // }
101:•                if (element instanceof SClassDefinition) {
102:                         // activeModule = null;
103:                         return getClassDefinitionLabel((SClassDefinition) element, flags);
104:                 }
105:•                if (element instanceof AModuleModules) {
106:                         activeModule.put(((AModuleModules) element).getName().getName(), ((AModuleModules) element));
107:                         return getModuleLabel((AModuleModules) element, flags);
108:                 }
109:•                if (element instanceof AInstanceVariableDefinition) {
110:                         return getInstanceVariableDefinitionLabel((AInstanceVariableDefinition) element);
111:                 }
112:•                if (element instanceof ATypeDefinition) {
113:                         return getTypeDefinitionLabel((ATypeDefinition) element);
114:                 }
115:•                if (element instanceof AExplicitOperationDefinition) {
116:                         return getExplicitOperationDefinitionLabel((AExplicitOperationDefinition) element);
117:                 }
118:•                if (element instanceof AImplicitOperationDefinition) {
119:                         return getImplicitOperationDefinitionLabel((AImplicitOperationDefinition) element);
120:                 }
121:
122:•                if (element instanceof AExplicitFunctionDefinition) {
123:                         return getExplicitFunctionDefinitionLabel((AExplicitFunctionDefinition) element);
124:                 }
125:
126:•                if (element instanceof AImplicitFunctionDefinition) {
127:                         return getImplicitFunctionDefinitionLabel((AImplicitFunctionDefinition) element);
128:                 }
129:•                if (element instanceof ALocalDefinition) {
130:                         return getLocalDefinitionLabel((ALocalDefinition) element);
131:                 }
132:                 if (element instanceof AValueDefinition) {
133: //                        System.out.println("VALUE DEF");
134:                 }
135:•                if (element instanceof ANamedTraceDefinition) {
136:                         return getNamedTraceDefinitionLabel((ANamedTraceDefinition) element);
137:                 }
138:
139:•                if (element instanceof AUntypedDefinition) {
140:                         return getUntypedDefinition((AUntypedDefinition) element);
141:                 }
142:
143:•                if (element instanceof AModuleImports) {
144:                         StyledString result = new StyledString();
145:                         result.append("import definitions");
146:                         return result;
147:                 }
148:
149:•                if (element instanceof AFromModuleImports) {
150:                         return getImportFromModuleLabel((AFromModuleImports) element);
151:                 }
152:
153:•                if (element instanceof PImport) {
154:                         return getImportLabel((PImport) element);
155:                 }
156:
157:•                if (element instanceof AFieldField) {
158:                         StyledString result = new StyledString();
159:                         result.append(((AFieldField) element).getTag());
160:                         result.append(" : " + processUnresolved(((AFieldField) element).getType()),
161:                                         StyledString.DECORATIONS_STYLER);
162:                         return result;
163:                 }
164:
165:•                if (element instanceof APerSyncDefinition) {
166:                         return getPerSyncDefinitionLabel((APerSyncDefinition) element);
167:                 }
168:
169:•                if (element instanceof AInheritedDefinition) {
170:                         return getInheritedDefinition((AInheritedDefinition) element, flags);
171:                 }
172:
173:•                if (element instanceof ImportsContainer) {
174:                         return getStyledTextLabel(
175:                                         (AModuleImports) ((ImportsContainer) element).getImports(),
176:                                         flags);
177:                 }
178:
179:•                if (element instanceof ARenamedDefinition) {
180:                         return getRenamedDefinitionLabel((ARenamedDefinition) element, flags);
181:                 }
182:
183:•                if(element instanceof AImportedDefinition)
184:                 {
185:                         return getImportedDefinitionLabel(element, flags);
186:                 }
187:                 
188: //                StyledString result = new StyledString();
189: //                result.append("Unsupported type reached: " + element);
190: //                return result;
191:                 return null;
192:
193:         }
194:
195:         private static StyledString getImportedDefinitionLabel(Object element, long flags)
196:         {
197:                 AImportedDefinition e = (AImportedDefinition) element;
198:                 
199:                 StyledString defStr = getStyledTextLabel(e.getDef(), flags);
200:                 
201:•                if(defStr == null)
202:                 {
203:                         return null;
204:                 }
205:                 else
206:                 {
207:                         PDefinition def = e.getDef();
208:
209:•                        if (def != null)
210:                         {
211:                                 ILexLocation loc = def.getLocation();
212:
213:•                                if (loc != null)
214:                                 {
215:                                         String module = loc.getModule();
216:
217:•                                        if (module != null)
218:                                         {
219:                                                 StyledString fromModuleStr = new StyledString(module
220:                                                                 + ": ");
221:                                                 return fromModuleStr.append(defStr);
222:                                         }
223:                                 }
224:                         }
225:
226:                         return defStr;
227:                 }
228:         }
229:
230:         private static StyledString getRenamedDefinitionLabel(
231:                         ARenamedDefinition element, long flags) {
232:
233:                 return getStyledTextLabel(element.getDef(), flags);
234:
235:         }
236:
237:         private static StyledString getInheritedDefinition(
238:                         AInheritedDefinition element, long flags) {
239:
240:                 StyledString res = getStyledTextLabel(element.getSuperdef(), flags);
241:
242:                 return res;
243:         }
244:
245:         private static StyledString getPerSyncDefinitionLabel(
246:                         APerSyncDefinition element) {
247:                 StyledString result = new StyledString();
248:                 result.append(element.getName().getSimpleName());
249:                 result.append(" : sync predicate", StyledString.DECORATIONS_STYLER);
250:                 return result;
251:         }
252:
253:         private static StyledString getImplicitOperationDefinitionLabel(
254:                         AImplicitOperationDefinition element) {
255:                 StyledString result = new StyledString();
256:
257:                 result.append(element.getName().getSimpleName());
258:
259:•                if (element.getType() instanceof AOperationType) {
260: AOperationType type = (AOperationType)element.getType();
261:•                        if (type.getParameters().size() == 0) {
262:                                 result.append("() ");
263:                         } else {
264:                                 result.append("(");
265:                                 int i = 0;
266:•                                while (i < type.getParameters().size() - 1) {
267:                                         PType definition = (PType) type.getParameters().get(i);
268:                                         result.append(getSimpleTypeString(definition) + ", ");
269:
270:                                         i++;
271:                                 }
272:                                 PType definition = (PType) type.getParameters().get(i);
273:                                 result.append(getSimpleTypeString(definition) + ")");
274:                         }
275:
276:• if (type.getResult() instanceof AVoidType) {
277: result.append(" : ()", StyledString.DECORATIONS_STYLER);
278:                  } else {
279:                          result.append(" : " + getSimpleTypeString(type.getResult()),
280:                                          StyledString.DECORATIONS_STYLER);
281:                  }
282:
283:                 }
284:
285:
286:                 return result;
287:         }
288:
289:         private static StyledString getImplicitFunctionDefinitionLabel(
290:                         AImplicitFunctionDefinition element) {
291:                 StyledString result = new StyledString();
292:                 result.append(element.getName().getSimpleName());
293:
294:•                if (element.getType() instanceof AFunctionType) {
295: AFunctionType type = (AFunctionType)element.getType();
296:•                        if (type.getParameters().size() == 0) {
297:                                 result.append("() ");
298:                         } else {
299:                                 result.append("(");
300:                                 int i = 0;
301:•                                while (i < type.getParameters().size() - 1) {
302:                                         PType definition = (PType) type.getParameters().get(i);
303:                                         result.append(getSimpleTypeString(definition) + ", ");
304:
305:                                         i++;
306:                                 }
307:                                 PType definition = (PType) type.getParameters().get(i);
308:                                 result.append(getSimpleTypeString(definition) + ")");
309:                         }
310:
311:•                 if (type.getResult() instanceof AVoidType) {
312:                          result.append(" : ()", StyledString.DECORATIONS_STYLER);
313:                  } else {
314:                          result.append(" : " + getSimpleTypeString(type.getResult()),
315:                                         StyledString.DECORATIONS_STYLER);
316:                  }
317:                 }
318:
319:
320:                 return result;
321:         }
322:
323:         private static StyledString getImportLabel(PImport element) {
324:
325:                 StyledString result = new StyledString();
326:
327:•                if (element instanceof AAllImport) {
328:                         result.append(element.getName().getSimpleName());
329:•                } else if (element instanceof ATypeImport) {
330:                         
331:                         
332:                         ATypeImport type = (ATypeImport) element;
333:                         result.append(type.getName().getSimpleName());
334:•                        if(type.getDef()!=null)
335:                         {
336:                                 result.append(" : " + getSimpleTypeString(type.getDef().getType()), StyledString.DECORATIONS_STYLER);
337:                         }else
338:                         {
339:                                 result.append(" : " , StyledString.DECORATIONS_STYLER);
340:                         }
341:                         
342:                         result.append(type.getRenamed().getName(), StyledString.DECORATIONS_STYLER);
343:•                } else if (element instanceof SValueImport) {
344:                         SValueImport value = (SValueImport) element;
345:                         result.append(value.getName().getSimpleName());
346:•                        if (value.getImportType() != null) {
347:                                 String typeString = value.getImportType().toString();
348:                                 typeString = typeString.replaceFirst("[(]", "");
349:                                 typeString = typeString.substring(0, typeString.length() - 1);
350:                                 result.append(" : " + typeString);
351:                         }
352:                 }
353:
354:•                if (element.getRenamed()!= null) {
355:                         result.append(" (renamed as: " + element.getRenamed().getFullName() + ")",
356:                                         StyledString.DECORATIONS_STYLER);
357:                 }
358:                 return result;
359:         }
360:
361:         private static StyledString getImportFromModuleLabel(
362:                         AFromModuleImports element) {
363:                 StyledString result = new StyledString();
364:
365:                 result.append(element.getName().getName());
366:
367:                 return result;
368:         }
369:
370:         private static StyledString getNamedTraceDefinitionLabel(
371:                         ANamedTraceDefinition element) {
372:                 StyledString result = new StyledString();
373:                 result.append(element.getName().getSimpleName());
374:                 return result;
375:         }
376:
377:         private static StyledString getUntypedDefinition(AUntypedDefinition element) {
378:                 StyledString result = new StyledString();
379:                 result.append(element.getName().getSimpleName());
380:                 List<PDefinition> definitions = null;
381:•                if (element.getClassDefinition() != null) {
382:                         SClassDefinition classDef = element.getClassDefinition();
383:                         definitions = classDef.getDefinitions();
384:                 } else {
385:•                        if (activeModule != null && activeModule.containsKey(element.getName().getModule()))
386:                         {
387:                                 definitions = activeModule.get(element.getName().getModule()).getDefs();
388:                         }
389:                                 
390:                 }
391:•                if (definitions != null) {
392:•                        for (PDefinition def : definitions) {
393:•                                if (def instanceof AValueDefinition) {
394:•                                        for (int i = 0; i < ((AValueDefinition)def).getDefs().size(); i++) {
395:                                                 if (((AValueDefinition)def).getDefs().get(i).getLocation()
396:•                                                                .equals(element.getLocation())) {
397:                                                         PType type = ((AValueDefinition) def).getType();
398:•                                                        if (type instanceof AProductType) {
399:                                                                 return result
400:                                                                                 .append(" : "
401:                                                                                                 + getSimpleTypeString(((AProductType) type).getTypes()
402:                                                                                                                 .get(i)),
403:                                                                                                 StyledString.DECORATIONS_STYLER);
404:•                                                        } else if (type instanceof AUnresolvedType) {
405:                                                                 return result.append(" : "
406:                                                                                 + getSimpleTypeString(type),
407:                                                                                 StyledString.DECORATIONS_STYLER);
408:•                                                        } else if (type != null) {
409:                                                                 return result.append(" : "
410:                                                                                 + getSimpleTypeString(type),
411:                                                                                 StyledString.DECORATIONS_STYLER);
412:                                                         } else {
413:                                                                 // System.err.println("Could not translate type");
414:                                                                 return result.append(" : "
415:                                                                                 + ((AValueDefinition) def).getExpression(),
416:                                                                                 StyledString.DECORATIONS_STYLER);
417:                                                         }
418:                                                 }
419:                                         }
420:                                 }
421:                         }
422:                 }
423:
424:                 // Type elemType = element.getType();
425:                 // result.append(" : " + getSimpleTypeString(elemType),
426:                 // StyledString.DECORATIONS_STYLER);
427:                 return result;
428:         }
429:
430:         private static StyledString getLocalDefinitionLabel(ALocalDefinition element) {
431:                 StyledString result = new StyledString();
432:                 result.append(element.getName().getSimpleName());
433:•                if (element.getType().getLocation().getModule().toLowerCase().equals("default")) {
434:                         result.append(" : " + getSimpleTypeString(element.getType()),
435:                                         StyledString.DECORATIONS_STYLER);
436:                 } else {
437:                         result.append(" : " + element.getType().getLocation().getModule() + "`"
438:                                         + getSimpleTypeString(element.getType()),
439:                                         StyledString.DECORATIONS_STYLER);
440:                 }
441:                 return result;
442:         }
443:
444:         private static StyledString getExplicitFunctionDefinitionLabel(
445:                         AExplicitFunctionDefinition element) {
446:                 StyledString result = new StyledString();
447:                 result.append(element.getName().getSimpleName());
448:
449:                 AFunctionType type = (AFunctionType)element.getType();
450:•                if (type.getParameters().size() == 0)
451:                 {
452:                         result.append("() ");
453:                 } else
454:                 {
455:                         result.append("(");
456:                         int i = 0;
457:•                        while (i < type.getParameters().size() - 1)
458:                         {
459:                                 PType definition = (PType) type.getParameters().get(i);
460:                                 result.append(getSimpleTypeString(definition) + ", ");
461:
462:                                 i++;
463:                         }
464:                         PType definition = (PType) type.getParameters().get(i);
465:                         result.append(getSimpleTypeString(definition) + ")");
466:                 }
467:
468:•                 if (type.getResult() instanceof AVoidType) {
469:                         result.append(" : ()", StyledString.DECORATIONS_STYLER);
470:                 } else {
471:                         result.append(" : " + getSimpleTypeString(type.getResult()),
472:                                         StyledString.DECORATIONS_STYLER);
473:
474:                 }
475:
476:                 return result;
477:         }
478:
479:         private static StyledString getTypeDefinitionLabel(ATypeDefinition element) {
480:                 StyledString result = new StyledString();
481:•                if (element.getType() instanceof ARecordInvariantType) {
482:
483:                         result.append(element.getName().getSimpleName());
484:                         result.append(" : record type", StyledString.DECORATIONS_STYLER);
485:•                } else if (element.getType() instanceof ANamedInvariantType) {
486:
487:                         result.append(element.getName().getSimpleName());
488:                         result.append(" : "
489:                                         + getSimpleTypeString(((ANamedInvariantType)element.getType()).getType()),
490:                                         StyledString.DECORATIONS_STYLER);
491:
492:                 }
493:                 else
494:                         result.append(element.getName().getFullName());
495:                 return result;
496:         }
497:
498:         private static StyledString getExplicitOperationDefinitionLabel(
499:                         AExplicitOperationDefinition element) {
500:                 StyledString result = new StyledString();
501:
502:                 result.append(element.getName().getSimpleName());
503:
504:•                if (element.getType() instanceof AOperationType) {
505: AOperationType type = (AOperationType)element.getType();
506:•                        if (type.getParameters().size() == 0) {
507:                                 result.append("() ");
508:                         } else {
509:                                 result.append("(");
510:                                 int i = 0;
511:•                                while (i < type.getParameters().size() - 1) {
512:                                         PType definition = (PType) type.getParameters().get(i);
513:                                         result.append(getSimpleTypeString(definition) + ", ");
514:
515:                                         i++;
516:                                 }
517:                                 PType definition = (PType) type.getParameters().get(i);
518:                                 result.append(getSimpleTypeString(definition) + ")");
519:                         }
520:
521:•                 if (type.getResult() instanceof AVoidType) {
522:                          result.append(" : ()", StyledString.DECORATIONS_STYLER);
523:                  } else {
524:                          result.append(" : " + getSimpleTypeString(type.getResult()),
525:                                         StyledString.DECORATIONS_STYLER);
526:                 }
527:                 }
528:
529:
530:                 return result;
531:         }
532:
533:         private static StyledString getInstanceVariableDefinitionLabel(
534:                         AInstanceVariableDefinition element) {
535:                 StyledString result = new StyledString();
536:                 result.append(element.getName().getSimpleName());
537:                 result.append(" : " + getSimpleTypeString(element.getType()),
538:                                 StyledString.DECORATIONS_STYLER);
539:                 return result;
540:         }
541:
542:         private static StyledString getClassDefinitionLabel(
543:                         SClassDefinition element, long flags) {
544:                 StyledString result = new StyledString();
545:                 result.append(element.getName().getSimpleName());
546:                 return result;
547:         }
548:
549:         private static StyledString getModuleLabel(AModuleModules element, long flags) {
550:                 StyledString result = new StyledString();
551:                 result.append(element.getName().getName());
552:                 return result;
553:         }
554:
555:         public static String getTextLabel(Object element, long evaluateTextFlags) {
556:                 // TODO Auto-generated method stub
557:                 return null;
558:         }
559:
560:         private static String processUnresolved(PType definition) {
561:
562:                 String defString = definition.toString();
563:
564:•                if (defString.contains("unresolved ")) {
565:                         defString = defString.replace("(", "");
566:                         defString = defString.replace(")", "");
567:                         defString = defString.replace("unresolved ", "");
568:                         return defString;
569:                 }
570:                 return definition.toString();
571:         }
572:
573:         protected static String getSimpleTypeString(PType type) {
574:                 String typeName = processUnresolved(type);
575:                 typeName = typeName.replace("(", "");
576:                 typeName = typeName.replace(")", "");
577:                 return typeName;
578:         }
579: }