Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 1.05 KB  |  hits: 68  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class PublishView
  2. {
  3.     @Inject
  4.     private IEventBroker eventBroker;
  5.    
  6.     @PostConstruct
  7.     public void createPartControl(Composite parent)
  8.     {
  9.         Button button = new Button(parent, SWT.PUSH);
  10.         button.setText("Publish!");
  11.         button.addSelectionListener(new SelectionListener() {
  12.             @Override
  13.             public void widgetSelected(SelectionEvent e)
  14.             {
  15.                 System.out.format("Publishing on foo\n");
  16.                 eventBroker.send("foo", "Hello");
  17.             }
  18.  
  19.             ...
  20.         });
  21.     }
  22. }
  23.  
  24. public class PublishViewPart extends DIViewPart<PublishView>
  25. {
  26.     public PublishViewPart()
  27.     {
  28.         super(PublishView.class);
  29.     }
  30. }
  31.  
  32. public class SubscribeView
  33. {
  34.     ...
  35.    
  36.     @Inject
  37.     public void handleFoo(@EventTopic("foo") Object data) {
  38.         System.out.format("Received foo: %s\n", data);
  39.     }
  40. }
  41.  
  42. public class SubscribeViewPart extends DIViewPart<SubscribeView>
  43. {
  44.     public SubscribeViewPart()
  45.     {
  46.         super(SubscribeView.class);
  47.     }
  48. }