1 package org.simantics.scl.ui.assist;
\r
3 import org.eclipse.jface.fieldassist.IContentProposal;
\r
4 import org.simantics.scl.compiler.common.names.Name;
\r
5 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
\r
6 import org.simantics.scl.compiler.types.Type;
\r
8 public class SCLContentProposal implements IContentProposal {
\r
10 private final String content;
\r
11 private final String name;
\r
12 private final String module;
\r
13 private final Type type;
\r
14 private final String documentation;
\r
16 public SCLContentProposal(SCLValue value) {
\r
17 Name n = value.getName();
\r
19 this.module = n.module;
\r
20 // this.content = name.substring(prefixLength-namespaceLength);
\r
21 this.content = name;
\r
22 this.type = value.getType();
\r
23 this.documentation = value.getDocumentation();
\r
26 public SCLContentProposal(String name, String module, Type type) {
\r
28 this.module = module;
\r
29 // this.content = name.substring(prefixLength-namespaceLength);
\r
30 this.content = name;
\r
32 this.documentation = null;
\r
36 public String getContent() {
\r
41 public int getCursorPosition() {
\r
42 return content.length();
\r
46 public String getLabel() {
\r
47 return name + " :: " + type + " (" + module + ")";
\r
51 public String getDescription() {
\r
52 return documentation;
\r