Examples of TemplateContextType


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

 
  private char[] fProposalAutoActivationSet;
     
  public JavaSnippetCompletionProcessor(ConsoleEditor editor) {
    fEditor= editor;
    TemplateContextType contextType= JavaPlugin.getDefault().getTemplateContextRegistry().getContextType("java"); //$NON-NLS-1$
    if (contextType != null) {
      fTemplateEngine= new TemplateEngine(contextType);
    }
   
    fComparator= new CompletionProposalComparator();
View Full Code Here

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

    /**
     * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getContextType(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
     */
    protected TemplateContextType getContextType( ITextViewer viewer, IRegion region )
    {
        TemplateContextType contextType = BrowserCommonActivator.getDefault().getFilterTemplateContextTypeRegistry()
            .getContextType( BrowserCommonConstants.FILTER_TEMPLATE_ID );
        return contextType;
    }
View Full Code Here

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

    /**
     * @see org.eclipse.jface.text.templates.TemplateCompletionProcessor#getContextType(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
     */
    protected TemplateContextType getContextType( ITextViewer viewer, IRegion region )
    {
        TemplateContextType contextType = BrowserCommonActivator.getDefault().getFilterTemplateContextTypeRegistry()
            .getContextType( BrowserCommonConstants.FILTER_TEMPLATE_ID );
        return contextType;
    }
View Full Code Here

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

        //empty list
        return results;
      }
      //get a list of templates
      String contextString=getTemplateContextString(context);
      TemplateContextType contextType=VerilogPlugin.getPlugin().getContextTypeRegistry().getContextType(contextString);
      Template[] templates= VerilogPlugin.getPlugin().getTemplateStore().getTemplates(contextType.getId());
      DocumentTemplateContext documnetTemplateContext= new DocumentTemplateContext(contextType, doc, region.getOffset(), region.getLength());
      //find a matching template
      for (int i= 0; i < templates.length; i++) {
        Template template= templates[i];
        String pattern = template.getPattern();
        pattern = pattern.replace("\t", indentationstring);
        pattern = pattern.replace("\r", "");
        pattern = pattern.replace("\n", eol);
        template.setPattern(pattern);
       
        try {
          contextType.validate(template.getPattern());
        } catch (TemplateException e) {
          continue;
        }     
       
        if (template.matches(prefix, contextType.getId()) && template.getName().startsWith(prefix)){
          String indent = doc.getIndentString(offset);
          template = new TemplateWithIndent(template, indent);
          HdlTemplateProposal hdlTemplateProposal=new HdlTemplateProposal(template,
                                documnetTemplateContext,
                                region,
View Full Code Here

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

    public WojJavaCompletionProcessor(IEditorPart editor) {
      super(editor);
        fEditor= editor;
        fManager= JavaPlugin.getDefault().getWorkingCopyManager();
        TemplateContextType contextType= JavaPlugin.getDefault().getTemplateContextRegistry().getContextType("java"); //$NON-NLS-1$
        if (contextType == null) {
            contextType= new JavaContextType();
            JavaPlugin.getDefault().getTemplateContextRegistry().addContextType(contextType);
        }
        if (contextType != null)
View Full Code Here

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

   */
  private int computeMinimumContextColumnWidth(GC gc) {
    int width= gc.stringExtent(TemplatesMessages.TemplatePreferencePage_column_context).x;
    Iterator iter= getContextTypeRegistry().contextTypes();
    while (iter.hasNext()) {
      TemplateContextType contextType= (TemplateContextType)iter.next();
      width= Math.max(width, gc.stringExtent(contextType.getName()).x);
    }
    return width;
  }
View Full Code Here

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

      fOriginalTemplate= template;
      fIsNameModifiable= isNameModifiable;

      List contexts= new ArrayList();
      for (Iterator it= registry.contextTypes(); it.hasNext();) {
        TemplateContextType type= (TemplateContextType) it.next();
        contexts.add(new String[] { type.getId(), type.getName() });
      }
      Collections.sort(contexts, new Comparator() {
        Collator fCollator= Collator.getInstance();
        public int compare(Object o1, Object o2) {
          return fCollator.compare(((String[])o1)[1], ((String[])o2)[1]);
        }
      });
      fContextTypes= (String[][]) contexts.toArray(new String[contexts.size()][]);

      fValidationStatus= new StatusInfo();

      fContextTypeRegistry= registry;

      TemplateContextType type= fContextTypeRegistry.getContextType(template.getContextTypeId());
      fTemplateProcessor.setContextType(type);
    }
View Full Code Here

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

    }

    private void doSourceChanged(IDocument document) {
      String text= document.get();
      fValidationStatus.setOK();
      TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId());
      if (contextType != null) {
        try {
          contextType.validate(text);
        } catch (TemplateException e) {
          fValidationStatus.setError(e.getLocalizedMessage());
        }
      }
View Full Code Here

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

      switch (columnIndex) {
        case 0:
          return template.getName();
        case 1:
          TemplateContextType type= fContextTypeRegistry.getContextType(template.getContextTypeId());
          if (type != null)
            return type.getName();
          return template.getContextTypeId();
        case 2:
          return template.getDescription();
        case 3:
          return template.isAutoInsertable() ? TemplatesMessages.TemplatePreferencePage_on : ""//$NON-NLS-1$
View Full Code Here

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

     */
    public Object[] getChildren(Object parentElement) {
      if (parentElement instanceof TemplatePersistenceData)
        return new Object[0];
      else if (parentElement instanceof TemplateContextType) {
        TemplateContextType contextType= (TemplateContextType) parentElement;
        return getTemplates(contextType.getId());
      }
      return null;
    }
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.