本文整理汇总了Java中com.intellij.codeInsight.template.impl.TemplateImpl.isDeactivated方法的典型用法代码示例。如果您正苦于以下问题:Java TemplateImpl.isDeactivated方法的具体用法?Java TemplateImpl.isDeactivated怎么用?Java TemplateImpl.isDeactivated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.template.impl.TemplateImpl
的用法示例。
在下文中一共展示了TemplateImpl.isDeactivated方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAvailable
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
final TemplateImpl template = getTemplate();
if (template != null) {
int offset = editor.getCaretModel().getOffset();
int startOffset = offset;
if (editor.getSelectionModel().hasSelection()) {
final int selStart = editor.getSelectionModel().getSelectionStart();
final int selEnd = editor.getSelectionModel().getSelectionEnd();
startOffset = (offset == selStart) ? selEnd : selStart;
}
PsiElement element = file.findElementAt(startOffset);
while (element instanceof PsiWhiteSpace) {
element = element.getPrevSibling();
}
PsiStatement psiStatement = PsiTreeUtil.getParentOfType(element, PsiStatement.class, false);
if (psiStatement != null) {
startOffset = psiStatement.getTextRange().getStartOffset();
}
if (!template.isDeactivated() &&
(TemplateManagerImpl.isApplicable(file, offset, template) ||
(TemplateManagerImpl.isApplicable(file, startOffset, template)))) {
return getIterableExpression(editor, file) != null;
}
}
return false;
}
示例2: getMatchingTemplates
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
@NotNull
private static List<TemplateImpl> getMatchingTemplates(@NotNull String templateKey) {
TemplateSettings settings = TemplateSettings.getInstance();
List<TemplateImpl> candidates = new ArrayList<TemplateImpl>();
for (TemplateImpl template : settings.getTemplates(templateKey)) {
if (!template.isDeactivated()) {
candidates.add(template);
}
}
return candidates;
}
示例3: getMatchingTemplates
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
private static List<TemplateImpl> getMatchingTemplates(@NotNull String templateKey) {
TemplateSettings settings = TemplateSettings.getInstance();
List<TemplateImpl> candidates = new ArrayList<TemplateImpl>();
for (TemplateImpl template : settings.getTemplates(templateKey)) {
if (!template.isDeactivated()) {
candidates.add(template);
}
}
return candidates;
}
示例4: getMatchingTemplates
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
@Nonnull
private static List<TemplateImpl> getMatchingTemplates(@Nonnull String templateKey) {
TemplateSettings settings = TemplateSettings.getInstance();
List<TemplateImpl> candidates = new ArrayList<TemplateImpl>();
for (TemplateImpl template : settings.getTemplates(templateKey)) {
if (!template.isDeactivated()) {
candidates.add(template);
}
}
return candidates;
}
示例5: fillCompletionVariants
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
public static void fillCompletionVariants(JavaSmartCompletionParameters parameters,
final Consumer<LookupElement> result,
PrefixMatcher matcher) {
final PsiElement element = parameters.getPosition();
if (JavaKeywordCompletion.isAfterTypeDot(element)) {
addKeyword(result, element, PsiKeyword.CLASS);
addKeyword(result, element, PsiKeyword.THIS);
}
if (!JavaKeywordCompletion.AFTER_DOT.accepts(element)) {
if (parameters.getParameters().getInvocationCount() <= 1) {
new CollectionsUtilityMethodsProvider(parameters.getPosition(),
parameters.getExpectedType(),
parameters.getDefaultType(), result)
.addCompletions(StringUtil.isNotEmpty(matcher.getPrefix()));
}
ClassLiteralGetter.addCompletions(parameters, result, matcher);
final PsiElement position = parameters.getPosition();
final PsiType expectedType = parameters.getExpectedType();
for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) {
if (!template.isDeactivated() && template.getTemplateContext().isEnabled(new SmartCompletionContextType())) {
result.consume(new SmartCompletionTemplateItem(template, position));
}
}
addKeyword(result, position, PsiKeyword.TRUE);
addKeyword(result, position, PsiKeyword.FALSE);
final PsiElement parent = position.getParent();
if (parent != null && !(parent.getParent() instanceof PsiSwitchLabelStatement)) {
for (final PsiExpression expression : ThisGetter.getThisExpressionVariants(position)) {
result.consume(new ExpressionLookupItem(expression));
}
}
processDataflowExpressionTypes(position, expectedType, matcher, result);
}
}
示例6: isAvailableTemplate
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
private boolean isAvailableTemplate(@NotNull TemplateImpl template) {
if (myApplicableContextTypes == null) {
myApplicableContextTypes = TemplateManagerImpl.getApplicableContextTypes(myFile, myOffset);
}
return !template.isDeactivated() && TemplateManagerImpl.isApplicable(template, myApplicableContextTypes);
}
示例7: fillCompletionVariants
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
public static void fillCompletionVariants(JavaSmartCompletionParameters parameters,
final Consumer<LookupElement> result,
PrefixMatcher matcher) {
final PsiElement element = parameters.getPosition();
if (JavaCompletionData.isAfterTypeDot(element)) {
addKeyword(result, element, PsiKeyword.CLASS);
addKeyword(result, element, PsiKeyword.THIS);
}
if (!JavaCompletionData.AFTER_DOT.accepts(element)) {
if (parameters.getParameters().getInvocationCount() <= 1) {
new CollectionsUtilityMethodsProvider(parameters.getPosition(),
parameters.getExpectedType(),
parameters.getDefaultType(), result)
.addCompletions(StringUtil.isNotEmpty(matcher.getPrefix()));
}
ClassLiteralGetter.addCompletions(parameters, result, matcher);
final PsiElement position = parameters.getPosition();
final PsiType expectedType = parameters.getExpectedType();
for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) {
if (!template.isDeactivated() && template.getTemplateContext().isEnabled(new SmartCompletionContextType())) {
result.consume(new SmartCompletionTemplateItem(template, position));
}
}
addKeyword(result, position, PsiKeyword.TRUE);
addKeyword(result, position, PsiKeyword.FALSE);
final PsiElement parent = position.getParent();
if (parent != null && !(parent.getParent() instanceof PsiSwitchLabelStatement)) {
for (final PsiExpression expression : ThisGetter.getThisExpressionVariants(position)) {
result.consume(new ExpressionLookupItem(expression));
}
}
processDataflowExpressionTypes(position, expectedType, matcher, result);
}
}
示例8: isAvailableTemplate
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
private boolean isAvailableTemplate(@Nonnull TemplateImpl template) {
if (myApplicableContextTypes == null) {
myApplicableContextTypes = TemplateManagerImpl.getApplicableContextTypes(myFile, myOffset);
}
return !template.isDeactivated() && TemplateManagerImpl.isApplicable(template, myApplicableContextTypes);
}
示例9: fillCompletionVariants
import com.intellij.codeInsight.template.impl.TemplateImpl; //导入方法依赖的package包/类
public static void fillCompletionVariants(JavaSmartCompletionParameters parameters, final Consumer<LookupElement> result, PrefixMatcher matcher)
{
final PsiElement element = parameters.getPosition();
if(JavaKeywordCompletion.isAfterTypeDot(element))
{
addKeyword(result, element, PsiKeyword.CLASS);
addKeyword(result, element, PsiKeyword.THIS);
}
if(!JavaKeywordCompletion.AFTER_DOT.accepts(element))
{
if(parameters.getParameters().getInvocationCount() <= 1)
{
new CollectionsUtilityMethodsProvider(parameters.getPosition(), parameters.getExpectedType(), parameters.getDefaultType(), result).addCompletions(StringUtil.isNotEmpty(matcher
.getPrefix()));
}
ClassLiteralGetter.addCompletions(parameters, result, matcher);
final PsiElement position = parameters.getPosition();
final PsiType expectedType = parameters.getExpectedType();
for(final TemplateImpl template : TemplateSettings.getInstance().getTemplates())
{
if(!template.isDeactivated() && template.getTemplateContext().isEnabled(new SmartCompletionContextType()))
{
result.consume(new SmartCompletionTemplateItem(template, position));
}
}
addKeyword(result, position, PsiKeyword.TRUE);
addKeyword(result, position, PsiKeyword.FALSE);
final PsiElement parent = position.getParent();
if(parent != null && !(parent.getParent() instanceof PsiSwitchLabelStatement))
{
for(final PsiExpression expression : ThisGetter.getThisExpressionVariants(position))
{
result.consume(new ExpressionLookupItem(expression));
}
}
processDataflowExpressionTypes(position, expectedType, matcher, result);
}
}