Java Code Examples for com.intellij.openapi.util.text.StringUtilRt#parseInt()

The following examples show how to use com.intellij.openapi.util.text.StringUtilRt#parseInt() . 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: CsvTableEditorState.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
public static CsvTableEditorState create(@NotNull Element element, @NotNull Project project, @NotNull VirtualFile file) {
    CsvTableEditorState state = new CsvTableEditorState();

    Attribute attribute = element.getAttribute("showInfoPanel");
    state.setShowInfoPanel(
            attribute == null ? CsvEditorSettings.getInstance().showTableEditorInfoPanel() : Boolean.parseBoolean(attribute.getValue())
    );

    attribute = element.getAttribute("fixedHeaders");
    state.setFixedHeaders(
            attribute == null ? false : Boolean.parseBoolean(attribute.getValue())
    );

    attribute = element.getAttribute("autoColumnWidthOnOpen");
    if (attribute != null) {
        state.setAutoColumnWidthOnOpen(Boolean.parseBoolean(attribute.getValue()));
    }

    state.setRowLines(
            StringUtilRt.parseInt(element.getAttributeValue("rowLines"), CsvEditorSettings.getInstance().getTableEditorRowHeight())
    );

    List<Element> columnWidthElements = element.getChildren("column");
    int[] columnWidths = new int[columnWidthElements.size()];
    int defaultColumnWidth = CsvEditorSettings.getInstance().getTableDefaultColumnWidth();
    for (int i = 0; i < columnWidthElements.size(); ++i) {
        Element columnElement = columnWidthElements.get(i);
        int index = StringUtilRt.parseInt(columnElement.getAttributeValue("index"), i);
        columnWidths[index] = StringUtilRt.parseInt(columnElement.getAttributeValue("width"), defaultColumnWidth);
    }
    state.setColumnWidths(columnWidths);

    return state;
}
 
Example 2
Source File: PropertiesComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
default int getInt(@Nonnull String name, int defaultValue) {
  return StringUtilRt.parseInt(getValue(name), defaultValue);
}
 
Example 3
Source File: FileTypeManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void loadState(@Nonnull 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, false);
    }
  }

  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");
  }

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

  myIgnoredFileCache.clearCache();

  String counter = JDOMExternalizer.readString(state, "fileTypeChangedCounter");
  if (counter != null) {
    fileTypeChangedCount.set(StringUtilRt.parseInt(counter, 0));
    autoDetectedAttribute = autoDetectedAttribute.newVersion(fileTypeChangedCount.get());
  }
}
 
Example 4
Source File: JDOMExternalizer.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static int readInteger(Element root, String name, int defaultValue) {
  return StringUtilRt.parseInt(readString(root, name), defaultValue);
}
 
Example 5
Source File: DataViewsConfigurableUi.java    From consulo with Apache License 2.0 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);
}