Package com.aptana.shared_core.string

Examples of com.aptana.shared_core.string.FastStringBuffer


            Document doc = new Document(str);
            formatter.formatAll(doc, null, false, formatStd, false);
            str = doc.get();
        } catch (SyntaxErrorException e) {
        }
        FastStringBuffer buf = new FastStringBuffer();
        for (String line : StringUtils.splitInLines(str)) {
            buf.append(line);
            char c = buf.lastChar();
            if (c == '\n') {
                buf.deleteLast();
                if (showSpacesAndNewLines) {
                    buf.append("\\n");
                }
                //Adds chars so that the initial presentation is bigger (they are later changed for spaces).
                //If that's not done, the created editor would be too small... especially if we consider
                //that the code-formatting can change for that editor (so, some parts wouldn't appear if we
                //need more space later on).
                buf.appendN('|', 8);
                buf.append(c);
            }
        }
        String result = buf.toString();

        String finalResult;
        if (showSpacesAndNewLines) {
            finalResult = result.replace(' ', '.');
        } else {
View Full Code Here


        return lastLoadedContents;
    }

    private void traceFunc(String func, Object... args) {
        if (TRACE_PYTHON_NATURE_STORE) {
            FastStringBuffer buf = new FastStringBuffer(func, 128);
            for (Object o : args) {
                buf.appendObject(o);
            }
            func = buf.toString();
            if (!func.startsWith("END ")) {
                System.out.println(indent + func);
                indent.append("  ");

            } else {
View Full Code Here

     * @return the assembled string of paths or null if the input was null
     */
    private String getPathStringFromArray(String[] pathArray) {
        traceFunc("getPathStringFromArray");
        if (pathArray != null) {
            FastStringBuffer s = new FastStringBuffer();
            for (int i = 0; i < pathArray.length; i++) {
                if (i > 0) {
                    s.append('|');
                }
                s.append(pathArray[i]);
            }
            traceFunc("END getPathStringFromArray");
            return s.toString();
        }
        traceFunc("END getPathStringFromArray (null)");
        return null;
    }
View Full Code Here

        traceFunc("END setTextContent");
    }

    private String getTextContent(Node self) throws DOMException {
        traceFunc("getTextContent");
        FastStringBuffer fBufferStr = new FastStringBuffer();
        Node child = self.getFirstChild();
        if (child != null) {
            Node next = child.getNextSibling();
            if (next == null) {
                if (hasTextContent(child)) {
                    String nodeValue = child.getNodeValue();
                    if (nodeValue != null) {
                        traceFunc("END getTextContent - ", nodeValue);
                        return nodeValue;
                    }
                }
                traceFunc("END getTextContent - EMPTY");
                return "";
            }
            fBufferStr.clear();
            getTextContent(fBufferStr, self);
            traceFunc("END getTextContent - ", fBufferStr);
            return fBufferStr.toString();
        }
        traceFunc("END getTextContent - EMPTY");
        return "";
    }
View Full Code Here

        public void widgetSelected(SelectionEvent e) {
            Text textControl = parametersField.getTextControl();
            String currentText = textControl.getText();
            StringTokenizer stringTokenizer = new StringTokenizer(currentText);
            FastStringBuffer buf = new FastStringBuffer(currentText.length() * 2);

            boolean found = false;
            while (stringTokenizer.hasMoreTokens()) {
                String tok = stringTokenizer.nextToken();
                if (tok.startsWith(tag)) {
                    found = true;
                }
                buf.append(tok);
                buf.append('\n');
            }
            if (!found) {
                buf.append(tag);
                buf.append('=');
            } else {
                buf.deleteLast(); //remove the last '\n'
            }
            textControl.setText(buf.toString());
            textControl.setSelection(textControl.getSize());
            textControl.setFocus();
        }
View Full Code Here

    public String getProcessType() {
        return isJython() ? "java" : Constants.PROCESS_TYPE;
    }

    public static String getRunningName(IPath[] paths) {
        FastStringBuffer buf = new FastStringBuffer(20 * paths.length);
        for (IPath p : paths) {
            if (buf.length() > 0) {
                buf.append(" - ");
            }
            buf.append(p.lastSegment());
        }
        return buf.toString();

    }
View Full Code Here

                d.targets = exprs;
                return d;

            case JJTDOTTED_NAME:
                Name name = (Name) n;
                FastStringBuffer sb = tempBuffer.clear();
                for (int i = 0; i < arity; i++) {
                    if (i > 0) {
                        sb.insert(0, '.');
                    }
                    Name name0 = (Name) stack.popNode();
                    sb.insert(0, name0.id);
                    addSpecials(name0, name);
                    //we have to set that, because if we later add things to the previous Name, we will now want it to be added to
                    //the new name (comments will only appear later and may be added to the previous name -- so, we replace the previous
                    //name specials list).
                    name0.specialsBefore = name.getSpecialsBefore();
                    name0.specialsAfter = name.getSpecialsAfter();
                }
                name.id = sb.toString();
                return name;

            case JJTDOTTED_AS_NAME:
                NameTok asname = null;
                if (arity > 1) {
View Full Code Here

    public void setSpacesAfterColon(int i) {
        this.tokReplacement.put(":", createSpacesStr(i, ":"));
    }

    private String createSpacesStr(int i, String startingWith) {
        FastStringBuffer buf = new FastStringBuffer(startingWith, i);
        buf.appendN(' ', i);
        return buf.toString();
    }
View Full Code Here

        }
        return workingCopy;
    }

    private static String makeFileRelativeToWorkspace(FileOrResource[] resource, IStringVariableManager varManager) {
        FastStringBuffer moduleFile = new FastStringBuffer(80 * resource.length);
        for (FileOrResource r : resource) {
            if (moduleFile.length() > 0) {
                moduleFile.append("|");
            }

            if (r.resource != null) {
                moduleFile.append(makeFileRelativeToWorkspace(r.resource, varManager));
            } else {
                moduleFile.append(FileUtils.getFileAbsolutePath(r.file));
            }
        }
        return moduleFile.toString();
    }
View Full Code Here

        writeNewLine(true);
    }

    public boolean writeNewLine(boolean force) throws IOException {
        if (force || lastState == LAST_STATE_WRITE) {
            FastStringBuffer buffer = writer.getBuffer();
            if (buffer.endsWith(": ")) {
                buffer.deleteLast();
            }

            if (lastState == LAST_STATE_NEW_LINE) {
                this.writeIndent();
            }
View Full Code Here

TOP

Related Classes of com.aptana.shared_core.string.FastStringBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.