当前位置: 首页>>代码示例>>Java>>正文


Java TemplateVariable.setUnambiguous方法代码示例

本文整理汇总了Java中org.eclipse.jface.text.templates.TemplateVariable.setUnambiguous方法的典型用法代码示例。如果您正苦于以下问题:Java TemplateVariable.setUnambiguous方法的具体用法?Java TemplateVariable.setUnambiguous怎么用?Java TemplateVariable.setUnambiguous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.text.templates.TemplateVariable的用法示例。


在下文中一共展示了TemplateVariable.setUnambiguous方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
  variable.setUnambiguous(true);
  variable.setValue(""); // $NON-NLS-1$

  if (context instanceof JavaContext) {
    JavaContext jc = (JavaContext) context;
    List<String> params = variable.getVariableType().getParams();
    if (params.size() > 0) {
      for (Iterator<String> iterator = params.iterator(); iterator.hasNext(); ) {
        String typeName = iterator.next();
        jc.addImport(typeName);
      }
    }
  } else {
    super.resolve(variable, context);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:ImportsResolver.java

示例2: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
  variable.setUnambiguous(true);
  variable.setValue(""); // $NON-NLS-1$

  if (context instanceof JavaContext) {
    JavaContext jc = (JavaContext) context;
    List<String> params = variable.getVariableType().getParams();
    if (params.size() > 0) {
      for (Iterator<String> iterator = params.iterator(); iterator.hasNext(); ) {
        String qualifiedMemberName = iterator.next();
        jc.addStaticImport(qualifiedMemberName);
      }
    }
  } else {
    super.resolve(variable, context);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:StaticImportResolver.java

示例3: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
  if (variable instanceof MultiVariable) {
    JavaContext jc = (JavaContext) context;
    JavaVariable jv = (JavaVariable) variable;
    Variable[] iterables = getVariables(jc);
    if (iterables.length > 0) {
      jv.setChoices(iterables);
      jc.markAsUsed(iterables[0].getName());

      if (iterables.length > 1) variable.setUnambiguous(false);
      else variable.setUnambiguous(isUnambiguous(context));

      return;
    }
  }

  super.resolve(variable, context);
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:AbstractJavaContextType.java

示例4: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void resolve(TemplateVariable variable, TemplateContext context)
{
	if (!variable.getVariableType().getParams().isEmpty())
	{
		String[] values = (String[]) variable.getVariableType().getParams().toArray(new String[0]);
		variable.setValues(values);
		variable.setUnambiguous(false);
		variable.setResolved(true);
	}
	else
	{
		super.resolve(variable, context);
		setEvaluationString(variable.getName());
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:18,代码来源:TabStopVariableResolver.java

示例5: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	variable.setUnambiguous(true);
	variable.setValue(""); //$NON-NLS-1$

	if (context instanceof JavaContext) {
		JavaContext jc= (JavaContext) context;
		List<String> params= variable.getVariableType().getParams();
		if (params.size() > 0) {
			for (Iterator<String> iterator= params.iterator(); iterator.hasNext();) {
				String typeName= iterator.next();
				jc.addImport(typeName);
			}
		}
	} else {
		super.resolve(variable, context);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ImportsResolver.java

示例6: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	variable.setUnambiguous(true);
	variable.setValue(""); //$NON-NLS-1$

	if (context instanceof JavaContext) {
		JavaContext jc= (JavaContext) context;
		List<String> params= variable.getVariableType().getParams();
		if (params.size() > 0) {
			for (Iterator<String> iterator= params.iterator(); iterator.hasNext();) {
				String qualifiedMemberName= iterator.next();
				jc.addStaticImport(qualifiedMemberName);
			}
		}
	} else {
		super.resolve(variable, context);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:StaticImportResolver.java

示例7: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	if (variable instanceof MultiVariable) {
		JavaContext jc= (JavaContext) context;
		JavaVariable jv= (JavaVariable) variable;
        Variable[] iterables= getVariables(jc);
		if (iterables.length > 0) {
			jv.setChoices(iterables);
			jc.markAsUsed(iterables[0].getName());

			if (iterables.length > 1)
				variable.setUnambiguous(false);
			else
				variable.setUnambiguous(isUnambiguous(context));

			return;
		}
	}

	super.resolve(variable, context);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:AbstractJavaContextType.java

示例8: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	if (variable instanceof MultiVariable) {
		JavaContext jc= (JavaContext) context;
		JavaVariable jv= (JavaVariable) variable;
        Variable[] iterables= getLocalVariables(jc);
		if (iterables.length > 0) {
			jv.setChoices(iterables);
			jc.markAsUsed(iterables[0].getName());

			if (iterables.length > 1)
				variable.setUnambiguous(false);
			else
				variable.setUnambiguous(isUnambiguous(context));

			return;
		}
	}

	super.resolve(variable, context);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:AbstractJavaContextType.java

示例9: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext templateContext) {
	XtextTemplateContext castedContext = (XtextTemplateContext) templateContext;
	List<String> names = resolveValues(variable, castedContext);
	String[] bindings = names.toArray(new String[names.size()]);
	if (bindings.length != 0)
		variable.setValues(bindings);
	if (bindings.length > 1)
		variable.setUnambiguous(false);
	else
		variable.setUnambiguous(isUnambiguous(castedContext));
	variable.setResolved(true);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:14,代码来源:AbstractTemplateVariableResolver.java

示例10: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {

  variable.setUnambiguous(false);

  if (variable instanceof JavaVariable) {
    JavaContext jc = (JavaContext) context;
    JavaVariable jv = (JavaVariable) variable;

    List<String> params = variable.getVariableType().getParams();
    if (params.size() > 0) {
      fProposals = new String[params.size()];
      int i = 0;
      for (Iterator<String> iterator = params.iterator(); iterator.hasNext(); ) {
        String param = iterator.next();
        fProposals[i] = param;
        i++;
      }
      jv.setChoices(fProposals);
      jv.setCurrentChoice(fProposals[0]);

      jc.markAsUsed(jv.getDefaultValue());
    } else {
      fProposals = new String[] {variable.getDefaultValue()};
      super.resolve(variable, context);
      return;
    }
  } else super.resolve(variable, context);
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:LinkResolver.java

示例11: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {

  if (variable instanceof JavaVariable) {
    JavaContext jc = (JavaContext) context;
    JavaVariable jv = (JavaVariable) variable;

    List<String> params = variable.getVariableType().getParams();
    if (params.size() == 0) {
      fVariables = getVisibleVariables(fDefaultType, jc);
      jv.setParamType(fDefaultType);
    } else if (params.size() == 1) {
      String type = params.get(0);
      fVariables = getVisibleVariables(type, jc);
      jv.setParamType(type);
    } else {
      ArrayList<Variable> variables = new ArrayList<Variable>();
      for (Iterator<String> iterator = params.iterator(); iterator.hasNext(); ) {
        variables.addAll(Arrays.asList(getVisibleVariables(iterator.next(), jc)));
      }
      fVariables = variables.toArray(new Variable[variables.size()]);

      // set to default type, a template which references to the type
      // of _the_ parameter will not correctly work anyway
      jv.setParamType(fDefaultType);
    }

    if (fVariables.length > 0) {
      jv.setChoices(fVariables);
      jc.markAsUsed(jv.getDefaultValue());
    } else {
      super.resolve(variable, context);
      return;
    }
    if (fVariables.length > 1) variable.setUnambiguous(false);
    else variable.setUnambiguous(isUnambiguous(context));
  } else super.resolve(variable, context);
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:AbstractVariableResolver.java

示例12: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	@SuppressWarnings("unchecked")
	List<String> params = (List<String>) variable.getVariableType().getParams();
	variable.setValue("");
	variable.setUnambiguous(this.isUnambiguous(context));
	variable.setResolved(true);
	if (params.size() != 1) {
		return;
	}
	List<Integer> result = this.resolve(params, context);
	if (result.get(0) != null) {
		context.setVariable(variable.getName(), "" + result.get(0));
	}
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:16,代码来源:EvalResolver.java

示例13: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	@SuppressWarnings("unchecked")
	List<String> params = (List<String>) variable.getVariableType().getParams();
	variable.setValue("");
	variable.setResolved(true);
	variable.setUnambiguous(this.isUnambiguous(context));
	if (params.size() != 1) {
		return;
	}
	Integer expanded = this.resolve(params, context).get(0);
	if (expanded == null) {
		return;
	}
	char c = ' ';
	if (expanded > 0) {
		c = '+';
	}
	else {
		c = '-';
		expanded = -expanded;
	}
	char[] incDec = new char[expanded];
	Arrays.fill(incDec, c);
	String value = new String(incDec);
	variable.setValue(value);
	context.setVariable(variable.getName(), value);
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:29,代码来源:BfIncDecResolver.java

示例14: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	@SuppressWarnings("unchecked")
	List<String> params = (List<String>) variable.getVariableType().getParams();
	variable.setValue("");
	variable.setResolved(true);
	variable.setUnambiguous(this.isUnambiguous(context));
	if (params.size() != 1) {
		return;
	}
	Integer expanded = this.resolve(params, context).get(0);
	if (expanded == null) {
		return;
	}
	char c = ' ';
	if (expanded > 0) {
		c = '>';
	}
	else {
		c = '<';
		expanded = -expanded;
	}
	
	char[] shifts = new char[expanded];
	Arrays.fill(shifts, c);
	String value = new String(shifts); 
	variable.setValue(new String(shifts));
	context.setVariable(variable.getName(), value);
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:30,代码来源:BfMemShiftResolver.java

示例15: resolve

import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
	@SuppressWarnings("unchecked")
	List<String> params = (List<String>) variable.getVariableType().getParams();
	variable.setValue("");
	variable.setResolved(true);
	variable.setUnambiguous(this.isUnambiguous(context));
	if (params.size() != 2 && params.size() != 3) {
		return;
	}
	Integer repeats = this.resolve(Arrays.asList(params.get(0)), context).get(0);
	if (repeats == null) {
		return;
	}
	Integer deleteSize = null;
	if (params.size() == 3) {
		deleteSize = this.resolve(Arrays.asList(params.get(2)), context).get(0);
	}
	String pattern = params.get(1);
	StringBuilder result = new StringBuilder();
	for (int i = 0; i < repeats; i++) {
		result.append(pattern);
	}
	if (deleteSize != null && deleteSize > 0) {
		result.delete(result.length() - deleteSize, result.length());
	}
	variable.setValue(result.toString());
	context.setVariable(variable.getName(), result.toString());
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:30,代码来源:PatternGenerator.java


注:本文中的org.eclipse.jface.text.templates.TemplateVariable.setUnambiguous方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。