Minor updates

This commit is contained in:
akshatbahety
2018-06-08 14:30:19 +05:30
parent 84f9c9db32
commit 6fe9459d1c
3 changed files with 9 additions and 9 deletions

View File

@ -34,15 +34,13 @@ public class ClasspathClassLoader extends URLClassLoader {
registerAsParallelCapable();
}
public ClasspathClassLoader(String classpath, ClassLoader parent) throws IOException {
super(initURLs(classpath), parent);
}
public ClasspathClassLoader(List<File> 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<File> 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 {

View File

@ -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());

View File

@ -76,9 +76,9 @@ public class SourceEditorController implements Initializable, SettingsOwner {
private static final Duration AST_REFRESH_DELAY = Duration.ofMillis(100);
private Var<List<File>> auxclasspathFiles = Var.newSimpleVar(Collections.emptyList());
private final Val<ClassLoader> auxclasspathClassLoader = auxclasspathFiles.map(files -> {
private final Val<ClassLoader> 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));
}