mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Inverted MVC logic on installer to get a cleaner code.
Part of the control logic was moved from listeners to GUI class methods. This goes against a pure MVC but makes the code much more cleaner.
This commit is contained in:
committed by
Federico Fissore
parent
cf058c37ba
commit
5d1e4e3f70
@ -48,15 +48,16 @@ import com.fasterxml.jackson.module.mrbean.MrBeanModule;
|
||||
|
||||
public class ContributionsIndexer {
|
||||
|
||||
private File preferencesFolder;
|
||||
private File packagesFolder;
|
||||
private File stagingFolder;
|
||||
private File indexFile;
|
||||
private ContributionsIndex index;
|
||||
|
||||
public ContributionsIndexer(File _preferencesFolder) {
|
||||
preferencesFolder = _preferencesFolder;
|
||||
public ContributionsIndexer(File preferencesFolder) {
|
||||
packagesFolder = new File(preferencesFolder, "packages");
|
||||
stagingFolder = new File(preferencesFolder, "staging");
|
||||
stagingFolder = new File(preferencesFolder, "staging" + File.separator +
|
||||
"packages");
|
||||
indexFile = new File(preferencesFolder, "package_index.json");
|
||||
}
|
||||
|
||||
// public static void main(String args[]) throws Exception {
|
||||
@ -75,7 +76,7 @@ public class ContributionsIndexer {
|
||||
|
||||
public void parseIndex() throws JsonParseException, IOException {
|
||||
// Parse index file
|
||||
parseIndex(new File(preferencesFolder, "package_index.json"));
|
||||
parseIndex(indexFile);
|
||||
|
||||
List<ContributedPackage> packages = index.getPackages();
|
||||
for (ContributedPackage pack : packages) {
|
||||
@ -224,10 +225,6 @@ public class ContributionsIndexer {
|
||||
return index;
|
||||
}
|
||||
|
||||
public File getPreferencesFolder() {
|
||||
return preferencesFolder;
|
||||
}
|
||||
|
||||
public File getPackagesFolder() {
|
||||
return packagesFolder;
|
||||
}
|
||||
@ -236,4 +233,8 @@ public class ContributionsIndexer {
|
||||
return stagingFolder;
|
||||
}
|
||||
|
||||
public File getIndexFile() {
|
||||
return indexFile;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -586,6 +586,9 @@ public class BaseNoGui {
|
||||
|
||||
static public void initPackages() throws Exception {
|
||||
indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
||||
if (!indexer.getIndexFile().isFile())
|
||||
// TODO: run first setup
|
||||
;
|
||||
indexer.parseIndex();
|
||||
indexer.syncWithFilesystem();
|
||||
System.out.println(indexer);
|
||||
|
Reference in New Issue
Block a user