Commit 54367d6b by Jessica Hawkwell

Minor simplification, adding services support

1 parent a08f4705
Pipeline #195 passed
in 17 seconds
...@@ -219,6 +219,12 @@ public final class LangBuilder implements IStrappedApp { ...@@ -219,6 +219,12 @@ public final class LangBuilder implements IStrappedApp {
plugins.put(plugin.getName(), plugin); plugins.put(plugin.getName(), plugin);
}
@Override public void start() {
plugins.forEach((name, plugin) -> {
final String t = "plugin.".concat(name);
boolean needShowWindow = true; boolean needShowWindow = true;
if ( plugin.hasButton() ) { if ( plugin.hasButton() ) {
JButton button = plugin.getButton(); JButton button = plugin.getButton();
...@@ -259,21 +265,19 @@ public final class LangBuilder implements IStrappedApp { ...@@ -259,21 +265,19 @@ public final class LangBuilder implements IStrappedApp {
if ( plugin.hasToolBar() ) { if ( plugin.hasToolBar() ) {
JToolBar jt = plugin.getToolBar(); JToolBar jt = plugin.getToolBar();
jt.setName("plugin.".concat(plugin.getName())); jt.setName(t);
jTabbedPane.addTab(plugin.getDisplayName(), jt); jTabbedPane.addTab(plugin.getDisplayName(), jt);
needShowWindow = false; needShowWindow = false;
} }
if ( needShowWindow && plugin.hasWindow() ) { if ( needShowWindow && plugin.hasWindow() ) {
JPanel jp = plugin.getPanel(); JPanel jp = plugin.getPanel();
jp.setName("plugin.".concat(plugin.getName())); jp.setName(t);
desktop.addTab(plugin.getDisplayName(), jp); desktop.addTab(plugin.getDisplayName(), jp);
} }
} });
@Override public void start() {
jFrame.pack(); jFrame.pack();
jFrame.setVisible(true); jFrame.setVisible(true);
} }
} }
package me.felinewith.lang_toolkit.library; package me.felinewith.lang_toolkit.library;
import org.apache.commons.configuration2.Configuration;
/** /**
* *
* @author jlhawkwell * @author jlhawkwell
*/ */
public interface ILangPlugin { public abstract class ILangPlugin {
protected Configuration project;
public abstract int hasFile();
public abstract String getFileName();
} }
package me.felinewith.lang_toolkit.library; package me.felinewith.lang_toolkit.library;
import javax.swing.JComponent; import javax.swing.JComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/** /**
* *
* @author jlhawkwell * @author jlhawkwell
*/ */
public interface ILangService<T> { public abstract class ILangService<T> {
public abstract void serviceInit(); protected Logger log;
public void serviceInit() { log = LogManager.getLogger(); }
public abstract void serviceInit(T t); public abstract void serviceInit(T t);
public abstract boolean canAttach(); public abstract boolean canAttach();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!