Java 类com.intellij.util.StringBuilderSpinAllocator 实例源码

项目:manifold-ij    文件:ManLightMethodBuilderImpl.java   
public String getAllModifierProperties( LightModifierList modifierList )
{
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try
  {
    for( String modifier : modifierList.getModifiers() )
    {
      if( !PsiModifier.PACKAGE_LOCAL.equals( modifier ) )
      {
        builder.append( modifier ).append( ' ' );
      }
    }
    return builder.toString();
  }
  finally
  {
    StringBuilderSpinAllocator.dispose( builder );
  }
}
项目:intellij-ce-playground    文件:MethodBreakpoint.java   
public String getDisplayName() {
  final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    if(isValid()) {
      final String className = getClassName();
      final boolean classNameExists = className != null && className.length() > 0;
      if (classNameExists) {
        buffer.append(className);
      }
      if(getMethodName() != null) {
        if (classNameExists) {
          buffer.append(".");
        }
        buffer.append(getMethodName());
      }
    }
    else {
      buffer.append(DebuggerBundle.message("status.breakpoint.invalid"));
    }
    return buffer.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:intellij-ce-playground    文件:JavaMethodBreakpointType.java   
static String getText(XBreakpoint<JavaMethodBreakpointProperties> breakpoint) {
  final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    //if(isValid()) {
    final String className = breakpoint.getProperties().myClassPattern;
    final boolean classNameExists = className != null && className.length() > 0;
    if (classNameExists) {
      buffer.append(className);
    }
    if(breakpoint.getProperties().myMethodName != null) {
      if (classNameExists) {
        buffer.append(".");
      }
      buffer.append(breakpoint.getProperties().myMethodName);
    }
    //}
    //else {
    //  buffer.append(DebuggerBundle.message("status.breakpoint.invalid"));
    //}
    return buffer.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:intellij-ce-playground    文件:WildcardMethodBreakpoint.java   
public String getDisplayName() {
  if (!isValid()) {
    return DebuggerBundle.message("status.breakpoint.invalid");
  }
  final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    buffer.append(getClassPattern());
    buffer.append(".");
    buffer.append(getMethodName());
    buffer.append("()");
    return buffer.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:intellij-ce-playground    文件:NodeManagerImpl.java   
@Nullable
public static String getContextKeyForFrame(final StackFrameProxyImpl frame) {
  if (frame == null) {
    return null;
  }
  try {
    final Location location = frame.location();
    final Method method = location.method();
    final ReferenceType referenceType = location.declaringType();
    final StringBuilder builder = StringBuilderSpinAllocator.alloc();
    try {
      return builder.append(referenceType.signature()).append("#").append(method.name()).append(method.signature()).toString();
    }
    finally {
      StringBuilderSpinAllocator.dispose(builder);
    }
  }
  catch (EvaluateException e) {
    return null;
  }
}
项目:intellij-ce-playground    文件:ReloadClassesWorker.java   
private void reportProblem(final String qualifiedName, @Nullable Exception ex) {
  String reason = null;
  if (ex != null)  {
    reason = ex.getLocalizedMessage();
  }
  if (reason == null || reason.length() == 0) {
    reason = DebuggerBundle.message("error.io.error");
  }
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    buf.append(qualifiedName).append(" : ").append(reason);
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, buf.toString());
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:intellij-ce-playground    文件:ProjectStructureProblemsHolderImpl.java   
public String composeTooltipMessage() {
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    buf.append("<html><body>");
    if (myProblemDescriptions != null) {
      int problems = 0;
      for (ProjectStructureProblemDescription problemDescription : myProblemDescriptions) {
        buf.append(XmlStringUtil.escapeString(problemDescription.getMessage(false))).append("<br>");
        problems++;
        if (problems >= 10 && myProblemDescriptions.size() > 12) {
          buf.append(myProblemDescriptions.size() - problems).append(" more problems...<br>");
          break;
        }
      }
    }
    buf.append("</body></html>");
    return buf.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:intellij-ce-playground    文件:PackagingElementNode.java   
@Override
protected void update(PresentationData presentation) {
  final Collection<ArtifactProblemDescription> problems = ((ArtifactEditorImpl)myContext.getThisArtifactEditor()).getValidationManager().getProblems(this);
  if (problems == null || problems.isEmpty()) {
    super.update(presentation);
    return;
  }
  StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  final String tooltip;
  boolean isError = false;
  try {
    for (ArtifactProblemDescription problem : problems) {
      isError |= problem.getSeverity() == ProjectStructureProblemType.Severity.ERROR;
      buffer.append(problem.getMessage(false)).append("<br>");
    }
    tooltip = XmlStringUtil.wrapInHtml(buffer);
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }

  getElementPresentation().render(presentation, addErrorHighlighting(isError, SimpleTextAttributes.REGULAR_ATTRIBUTES),
                                  addErrorHighlighting(isError, SimpleTextAttributes.GRAY_ATTRIBUTES));
  presentation.setTooltip(tooltip);
}
项目:intellij-ce-playground    文件:CompilerPathsEx.java   
protected void acceptDirectory(final VirtualFile file, final String fileRoot, final String filePath) {
  ProgressManager.checkCanceled();
  final VirtualFile[] children = file.getChildren();
  for (final VirtualFile child : children) {
    final String name = child.getName();
    final String _filePath;
    final StringBuilder buf = StringBuilderSpinAllocator.alloc();
    try {
      buf.append(filePath).append("/").append(name);
      _filePath = buf.toString();
    }
    finally {
      StringBuilderSpinAllocator.dispose(buf);
    }
    accept(child, fileRoot, _filePath);
  }
}
项目:intellij-ce-playground    文件:PackagingElementPath.java   
@NotNull
public String getPathStringFrom(String separator, @Nullable CompositePackagingElement<?> ancestor) {
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    final List<CompositePackagingElement<?>> parents = getParentsFrom(ancestor);
    for (int i = parents.size() - 1; i >= 0; i--) {
      builder.append(parents.get(i).getName());
      if (i > 0) {
        builder.append(separator);
      }
    }
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:intellij-ce-playground    文件:LogFilterModel.java   
@Nullable
private Pattern getCustomPattern() {
  String customFilter = getCustomFilter();
  if (myCustomPattern == null && customFilter != null) {
    final StringBuilder buf = StringBuilderSpinAllocator.alloc();
    try {
      for (int i = 0; i < customFilter.length(); i++) {
        final char c = customFilter.charAt(i);
        if (Character.isLetterOrDigit(c)) {
          buf.append(Character.toUpperCase(c));
        }
        else {
          buf.append("\\").append(c);
        }
      }
      myCustomPattern = Pattern.compile(".*" + buf + ".*", Pattern.DOTALL);
    }
    finally {
      StringBuilderSpinAllocator.dispose(buf);
    }
  }
  return myCustomPattern;
}
项目:intellij-ce-playground    文件:AbstractSyntaxAwareReaderTransferableData.java   
@NotNull
private Reader getDelegate() {
  if (myDelegate != null) {
    return myDelegate;
  }

  int maxLength = Registry.intValue("editor.richcopy.max.size.megabytes") * FileUtilRt.MEGABYTE;
  final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    try {
      build(buffer, maxLength);
    }
    catch (Exception e) {
      LOG.error(e);
    }
    String s = buffer.toString();
    if (LOG.isDebugEnabled()) {
      LOG.debug("Resulting text: \n" + s);
    }
    myDelegate = new StringReader(s);
    return myDelegate;
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:intellij-ce-playground    文件:AntMessage.java   
public AntMessage(AntBuildMessageView.MessageType type, int priority, String[] lines, VirtualFile file, int line, int column) {
  myType = type;
  myPriority = priority;
  myFile = file;
  myLine = line;
  myColumn = column;
  myTextLines = lines;
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    for (final String aLine : lines) {
      builder.append(aLine);
      builder.append('\n');
    }
    myText = builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:intellij-ce-playground    文件:ExecuteCompositeTargetEvent.java   
public ExecuteCompositeTargetEvent(String[] targetNames) {
  myTargetNames = targetNames;
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    builder.append("[");
    for (int idx = 0; idx < targetNames.length; idx++) {
      if (idx > 0) {
        builder.append(",");
      }
      builder.append(targetNames[idx]);
    }
    builder.append("]");
    myCompositeName = builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
  myPresentableName = myCompositeName;
}
项目:intellij-ce-playground    文件:MetaTarget.java   
public String getActionId() {
  final String modelName = myBuildFile.getModel().getName();
  if (modelName == null || modelName.length() == 0) {
    return null;
  }
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    builder.append(AntConfiguration.getActionIdPrefix(myBuildFile.getProject()));
    builder.append("_");
    builder.append(modelName);
    builder.append('_');
    builder.append(getName());
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:intellij-ce-playground    文件:AntDomDocumentationProvider.java   
public String generateDoc(PsiElement element, PsiElement originalElement) {
  final String mainDoc = getMainDocumentation(originalElement);
  final String additionalDoc = getAdditionalDocumentation(originalElement);
  if (mainDoc == null && additionalDoc == null) {
    return null;
  }
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    if (additionalDoc != null) {
      builder.append(additionalDoc);
    }
    if (mainDoc != null) {
      builder.append(mainDoc);
    }
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:intellij-ce-playground    文件:GroovyPsiElementFactoryImpl.java   
@NotNull
@Override
public PsiParameterList createParameterList(@NotNull @NonNls String[] names, @NotNull PsiType[] types) throws IncorrectOperationException {
  StringBuilder builder = StringBuilderSpinAllocator.alloc();
  builder.append("def foo(");
  for (int i = 0; i < names.length; i++) {
    String name = names[i];
    final PsiType type = types[i];
    if (type != null) {
      builder.append(type.getCanonicalText());
      builder.append(' ');
    }
    builder.append(name);
    builder.append(',');
  }
  if (names.length > 0) {
    builder.delete(builder.length() - 1, builder.length());
  }
  builder.append("){}");
  final GrMethod method = createMethodFromText(builder);
  return method.getParameterList();
}
项目:sqlitemagic    文件:SqliteMagicLightMethodBuilder.java   
private PsiMethod rebuildMethodFromString() {
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    builder.append(getAllModifierProperties((LightModifierList) getModifierList()));
    PsiType returnType = getReturnType();
    if (null != returnType) {
      builder.append(returnType.getCanonicalText()).append(' ');
    }
    builder.append(getName());
    builder.append('(');
    if (getParameterList().getParametersCount() > 0) {
      for (PsiParameter parameter : getParameterList().getParameters()) {
        builder.append(parameter.getType().getCanonicalText()).append(' ').append(parameter.getName()).append(',');
      }
      builder.deleteCharAt(builder.length() - 1);
    }
    builder.append(')');
    builder.append('{').append("  ").append('}');

    PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getManager().getProject()).getElementFactory();
    return elementFactory.createMethodFromText(builder.toString(), getContainingClass());
  } finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:holdr    文件:HoldrLightMethodBuilder.java   
private PsiMethod rebuildMethodFromString() {
    final StringBuilder builder = StringBuilderSpinAllocator.alloc();
    try {
        builder.append(getAllModifierProperties((LightModifierList) getModifierList()));
        PsiType returnType = getReturnType();
        if (null != returnType) {
            builder.append(returnType.getCanonicalText()).append(' ');
        }
        builder.append(getName());
        builder.append('(');
        if (getParameterList().getParametersCount() > 0) {
            for (PsiParameter parameter : getParameterList().getParameters()) {
                builder.append(parameter.getType().getCanonicalText()).append(' ').append(parameter.getName()).append(',');
            }
            builder.deleteCharAt(builder.length() - 1);
        }
        builder.append(')');
        builder.append('{').append(" ").append('}');
        PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getManager().getProject()).getElementFactory();
        return elementFactory.createMethodFromText(builder.toString(), getContainingClass());
    } finally {
        StringBuilderSpinAllocator.dispose(builder);
    }
}
项目:tools-idea    文件:MethodBreakpoint.java   
public String getDisplayName() {
  final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    if(isValid()) {
      final String className = getClassName();
      final boolean classNameExists = className != null && className.length() > 0;
      if (classNameExists) {
        buffer.append(className);
      }
      if(myMethodName != null) {
        if (classNameExists) {
          buffer.append(".");
        }
        buffer.append(myMethodName);
      }
    }
    else {
      buffer.append(DebuggerBundle.message("status.breakpoint.invalid"));
    }
    return buffer.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:tools-idea    文件:WildcardMethodBreakpoint.java   
public String getDisplayName() {
  if (!isValid()) {
    return DebuggerBundle.message("status.breakpoint.invalid");
  }
  final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    buffer.append(myClassPattern);
    buffer.append(".");
    buffer.append(myMethodName);
    buffer.append("()");
    return buffer.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:tools-idea    文件:ValueDescriptorImpl.java   
private String getCustomLabel(String label) {
  //translate only strings in quotes
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    final Value value = getValue();
    if(isShowIdLabel() && value instanceof ObjectReference) {
      final String idLabel = getIdLabel((ObjectReference)value);
      if(!label.startsWith(idLabel)) {
        buf.append(idLabel);
      }
    }
    if(label == null) {
      //noinspection HardCodedStringLiteral
      buf.append("null");
    }
    else {
      buf.append(label);
    }
    return buf.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:tools-idea    文件:UserExpressionDescriptorImpl.java   
public String calcValueName() {
  StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    buffer.append(getName());
    buffer.append(": ");
    final Value value = getValue();
    if(value != null) {
      final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
      buffer.append(classRenderer.renderTypeName(value.type().name()));
    }

    return buffer.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:tools-idea    文件:NodeManagerImpl.java   
@Nullable
public static String getContextKeyForFrame(final StackFrameProxyImpl frame) {
  if (frame == null) {
    return null;
  }
  try {
    final Location location = frame.location();
    final Method method = location.method();
    final ReferenceType referenceType = location.declaringType();
    final StringBuilder builder = StringBuilderSpinAllocator.alloc();
    try {
      return builder.append(referenceType.signature()).append("#").append(method.name()).append(method.signature()).toString();
    }
    finally {
      StringBuilderSpinAllocator.dispose(builder);
    }
  }
  catch (EvaluateException e) {
    return null;
  }
}
项目:tools-idea    文件:PositionHighlighter.java   
public String getTooltipText() {
  DebugProcessImpl debugProcess = myContext.getDebugProcess();
  if (debugProcess == null) {
    return null;
  }
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    //noinspection HardCodedStringLiteral
    buf.append("<html><body>");
    for (Iterator<Pair<Breakpoint, Event>> iterator = myEventsOutOfLine.iterator(); iterator.hasNext();) {
      Pair<Breakpoint, Event> eventDescriptor = iterator.next();
      buf.append(((DebugProcessEvents)debugProcess).getEventText(eventDescriptor));
      if(iterator.hasNext()) {
        //noinspection HardCodedStringLiteral
        buf.append("<br>");
      }
    }
    //noinspection HardCodedStringLiteral
    buf.append("</body></html>");
    return buf.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:tools-idea    文件:ReloadClassesWorker.java   
private void reportProblem(final String qualifiedName, @Nullable Exception ex) {
  String reason = null;
  if (ex != null)  {
    reason = ex.getLocalizedMessage();
  }
  if (reason == null || reason.length() == 0) {
    reason = DebuggerBundle.message("error.io.error");
  }
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    buf.append(qualifiedName).append(" : ").append(reason);
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, buf.toString());
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:tools-idea    文件:ProjectStructureProblemsHolderImpl.java   
public String composeTooltipMessage() {
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    buf.append("<html><body>");
    if (myProblemDescriptions != null) {
      int problems = 0;
      for (ProjectStructureProblemDescription problemDescription : myProblemDescriptions) {
        buf.append(XmlStringUtil.escapeString(problemDescription.getMessage(false))).append("<br>");
        problems++;
        if (problems >= 10 && myProblemDescriptions.size() > 12) {
          buf.append(myProblemDescriptions.size() - problems).append(" more problems...<br>");
          break;
        }
      }
    }
    buf.append("</body></html>");
    return buf.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:tools-idea    文件:PackagingElementNode.java   
@Override
protected void update(PresentationData presentation) {
  final Collection<ArtifactProblemDescription> problems = ((ArtifactEditorImpl)myContext.getThisArtifactEditor()).getValidationManager().getProblems(this);
  if (problems == null || problems.isEmpty()) {
    super.update(presentation);
    return;
  }
  StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  final String tooltip;
  boolean isError = false;
  try {
    for (ArtifactProblemDescription problem : problems) {
      isError |= problem.getSeverity() == ProjectStructureProblemType.Severity.ERROR;
      buffer.append(problem.getMessage(false)).append("<br>");
    }
    tooltip = XmlStringUtil.wrapInHtml(buffer);
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }

  getElementPresentation().render(presentation, addErrorHighlighting(isError, SimpleTextAttributes.REGULAR_ATTRIBUTES),
                                  addErrorHighlighting(isError, SimpleTextAttributes.GRAY_ATTRIBUTES));
  presentation.setTooltip(tooltip);
}
项目:tools-idea    文件:CompilerPathsEx.java   
protected void acceptDirectory(final VirtualFile file, final String fileRoot, final String filePath) {
  ProgressManager.checkCanceled();
  final VirtualFile[] children = file.getChildren();
  for (final VirtualFile child : children) {
    final String name = child.getName();
    final String _filePath;
    final StringBuilder buf = StringBuilderSpinAllocator.alloc();
    try {
      buf.append(filePath).append("/").append(name);
      _filePath = buf.toString();
    }
    finally {
      StringBuilderSpinAllocator.dispose(buf);
    }
    accept(child, fileRoot, _filePath);
  }
}
项目:tools-idea    文件:PackagingElementPath.java   
@NotNull
public String getPathStringFrom(String separator, @Nullable CompositePackagingElement<?> ancestor) {
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    final List<CompositePackagingElement<?>> parents = getParentsFrom(ancestor);
    for (int i = parents.size() - 1; i >= 0; i--) {
      builder.append(parents.get(i).getName());
      if (i > 0) {
        builder.append(separator);
      }
    }
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:tools-idea    文件:MakeUtil.java   
/**
 * cuts inner or anonymous class' parts and translates package names to lower case
 */
private static String normalizeClassName(String qName) {
  int index = qName.indexOf('$');
  if (index >= 0) {
    qName = qName.substring(0, index);
  }
  if (SystemInfo.isFileSystemCaseSensitive) {
    return qName;
  }
  // the name of a dir should be lowercased because javac seem to allow difference in case
  // between the physical directory and package name.
  final int dotIndex = qName.lastIndexOf('.');
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    builder.append(qName);
    for (int idx = 0; idx < dotIndex; idx++) {
      builder.setCharAt(idx, Character.toLowerCase(builder.charAt(idx)));
    }
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:tools-idea    文件:InternedPath.java   
public static String join(List<String> value, char separator) {
  final int size = value.size();
  if (size > 1) {
    final StringBuilder builder = StringBuilderSpinAllocator.alloc();
    try {
      builder.append(value.get(0));
      for (int idx = 1; idx < size; idx++) {
        builder.append(separator).append(value.get(idx));
      }
      return builder.toString();
    }
    finally {
      StringBuilderSpinAllocator.dispose(builder);
    }
  }
  else if (size == 1){
    return value.get(0);
  }
  return "";
}
项目:tools-idea    文件:ModuleChunk.java   
public String getSourcePath(final int sourcesFilter) {
  if (getModuleCount() == 0) {
    return "";
  }
  final VirtualFile[] filteredRoots = getSourceRoots(sourcesFilter);
  final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  try {
    ApplicationManager.getApplication().runReadAction(new Runnable() {
      public void run() {
        for (VirtualFile root : filteredRoots) {
          if (buffer.length() > 0) {
            buffer.append(File.pathSeparatorChar);
          }
          buffer.append(root.getPath().replace('/', File.separatorChar));
        }
      }
    });
    return buffer.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }
}
项目:tools-idea    文件:ExternalCompiler.java   
@NotNull
public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
  final String[] commands = createStartupCommand(chunk, compileContext, outputDir);

  if (LOG.isDebugEnabled()) {
    @NonNls final StringBuilder buf = StringBuilderSpinAllocator.alloc();
    try {
      buf.append("\n===================================Environment:===========================\n");
      for (String pair : EnvironmentUtil.getEnvironment()) {
        buf.append("\t").append(pair).append("\n");
      }
      buf.append("=============================================================================\n");
      buf.append("Running compiler: ");
      for (final String command : commands) {
        buf.append(" ").append(command);
      }

      LOG.debug(buf.toString());
    }
    finally {
      StringBuilderSpinAllocator.dispose(buf);
    }
  }

  return Runtime.getRuntime().exec(commands);
}
项目:tools-idea    文件:LogFilterModel.java   
@Nullable
private Pattern getCustomPattern() {
  String customFilter = getCustomFilter();
  if (myCustomPattern == null && customFilter != null) {
    final StringBuilder buf = StringBuilderSpinAllocator.alloc();
    try {
      for (int i = 0; i < customFilter.length(); i++) {
        final char c = customFilter.charAt(i);
        if (Character.isLetterOrDigit(c)) {
          buf.append(Character.toUpperCase(c));
        }
        else {
          buf.append("\\").append(c);
        }
      }
      myCustomPattern = Pattern.compile(".*" + buf + ".*", Pattern.DOTALL);
    }
    finally {
      StringBuilderSpinAllocator.dispose(buf);
    }
  }
  return myCustomPattern;
}
项目:tools-idea    文件:UrlImpl.java   
@Override
public String toDecodedForm(boolean skipQueryAndFragment) {
  StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    builder.append(scheme).append("://");
    if (authority != null) {
      builder.append(authority);
    }
    if (path != null) {
      builder.append(getPath());
    }
    if (!skipQueryAndFragment && parameters != null) {
      builder.append(parameters);
    }
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:tools-idea    文件:AntMessage.java   
public AntMessage(AntBuildMessageView.MessageType type, int priority, String[] lines, VirtualFile file, int line, int column) {
  myType = type;
  myPriority = priority;
  myFile = file;
  myLine = line;
  myColumn = column;
  myTextLines = lines;
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    for (final String aLine : lines) {
      builder.append(aLine);
      builder.append('\n');
    }
    myText = builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:tools-idea    文件:ExecuteCompositeTargetEvent.java   
public ExecuteCompositeTargetEvent(String[] targetNames) {
  myTargetNames = targetNames;
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    builder.append("[");
    for (int idx = 0; idx < targetNames.length; idx++) {
      if (idx > 0) {
        builder.append(",");
      }
      builder.append(targetNames[idx]);
    }
    builder.append("]");
    myCompositeName = builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
  myPresentableName = myCompositeName;
}
项目:tools-idea    文件:MetaTarget.java   
public String getActionId() {
  final String modelName = myBuildFile.getModel().getName();
  if (modelName == null || modelName.length() == 0) {
    return null;
  }
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    builder.append(AntConfiguration.getActionIdPrefix(myBuildFile.getProject()));
    builder.append("_");
    builder.append(modelName);
    builder.append('_');
    builder.append(getName());
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}
项目:tools-idea    文件:AntDomDocumentationProvider.java   
public String generateDoc(PsiElement element, PsiElement originalElement) {
  final String mainDoc = getMainDocumentation(originalElement);
  final String additionalDoc = getAdditionalDocumentation(originalElement);
  if (mainDoc == null && additionalDoc == null) {
    return null;
  }
  final StringBuilder builder = StringBuilderSpinAllocator.alloc();
  try {
    if (additionalDoc != null) {
      builder.append(additionalDoc);
    }
    if (mainDoc != null) {
      builder.append(mainDoc);
    }
    return builder.toString();
  }
  finally {
    StringBuilderSpinAllocator.dispose(builder);
  }
}