Java Code Examples for org.eclipse.jface.text.templates.Template#matches()
The following examples show how to use
org.eclipse.jface.text.templates.Template#matches() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaContext.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private boolean hasCompatibleContextType(Template template) { String key= getKey(); if (template.matches(key, getContextType().getId())) return true; if (fCompatibleContextTypeIds == null) return false; Iterator<String> iter= fCompatibleContextTypeIds.iterator(); while (iter.hasNext()) { if (template.matches(key, iter.next())) return true; } return false; }
Example 2
Source File: JavaContext.java From goclipse with Eclipse Public License 1.0 | 6 votes |
private boolean hasCompatibleContextType(Template template) { String key= getKey(); if (template.matches(key, getContextType().getId())) return true; // if (fCompatibleContextTypeIds == null) // return false; // // Iterator<String> iter= fCompatibleContextTypeIds.iterator(); // while (iter.hasNext()) { // if (template.matches(key, iter.next())) // return true; // } // return false; }
Example 3
Source File: AbstractTypeScriptContext.java From typescript.java with MIT License | 5 votes |
@Override public boolean canEvaluate(Template template) { if (fForceEvaluation) return true; String key = getKey(); return template.matches(key, getContextType().getId()) && key.length() != 0 && template.getName().toLowerCase().startsWith(key.toLowerCase()); }
Example 4
Source File: JavaDocContext.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean canEvaluate(Template template) { String key= getKey(); if (fForceEvaluation) return true; return template.matches(key, getContextType().getId()) && (key.length() != 0) && template.getName().toLowerCase().startsWith(key.toLowerCase()); }
Example 5
Source File: QuickTemplateProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private boolean canEvaluate(TemplateContext context, Template template) { String contextId= context.getContextType().getId(); if (JavaDocContextType.ID.equals(contextId)) { if (!template.matches("", contextId) || template.getPattern().indexOf($_LINE_SELECTION) == -1 && template.getPattern().indexOf($_WORD_SELECTION) == -1) //$NON-NLS-1$ return false; } else { if (template.matches("", JavaDocContextType.ID) || template.getPattern().indexOf($_LINE_SELECTION) == -1) //$NON-NLS-1$ return false; } TemplateContextType contextType= JavaPlugin.getDefault().getTemplateContextRegistry().getContextType(template.getContextTypeId()); return contextType instanceof CompilationUnitContextType; }