Echo4190 / alliancep2pbeta

Automatically exported from code.google.com/p/alliancep2pbeta
0 stars 0 forks source link

PlugIn UICallbacks get removed immediately at startup #148

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Add a UICallback to a PlugIn init, such as this:

  public void init(CoreSubsystem core) throws Exception {
    core.addUICallback(new NonWindowUICallback() {
      @Override
      public void pluginCommunicationReceived(Friend source, String data) {
        System.out.println("Got plugin comm from " + source + ": " + data);
      }
    }
  }

2. Run the app with a console extension that invokes the callback method.  (I 
ran two Alliance apps, one of which sent a plugin communication to the other to 
see the error.)

What version of the product are you using? On what operating system?

I'm using trunk code on a Mac.

If this is the wrong approach to writing plugin functionality, let me know.

Otherwise, I believe we need to change the setUICallback calls into 
addUICallback calls.  Here are the places where that method is used:

   src/org/alliance/launchers/ui/JDesktopTrayIconSubsystem.java
   src/org/alliance/launchers/ui/Java6TrayIconSubsystem.java
   src/org/alliance/ui/UISubsystem.java

If I change those, then the callbacks work.  (Unfortunately, the stendahls 
library then gives a ton of "Wrong Thread" exception messages which each have a 
lot of output.  I'll try and figure out a workaround.)

Original issue reported on code.google.com by larsontrent on 17 Jan 2011 at 7:37

GoogleCodeExporter commented 9 years ago
Not exactly sure what you're trying to do, I haven't worked with alliance in a 
while, but below is a Hello World plugin.

Disclaimer: I did not write the HelloWorld example, orig Alliance author did, 
there used to be a wiki page up, but that has since disappeared.

http://pastebin.com/FJQziQr4

I make no guarantees if it will work out of the box (I might have added an 
additional method or two to UICallback..but if so, they can be implemented as 
stubs)

Anyway, when you make a jar, put a file named "Alliance.config" in the root of 
the plugin jar that is a text file with the class to load, for the helloworld 
above you would use
ex: org.alliance.helloworldplugin.HelloWorldPlugin

Hope that helps...

Original comment by RHKra...@gmail.com on 20 Jan 2011 at 4:24

GoogleCodeExporter commented 9 years ago
Thank you for responding!

I see that your approach to this problem is to reregister your plugin in the 
callbackRemoved() method removed.  I'll do that if this is by design.

However, if this isn't by design, I'd like to help come up with a solution.  
Unfortunately, there has been no response or activity on this project in months 
from the owners or committers; yours is the first since September.  Do you know 
anything about the status of the others?  I'd like to be able to talk about 
design and approaches.  Thanks for any information.

Original comment by larsontrent on 21 Jan 2011 at 2:33

GoogleCodeExporter commented 9 years ago
Can't tell you if it is by design or not, as this part of the code was all 
inherited from Alliancep2p, and was written by the original author.  

As for activity, I don't know what to tell you.  If there's something specific, 
about plugins you would like to discuss, feel free to email me, as I'm the one 
that's worked in it the most.

Original comment by RHKra...@gmail.com on 24 Jan 2011 at 2:39

GoogleCodeExporter commented 9 years ago
I have been busy since September and for now I lack of free time that's why 
activity dropped significantly, but if you have questions about anything except 
plugin system (because Kratos knows more about this than me) just mail them to 
me.

Original comment by Bastv...@gmail.com on 24 Jan 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Good to hear from you!

RHKra..., I would love to contact you about some of the plugin approaches.  
Unfortunately, I can't find how to contact you directly.  Do me a favor and 
point me to an online contact form, or just email me directly: my full username 
is "larsontrent" (or trentlarson.com).

Bastv..., it's good to hear you're still around.  Again, let me know how to 
contact you or email me directly at "larsontrent" (or trentlarson.com).

I plan to help on core improvements long-term, so I'm hoping to convince you to 
add me to the group of committers by either discussing them with you or sending 
patches for your review (eg. in 146 and 147).  Cheers.

Original comment by larsontrent on 26 Jan 2011 at 6:43

GoogleCodeExporter commented 9 years ago

Original comment by larsontrent on 8 Feb 2011 at 1:30

GoogleCodeExporter commented 9 years ago
See issue 153 for a proposed fix.

Original comment by larsontrent on 27 Feb 2011 at 12:26

GoogleCodeExporter commented 9 years ago

Original comment by larsontrent on 28 Feb 2011 at 3:54

GoogleCodeExporter commented 9 years ago
See issue 153.

Original comment by larsontrent on 8 Mar 2011 at 3:44