Java 类com.intellij.util.ThreeState 实例源码

项目:intellij-ce-playground    文件:CvsRootProvider.java   
@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;
}
项目:intellij-ce-playground    文件:CompoundPositionManager.java   
@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;
}
项目:intellij-ce-playground    文件:LoginPerformer.java   
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;
}
项目:intellij-ce-playground    文件:UnfocusedNameIdentifier.java   
@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;
}
项目:intellij-ce-playground    文件:SmartSerializer.java   
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);
                            }
                          };
}
项目:intellij-ce-playground    文件:ContentAnnotationCacheImpl.java   
@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;
}
项目:intellij-ce-playground    文件:CodeCompletionHandlerBase.java   
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;
}
项目:intellij-ce-playground    文件:SvnAuthenticationNotifier.java   
/**
 * 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;
}
项目:intellij-ce-playground    文件:ShowIntentionActionsHandler.java   
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;
}
项目:intellij-ce-playground    文件:XmlParser.java   
@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;
}
项目:intellij-ce-playground    文件:HtmlTextCompletionConfidence.java   
@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;
}
项目:intellij-ce-playground    文件:DeviceChooser.java   
@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);
    }
  }
}
项目:intellij-ce-playground    文件:AndroidProjectStructureConfigurable.java   
@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);
  }
}
项目:intellij-ce-playground    文件:UnimportedModuleNotificationProvider.java   
@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());
}
项目:intellij-ce-playground    文件:CvsInfo.java   
@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);
    }
  };
}
项目:intellij-ce-playground    文件:LaunchCompatibility.java   
/** Returns whether a project with given minSdkVersion and target platform can be run on an AVD with given target platform. */
@NotNull
public static LaunchCompatibility canRunOnAvd(@NotNull AndroidVersion minSdkVersion,
                                              @NotNull IAndroidTarget projectTarget,
                                              @NotNull IAndroidTarget avdTarget) {
  AndroidVersion avdVersion = avdTarget.getVersion();
  if (!avdVersion.canRun(minSdkVersion)) {
    String reason = String.format("minSdk(%1$s) %3$s deviceSdk(%2$s)",
                                  minSdkVersion,
                                  avdVersion,
                                  minSdkVersion.getCodename() == null ? ">" : "!=");
    return new LaunchCompatibility(ThreeState.NO, reason);
  }

  return projectTarget.isPlatform() ? YES : isCompatibleAddonAvd(projectTarget, avdTarget);
}
项目:intellij-ce-playground    文件:LaunchCompatibilityTest.java   
public void testMinSdk() {
  final MockPlatformTarget projectTarget = new MockPlatformTarget(14, 0);
  final EnumSet<IDevice.HardwareFeature> requiredFeatures = EnumSet.noneOf(IDevice.HardwareFeature.class);

  // cannot run if the API level of device is < API level required by minSdk
  LaunchCompatibility compatibility =
    LaunchCompatibility.canRunOnDevice(new AndroidVersion(8, null), projectTarget, requiredFeatures, createMockDevice(7, null), null);
  assertEquals(new LaunchCompatibility(ThreeState.NO, "minSdk(API 8) > deviceSdk(API 7)"), compatibility);

  // can run if the API level of device is >= API level required by minSdk
  compatibility =
    LaunchCompatibility.canRunOnDevice(new AndroidVersion(8, null), projectTarget, requiredFeatures, createMockDevice(8, null), null);
  assertEquals(new LaunchCompatibility(ThreeState.YES, null), compatibility);

  // cannot run if minSdk uses a code name that is not matched by the device
  compatibility =
    LaunchCompatibility.canRunOnDevice(new AndroidVersion(8, "P"), projectTarget, requiredFeatures, createMockDevice(9, null), null);
  assertEquals(new LaunchCompatibility(ThreeState.NO, "minSdk(API 8, P preview) != deviceSdk(API 9)"), compatibility);
}
项目:intellij-ce-playground    文件:LaunchCompatibilityTest.java   
public void testRequiredDeviceCharacteristic() {
  final AndroidVersion minSdkVersion = new AndroidVersion(8, null);
  final MockPlatformTarget projectTarget = new MockPlatformTarget(14, 0);
  EnumSet<IDevice.HardwareFeature> requiredFeatures = EnumSet.of(IDevice.HardwareFeature.WATCH);

  // cannot run if the device doesn't have a required feature
  LaunchCompatibility compatibility =
    LaunchCompatibility.canRunOnDevice(minSdkVersion, projectTarget, requiredFeatures, createMockDevice(8, null, false), null);
  assertEquals(new LaunchCompatibility(ThreeState.NO, "missing feature: WATCH"), compatibility);

  // can run if the device has the required features
  compatibility =
    LaunchCompatibility.canRunOnDevice(minSdkVersion, projectTarget, requiredFeatures, createMockDevice(8, null, true), null);
  assertEquals(new LaunchCompatibility(ThreeState.YES, null), compatibility);

  // cannot run apk's that don't specify uses-feature watch on a wear device
  requiredFeatures = EnumSet.noneOf(IDevice.HardwareFeature.class);
  compatibility =
    LaunchCompatibility.canRunOnDevice(minSdkVersion, projectTarget, requiredFeatures, createMockDevice(8, null, true), null);
  assertEquals(new LaunchCompatibility(ThreeState.NO, "missing uses-feature watch, non-watch apks cannot be launched on a watch"),
               compatibility);
}
项目:roc-completion    文件:SubCompletionConfidence.java   
@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;
}
项目:react-css-modules-intellij-plugin    文件:CssModulesClassNameCompletionConfidence.java   
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
    if (contextElement.getParent() instanceof JSLiteralExpression) {
        final PsiElement cssClassNamesImportOrRequire = CssModulesUtil.getCssClassNamesImportOrRequireDeclaration((JSLiteralExpression) contextElement.getParent());
        if (cssClassNamesImportOrRequire != null) {
            final StylesheetFile stylesheetFile = CssModulesUtil.resolveStyleSheetFile(cssClassNamesImportOrRequire);
            if (stylesheetFile != null) {
                return ThreeState.NO;
            }
        }
    }
    return ThreeState.UNSURE;
}
项目:intellij-ce-playground    文件:JavaValue.java   
@NotNull
@Override
public ThreeState computeInlineDebuggerData(@NotNull final XInlineDebuggerDataCallback callback) {
  computeSourcePosition(new XNavigatable() {
    @Override
    public void setSourcePosition(@Nullable XSourcePosition sourcePosition) {
      callback.computed(sourcePosition);
    }
  }, true);
  return ThreeState.YES;
}
项目:intellij-ce-playground    文件:StackFrameProxyImpl.java   
@Override
protected void clearCaches() {
  DebuggerManagerThreadImpl.assertIsManagerThread();
  if (LOG.isDebugEnabled()) {
    LOG.debug("caches cleared " + super.toString());
  }
  myFrameIndex = -1;
  myStackFrame = null;
  myIsObsolete = ThreeState.UNSURE;
  myThisReference = null;
  myClassLoader = null;
  myAllValues = null;
}
项目:intellij-ce-playground    文件:VirtualMachineProxyImpl.java   
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();
}
项目:intellij-ce-playground    文件:ObjectReferenceProxyImpl.java   
public boolean isCollected() {
  checkValid();
  if (myIsCollected != ThreeState.YES) {
    try {
      myIsCollected = ThreeState.fromBoolean(VirtualMachineProxyImpl.isCollected(myObjectReference));
    }
    catch (VMDisconnectedException ignored) {
      myIsCollected = ThreeState.YES;
    }
  }
  return myIsCollected.toBoolean();
}
项目:intellij-ce-playground    文件:ObjectReferenceProxyImpl.java   
/**
 * The advice to the proxy to clear cached data.
 */
@Override
protected void clearCaches() {
  if (myIsCollected == ThreeState.NO) {
    // clearing cache makes sense only if the object has not been collected yet
    myIsCollected = ThreeState.UNSURE;
  }
}
项目:intellij-ce-playground    文件:JCiPExternalLibraryResolver.java   
@Nullable
@Override
public ExternalClassResolveResult resolveClass(@NotNull String shortClassName, @NotNull ThreeState isAnnotation, @NotNull Module contextModule) {
  if (JCiPUtil.isJCiPAnnotation(shortClassName) && isAnnotation == ThreeState.YES) {
    return new ExternalClassResolveResult("net.jcip.annotations." + shortClassName, JDCIP_LIBRARY_DESCRIPTOR);
  }
  return null;
}
项目:intellij-ce-playground    文件:LoginPerformer.java   
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;
  }
}
项目:intellij-ce-playground    文件:OrderEntryFix.java   
private static ThreeState isReferenceToAnnotation(final PsiElement psiElement) {
  if (!PsiUtil.isLanguageLevel5OrHigher(psiElement)) {
    return ThreeState.NO;
  }
  if (PsiTreeUtil.getParentOfType(psiElement, PsiAnnotation.class) != null) {
    return ThreeState.YES;
  }
  if (PsiTreeUtil.getParentOfType(psiElement, PsiImportStatement.class) != null) {
    return ThreeState.UNSURE;
  }
  return ThreeState.NO;
}
项目:intellij-ce-playground    文件:JavaReflectionCompletionConfidence.java   
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
  final PsiElement literal = contextElement.getParent();
  if (literal != null && JavaReflectionReferenceContributor.PATTERN.accepts(literal)) {
    return ThreeState.NO;
  }
  return super.shouldSkipAutopopup(contextElement, psiFile, offset);
}
项目:intellij-ce-playground    文件:InspectionProfileEntry.java   
private static void addAllSuppressActions(@NotNull Set<SuppressQuickFix> fixes,
                                          @NotNull PsiElement element,
                                          @NotNull InspectionSuppressor suppressor,
                                          @NotNull ThreeState appliedToInjectionHost,
                                          @NotNull String toolId) {
  final SuppressQuickFix[] actions = suppressor.getSuppressActions(element, toolId);
  for (SuppressQuickFix action : actions) {
    if (action instanceof InjectionAwareSuppressQuickFix) {
      ((InjectionAwareSuppressQuickFix)action).setShouldBeAppliedToInjectionHost(appliedToInjectionHost);
    }
    fixes.add(action);
  }
}
项目:intellij-ce-playground    文件:ConfigImportSettings.java   
protected String getProductName(ThreeState full) {
  ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
  if (full == ThreeState.YES) {
    return namesInfo.getFullProductName();
  }
  else if (full == ThreeState.NO) {
    return namesInfo.getProductName();
  }
  else {
    return namesInfo.getProductName().equals("IDEA") ? namesInfo.getFullProductName() : namesInfo.getProductName();
  }
}
项目:intellij-ce-playground    文件:ImportOldConfigsPanel.java   
private void close() {
  if (myRbImport.isSelected()) {
    String instHome = null;
    if (myPrevInstallation.getText() != null) {
      instHome = FileUtil.toSystemDependentName(PathUtil.getCanonicalPath(myPrevInstallation.getText()));
    }

    String productWithVendor = mySettings.getProductName(ThreeState.YES);
    if (StringUtil.isEmptyOrSpaces(instHome)) {
      showError(mySettings.getEmptyHomeErrorText(productWithVendor));
      return;
    }

    String thisInstanceHome = PathManager.getHomePath();
    if (SystemInfo.isFileSystemCaseSensitive ? thisInstanceHome.equals(instHome) : thisInstanceHome.equalsIgnoreCase(instHome)) {
      showError(mySettings.getCurrentHomeErrorText(productWithVendor));
      return;
    }

    if (myRbImport.isSelected() && !ConfigImportHelper.isInstallationHomeOrConfig(instHome, mySettings)) {
      showError(mySettings.getInvalidHomeErrorText(productWithVendor, instHome));
      return;
    }

    if (!new File(instHome).canRead()) {
      showError(mySettings.getInaccessibleHomeErrorText(instHome));
      return;
    }
  }

  //noinspection SSBasedInspection
  dispose();
}
项目:intellij-ce-playground    文件:FileStatusManagerImpl.java   
private void cacheChangedFileStatus(final VirtualFile virtualFile, final FileStatus fs) {
  myCachedStatuses.put(virtualFile, fs);
  if (FileStatus.NOT_CHANGED.equals(fs)) {
    final ThreeState parentingStatus = myFileStatusProvider.getNotChangedDirectoryParentingStatus(virtualFile);
    if (ThreeState.YES.equals(parentingStatus)) {
      myWhetherExactlyParentToChanged.put(virtualFile, true);
    }
    else if (ThreeState.UNSURE.equals(parentingStatus)) {
      myWhetherExactlyParentToChanged.put(virtualFile, false);
    }
  }
  else {
    myWhetherExactlyParentToChanged.remove(virtualFile);
  }
}
项目:intellij-ce-playground    文件:SkipAutopopupInComments.java   
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
  if (PsiTreeUtil.findElementOfClassAtOffset(psiFile, offset, PsiComment.class, false) != null) {
    return ThreeState.YES;
  }

  return ThreeState.UNSURE;
}
项目:intellij-ce-playground    文件:SkipAutopopupInStrings.java   
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
  if (isInStringLiteral(contextElement)) {
    return ThreeState.YES;
  }

  return ThreeState.UNSURE;
}
项目:intellij-ce-playground    文件:SkipDefaultsSerializationFilter.java   
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);
  }
}
项目:intellij-ce-playground    文件:DiffTree.java   
@NotNull
private CompareResult looksEqual(@NotNull ShallowNodeComparator<OT, NT> comparator, OT oldChild1, NT newChild1) {
  if (oldChild1 == null || newChild1 == null) {
    return oldChild1 == newChild1 ? CompareResult.EQUAL : CompareResult.NOT_EQUAL;
  }
  if (!comparator.typesEqual(oldChild1, newChild1)) return CompareResult.NOT_EQUAL;
  ThreeState ret = comparator.deepEqual(oldChild1, newChild1);
  if (ret == ThreeState.YES) return CompareResult.EQUAL;
  if (ret == ThreeState.UNSURE) return CompareResult.DRILL_DOWN_NEEDED;
  return CompareResult.TYPE_ONLY;
}
项目:intellij-ce-playground    文件:ASTShallowComparator.java   
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;
}
项目:intellij-ce-playground    文件:ASTShallowComparator.java   
@Override
public boolean hashCodesEqual(@NotNull final ASTNode n1, @NotNull final ASTNode n2) {
  if (n1 instanceof LeafElement && n2 instanceof LeafElement) {
    return textMatches(n1, n2) == ThreeState.YES;
  }

  if (n1 instanceof PsiErrorElement && n2 instanceof PsiErrorElement) {
    final PsiErrorElement e1 = (PsiErrorElement)n1;
    final PsiErrorElement e2 = (PsiErrorElement)n2;
    if (!Comparing.equal(e1.getErrorDescription(), e2.getErrorDescription())) return false;
  }

  return ((TreeElement)n1).hc() == ((TreeElement)n2).hc();
}
项目:intellij-ce-playground    文件:StartedActivated.java   
public void start(final List<ThrowableRunnable<VcsException>> callList) {
  if (myMaster != null) {
    myMaster.start(callList);
  }
  if (! ThreeState.YES.equals(myState)) {
    myState = ThreeState.YES;
    callList.add(myStart);
  }
}