@Override public void actionPerformed(ActionEvent ae) { LanguageVersion languageVersion = getLanguageVersion(); DFAGraphRule dfaGraphRule = languageVersion.getLanguageVersionHandler().getDFAGraphRule(); if (dfaGraphRule != null) { final RuleSet rs = new RuleSetFactory().createSingleRuleRuleSet(dfaGraphRule); RuleContext ctx = new RuleContext(); ctx.setSourceCodeFilename("[no filename]." + languageVersion.getLanguage().getExtensions().get(0)); StringReader reader = new StringReader(codeEditorPane.getText()); PMDConfiguration config = new PMDConfiguration(); config.setDefaultLanguageVersion(languageVersion); try { new SourceCodeProcessor(config).processSourceCode(reader, new RuleSets(rs), ctx); // } catch (PMDException pmde) { // loadTreeData(new ExceptionNode(pmde)); } catch (Exception e) { e.printStackTrace(); } List<DFAGraphMethod> methods = dfaGraphRule.getMethods(); if (methods != null && !methods.isEmpty()) { dfaPanel.resetTo(methods, codeEditorPane); dfaPanel.repaint(); } } } }
@Override public void actionPerformed(ActionEvent ae) { LanguageVersion languageVersion = getLanguageVersion(); DFAGraphRule dfaGraphRule = languageVersion.getLanguageVersionHandler().getDFAGraphRule(); if (dfaGraphRule != null) { final RuleSet rs = new RuleSetFactory().createSingleRuleRuleSet(dfaGraphRule); RuleContext ctx = new RuleContext(); ctx.setSourceCodeFilename("[no filename]." + languageVersion.getLanguage().getExtensions().get(0)); StringReader reader = new StringReader(codeEditorPane.getText()); PMDConfiguration config = new PMDConfiguration(); config.setDefaultLanguageVersion(languageVersion); try { new SourceCodeProcessor(config).processSourceCode(reader, new RuleSets(rs), ctx); // } catch (PMDException pmde) { // loadTreeData(new ExceptionNode(pmde)); } catch (Exception e) { e.printStackTrace(); } List<DFAGraphMethod> methods = dfaGraphRule.getMethods(); if (methods != null && !methods.isEmpty()) { dfaPanel.resetTo(methods, codeEditorPane); dfaPanel.repaint(); } } } }