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


Java ThreeState.UNSURE属性代码示例

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


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

示例1: silentLogin

@Override
public ThreeState silentLogin(boolean forceCheck) throws AuthenticationException {
  if (mySettings.isOffline())  return ThreeState.NO;

  try {
    silentLoginImpl(forceCheck);
  }
  catch (AuthenticationException e) {
    if (e.isSolveable()) {
      clearOldCredentials();
      return ThreeState.UNSURE;
    }
    throw e;
  }
  return ThreeState.YES;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:CvsLoginWorkerImpl.java

示例2: shouldSkipAutoPopup

private static boolean shouldSkipAutoPopup(Editor editor, PsiFile psiFile) {
  int offset = editor.getCaretModel().getOffset();
  int psiOffset = Math.max(0, offset - 1);

  PsiElement elementAt = InjectedLanguageUtil.findInjectedElementNoCommit(psiFile, psiOffset);
  if (elementAt == null) {
    elementAt = psiFile.findElementAt(psiOffset);
  }
  if (elementAt == null) return true;

  Language language = PsiUtilCore.findLanguageFromElement(elementAt);

  for (CompletionConfidence confidence : CompletionConfidenceEP.forLanguage(language)) {
    final ThreeState result = confidence.shouldSkipAutopopup(elementAt, psiFile, offset);
    if (result != ThreeState.UNSURE) {
      LOG.debug(confidence + " has returned shouldSkipAutopopup=" + result);
      return result == ThreeState.YES;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CodeCompletionHandlerBase.java

示例3: shouldSkipAutopopup

@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset)
{
    // Wrong file.
    if (!CompletionPreloader.isRocConfigFile(psiFile))
    {
        return ThreeState.UNSURE;
    }

    JSProperty property = PsiTreeUtil.getParentOfType(contextElement, JSProperty.class);
    // Wrong place in file.
    if (property == null)
    {
        return ThreeState.UNSURE;
    }

    Setting setting = CompletionPreloader
        .getCompletions()
        .getSetting(property.getQualifiedName());

    // Not a roc-setting.
    if (setting == null)
    {
        return ThreeState.UNSURE;
    }

    return setting.getSubCompletionVariants().size() > 1 ? ThreeState.NO : ThreeState.UNSURE;
}
 
开发者ID:whitefire,项目名称:roc-completion,代码行数:29,代码来源:SubCompletionConfidence.java

示例4: shouldFocusLookup

@NotNull
@Override
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
  final PsiElement position = parameters.getPosition();

  PsiFile file = position.getContainingFile();
  if (file instanceof GroovyFile && GroovyScriptUtil.getScriptType((GroovyFile)file) != GroovyScriptUtil.DEFAULT_TYPE) {
    return ThreeState.NO;
  }

  if (position.getParent() instanceof GrReferenceElement &&
      PsiJavaPatterns.psiElement().afterLeaf(PsiJavaPatterns.psiElement().withText("(").withParent(GrForStatement.class)).accepts(position)) {
    return ThreeState.NO;
  }

  if (position.getParent() instanceof GrReferenceExpression) {
    final GrReferenceExpression ref = (GrReferenceExpression)position.getParent();
    final GrExpression qualifier = ref.getQualifierExpression();
    if (qualifier == null) {
      if (isPossibleClosureParameter(ref)) return ThreeState.NO;
      if (parameters.getOriginalFile().getUserData(GROOVY_SHELL_FILE) == Boolean.TRUE) {
        return ThreeState.NO;
      }

      GrExpression runtimeQualifier = PsiImplUtil.getRuntimeQualifier(ref);
      if (runtimeQualifier != null && runtimeQualifier.getType() == null) {
        return ThreeState.NO;
      }

      return ThreeState.YES;
    }

    if (qualifier.getType() == null) {
      return ThreeState.NO;
    }
    return ThreeState.YES;
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GroovyCompletionConfidence.java

示例5: isSyncNeeded

/**
 * Indicates whether a project sync with Gradle is needed. A Gradle sync is usually needed when a build.gradle or settings.gradle file has
 * been updated <b>after</b> the last project sync was performed.
 *
 * @return {@code YES} if a sync with Gradle is needed, {@code FALSE} otherwise, or {@code UNSURE} If the timestamp of the last Gradle
 * sync cannot be found.
 */
@NotNull
public ThreeState isSyncNeeded() {
  long lastSync = getLastGradleSyncTimestamp();
  if (lastSync < 0) {
    // Previous sync may have failed. We don't know if a sync is needed or not. Let client code decide.
    return ThreeState.UNSURE;
  }
  return isSyncNeeded(lastSync) ? ThreeState.YES : ThreeState.NO;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GradleSyncState.java

示例6: isAvailable

public final boolean isAvailable() {
  if (myValue == ThreeState.UNSURE) {
    try {
      myValue = ThreeState.fromBoolean(calcValue());
    }
    catch (VMDisconnectedException e) {
      LOG.info(e);
      myValue = ThreeState.NO;
    }
  }
  return myValue.toBoolean();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:VirtualMachineProxyImpl.java

示例7: textMatches

private ThreeState textMatches(ASTNode oldNode, ASTNode newNode) {
  myIndicator.checkCanceled();
  String oldText = TreeUtil.isCollapsedChameleon(oldNode) ? oldNode.getText() : null;
  String newText = TreeUtil.isCollapsedChameleon(newNode) ? newNode.getText() : null;
  if (oldText != null && newText != null) return oldText.equals(newText) ? ThreeState.YES : ThreeState.UNSURE;

  if (oldText != null) {
    return compareTreeToText((TreeElement)newNode, oldText) ? ThreeState.YES : ThreeState.UNSURE;
  }
  if (newText != null) {
    return compareTreeToText((TreeElement)oldNode, newText) ? ThreeState.YES : ThreeState.UNSURE;
  }

  if (oldNode instanceof ForeignLeafPsiElement) {
    return newNode instanceof ForeignLeafPsiElement && oldNode.getText().equals(newNode.getText()) ? ThreeState.YES : ThreeState.NO;
  }
  
  if (newNode instanceof ForeignLeafPsiElement) return ThreeState.NO;

  if (oldNode instanceof LeafElement) {
    return ((LeafElement)oldNode).textMatches(newNode.getText()) ? ThreeState.YES : ThreeState.NO;
  }
  if (newNode instanceof LeafElement) {
    return ((LeafElement)newNode).textMatches(oldNode.getText()) ? ThreeState.YES : ThreeState.NO;
  }

  if (oldNode instanceof PsiErrorElement && newNode instanceof PsiErrorElement) {
    final PsiErrorElement e1 = (PsiErrorElement)oldNode;
    final PsiErrorElement e2 = (PsiErrorElement)newNode;
    if (!Comparing.equal(e1.getErrorDescription(), e2.getErrorDescription())) return ThreeState.NO;
  }

  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ASTShallowComparator.java

示例8: shouldSkipAutopopup

@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
  if (CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS && psiFile.getUserData(GROOVY_SHELL_FILE) == Boolean.TRUE) {
    return ThreeState.YES;
  }

  if (com.intellij.psi.impl.PsiImplUtil.isLeafElementOfType(contextElement, TokenSets.STRING_LITERALS)) {
    @SuppressWarnings("ConstantConditions")
    PsiElement parent = contextElement.getParent();
    if (parent != null) {
      for (PsiReference reference : parent.getReferences()) {
        if (!reference.isSoft() && reference.getRangeInElement().shiftRight(parent.getTextOffset()).containsOffset(offset)) {
          return ThreeState.NO;
        }
      }
    }

    return ThreeState.YES;
  }

  if (PsiJavaPatterns.psiElement().afterLeaf("def").accepts(contextElement)) {
    return ThreeState.YES;
  }

  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GroovyCompletionConfidence.java

示例9: shouldPreselectFirstSuggestion

private static boolean shouldPreselectFirstSuggestion(CompletionParameters parameters) {
  if (!Registry.is("ide.completion.autopopup.choose.by.enter")) {
    return false;
  }

  if (Registry.is("ide.completion.lookup.element.preselect.depends.on.context")) {
    for (CompletionPreselectionBehaviourProvider provider : Extensions.getExtensions(CompletionPreselectionBehaviourProvider.EP_NAME)) {
      if (!provider.shouldPreselectFirstSuggestion(parameters)) {
        return false;
      }
    }
  }

  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    return true;
  }

  switch (CodeInsightSettings.getInstance().AUTOPOPUP_FOCUS_POLICY) {
    case CodeInsightSettings.ALWAYS:
      return true;
    case CodeInsightSettings.NEVER:
      return false;
  }

  final Language language = PsiUtilCore.getLanguageAtOffset(parameters.getPosition().getContainingFile(), parameters.getOffset());
  for (CompletionConfidence confidence : CompletionConfidenceEP.forLanguage(language)) {
    //noinspection deprecation
    final ThreeState result = confidence.shouldFocusLookup(parameters);
    if (result != ThreeState.UNSURE) {
      LOG.debug(confidence + " has returned shouldFocusLookup=" + result);
      return result == ThreeState.YES;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:CompletionProgressIndicator.java

示例10: isEquals

@NotNull
@Override
public ThreeState isEquals(@NotNull Change change1, @NotNull Change change2) {
  if (change1 instanceof ConflictedSvnChange && change2 instanceof ConflictedSvnChange) {
    if (!change1.isTreeConflict() && !change2.isTreeConflict()) return ThreeState.UNSURE;
    if (!change1.isTreeConflict() || !change2.isTreeConflict()) return ThreeState.NO;

    TreeConflictDescription description1 = ((ConflictedSvnChange)change1).getBeforeDescription();
    TreeConflictDescription description2 = ((ConflictedSvnChange)change2).getBeforeDescription();
    return TreeConflictRefreshablePanel.descriptionsEqual(description1, description2) ? ThreeState.YES : ThreeState.NO;
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SvnTreeConflictDiffRequestProvider.java

示例11: equal

boolean equal(@Nullable Binding binding, @Nullable Object currentValue, @Nullable Object defaultValue) {
  if (defaultValue instanceof Element && currentValue instanceof Element) {
    return JDOMUtil.areElementsEqual((Element)currentValue, (Element)defaultValue);
  }
  else {
    if (currentValue == defaultValue) {
      return true;
    }
    if (currentValue == null || defaultValue == null) {
      return false;
    }

    if (binding instanceof BasePrimitiveBinding) {
      Binding referencedBinding = ((BasePrimitiveBinding)binding).myBinding;
      if (referencedBinding instanceof BeanBinding) {
        BeanBinding classBinding = (BeanBinding)referencedBinding;
        ThreeState compareByFields = classBinding.compareByFields;
        if (compareByFields == ThreeState.UNSURE) {
          compareByFields = ReflectionUtil.getDeclaredMethod(classBinding.myBeanClass, "equals", Object.class) == null ? ThreeState.YES : ThreeState.NO;

          classBinding.compareByFields = compareByFields;
        }

        if (compareByFields == ThreeState.YES) {
          return classBinding.equalByFields(currentValue, defaultValue, this);
        }
      }
    }

    return Comparing.equal(currentValue, defaultValue);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:SkipDefaultsSerializationFilter.java

示例12: checkLoginWorker

public static ThreeState checkLoginWorker(final CvsLoginWorker worker, final boolean forceCheckParam)
  throws AuthenticationException {
  boolean forceCheck = forceCheckParam;
  final Ref<Boolean> promptResult = new Ref<Boolean>();
  final Runnable prompt = new Runnable() {
    @Override
    public void run() {
      promptResult.set(worker.promptForPassword());
    }
  };
  while (true) {
    final ThreeState state = worker.silentLogin(forceCheck);
    if (ThreeState.YES.equals(state)) return ThreeState.YES;
    if (ThreeState.NO.equals(state)) return state;
    try {
      // hack: allow indeterminate progress bar time to appear before displaying login dialog.
      // otherwise progress bar without cancel button appears on top of login dialog, blocking input and hanging IDEA.
      Thread.sleep(1000L);
    }
    catch (InterruptedException ignore) {
      return ThreeState.NO;
    }
    UIUtil.invokeAndWaitIfNeeded(prompt);
    if (! Boolean.TRUE.equals(promptResult.get())) {
      return ThreeState.UNSURE; // canceled
    }
    forceCheck = true;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:LoginPerformer.java

示例13: shouldFocusLookup

@NotNull
@Override
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PyCompletionConfidence.java

示例14: accepts

@Override
protected ThreeState accepts(@NotNull String name, @NotNull Object beanValue) {
  return name.equals("port") ? ThreeState.fromBoolean(!beanValue.equals(defaultPort)) : ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RemoteDebugConfiguration.java

示例15: isShouldBeAppliedToInjectionHost

public ThreeState isShouldBeAppliedToInjectionHost() {
  return myFix instanceof InjectionAwareSuppressQuickFix
         ? ((InjectionAwareSuppressQuickFix)myFix).isShouldBeAppliedToInjectionHost()
         : ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:SuppressIntentionActionFromFix.java


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