Java Code Examples for com.intellij.openapi.util.text.StringUtilRt

The following are top voted examples for showing how to use com.intellij.openapi.util.text.StringUtilRt. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: intellij-ce-playground   File: Comparing.java   View source code 6 votes vote down vote up
public static boolean equal(@Nullable CharSequence s1, @Nullable CharSequence s2, boolean caseSensitive) {
  if (s1 == s2) return true;
  if (s1 == null || s2 == null) return false;

  // Algorithm from String.regionMatches()

  if (s1.length() != s2.length()) return false;
  int to = 0;
  int po = 0;
  int len = s1.length();

  while (len-- > 0) {
    char c1 = s1.charAt(to++);
    char c2 = s2.charAt(po++);
    if (c1 == c2) {
      continue;
    }
    if (!caseSensitive && StringUtilRt.charsEqualIgnoreCase(c1, c2)) continue;
    return false;
  }

  return true;
}
 
Example 2
Project: intellij-ce-playground   File: SslSocketFactory.java   View source code 6 votes vote down vote up
public SslSocketFactory() throws GeneralSecurityException, IOException {
  super();
  SSLContext ctx = SSLContext.getInstance("TLS");
  TrustManager[] tms;
  KeyManager[] kms;
  try {
    String caCertPath = System.getProperty(SSL_CA_CERT_PATH);
    String clientCertPath = System.getProperty(SSL_CLIENT_CERT_PATH);
    String clientKeyPath = System.getProperty(SSL_CLIENT_KEY_PATH);
    boolean trustEverybody = StringUtilRt.parseBoolean(System.getProperty(SSL_TRUST_EVERYBODY), false);

    tms = trustEverybody ? new TrustManager[]{new MyTrustEverybodyManager()} :
          caCertPath == null ? new TrustManager[]{} : new TrustManager[]{new MyTrustManager(caCertPath)};
    kms = clientCertPath != null && clientKeyPath != null
          ? new KeyManager[]{new MyKeyManager(clientCertPath, clientKeyPath)}
          : new KeyManager[]{};
  }
  catch (Exception e) {
    throw new RuntimeException(e);
  }

  ctx.init(kms, tms, null);
  myFactory = ctx.getSocketFactory();
}
 
Example 3
Project: intellij-ce-playground   File: DefaultHtmlDoctypeInitialConfigurator.java   View source code 6 votes vote down vote up
public DefaultHtmlDoctypeInitialConfigurator(ProjectManager projectManager,
                                             PropertiesComponent propertiesComponent) {
  if (!propertiesComponent.getBoolean("DefaultHtmlDoctype.MigrateToHtml5")) {
    propertiesComponent.setValue("DefaultHtmlDoctype.MigrateToHtml5", true);
    ExternalResourceManagerEx.getInstanceEx()
      .setDefaultHtmlDoctype(Html5SchemaProvider.getHtml5SchemaLocation(), projectManager.getDefaultProject());
  }
  // sometimes VFS fails to pick up updated schema contents and we need to force refresh
  if (StringUtilRt.parseInt(propertiesComponent.getValue("DefaultHtmlDoctype.Refreshed"), 0) < VERSION) {
    propertiesComponent.setValue("DefaultHtmlDoctype.Refreshed", Integer.toString(VERSION));
    final String schemaUrl = VfsUtilCore.pathToUrl(Html5SchemaProvider.getHtml5SchemaLocation());
    final VirtualFile schemaFile = VirtualFileManager.getInstance().findFileByUrl(schemaUrl);
    if (schemaFile != null) {
      schemaFile.getParent().refresh(false, true);
    }
  }
}
 
Example 4
Project: intellij-ce-playground   File: MapEntryOrKeyValueHintProcessor.java   View source code 6 votes vote down vote up
private static int extractArgNum(String[] options) {


    for (String value : options) {
      Integer parsedValue = parseArgNum(value);
      if (parsedValue != null) {
        return parsedValue;
      }
    }

    if (options.length == 1) {
      return StringUtilRt.parseInt(options[0], 0);
    }

    return 0;
  }
 
Example 5
Project: Buck-IntelliJ-Plugin   File: BuckFileTypeFactory.java   View source code 6 votes vote down vote up
@Override
public void createFileTypes(FileTypeConsumer fileTypeConsumer) {
  fileTypeConsumer.consume(
      BuckFileType.INSTANCE, new FileNameMatcherEx() {
        @Override
        public String getPresentableString() {
          return BuckFileUtil.getBuildFileName();
        }

        @Override
        public boolean acceptsCharSequence(CharSequence fileName) {
          String buildFileName = BuckFileUtil.getBuildFileName();
          return StringUtilRt.endsWithIgnoreCase(fileName, buildFileName) ||
            Comparing.equal(fileName, buildFileName, true);
        }
      });
}
 
Example 6
Project: tools-idea   File: Comparing.java   View source code 6 votes vote down vote up
public static boolean equal(@Nullable CharSequence s1, @Nullable CharSequence s2, boolean caseSensitive) {
  if (s1 == s2) return true;
  if (s1 == null || s2 == null) return false;

  // Algorithm from String.regionMatches()

  if (s1.length() != s2.length()) return false;
  int to = 0;
  int po = 0;
  int len = s1.length();

  while (len-- > 0) {
    char c1 = s1.charAt(to++);
    char c2 = s2.charAt(po++);
    if (c1 == c2) {
      continue;
    }
    if (!caseSensitive && StringUtilRt.charsEqualIgnoreCase(c1, c2)) continue;
    return false;
  }

  return true;
}
 
Example 7
Project: jediterm   File: Comparing.java   View source code 6 votes vote down vote up
public static boolean equal(@Nullable CharSequence s1, @Nullable CharSequence s2, boolean caseSensitive) {
  if (s1 == s2) return true;
  if (s1 == null || s2 == null) return false;

  // Algorithm from String.regionMatches()

  if (s1.length() != s2.length()) return false;
  int to = 0;
  int po = 0;
  int len = s1.length();

  while (len-- > 0) {
    char c1 = s1.charAt(to++);
    char c2 = s2.charAt(po++);
    if (c1 == c2) {
      continue;
    }
    if (!caseSensitive && StringUtilRt.charsEqualIgnoreCase(c1, c2)) continue;
    return false;
  }

  return true;
}
 
Example 8
Project: buck   File: BuckFileTypeFactory.java   View source code 6 votes vote down vote up
@Override
public void createFileTypes(FileTypeConsumer fileTypeConsumer) {
  fileTypeConsumer.consume(
      BuckFileType.INSTANCE,
      new FileNameMatcherEx() {
        @Override
        public String getPresentableString() {
          return BuckFileUtil.getBuildFileName();
        }

        @Override
        public boolean acceptsCharSequence(CharSequence fileName) {
          String buildFileName = BuckFileUtil.getBuildFileName();
          return StringUtilRt.endsWithIgnoreCase(fileName, buildFileName)
              || Comparing.equal(fileName, buildFileName, true);
        }
      });
}
 
Example 9
Project: consulo   File: Comparing.java   View source code 6 votes vote down vote up
public static boolean equal(@Nullable CharSequence s1, @Nullable CharSequence s2, boolean caseSensitive) {
  if (s1 == s2) return true;
  if (s1 == null || s2 == null) return false;

  // Algorithm from String.regionMatches()

  if (s1.length() != s2.length()) return false;
  int to = 0;
  int po = 0;
  int len = s1.length();

  while (len-- > 0) {
    char c1 = s1.charAt(to++);
    char c2 = s2.charAt(po++);
    if (c1 == c2) {
      continue;
    }
    if (!caseSensitive && StringUtilRt.charsEqualIgnoreCase(c1, c2)) continue;
    return false;
  }

  return true;
}
 
Example 10
Project: intellij-ce-playground   File: JpsArtifactPathUtil.java   View source code 5 votes vote down vote up
public static String appendToPath(@NotNull String basePath, @NotNull String relativePath) {
  final boolean endsWithSlash = StringUtilRt.endsWithChar(basePath, '/') || StringUtilRt.endsWithChar(basePath, '\\');
  final boolean startsWithSlash = StringUtil.startsWithChar(relativePath, '/') || StringUtil.startsWithChar(relativePath, '\\');
  String tail;
  if (endsWithSlash && startsWithSlash) {
    tail = trimForwardSlashes(relativePath);
  }
  else if (!endsWithSlash && !startsWithSlash && basePath.length() > 0 && relativePath.length() > 0) {
    tail = "/" + relativePath;
  }
  else {
    tail = relativePath;
  }
  return basePath + tail;
}
 
Example 11
Project: intellij-ce-playground   File: GenericDebuggerParametersRunnerConfigurable.java   View source code 5 votes vote down vote up
private void setPort(String port) {
  if (isSocket()) {
    myPortField.setText(String.valueOf(StringUtilRt.parseInt(port, 0)));
  }
  else {
    myAddressField.setText(port);
  }
}
 
Example 12
Project: intellij-ce-playground   File: ChainCompletionStringUtil.java   View source code 5 votes vote down vote up
private static void fillPrimitivesNames(final PsiPrimitiveType type) {
  PRIMITIVES_NAMES.add(type.getBoxedTypeName());
  PRIMITIVES_NAMES.add(type.getCanonicalText());

  PRIMITIVES_SHORT_NAMES.add(StringUtilRt.getShortName(type.getBoxedTypeName()));
  PRIMITIVES_SHORT_NAMES.add(type.getCanonicalText());
}
 
Example 13
Project: intellij-ce-playground   File: AbstractExternalFilter.java   View source code 5 votes vote down vote up
public CharSequence refFilter(final String root, @NotNull CharSequence read) {
  CharSequence toMatch = StringUtilRt.toUpperCase(read);
  StringBuilder ready = new StringBuilder();
  int prev = 0;
  Matcher matcher = mySelector.matcher(toMatch);

  while (matcher.find()) {
    CharSequence before = read.subSequence(prev, matcher.start(1) - 1);     // Before reference
    final CharSequence href = read.subSequence(matcher.start(1), matcher.end(1)); // The URL
    prev = matcher.end(1) + 1;
    ready.append(before);
    ready.append("\"");
    ready.append(ApplicationManager.getApplication().runReadAction(
      new Computable<String>() {
        @Override
        public String compute() {
          return convertReference(root, href.toString());
        }
      }
    ));
    ready.append("\"");
  }

  ready.append(read, prev, read.length());

  return ready;
}
 
Example 14
Project: intellij-ce-playground   File: GitAskPassApp.java   View source code 5 votes vote down vote up
@NotNull
private static Pair<Boolean, String> parseArguments(@NotNull String arg) {
  boolean username = StringUtilRt.startsWithIgnoreCase(arg, "username");
  String url;
  String[] split = arg.split(" ");
  if (split.length > 2) {
    url = parseUrl(split[2]);
  }
  else {
    url = ""; // XML RPC doesn't like nulls
  }
  return Pair.create(username, url);
}
 
Example 15
Project: intellij-ce-playground   File: MapEntryOrKeyValueHintProcessor.java   View source code 5 votes vote down vote up
private static boolean extractIndex(String[] options) {
  for (String value : options) {
    Boolean parsedValue = parseIndex(value);
    if (parsedValue != null) {
      return parsedValue;
    }
  }

  if (options.length == 1) {
    return StringUtilRt.parseBoolean(options[0], false);
  }

  return false;
}
 
Example 16
Project: intellij-ce-playground   File: MapEntryOrKeyValueHintProcessor.java   View source code 5 votes vote down vote up
private static Boolean parseIndex(String value) {
  Couple<String> pair = parseValue(value);
  if (pair == null) return null;

  Boolean parsedValue = StringUtilRt.parseBoolean(pair.getSecond(), false);
  if ("index".equals(pair.getFirst())) {
    return parsedValue;
  }

  return null;
}
 
Example 17
Project: intellij-ce-playground   File: MapEntryOrKeyValueHintProcessor.java   View source code 5 votes vote down vote up
private static Integer parseArgNum(String value) {
  Couple<String> pair = parseValue(value);
  if (pair == null) return null;

  Integer parsedValue = StringUtilRt.parseInt(pair.getSecond(), 0);
  if ("argNum".equals(pair.getFirst())) {
    return parsedValue;
  }

  return null;
}
 
Example 18
Project: tools-idea   File: JpsArtifactPathUtil.java   View source code 5 votes vote down vote up
public static String appendToPath(@NotNull String basePath, @NotNull String relativePath) {
  final boolean endsWithSlash = StringUtilRt.endsWithChar(basePath, '/') || StringUtilRt.endsWithChar(basePath, '\\');
  final boolean startsWithSlash = StringUtil.startsWithChar(relativePath, '/') || StringUtil.startsWithChar(relativePath, '\\');
  String tail;
  if (endsWithSlash && startsWithSlash) {
    tail = trimForwardSlashes(relativePath);
  }
  else if (!endsWithSlash && !startsWithSlash && basePath.length() > 0 && relativePath.length() > 0) {
    tail = "/" + relativePath;
  }
  else {
    tail = relativePath;
  }
  return basePath + tail;
}
 
Example 19
Project: tools-idea   File: GitAskPassApp.java   View source code 5 votes vote down vote up
@NotNull
private static Pair<Boolean, String> parseArguments(@NotNull String arg) {
  boolean username = StringUtilRt.startsWithIgnoreCase(arg, "username");
  String url;
  String[] split = arg.split(" ");
  if (split.length > 2) {
    url = parseUrl(split[2]);
  }
  else {
    url = ""; // XML RPC doesn't like nulls
  }
  return Pair.create(username, url);
}
 
Example 20
Project: consulo   File: FormBuilder.java   View source code 5 votes vote down vote up
@Nonnull
@RequiredUIAccess
public FormBuilder addLabeled(@Nonnull final String labelText, @Nonnull Component component) {
  String newLabelText = labelText;
  if (!StringUtilRt.endsWithChar(newLabelText, ':')) {
    newLabelText += ": ";
  }

  myLayout.add(Label.create(newLabelText), TableLayout.cell(myLineCount, 0));
  myLayout.add(component, TableLayout.cell(myLineCount, 1).fill());

  myLineCount++;
  return this;
}
 
Example 21
Project: consulo   File: LabeledComponents.java   View source code 5 votes vote down vote up
@RequiredUIAccess
public static Component left(@Nonnull String text, @Nonnull Component component) {
  if (!StringUtilRt.endsWithChar(text, ':')) {
    text += ": ";
  }

  HorizontalLayout horizontal = HorizontalLayout.create();
  horizontal.add(Label.create(text));
  horizontal.add(component);
  return horizontal;
}
 
Example 22
Project: consulo   File: LabeledComponents.java   View source code 5 votes vote down vote up
@RequiredUIAccess
public static Component leftFilled(@Nonnull String text, @Nonnull Component component) {
  if (!StringUtilRt.endsWithChar(text, ':')) {
    text += ": ";
  }

  DockLayout dock = DockLayout.create();
  dock.left(Label.create(text));
  dock.center(component);
  return dock;
}
 
Example 23
Project: consulo   File: SchemesManagerImpl.java   View source code 5 votes vote down vote up
private boolean canRead(@Nonnull File file) {
  if (file.isDirectory()) {
    return false;
  }

  // migrate from custom extension to default
  if (myUpdateExtension && StringUtilRt.endsWithIgnoreCase(file.getName(), mySchemeExtension)) {
    return true;
  }
  else {
    return StringUtilRt.endsWithIgnoreCase(file.getName(), DirectoryStorageData.DEFAULT_EXT);
  }
}
 
Example 24
Project: consulo   File: SchemesManagerImpl.java   View source code 5 votes vote down vote up
@Nonnull
private String createFileName(@Nonnull CharSequence fileName) {
  if (StringUtilRt.endsWithIgnoreCase(fileName, mySchemeExtension)) {
    fileName = fileName.subSequence(0, fileName.length() - mySchemeExtension.length());
  }
  else if (StringUtilRt.endsWithIgnoreCase(fileName, DirectoryStorageData.DEFAULT_EXT)) {
    fileName = fileName.subSequence(0, fileName.length() - DirectoryStorageData.DEFAULT_EXT.length());
  }
  return fileName.toString();
}
 
Example 25
Project: consulo   File: AbstractExternalFilter.java   View source code 5 votes vote down vote up
public CharSequence refFilter(final String root, @Nonnull CharSequence read) {
  CharSequence toMatch = StringUtilRt.toUpperCase(read);
  StringBuilder ready = new StringBuilder();
  int prev = 0;
  Matcher matcher = mySelector.matcher(toMatch);

  while (matcher.find()) {
    CharSequence before = read.subSequence(prev, matcher.start(1) - 1);     // Before reference
    final CharSequence href = read.subSequence(matcher.start(1), matcher.end(1)); // The URL
    prev = matcher.end(1) + 1;
    ready.append(before);
    ready.append("\"");
    ready.append(ApplicationManager.getApplication().runReadAction(
            new Computable<String>() {
              @Override
              public String compute() {
                return convertReference(root, href.toString());
              }
            }
    ));
    ready.append("\"");
  }

  ready.append(read, prev, read.length());

  return ready;
}
 
Example 26
Project: intellij-ce-playground   File: ExtensionFileNameMatcher.java   View source code 4 votes vote down vote up
@Override
public boolean acceptsCharSequence(@NonNls @NotNull CharSequence fileName) {
  return StringUtilRt.endsWithIgnoreCase(fileName, myDotExtension);
}
 
Example 27
Project: intellij-ce-playground   File: ChainCompletionStringUtil.java   View source code 4 votes vote down vote up
private static void fillNonPrimitiveNames(final String typeAsString) {
  PRIMITIVES_NAMES.add(typeAsString);
  PRIMITIVES_SHORT_NAMES.add(StringUtilRt.getShortName(typeAsString));
}
 
Example 28
Project: intellij-ce-playground   File: FileUtilRt.java   View source code 4 votes vote down vote up
@NotNull
public static CharSequence getExtension(@NotNull CharSequence fileName) {
  int index = StringUtilRt.lastIndexOf(fileName, '.', 0, fileName.length());
  if (index < 0) return "";
  return fileName.subSequence(index + 1, fileName.length());
}
 
Example 29
Project: intellij-ce-playground   File: FileUtilRt.java   View source code 4 votes vote down vote up
private static String ensureEnds(@NotNull String s, final char endsWith) {
  return StringUtilRt.endsWithChar(s, endsWith) ? s : s + endsWith;
}
 
Example 30
Project: intellij-ce-playground   File: FileUtilRt.java   View source code 4 votes vote down vote up
@NotNull
public static String loadFile(@NotNull File file, @Nullable @NonNls String encoding, boolean convertLineSeparators) throws IOException {
  final String s = new String(loadFileText(file, encoding));
  return convertLineSeparators ? StringUtilRt.convertLineSeparators(s) : s;
}
 
Example 31
Project: intellij-ce-playground   File: FileUtilRt.java   View source code 4 votes vote down vote up
@Override
public boolean charsEqual(char ch1, char ch2) {
  return StringUtilRt.charsEqualIgnoreCase(ch1, ch2);
}
 
Example 32
Project: intellij-ce-playground   File: DirectoryStorageUtil.java   View source code 4 votes vote down vote up
@NotNull
public static Map<String, Element> loadFrom(@Nullable VirtualFile dir, @Nullable TrackingPathMacroSubstitutor pathMacroSubstitutor) {
  if (dir == null || !dir.exists()) {
    return Collections.emptyMap();
  }

  StringInterner interner = new StringInterner();
  Map<String, Element> fileToState = new THashMap<String, Element>();
  for (VirtualFile file : dir.getChildren()) {
    // ignore system files like .DS_Store on Mac
    if (!StringUtilRt.endsWithIgnoreCase(file.getNameSequence(), FileStorageCoreUtil.DEFAULT_EXT)) {
      continue;
    }

    try {
      if (file.getLength() == 0) {
        LOG.warn("Ignore empty file " + file.getPath());
        continue;
      }

      Element element = JDOMUtil.load(file.getInputStream());
      String componentName = FileStorageCoreUtil.getComponentNameIfValid(element);
      if (componentName == null) {
        continue;
      }

      if (!element.getName().equals(FileStorageCoreUtil.COMPONENT)) {
        LOG.error("Incorrect root tag name (" + element.getName() + ") in " + file.getPresentableUrl());
        continue;
      }

      List<Element> elementChildren = element.getChildren();
      if (elementChildren.isEmpty()) {
        continue;
      }

      Element state = (Element)elementChildren.get(0).detach();
      if (JDOMUtil.isEmpty(state)) {
        continue;
      }

      JDOMUtil.internElement(state, interner);
      if (pathMacroSubstitutor != null) {
        pathMacroSubstitutor.expandPaths(state);
        pathMacroSubstitutor.addUnknownMacros(componentName, PathMacrosCollector.getMacroNames(state));
      }

      fileToState.put(file.getName(), state);
    }
    catch (Throwable e) {
      LOG.warn("Unable to load state", e);
    }
  }
  return fileToState;
}
 
Example 33
Project: intellij-ce-playground   File: PropertiesComponent.java   View source code 4 votes vote down vote up
public int getInt(@NotNull String name, int defaultValue) {
  return StringUtilRt.parseInt(getValue(name), defaultValue);
}
 
Example 34
Project: intellij-ce-playground   File: RestService.java   View source code 4 votes vote down vote up
protected static int getIntParameter(@NotNull String name, @NotNull QueryStringDecoder urlDecoder) {
  return StringUtilRt.parseInt(StringUtil.nullize(ContainerUtil.getLastItem(urlDecoder.parameters().get(name)), true), -1);
}
 
Example 35
Project: intellij-ce-playground   File: OpenFileHttpService.java   View source code 4 votes vote down vote up
@Nullable
@Override
public String execute(@NotNull QueryStringDecoder urlDecoder, @NotNull FullHttpRequest request, @NotNull ChannelHandlerContext context) throws IOException {
  final boolean keepAlive = HttpUtil.isKeepAlive(request);
  final Channel channel = context.channel();

  OpenFileRequest apiRequest;
  if (request.method() == HttpMethod.POST) {
    apiRequest = gson.getValue().fromJson(createJsonReader(request), OpenFileRequest.class);
  }
  else {
    apiRequest = new OpenFileRequest();
    apiRequest.file = StringUtil.nullize(getStringParameter("file", urlDecoder), true);
    apiRequest.line = getIntParameter("line", urlDecoder);
    apiRequest.column = getIntParameter("column", urlDecoder);
    apiRequest.focused = getBooleanParameter("focused", urlDecoder, true);
  }

  int prefixLength = 1 + PREFIX.length() + 1 + getServiceName().length() + 1;
  String path = urlDecoder.path();
  if (path.length() > prefixLength) {
    Matcher matcher = LINE_AND_COLUMN.matcher(path).region(prefixLength, path.length());
    LOG.assertTrue(matcher.matches());
    if (apiRequest.file == null) {
      apiRequest.file = matcher.group(1).trim();
    }
    if (apiRequest.line == -1) {
      apiRequest.line = StringUtilRt.parseInt(matcher.group(2), 1);
    }
    if (apiRequest.column == -1) {
      apiRequest.column = StringUtilRt.parseInt(matcher.group(3), 1);
    }
  }

  if (apiRequest.file == null) {
    sendStatus(HttpResponseStatus.BAD_REQUEST, keepAlive, channel);
    return null;
  }

  openFile(apiRequest)
    .done(new Consumer<Void>() {
      @Override
      public void consume(Void aVoid) {
        sendStatus(HttpResponseStatus.OK, keepAlive, channel);
      }
    })
    .rejected(new Consumer<Throwable>() {
      @Override
      public void consume(Throwable throwable) {
        if (throwable == NOT_FOUND) {
          sendStatus(HttpResponseStatus.NOT_FOUND, keepAlive, channel);
        }
        else {
          // todo send error
          sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR, keepAlive, channel);
          LOG.error(throwable);
        }
      }
    });
  return null;
}
 
Example 36
Project: intellij-ce-playground   File: FileTypeManagerImpl.java   View source code 4 votes vote down vote up
@Override
public void loadState(Element state) {
  int savedVersion = StringUtilRt.parseInt(state.getAttributeValue(ATTRIBUTE_VERSION), 0);

  for (Element element : state.getChildren()) {
    if (element.getName().equals(ELEMENT_IGNORE_FILES)) {
      myIgnoredPatterns.setIgnoreMasks(element.getAttributeValue(ATTRIBUTE_LIST));
    }
    else if (AbstractFileType.ELEMENT_EXTENSION_MAP.equals(element.getName())) {
      readGlobalMappings(element);
    }
  }

  if (savedVersion < 4) {
    if (savedVersion == 0) {
      addIgnore(".svn");
    }

    if (savedVersion < 2) {
      restoreStandardFileExtensions();
    }

    addIgnore("*.pyc");
    addIgnore("*.pyo");
    addIgnore(".git");
  }

  if (savedVersion < 5) {
    addIgnore("*.hprof");
  }

  if (savedVersion < 6) {
    addIgnore("_svn");
  }

  if (savedVersion < 7) {
    addIgnore(".hg");
  }

  if (savedVersion < 8) {
    addIgnore("*~");
  }

  if (savedVersion < 9) {
    addIgnore("__pycache__");
  }

  if (savedVersion < 11) {
    addIgnore("*.rbc");
  }

  if (savedVersion < 13) {
    // we want *.lib back since it's an important user artifact for CLion, also for IDEA project itself, since we have some libs.  
    unignoreMask("*.lib");
  }

  if (savedVersion < 15) {
    // we want .bundle back, bundler keeps useful data there
    unignoreMask(".bundle");
  }
  
  if (savedVersion < 16) {
    // we want .tox back to allow users selecting interpreters from it
    unignoreMask(".tox");
  }
  
  myIgnoredFileCache.clearCache();

  String counter = JDOMExternalizer.readString(state, "fileTypeChangedCounter");
  if (counter != null) {
    fileTypeChangedCount.set(StringUtilRt.parseInt(counter, 0));
    autoDetectedAttribute = autoDetectedAttribute.newVersion(fileTypeChangedCount.get());
  }
}
 
Example 37
Project: intellij-ce-playground   File: JDOMExternalizer.java   View source code 4 votes vote down vote up
public static int readInteger(Element root, String name, int defaultValue) {
  return StringUtilRt.parseInt(readString(root, name), defaultValue);
}
 
Example 38
Project: intellij-ce-playground   File: AutoTestManager.java   View source code 4 votes vote down vote up
public AutoTestManager(@NotNull Project project) {
  myProject = project;
  myDelayMillis = StringUtilRt.parseInt(PropertiesComponent.getInstance(project).getValue(AUTO_TEST_MANAGER_DELAY), AUTO_TEST_MANAGER_DELAY_DEFAULT);
  myDocumentWatcher = createWatcher();
}
 
Example 39
Project: intellij-ce-playground   File: DataViewsConfigurableUi.java   View source code 4 votes vote down vote up
private int getValueTooltipDelay() {
  Object value = valueTooltipDelayTextField.getValue();
  return value instanceof Number ? ((Number)value).intValue() :
         StringUtilRt.parseInt((String)value, XDebuggerDataViewSettings.DEFAULT_VALUE_TOOLTIP_DELAY);
}
 
Example 40
Project: intellij-ce-playground   File: CodeCompletionPanel.java   View source code 4 votes vote down vote up
private static int getIntegerValue(String s, int defaultValue) {
  int value = StringUtilRt.parseInt(s, defaultValue);
  return value < 0 ? defaultValue : value;
}