Merge from DG fork (#58)

* Plugin Help

Small change to Help system so that plugins under development can more
easily display their help

* PamModel update

Notes on how to add a plugin to the model during the plugin development
phase.
This commit is contained in:
Douglas Gillespie 2022-09-20 17:34:30 +01:00 committed by GitHub
parent eb176a4568
commit 6aefbc124b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 16 deletions

View File

@ -6,9 +6,8 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/AdoptOpenJDK 16"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>

View File

@ -1069,6 +1069,22 @@ final public class PamModel implements PamModelInterface, PamSettings {
pluginList.clear(); pluginList.clear();
daqList.clear(); daqList.clear();
/*
* If developing a new PAMPlugin in eclipse, the easiest way to do it is to make a new
* Eclipse project for your plugin code. Within that project, copy this PamModel class
* and put it into a package with exactly the same name within your new project (i.e. PamModel)
* then add a line to the copy of this class to explicitly add the class name of your new
* plugin, e.g.
pluginList.add(new CollatorPlugin());
* The plugin information will then be extracted from the PamPluginInterface in the same way as
* it would should it be being used as a real plugin, inclusing help information which will be
* added to the PAMGuard help
*
* When you export the code for your plugin to a jar file, remember to NOT inlcude the copy of
* PamModel !
*/
// Load up whatever default classloader was used to create this class. Must use the same classloader // Load up whatever default classloader was used to create this class. Must use the same classloader
// for all plugins, or else we will not be able to create proper dependencies between them or be able // for all plugins, or else we will not be able to create proper dependencies between them or be able
// to save properties in the psf file. Found this problem because ipiDemo requires the // to save properties in the psf file. Found this problem because ipiDemo requires the

View File

@ -376,8 +376,18 @@ public class PamHelp {
// set up a URL to point to the helpset file inside the jar // set up a URL to point to the helpset file inside the jar
try { try {
//URL helpSetLoc = new URL("jar:file:\\C:\\Users\\SCANS\\workspace\\Pamguard_MikeBranch\\plugins\\TestPlugin.jar!/TestPlugin/PluginHelp.hs"); this one worked - passed argument should match //URL helpSetLoc = new URL("jar:file:\\C:\\Users\\SCANS\\workspace\\Pamguard_MikeBranch\\plugins\\TestPlugin.jar!/TestPlugin/PluginHelp.hs"); this one worked - passed argument should match
URL helpSetLoc = new URL("jar:file:" + File.separator + pluginList.get(i).getJarFile()+"!/"+pluginList.get(i).getHelpSetName()); String pluginJar = pluginList.get(i).getJarFile();
addPluginHelpSet(helpSetLoc); URL helpSetLoc;
if (pluginJar != null) {
helpSetLoc = new URL("jar:file:" + File.separator + pluginList.get(i).getJarFile()+"!/"+pluginList.get(i).getHelpSetName());
addPluginHelpSet(helpSetLoc);
}
else {
// this used when developing plugins and they are not actually in a jar file yet, rather they
// have just been manually added to the list of available plugins.
String hsN = pluginList.get(i).getHelpSetName();
addHelpSet(hsN);
}
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
System.err.println("Error generating URL for help set " + pluginList.get(i).getHelpSetName()); System.err.println("Error generating URL for help set " + pluginList.get(i).getHelpSetName());
System.err.println(e.getMessage()); System.err.println(e.getMessage());
@ -552,16 +562,16 @@ public class PamHelp {
this.helpLocURL = helpLocURL; this.helpLocURL = helpLocURL;
} }
/** // /**
* Quick main function // * Quick main function
* @param args // * @param args
*/ // */
public static void main(String[] args) { // public static void main(String[] args) {
try { // try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) { } // } catch (Exception e) { }
PamHelp.getInstance().displayHelp(); // PamHelp.getInstance().displayHelp();
} // }
} }

View File

@ -133,7 +133,7 @@ public class ClickTrainDetLogging extends SuperDetLogging {
String classificationData = getClassifierData(ctDataUnit); String classificationData = getClassifierData(ctDataUnit);
System.out.println("Classifier Save: " + classificationData); // System.out.println("Classifier Save: " + classificationData);
if (classificationData.length()>0) { if (classificationData.length()>0) {
//classifiers.setLength(classificationData.length()); //classifiers.setLength(classificationData.length());

View File

@ -1,6 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head> <html><head>
<link href="../../../pamHelpStylesheet.css" type="text/css" rel="STYLESHEET"><title>Click Classification with Frequency Sweep</title></head> <link href="../../../pamHelpStylesheet.css" type="text/css" rel="STYLESHEET">
<title>Click Classification with Frequency Sweep</title></head>
<body> <body>
<h1>Click Detector</h1> <h1>Click Detector</h1>
<h2>Click Classification With Frequency Sweep</h2> <h2>Click Classification With Frequency Sweep</h2>