Use database icon for custom Presets instead of the generic "Run Script" icon
This commit is contained in:
parent
c960fd85a7
commit
76838cb1ba
|
@ -11,6 +11,8 @@ import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
|
||||||
import net.filebot.CachedResource.Transform;
|
import net.filebot.CachedResource.Transform;
|
||||||
import net.filebot.Language;
|
import net.filebot.Language;
|
||||||
import net.filebot.StandardRenameAction;
|
import net.filebot.StandardRenameAction;
|
||||||
|
@ -84,6 +86,10 @@ public class Preset {
|
||||||
return getValue(database, id -> getService(id, getSupportedServices()));
|
return getValue(database, id -> getService(id, getSupportedServices()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Icon getIcon() {
|
||||||
|
return getValue(database, id -> getService(id, getSupportedServices()).getIcon());
|
||||||
|
}
|
||||||
|
|
||||||
private <T> T getValue(String s, Transform<String, T> t) {
|
private <T> T getValue(String s, Transform<String, T> t) {
|
||||||
try {
|
try {
|
||||||
return s == null || s.isEmpty() ? null : t.transform(s);
|
return s == null || s.isEmpty() ? null : t.transform(s);
|
||||||
|
|
|
@ -688,7 +688,7 @@ public class RenamePanel extends JComponent {
|
||||||
private Preset preset;
|
private Preset preset;
|
||||||
|
|
||||||
public ApplyPresetAction(Preset preset) {
|
public ApplyPresetAction(Preset preset) {
|
||||||
super(preset.getName(), preset.getDatasource().getIcon(), preset::getAutoCompleteMatcher);
|
super(preset.getName(), preset.getIcon(), preset::getAutoCompleteMatcher);
|
||||||
this.preset = preset;
|
this.preset = preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue