public class SCLCompletionProposal implements ICompletionProposal, ICompletionProposalExtension, ICompletionProposalExtension2, ICompletionProposalExtension3, ICompletionProposalExtension4, ICompletionProposalExtension5 {
- private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage();
- private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage();
- private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage();
- private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage();
+ private static final Image PRIVATE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/private_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final Image PUBLIC = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/public_co.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final Image CONST = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/container_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final Image TYPE = Activator.imageDescriptorFromPlugin("org.simantics.scl.ui", "icons/typedef_obj.gif").createImage(); //$NON-NLS-1$ //$NON-NLS-2$
private final String content;
private final String name;
String tempModule = value.getName().module;
int p = tempName.lastIndexOf('.');
if(p >= 0) {
- tempModule = tempModule + "." + tempName.substring(0, p);
+ tempModule = tempModule + "." + tempName.substring(0, p); //$NON-NLS-1$
tempName = tempName.substring(p+1);
}
this.name = tempName;
this.module = tempModule;
this.documentation = value.getDocumentation();
- this.content = name + " :: " + value.getType() + " (" + module + ")";
+ this.content = name + " :: " + value.getType() + " (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
this.replacementOffset = replacementOffset;
this.prefix = prefix;
// System.out.println(prefix);
public SCLCompletionProposal(String name, String module, SCLCompletionType completionType, int replacementOffset, String prefix) {
this.name = name;
this.module = module;
- this.content = name + " (" + module + ")";
+ this.content = name + " (" + module + ")"; //$NON-NLS-1$ //$NON-NLS-2$
this.documentation = null;
this.replacementOffset = replacementOffset;
this.prefix = prefix;
// String sadd = doc.get(start, end);
// System.out.println("toReplace : " + sadd);
if (p.y > 0) {
- doc.replace(p.x, p.y, "");
+ doc.replace(p.x, p.y, ""); //$NON-NLS-1$
doc.replace(offset, 0, getName());
} else {
String currentText = doc.get(offset - prefix.length(), prefix.length());
if (currentText.equals(getName()))
return;
- doc.replace(offset - prefix.length(), prefix.length(), "");
+ doc.replace(offset - prefix.length(), prefix.length(), ""); //$NON-NLS-1$
doc.replace(offset - prefix.length(), 0, getName());
}
} catch (BadLocationException x) {
@Override
public boolean validate(IDocument document, int offset, DocumentEvent event) {
try {
-// System.out.println("replacementOffset : " + replacementOffset);
-// System.out.println("offset : " + offset);
+ String n = getName();
+ //System.out.println(n + " (" + n.length() + ") " + replacementOffset + " " + offset);
boolean a = offset >= replacementOffset;
- boolean b = offset < replacementOffset + getName().length();
+ boolean b = offset <= replacementOffset + n.length();
String s = document.get(replacementOffset, offset - replacementOffset);
prefix = s;
- String d = getName();//.substring(0, offset - prefixStart);
- boolean c = d.toLowerCase().startsWith(s.toLowerCase());
+ //System.out.println("prefix: " + s + " - " + prefix);
+ boolean c = n.toLowerCase().startsWith(s.toLowerCase());
+ //System.out.println("matches: " + a + " " + b + " " + c);
return a && b && c;
} catch (BadLocationException x) {
//x.printStackTrace();