forked from phoedos/pmd
Minor Fixes
This commit is contained in:
@ -125,9 +125,7 @@ public class XPathPanelController implements Initializable, SettingsOwner {
|
|||||||
.subscribe(t -> {
|
.subscribe(t -> {
|
||||||
try {
|
try {
|
||||||
if (xpathExpressionArea.getText().contains("/")) {
|
if (xpathExpressionArea.getText().contains("/")) {
|
||||||
if (t.getInserted().equals("/")) {
|
if (!t.getInserted().equals("/")) {
|
||||||
autoComplete(xpathExpressionArea.getText().substring(xpathExpressionArea.getText().indexOf("/")));
|
|
||||||
} else {
|
|
||||||
autoComplete(xpathExpressionArea.getText().substring(xpathExpressionArea.getText().lastIndexOf("/")));
|
autoComplete(xpathExpressionArea.getText().substring(xpathExpressionArea.getText().lastIndexOf("/")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +143,7 @@ public class XPathPanelController implements Initializable, SettingsOwner {
|
|||||||
List<MenuItem> resultToDisplay = new ArrayList<>();
|
List<MenuItem> resultToDisplay = new ArrayList<>();
|
||||||
|
|
||||||
String language = parent.getLanguageVersion().getName().replaceAll("[0-9]", "").replaceAll("//s", "").toLowerCase().trim();
|
String language = parent.getLanguageVersion().getName().replaceAll("[0-9]", "").replaceAll("//s", "").toLowerCase().trim();
|
||||||
XPathSuggestions xPathSuggestions = new XPathSuggestions("net.sourceforge.pmd.lang." + language + ".ast");
|
XPathSuggestions xPathSuggestions = new XPathSuggestions(language);
|
||||||
|
|
||||||
List<String> suggestions = xPathSuggestions.getXPathSuggestions();
|
List<String> suggestions = xPathSuggestions.getXPathSuggestions();
|
||||||
for (String s1 : suggestions) {
|
for (String s1 : suggestions) {
|
||||||
@ -171,7 +169,6 @@ public class XPathPanelController implements Initializable, SettingsOwner {
|
|||||||
xpathExpressionArea.insertText(xpathExpressionArea.getCaretPosition(), ((MenuItem) e.getTarget()).getText().replace(temp.get(temp.size() - 1)
|
xpathExpressionArea.insertText(xpathExpressionArea.getCaretPosition(), ((MenuItem) e.getTarget()).getText().replace(temp.get(temp.size() - 1)
|
||||||
.replace("/", "").trim(), "").trim());
|
.replace("/", "").trim(), "").trim());
|
||||||
autoCompletePopup.hide();
|
autoCompletePopup.hide();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -17,10 +17,12 @@ import java.util.List;
|
|||||||
|
|
||||||
public class XPathSuggestions {
|
public class XPathSuggestions {
|
||||||
private List<String> xPathSuggestions = new ArrayList<>();
|
private List<String> xPathSuggestions = new ArrayList<>();
|
||||||
String packagename;
|
private String packagename;
|
||||||
|
private String language;
|
||||||
|
|
||||||
public XPathSuggestions(String packageName) {
|
public XPathSuggestions(String language) {
|
||||||
this.packagename = packageName;
|
this.packagename = "net.sourceforge.pmd.lang." + language + ".ast";
|
||||||
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +89,6 @@ public class XPathSuggestions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<String> evaluateXpathSuggestions(List<String> fileNameList) {
|
private List<String> evaluateXpathSuggestions(List<String> fileNameList) {
|
||||||
String language = packagename.replace("net.sourceforge.pmd.lang.", "").replace(".ast", "").trim();
|
|
||||||
for (String s : fileNameList) {
|
for (String s : fileNameList) {
|
||||||
xPathSuggestions.add(s.replace("AST", "").replace("." + language, "").replace("net.sourceforge.pmd.lang.ast" + ".", "")); }
|
xPathSuggestions.add(s.replace("AST", "").replace("." + language, "").replace("net.sourceforge.pmd.lang.ast" + ".", "")); }
|
||||||
return xPathSuggestions;
|
return xPathSuggestions;
|
||||||
|
Reference in New Issue
Block a user