Package org.eclipse.php.internal.core.codeassist.templates

Examples of org.eclipse.php.internal.core.codeassist.templates.CodeCompletionRequestor


    protected String resolve(TemplateContext context) {
      ISourceModule module = ((ScriptTemplateContext) context)
          .getSourceModule();
      int offset = ((ScriptTemplateContext) context)
          .getCompletionOffset();
      CodeCompletionRequestor requestor = new VariableCodeCompletionRequestor();
      try {
        module.codeComplete(offset, requestor, 1000);
      } catch (ModelException e) {
        PHPUiPlugin.log(e);
      }

      String[] knownVars = requestor.getVariables();
      Set knownVarsSet = new HashSet(Arrays.asList(knownVars));

      return findUnusedName(knownVarsSet);
    }
View Full Code Here


    public void resolve(TemplateVariable variable, TemplateContext context) {
      ISourceModule module = ((ScriptTemplateContext) context)
          .getSourceModule();
      int offset = ((ScriptTemplateContext) context)
          .getCompletionOffset();
      CodeCompletionRequestor requestor = new VariableCodeCompletionRequestor();
      try {
        module.codeComplete(offset, requestor, 1000);
      } catch (ModelException e) {
        PHPUiPlugin.log(e);
      }

      String[] knownVars = requestor.getVariables();
      Set knownVarsSet = new HashSet(Arrays.asList(knownVars));

      List params = variable.getVariableType().getParams();
      if (params.size() == 0) {
        String result = findUnusedName(knownVarsSet);
View Full Code Here

    protected String[] resolveAll(TemplateContext context) {
      ISourceModule module = ((ScriptTemplateContext) context)
          .getSourceModule();
      int offset = ((ScriptTemplateContext) context)
          .getCompletionOffset();
      CodeCompletionRequestor requestor = new VariableCodeCompletionRequestor();
      try {
        module.codeComplete(offset, requestor, 1000);
      } catch (ModelException e) {
        PHPUiPlugin.log(e);
      }

      return requestor.getVariables();
    }
View Full Code Here

    protected String[] resolveAll(TemplateContext context) {
      ISourceModule module = ((ScriptTemplateContext) context)
          .getSourceModule();
      int offset = ((ScriptTemplateContext) context)
          .getCompletionOffset();
      CodeCompletionRequestor requestor = new CodeCompletionRequestor() {
        @Override
        public void accept(CompletionProposal proposal) {
          if (isIgnored(proposal.getKind()))
            return;
          switch (proposal.getKind()) {
          case CompletionProposal.TYPE_REF:
            try {
              if (!PHPFlags.isNamespace(((IType) proposal
                  .getModelElement()).getFlags())) {
                addProposal(proposal);
              }
            } catch (ModelException e) {
            }

            break;
          default:
            break;
          }
        }

        public ICompletionContext[] createContexts() {
          return new ICompletionContext[] { new GlobalStatementContext() };
        }
      };
      try {
        module.codeComplete(offset, requestor, 1000);
      } catch (ModelException e) {
        PHPUiPlugin.log(e);
      }

      return requestor.getVariables();
    }
View Full Code Here

    public void resolve(TemplateVariable variable, TemplateContext context) {
      ISourceModule module = ((ScriptTemplateContext) context)
          .getSourceModule();
      int offset = ((ScriptTemplateContext) context)
          .getCompletionOffset();
      CodeCompletionRequestor requestor = new VariableCodeCompletionRequestor();
      try {
        module.codeComplete(offset, requestor, 1000);
      } catch (ModelException e) {
        PHPUiPlugin.log(e);
      }

      String[] knownVars = requestor.getVariables();
      Set knownVarsSet = new HashSet(Arrays.asList(knownVars));

      List params = variable.getVariableType().getParams();
      String result = "$" + findUnusedName("index", knownVarsSet); //$NON-NLS-1$ //$NON-NLS-2$
      variable.setValue(result);
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.codeassist.templates.CodeCompletionRequestor

Copyright © 2018 www.massapicom. 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.