--- /dev/null
+package com.axyus.generator.pespj;
+
+import com.axyus.generator.pespj.WizardLauncher.CustomUncaughtExceptionHandler;
+import com.axyus.generator.pespj.WizardLauncher.RunContextAdapter;
+import fr.gouv.finances.dgfip.xemelios.tools.AbstractTool;
+import fr.gouv.finances.dgfip.xemelios.tools.MenuTitle;
+import fr.gouv.finances.dgfip.xemelios.tools.ToolServiceProviderFactory;
+import fr.gouv.finances.dgfip.xemelios.tools.XemeliosToolServiceProvider;
+import java.net.URL;
+import javax.swing.JFrame;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author CBO
+ */
+@MenuTitle(value = "Générateur de PES PJ")
+public class XemeliosEntryPoint extends AbstractTool {
+ private static Log logger = LogFactory.getLog(XemeliosEntryPoint.class);
+
+ @Override
+ public void setParentWindow(JFrame parentWindow) {
+ }
+
+ @Override
+ public void run() {
+ WizardLauncher.startUI(new XemeliosRunContextAdapter());
+ }
+
+ public static final class XemeliosRunContextAdapter implements RunContextAdapter {
+
+ private Thread.UncaughtExceptionHandler savedUncaughtExceptionHandler;
+ private String savedSunAwtExceptionHandler;
+
+ public XemeliosRunContextAdapter() {
+ savedUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
+ Thread.setDefaultUncaughtExceptionHandler(new CustomUncaughtExceptionHandler());
+ savedSunAwtExceptionHandler = System.getProperty("sun.awt.exception.handler");
+ System.setProperty("sun.awt.exception.handler", CustomUncaughtExceptionHandler.class.getName());
+ CustomUncaughtExceptionHandler.runContextAdapter = this; // TODO : faire autrement...
+ }
+
+ @Override
+ public void onCloseRequest() {
+ if (savedSunAwtExceptionHandler != null) {
+ System.setProperty("sun.awt.exception.handler", savedSunAwtExceptionHandler);
+ }
+ if (savedUncaughtExceptionHandler != null) {
+ Thread.setDefaultUncaughtExceptionHandler(savedUncaughtExceptionHandler);
+ }
+ }
+
+ @Override
+ public boolean isPesFileImportSupported() {
+ return true;
+ }
+
+ @Override
+ public boolean isInXemelios(){
+ return true;
+ }
+
+ @Override
+ public URL getPesSchemaURL() {
+ XemeliosToolServiceProvider serviceProvider = ToolServiceProviderFactory.newInstance().getServiceProvider();
+ URL ret=serviceProvider.getDocumentSchema("pes-aller");
+ if(ret != null){
+ logger.debug(ret.toExternalForm());
+ }
+ return ret;
+ }
+
+ @Override
+ public JFrame getParentFrame() {
+ return null;
+ }
+ }
+}