]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/assist/SCLContentProposal.java
Externalize strings in org.simantics.scl.ui
[simantics/platform.git] / bundles / org.simantics.scl.ui / src / org / simantics / scl / ui / assist / SCLContentProposal.java
1 package org.simantics.scl.ui.assist;
2
3 import org.eclipse.jface.fieldassist.IContentProposal;
4 import org.simantics.scl.compiler.common.names.Name;
5 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
6 import org.simantics.scl.compiler.types.Type;
7
8 public class SCLContentProposal implements IContentProposal {
9
10     private final String content;
11     private final String name;
12     private final String module;
13     private final Type type;
14     private final String documentation;
15     
16     public SCLContentProposal(SCLValue value) {
17         Name n = value.getName();
18         this.name = n.name;
19         this.module = n.module;
20 //        this.content = name.substring(prefixLength-namespaceLength);
21         this.content = name;
22         this.type = value.getType();
23         this.documentation = value.getDocumentation();
24     }
25     
26     public SCLContentProposal(String name, String module, Type type) {
27         this.name = name;
28         this.module = module;
29 //        this.content = name.substring(prefixLength-namespaceLength);
30         this.content = name;
31         this.type = type;
32         this.documentation = null;
33     }
34     
35     @Override
36     public String getContent() {
37         return content;
38     }
39
40     @Override
41     public int getCursorPosition() {
42         return content.length();
43     }
44
45     @Override
46     public String getLabel() {
47         return name + " :: " + type + "  (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
48     }
49
50     @Override
51     public String getDescription() {
52         return documentation;
53     }
54
55 }