Java 类com.intellij.openapi.util.text.StringUtilRt 实例源码

项目:intellij-ce-playground    文件:Comparing.java   
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;
}
项目:intellij-ce-playground    文件:SslSocketFactory.java   
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();
}
项目:intellij-ce-playground    文件:DefaultHtmlDoctypeInitialConfigurator.java   
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);
    }
  }
}
项目:intellij-ce-playground    文件:MapEntryOrKeyValueHintProcessor.java   
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;
  }
项目:Buck-IntelliJ-Plugin    文件:BuckFileTypeFactory.java   
@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);
        }
      });
}
项目:tools-idea    文件:Comparing.java   
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;
}
项目:jediterm    文件:Comparing.java   
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;
}
项目:buck    文件:BuckFileTypeFactory.java   
@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);
        }
      });
}
项目:consulo    文件:Comparing.java   
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;
}
项目:intellij-ce-playground    文件:JpsArtifactPathUtil.java   
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;
}
项目:intellij-ce-playground    文件:GenericDebuggerParametersRunnerConfigurable.java   
private void setPort(String port) {
  if (isSocket()) {
    myPortField.setText(String.valueOf(StringUtilRt.parseInt(port, 0)));
  }
  else {
    myAddressField.setText(port);
  }
}
项目:intellij-ce-playground    文件:ChainCompletionStringUtil.java   
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());
}
项目:intellij-ce-playground    文件:AbstractExternalFilter.java   
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;
}
项目:intellij-ce-playground    文件:GitAskPassApp.java   
@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);
}
项目:intellij-ce-playground    文件:MapEntryOrKeyValueHintProcessor.java   
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;
}
项目:intellij-ce-playground    文件:MapEntryOrKeyValueHintProcessor.java   
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;
}
项目:intellij-ce-playground    文件:MapEntryOrKeyValueHintProcessor.java   
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;
}
项目:tools-idea    文件:JpsArtifactPathUtil.java   
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;
}
项目:tools-idea    文件:GitAskPassApp.java   
@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);
}
项目:consulo    文件:FormBuilder.java   
@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;
}
项目:consulo    文件:LabeledComponents.java   
@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;
}
项目:consulo    文件:LabeledComponents.java   
@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;
}
项目:consulo    文件:SchemesManagerImpl.java   
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);
  }
}
项目:consulo    文件:SchemesManagerImpl.java   
@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();
}
项目:consulo    文件:AbstractExternalFilter.java   
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;
}
项目:intellij-ce-playground    文件:ExtensionFileNameMatcher.java   
@Override
public boolean acceptsCharSequence(@NonNls @NotNull CharSequence fileName) {
  return StringUtilRt.endsWithIgnoreCase(fileName, myDotExtension);
}
项目:intellij-ce-playground    文件:ChainCompletionStringUtil.java   
private static void fillNonPrimitiveNames(final String typeAsString) {
  PRIMITIVES_NAMES.add(typeAsString);
  PRIMITIVES_SHORT_NAMES.add(StringUtilRt.getShortName(typeAsString));
}
项目:intellij-ce-playground    文件:FileUtilRt.java   
@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());
}
项目:intellij-ce-playground    文件:FileUtilRt.java   
private static String ensureEnds(@NotNull String s, final char endsWith) {
  return StringUtilRt.endsWithChar(s, endsWith) ? s : s + endsWith;
}
项目:intellij-ce-playground    文件:FileUtilRt.java   
@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;
}
项目:intellij-ce-playground    文件:FileUtilRt.java   
@Override
public boolean charsEqual(char ch1, char ch2) {
  return StringUtilRt.charsEqualIgnoreCase(ch1, ch2);
}
项目:intellij-ce-playground    文件:DirectoryStorageUtil.java   
@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;
}
项目:intellij-ce-playground    文件:PropertiesComponent.java   
public int getInt(@NotNull String name, int defaultValue) {
  return StringUtilRt.parseInt(getValue(name), defaultValue);
}
项目:intellij-ce-playground    文件:RestService.java   
protected static int getIntParameter(@NotNull String name, @NotNull QueryStringDecoder urlDecoder) {
  return StringUtilRt.parseInt(StringUtil.nullize(ContainerUtil.getLastItem(urlDecoder.parameters().get(name)), true), -1);
}
项目:intellij-ce-playground    文件:OpenFileHttpService.java   
@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;
}
项目:intellij-ce-playground    文件:FileTypeManagerImpl.java   
@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());
  }
}
项目:intellij-ce-playground    文件:JDOMExternalizer.java   
public static int readInteger(Element root, String name, int defaultValue) {
  return StringUtilRt.parseInt(readString(root, name), defaultValue);
}
项目:intellij-ce-playground    文件:AutoTestManager.java   
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();
}
项目:intellij-ce-playground    文件:DataViewsConfigurableUi.java   
private int getValueTooltipDelay() {
  Object value = valueTooltipDelayTextField.getValue();
  return value instanceof Number ? ((Number)value).intValue() :
         StringUtilRt.parseInt((String)value, XDebuggerDataViewSettings.DEFAULT_VALUE_TOOLTIP_DELAY);
}
项目:intellij-ce-playground    文件:CodeCompletionPanel.java   
private static int getIntegerValue(String s, int defaultValue) {
  int value = StringUtilRt.parseInt(s, defaultValue);
  return value < 0 ? defaultValue : value;
}