Package org.eclipse.jface.text.templates

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


  }

  public abstract void templates(String contentType, String ctx);

  public void template(String name, String description, String pattern) {
    templates.add(new Template(name, description, getClass().getName(), pattern, true));
  }
View Full Code Here


        return evaluate(template, false);
    }

    public TemplateBuffer evaluate(final Template template0, final boolean indentFrom0)
            throws BadLocationException, TemplateException {
        Template template = template0;
        if (!canEvaluate(template)) {
            return null;
        }

        if (ErlTemplateCompletionPreferences.getIndentCode()) {
View Full Code Here

        try {
            pattern = IndentHandler.indentLines(0, 0, pattern, true, whiteSpacePrefix);
        } catch (final RpcException e) {
            ErlLogger.error(e);
        }
        return new Template(template.getName(), template.getDescription(),
                template.getContextTypeId(), pattern, template.isAutoInsertable());
    }
View Full Code Here

        try {
            final TemplateContext context = getContext();
            context.setReadOnly(true);
            TemplateBuffer templateBuffer;
            try {
                final Template template = getTemplate();
                if (context instanceof ErlangTemplateContext) {
                    final ErlangTemplateContext etc = (ErlangTemplateContext) context;
                    templateBuffer = etc.evaluate(template, true);
                } else {
                    templateBuffer = context.evaluate(template);
View Full Code Here

        for (final Object[] element : functions) {
            arg_var.setArity(((Integer) element[1]).intValue());
            name_var.setFunctionName((String) element[0]);

            final Template commentTemplate = ErlangSourceContextTypeComment.getDefault()
                    .getTemplateStore()
                    .getTemplateData("org.erlide.ui.erlangsource.functioncomment")
                    .getTemplate();

            DocumentTemplateContext commentContext = new DocumentTemplateContext(
                    ErlangSourceContextTypeLayout.getDefault(), new Document(
                            commentTemplate.getPattern()), 0, commentTemplate
                            .getPattern().length());
            TemplateBuffer tb = null;
            try {
                tb = commentContext.evaluate(commentTemplate);
            } catch (final BadLocationException e) {
                ErlLogger.warn(e);
                buff.append("Error: " + e.getMessage());
            } catch (final TemplateException e) {
                ErlLogger.warn(e);
                buff.append("Error: " + commentTemplate.getName()
                        + " could not be validated!");
            }

            if (tb != null) {
                buff.append(tb.getString() + "\n");
            }

            final Template template = ErlangSourceContextTypeComment.getDefault()
                    .getTemplateStore()
                    .getTemplateData("org.erlide.ui.erlangsource.functionlayout")
                    .getTemplate();

            commentContext = new DocumentTemplateContext(
                    ErlangSourceContextTypeLayout.getDefault(), new Document(
                            template.getPattern()), 0, template.getPattern().length());
            try {
                tb = commentContext.evaluate(template);
            } catch (final BadLocationException e) {
                ErlLogger.warn(e);
                buff.append("Error: " + e.getMessage());
            } catch (final TemplateException e) {
                ErlLogger.warn(e);
                buff.append("Error: " + template.getName() + " could not be validated!");
            }

            if (tb != null) {
                buff.append(tb.getString() + "\n");
            }
View Full Code Here

      e.printStackTrace();
    }

    for (int i = 0; i < this.componentList.size(); i++) {
      String prop = (String) this.componentList.get(i);
      Template template = new Template(prop, "Defined Component", TapestryElementCollection.attributesValueContextTypeId, prop, true);
      completionList.add(template);
    }
    return completionList;
  }
View Full Code Here

            super.endVisit(node);
          }
        });
        super.endVisit(node);
        if (parameter){
          Template template = new Template(paramName, "add attribute " + paramName, contextTypeId, buildAttributeInsertCode(paramName), true);
          components.add(template);
        }
      }
    });
  }
View Full Code Here

        if(ele.getElementType() == IJavaElement.COMPILATION_UNIT && ele.getElementName().endsWith(".java")){
          TapestryCoreComponents component = new TapestryCoreComponents();
          String name = ele.getElementName().substring(0, ele.getElementName().indexOf('.'));
          component.setName(name);
          component.setElementLabel("t:" + name.toLowerCase());
          components.add(new Template("t:" + component.getName(), buildDescription(component, "root package"), contextTypeId, component.getName(), true));
        }
      }
      return components;
    } catch (JavaModelException e) {
      e.printStackTrace();
View Full Code Here

        if(ele.getElementType() == IJavaElement.COMPILATION_UNIT && ele.getElementName().endsWith(".java")){
          TapestryCoreComponents component = new TapestryCoreComponents();
          String name = ele.getElementName().substring(0, ele.getElementName().indexOf('.'));
          component.setName(name);
          component.setElementLabel("t:" + name.toLowerCase());
          components.add(new Template("t:" + component.getName(), buildDescription(component, "root package"), contextTypeId, buildInsertCode(component, type), true));
        }
      }
      return components;
    } catch (JavaModelException e) {
      e.printStackTrace();
View Full Code Here

                  } catch (ClassFormatException e) {
                    e.printStackTrace();
                  }
                  if(component != null){
                    for(String paramName : component.getPamameters()){
                      Template template = new Template(paramName, "add attribute " + paramName, contextTypeId, buildAttributeInsertCode(paramName), true);
                      components.add(template);
                    }
                    return components;
                  }
                }
View Full Code Here

TOP

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

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.