/** * Returns <code>true</code> if a context type id specifies a valid context type * or if no context type registry is present. * * @param contextTypeId the context type id to look for * @return <code>true</code> if the context type specified by the id * is present in the context type registry, or if no registry is * specified */ private boolean contextExists(String contextTypeId) { return contextTypeId != null && (fRegistry == null || fRegistry.getContextType(contextTypeId) != null); }
protected void addContextType(String id) { TemplateContextType contextType = registry.getContextType(id); if (contextType != null) result.add(contextType); } }
private static TemplateEngine createTemplateEngine(ContextTypeRegistry templateContextRegistry, String contextTypeId) { TemplateContextType contextType= templateContextRegistry.getContextType(contextTypeId); Assert.isNotNull(contextType); return new TemplateEngine(contextType); }
protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) { TemplateContextType type = null; ContextTypeRegistry registry = getTemplateContextRegistry(); if (registry != null) { type = registry.getContextType(fContextTypeId); } return type; }
private static TemplateEngine createTemplateEngine(ContextTypeRegistry templateContextRegistry, String contextTypeId) { TemplateContextType contextType= templateContextRegistry.getContextType(contextTypeId); Assert.isNotNull(contextType); return new TemplateEngine(contextType); }
private static TemplateEngine createTemplateEngine(ContextTypeRegistry templateContextRegistry, String contextTypeId) { TemplateContextType contextType= templateContextRegistry.getContextType(contextTypeId); Assert.isNotNull(contextType); return new TemplateEngine(contextType); }
public MarkupTemplateCompletionProcessor() { ContextTypeRegistry contextTypeRegistry = WikiTextTemplateAccess.getInstance().getContextTypeRegistry(); contextType = (SourceTemplateContextType) contextTypeRegistry.getContextType(SourceTemplateContextType.ID); if (contextType == null) { throw new IllegalStateException(); } }
/** * Returns <code>true</code> if a context type id specifies a valid context type or if no context type registry is * present. * * @param contextTypeId the context type id to look for * @return <code>true</code> if the context type specified by the id is present in the context type registry, or * if no registry is specified */ private boolean contextExists(String contextTypeId) { return contextTypeId != null && (getRegistry() == null || getRegistry().getContextType(contextTypeId) != null); }
/** * @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; }
public CodeTemplateContext(String contextTypeName, IJavaProject project, String lineDelim) { super(JavaPlugin.getDefault().getCodeTemplateContextRegistry().getContextType(contextTypeName)); fLineDelimiter= lineDelim; fProject= project; }
/** * Returns <code>true</code> if a context type id specifies a valid context type * or if no context type registry is present. * * @param contextTypeId the context type id to look for * @return <code>true</code> if the context type specified by the id * is present in the context type registry, or if no registry is * specified */ private boolean contextExists(String contextTypeId) { return contextTypeId != null && (getRegistry() == null || getRegistry().getContextType(contextTypeId) != null); }
public CodeTemplateContext(String contextTypeName, IJavaProject project, String lineDelim) { super(JavaPlugin.getDefault().getCodeTemplateContextRegistry().getContextType(contextTypeName)); fLineDelimiter= lineDelim; fProject= project; }
/** * Returns <code>true</code> if a context type id specifies a valid context type * or if no context type registry is present. * * @param contextTypeId the context type id to look for * @return <code>true</code> if the context type specified by the id * is present in the context type registry, or if no registry is * specified */ private boolean contextExists(String contextTypeId) { return contextTypeId != null && (getRegistry() == null || getRegistry().getContextType(contextTypeId) != null); }
protected String getContextName() { String result; if (fContextCombo != null && !fContextCombo.isDisposed()) { result = fContextCombo.getText(); } else { String contextId = fTemplate.getContextTypeId(); result = fContextTypeRegistry.getContextType(contextId).getName(); } if (result.startsWith("Keyword ")) result = result.substring("Keyword ".length()); return result; }
@Override public Object getParent(Object element) { if (element instanceof TemplatePersistenceData) { TemplatePersistenceData templateData= (TemplatePersistenceData) element; return getContextTypeRegistry().getContextType( templateData.getTemplate().getContextTypeId()); } return null; }
private void doTextWidgetChanged(Widget w) { if (w == fNameText) { fSuppressError= false; updateButtons(); } else if (w == fContextCombo) { String contextId= getContextId(); fTemplateProcessor.setContextType(fContextTypeRegistry.getContextType(contextId)); } else if (w == fDescriptionText) { // oh, nothing } }
private void doTextWidgetChanged(Widget w) { if (w == fNameText) { fSuppressError= false; updateButtons(); } else if (w == fContextCombo) { String contextId= getContextId(); fTemplateProcessor.setContextType(fContextTypeRegistry.getContextType(contextId)); } else if (w == fDescriptionText) { // oh, nothing } }
public JavaSnippetCompletionProcessor(JavaSnippetEditor editor) { fEditor= editor; TemplateContextType contextType= JavaPlugin.getDefault().getTemplateContextRegistry().getContextType("java"); //$NON-NLS-1$ if (contextType != null) { fTemplateEngine= new TemplateEngine(contextType); } fComparator= new CompletionProposalComparator(); }
protected String validateTemplate(Template template) { TemplateContextType type= fRegistry.getContextType(template.getContextTypeId()); if (type == null) { return "Unknown context type: " + template.getContextTypeId(); //$NON-NLS-1$ } try { type.validate(template.getPattern()); return null; } catch (TemplateException e) { return e.getMessage(); } }
protected String validateTemplate(Template template) { TemplateContextType type= fRegistry.getContextType(template.getContextTypeId()); if (type == null) { return "Unknown context type: " + template.getContextTypeId(); //$NON-NLS-1$ } try { type.validate(template.getPattern()); return null; } catch (TemplateException e) { return e.getMessage(); } }