Fix names

This commit is contained in:
Clément Fournier 2019-01-24 00:54:49 +01:00
parent 3de2d87abf
commit 50f67945bb
3 changed files with 15 additions and 16 deletions

View File

@ -73,7 +73,7 @@ public class SourceEditorController extends AbstractController {
@FXML
private HighlightLayerCodeArea<StyleLayerIds> codeEditorArea;
@FXML
private NodeParentageCrumbBar focusNodeParentageBreadCrumbBar;
private NodeParentageCrumbBar focusNodeParentageCrumbBar;
private final ASTManager astManager;
@ -142,7 +142,7 @@ public class SourceEditorController extends AbstractController {
DesignerUtil.rewire(astManager.languageVersionProperty(), languageVersionUIProperty);
// Focus the crumb
focusNodeParentageBreadCrumbBar.setOnRegularCrumbAction(treeitem -> {
focusNodeParentageCrumbBar.setOnRegularCrumbAction(treeitem -> {
if (treeitem != null && treeitem.getValue() != null) {
astTreeView.focusNode(treeitem.getValue());
}

View File

@ -17,7 +17,6 @@ import net.sourceforge.pmd.lang.Parser;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.util.fxdesigner.DesignerRoot;
import net.sourceforge.pmd.util.fxdesigner.model.LogEntry.Category;
import net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil;
/**
@ -29,14 +28,7 @@ import net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil;
public class ASTManager {
private final DesignerRoot designerRoot;
/**
* Most up-to-date compilation unit. Is null if the current source cannot be parsed.
*/
private final Var<Node> compilationUnit = Var.newSimpleVar(null);
/**
* Selected language version.
*/
private final Var<LanguageVersion> languageVersion = Var.newSimpleVar(LanguageRegistry.getDefaultLanguage().getDefaultVersion());
/**
* Last valid source that was compiled, corresponds to {@link #compilationUnit}.
*/
@ -45,6 +37,14 @@ public class ASTManager {
* Last language version used.
*/
private LanguageVersion lastLanguageVersion;
/**
* Most up-to-date compilation unit. Is null if the current source cannot be parsed.
*/
private final Var<Node> compilationUnit = Var.newSimpleVar(null);
/**
* Selected language version.
*/
private final Var<LanguageVersion> languageVersion = Var.newSimpleVar(LanguageRegistry.getDefaultLanguage().getDefaultVersion());
public ASTManager(DesignerRoot owner) {
@ -53,8 +53,7 @@ public class ASTManager {
public LanguageVersion getLanguageVersion() {
LanguageVersion ver = languageVersion.getValue();
return ver == null ? DesignerUtil.defaultLanguageVersion() : ver;
return languageVersion.getValue();
}
@ -82,8 +81,8 @@ public class ASTManager {
*/
public Optional<Node> updateIfChanged(String source, ClassLoader classLoader) throws ParseAbortedException {
if (compilationUnit.isPresent()
&& getLanguageVersion().equals(lastLanguageVersion)
&& StringUtils.equals(source, lastValidSource)) {
&& getLanguageVersion().equals(lastLanguageVersion)
&& StringUtils.equals(source, lastValidSource)) {
return getCompilationUnit();
}
LanguageVersionHandler languageVersionHandler = getLanguageVersion().getLanguageVersionHandler();

View File

@ -80,7 +80,7 @@
</SplitPane>
</center>
<bottom>
<NodeParentageCrumbBar fx:id="focusNodeParentageBreadCrumbBar"
<NodeParentageCrumbBar fx:id="focusNodeParentageCrumbBar"
stylesheets="@../css/crumbbar.css"
prefHeight="30" id="main-toolbar" />
</bottom>