Examples of AutocompleteCandidate


Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

      v = vc.getRuleContext(VariableDeclaratorContext.class, 0);
      if(v!=null) {
        VariableDeclaratorIdContext vi = v.getRuleContext(VariableDeclaratorIdContext.class, 0);
        if(vi.getChildCount()>0) {
          //System.out.println("VAR "+vi.getChild(0).getText()+" of type "+type);
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.NAME, vi.getChild(0).getText());
          registry.addCandidate(c);
          if(type!=null) {
            classUtils.defineVariable(vi.getChild(0).getText(), type);
          }
        }
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

      if(v!=null) {
        for(VariableDeclaratorContext v2 : v) {
          VariableDeclaratorIdContext vi = v2.getRuleContext(VariableDeclaratorIdContext.class, 0);
          if(vi.getChildCount()>0) {
            //System.out.println("VAR "+vi.getChild(0).getText()+" of type "+type);
            AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.NAME, vi.getChild(0).getText());
            registry.addCandidate(c);
            if(type!=null) {
              classUtils.defineVariable(vi.getChild(0).getText(), type);
            }
          }
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

    if(arg0.getSymbol().getStartIndex() < cursor && arg0.getSymbol().getStopIndex()+1 >= cursor) {
      //System.out.println("ERR: "+arg0.getSymbol().getStartIndex()+" "+arg0.getSymbol().getStopIndex()+" "+arg0.getSymbol().getText());
      if(arg0.getParent() instanceof CompilationUnitContext) {
        CompilationUnitContext cuc = (CompilationUnitContext) arg0.getParent();
        if(cuc.getChild(0).equals(arg0)) {
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.INITIAL, arg0.getText());
          addQuery(c);
        } else {
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, arg0.getText());
          addQuery(c);
        }
        return;
      }
      if(arg0.getParent() instanceof BlockStatementContext) {
        if(!arg0.getSymbol().getText().equals(".")) {
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, arg0.getText());
          addQuery(c);
          c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, arg0.getText());
          addQuery(c);
          c = new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, arg0.getText());
          addQuery(c);
          c = new AutocompleteCandidate(JavaCompletionTypes.NAME, arg0.getText());
          addQuery(c);
        } else {
          BlockStatementContext bs = (BlockStatementContext)arg0.getParent();
          if(bs.getChildCount()>1) {
            addQuery(classUtils.expandExpression(bs.getText(), registry));
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

  public void exitMemberDeclaration(MemberDeclarationContext ctx) {
    if(ctx.getStart().getStartIndex() < cursor && ctx.getStop().getStopIndex()+1 >= cursor) {
      String txt = ctx.getText();
      if(txt.contains(" "))
        return;
      AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.MEMBERDELC, txt);
      addQuery(c);

    }   
  }
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

      String txt = ctx.getText();
      if(txt.contains(" "))
        return;
      if(txt.contains(".")) {
        String [] txtv = txt.split("\\.");
        AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
        addQuery(c);
      } else {
        AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, txt);
        addQuery(c);
        c = new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, txt);
        addQuery(c);
      }
    }
  }
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

        if(text.charAt(cursor-1)=='.') {
          // TODO (do I need it?)
        } else {
          if(txt.contains(".")) {
            String [] txtv = txt.split("\\.");
            AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
            addQuery(c);
          } else {
            AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.NAME, txt);
            addQuery(c);
            c = new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, txt);
            addQuery(c);
          }
        }
      } else {
        //System.out.println("EXP: "+ctx.getStart().getStartIndex()+" "+ctx.getStart().getStopIndex()+" "+ctx.getText());
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

      if(text.charAt(cursor-1)=='.') {
        // TODO (do I need it?)
      } else {
        if(txt.contains(".")) {
          String [] txtv = txt.split("\\.");
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
          addQuery(c);
        } else {
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.CUSTOM_TYPE, txt);
          addQuery(c);
        }
      }
    }
   
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

          QualifiedNameContext qn = (QualifiedNameContext)ctx.getChild(1);
          String st = qn.getText();
          //System.out.println("wants next package name for "+st);
          String [] txtv = (st+".X").split("\\.");
          txtv[txtv.length-1] = "";
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, txtv);
          addQuery(c);
          c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
          addQuery(c);
        }
      } else {
        // looking to autocomplete a package name
        if(ctx.getChildCount() > 2 && (ctx.getChild(1) instanceof QualifiedNameContext)) {
          QualifiedNameContext qn = (QualifiedNameContext)ctx.getChild(1);
          String st = qn.getText();
          //System.out.println("wants to finish package name for "+qn.getText());
          String [] txtv = st.split("\\.");
          AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, txtv);
          addQuery(c);
          c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, txtv);
          addQuery(c);
        }
      }
    } else {
      // add this import declaration
      if(ctx.getChildCount() > 2 && (ctx.getChild(1) instanceof QualifiedNameContext)) {
        QualifiedNameContext qn = (QualifiedNameContext)ctx.getChild(1);
        // this imports using '*'
        if(ctx.getChildCount() >= 4 && ctx.getChild(2).getText().equals(".") && ctx.getChild(3).getText().equals("*")) {
          //System.out.println("ADD ALL imports for "+qn.getText());
          String st = qn.getText();
          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));
              classUtils.defineClassShortName(s, st+"."+s);
            }
            registry.addCandidate(c);
          }
        } else {
          // this imports a specific type
          //System.out.println("ADD import for "+qn.getText());
          String st = qn.getText();
          String [] txtv = st.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);
          classUtils.defineClassShortName(txtv[txtv.length-1], st);
        }
      }     
    }
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

    setup(registry);
    cps = _cps;
   
    for ( String pkg : cps.getPackages()) {
      String[] pkgv = pkg.split("\\.");
      AutocompleteCandidate c = new AutocompleteCandidate(JavaCompletionTypes.PACKAGE_NAME, pkgv);
      registry.addCandidate(c);
      List<String> cls = cps.getClasses(pkg);
      if(cls!=null && !cls.isEmpty()) {
        c = new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, pkgv);
        AutocompleteCandidate l = c;
        while(l.hasChildren()) { l = l.getChildrens().get(0); }
        for ( String cl : cls) {
          l.addChildren(new AutocompleteCandidate(JavaCompletionTypes.FQ_TYPE, cl));
        }
        registry.addCandidate(c);
      }
    }
View Full Code Here

Examples of com.twosigma.beaker.autocomplete.AutocompleteCandidate

    }

  }
 
  private void setup(AutocompleteRegistry r) {
    AutocompleteCandidate c;
   
    c = new AutocompleteCandidate(JavaCompletionTypes.INITIAL, "package");
    r.addCandidate(c);
   
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "import");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "public");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "class");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "abstract");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "enum");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "final");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "interface");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "private");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "protected");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TOPLEVEL, "static");
    r.addCandidate(c);

    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "if");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "for");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "while");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "do");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "else");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "try");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "catch");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "switch");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "return");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "throw");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "break");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "continue");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "synchronized");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "finally");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.BLOCKLEVEL, "default");
    r.addCandidate(c);

    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "int");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "float");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "char");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "byte");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "void");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "boolean");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "short");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "long");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.TYPE, "double");
    r.addCandidate(c);
   
    c = new AutocompleteCandidate(JavaCompletionTypes.MEMBERDELC, "public");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.MEMBERDELC, "abstract");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.MEMBERDELC, "final");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.MEMBERDELC, "private");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.MEMBERDELC, "protected");
    r.addCandidate(c);
    c = new AutocompleteCandidate(JavaCompletionTypes.MEMBERDELC, "static");
    r.addCandidate(c);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.