Package com.aptana.shared_core.string

Examples of com.aptana.shared_core.string.FastStringBuffer


            if (t != null) {
                t.setSuspended(false, null);
                fireEvent(new DebugEvent(t, DebugEvent.RESUME, resumeReason));

            } else {
                FastStringBuffer buf = new FastStringBuffer();
                for (PyThread thread : threads) {
                    if (buf.length() > 0) {
                        buf.append(", ");
                    }
                    buf.append("id: " + thread.getId());
                }
                String msg = "Unable to find thread: " + threadID +
                        " available: " + buf;
                PydevDebugPlugin.log(IStatus.ERROR, msg, new RuntimeException(msg));
            }
View Full Code Here


            fCounterPanel.setFailureValue(numberOfFailures);

            String totalTime = currentRun.getTotalTime();
            if (totalTime == null) {
                Collection<PyUnitTestStarted> testsRunning = currentRun.getTestsRunning();
                FastStringBuffer bufStatus = new FastStringBuffer("Current: ", 200);
                FastStringBuffer bufTooltip = new FastStringBuffer("Current: ", 200);

                int i = 0;
                for (PyUnitTestStarted pyUnitTestStarted : testsRunning) {
                    if (i > 0) {
                        bufTooltip.append('\n');
                    }
                    bufTooltip.append(pyUnitTestStarted.test);
                    bufTooltip.append("  ");
                    bufTooltip.append('(');
                    bufTooltip.append(pyUnitTestStarted.location);
                    bufTooltip.append(')');

                    if (i > 0) {
                        bufStatus.append(", ");
                    }
                    bufStatus.append(pyUnitTestStarted.test);
                    i++;
                }
                this.fStatus.setText(bufStatus.toString());
                this.fStatus.setToolTipText(bufTooltip.toString());
            } else {
                this.fStatus.setText(totalTime);
                this.fStatus.setToolTipText(totalTime);
            }
        } else {
View Full Code Here

        return lastGenAndTok.generator.isImport();
    }

    @Override
    public String toString() {
        FastStringBuffer buffer = new FastStringBuffer();
        buffer.append("Found { (used:");
        buffer.append(used);
        buffer.append(") [");

        for (GenAndTok g : found) {
            buffer.appendObject(g);
            buffer.append("  ");
        }
        buffer.append(" ]}");
        return buffer.toString();
    }
View Full Code Here

     * presentation is based on its format to add a different formatting).
     */
    @Override
    public String toString() {
        int fixedContentsLen = 50;
        FastStringBuffer buf = new FastStringBuffer(this.test.length() + this.status.length() + this.time.length()
                + this.location.length() + this.errorContents.length() + this.capturedOutput.length()
                + fixedContentsLen);

        return buf.append(this.test).append(" Status: ").append(this.status).append(" Time: ").append(this.time)
                .append("\n\n").append("File: ").append(this.location).append("\n\n").append(this.errorContents)
                .append("\n\n").append(this.capturedOutput).append("\n\n").toString();
    }
View Full Code Here

    public void relaunchTestResults(List<PyUnitTestResult> runsToRelaunch) {
        this.relaunchTestResults(runsToRelaunch, null);
    }

    public void relaunchTestResults(List<PyUnitTestResult> runsToRelaunch, String mode) {
        FastStringBuffer buf = new FastStringBuffer(100 * runsToRelaunch.size());
        for (PyUnitTestResult pyUnitTestResult : runsToRelaunch) {
            buf.append(pyUnitTestResult.location).append("|").append(pyUnitTestResult.test).append('\n');
        }

        try {
            ILaunchConfigurationWorkingCopy workingCopy;
            String name = configuration.getName();
            if (name.indexOf("[pyunit run]") != -1) {
                //if it's already an errors relaunch, just change it
                workingCopy = configuration.getWorkingCopy();
            } else {
                //if it's not, create a copy, as we don't want to screw with the original launch
                workingCopy = configuration.copy(name + " [pyunit run]");
            }
            //When running it, it'll put the contents we set in the buf string into a file and pass that
            //file to the actual unittest run.
            workingCopy.setAttribute(Constants.ATTR_UNITTEST_CONFIGURATION_FILE, buf.toString());
            ILaunchConfiguration newConf = workingCopy.doSave();
            ILaunch l = launch;
            if (mode != null) {
                String launchMode = launch.getLaunchMode();
                if (!mode.equals(launchMode)) {
View Full Code Here

        Set<Tuple<String, String>> mods = new HashSet<Tuple<String, String>>();
        //1. check if it is some module

        //use a single buffer to create all the strings
        FastStringBuffer buffer = new FastStringBuffer();
        boolean doIgnoreImportsStartingWithUnder = AutoImportsPreferencesPage.doIgnoreImportsStartingWithUnder();

        for (String completeName : allModules) {
            FullRepIterable iterable = new FullRepIterable(completeName);

            for (String mod : iterable) {

                if (fullRep.startsWith(mod)) {

                    if (fullRep.length() == mod.length() //it does not only start with, but it is equal to it.
                            || (fullRep.length() > mod.length() && fullRep.charAt(mod.length()) == '.')) {
                        buffer.clear();
                        String realImportRep = buffer.append("import ").append(mod).toString();
                        buffer.clear();
                        String displayString = buffer.append("Import ").append(mod).toString();
                        addProp(props, realImportRep, displayString, packageImage, offset, mods);
                    }
                }

                String[] strings = FullRepIterable.headAndTail(mod);
                String packageName = strings[0];
                String importRep = strings[1];

                if (importRep.equals(markerContents)) {
                    if (packageName.length() > 0) {
                        buffer.clear();
                        String realImportRep = buffer.append("from ").append(packageName).append(" ").append("import ")
                                .append(strings[1]).toString();
                        buffer.clear();
                        String displayString = buffer.append("Import ").append(importRep).append(" (")
                                .append(packageName).append(")").toString();
                        addProp(props, realImportRep, displayString, packageImage, offset, mods);

                    } else {
                        buffer.clear();
                        String realImportRep = buffer.append("import ").append(strings[1]).toString();
                        buffer.clear();
                        String displayString = buffer.append("Import ").append(importRep).toString();
                        addProp(props, realImportRep, displayString, packageImage, offset, mods);
                    }
                }
            }
        }

        //2. check if it is some global class or method
        List<AbstractAdditionalTokensInfo> additionalInfo;
        try {
            additionalInfo = AdditionalProjectInterpreterInfo.getAdditionalInfo(nature);
        } catch (MisconfigurationException e) {
            return;
        }
        FastStringBuffer tempBuf = new FastStringBuffer();
        for (AbstractAdditionalTokensInfo info : additionalInfo) {
            Collection<IInfo> tokensEqualTo = info.getTokensEqualTo(markerContents,
                    AbstractAdditionalTokensInfo.TOP_LEVEL);
            for (IInfo found : tokensEqualTo) {
                //there always is a declaring module
View Full Code Here

            IDocument document = (IDocument) doc;
            charArray = document.get().toCharArray();
            len = charArray.length;

        } else if (doc instanceof FastStringBuffer) {
            FastStringBuffer fastStringBuffer = (FastStringBuffer) doc;
            //In this case, we can actually get the internal array without doing any copies (and just specifying the len).
            charArray = fastStringBuffer.getInternalCharsArray();
            len = fastStringBuffer.length();

        } else if (doc instanceof String) {
            String str = (String) doc;
            charArray = str.toCharArray();
            len = charArray.length;
View Full Code Here

        }

        PythonNature nature = PythonNature.getPythonNature(next);
        AnalysisBuilderVisitor visitor = new AnalysisBuilderVisitor();
        visitor.visitingWillStart(new NullProgressMonitor(), false, null);
        FastStringBuffer buf = new FastStringBuffer();
        for (IFile f : filesToVisit) {
            if (monitor.isCanceled()) {
                break;
            }
            if (filesVisited.contains(f)) {
                continue;
            }
            filesVisited.add(f);
            monitor.setTaskName(buf.clear().append("Scheduling: ").append(f.getName()).toString());
            IDocument doc = FileUtilsFileBuffer.getDocFromResource(f);
            visitor.memo = new HashMap<String, Object>();
            visitor.memo.put(PyDevBuilderVisitor.IS_FULL_BUILD, false);
            long documentTime = f.getModificationStamp();
            visitor.memo.put(PyDevBuilderVisitor.DOCUMENT_TIME, documentTime);
View Full Code Here

            }
            entry = entry.parent;
        }

        //now that we have the stack, let's make it into a path...
        FastStringBuffer buf = new FastStringBuffer();
        while (tempStack.size() > 0) {
            if (buf.length() > 0) {
                buf.append(".");
            }
            buf.append(NodeUtils.getRepresentationString(tempStack.pop()));
        }
        return new Tuple<String, Boolean>(buf.toString(), lastIsMethod);
    }
View Full Code Here

                offset, //note: the cursor position is unchanged!
                annotationImage, messageToIgnore.substring(1), null, null,
                PyCompletionProposal.PRIORITY_DEFAULT, edit) {
            @Override
            public void apply(IDocument document) {
                FastStringBuffer strToAdd = new FastStringBuffer(messageToIgnore, 5);
                int lineLen = line.length();

                int endLineIndex = ps.getEndLineOffset();
                boolean isComment = ParsingUtils.isCommentPartition(document, endLineIndex);

                int whitespacesAtEnd = 0;
                char c = '\0';
                for (int i = lineLen - 1; i >= 0; i--) {
                    c = line.charAt(i);
                    if (c == ' ') {
                        whitespacesAtEnd += 1;
                    } else {
                        break;
                    }
                }

                if (isComment) {
                    if (whitespacesAtEnd == 0) {
                        strToAdd.insert(0, ' '); //it's a comment already, but as it has no spaces in the end, let's add one.
                    }

                } else {
                    FormatStd formatStd = IgnoreErrorParticipant.this.format;
                    if (formatStd == null) {
                        formatStd = PyFormatStd.getFormat();
                    }

                    strToAdd.insert(0, '#');

                    //Just add spaces before the '#' if there's actually some content in the line.
                    if (c != '\r' && c != '\n' && c != '\0' && c != ' ') {
                        int spacesBeforeComment = formatStd.spacesBeforeComment;
                        if (spacesBeforeComment < 0) {
                            spacesBeforeComment = 1; //If 'manual', add a single space.
                        }
                        spacesBeforeComment = spacesBeforeComment - whitespacesAtEnd;
                        if (spacesBeforeComment > 0) {
                            strToAdd.insertN(0, ' ', spacesBeforeComment);
                        }
                    }
                    PyFormatStd.formatComment(formatStd, strToAdd);
                }

                fReplacementString = strToAdd.toString();
                super.apply(document);
            }
        };
        props.add(proposal);
    }
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.