From 6fe9459d1c9b60203772c5e84a59e0145aac7092 Mon Sep 17 00:00:00 2001 From: akshatbahety Date: Fri, 8 Jun 2018 14:30:19 +0530 Subject: [PATCH] Minor updates --- .../net/sourceforge/pmd/util/ClasspathClassLoader.java | 10 ++++------ .../pmd/util/fxdesigner/AuxClassPathController.java | 2 +- .../pmd/util/fxdesigner/SourceEditorController.java | 6 ++++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/util/ClasspathClassLoader.java b/pmd-core/src/main/java/net/sourceforge/pmd/util/ClasspathClassLoader.java index d5324bcb50..841baa81e5 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/util/ClasspathClassLoader.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/util/ClasspathClassLoader.java @@ -33,16 +33,14 @@ public class ClasspathClassLoader extends URLClassLoader { static { registerAsParallelCapable(); } - - public ClasspathClassLoader(String classpath, ClassLoader parent) throws IOException { - super(initURLs(classpath), parent); - } - public ClasspathClassLoader(List files, ClassLoader parent) throws IOException { super(fileToURL(files), parent); } + public ClasspathClassLoader(String classpath, ClassLoader parent) throws IOException { + super(initURLs(classpath), parent); + } private static URL[] fileToURL(List files) throws IOException { @@ -51,7 +49,7 @@ public class ClasspathClassLoader extends URLClassLoader { for (File f : files) { urlList.add(f.toURI().toURL()); } - return urlList.toArray(new URL[urlList.size()]); + return urlList.toArray(new URL[0]); } private static URL[] initURLs(String classpath) throws IOException { diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/AuxClassPathController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/AuxClassPathController.java index 3b3ba5aef6..059dc3b21a 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/AuxClassPathController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/AuxClassPathController.java @@ -57,7 +57,7 @@ public class AuxClassPathController implements Initializable, SettingsOwner { removeFileButton.disableProperty().bind(fileListView.getSelectionModel().selectedItemProperty().isNull()); moveItemUpButton.disableProperty().bind(fileListView.getSelectionModel().selectedItemProperty().isNull()); moveItemDownButton.disableProperty().bind(fileListView.getSelectionModel().selectedItemProperty().isNull()); - setClassPathButton.disableProperty().bind(fileListView.getSelectionModel().selectedItemProperty().isNull()); + selectFilesButton.setOnAction(e -> onSelectFileClicked()); diff --git a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java index f63a20e5e2..a390ba841b 100644 --- a/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java +++ b/pmd-ui/src/main/java/net/sourceforge/pmd/util/fxdesigner/SourceEditorController.java @@ -76,9 +76,9 @@ public class SourceEditorController implements Initializable, SettingsOwner { private static final Duration AST_REFRESH_DELAY = Duration.ofMillis(100); private Var> auxclasspathFiles = Var.newSimpleVar(Collections.emptyList()); - private final Val auxclasspathClassLoader = auxclasspathFiles.map(files -> { + private final Val auxclasspathClassLoader = auxclasspathFiles.map(fileList -> { try { - return new ClasspathClassLoader(files, SourceEditorController.class.getClassLoader()); + return new ClasspathClassLoader(fileList, SourceEditorController.class.getClassLoader()); } catch (IOException e) { e.printStackTrace(); } @@ -117,6 +117,8 @@ public class SourceEditorController implements Initializable, SettingsOwner { parent.refreshAST(); }); + auxclasspathClassLoader.changes().subscribe(t -> parent.refreshAST()); + codeEditorArea.setParagraphGraphicFactory(LineNumberFactory.get(codeEditorArea)); }