Commit 6d9a5139 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

Fixed class member listing when hovering


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 090615d5
......@@ -1119,6 +1119,39 @@ public final class Class_Type extends Type implements ITypeWithComponents {
return definitions;
}
/** Gets all definitions of a class including both local and inherited members
*
* @return A map of definitions with an indication if the definitions are inherited
*/
private Map<Definition,Boolean> getAllDefintions() {
Map<Definition,Boolean> definitions = new HashMap<>();
if (baseClass != null) {
for (Definition def : baseClass.getDefinitions()) {
definitions.put(def, true);
}
}
if (baseTraits != null) {
for (int i = 0; i < baseTraits.getNofTypes(); i++) {
final Type baseTrait = baseTraits.getType(i);
if (baseTrait instanceof Class_Type) {
for (Definition def : ((Class_Type)baseTrait).getDefinitions()) {
definitions.put(def, true);
}
}
}
}
if (members.getDefinitionMap() != null) {
for (Map.Entry<String,Definition> defs : members.getDefinitionMap().entrySet()) {
definitions.put(defs.getValue(), false);
}
}
return definitions;
}
@Override
/** {@inheritDoc} */
public void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
......@@ -1283,7 +1316,8 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (dc != null) {
members = dc.getMembers();
}
for (Definition def : getDefinitions()) {
for (Map.Entry<Definition,Boolean> defs : getAllDefintions().entrySet()) {
final Definition def = defs.getKey();
switch (def.getVisibilityModifier()) {
case Private:
content.addText("<span style=\"margin-left: 20px; margin-right: 5px; color: red;\">\u25fc</span>");
......@@ -1324,9 +1358,9 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (isOverride) {
content.addStyledText(" (overridden)", SWT.ITALIC);
} else {
// if (isDefintionInherited(def)) {
// content.addStyledText(" (inherited)", SWT.ITALIC);
// }
if (defs.getValue()) {
content.addStyledText(" (inherited)", SWT.ITALIC);
}
if (def.getNameParent() instanceof Class_Type) {
final Class_Type parentBody = (Class_Type)def.getNameParent();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment