Commit 95081691 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

More types converted to IHoverContent


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 9d7b617f
......@@ -7,12 +7,15 @@
******************************************************************************/
package org.eclipse.titan.designer.AST.TTCN3.definitions;
import java.net.ContentHandler;
import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
import org.antlr.v4.runtime.tree.ParseTree;
import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.DocumentComment;
import org.eclipse.titan.designer.AST.GovernedSimple.CodeSectionType;
import org.eclipse.titan.designer.AST.INamedNode;
import org.eclipse.titan.designer.AST.IReferenceChain;
......@@ -41,6 +44,8 @@ import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.editors.ProposalCollector;
import org.eclipse.titan.designer.editors.T3Doc;
import org.eclipse.titan.designer.editors.actions.DeclarationCollector;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent.ContentType;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import org.eclipse.titan.designer.parsers.ParserUtilities;
import org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser;
......@@ -52,12 +57,14 @@ import org.eclipse.titan.designer.parsers.ttcn3parser.Ttcn3Lexer;
import org.eclipse.titan.designer.parsers.ttcn3parser.Ttcn3Reparser;
import org.eclipse.titan.designer.parsers.ttcn3parser.Ttcn3Reparser.Pr_ExpressionContext;
import org.eclipse.titan.designer.preferences.PreferenceConstants;
import org.eclipse.ui.IEditorPart;
/**
* The Def_Const class represents TTCN3 constant definitions.
*
* @author Kristof Szabados
* @author Arpad Lovassy
* @author Miklos Magyari
*/
public final class Def_Const extends Definition {
private static final String FULLNAMEPART = ".<type>";
......@@ -547,4 +554,25 @@ public final class Def_Const extends Definition {
public void generateCodeInitComp(final JavaGenData aData, final StringBuilder initComp, final Definition definition) {
/* This function actually does nothing as this and base_defn are exactly the same. */
}
@Override
public Ttcn3HoverContent getHoverContent(IEditorPart editor, Assignment assignment) {
super.getHoverContent(editor, assignment);
final IType constType = assignment.getType(getLastTimeChecked());
String typeName = null;
if (constType != null) {
typeName = constType.getTypename();
}
hoverContent.addText("constant ");
hoverContent.addStyledText(typeName + " " + ((Definition)assignment).getIdentifier().getName(), Ttcn3HoverContent.boldRange());
hoverContent.addText("\nValue: " + ((Def_Const)assignment).getValue().createStringRepresentation());
if (hasDocumentComment()) {
final DocumentComment dc = getDocumentComment();
dc.addDescsContent(hoverContent);
dc.addAuthorsContent(hoverContent);
}
hoverContent.addContent(ContentType.Info);
return hoverContent;
}
}
......@@ -18,9 +18,6 @@ import java.util.Set;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Color;
import org.eclipse.titan.common.logging.ErrorReporter;
import org.eclipse.titan.designer.Activator;
import org.eclipse.titan.designer.AST.ASTVisitor;
......@@ -1496,10 +1493,10 @@ public final class Def_Function extends Definition implements IParameterisedAssi
}
@Override
public Ttcn3HoverContent getHoverContent(IEditorPart editor, Assignment ass) {
super.getHoverContent(editor, ass);
public Ttcn3HoverContent getHoverContent(IEditorPart editor, Assignment assignment) {
super.getHoverContent(editor, assignment);
final Def_Function func = (Def_Function)ass;
final Def_Function func = (Def_Function)assignment;
hoverContent.addText("function ");
hoverContent.addStyledText(getIdentifier().getDisplayName(), Ttcn3HoverContent.boldRange());
......@@ -1542,8 +1539,6 @@ public final class Def_Function extends Definition implements IParameterisedAssi
return hoverContent;
}
private String getFormalParamType(FormalParameter fp) {
String paramType;
......@@ -1551,15 +1546,15 @@ public final class Def_Function extends Definition implements IParameterisedAssi
case A_PAR_VAL:
case A_PAR_VAL_IN:
case A_PAR_TEMP_IN:
paramType = "IN";
paramType = "in";
break;
case A_PAR_VAL_INOUT:
case A_PAR_TEMP_INOUT:
paramType = "INOUT";
paramType = "inout";
break;
case A_PAR_VAL_OUT:
case A_PAR_TEMP_OUT:
paramType = "OUT";
paramType = "out";
break;
default:
paramType = null;
......
......@@ -13,8 +13,11 @@ import java.util.List;
import java.util.Locale;
import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.DocumentComment;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.ISubReference;
import org.eclipse.titan.designer.AST.IType;
import org.eclipse.titan.designer.AST.ISubReference.Subreference_type;
import org.eclipse.titan.designer.AST.IType.TypeOwner_type;
import org.eclipse.titan.designer.AST.IType.Type_type;
......@@ -37,13 +40,18 @@ import org.eclipse.titan.designer.AST.TTCN3.attributes.SingleWithAttribute.Attri
import org.eclipse.titan.designer.AST.TTCN3.attributes.WithAttributesPath;
import org.eclipse.titan.designer.AST.TTCN3.types.Address_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.Altstep_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.ClassTypeBody;
import org.eclipse.titan.designer.AST.TTCN3.types.Class_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.Component_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.Function_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.Testcase_Type;
import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.editors.ProposalCollector;
import org.eclipse.titan.designer.editors.T3Doc;
import org.eclipse.titan.designer.editors.actions.DeclarationCollector;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent.ContentType;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import org.eclipse.titan.designer.parsers.extensionattributeparser.ExtensionAttributeAnalyzer;
import org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser;
......@@ -52,6 +60,7 @@ import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException;
import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
import org.eclipse.titan.designer.parsers.ttcn3parser.Ttcn3Lexer;
import org.eclipse.titan.designer.preferences.PreferenceConstants;
import org.eclipse.ui.IEditorPart;
/**
* The Def_Type class represents TTCN3 type definitions.
......@@ -535,4 +544,27 @@ public final class Def_Type extends Definition {
sb.append(source);
}
@Override
public Ttcn3HoverContent getHoverContent(IEditorPart editor, Assignment assignment) {
super.getHoverContent(editor, assignment);
final CompilationTimeStamp timestamp = getLastTimeChecked();
final IType varType = assignment.getType(timestamp);
if (varType instanceof Class_Type) {
hoverContent.addText("\n\n");
final Class_Type ct = (Class_Type)varType;
final ClassTypeBody body = ct.getClassBody();
if (body != null) {
DocumentComment dc = null;
if (hasDocumentComment()) {
dc = getDocumentComment();
}
body.addClassMembers(assignment, hoverContent, dc);
}
}
hoverContent.addContent(ContentType.Info);
return hoverContent;
}
}
......@@ -12,6 +12,8 @@ import java.util.List;
import java.util.Locale;
import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.DocumentComment;
import org.eclipse.titan.designer.AST.GovernedSimple.CodeSectionType;
import org.eclipse.titan.designer.AST.INamedNode;
import org.eclipse.titan.designer.AST.IReferenceChain;
......@@ -37,11 +39,15 @@ import org.eclipse.titan.designer.AST.TTCN3.attributes.WithAttributesPath;
import org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter.parameterEvaluationType;
import org.eclipse.titan.designer.AST.TTCN3.types.Array_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.ClassTypeBody;
import org.eclipse.titan.designer.AST.TTCN3.types.Class_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.ComponentTypeBody;
import org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type;
import org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct;
import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.editors.ProposalCollector;
import org.eclipse.titan.designer.editors.actions.DeclarationCollector;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent.ContentType;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import org.eclipse.titan.designer.parsers.ttcn3parser.IIdentifierReparser;
import org.eclipse.titan.designer.parsers.ttcn3parser.IdentifierReparser;
......@@ -49,6 +55,7 @@ import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException;
import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
import org.eclipse.titan.designer.parsers.ttcn3parser.Ttcn3Lexer;
import org.eclipse.titan.designer.preferences.PreferenceConstants;
import org.eclipse.ui.IEditorPart;
/**
* The Def_Var class represents TTCN3 variable definitions.
......@@ -537,4 +544,26 @@ public final class Def_Var extends Definition {
initialValue.generateCodeInit(aData, initComp, definition.getGenNameFromScope(aData, initComp, ""));
}
}
@Override
public Ttcn3HoverContent getHoverContent(IEditorPart editor, Assignment assignment) {
super.getHoverContent(editor, assignment);
final CompilationTimeStamp timestamp = getLastTimeChecked();
final IType varType = assignment.getType(timestamp);
String typeName = null;
if (varType != null) {
typeName = varType.getTypename();
}
hoverContent.addText("var ");
hoverContent.addStyledText(typeName + " " + ((Definition)assignment).getIdentifier().getName() + " ", Ttcn3HoverContent.boldRange());
if (hasDocumentComment()) {
final DocumentComment dc = getDocumentComment();
dc.addDescsContent(hoverContent);
dc.addAuthorsContent(hoverContent);
}
hoverContent.addContent(ContentType.Info);
return hoverContent;
}
}
......@@ -823,7 +823,9 @@ public abstract class Definition extends Assignment implements IAppendableSyntax
return isInherited;
}
/** {@inheritDoc} */
public Ttcn3HoverContent getHoverContent(IEditorPart editor, Assignment assignment) {
hoverContent = new Ttcn3HoverContent();
final IFile file = editor.getEditorInput().getAdapter(IFile.class);
PeekSource.addStyledSource(PeekSource.getPeekSource(editor, file, assignment.getDeclaration()), hoverContent);
......
......@@ -4,6 +4,19 @@ import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent;
import org.eclipse.ui.IEditorPart;
/**
* This interface represents the content for editor hovers
* (information, source code, etc.)
*
* @author Miklos Magyari
*/
public interface IHoverContent {
/**
* Gets information for the given node that could be displayed in a source editor hover
*
* @param editor
* @param assignment
* @return
*/
Ttcn3HoverContent getHoverContent(IEditorPart editor, Assignment assignment);
}
......@@ -16,8 +16,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Color;
import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.DocumentComment;
import org.eclipse.titan.designer.AST.FieldSubReference;
import org.eclipse.titan.designer.AST.ILocateableNode;
import org.eclipse.titan.designer.AST.IReferenceChain;
......@@ -35,8 +38,11 @@ import org.eclipse.titan.designer.AST.ReferenceFinder.Hit;
import org.eclipse.titan.designer.AST.TTCN3.IIncrementallyUpdateable;
import org.eclipse.titan.designer.AST.TTCN3.TTCN3Scope;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Timer;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Definition;
import org.eclipse.titan.designer.AST.TTCN3.definitions.VisibilityModifier;
import org.eclipse.titan.designer.editors.Stylers;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException;
import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
......@@ -548,4 +554,51 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
}
return false;
}
public void addClassMembers(Assignment assignment, Ttcn3HoverContent content, DocumentComment dc) {
content.addStyledText("Members:\n\n", Ttcn3HoverContent.boldRange());
Map<String,String> members = null;
if (dc != null) {
members = dc.getMembers();
}
for (Definition def : getDefinitions()) {
Color color;
switch (def.getVisibilityModifier()) {
case Private:
color = Stylers.PrivateColor;
break;
case Public:
color= Stylers.PublicColor;
break;
default:
color = Stylers.ProtectedColor;
}
content.addStyledText(" \u25fc", Ttcn3HoverContent.colorRange(color));
String id = def.getIdentifier().getDisplayName();
String memberText = null;
if (members != null) {
memberText = members.get(id);
}
String memberTypeName = null;
if (def instanceof Def_Function) {
if (id.equals("create")) {
memberTypeName = "constructor";
} else {
memberTypeName = "function";
}
} else if (def instanceof Def_Timer) {
memberTypeName = "timer";
}
else {
final IType memberType = def.getType(lastCompilationTimeStamp);
if (memberType != null) {
memberTypeName = memberType.getTypename();
}
}
content.addText(memberTypeName + " ");
content.addStyledText(def.getIdentifier().getDisplayName(), Ttcn3HoverContent.boldItalicRange());
content.addText(" " + (memberText != null ? memberText : ""));
content.addText("\n");
}
}
}
\ No newline at end of file
......@@ -13,9 +13,7 @@ import org.eclipse.jface.text.rules.IToken;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.Location;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Type;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Definition;
import org.eclipse.titan.designer.declarationsearch.Declaration;
import org.eclipse.titan.designer.editors.ColorManager;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent.ContentType;
......@@ -34,8 +32,7 @@ public class PeekSource {
final Assignment ass = decl.getAssignment();
Location codeLoc = null;
if (ass instanceof Def_Type || ass instanceof Def_Function ||
ass instanceof Def_Testcase) {
if (ass instanceof Definition) {
codeLoc = ass.getLocation();
}
if (codeLoc != null) {
......
......@@ -17,7 +17,8 @@ import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Color;
/**
* This class represents a collection of strings with style ranges
* This class represents a categorized collection of strings with style ranges
*
* Used for ttcn3 editor hover support returned by getHoverInfo2 as an 'object'
*
* @author Miklos Magyari
......@@ -31,7 +32,7 @@ public class Ttcn3HoverContent {
ContentEntry(String text, List<StyleRange> ranges) {
this.text = text;
this.ranges = new ArrayList<StyleRange>(ranges);
this.ranges = ranges != null ? new ArrayList<StyleRange>(ranges) : new ArrayList<StyleRange>();
}
}
......
......@@ -11,8 +11,6 @@ import org.eclipse.jface.text.AbstractInformationControl;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IInformationControlExtension2;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
......@@ -21,6 +19,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.titan.designer.Activator;
import org.eclipse.titan.designer.editors.actions.SwitchHoverWindowContentAction;
import org.eclipse.titan.designer.editors.controls.Ttcn3HoverContent.ContentType;
import org.eclipse.titan.designer.preferences.PreferenceConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.keys.IBindingService;
......@@ -36,7 +35,8 @@ public class Ttcn3HoverInfoControl extends AbstractInformationControl implements
private Ttcn3HoverContent content;
private Shell fShell;
private boolean isRich;
private ContentType actualType = ContentType.Source;
private ContentType actualType =
Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.HOVER_WINDOW_CONTENT).equals("comment") ? ContentType.Info : ContentType.Source;
public Ttcn3HoverInfoControl(Shell parentShell, String string) {
super(parentShell, string);
......@@ -49,14 +49,6 @@ public class Ttcn3HoverInfoControl extends AbstractInformationControl implements
this.isRich = isRich;
createContent(parentShell);
create();
Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
// TODO Auto-generated method stub
}
});
}
@Override
......
......@@ -27,20 +27,14 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.DocumentComment;
import org.eclipse.titan.designer.AST.IType;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.Identifier.Identifier_type;
import org.eclipse.titan.designer.AST.Module;
import org.eclipse.titan.designer.AST.Reference;
import org.eclipse.titan.designer.AST.Scope;
import org.eclipse.titan.designer.AST.Type;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Const;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Timer;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Type;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Var;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Definition;
import org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter;
import org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList;
import org.eclipse.titan.designer.AST.TTCN3.definitions.IHoverContent;
import org.eclipse.titan.designer.AST.TTCN3.types.ClassTypeBody;
import org.eclipse.titan.designer.AST.TTCN3.types.Class_Type;
......@@ -123,28 +117,17 @@ public final class TextHover extends BaseTextHover implements ITextHoverExtensio
DocumentComment dc = ((Definition) assignment).parseDocumentComment();
List<StyleRange> styles = new ArrayList<StyleRange>();
StringBuilder tooltip = new StringBuilder();
if (assignment instanceof IHoverContent) {
info = ((Definition)assignment).getHoverContent(editor, assignment);
}
// if (assignment instanceof Def_Function) {
//// functionHover(tooltip, styles, dc, assignment);
// Def_Function df = (Def_Function)assignment;
// }
if (assignment instanceof Def_Const) {
constantHover(tooltip, styles, dc, assignment, timestamp);
}
if (assignment instanceof Def_Var) {
varHover(tooltip, styles, dc, assignment, timestamp);
}
if (assignment instanceof Def_Type) {
final Def_Type deftype = (Def_Type)assignment;
final Type type = deftype.getType(timestamp);
switch (type.getTypetypeTtcn3()) {
case TYPE_CLASS:
classHover(tooltip, styles, dc, assignment, timestamp);
info = ((IHoverContent)assignment).getHoverContent(editor, assignment);
break;
default:
}
} else if (assignment instanceof IHoverContent) {
info = ((IHoverContent)assignment).getHoverContent(editor, assignment);
}
if (info == null) {
......@@ -211,29 +194,6 @@ public final class TextHover extends BaseTextHover implements ITextHoverExtensio
}
}
private void addParams(StringBuilder sb, List<StyleRange> styles, DocumentComment dc, Assignment ass) {
final Map<String,String> params = dc.getParams();
if (params.size() > 0) {
String paramType = null;
final Def_Function func = (Def_Function)ass;
final FormalParameterList fpl = func.getFormalParameterList();
sb.append("\n\n");
addStyledText(sb, styles, "Parameters:\n", boldRange());
for (Map.Entry<String, String> param : params.entrySet()) {
final FormalParameter fp = fpl.getParameterById(new Identifier(Identifier_type.ID_TTCN, param.getKey()));
if (fp != null) {
paramType = getFormalParamType(fp);
} else {
// FIXME : report param mismatch
}
sb.append("\n ");
addStyledText(sb, styles, param.getKey(), boldItalicRange());
addStyledText(sb, styles, " (" + (paramType != null ? paramType : "<?>") + ")", boldRange());
sb.append(" " + param.getValue());
}
}
}
private void addReturn(StringBuilder sb, List<StyleRange> styles, DocumentComment dc) {
final String ret = dc.getReturn();
if (ret != null) {
......@@ -254,70 +214,6 @@ public final class TextHover extends BaseTextHover implements ITextHoverExtensio
}
}
private void functionHover(StringBuilder sb, List<StyleRange> styles, DocumentComment dc, Assignment ass) {
sb.append("function ");
addStyledText(sb, styles, ((Definition)ass).getIdentifier().getDisplayName(), boldRange());
sb.append("()");
if (dc != null) {
addDescs(sb, styles, dc);
addParams(sb, styles, dc, ass);
addReturn(sb, styles, dc);
addAuthors(sb, styles, dc);
} else {
final Def_Function func = (Def_Function)ass;
final FormalParameterList fp = func.getFormalParameterList();
if (fp.getNofParameters() > 0) {
sb.append("\n\n");
addStyledText(sb, styles, "Parameters\n", boldRange());
for (int i = 0; i < fp.getNofParameters(); i++) {
final FormalParameter param = fp.getParameterByIndex(i);
String paramType = getFormalParamType(param);
sb.append("\n ");
addStyledText(sb, styles, param.getIdentifier().getDisplayName(), boldItalicRange());
addStyledText(sb, styles, " (" + (paramType != null ? paramType : "<?>") + ")", boldRange());
}
}
}
}
private void varHover(StringBuilder sb, List<StyleRange> styles, DocumentComment dc, Assignment ass, CompilationTimeStamp timestamp) {
final IType varType = ass.getType(timestamp);
String typeName = null;
if (varType != null) {
typeName = varType.getTypename();
}
sb.append("var ");
addStyledText(sb, styles, typeName + ((Definition)ass).getIdentifier().getName() + " ", boldRange());
if (varType instanceof Referenced_Type) {
final Referenced_Type refd = (Referenced_Type)varType;
if (refd.getTypeRefdLast(timestamp) instanceof Class_Type) {
sb.append("\n\n");
final Class_Type ct = (Class_Type)refd.getTypeRefdLast(timestamp);
final Def_Type classType = (Def_Type)ct.getNameParent();
addClassMembers(sb, styles, classType.parseDocumentComment(), timestamp, ct.getClassBody());
}
}
if (dc != null) {
addDescs(sb, styles, dc);
addAuthors(sb, styles, dc);
}
}