Package data

Examples of data.SearchResult


    public Object getValueAt(int rowIndex, int columnIndex) {
        if (rowIndex >= results.size() || rowIndex < 0) {
            throw new IllegalArgumentException(String.format("Row out of bounds! (Items: %d, Row: %d)", results.size(), rowIndex));
        }

        SearchResult searchResult = get(rowIndex);
        Object value = null;
        switch (columnIndex) {
            case COL_FILENAME:
                value = searchResult.getFileName();
                break;
            case COL_FILEPATH:
                value = searchResult.getPath();
                break;
            case COL_FILESIZE:
                value = searchResult.getSize();
                break;
            case COL_FILETYPE:
                value = searchResult.getFileType();
                break;
            case COL_LASTCHANGE:
                value = searchResult.getLastChange();
                break;
            default:
                log(ERROR, "Invalid column-id <" + columnIndex + ">!");
                throw new IllegalArgumentException(String.format("Invalid column %d!", columnIndex));
        }
View Full Code Here


        }
        return false;
    }

    private void findMatches() {
        SearchResult result = null;
        int matchCount = 0;

        results.clear();

        for (File f : foundFiles) {
            if (!running) {
                break;
            }
            enteredDirectory(f.getAbsolutePath());
            result = new SearchResult(f);

            matchFile(f, result);

            if (result.getMatchCount() > 0) {

                results.add(result);
                matchCount += result.getMatchCount();
                foundMatch(result, matchCount, results.size());
            }

        }
    }
View Full Code Here

    private void onPopUpCopy(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onPopUpCopy
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(resultModel.get(taResults.getSelectedRow()).getAbsoluteFilePath()), null);
    }//GEN-LAST:event_onPopUpCopy

    private void onPopUpOpenInFolder(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onPopUpOpenInFolder
        SearchResult result = resultModel.get(taResults.getSelectedRow());
        File fileToShow = new File(result.getPath());
        if (!fileToShow.exists()) {
            return;
        }

        try {
View Full Code Here

            log(LogLevel.ERROR, ex);
        }
    }//GEN-LAST:event_onPopUpOpenInFolder

    private void onPopUpOpen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onPopUpOpen
        SearchResult result = resultModel.get(taResults.getSelectedRow());
        File fileToShow = new File(result.getAbsoluteFilePath());
        if (!fileToShow.exists()) {
            return;
        }

        try {
View Full Code Here

        }
    }

    @Override
    public void valueChanged(ListSelectionEvent e) {
        SearchResult result = null;
        Document doc = staCode.getDocument();
        boolean firstRun = true;
        int offset = 0;
        String linePrefix = "";

        if (taResults.getSelectedRow() >= resultModel.getRowCount() || taResults.getSelectedRow() < 0) {
            return;
        }

        result = resultModel.get(taResults.getSelectedRow());

        staCode.setSyntaxEditingStyle(result.getSyntaxStyle());

        try {
            resetSyntaxTable();

            for (LineMatch match : result.getMatches()) {
                for (Line line : match.getLines()) {
                    offset = firstRun ? doc.getStartPosition().getOffset() : doc.getEndPosition().getOffset();
                    linePrefix = firstRun ? "" : "\n";

                    doc.insertString(offset,
                            String.format("%-5d\t", line.getLineNumber()) + line.getLine() + linePrefix, null);
                    firstRun = false;
                }
                //Add Separator
                if (result.getMatchCount() > 1) //if more than one matches
                {
                    String matchSeparator = "";
                    offset = firstRun ? doc.getStartPosition().getOffset() : doc.getEndPosition().getOffset();
                    linePrefix = firstRun ? "" : "\n";
View Full Code Here

TOP

Related Classes of data.SearchResult

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.