Java 类org.eclipse.jface.text.templates.TemplateVariableType 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:JavaContext.java   
@Override
    public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
        clear();

        if (!canEvaluate(template))
            throw new TemplateException(JavaTemplateMessages.Context_error_cannot_evaluate);

        TemplateTranslator translator= new TemplateTranslator() {
            @Override
            protected TemplateVariable createVariable(TemplateVariableType type, String name, int[] offsets) {
//              TemplateVariableResolver resolver= getContextType().getResolver(type.getName());
//              return resolver.createVariable();

                MultiVariable variable= new JavaVariable(type, name, offsets);
                fVariables.put(name, variable);
                return variable;
            }
        };
        TemplateBuffer buffer= translator.translate(template);

        getContextType().resolve(buffer, this);

        rewriteImports();

        IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore();
        boolean useCodeFormatter= prefs.getBoolean(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER);

        IJavaProject project= getJavaProject();
        JavaFormatter formatter= new JavaFormatter(TextUtilities.getDefaultLineDelimiter(getDocument()), getIndentation(), useCodeFormatter, project);
        formatter.format(buffer, this);

        clear();

        return buffer;
    }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaContext.java   
@Override
    public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
        clear();

        if (!canEvaluate(template))
            throw new TemplateException(JavaTemplateMessages.Context_error_cannot_evaluate);

        TemplateTranslator translator= new TemplateTranslator() {
            @Override
            protected TemplateVariable createVariable(TemplateVariableType type, String name, int[] offsets) {
//              TemplateVariableResolver resolver= getContextType().getResolver(type.getName());
//              return resolver.createVariable();

                MultiVariable variable= new JavaVariable(type, name, offsets);
                fVariables.put(name, variable);
                return variable;
            }
        };
        TemplateBuffer buffer= translator.translate(template);

        getContextType().resolve(buffer, this);

        rewriteImports();

        IPreferenceStore prefs= JavaPlugin.getDefault().getPreferenceStore();
        boolean useCodeFormatter= prefs.getBoolean(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER);

        IJavaProject project= getJavaProject();
        JavaFormatter formatter= new JavaFormatter(TextUtilities.getDefaultLineDelimiter(getDocument()), getIndentation(), useCodeFormatter, project);
        formatter.format(buffer, this);

        clear();

        return buffer;
    }
项目:che    文件:JavaContext.java   
@Override
public TemplateBuffer evaluate(Template template) throws BadLocationException, TemplateException {
  clear();

  if (!canEvaluate(template))
    throw new TemplateException(JavaTemplateMessages.Context_error_cannot_evaluate);

  TemplateTranslator translator =
      new TemplateTranslator() {
        @Override
        protected TemplateVariable createVariable(
            TemplateVariableType type, String name, int[] offsets) {
          //                TemplateVariableResolver resolver= getContextType().getResolver(type.getName());
          //                return resolver.createVariable();

          MultiVariable variable = new JavaVariable(type, name, offsets);
          fVariables.put(name, variable);
          return variable;
        }
      };
  TemplateBuffer buffer = translator.translate(template);

  getContextType().resolve(buffer, this);

  rewriteImports();

  //        IPreferenceStore prefs = JavaPlugin.getDefault().getPreferenceStore();
  boolean useCodeFormatter =
      true; // prefs.getBoolean(PreferenceConstants.TEMPLATES_USE_CODEFORMATTER);

  IJavaProject project = getJavaProject();
  JavaFormatter formatter =
      new JavaFormatter(
          TextUtilities.getDefaultLineDelimiter(getDocument()),
          getIndentation(),
          useCodeFormatter,
          project);
  formatter.format(buffer, this);

  clear();

  return buffer;
}
项目:che    文件:JavaVariable.java   
public JavaVariable(TemplateVariableType type, String name, int[] offsets) {
  super(type, name, offsets);
}
项目:che    文件:MultiVariable.java   
public MultiVariable(TemplateVariableType type, String name, int[] offsets) {
  super(type, name, name, offsets);
  fKey = DEFAULT_KEY;
  fValueMap.put(fKey, new String[] {name});
  fCurrentChoice = getChoices()[0];
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaVariable.java   
public JavaVariable(TemplateVariableType type, String name, int[] offsets) {
    super(type, name, offsets);
}
项目:Eclipse-Postfix-Code-Completion    文件:MultiVariable.java   
public MultiVariable(TemplateVariableType type, String name, int[] offsets) {
    super(type, name, name, offsets);
    fKey= DEFAULT_KEY;
    fValueMap.put(fKey, new String[] { name });
    fCurrentChoice= getChoices()[0];
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaVariable.java   
public JavaVariable(TemplateVariableType type, String name, int[] offsets) {
    super(type, name, offsets);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:MultiVariable.java   
public MultiVariable(TemplateVariableType type, String name, int[] offsets) {
    super(type, name, name, offsets);
    fKey= DEFAULT_KEY;
    fValueMap.put(fKey, new String[] { name });
    fCurrentChoice= getChoices()[0];
}