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

The following examples show how to use com.intellij.openapi.util.text.StringUtil#getThrowableText() . 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: TabbedPaneImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * @return value of <code>leadingTabIndex</code> field of BasicTabbedPaneUI.ScrollableTabSupport class.
 */
public int getLeadingTabIndex() {
  try {
    final Field tabScrollerField = BasicTabbedPaneUI.class.getDeclaredField(TAB_SCROLLER_NAME);
    tabScrollerField.setAccessible(true);
    final Object tabScrollerValue = tabScrollerField.get(myUI);

    final Field leadingTabIndexField = tabScrollerValue.getClass().getDeclaredField(LEADING_TAB_INDEX_NAME);
    leadingTabIndexField.setAccessible(true);
    return leadingTabIndexField.getInt(tabScrollerValue);
  }
  catch (Exception exc) {
    final String writer = StringUtil.getThrowableText(exc);
    throw new IllegalStateException("myUI=" + myUI + "; cause=" + writer);
  }
}
 
Example 2
Source File: TabbedPaneImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void setLeadingTabIndex(final int leadingIndex) {
  try {
    final Field tabScrollerField = BasicTabbedPaneUI.class.getDeclaredField(TAB_SCROLLER_NAME);
    tabScrollerField.setAccessible(true);
    final Object tabScrollerValue = tabScrollerField.get(myUI);

    Method setLeadingIndexMethod = null;
    final Method[] methods = tabScrollerValue.getClass().getDeclaredMethods();
    for (final Method method : methods) {
      if (SET_LEADING_TAB_INDEX_METHOD.equals(method.getName())) {
        setLeadingIndexMethod = method;
        break;
      }
    }
    if (setLeadingIndexMethod == null) {
      throw new IllegalStateException("method setLeadingTabIndex not found");
    }
    setLeadingIndexMethod.setAccessible(true);
    setLeadingIndexMethod.invoke(tabScrollerValue, Integer.valueOf(getTabPlacement()), Integer.valueOf(leadingIndex));
  }
  catch (Exception exc) {
    final String writer = StringUtil.getThrowableText(exc);
    throw new IllegalStateException("myUI=" + myUI + "; cause=" + writer);
  }
}
 
Example 3
Source File: CompositeElement.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public int getTextLength() {
  int cachedLength = myCachedLength;
  if (cachedLength >= 0) return cachedLength;

  assertReadAccessAllowed(); //otherwise a write action can modify the tree while we're walking it
  try {
    return walkCachingLength();
  }
  catch (AssertionError e) {
    myCachedLength = -1;
    String assertion = StringUtil.getThrowableText(e);
    throw new AssertionError("Walking failure: ===\n" + assertion + "\n=== Thread dump:\n" + ThreadDumper.dumpThreadsToString() + "\n===\n");
  }
}
 
Example 4
Source File: IdeaLoggingEvent.java    From consulo with Apache License 2.0 4 votes vote down vote up
public String getThrowableText() {
  if (myThrowable == null) return "";
  
  return StringUtil.getThrowableText(myThrowable);
}
 
Example 5
Source File: LogMessage.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public String getThrowableText() {
  return StringUtil.getThrowableText(getThrowable());
}