Java 类com.intellij.openapi.util.Comparing 实例源码

项目:intellij-ce-playground    文件:AndroidToolWindowFactory.java   
@Override
public void rootsChanged(ModuleRootEvent event) {
  final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(TOOL_WINDOW_ID);
  if (window == null) {
    return;
  }

  if (window.isDisposed() || !window.isVisible()) {
    return;
  }

  AndroidPlatform newPlatform = getPlatform();

  if (!Comparing.equal(myPrevPlatform, newPlatform)) {
    myPrevPlatform = newPlatform;
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        if (!window.isDisposed() && window.isVisible()) {
          myView.activate();
        }
      }
    });
  }
}
项目:intellij-ce-playground    文件:EditorGutterComponentImpl.java   
private void drawEditorLineBackgroundRect(Graphics g,
                                          TextAttributes attributes,
                                          int visualLine,
                                          Color defaultBackgroundColor,
                                          Color defaultForegroundColor,
                                          int startX,
                                          int startY) {
  Color color = myEditor.getBackgroundColor(attributes);
  if (!Comparing.equal(color, defaultBackgroundColor)) {
    Color fgColor = attributes.getForegroundColor();
    if (!Comparing.equal(fgColor, defaultForegroundColor)) {
      myTextFgColors.put(visualLine, fgColor);
    }
    g.setColor(color);
    g.fillRect(startX, startY, getWidth() - startX, myEditor.getLineHeight());
  }
}
项目:intellij-ce-playground    文件:CopyPasteManagerEx.java   
private void moveContentToStackTop(Transferable t, boolean notifyOthers) {
  Transferable current = myData.isEmpty() ? null : myData.get(0);
  if (!Comparing.equal(t, current)) {
    myData.remove(t);
    myData.add(0, t);
    if (notifyOthers) {
      setSystemClipboardContent(t);
      fireContentChanged(current, t);
    }
  }
  else {
    if (notifyOthers) {
      setSystemClipboardContent(t);
    }
  }
}
项目:intellij-ce-playground    文件:KeywordArgumentCompletionUtil.java   
@Override
public void visitPyCallExpression(PyCallExpression node) {
  if (node.isCalleeText("pop", "get", "getattr")) {
    PyReferenceExpression child = PsiTreeUtil.getChildOfType(node.getCallee(), PyReferenceExpression.class);
    if (child != null) {
      String operandName = child.getName();
      if (node.getArguments().length > 0) {
        PyExpression argument = node.getArguments()[0];
        processGet(operandName, argument);
      }
    }
  }
  else if (node.isCalleeText("__init__")) {
    kwArgsTransit = false;
    for (PyExpression e : node.getArguments()) {
      if (e instanceof PyStarArgument) {
        PyStarArgument kw = (PyStarArgument)e;
        if (Comparing.equal(myKwArgs.getName(), kw.getFirstChild().getNextSibling().getText())) {
          kwArgsTransit = true;
          break;
        }
      }
    }
  }
  super.visitPyCallExpression(node);
}
项目:intellij-ce-playground    文件:PsiMethodReferenceExpressionImpl.java   
@Override
public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
  PsiElement oldIdentifier = findChildByRoleAsPsiElement(ChildRole.REFERENCE_NAME);
  if (oldIdentifier == null) {
    oldIdentifier = findChildByRoleAsPsiElement(ChildRole.CLASS_REFERENCE);
  }
  if (oldIdentifier == null) {
    throw new IncorrectOperationException();
  }
  final String oldRefName = oldIdentifier.getText();
  if (PsiKeyword.THIS.equals(oldRefName) ||
      PsiKeyword.SUPER.equals(oldRefName) ||
      PsiKeyword.NEW.equals(oldRefName) ||
      Comparing.strEqual(oldRefName, newElementName)) {
    return this;
  }
  PsiIdentifier identifier = JavaPsiFacade.getInstance(getProject()).getElementFactory().createIdentifier(newElementName);
  oldIdentifier.replace(identifier);
  return this;
}
项目:intellij-ce-playground    文件:CreateFromUsageUtils.java   
private static int compareMembers(PsiMember m1, PsiMember m2, PsiExpression context) {
  ProgressManager.checkCanceled();
  int result = JavaStatisticsManager.createInfo(null, m2).getUseCount() - JavaStatisticsManager.createInfo(null, m1).getUseCount();
  if (result != 0) return result;
  final PsiClass aClass = m1.getContainingClass();
  final PsiClass bClass = m2.getContainingClass();
  if (aClass != null && bClass != null) {
    result = JavaStatisticsManager.createInfo(null, bClass).getUseCount() - JavaStatisticsManager.createInfo(null, aClass).getUseCount();
    if (result != 0) return result;
  }

  WeighingComparable<PsiElement,ProximityLocation> proximity1 = PsiProximityComparator.getProximity(m1, context);
  WeighingComparable<PsiElement,ProximityLocation> proximity2 = PsiProximityComparator.getProximity(m2, context);
  if (proximity1 != null && proximity2 != null) {
    result = proximity2.compareTo(proximity1);
    if (result != 0) return result;
  }

  String name1 = PsiUtil.getMemberQualifiedName(m1);
  String name2 = PsiUtil.getMemberQualifiedName(m2);
  return Comparing.compare(name1, name2);
}
项目:intellij-ce-playground    文件:JavaChangeSignatureUsageSearcher.java   
private void findParametersUsage(final PsiMethod method, ArrayList<UsageInfo> result, PsiMethod[] overriders) {
  if (JavaLanguage.INSTANCE.equals(myChangeInfo.getLanguage())) {
    PsiParameter[] parameters = method.getParameterList().getParameters();
    for (ParameterInfo info : myChangeInfo.getNewParameters()) {
      if (info.getOldIndex() >= 0) {
        PsiParameter parameter = parameters[info.getOldIndex()];
        if (!info.getName().equals(parameter.getName())) {
          addParameterUsages(parameter, result, info);

          for (PsiMethod overrider : overriders) {
            PsiParameter parameter1 = overrider.getParameterList().getParameters()[info.getOldIndex()];
            if (parameter1 != null && Comparing.strEqual(parameter.getName(), parameter1.getName())) {
              addParameterUsages(parameter1, result, info);
            }
          }
        }
      }
    }
  }
}
项目:intellij-ce-playground    文件:EncodingManager.java   
private void applySettings(VirtualFile file) {
  if (file == null) return;
  if (!Utils.isEnabled(CodeStyleSettingsManager.getInstance(myProject).getCurrentSettings())) return;

  // Prevent "setEncoding" calling "saveAll" from causing an endless loop
  isApplyingSettings = true;
  try {
    final String filePath = Utils.getFilePath(myProject, file);
    final List<OutPair> outPairs = SettingsProviderComponent.getInstance().getOutPairs(myProject, filePath);
    final EncodingProjectManager encodingProjectManager = EncodingProjectManager.getInstance(myProject);
    final String charset = Utils.configValueForKey(outPairs, charsetKey);
    if (!charset.isEmpty()) {
      final Charset newCharset = encodingMap.get(charset);
      if (newCharset != null) {
        if (Comparing.equal(newCharset, file.getCharset())) return;
        encodingProjectManager.setEncoding(file, newCharset);
      } else {
        Utils.invalidConfigMessage(myProject, charset, charsetKey, filePath);
      }
    }
  } finally {
    isApplyingSettings = false;
  }
}
项目:intellij-ce-playground    文件:PropertyUtil.java   
@SuppressWarnings("HardCodedStringLiteral")
public static boolean isSimplePropertySetter(@Nullable PsiMethod method) {
  if (method == null) return false;

  if (method.isConstructor()) return false;

  String methodName = method.getName();

  if (!(methodName.startsWith("set") && methodName.length() > "set".length())) return false;
  if (Character.isLowerCase(methodName.charAt("set".length()))
      && (methodName.length() == "set".length() + 1 || Character.isLowerCase(methodName.charAt("set".length() + 1)))) {
    return false;
  }

  if (method.getParameterList().getParametersCount() != 1) {
    return false;
  }

  final PsiType returnType = method.getReturnType();

  if (returnType == null || PsiType.VOID.equals(returnType)) {
    return true;
  }

  return Comparing.equal(PsiUtil.resolveClassInType(TypeConversionUtil.erasure(returnType)), method.getContainingClass());
}
项目:intellij-ce-playground    文件:MavenArtifactIndex.java   
@NotNull
public List<MavenArtifact> findArtifacts(@Nullable String groupId, @Nullable String artifactId, @Nullable String version) {
  Map<String, List<MavenArtifact>> groupMap = myData.get(groupId);
  if (groupMap == null) return Collections.emptyList();

  List<MavenArtifact> artifacts = groupMap.get(artifactId);
  if (artifacts == null) return Collections.emptyList();

  List<MavenArtifact> res = new SmartList<MavenArtifact>();
  for (MavenArtifact artifact : artifacts) {
    if (Comparing.equal(version, artifact.getVersion())) {
      res.add(artifact);
    }
  }

  return res;
}
项目:intellij-ce-playground    文件:SliceUtil.java   
@Nullable
private static PsiSubstitutor unify(@NotNull PsiSubstitutor substitutor, @NotNull PsiSubstitutor parentSubstitutor, @NotNull Project project) {
  Map<PsiTypeParameter,PsiType> newMap = new THashMap<PsiTypeParameter, PsiType>(substitutor.getSubstitutionMap());

  for (Map.Entry<PsiTypeParameter, PsiType> entry : substitutor.getSubstitutionMap().entrySet()) {
    PsiTypeParameter typeParameter = entry.getKey();
    PsiType type = entry.getValue();
    PsiClass resolved = PsiUtil.resolveClassInType(type);
    if (!parentSubstitutor.getSubstitutionMap().containsKey(typeParameter)) continue;
    PsiType parentType = parentSubstitutor.substitute(parentSubstitutor.substitute(typeParameter));

    if (resolved instanceof PsiTypeParameter) {
      PsiTypeParameter res = (PsiTypeParameter)resolved;
      newMap.put(res, parentType);
    }
    else if (!Comparing.equal(type, parentType)) {
      return null; // cannot unify
    }
  }
  return JavaPsiFacade.getElementFactory(project).createSubstitutor(newMap);
}
项目:intellij-ce-playground    文件:LocalTaskImpl.java   
private void copy(Task issue) {
  mySummary = issue.getSummary();
  myDescription = issue.getDescription();
  myComments = issue.getComments();
  myClosed = issue.isClosed();
  myCreated = issue.getCreated();
  if (Comparing.compare(myUpdated, issue.getUpdated()) < 0) {
    myUpdated = issue.getUpdated();
  }
  myType = issue.getType();
  myPresentableName = issue.getPresentableName();
  myCustomIcon = issue.getCustomIcon();
  myIssueUrl = issue.getIssueUrl();
  myRepository = issue.getRepository();

  myProject = issue.getProject();
  myNumber = issue.getNumber();
}
项目:intellij-ce-playground    文件:CreateSetupPyAction.java   
private static String getPackageDirs(DataContext dataContext) {
  final Module module = LangDataKeys.MODULE.getData(dataContext);
  if (module != null) {
    final VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
    if (sourceRoots.length > 0) {
      for (VirtualFile sourceRoot : sourceRoots) {
        // TODO notify if we have multiple source roots and can't build mapping automatically
        final VirtualFile contentRoot = ProjectFileIndex.SERVICE.getInstance(module.getProject()).getContentRootForFile(sourceRoot);
        if (contentRoot != null && !Comparing.equal(contentRoot, sourceRoot)) {
          final String relativePath = VfsUtilCore.getRelativePath(sourceRoot, contentRoot, '/');
          return "\n    package_dir={'': '" + relativePath + "'},";
        }
      }
    }
  }
  return "";
}
项目:intellij-ce-playground    文件:JavaModuleExternalPathsImpl.java   
@Override
public boolean isChanged() {
  if (myOrderRootPointerContainers.size() != mySource.myOrderRootPointerContainers.size()) return true;
  for (final OrderRootType type : myOrderRootPointerContainers.keySet()) {
    final VirtualFilePointerContainer container = myOrderRootPointerContainers.get(type);
    final VirtualFilePointerContainer otherContainer = mySource.myOrderRootPointerContainers.get(type);
    if (container == null || otherContainer == null) {
      if (container != otherContainer) return true;
    }
    else {
      final String[] urls = container.getUrls();
      final String[] otherUrls = otherContainer.getUrls();
      if (urls.length != otherUrls.length) return true;
      for (int i = 0; i < urls.length; i++) {
        if (!Comparing.strEqual(urls[i], otherUrls[i])) return true;
      }
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:MemberInplaceRenamer.java   
@Nullable
public PsiElement getSubstituted() {
  if (mySubstituted != null && mySubstituted.isValid()){
    if (mySubstituted instanceof PsiNameIdentifierOwner) {
      if (Comparing.strEqual(myOldName, ((PsiNameIdentifierOwner)mySubstituted).getName())) return mySubstituted;

      final RangeMarker rangeMarker = mySubstitutedRange != null ? mySubstitutedRange : myRenameOffset;
      if (rangeMarker != null)
        return PsiTreeUtil.findElementOfClassAtRange(mySubstituted.getContainingFile(), rangeMarker.getStartOffset(), rangeMarker.getEndOffset(), PsiNameIdentifierOwner.class);
    }
    return mySubstituted;
  }
  if (mySubstitutedRange != null) {
    final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
    if (psiFile != null) {
      return PsiTreeUtil.findElementOfClassAtRange(psiFile, mySubstitutedRange.getStartOffset(), mySubstitutedRange.getEndOffset(), PsiNameIdentifierOwner.class);
    }
  }
  return getVariable();
}
项目:intellij-ce-playground    文件:EclipseClasspathReader.java   
public static void collectVariables(Set<String> usedVariables, Element classpathElement, final String rootPath) {
  for (Element element : classpathElement.getChildren(EclipseXml.CLASSPATHENTRY_TAG)) {
    String path = element.getAttributeValue(EclipseXml.PATH_ATTR);
    if (path == null) {
      continue;
    }

    String kind = element.getAttributeValue(EclipseXml.KIND_ATTR);
    if (Comparing.strEqual(kind, EclipseXml.VAR_KIND)) {
      createEPathVariable(path, 0);
      String srcPath = element.getAttributeValue(EclipseXml.SOURCEPATH_ATTR);
      if (srcPath != null) {
        createEPathVariable(srcPath, srcVarStart(srcPath));
      }
    }
    else if (Comparing.strEqual(kind, EclipseXml.SRC_KIND) || Comparing.strEqual(kind, EclipseXml.OUTPUT_KIND)) {
      EclipseProjectFinder.LinkedResource linkedResource = EclipseProjectFinder.findLinkedResource(rootPath, path);
      if (linkedResource != null && linkedResource.containsPathVariable()) {
        usedVariables.add(linkedResource.getVariableName());
      }
    }
  }
}
项目:intellij-ce-playground    文件:EntryPointsManagerBase.java   
@Override
@SuppressWarnings({"HardCodedStringLiteral"})
public void loadState(Element element) {
  Element entryPointsElement = element.getChild("entry_points");
  if (entryPointsElement != null) {
    final String version = entryPointsElement.getAttributeValue(VERSION_ATTR);
    if (!Comparing.strEqual(version, VERSION)) {
      convert(entryPointsElement, myPersistentEntryPoints);
    }
    else {
      List content = entryPointsElement.getChildren();
      for (final Object aContent : content) {
        Element entryElement = (Element)aContent;
        if (ENTRY_POINT_ATTR.equals(entryElement.getName())) {
          SmartRefElementPointerImpl entryPoint = new SmartRefElementPointerImpl(entryElement);
          myPersistentEntryPoints.put(entryPoint.getFQName(), entryPoint);
        }
      }
    }
  }
  try {
    ADDITIONAL_ANNOTATIONS.readExternal(element);
  }
  catch (Throwable ignored) {
  }
}
项目:intellij-ce-playground    文件:MavenEnvironmentForm.java   
private void update() {
  final boolean override = checkBox.isSelected();
  if (Comparing.equal(isOverridden, override)) return;

  isOverridden = override;

  component.setEditable(override);
  component.setEnabled(override && checkBox.isEnabled());

  if (override) {
    if (overrideText != null) component.setText(overrideText);
  }
  else {
    if (!StringUtil.isEmptyOrSpaces(component.getText())) overrideText = component.getText();
    component.setText(pathProvider.getPath());
  }
}
项目:intellij-ce-playground    文件:TooltipController.java   
public void showTooltip(@NotNull Editor editor,
                        @NotNull Point p,
                        @NotNull TooltipRenderer tooltipRenderer,
                        boolean alignToRight,
                        @NotNull TooltipGroup group,
                        @NotNull HintHint hintInfo) {
  if (myCurrentTooltip == null || !myCurrentTooltip.isVisible()) {
    myCurrentTooltipObject = null;
  }

  if (Comparing.equal(tooltipRenderer, myCurrentTooltipObject)) {
    IdeTooltipManager.getInstance().cancelAutoHide();
    return;
  }
  if (myCurrentTooltipGroup != null && group.compareTo(myCurrentTooltipGroup) < 0) return;

  p = new Point(p);
  hideCurrentTooltip();

  LightweightHint hint = tooltipRenderer.show(editor, p, alignToRight, group, hintInfo);

  myCurrentTooltipGroup = group;
  myCurrentTooltip = hint;
  myCurrentTooltipObject = tooltipRenderer;
}
项目:intellij-ce-playground    文件:LibraryOptionsPanel.java   
public void setLibraryProvider(@Nullable FrameworkLibraryProvider provider) {
  if (provider != null && !ContainerUtil.intersects(provider.getAvailableLibraryKinds(), myLibraryDescription.getSuitableLibraryKinds())) {
    provider = null;
  }

  if (!Comparing.equal(myLibraryProvider, provider)) {
    myLibraryProvider = provider;

    if (mySettings != null) {
      if (provider != null && !myUseFromProviderRadioButton.isVisible()) {
        myUseFromProviderRadioButton.setSelected(true);
      }
      myUseFromProviderRadioButton.setVisible(provider != null);
      updateState();
    }
  }
}
项目:intellij-ce-playground    文件:PullUpDialog.java   
protected PsiClass getPreselection() {
  PsiClass preselection = RefactoringHierarchyUtil.getNearestBaseClass(myClass, false);

  final String statKey = PULL_UP_STATISTICS_KEY + myClass.getQualifiedName();
  for (StatisticsInfo info : StatisticsManager.getInstance().getAllValues(statKey)) {
    final String superClassName = info.getValue();
    PsiClass superClass = null;
    for (PsiClass aClass : mySuperClasses) {
      if (Comparing.strEqual(superClassName, aClass.getQualifiedName())) {
        superClass = aClass;
        break;
      }
    }
    if (superClass != null && StatisticsManager.getInstance().getUseCount(info) > 0) {
      preselection = superClass;
      break;
    }
  }
  return preselection;
}
项目:intellij-ce-playground    文件:UndoChangeRevertingVisitor.java   
@Override
public void visit(RenameChange c) throws StopVisitingException {
  if (shouldRevert(c)) {
    VirtualFile f = myGateway.findVirtualFile(c.getPath());
    if (f != null) {
      VirtualFile existing = f.getParent().findChild(c.getOldName());
      try {
        if (existing != null && !Comparing.equal(existing, f)) {
          existing.delete(LocalHistory.VFS_EVENT_REQUESTOR);
        }
        f.rename(LocalHistory.VFS_EVENT_REQUESTOR, c.getOldName());
      }
      catch (IOException e) {
        throw new RuntimeIOException(e);
      }
    }
  }
  checkShouldStop(c);
}
项目:intellij-ce-playground    文件:EJavadocUtil.java   
static void appendJavadocRoots(Element element,
                               ModuleRootModel model,
                               final List<String> currentRoots,
                               Library.ModifiableModel modifiableModel) {
  final Element attributes = element.getChild("attributes");
  if (attributes == null) {
    return;
  }
  for (Object o : attributes.getChildren("attribute")) {
    if (Comparing.strEqual(((Element)o).getAttributeValue("name"), JAVADOC_LOCATION)) {
      Element attribute = (Element)o;
      String javadocPath = attribute.getAttributeValue("value");
      if (!SystemInfo.isWindows) {
        javadocPath = javadocPath.replaceFirst(FILE_PROTOCOL, FILE_PROTOCOL + "/");
      }
      modifiableModel.addRoot(toIdeaJavadocUrl(model, javadocPath, currentRoots), JavadocOrderRootType.getInstance());
    }
  }
}
项目:jfrog-idea-plugin    文件:XrayServerConfig.java   
@Override
public boolean equals(Object o) {
    if (!(o instanceof XrayServerConfig)) {
        return false;
    }
    XrayServerConfig other = (XrayServerConfig) o;

    return Comparing.equal(getUrl(), other.getUrl()) &&
            Comparing.equal(getPassword(), other.getPassword()) &&
            Comparing.equal(getUsername(), other.getUsername());
}
项目:intellij-ce-playground    文件:ReuseVariableDeclarationFix.java   
@Override
public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
  if (!myVariable.isValid()) {
    return false;
  }
  final PsiVariable previousVariable = findPreviousVariable();
  return previousVariable != null &&
         Comparing.equal(previousVariable.getType(), myVariable.getType()) &&
         myVariable.getManager().isInProject(myVariable);
}
项目:intellij-ce-playground    文件:InspectionTestUtil.java   
static boolean compareFiles(Element reportedProblem, Element expectedProblem) {
  String reportedFileName = reportedProblem.getChildText("file");
  if (reportedFileName == null) {
    return true;
  }
  File reportedFile = new File(reportedFileName);

  return Comparing.equal(reportedFile.getName(), expectedProblem.getChildText("file"));
}
项目:intellij-ce-playground    文件:JpsJavaModuleExtensionImpl.java   
@Override
public void setTestOutputUrl(String testOutputUrl) {
  if (!Comparing.equal(myTestOutputUrl, testOutputUrl)) {
    myTestOutputUrl = testOutputUrl;
    fireElementChanged();
  }
}
项目:intellij-ce-playground    文件:ShowErrorDescriptionAction.java   
private static void changeState() {
  if (Comparing.strEqual(ActionManagerEx.getInstanceEx().getPrevPreformedActionId(), IdeActions.ACTION_SHOW_ERROR_DESCRIPTION)) {
    shouldShowDescription = descriptionShown;
  } else {
    shouldShowDescription = false;
    descriptionShown = true;
  }
}
项目:intellij-ce-playground    文件:TreeModelBuilder.java   
public TreeModel build(final Project project) {
  Runnable buildingRunnable = new Runnable() {
    public void run() {
      countFiles(project);
      myFileIndex.iterateContent(new ContentIterator() {
        PackageDependenciesNode lastParent = null;
        VirtualFile dir = null;
        public boolean processFile(VirtualFile fileOrDir) {
          if (!fileOrDir.isDirectory()) {
            if (lastParent != null && !Comparing.equal(dir, fileOrDir.getParent())) {
              lastParent = null;
            }
            lastParent = buildFileNode(fileOrDir, lastParent);
            dir = fileOrDir.getParent();
          } else {
            lastParent = null;
          }
          return true;
        }
      });

      for (VirtualFile root : LibraryUtil.getLibraryRoots(project)) {
        processFilesRecursively(root);
      }
    }
  };

  buildingRunnable.run();

  return new TreeModel(myRoot, myTotalFileCount, myMarkedFileCount);
}
项目:intellij-ce-playground    文件:StructureViewWrapperImpl.java   
@Override
public boolean selectCurrentElement(final FileEditor fileEditor, final VirtualFile file, final boolean requestFocus) {
  //todo [kirillk]
  // this is dirty hack since some bright minds decided to used different TreeUi every time, so selection may be followed
  // by rebuild on completely different instance of TreeUi

  Runnable runnable = new Runnable() {
    @Override
    public void run() {
      if (!Comparing.equal(myFileEditor, fileEditor)) {
        myFile = file;
        rebuild();
      }
      if (myStructureView != null) {
        myStructureView.navigateToSelectedElement(requestFocus);
      }
    }
  };

  if (isStructureViewShowing()) {
    if (myUpdateQueue.isEmpty()) {
      runnable.run();
    } else {
      myPendingSelection = runnable;
    }
  } else {
    myPendingSelection = runnable;
  }

  return true;
}
项目:intellij-ce-playground    文件:ConcurrentSoftValueIntObjectHashMap.java   
@Override
public boolean equals(Object obj) {
  V v = get();
  if (!(obj instanceof MyRef)) {
    return false;
  }
  MyRef other = (MyRef)obj;
  return other.hash == hash && key == other.getKey() && Comparing.equal(v, other.get());
}
项目:intellij-ce-playground    文件:SvnChangelistListener.java   
public void changeListRenamed(final ChangeList list, final String oldName) {
  if (Comparing.equal(list.getName(), oldName)) {
    return;
  }
  if (SvnChangeProvider.ourDefaultListName.equals(list.getName())) {
    changeListRemoved(list);
    return;
  }
  addToChangeList(list.getName(), list.getChanges());
}
项目:intellij-ce-playground    文件:JpsProjectImpl.java   
@Override
public void setName(@NotNull String name) {
  if (!Comparing.equal(myName, name)) {
    myName = name;
    fireElementChanged();
  }
}
项目:intellij-ce-playground    文件:TestNGTestMethod.java   
@Override
public boolean isConfiguredByElement(PsiElement element) {
  element = PsiTreeUtil.getParentOfType(element, PsiModifierListOwner.class, false);
  if (element instanceof PsiMethod) {
    final PsiClass aClass = ((PsiMethod) element).getContainingClass();
    final TestData data = myConfig.getPersistantData();
    return aClass != null &&
           Comparing.strEqual(data.MAIN_CLASS_NAME, JavaExecutionUtil.getRuntimeQualifiedName(aClass)) &&
           Comparing.strEqual(data.METHOD_NAME, ((PsiMethod) element).getName());
  }
  return false;
}
项目:intellij-ce-playground    文件:DiffRequestFactoryImpl.java   
@NotNull
private static String getRequestTitle(@NotNull String name1, @NotNull String path1, @Nullable String parentPath1,
                                      @NotNull String name2, @NotNull String path2, @Nullable String parentPath2,
                                      @NotNull String sep) {
  if (path1.equals(path2)) return getContentTitle(name1, path1, parentPath1);

  if (Comparing.equal(parentPath1, parentPath2)) {
    if (parentPath1 != null) {
      return name1 + sep + name2 + " (" + parentPath1 + ")";
    }
    else {
      return path1 + sep + path2;
    }
  }
  else {
    if (name1.equals(name2)) {
      if (parentPath1 != null && parentPath2 != null) {
        return name1 + " (" + parentPath1 + sep + parentPath2 + ")";
      }
      else {
        return path1 + sep + path2;
      }
    }
    else {
      if (parentPath1 != null && parentPath2 != null) {
        return name1 + sep + name2 + " (" + parentPath1 + sep + parentPath2 + ")";
      }
      else {
        return path1 + sep + path2;
      }
    }
  }
}
项目:intellij-ce-playground    文件:SmartElementDescriptor.java   
@Override
public boolean update() {
  PsiElement element = mySmartPointer.getElement();
  if (element == null) return true;
  int flags = Iconable.ICON_FLAG_VISIBILITY;
  if (isMarkReadOnly()){
    flags |= Iconable.ICON_FLAG_READ_STATUS;
  }
  Icon icon = null;
  try {
    icon = element.getIcon(flags);
  }
  catch (IndexNotReadyException ignored) {
  }
  Color color = null;

  if (isMarkModified() ){
    VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
    if (virtualFile != null) {
      color = FileStatusManager.getInstance(myProject).getStatus(virtualFile).getColor();
    }
  }
  if (CopyPasteManager.getInstance().isCutElement(element)) {
    color = CopyPasteManager.CUT_COLOR;
  }

  boolean changes = !Comparing.equal(icon, getIcon()) || !Comparing.equal(color, myColor);
  setIcon(icon);
  myColor = color;
  return changes;
}
项目:intellij-ce-playground    文件:ShelvedChange.java   
public ShelvedChange(final String patchPath, final String beforePath, final String afterPath, final FileStatus fileStatus) {
  myPatchPath = patchPath;
  myBeforePath = beforePath;
  // optimisation: memory
  myAfterPath = Comparing.equal(beforePath, afterPath) ? beforePath : afterPath;
  myFileStatus = fileStatus;
  myIsConflicting = new AtomicReference<Boolean>();
}
项目:intellij-ce-playground    文件:AndroidLayoutPreviewToolWindowForm.java   
public boolean setFile(@Nullable PsiFile file) {
  final boolean fileChanged = !Comparing.equal(myFile, file);
  myFile = file;

  if (fileChanged) {
    if (myConfiguration != null) {
      myConfiguration.removeListener(this);
      myConfiguration = null;
    }

    if (myFacet != null) {
      myFacet.getResourceFolderManager().removeListener(this);
    }

    if (file != null) {
      final VirtualFile virtualFile = file.getVirtualFile();
      if (virtualFile != null) {
        myFacet = AndroidFacet.getInstance(file);
        if (myFacet != null) {
          myFacet.getResourceFolderManager().removeListener(this);
          myFacet.getResourceFolderManager().addListener(this);
          ConfigurationManager manager = myFacet.getConfigurationManager();
          myConfiguration = manager.getConfiguration(virtualFile);
          myConfiguration.removeListener(this);
          myConfiguration.addListener(this);
        }
      }
    }
  }

  return true;
}
项目:intellij-ce-playground    文件:VFSForAnnotationListener.java   
@Override
public void contentsChanged(@NotNull VirtualFileEvent event) {
  if (! Comparing.equal(myFile, event.getFile())) return;
  if (! event.isFromRefresh()) return;
  if (! myFile.isWritable()) {
    myFileAnnotation.close();
  }
}
项目:intellij-ce-playground    文件:ControlFlowAnalyzer.java   
private void startElement(@NotNull PsiElement element) {
  for (PsiElement child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
    ProgressManager.checkCanceled();
    if (child instanceof PsiErrorElement &&
        !Comparing.strEqual(((PsiErrorElement)child).getErrorDescription(), JavaErrorMessages.message("expected.semicolon"))) {
      // do not perform control flow analysis for incomplete code
      throw new AnalysisCanceledSoftException(element);
    }
  }
  ProgressManager.checkCanceled();
  myCurrentFlow.startElement(element);

  generateUncheckedExceptionJumpsIfNeeded(element, true);
}