From 8bf981d31d6dbc13cc3ddf9faaa1a5b274a76d6e Mon Sep 17 00:00:00 2001 From: Arthur Poiret Date: Fri, 22 Jul 2022 19:58:40 +0200 Subject: [PATCH] style: fix code style issues --- .../controllers/PluginInfoController.java | 7 +++++- .../core/controllers/PluginsController.java | 22 ++++++++---------- .../java/com/owlplug/core/model/Plugin.java | 14 +++++++++-- .../owlplug/core/model/PluginComponent.java | 9 ++++++-- .../owlplug/core/tasks/PluginSyncTask.java | 23 ++++++++++++------- .../com/owlplug/core/ui/PluginTreeCell.java | 15 +++++++----- 6 files changed, 59 insertions(+), 31 deletions(-) diff --git a/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginInfoController.java b/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginInfoController.java index 1fe435e9..7e30c108 100644 --- a/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginInfoController.java +++ b/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginInfoController.java @@ -18,7 +18,12 @@ package com.owlplug.core.controllers; -import com.jfoenix.controls.*; +import com.jfoenix.controls.JFXButton; +import com.jfoenix.controls.JFXCheckBox; +import com.jfoenix.controls.JFXDialog; +import com.jfoenix.controls.JFXDialogLayout; +import com.jfoenix.controls.JFXListView; +import com.jfoenix.controls.JFXToggleButton; import com.owlplug.core.components.ApplicationDefaults; import com.owlplug.core.components.CoreTaskFactory; import com.owlplug.core.components.ImageCache; diff --git a/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginsController.java b/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginsController.java index 6c211d90..ec74bcf2 100644 --- a/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginsController.java +++ b/owlplug-client/src/main/java/com/owlplug/core/controllers/PluginsController.java @@ -29,10 +29,14 @@ import com.owlplug.core.controllers.dialogs.NewLinkController; import com.owlplug.core.dao.PluginDAO; import com.owlplug.core.dao.SymlinkDAO; -import com.owlplug.core.model.*; +import com.owlplug.core.model.IDirectory; +import com.owlplug.core.model.Plugin; +import com.owlplug.core.model.PluginComponent; +import com.owlplug.core.model.PluginDirectory; +import com.owlplug.core.model.Symlink; import com.owlplug.core.services.PluginService; -import com.owlplug.core.ui.PluginTreeCell; import com.owlplug.core.ui.FilterableTreeItem; +import com.owlplug.core.ui.PluginTreeCell; import com.owlplug.core.utils.FileUtils; import java.util.ArrayList; import java.util.HashMap; @@ -192,7 +196,7 @@ public void clearAndFillPluginTree() { // Display subcomponents in the plugin tree if (plugin.getComponents().size() > 1) { - for(PluginComponent component : plugin.getComponents()) { + for (PluginComponent component : plugin.getComponents()) { FilterableTreeItem compItem = new FilterableTreeItem<>(component); item.getInternalChildren().add(compItem); } @@ -211,27 +215,21 @@ public void clearAndFillPluginTree() { && !prefs.get(ApplicationDefaults.VST_DIRECTORY_KEY, "").isBlank()) { String path = prefs.get(ApplicationDefaults.VST_DIRECTORY_KEY, ""); userPluginDirectories.add(FileUtils.convertPath(path)); - for(String extraDirectory : prefs.getList(ApplicationDefaults.VST2_EXTRA_DIRECTORY_KEY)) { - userPluginDirectories.add(extraDirectory); - } + userPluginDirectories.addAll(prefs.getList(ApplicationDefaults.VST2_EXTRA_DIRECTORY_KEY)); } if (prefs.getBoolean(ApplicationDefaults.VST3_DISCOVERY_ENABLED_KEY, false) && !prefs.get(ApplicationDefaults.VST3_DIRECTORY_KEY, "").isBlank()) { String path = prefs.get(ApplicationDefaults.VST3_DIRECTORY_KEY, ""); userPluginDirectories.add(FileUtils.convertPath(path)); - for(String extraDirectory : prefs.getList(ApplicationDefaults.VST3_EXTRA_DIRECTORY_KEY)) { - userPluginDirectories.add(extraDirectory); - } + userPluginDirectories.addAll(prefs.getList(ApplicationDefaults.VST3_EXTRA_DIRECTORY_KEY)); } if (prefs.getBoolean(ApplicationDefaults.AU_DISCOVERY_ENABLED_KEY, false) && !prefs.get(ApplicationDefaults.AU_DIRECTORY_KEY, "").isBlank()) { String path = prefs.get(ApplicationDefaults.AU_DIRECTORY_KEY, ""); userPluginDirectories.add(FileUtils.convertPath(path)); - for(String extraDirectory : prefs.getList(ApplicationDefaults.AU_EXTRA_DIRECTORY_KEY)) { - userPluginDirectories.add(extraDirectory); - } + userPluginDirectories.addAll(prefs.getList(ApplicationDefaults.AU_EXTRA_DIRECTORY_KEY)); } for (String directory : userPluginDirectories) { diff --git a/owlplug-client/src/main/java/com/owlplug/core/model/Plugin.java b/owlplug-client/src/main/java/com/owlplug/core/model/Plugin.java index dcb48fc4..6940a6c8 100644 --- a/owlplug-client/src/main/java/com/owlplug/core/model/Plugin.java +++ b/owlplug-client/src/main/java/com/owlplug/core/model/Plugin.java @@ -18,10 +18,20 @@ package com.owlplug.core.model; -import com.owlplug.store.model.ProductTag; import java.util.HashSet; import java.util.Set; -import javax.persistence.*; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.Inheritance; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.Table; @Entity @Inheritance diff --git a/owlplug-client/src/main/java/com/owlplug/core/model/PluginComponent.java b/owlplug-client/src/main/java/com/owlplug/core/model/PluginComponent.java index 8e0fa122..4074db6d 100644 --- a/owlplug-client/src/main/java/com/owlplug/core/model/PluginComponent.java +++ b/owlplug-client/src/main/java/com/owlplug/core/model/PluginComponent.java @@ -1,7 +1,12 @@ package com.owlplug.core.model; -import com.owlplug.store.model.StoreProduct; -import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.ManyToOne; +import javax.persistence.Table; @Entity @Table(indexes = { @Index(name = "IDX_PLUGIN_COMPONENT_ID", columnList = "id") }) diff --git a/owlplug-client/src/main/java/com/owlplug/core/tasks/PluginSyncTask.java b/owlplug-client/src/main/java/com/owlplug/core/tasks/PluginSyncTask.java index f049c79f..83309d74 100644 --- a/owlplug-client/src/main/java/com/owlplug/core/tasks/PluginSyncTask.java +++ b/owlplug-client/src/main/java/com/owlplug/core/tasks/PluginSyncTask.java @@ -21,15 +21,22 @@ import com.owlplug.core.dao.PluginDAO; import com.owlplug.core.dao.PluginFootprintDAO; import com.owlplug.core.dao.SymlinkDAO; -import com.owlplug.core.model.*; +import com.owlplug.core.model.Plugin; +import com.owlplug.core.model.PluginComponent; +import com.owlplug.core.model.PluginFootprint; +import com.owlplug.core.model.PluginFormat; +import com.owlplug.core.model.PluginType; +import com.owlplug.core.model.Symlink; import com.owlplug.core.services.NativeHostService; import com.owlplug.core.tasks.plugins.discovery.PluginFileCollector; import com.owlplug.core.tasks.plugins.discovery.PluginSyncTaskParameters; import com.owlplug.core.tasks.plugins.discovery.SymlinkCollector; import com.owlplug.core.tasks.plugins.discovery.fileformats.PluginFile; import com.owlplug.host.NativePlugin; -import java.util.*; - +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -121,7 +128,7 @@ protected TaskResult call() throws Exception { if (parameters.isFindVst2()) { collectedPluginFiles.addAll(pluginCollector.collect(vst2Directory, PluginFormat.VST2)); collectedSymlinks.addAll(symlinkCollector.collect(vst2Directory)); - for(String path : parameters.getVst2ExtraDirectories()) { + for (String path : parameters.getVst2ExtraDirectories()) { collectedPluginFiles.addAll(pluginCollector.collect(path, PluginFormat.VST2)); collectedSymlinks.addAll(symlinkCollector.collect(path)); } @@ -129,7 +136,7 @@ protected TaskResult call() throws Exception { if (parameters.isFindVst3()) { collectedPluginFiles.addAll(pluginCollector.collect(vst3Directory, PluginFormat.VST3)); collectedSymlinks.addAll(symlinkCollector.collect(vst3Directory)); - for(String path : parameters.getVst3ExtraDirectories()) { + for (String path : parameters.getVst3ExtraDirectories()) { collectedPluginFiles.addAll(pluginCollector.collect(path, PluginFormat.VST3)); collectedSymlinks.addAll(symlinkCollector.collect(path)); } @@ -137,7 +144,7 @@ protected TaskResult call() throws Exception { if (parameters.isFindAu()) { collectedPluginFiles.addAll(pluginCollector.collect(auDirectory, PluginFormat.AU)); collectedSymlinks.addAll(symlinkCollector.collect(auDirectory)); - for(String path : parameters.getAuExtraDirectories()) { + for (String path : parameters.getAuExtraDirectories()) { collectedPluginFiles.addAll(pluginCollector.collect(path, PluginFormat.AU)); collectedSymlinks.addAll(symlinkCollector.collect(path)); } @@ -173,7 +180,7 @@ protected TaskResult call() throws Exception { plugin.setNativeCompatible(true); - for(NativePlugin nativePlugin : nativePlugins) { + for (NativePlugin nativePlugin : nativePlugins) { PluginComponent component = nativePluginToPluginComponent(nativePlugin); component.setPlugin(plugin); plugin.getComponents().add(component); @@ -192,7 +199,7 @@ protected TaskResult call() throws Exception { this.commitProgress(80.0 / collectedPluginFiles.size()); } - + this.updateProgress(1, 1); this.updateMessage("Plugins synchronized"); log.info("Plugin Sync task complete"); diff --git a/owlplug-client/src/main/java/com/owlplug/core/ui/PluginTreeCell.java b/owlplug-client/src/main/java/com/owlplug/core/ui/PluginTreeCell.java index 654d75f8..39275a3d 100644 --- a/owlplug-client/src/main/java/com/owlplug/core/ui/PluginTreeCell.java +++ b/owlplug-client/src/main/java/com/owlplug/core/ui/PluginTreeCell.java @@ -20,7 +20,12 @@ import com.jfoenix.controls.JFXTreeCell; import com.owlplug.core.components.ApplicationDefaults; -import com.owlplug.core.model.*; +import com.owlplug.core.model.IDirectory; +import com.owlplug.core.model.Plugin; +import com.owlplug.core.model.PluginComponent; +import com.owlplug.core.model.PluginDirectory; +import com.owlplug.core.model.PluginState; +import com.owlplug.core.model.Symlink; import com.owlplug.core.services.PluginService; import javafx.geometry.Pos; import javafx.scene.Node; @@ -36,7 +41,7 @@ public class PluginTreeCell extends JFXTreeCell { private PluginService pluginService; private ApplicationDefaults applicationDefaults; - public PluginTreeCell(ApplicationDefaults applicationDefaults, PluginService pluginService){ + public PluginTreeCell(ApplicationDefaults applicationDefaults, PluginService pluginService) { this.applicationDefaults = applicationDefaults; this.pluginService = pluginService; } @@ -53,7 +58,7 @@ public void updateItem(Object item, boolean empty) { if (item instanceof Plugin) { renderPlugin((Plugin) item); } else if (item instanceof PluginComponent) { - renderComponent((PluginComponent) item ); + renderComponent((PluginComponent) item); } else if (item instanceof IDirectory) { renderDirectory((IDirectory) item); } else { @@ -99,7 +104,6 @@ private void renderPlugin(Plugin plugin) { private void renderComponent(PluginComponent pluginComponent) { - Label label = new Label(pluginComponent.getName()); label.setGraphic(new ImageView(applicationDefaults.pluginComponentImage)); setGraphic(label); @@ -130,7 +134,7 @@ private void renderDirectory(IDirectory dir) { textFlow.getChildren().add(directoryName); Node icon; - if(dir instanceof Symlink) { + if (dir instanceof Symlink) { icon = new ImageView(applicationDefaults.symlinkImage); } else if (dir instanceof PluginDirectory pluginDirectory) { if (pluginDirectory.isRootDirectory()) { @@ -149,5 +153,4 @@ private void renderDirectory(IDirectory dir) { setText(null); } - }