<commit_before>package com.sii.rental.ui;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;

import com.opcoach.e4.preferences.ScopedPreferenceStore;
import com.opcoach.training.rental.Customer;
import com.opcoach.training.rental.RentalAgency;
import com.sii.rental.core.RentalCoreActivator;

public class RentalAddOn implements RentalUIConstants {

	@PostConstruct
	public void initContext(IEclipseContext context) {
		context.set(RentalAgency.class, RentalCoreActivator.getAgency());
		context.set(RENTAL_UI_IMG_REGISTRY, getLocalImageRegistry());
		context.set(IPreferenceStore.class, new ScopedPreferenceStore(InstanceScope.INSTANCE, "com.sii.rental.ui"));
	}
	
	public ImageRegistry getLocalImageRegistry() {
		Bundle bundle = FrameworkUtil.getBundle(getClass());
		ImageRegistry reg = new ImageRegistry();
		
		reg.put(IMG_CUSTOMER, ImageDescriptor.createFromURL(bundle.getEntry(IMG_CUSTOMER)));
		reg.put(IMG_RENTAL, ImageDescriptor.createFromURL(bundle.getEntry(IMG_RENTAL)));
		reg.put(IMG_RENTAL_OBJECT, ImageDescriptor.createFromURL(bundle.getEntry(IMG_RENTAL_OBJECT)));
		reg.put(IMG_AGENCY, ImageDescriptor.createFromURL(bundle.getEntry(IMG_AGENCY)));
		return reg;
	}
	
	@Inject
	@Optional
	public void reatOnCopyEvent(@UIEventTopic("copy/customer") Customer customer) {
		System.out.println("Copie du client " + customer.getDisplayName());
	}
}
<commit_msg>Affichage d'un extension point<commit_after>package com.sii.rental.ui;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;

import com.opcoach.e4.preferences.ScopedPreferenceStore;
import com.opcoach.training.rental.Customer;
import com.opcoach.training.rental.RentalAgency;
import com.sii.rental.core.RentalCoreActivator;

public class RentalAddOn implements RentalUIConstants {

	@PostConstruct
	public void initContext(IEclipseContext context) {
		context.set(RentalAgency.class, RentalCoreActivator.getAgency());
		context.set(RENTAL_UI_IMG_REGISTRY, getLocalImageRegistry());
		context.set(IPreferenceStore.class, new ScopedPreferenceStore(InstanceScope.INSTANCE, "com.sii.rental.ui"));
	}
	
	public ImageRegistry getLocalImageRegistry() {
		Bundle bundle = FrameworkUtil.getBundle(getClass());
		ImageRegistry reg = new ImageRegistry();
		
		reg.put(IMG_CUSTOMER, ImageDescriptor.createFromURL(bundle.getEntry(IMG_CUSTOMER)));
		reg.put(IMG_RENTAL, ImageDescriptor.createFromURL(bundle.getEntry(IMG_RENTAL)));
		reg.put(IMG_RENTAL_OBJECT, ImageDescriptor.createFromURL(bundle.getEntry(IMG_RENTAL_OBJECT)));
		reg.put(IMG_AGENCY, ImageDescriptor.createFromURL(bundle.getEntry(IMG_AGENCY)));
		return reg;
	}
	
	@Inject
	@Optional
	public void reatOnCopyEvent(@UIEventTopic("copy/customer") Customer customer) {
		System.out.println("Copie du client " + customer.getDisplayName());
	}
	
	@Inject
	public void getExtensionsQuickAccess(IExtensionRegistry registry) {
		for (IConfigurationElement element : registry.getConfigurationElementsFor("org.eclipse.e4.workbench.model")) {
			if (element.getName().equals("fragment")) {
				System.out.println(element.getNamespaceIdentifier() + " : " + element.getAttribute("uri"));
			} else if (element.getName().equals("processor")) {
				System.out.println(element.getNamespaceIdentifier() + " : " + element.getAttribute("class"));
			}
		}
	}
}

{'fraction_non_alphanumeric': 0.11273391145595618, 'fraction_numerical': 0.002053856686444546, 'mean_word_length': 5.732718894009216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4666522', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1395, 'n_words': 187}