mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-27 15:03:21 -04:00
added an experimental library path
This commit is contained in:
parent
9755e42d75
commit
9baf1a5b82
@ -45,6 +45,21 @@ import java.util.*;
|
|||||||
public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer> {
|
public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer> {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ElementLibrary.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ElementLibrary.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the additional library path
|
||||||
|
*/
|
||||||
|
public static String getLibPath() {
|
||||||
|
String path = ElementLibrary.class.getProtectionDomain().getCodeSource().getLocation().getPath().replace('\\', '/');
|
||||||
|
if (path.endsWith("/target/classes/"))
|
||||||
|
return path.substring(0, path.length() - 16) + "/src/main/dig/lib";
|
||||||
|
if (path.endsWith("/target/Digital.jar"))
|
||||||
|
return path.substring(0, path.length() - 19) + "/src/main/dig/lib";
|
||||||
|
if (path.endsWith("Digital.jar"))
|
||||||
|
return path.substring(0, path.length() - 12) + "/examples/lib";
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private final HashMap<String, LibraryNode> map = new HashMap<>();
|
private final HashMap<String, LibraryNode> map = new HashMap<>();
|
||||||
private final HashSet<String> isProgrammable = new HashSet<>();
|
private final HashSet<String> isProgrammable = new HashSet<>();
|
||||||
private final ArrayList<LibraryListener> listeners = new ArrayList<>();
|
private final ArrayList<LibraryListener> listeners = new ArrayList<>();
|
||||||
@ -276,6 +291,7 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
|||||||
|
|
||||||
private void rescanFolder() throws IOException {
|
private void rescanFolder() throws IOException {
|
||||||
LOGGER.debug("rescan folder");
|
LOGGER.debug("rescan folder");
|
||||||
|
LOGGER.info("library " + getLibPath());
|
||||||
LibraryNode changedNode = null;
|
LibraryNode changedNode = null;
|
||||||
if (rootLibraryPath != null) {
|
if (rootLibraryPath != null) {
|
||||||
if (customNode == null) {
|
if (customNode == null) {
|
||||||
@ -311,7 +327,7 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
|||||||
l.libraryChanged(node);
|
l.libraryChanged(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int scanFolder(File path, LibraryNode node) {
|
private static int scanFolder(File path, LibraryNode node) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
File[] list = path.listFiles();
|
File[] list = path.listFiles();
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
|
@ -234,7 +234,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
getContentPane().add(toolBar, BorderLayout.NORTH);
|
getContentPane().add(toolBar, BorderLayout.NORTH);
|
||||||
|
|
||||||
setJMenuBar(menuBar);
|
setJMenuBar(menuBar);
|
||||||
JMenu help = InfoDialog.getInstance().addToFrame(this, MESSAGE);
|
JMenu help = InfoDialog.getInstance().addToFrame(this, MESSAGE+"\n\nlib: "+ElementLibrary.getLibPath());
|
||||||
help.add(new ToolTipAction(Lang.get("menu_help_elements")) {
|
help.add(new ToolTipAction(Lang.get("menu_help_elements")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user