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


Java ThreeState类代码示例

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


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

示例1: equals

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (!(o instanceof CvsRootProvider)) return false;

  CvsRootProvider that = (CvsRootProvider)o;

  if (myAdminRoot != null ? !myAdminRoot.equals(that.myAdminRoot) : that.myAdminRoot != null) return false;
  if (myLocalRoot != null ? !myLocalRoot.equals(that.myLocalRoot) : that.myLocalRoot != null) return false;

  final ThreeState checkEnv = checkNulls(myCvsEnvironment, that.myCvsEnvironment);
  if (! ThreeState.UNSURE.equals(checkEnv)) return ThreeState.YES.equals(checkEnv);

  final ThreeState checkRoot = checkNulls(myCvsEnvironment.getCvsRoot(), that.myCvsEnvironment.getCvsRoot());
  if (! ThreeState.UNSURE.equals(checkRoot)) return ThreeState.YES.equals(checkRoot);

  if (myCvsEnvironment.getCvsRoot().getRepositoryPath() != null ?
      ! myCvsEnvironment.getCvsRoot().getRepositoryPath().equals(that.myCvsEnvironment.getCvsRoot().getRepositoryPath()) :
      that.myCvsEnvironment.getCvsRoot().getRepositoryPath() != null) return false;

  if (myCvsEnvironment.getCvsRoot().getCvsRoot() != null ?
      ! myCvsEnvironment.getCvsRoot().getCvsRoot().equals(that.myCvsEnvironment.getCvsRoot().getCvsRoot()) :
      that.myCvsEnvironment.getCvsRoot().getCvsRoot() != null) return false;
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CvsRootProvider.java

示例2: evaluateCondition

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Override
public ThreeState evaluateCondition(@NotNull EvaluationContext context,
                                    @NotNull StackFrameProxyImpl frame,
                                    @NotNull Location location,
                                    @NotNull String expression) {
  for (PositionManager positionManager : myPositionManagers) {
    if (positionManager instanceof PositionManagerEx) {
      try {
        ThreeState result = ((PositionManagerEx)positionManager).evaluateCondition(context, frame, location, expression);
        if (result != ThreeState.UNSURE) {
          return result;
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CompoundPositionManager.java

示例3: loginAll

import com.intellij.util.ThreeState; //导入依赖的package包/类
public boolean loginAll(final boolean goOffline) {
  for (CvsEnvironment root : myRoots) {
    final CvsLoginWorker worker = root.getLoginWorker(myProject);

    try {
      final ThreeState checkResult = checkLoginWorker(worker, myForceCheck);
      if (! ThreeState.YES.equals(checkResult)) {
        if (ThreeState.UNSURE.equals(checkResult)) {
          if (goOffline) {
            worker.goOffline();
          }
          myExceptionConsumer.consume(new CvsException("Authentication canceled", root.getCvsRootAsString()));
        }
        return false;
      }
    } catch (AuthenticationException e) {
      myExceptionConsumer.consume(new CvsException(e, root.getCvsRootAsString()));
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LoginPerformer.java

示例4: shouldFocusLookup

import com.intellij.util.ThreeState; //导入依赖的package包/类
@NotNull
@Override
public ThreeState shouldFocusLookup(@NotNull CompletionParameters parameters) {
  final PsiElement position = parameters.getPosition();
  final PsiElement parent = position.getParent();
  if (parent instanceof PsiNameIdentifierOwner) {
    final PsiElement nameIdentifier = ((PsiNameIdentifierOwner)parent).getNameIdentifier();
    if (nameIdentifier == position) {
      return ThreeState.NO;
    }

    if (nameIdentifier != null && position.getTextRange().equals(nameIdentifier.getTextRange())) {
      //sometimes name identifiers are non-physical (e.g. Groovy)
      return ThreeState.NO;
    }
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:UnfocusedNameIdentifier.java

示例5: SmartSerializer

import com.intellij.util.ThreeState; //导入依赖的package包/类
public SmartSerializer(boolean trackSerializedNames, boolean useSkipEmptySerializationFilter) {
  mySerializedAccessorNameTracker = trackSerializedNames ? new LinkedHashSet<String>() : null;

  mySerializationFilter = useSkipEmptySerializationFilter ?
                          new SkipEmptySerializationFilter() {
                            @Override
                            protected ThreeState accepts(@NotNull String name, @NotNull Object beanValue) {
                              return mySerializedAccessorNameTracker != null && mySerializedAccessorNameTracker.contains(name) ? ThreeState.YES : ThreeState.UNSURE;
                            }
                          } :
                          new SkipDefaultValuesSerializationFilters() {
                            @Override
                            public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
                              if (mySerializedAccessorNameTracker != null && mySerializedAccessorNameTracker.contains(accessor.getName())) {
                                return true;
                              }
                              return super.accepts(accessor, bean);
                            }
                          };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SmartSerializer.java

示例6: isRecent

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Override
@Nullable
public ThreeState isRecent(final VirtualFile vf,
                           final VcsKey vcsKey,
                           final VcsRevisionNumber number,
                           final TextRange range,
                           final long boundTime) {
  TreeMap<Integer, Long> treeMap;
  synchronized (myLock) {
    treeMap = myCache.get(new HistoryCacheWithRevisionKey(VcsContextFactory.SERVICE.getInstance().createFilePathOn(vf), vcsKey, number));
  }
  if (treeMap != null) {
    Map.Entry<Integer, Long> last = treeMap.floorEntry(range.getEndOffset());
    if (last == null || last.getKey() < range.getStartOffset()) return ThreeState.NO;
    Map.Entry<Integer, Long> first = treeMap.ceilingEntry(range.getStartOffset());
    assert first != null;
    final SortedMap<Integer,Long> interval = treeMap.subMap(first.getKey(), last.getKey());
    for (Map.Entry<Integer, Long> entry : interval.entrySet()) {
      if (entry.getValue() >= boundTime) return ThreeState.YES;
    }
    return ThreeState.NO;
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ContentAnnotationCacheImpl.java

示例7: shouldSkipAutoPopup

import com.intellij.util.ThreeState; //导入依赖的package包/类
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,代码行数:22,代码来源:CodeCompletionHandlerBase.java

示例8: isAuthenticatedFor

import com.intellij.util.ThreeState; //导入依赖的package包/类
/**
 * Bases on presence of notifications!
 */
public ThreeState isAuthenticatedFor(@NotNull VirtualFile vf, @Nullable ClientFactory factory) {
  final WorkingCopy wcCopy = myRootsToWorkingCopies.getWcRoot(vf);
  if (wcCopy == null) return ThreeState.UNSURE;

  // check there's no cancellation yet
  final boolean haveCancellation = getStateFor(wcCopy.getUrl());
  if (haveCancellation) return ThreeState.NO;

  final Boolean keptResult = myCopiesPassiveResults.get(wcCopy.getUrl());
  if (Boolean.TRUE.equals(keptResult)) return ThreeState.YES;
  if (Boolean.FALSE.equals(keptResult)) return ThreeState.NO;

  // check have credentials
  final boolean calculatedResult =
    factory == null ? passiveValidation(myVcs.getProject(), wcCopy.getUrl()) : passiveValidation(factory, wcCopy.getUrl());
  myCopiesPassiveResults.put(wcCopy.getUrl(), calculatedResult);
  return calculatedResult ? ThreeState.YES : ThreeState.NO;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SvnAuthenticationNotifier.java

示例9: isAvailableHere

import com.intellij.util.ThreeState; //导入依赖的package包/类
private static boolean isAvailableHere(Editor editor, PsiFile psiFile, PsiElement psiElement, boolean inProject, IntentionAction action) {
  try {
    Project project = psiFile.getProject();
    if (action instanceof SuppressIntentionActionFromFix) {
      final ThreeState shouldBeAppliedToInjectionHost = ((SuppressIntentionActionFromFix)action).isShouldBeAppliedToInjectionHost();
      if (editor instanceof EditorWindow && shouldBeAppliedToInjectionHost == ThreeState.YES) {
        return false;
      }
      if (!(editor instanceof EditorWindow) && shouldBeAppliedToInjectionHost == ThreeState.NO) {
        return false;
      }
    }
    
    if (action instanceof PsiElementBaseIntentionAction) {
      if (!inProject || psiElement == null || !((PsiElementBaseIntentionAction)action).isAvailable(project, editor, psiElement)) return false;
    }
    else if (!action.isAvailable(project, editor, psiFile)) {
      return false;
    }
  }
  catch (IndexNotReadyException e) {
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ShowIntentionActionsHandler.java

示例10: fun

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Override
public ThreeState fun(ASTNode oldNode,
                      LighterASTNode newNode,
                      FlyweightCapableTreeStructure<LighterASTNode> structure) {
  if (oldNode instanceof XmlTag && newNode.getTokenType() == XmlElementType.XML_TAG) {
    String oldName = ((XmlTag)oldNode).getName();
    Ref<LighterASTNode[]> childrenRef = Ref.create(null);
    int count = structure.getChildren(newNode, childrenRef);
    if (count < 3) return ThreeState.UNSURE;
    LighterASTNode[] children = childrenRef.get();
    if (children[0].getTokenType() != XmlTokenType.XML_START_TAG_START) return ThreeState.UNSURE;
    if (children[1].getTokenType() != XmlTokenType.XML_NAME) return ThreeState.UNSURE;
    if (children[2].getTokenType() != XmlTokenType.XML_TAG_END) return ThreeState.UNSURE;
    LighterASTTokenNode name = (LighterASTTokenNode)children[1];
    CharSequence newName = name.getText();
    if (!Comparing.equal(oldName, newName)) return ThreeState.NO;
  }

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

示例11: shouldSkipAutopopup

import com.intellij.util.ThreeState; //导入依赖的package包/类
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
  ASTNode node = contextElement.getNode();
  if (node != null && node.getElementType() == XmlTokenType.XML_DATA_CHARACTERS) {
    PsiElement parent = contextElement.getParent();
    if (parent instanceof XmlText || parent instanceof XmlDocument) {
      String contextElementText = contextElement.getText();
      int endOffset = offset - contextElement.getTextRange().getStartOffset();
      String prefix = contextElementText.substring(0, Math.min(contextElementText.length(), endOffset));
      if (!StringUtil.startsWithChar(prefix, '<') && !StringUtil.startsWithChar(prefix, '&')) {
        return ThreeState.YES;
      }
    }
  }
  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HtmlTextCompletionConfidence.java

示例12: customizeCellRenderer

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Override
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
  if (!(value instanceof LaunchCompatibility)) {
    return;
  }

  LaunchCompatibility compatibility = (LaunchCompatibility)value;
  ThreeState compatible = compatibility.isCompatible();
  if (compatible == ThreeState.YES) {
    append("Yes");
  } else {
    if (compatible == ThreeState.NO) {
      append("No", SimpleTextAttributes.ERROR_ATTRIBUTES);
    } else {
      append("Maybe");
    }
    String reason = compatibility.getReason();
    if (reason != null) {
      append(", ");
      append(reason);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DeviceChooser.java

示例13: apply

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Override
public void apply() throws ConfigurationException {
  validateState();
  if (myErrorsPanel.hasCriticalErrors()) {
    return;
  }

  boolean dataChanged = false;
  for (Configurable configurable: myConfigurables) {
    if (configurable.isModified()) {
      dataChanged = true;
      configurable.apply();
    }
  }

  if (!myProject.isDefault() && (dataChanged || GradleSyncState.getInstance(myProject).isSyncNeeded() == ThreeState.YES)) {
    GradleProjectImporter.getInstance().requestProjectSync(myProject, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidProjectStructureConfigurable.java

示例14: createNotificationPanel

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (!Projects.isGradleProject(myProject) || myIsImporting.get()) {
    return null;
  }
  GradleSyncState syncState = GradleSyncState.getInstance(myProject);
  if (Projects.lastGradleSyncFailed(myProject) ||
      syncState.isSyncInProgress() ||
      syncState.isSyncNeeded() != ThreeState.NO) {
    return null;
  }
  if (!isGradleBuildFile(file) || isImportedGradleProjectRoot(file, myProject)) {
    return null;
  }
  return new UnimportedModuleNotificationPanel(myProject, file.getParent());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:UnimportedModuleNotificationProvider.java

示例15: getLoginWorker

import com.intellij.util.ThreeState; //导入依赖的package包/类
@Override
public CvsLoginWorker getLoginWorker(final Project project) {
  return new CvsLoginWorker() {
    @Override
    public boolean promptForPassword() {
      return true;
    }

    @Override
    public ThreeState silentLogin(boolean forceCheck) {
      VcsBalloonProblemNotifier.showOverChangesView(
        project, CvsBundle.message("message.error.invalid.cvs.root", getCvsRootAsString()), MessageType.ERROR);
      return ThreeState.NO;
    }

    @Override
    public void goOffline() {
      setOffline(true);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CvsInfo.java


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