Skip to content

Commit

Permalink
feat: plugin component hold the plugin type
Browse files Browse the repository at this point in the history
  • Loading branch information
DropSnorz committed Jul 24, 2022
1 parent 5b2d08e commit 81c4e18
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package com.owlplug.core.controllers;

import com.jfoenix.controls.JFXButton;
import com.owlplug.core.components.CoreTaskFactory;
import com.owlplug.core.components.ImageCache;
import com.owlplug.core.model.Plugin;
import com.owlplug.core.model.PluginComponent;
Expand All @@ -46,14 +45,10 @@
@Controller
public class ComponentInfoController extends BaseController {

@Autowired
private PluginsController pluginsController;
@Autowired
private PluginService pluginService;
@Autowired
private ImageCache imageCache;
@Autowired
private CoreTaskFactory coreTaskFactory;

@FXML
private Pane pluginScreenshotPane;
Expand All @@ -76,7 +71,7 @@ public class ComponentInfoController extends BaseController {
@FXML
private PluginStateView pluginStateView;
@FXML
private Label pluginPathLabel;
private Label pluginReferenceLabel;
@FXML
private JFXButton openDirectoryButton;
private PluginComponent currentComponent = null;
Expand All @@ -93,7 +88,7 @@ public void initialize() {
openDirectoryButton.setGraphic(new ImageView(this.getApplicationDefaults().directoryImage));
openDirectoryButton.setText("");
openDirectoryButton.setOnAction(e -> {
File pluginFile = new File(pluginPathLabel.getText());
File pluginFile = new File(pluginReferenceLabel.getText());
PlatformUtils.openDirectoryExplorer(pluginFile.getParentFile());
});

Expand All @@ -110,7 +105,7 @@ public void setComponent(PluginComponent component) {
pluginIdentifierLabel.setText(Optional.ofNullable(component.getUid()).orElse("Unknown"));
pluginCategoryLabel.setText(Optional.ofNullable(component.getCategory()).orElse("Unknown"));
pluginStateView.setPluginState(pluginService.getPluginState(component.getPlugin()));
pluginPathLabel.setText(component.getPath());
pluginReferenceLabel.setText(component.getIdentifier());

setPluginImage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public class PluginComponent {
protected String category;
protected String manufacturerName;
protected String identifier;
protected String path;
protected String bundleId;
protected String version;
protected PluginType type;

@ManyToOne
private Plugin plugin;
Expand Down Expand Up @@ -103,14 +103,6 @@ public void setIdentifier(String identifier) {
this.identifier = identifier;
}

public String getPath() {
return path;
}

public void setPath(String path) {
this.path = path;
}

public String getBundleId() {
return bundleId;
}
Expand All @@ -127,11 +119,20 @@ public void setVersion(String version) {
this.version = version;
}

public PluginType getType() {
return type;
}

public void setType(PluginType type) {
this.type = type;
}

public Plugin getPlugin() {
return plugin;
}

public void setPlugin(Plugin plugin) {
this.plugin = plugin;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected TaskResult call() throws Exception {
plugin.setNativeCompatible(true);

for (NativePlugin nativePlugin : nativePlugins) {
PluginComponent component = nativePluginToPluginComponent(nativePlugin);
PluginComponent component = createComponentFromNative(nativePlugin);
component.setPlugin(plugin);
plugin.getComponents().add(component);
log.debug("Created component {} for plugin {}", component.getName(), plugin.getName());
Expand Down Expand Up @@ -215,7 +215,7 @@ protected TaskResult call() throws Exception {

}

private PluginComponent nativePluginToPluginComponent(NativePlugin nativePlugin) {
private PluginComponent createComponentFromNative(NativePlugin nativePlugin) {
PluginComponent pluginComponent = new PluginComponent();
pluginComponent.setName(nativePlugin.getName());
pluginComponent.setDescriptiveName(nativePlugin.getDescriptiveName());
Expand All @@ -225,7 +225,11 @@ private PluginComponent nativePluginToPluginComponent(NativePlugin nativePlugin)
pluginComponent.setIdentifier(nativePlugin.getFileOrIdentifier());
pluginComponent.setUid(String.valueOf(nativePlugin.getUid()));

// TODO add type : instrument or effect
if (nativePlugin.isInstrument()) {
pluginComponent.setType(PluginType.INSTRUMENT);
} else {
pluginComponent.setType(PluginType.EFFECT);
}

return pluginComponent;
}
Expand Down
4 changes: 2 additions & 2 deletions owlplug-client/src/main/resources/fxml/ComponentInfoView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
<children>
<TextFlow GridPane.columnSpan="2147483647" GridPane.rowIndex="2">
<children>
<Label text="Path: " />
<Label fx:id="pluginPathLabel" styleClass="label-emphase" text="UNKNOWN" />
<Label text="Ref: " />
<Label fx:id="pluginReferenceLabel" styleClass="label-emphase" text="UNKNOWN" />
</children>
</TextFlow>
<JFXButton fx:id="openDirectoryButton" minHeight="-Infinity" prefHeight="23.0" styleClass="label-emphase" text="Open folder">
Expand Down

0 comments on commit 81c4e18

Please sign in to comment.