use of com.twosigma.beakerx.autocomplete.AutocompleteCandidate in project beakerx by twosigma.
the class AutocompleteRegistryFactory method addDefaultImports.
public static void addDefaultImports(ClassUtils cu, AutocompleteRegistry registry, List<String> imports, ClasspathScanner cps) {
for (String imp : imports) {
// this imports using '*'
if (imp.endsWith(".*")) {
String st = imp.substring(0, imp.length() - 2);
String[] txtv = st.split("\\.");
AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, txtv);
registry.addCandidate(c);
List<String> cls = cps.getClasses(st);
if (cls != null) {
c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
AutocompleteCandidate l = c.findLeaf();
for (String s : cls) {
l.addChildren(new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, s));
registry.addCandidate(new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, s));
cu.defineClassShortName(s, st + "." + s);
}
registry.addCandidate(c);
}
} else {
String[] txtv = imp.split("\\.");
AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, txtv, txtv.length - 1);
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, txtv[txtv.length - 1]);
registry.addCandidate(c);
cu.defineClassShortName(txtv[txtv.length - 1], imp);
}
}
}
use of com.twosigma.beakerx.autocomplete.AutocompleteCandidate in project beakerx by twosigma.
the class AutocompleteRegistryFactory method setup.
public static void setup(ClassUtils cu, AutocompleteRegistry registry) {
cu.defineClassShortName("Boolean", "java.lang.Boolean");
cu.defineClassShortName("Byte", "java.lang.Byte");
cu.defineClassShortName("Character", "java.lang.Character");
cu.defineClassShortName("Double", "java.lang.Double");
cu.defineClassShortName("Float", "java.lang.Float");
cu.defineClassShortName("Integer", "java.lang.Integer");
cu.defineClassShortName("Long", "java.lang.Long");
cu.defineClassShortName("Math", "java.lang.Math");
cu.defineClassShortName("Number", "java.lang.Number");
cu.defineClassShortName("Object", "java.lang.Object");
cu.defineClassShortName("Package", "java.lang.Package");
cu.defineClassShortName("Process", "java.lang.Process");
cu.defineClassShortName("ProcessBuilder", "java.lang.ProcessBuilder");
cu.defineClassShortName("Runtime", "java.lang.Runtime");
cu.defineClassShortName("RuntimePermission", "java.lang.RuntimePermission");
cu.defineClassShortName("SecurityManager", "java.lang.SecurityManager");
cu.defineClassShortName("Short", "java.lang.Short");
cu.defineClassShortName("StackTraceElement", "java.lang.StackTraceElement");
cu.defineClassShortName("StrictMath", "java.lang.StrictMath");
cu.defineClassShortName("String", "java.lang.String");
cu.defineClassShortName("StringBuffer", "java.lang.StringBuffer");
cu.defineClassShortName("StringBuilder", "java.lang.StringBuilder");
cu.defineClassShortName("System", "java.lang.System");
cu.defineClassShortName("Thread", "java.lang.Thread");
cu.defineClassShortName("ThreadGroup", "java.lang.ThreadGroup");
cu.defineClassShortName("Throwable", "java.lang.Throwable");
cu.defineClassShortName("Void", "java.lang.Void");
AutocompleteCandidate c;
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Boolean");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Byte");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Character");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Double");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Exception");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Float");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Integer");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Long");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Number");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Object");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Package");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Process");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "ProcessBuilder");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Runtime");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "RuntimePermission");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "SecurityManager");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Short");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "StackTraceElement");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "StrictMath");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "String");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "StringBuffer");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "StringBuilder");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "System");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Thread");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "ThreadGroup");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Throwable");
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.NAME, "Void");
registry.addCandidate(c);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteCandidate in project beakerx by twosigma.
the class AutocompleteRegistryFactory method createImportAutocompleteCandidate.
public static void createImportAutocompleteCandidate(ClassUtils cu, AutocompleteRegistry registry, String imp) {
String[] txtv = imp.split("\\.");
AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, txtv, txtv.length - 1);
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
registry.addCandidate(c);
c = new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, txtv[txtv.length - 1]);
registry.addCandidate(c);
cu.defineClassShortName(txtv[txtv.length - 1], imp);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteCandidate in project beakerx by twosigma.
the class JavaImportDeclarationCompletion method importPackageNameAfterDot.
private void importPackageNameAfterDot(ImportDeclarationContext ctx) {
String st = ctx.getText();
st = removeImportWord(st);
String[] txtv = (st + "X").split("\\.");
txtv[txtv.length - 1] = EMPTY_NODE;
AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, txtv);
addQuery(c, AutocompleteJavaResult.getStartIndex(ctx) + 1);
c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
addQuery(c, AutocompleteJavaResult.getStartIndex(ctx) + 1);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteCandidate in project beakerx by twosigma.
the class JavaImportDeclarationCompletion method importWithWildcard.
private void importWithWildcard(String st) {
String[] txtv = st.split("\\.");
AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, txtv);
registry.addCandidate(c);
st = st.substring(0, st.length() - 2);
List<String> cls = cps.getClasses(st);
if (cls != null) {
c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
AutocompleteCandidate l = c.findLeaf();
for (String s : cls) {
l.addChildren(new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, s));
registry.addCandidate(new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, s));
classUtils.defineClassShortName(s, st + "." + s);
}
registry.addCandidate(c);
}
}
Aggregations