Slow progress getting packer to run as a plugin.

This commit is contained in:
Martin Haye
2016-07-16 05:09:21 -07:00
parent 39d152720f
commit 43fa3101a3
3 changed files with 22 additions and 22 deletions

View File

@@ -150,6 +150,14 @@ public class Application extends javafx.application.Application implements Appli
+ "org.badvision.outlaweditor.data.xml,"
+ "org.badvision.outlaweditor.ui,"
+ "org.osgi.framework");
// MH: Had to add these to allow plugin to access basic Java XML classes,
// and other stuff you'd think would just be default.
config.put("org.osgi.framework.bootdelegation",
"sun.*,"
+ "com.sun.*,"
+ "org.w3c.*,"
+ "org.xml.*,"
+ "javax.xml.*");
felix = new Felix(config);
felix.start();
felix.getBundleContext().registerService(ApplicationState.class, this, null);

View File

@@ -15,7 +15,7 @@ import org.badvision.outlaweditor.api.ApplicationState;
import org.badvision.outlaweditor.api.MenuAction;
import org.badvision.outlaweditor.ui.UIAction;
import org.osgi.framework.BundleContext;
import org.w3c.dom.Element;
/**
* This registers a plugin which creates Apple II disk images.
@@ -33,14 +33,14 @@ public class A2PackPlugin implements MenuAction {
// This is called when our plugin is starting
@Activate
public void activate() throws Exception {
System.out.println("Hello, menu 3!");
checkReferences();
//System.out.println("Hello, menu!");
System.out.println(Element.ATTRIBUTE_NODE);
}
// This is called when our plugin is stopping
@Deactivate
public void stop(BundleContext bc) throws Exception {
System.out.println("Goodbye, menu!");
//System.out.println("Goodbye, menu!");
}
// This identifies the menu item label
@@ -49,10 +49,14 @@ public class A2PackPlugin implements MenuAction {
return "Build Apple II disk";
}
public void callback(String event)
public void error(String msg, String context)
{
System.out.println("Hello from callback.");
System.out.println("Event is: " + event);
System.out.println("Error: msg=" + msg + ", context=" + context);
}
public void warnings(int nWarnings, String str)
{
System.out.println("Warnings: nWarnings=" + nWarnings + ", str=" + str);
}
// This method is called when the user selects the menu item
@@ -77,17 +81,4 @@ public class A2PackPlugin implements MenuAction {
}
UIAction.alert("A2_4evr!");
}
private void checkReferences() {
// app = ApplicationState.getInstance();
if (app == null) {
System.out.println("App is null?!?!");
} else {
if (app.getCurrentPlatform() == null) {
System.out.println("Current platform is null?");
} else {
System.out.println("Current platform is "+app.getCurrentPlatform());
}
}
}
}

View File

@@ -1456,9 +1456,10 @@ class A2PackPartitions
if (!res)
res = getClass().getResource("/" + partial.replace("\\", "/"))
if (res) {
def m = res.toString() =~ /^jar:file:(.*)!.*$/
def m = res.toString() =~ /^(jar:file:|bundle:\/\/[^\/]*)(.*)!.*$/
println res.toString()
assert m
srcFile = new File(java.net.URLDecoder.decode(m.group(1), "UTF-8"))
srcFile = new File(java.net.URLDecoder.decode(m.group(2), "UTF-8"))
if (dstFile.exists()) {
if (srcFile.lastModified() <= dstFile.lastModified())
return dstFile