Java Code Examples for com.intellij.openapi.util.text.StringUtil#equals()

The following examples show how to use com.intellij.openapi.util.text.StringUtil#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XDebuggerEditorLinePainter.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void produceChangedParts(List<LineExtensionInfo> result) {
  if (isArray(actual) && isArray(old)) {
    List<String> actualParts = getArrayParts(actual);
    List<String> oldParts = getArrayParts(old);
    result.add(new LineExtensionInfo("{", getNormalAttributes()));
    for (int i = 0; i < actualParts.size(); i++) {
      if (i < oldParts.size() && StringUtil.equals(actualParts.get(i), oldParts.get(i))) {
        result.add(new LineExtensionInfo(actualParts.get(i), getNormalAttributes()));
      }
      else {
        result.add(new LineExtensionInfo(actualParts.get(i), getChangedAttributes()));
      }
      if (i != actualParts.size() - 1) {
        result.add(new LineExtensionInfo(", ", getNormalAttributes()));
      }
    }
    result.add(new LineExtensionInfo("}", getNormalAttributes()));
    return;
  }

  result.add(new LineExtensionInfo(actual, getChangedAttributes()));
}
 
Example 2
Source File: PresentationModeProgressPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void updateImpl() {
  Color color = getTextForeground();
  myText.setForeground(color);
  myText2.setForeground(color);
  myProgressBar.setForeground(color);

  if (!StringUtil.equals(myText.getText(), myProgress.getText())) {
    myText.setText(myProgress.getText());
  }
  if (!StringUtil.equals(myText2.getText(), myProgress.getText2())) {
    myText2.setText(myProgress.getText2());
  }
  if ((myProgress.isIndeterminate() || myProgress.getFraction() == 0.0) != myProgressBar.isIndeterminate()) {
    myProgressBar.setIndeterminate(myProgress.isIndeterminate() || myProgress.getFraction() == 0.0);
    myProgressBar.revalidate();
  }

  if (!myProgressBar.isIndeterminate()) {
    myProgressBar.setValue((int)(myProgress.getFraction() * 99) + 1);
  }

  myEastButtons.forEach(b -> b.updateAction.run());
}
 
Example 3
Source File: ValidationInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (!(o instanceof ValidationInfo)) return false;

  ValidationInfo that = (ValidationInfo)o;
  return StringUtil.equals(this.message, that.message) && this.component == that.component && this.okEnabled == that.okEnabled && this.warning == that.warning;
}
 
Example 4
Source File: CrucibleConfigurable.java    From Crucible4IDEA with MIT License 5 votes vote down vote up
@Override
public boolean isModified() {
  if (isPasswordModified()) {
    final String password = myCrucibleSettings.getPassword();
    if (!StringUtil.equals(password, new String(myPasswordField.getPassword()))) {
      return true;
    }
  }
  return !StringUtil.equals(myCrucibleSettings.SERVER_URL, myServerField.getText()) ||
         !StringUtil.equals(myCrucibleSettings.USERNAME, myUsernameField.getText());
}
 
Example 5
Source File: ArrangementSectionRule.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }

  final ArrangementSectionRule section = (ArrangementSectionRule)o;
  if (!StringUtil.equals(myStartComment, section.myStartComment) ||
      !StringUtil.equals(myEndComment, section.myEndComment) ||
      myMatchRules.size() != section.getMatchRules().size()) {
    return false;
  }

  final List<StdArrangementMatchRule> matchRules = section.getMatchRules();
  for (int i = 0; i < myMatchRules.size(); i++) {
    final StdArrangementMatchRule rule1 = myMatchRules.get(i);
    final StdArrangementMatchRule rule2 = matchRules.get(i);
    if (!rule1.equals(rule2)) {
      return false;
    }
  }

  return true;
}
 
Example 6
Source File: FlutterFramesMonitor.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void onVmServiceReceived(String streamId, Event event) {
  if (StringUtil.equals(streamId, VmService.EXTENSION_STREAM_ID)) {
    if (StringUtil.equals("Flutter.Frame", event.getExtensionKind())) {
      handleFlutterFrame(event);
    }
  }
}
 
Example 7
Source File: ServerFingerprintDataPart.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
    if (o == null || ! getClass().equals(o.getClass())) {
        return false;
    }
    ServerFingerprintDataPart that = (ServerFingerprintDataPart) o;
    return StringUtil.equals(that.getServerFingerprint(), getServerFingerprint());
}
 
Example 8
Source File: ToolWindowTracker.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void update() {
  final String newWindow = findWindowId();

  if (!StringUtil.equals(newWindow, currentWindowId)) {
    currentWindowId = newWindow;
    myAnalytics.sendScreenView(currentWindowId);
  }
}
 
Example 9
Source File: ExternalSystemNotificationManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private Content findContent(@Nonnull Pair<NotificationSource, ProjectSystemId> contentIdPair, @Nonnull String contentDisplayName) {
  Content targetContent = null;
  final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
  for (Content content : messageView.getContentManager().getContents()) {
    if (contentIdPair.equals(content.getUserData(CONTENT_ID_KEY))
        && StringUtil.equals(content.getDisplayName(), contentDisplayName) && !content.isPinned()) {
      targetContent = content;
    }
  }
  return targetContent;
}
 
Example 10
Source File: FileStructurePopup.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean shouldBeShowing(Object value) {
  if (!isShouldNarrowDown()) return true;

  String filter = getSearchPrefix();
  if (!StringUtil.equals(myLastFilter, filter)) {
    myVisibleParents.clear();
    myLastFilter = filter;
  }
  if (filter != null) {
    if (myVisibleParents.contains(value)) {
      return true;
    }

    String text = getSpeedSearchText(value);
    if (text == null) return false;

    if (matches(filter, text)) {
      Object o = value;
      while (o instanceof FilteringTreeStructure.FilteringNode && (o = ((FilteringTreeStructure.FilteringNode)o).getParent()) != null) {
        myVisibleParents.add(o);
      }
      return true;
    }
    else {
      return false;
    }
  }
  return true;
}
 
Example 11
Source File: VagrantBasedCredentialsHolder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;

  VagrantBasedCredentialsHolder holder = (VagrantBasedCredentialsHolder)o;

  if (!myVagrantFolder.equals(holder.myVagrantFolder)) return false;

  if (StringUtil.isNotEmpty(myMachineName) || StringUtil.isNotEmpty(holder.myMachineName)) {
    return StringUtil.equals(myMachineName, holder.myMachineName);
  }

  return true;
}
 
Example 12
Source File: RecentLocationsRenderer.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
private static SimpleColoredComponent createTitleTextComponent(@Nonnull Project project,
                                                               @Nonnull JList<? extends RecentLocationItem> list,
                                                               @Nonnull SpeedSearch speedSearch,
                                                               @Nonnull IdeDocumentHistoryImpl.PlaceInfo placeInfo,
                                                               @Nonnull EditorColorsScheme colorsScheme,
                                                               @Nullable String breadcrumbText,
                                                               boolean selected) {
  SimpleColoredComponent titleTextComponent = new SimpleColoredComponent();

  String fileName = placeInfo.getFile().getName();
  String text = fileName;
  titleTextComponent.append(fileName, createFileNameTextAttributes(colorsScheme, selected));

  if (StringUtil.isNotEmpty(breadcrumbText) && !StringUtil.equals(breadcrumbText, fileName)) {
    text += " " + breadcrumbText;
    titleTextComponent.append("  ");
    titleTextComponent.append(breadcrumbText, createBreadcrumbsTextAttributes(colorsScheme, selected));
  }

  Image icon = fetchIcon(project, placeInfo);

  if (icon != null) {
    titleTextComponent.setIcon(icon);
    titleTextComponent.setIconTextGap(4);
  }

  titleTextComponent.setBorder(JBUI.Borders.empty());

  if (!SystemInfo.isWindows) {
    titleTextComponent.setFont(FontUtil.minusOne(UIUtil.getLabelFont()));
  }

  if (speedSearch.matchingFragments(text) != null) {
    SpeedSearchUtil.applySpeedSearchHighlighting(list, titleTextComponent, false, selected);
  }

  long timeStamp = placeInfo.getTimeStamp();
  if (UISettings.getInstance().getShowInplaceComments() && Registry.is("show.last.visited.timestamps") && timeStamp != -1) {
    titleTextComponent.append(" " + DateFormatUtil.formatPrettyDateTime(timeStamp), SimpleTextAttributes.GRAYED_SMALL_ATTRIBUTES);
  }

  return titleTextComponent;
}
 
Example 13
Source File: DvcsBranchUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean repoAndSourceAreEqual(@javax.annotation.Nullable Repository repository,
                                             @Nonnull String sourceBranch,
                                             @Nonnull DvcsBranchInfo targetInfo) {
  return getPathFor(repository).equals(targetInfo.repoPath) && StringUtil.equals(targetInfo.sourceName, sourceBranch);
}
 
Example 14
Source File: PantsTestRunConfigurationProducer.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
private boolean compareSettings(ExternalSystemTaskExecutionSettings settings1, ExternalSystemTaskExecutionSettings settings2) {
  return settings1.equals(settings2) &&
         StringUtil.equalsIgnoreWhitespaces(settings1.getScriptParameters(), settings2.getScriptParameters()) &&
         StringUtil.equals(settings1.getExecutionName(), settings2.getExecutionName());
}
 
Example 15
Source File: PantsTargetAddress.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public boolean isMainTarget() {
  return StringUtil.equals(PathUtil.getFileName(getPath()), getTargetName());
}
 
Example 16
Source File: ChangesUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean equals(@Nonnull FilePath path1, @Nonnull FilePath path2) {
  return StringUtil.equals(path1.getPath(), path2.getPath());
}
 
Example 17
Source File: PreviewView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static boolean isAttributeElidable(String name) {
  return StringUtil.equals("text", name) || StringUtil.equals("icon", name);
}
 
Example 18
Source File: TargetAddressInfo.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public boolean isJarLibrary() {
  return StringUtil.equals("jar_library", getInternalPantsTargetType());
}
 
Example 19
Source File: PhpStanValidatorRemoteConfigurationProvider.java    From idea-php-generics-plugin with MIT License 4 votes vote down vote up
public boolean canLoad(@NotNull String tagName) {
    return StringUtil.equals(tagName, "phpstan_by_interpreter");
}
 
Example 20
Source File: PsalmValidatorRemoteConfigurationProvider.java    From idea-php-generics-plugin with MIT License 4 votes vote down vote up
public boolean canLoad(@NotNull String tagName) {
    return StringUtil.equals(tagName, "psalm_by_interpreter");
}