Examples of TemplateContextType


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

     */
    public Object[] getElements(Object inputElement) {
      List contextTypes= new ArrayList();

      for (Iterator iterator= getContextTypeRegistry().contextTypes(); iterator.hasNext();) {
        TemplateContextType contextType= (TemplateContextType) iterator.next();
        if (!fLinkWithEditorAction.isChecked() || isActiveContext(contextType))
          contextTypes.add(contextType);
      }
      return contextTypes.toArray(new TemplateContextType[contextTypes.size()]);
    }
View Full Code Here

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

                    return null;
                }
            }
        }
      
        TemplateContextType contextType = getContextType(viewer, region);
        if (contextType != null) {
            return new DocTemplContext(
                    contextType, document, region.getOffset(), region.getLength(),
                    containingTypeDeclaration != null);
        }
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

     * @param viewer the viewer for which the context is created
     * @param region the region into <code>document</code> for which the context is created
     * @return a template context that can handle template insertion at the given location, or <code>null</code>
     */
    protected TemplateContext createContext(ITextViewer viewer, IRegion region, IDocument document) {
        TemplateContextType contextType = getContextType(viewer, region);
        if (contextType != null) {
            return new DocumentTemplateContext(contextType, document, region.getOffset(), region.getLength());
        }
        return null;
    }
View Full Code Here

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

     */
    protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
        PydevPlugin plugin = PydevPlugin.getDefault();
        if (plugin == null) {
            //just for tests
            return new TemplateContextType();
        }
        return TemplateHelper.getContextTypeRegistry().getContextType(PyContextType.PY_COMPLETIONS_CONTEXT_TYPE);
    }
View Full Code Here

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

    /**
     * Overridden so that we can do the indentation in this case.
     */
    @Override
    protected TemplateContext createContext(final ITextViewer viewer, final IRegion region) {
        TemplateContextType contextType = getContextType(viewer, region);
        return createContext(contextType, viewer, region);
    }
View Full Code Here

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

    String delim = new Document().getLegalLineDelimiters()[0];

    List contexts = new ArrayList();
    for (Iterator it = registry.contextTypes(); it.hasNext();) {
      TemplateContextType type = (TemplateContextType) it.next();
      if (type.getId().equals("javadoc")) //$NON-NLS-1$
        contexts.add(new String[] { type.getId(), type.getName(),
            "/**" + delim }); //$NON-NLS-1$
      else
        contexts.add(0,
            new String[] { type.getId(), type.getName(), "" }); //$NON-NLS-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

  }

  protected 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

  protected TemplateContextType getContextType(ITextViewer viewer,
      IRegion region) {

    // For now always return the context type for ALL PHP regions
    TemplateContextType type = null;

    ContextTypeRegistry registry = getTemplateContextRegistry();
    if (registry != null)
      type = registry.getContextType(contextTypeId);
View Full Code Here

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

    if (selection.size() == 1
        && selection.get(0) instanceof TemplatePersistenceData) {
      TemplatePersistenceData data = (TemplatePersistenceData) selection
          .get(0);
      Template template = data.getTemplate();
      TemplateContextType type = PHPUiPlugin.getDefault()
          .getCodeTemplateContextRegistry().getContextType(
              template.getContextTypeId());
      fTemplateProcessor.setContextType(type);
      fPatternViewer.getDocument().set(template.getPattern());
    } else {
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.