Example usage for javax.swing Timer getClass

List of usage examples for javax.swing Timer getClass

Introduction

In this page you can find the example usage for javax.swing Timer getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:net.sourceforge.pmd.cpd.GUI.java

private void go() {
    try {//from  ww  w.  j  a va  2  s  . co m
        File dirPath = new File(rootDirectoryField.getText());
        if (!dirPath.exists()) {
            JOptionPane.showMessageDialog(frame, "Can't read from that root source directory", "Error",
                    JOptionPane.ERROR_MESSAGE);
            return;
        }

        setProgressControls(true);

        Properties p = new Properties();
        CPDConfiguration config = new CPDConfiguration();
        config.setMinimumTileSize(Integer.parseInt(minimumLengthField.getText()));
        config.setEncoding(encodingField.getText());
        config.setIgnoreIdentifiers(ignoreIdentifiersCheckbox.isSelected());
        config.setIgnoreLiterals(ignoreLiteralsCheckbox.isSelected());
        config.setIgnoreAnnotations(ignoreAnnotationsCheckbox.isSelected());
        config.setIgnoreUsings(ignoreUsingsCheckbox.isSelected());
        p.setProperty(LanguageFactory.EXTENSION, extensionField.getText());

        LanguageConfig conf = languageConfigFor((String) languageBox.getSelectedItem());
        Language language = conf.languageFor(p);
        config.setLanguage(language);

        CPDConfiguration.setSystemProperties(config);

        CPD cpd = new CPD(config);
        cpd.setCpdListener(this);
        tokenizingFilesBar.setMinimum(0);
        phaseLabel.setText("");
        if (isLegalPath(dirPath.getPath(), conf)) { // should use the
            // language file filter
            // instead?
            cpd.add(dirPath);
        } else {
            if (recurseCheckbox.isSelected()) {
                cpd.addRecursively(dirPath);
            } else {
                cpd.addAllInDirectory(dirPath);
            }
        }
        Timer t = createTimer();
        t.start();
        cpd.go();
        t.stop();

        matches = new ArrayList<>();
        for (Iterator<Match> i = cpd.getMatches(); i.hasNext();) {
            Match match = i.next();
            setLabelFor(match);
            matches.add(match);
        }

        setListDataFrom(matches);
        String report = new SimpleRenderer().render(cpd.getMatches());
        if (report.length() == 0) {
            JOptionPane.showMessageDialog(frame, "Done. Couldn't find any duplicates longer than "
                    + minimumLengthField.getText() + " tokens");
        } else {
            resultsTextArea.setText(report);
        }
    } catch (IOException t) {
        t.printStackTrace();
        JOptionPane.showMessageDialog(frame, "Halted due to " + t.getClass().getName() + "; " + t.getMessage());
    } catch (RuntimeException t) {
        t.printStackTrace();
        JOptionPane.showMessageDialog(frame, "Halted due to " + t.getClass().getName() + "; " + t.getMessage());
    }
    setProgressControls(false);
}