Package org.eclipse.jface.text.templates

Examples of org.eclipse.jface.text.templates.TemplateProposal


      ICompletionProposal[] result = merge(templates, proposals);

      List<ICompletionProposal> prop = new ArrayList<ICompletionProposal>();
      if (result != null) {
        for (int i = 0; i < result.length; i++) {
          TemplateProposal tprop = (TemplateProposal) result[i];
          if ((tprop.getRelevance() > 0) && (!prop.contains(tprop)))
            prop.add(tprop);
        }
        result = prop.toArray(new TemplateProposal[prop.size()]);
      }
      return result;
View Full Code Here


  private List<TemplateProposal> createQVTProposals(List<Object> objects,
      IRegion region) {
    List<TemplateProposal> proposals = new ArrayList<TemplateProposal>();
    for (Iterator<Object> iter = objects.iterator(); iter.hasNext();) {
      TemplateProposal temp = createTemplateProposal(iter.next(), region);
      if (temp != null)
        proposals.add(temp);
    }
    return proposals;
  }
View Full Code Here

      if (description == null)
        description = "";

      Template template = new Template(name, description,
          QVTContextType.QVT_CONTEXT_TYPE, pattern, true);
      TemplateProposal proposal = new TemplateProposal(template, context,
          region, image_id, getRelevance(template, prefix));
      return proposal;
    } catch (Exception e) {
      UiPlugin.getDefault().getLogger().log(
          java.util.logging.Level.WARNING, "Unknown error", e);
View Full Code Here

    String pattern = "helper ${type_in}::" + prefix
        + "(${}) : ${type_out}{\n"
        + "\t-- Auto-generated method stub\n\t${cursor}\n}";
    Template template = new Template(prefix, "Method Stub",
        QVTContextType.QVT_CONTEXT_TYPE, pattern, false);
    TemplateProposal proposal = new TemplateProposal(template, context,
        region, image_id, getRelevance(template, prefix));
    return proposal;
  }
View Full Code Here

        IRegion region = ps.getRegion();
        TemplateContext context = createContext(edit.getPySourceViewer(), region, ps.getDoc());

        Template t = new Template("Convert", "% to .format()", "", replacementString, false);
        l.add(new TemplateProposal(t, context, region, imageCache.get(UIConstants.COMPLETION_TEMPLATE), 5));
        return l;
    }
View Full Code Here

    private ICompletionProposal createProposal(PySelection ps, ImageCache imageCache, PyEdit edit,
            final String startIndent, IRegion region, int iComp, String comp, TemplateContext context) {
        Template t = new Template("Surround with", SURROUND_WITH_COMPLETIONS[iComp + 1], "", comp, false);
        if (context != null) {
            TemplateProposal proposal = new TemplateProposal(t, context, region,
                    imageCache.get(UIConstants.COMPLETION_TEMPLATE), 5) {
                @Override
                public String getAdditionalProposalInfo() {
                    return startIndent + super.getAdditionalProposalInfo();
                }
View Full Code Here

                //ok, looking for epydoc filters
                for (int i = 0; i < EPYDOC_FIELDS.length; i++) {
                    String f = EPYDOC_FIELDS[i];
                    if (f.startsWith(request.qualifier)) {
                        Template t = new Template(f, EPYDOC_FIELDS[i + 2], "", EPYDOC_FIELDS[i + 1], false);
                        ret.add(new TemplateProposal(t, context, region, image, 5) {
                            @Override
                            public String getDisplayString() {
                                try {
                                    return super.getDisplayString();
                                } catch (NoClassDefFoundError e) {
View Full Code Here

        PyEdit pyEdit = (PyEdit) openEditor;
        Region region = new Region(0, 0);
        PyDocumentTemplateContext context = PyTemplateCompletionProcessor.createContext(new PyContextType(),
                pyEdit.getPySourceViewer(), region);

        TemplateProposal templateProposal = new TemplateProposal(template, context, region, null);
        templateProposal.apply(pyEdit.getPySourceViewer(), '\n', 0, 0);
    }
View Full Code Here

            Region region = new Region(offset, len);
            PyDocumentTemplateContext context = PyTemplateCompletionProcessor.createContext(new PyContextType(),
                    targetEditor.getPySourceViewer(), region, indent);

            Template template = new Template("Create " + creationStr, "Create " + creationStr, "", source, true);
            TemplateProposal templateProposal = new TemplateProposal(template, context, region, null);
            return templateProposal;

        } else {
            //This should only happen in tests.
            source = StringUtils.indentTo(source, indent, false);
View Full Code Here

        return false;
    }

    @Override
    public Point getSelection(IDocument document) {
        TemplateProposal executed2 = getExecuted();
        if (executed2 != null) {
            return executed2.getSelection(document);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.templates.TemplateProposal

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.