--- /dev/null
+package org.simantics.scl.ui.assist;\r
+\r
+import org.eclipse.jface.fieldassist.IContentProposal;\r
+import org.simantics.scl.compiler.common.names.Name;\r
+import org.simantics.scl.compiler.elaboration.modules.SCLValue;\r
+import org.simantics.scl.compiler.types.Type;\r
+\r
+public class SCLContentProposal implements IContentProposal {\r
+\r
+ private final String content;\r
+ private final String name;\r
+ private final String module;\r
+ private final Type type;\r
+ private final String documentation;\r
+ \r
+ public SCLContentProposal(SCLValue value) {\r
+ Name n = value.getName();\r
+ this.name = n.name;\r
+ this.module = n.module;\r
+// this.content = name.substring(prefixLength-namespaceLength);\r
+ this.content = name;\r
+ this.type = value.getType();\r
+ this.documentation = value.getDocumentation();\r
+ }\r
+ \r
+ public SCLContentProposal(String name, String module, Type type) {\r
+ this.name = name;\r
+ this.module = module;\r
+// this.content = name.substring(prefixLength-namespaceLength);\r
+ this.content = name;\r
+ this.type = type;\r
+ this.documentation = null;\r
+ }\r
+ \r
+ @Override\r
+ public String getContent() {\r
+ return content;\r
+ }\r
+\r
+ @Override\r
+ public int getCursorPosition() {\r
+ return content.length();\r
+ }\r
+\r
+ @Override\r
+ public String getLabel() {\r
+ return name + " :: " + type + " (" + module + ")";\r
+ }\r
+\r
+ @Override\r
+ public String getDescription() {\r
+ return documentation;\r
+ }\r
+\r
+}\r