本文整理汇总了Java中com.intellij.util.StringBuilderSpinAllocator.alloc方法的典型用法代码示例。如果您正苦于以下问题:Java StringBuilderSpinAllocator.alloc方法的具体用法?Java StringBuilderSpinAllocator.alloc怎么用?Java StringBuilderSpinAllocator.alloc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.StringBuilderSpinAllocator
的用法示例。
在下文中一共展示了StringBuilderSpinAllocator.alloc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllModifierProperties
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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 );
}
}
示例2: getCustomPattern
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
@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;
}
示例3: getDisplayName
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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);
}
}
示例4: rebuildMethodFromString
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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);
}
}
示例5: ExecuteCompositeTargetEvent
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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;
}
示例6: createParameterList
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
@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();
}
示例7: composeTooltipMessage
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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);
}
}
示例8: AntMessage
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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);
}
}
示例9: getActionId
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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);
}
}
示例10: getDisplayName
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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);
}
}
示例11: getCustomLabel
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
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);
}
}
示例12: toDecodedForm
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
@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);
}
}
示例13: launchProcess
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
@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);
}
示例14: getPathStringFrom
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
@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);
}
}
示例15: getActionId
import com.intellij.util.StringBuilderSpinAllocator; //导入方法依赖的package包/类
@Nullable
public String getActionId() {
final String modelName = myModel.getName();
if (modelName == null || modelName.length() == 0) {
return null;
}
final StringBuilder name = StringBuilderSpinAllocator.alloc();
try {
name.append(AntConfiguration.getActionIdPrefix(myModel.getBuildFile().getProject()));
name.append("_");
name.append(modelName);
name.append('_');
name.append(getName());
return name.toString();
}
finally {
StringBuilderSpinAllocator.dispose(name);
}
}