// Path: org.fipro.mafia.common/src/org/fipro/mafia/common/MafiaBossConstants.java
// public final class MafiaBossConstants {
// 
//     private MafiaBossConstants() {
//         // private default constructor for constants class
//         // to avoid someone extends the class
//     }
// 
//     public static final String TOPIC_BASE = "org/fipro/mafia/Boss/";
//     public static final String TOPIC_CONVINCE = TOPIC_BASE + "CONVINCE";
//     public static final String TOPIC_ENCASH = TOPIC_BASE + "ENCASH";
//     public static final String TOPIC_SOLVE = TOPIC_BASE + "SOLVE";
//     public static final String TOPIC_ALL = TOPIC_BASE + "*";
// 
//     public static final String PROPERTY_KEY_TARGET = "target";
// 
// }


import java.util.Dictionary;
import java.util.Hashtable;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.fipro.mafia.common.MafiaBossConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
package org.fipro.mafia.ui;




public class MafiaPart {

	private Label handlerLabel;
	private Label e4HandlerLabel;
	private ServiceRegistration<?> eventHandler;

	@PostConstruct
	public void postConstruct(Composite parent) {
		parent.setLayout(new GridLayout(2, false));
		
		Label l1 = new Label(parent, SWT.NONE);
		l1.setText("Received via handler:");
		GridDataFactory.defaultsFor(l1).applyTo(l1);
		
		handlerLabel = new Label(parent, SWT.NONE);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(handlerLabel);
		
		Label l2 = new Label(parent, SWT.NONE);
		l2.setText("Received via E4 handler:");
		GridDataFactory.defaultsFor(l2).applyTo(l2);
		
		e4HandlerLabel = new Label(parent, SWT.NONE);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(e4HandlerLabel);
		
		
		// retrieve the bundle of the calling class
		Bundle bundle = FrameworkUtil.getBundle(getClass());
		BundleContext bc = (bundle != null) ? bundle.getBundleContext() : null;
		if (bc != null) {
		    // create the service properties instance
		    Dictionary<String, Object> properties = new Hashtable<>();
// Path: org.fipro.mafia.common/src/org/fipro/mafia/common/MafiaBossConstants.java
// public final class MafiaBossConstants {
// 
//     private MafiaBossConstants() {
//         // private default constructor for constants class
//         // to avoid someone extends the class
//     }
// 
//     public static final String TOPIC_BASE = "org/fipro/mafia/Boss/";
//     public static final String TOPIC_CONVINCE = TOPIC_BASE + "CONVINCE";
//     public static final String TOPIC_ENCASH = TOPIC_BASE + "ENCASH";
//     public static final String TOPIC_SOLVE = TOPIC_BASE + "SOLVE";
//     public static final String TOPIC_ALL = TOPIC_BASE + "*";
// 
//     public static final String PROPERTY_KEY_TARGET = "target";
// 
// }


// Path: org.fipro.mafia.ui/src/org/fipro/mafia/ui/MafiaPart.java
import java.util.Dictionary;
import java.util.Hashtable;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.fipro.mafia.common.MafiaBossConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;

package org.fipro.mafia.ui;




public class MafiaPart {

	private Label handlerLabel;
	private Label e4HandlerLabel;
	private ServiceRegistration<?> eventHandler;

	@PostConstruct
	public void postConstruct(Composite parent) {
		parent.setLayout(new GridLayout(2, false));
		
		Label l1 = new Label(parent, SWT.NONE);
		l1.setText("Received via handler:");
		GridDataFactory.defaultsFor(l1).applyTo(l1);
		
		handlerLabel = new Label(parent, SWT.NONE);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(handlerLabel);
		
		Label l2 = new Label(parent, SWT.NONE);
		l2.setText("Received via E4 handler:");
		GridDataFactory.defaultsFor(l2).applyTo(l2);
		
		e4HandlerLabel = new Label(parent, SWT.NONE);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(e4HandlerLabel);
		
		
		// retrieve the bundle of the calling class
		Bundle bundle = FrameworkUtil.getBundle(getClass());
		BundleContext bc = (bundle != null) ? bundle.getBundleContext() : null;
		if (bc != null) {
		    // create the service properties instance
		    Dictionary<String, Object> properties = new Hashtable<>();
		    properties.put(EventConstants.EVENT_TOPIC, MafiaBossConstants.TOPIC_ALL);