Examples of CodeModel


Examples of org.apache.uima.ruta.ide.core.CodeModel

      --remainingWork;
    }
  }

  private CodeModel getCodeModel(ISourceModule module) {
    CodeModel model = (CodeModel) codeModels.get(module);
    if (model == null) {
      try {
        model = new CodeModel(module.getSource());
        codeModels.put(module, model);
      } catch (ModelException e) {
        if (DLTKCore.DEBUG) {
          e.printStackTrace();
        }
View Full Code Here

Examples of org.apache.uima.ruta.ide.core.CodeModel

    return buildpath;
  }

  private void reportPackageProblem(RutaPackageDeclaration pkg, IProblemReporter reporter,
          ISourceModule module, String message, String pkgName) {
    final CodeModel model = getCodeModel(module);
    if (model == null) {
      return;
    }
    reporter.reportProblem(new DefaultProblem(message, RutaProblems.UNKNOWN_REQUIRED_PACKAGE,
            new String[] { pkgName }, ProblemSeverities.Error, pkg.sourceStart(), pkg.sourceEnd(),
            model.getLineNumber(pkg.sourceStart(), pkg.sourceEnd())));
  }
View Full Code Here

Examples of org.apache.uima.ruta.ide.core.CodeModel

      --remainingWork;
    }
  }

  private CodeModel getCodeModel(ISourceModule module) {
    CodeModel model = (CodeModel) codeModels.get(module);
    if (model == null) {
      try {
        model = new CodeModel(module.getSource());
        codeModels.put(module, model);
      } catch (ModelException e) {
        if (DLTKCore.DEBUG) {
          e.printStackTrace();
        }
View Full Code Here

Examples of org.apache.uima.ruta.ide.core.CodeModel

    return buildpath;
  }

  private void reportPackageProblem(RutaPackageDeclaration pkg, IProblemReporter reporter,
          ISourceModule module, String message, String pkgName) {
    final CodeModel model = getCodeModel(module);
    if (model == null) {
      return;
    }
    reporter.reportProblem(new DefaultProblem(message, RutaProblems.UNKNOWN_REQUIRED_PACKAGE,
            new String[] { pkgName }, ProblemSeverities.Error, pkg.sourceStart(), pkg.sourceEnd(),
            model.getLineNumber(pkg.sourceStart(), pkg.sourceEnd())));
  }
View Full Code Here

Examples of org.pworks.core.model.CodeModel

    this.cms = new HashMap<String, CodeModel>();
    for (Iterator<CmConfig> cmCfgs = cg.getCms().iterator(); cmCfgs
        .hasNext();) {
      CmConfig cmCfg = cmCfgs.next();
      CodeModel cm = new CodeModel();
      cm.setId(cmCfg.getId());
      cm.setDataProcessor((IDataProcessor) Class.forName(cmCfg.getDp())
          .newInstance());
      cm.setNamePattern(cmCfg.getSrcfmt());
      cm.setTemplate(cmCfg.getTemplate());
      this.cms.put(cmCfg.getId(), cm);
    }

    this.patterns = new HashMap<String, PatternModel>();
    for (Iterator<PatternConfig> pnCfgs = cg.getPatterns().iterator(); pnCfgs
View Full Code Here

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.ace.CodeModel

     
      RInfixData infixData = RInfixData.create();
      AceEditor editor = (AceEditor) docDisplay_;
      if (editor != null)
      {
         CodeModel codeModel = editor.getSession().getMode().getCodeModel();
         TokenCursor cursor = codeModel.getTokenCursor();
        
         if (cursor.moveToPosition(input_.getCursorPosition()))
         {
            String token = "";
            if (cursor.currentType() == "identifier")
               token = cursor.currentValue();
           
            String cursorPos = "left";
            if (cursor.currentValue() == "=")
               cursorPos = "right";
           
            TokenCursor clone = cursor.cloneCursor();
            if (clone.moveToPreviousToken())
               if (clone.currentValue() == "=")
                  cursorPos = "right";
           
            // Try to get a dplyr join completion
            DplyrJoinContext joinContext =
                  codeModel.getDplyrJoinContextFromInfixChain(cursor);
           
            // If that failed, try a non-infix lookup
            if (joinContext == null)
            {
               String joinString =
                     getDplyrJoinString(editor, cursor);
              
               if (!StringUtil.isNullOrEmpty(joinString))
               {
                  requester_.getDplyrJoinCompletionsString(
                        token,
                        joinString,
                        cursorPos,
                        implicit,
                        context_);

                  return true;
               }
            }
            else
            {
               requester_.getDplyrJoinCompletions(
                     joinContext,
                     implicit,
                     context_);
               return true;
              
            }
           
            // Try to see if there's an object name we should use to supplement
            // completions
            if (cursor.moveToPosition(input_.getCursorPosition()))
               infixData = codeModel.getDataFromInfixChain(cursor);
         }
      }
     
      String filePath = getSourceDocumentPath();
      if (filePath == null)
View Full Code Here

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.ace.CodeModel

      // Establish an evaluation context by looking backwards
      AceEditor editor = (AceEditor) docDisplay_;
      if (editor == null)
         return false;
     
      CodeModel codeModel = editor.getSession().getMode().getCodeModel();
      codeModel.tokenizeUpToRow(input_.getCursorPosition().getRow());
     
      TokenCursor cursor = codeModel.getTokenCursor();
        
      if (!cursor.moveToPosition(input_.getCursorPosition()))
         return false;
     
      // Move back to the '$'
View Full Code Here

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.ace.CodeModel

      // access to the R Code model
      AceEditor editor = (AceEditor) docDisplay_;
      if (editor == null)
         return context;
     
      CodeModel codeModel = editor.getSession().getMode().getCodeModel();
     
      // We might need to grab content from further up in the document than
      // the current cursor position -- so tokenize ahead.
      codeModel.tokenizeUpToRow(row + 100);
     
      // Make a token cursor and place it at the first token previous
      // to the cursor.
      TokenCursor tokenCursor = codeModel.getTokenCursor();
      if (!tokenCursor.moveToPosition(input_.getCursorPosition()))
         return context;
     
      TokenCursor startCursor = tokenCursor.cloneCursor();
      boolean startedOnEquals = tokenCursor.currentValue() == "=";
View Full Code Here

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.ace.CodeModel

      // NOTE: this will be null in the console, so protect against that
      if (editor != null)
      {
         Position cursorPosition =
               editor.getSession().getSelection().getCursor();
         CodeModel codeModel = editor.getSession().getMode().getCodeModel();
         JsArray<RFunction> scopedFunctions =
               codeModel.getFunctionsInScope(cursorPosition);

         for (int i = 0; i < scopedFunctions.length(); i++)
         {
            RFunction scopedFunction = scopedFunctions.get(i);
            String functionName = scopedFunction.getFunctionName();
View Full Code Here

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.ace.CodeModel

      // NOTE: this will be null in the console, so protect against that
      if (editor != null)
      {
         Position cursorPosition =
               editor.getSession().getSelection().getCursor();
         CodeModel codeModel = editor.getSession().getMode().getCodeModel();
     
         JsArray<RScopeObject> scopeVariables = codeModel.getVariablesInScope(cursorPosition);
         for (int i = 0; i < scopeVariables.length(); i++)
         {
            RScopeObject variable = scopeVariables.get(i);
            if (variable.getToken().startsWith(token) && variable.getType() == type)
               completions.add(new QualifiedName(
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.