/** Creates a java context type. */ public JavaDocContextType() { // global addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new SurroundWithLineSelection()); addResolver(new SurroundWithWordSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); // compilation unit addResolver(new File()); addResolver(new PrimaryTypeName()); addResolver(new Method()); addResolver(new ReturnType()); addResolver(new Arguments()); addResolver(new Type()); addResolver(new Package()); addResolver(new Project()); }
private void addResolvers(int noOfParameters) { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); addResolver(new EvalResolver("eval", "Evaluates an expression. Returns empty String, used to define intermediate variables used as parameters")); addResolver(new BfMemShiftResolver("mem_shift", "Inserts (number) of memory pointer shifts. Negative parameter shifts left, positive shifts right")); addResolver(new BfIncDecResolver("inc_dec", "Inserts (number) of increments/decrements. Negative parameter decrements, positive increments")); addResolver(new BfKeyResolver("trigger_key", "Evaluates to the text on which the template proposal was triggered")); addResolver(new PatternGenerator("repeat", ":repeat(ex1, pattern, ex2) repeats the pattern ex1 times and deletes ex2 characters from the result")); for (int i = noOfParameters; i>0; i--) { addResolver(new BfNamedParameterResolver(i)); } }
private void addGlobalResolvers() { // Global addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); // Tabstops resolver addResolver(new TabStopVariableResolver()); // Environment variables resolver addResolver(new EnvironmentVariableVariableResolver()); }
/** * Creates a java context type. */ public JavaDocContextType() { // global addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new SurroundWithLineSelection()); addResolver(new SurroundWithWordSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); // compilation unit addResolver(new File()); addResolver(new PrimaryTypeName()); addResolver(new Method()); addResolver(new ReturnType()); addResolver(new Arguments()); addResolver(new Type()); addResolver(new Package()); addResolver(new Project()); }
private void addGlobalResolvers() { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); PyContextTypeVariables.addResolvers(this); HashMap<String, Object> locals = new HashMap<String, Object>(); locals.put("py_context_type", this); //execute all the files that start with 'pytemplate' that are located beneath //the org.python.pydev.jython/jysrc directory and some user specified dir (if any). JythonPlugin.execAll(locals, "pytemplate", interpreter); }
private int getCaretOffset(TemplateBuffer buffer) { TemplateVariable[] variables = buffer.getVariables(); for (int i = 0; i != variables.length; i++) { TemplateVariable variable = variables[i]; if (variable.getType().equals(GlobalTemplateVariables.Cursor.NAME)) return variable.getOffsets()[0]; } return buffer.getString().length(); }
private void addGlobalResolvers() { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); }
public AbstractTypeScriptContextType(String name) { super(name); // global addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); }
protected void addDefaultTemplateVariables() { addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.User()); addResolver(new GlobalTemplateVariables.Cursor()); }
@Override protected String resolve(TemplateContext context) { String selection = context.getVariable(org.eclipse.jface.text.templates.GlobalTemplateVariables.SELECTION); if (selection == null) return ""; // $NON-NLS-1$ return selection; }
@Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { // check for multiple cursor variables for (int i = 0; i < variables.length; i++) { TemplateVariable var = variables[i]; if (var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { if (var.getOffsets().length > 1) { throw new TemplateException( JavaTemplateMessages.ContextType_error_multiple_cursor_variables); } } } }
/** * Initializes the context type resolvers. * * <p><strong>Note:</strong> Only call this method if this context type doesn't inherit from * another context type which already has these resolvers. * * @since 3.4 */ public void initializeContextTypeResolvers() { // global addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new SurroundWithLineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); // compilation unit addResolver(new File()); addResolver(new PrimaryTypeName()); addResolver(new ReturnType()); addResolver(new Method()); addResolver(new Type()); addResolver(new Package()); addResolver(new Project()); addResolver(new Arguments()); // java addResolver(new Array()); addResolver(new ArrayType()); addResolver(new ArrayElement()); addResolver(new Index()); addResolver(new Iterator()); addResolver(new Collection()); addResolver(new Iterable()); addResolver(new IterableType()); addResolver(new IterableElement()); addResolver(new Todo()); }
private void addGlobalResolvers() { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); addResolver(new ElementNameResolver()); }
@Override protected String resolve(TemplateContext context) { String selection= context.getVariable(org.eclipse.jface.text.templates.GlobalTemplateVariables.SELECTION); if (selection == null) return ""; //$NON-NLS-1$ return selection; }
@Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { // check for multiple cursor variables for (int i= 0; i < variables.length; i++) { TemplateVariable var= variables[i]; if (var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { if (var.getOffsets().length > 1) { throw new TemplateException(JavaTemplateMessages.ContextType_error_multiple_cursor_variables); } } } }
/** * Initializes the context type resolvers. * <p> * <strong>Note:</strong> Only call this method if this * context type doesn't inherit from another context type * which already has these resolvers.</p> * * @since 3.4 */ public void initializeContextTypeResolvers() { // global addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new SurroundWithLineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); // compilation unit addResolver(new File()); addResolver(new PrimaryTypeName()); addResolver(new ReturnType()); addResolver(new Method()); addResolver(new Type()); addResolver(new Package()); addResolver(new Project()); addResolver(new Arguments()); // java addResolver(new Array()); addResolver(new ArrayType()); addResolver(new ArrayElement()); addResolver(new Index()); addResolver(new Iterator()); addResolver(new Collection()); addResolver(new Iterable()); addResolver(new IterableType()); addResolver(new IterableElement()); addResolver(new Todo()); }
private int getCaretOffset(TemplateBuffer buffer) { TemplateVariable[] variables= buffer.getVariables(); for (int i= 0; i != variables.length; i++) { TemplateVariable variable= variables[i]; if (variable.getType().equals(GlobalTemplateVariables.Cursor.NAME)) return variable.getOffsets()[0]; } return buffer.getString().length(); }
@Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { // check for multiple cursor variables for (int i = 0; i < variables.length; i++) { TemplateVariable var = variables[i]; if (var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { if (var.getOffsets().length > 1) { throw new TemplateException("Template has multiple cursor variables."); } } } }
@Override protected String resolve(TemplateContext context) { String selection= context.getVariable(GlobalTemplateVariables.SELECTION); if (selection == null) return ""; return selection; }
protected void setupResolvers() { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); addAdditionalResolvers(); }
@Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { // check for multiple cursor variables for(int i = 0; i < variables.length; i++) { TemplateVariable var = variables[i]; if(var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { if(var.getOffsets().length > 1) { throw new TemplateException(JavaTemplateMessages.ContextType_error_multiple_cursor_variables); } } } }
public SQLEditorTemplateContextType() { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.LineSelection()); }
private void addGlobalResolvers() { addResolver(new GlobalTemplateVariables.Cursor()); }