public void windowDeiconified(WindowEvent ev) { try { MIDletBridge.getMIDletAccess(MIDletBridge.getCurrentMIDlet()).startApp(); } catch (MIDletStateChangeException ex) { System.err.println(ex); } } };
public void handleEvent(Event e) { if (selectDeviceDialog.open() == SwtDialog.OK) { if (selectDeviceDialog.getSelectedDeviceEntry().equals(getDevice())) { return; } if (MIDletBridge.getCurrentMIDlet() != getLauncher()) { if (!SwtMessageDialog.openQuestion(shell, "Question?", "Changing device needs MIDlet to be restarted. All MIDlet data will be lost. Are you sure?")) { return; } } setDevice(selectDeviceDialog.getSelectedDeviceEntry()); if (MIDletBridge.getCurrentMIDlet() != getLauncher()) { try { startMidlet(MIDletBridge.getCurrentMIDlet().getClass(), MIDletBridge.getMIDletAccess()); } catch (Exception ex) { System.err.println(ex); } } else { startLauncher(MIDletBridge.getMIDletContext()); } } } };
public void run() { try { MIDletBridge.getMIDletAccess(midlet).startApp(); } catch (MIDletStateChangeException ex) { System.err.println(ex); } } }.start();
public InputStream getResourceAsStream(String name) { return MIDletBridge.getCurrentMIDlet().getClass().getResourceAsStream(name); }
MIDletContext context = startMidlet(midletClass, MIDletBridge.getMIDletAccess()); if (MIDletBridge.getMIDletContext() == context) { synchronized (destroyNotify) { try {
public void actionPerformed(ActionEvent e) { common.startLauncher(MIDletBridge.getMIDletContext()); } };
MIDletBridge.setThreadMIDletContext(context); MIDletBridge.getRecordStoreManager().init(MIDletBridge.getMicroEmulator()); try { MIDlet m; } catch (Throwable e) { Message.error(errorTitle, "Unable to create MIDlet, " + Message.getCauseMessage(e), e); MIDletBridge.destroyMIDletContext(context); return null; } catch (Throwable e) { Message.error(errorTitle, "Unable to start MIDlet, " + Message.getCauseMessage(e), e); MIDletBridge.destroyMIDletContext(context); return null; MIDletBridge.setThreadMIDletContext(null);
protected void startLauncher(MIDletContext midletContext) { if ((midletContext != null) && (midletContext.isLauncher())) { return; } if (midletContext != null) { try { MIDletAccess previousMidletAccess = midletContext.getMIDletAccess(); if (previousMidletAccess != null) { previousMidletAccess.destroyApp(true); } } catch (Throwable e) { Logger.error("destroyApp error", e); } if (exitOnMIDletDestroy) { System.exit(0); } } try { launcher = new Launcher(this); MIDletBridge.getMIDletAccess(launcher).startApp(); launcher.setCurrentMIDlet(launcher); } catch (Throwable e) { Message.error("Unable to start launcher MIDlet, " + Message.getCauseMessage(e), e); handleStartMidletException(e); } finally { MIDletBridge.setThreadMIDletContext(null); } }
MIDletBridge.clear(); Launcher.addMIDletEntry(new MIDletEntry(jadEntry.getName(), midletClass)); startLauncher(MIDletBridge.getMIDletContext()); setStatusBar(""); } finally {
public Common(EmulatorContext context) { instance = this; this.emulatorContext = context; /* * Initialize secutity context for implemenations, May be there are better place * for this call */ ImplFactory.instance(); MIDletSystemProperties.initContext(); // TODO integrate with ImplementationInitialization ImplFactory.registerGCF(ImplFactory.DEFAULT, new ConnectorImpl()); MIDletBridge.setMicroEmulator(this); }
launcher.setCurrentMIDlet(launcher); } finally { MIDletBridge.setThreadMIDletContext(null);
public void destroy() { try { MIDletBridge.getMIDletAccess(midlet).destroyApp(true); } catch (MIDletStateChangeException ex) { System.err.println(ex); } }
public InputStream getResourceAsStream(String name) { return MIDletBridge.getCurrentMIDlet().getClass().getResourceAsStream(name); }
MIDletEntry entry = launcher.getSelectedMidletEntry(); if (startMidlet && entry != null) { started = (null != startMidlet(entry.getMIDletClass(), MIDletBridge.getMIDletAccess())); started = (null != startMidlet(midletClass, MIDletBridge.getMIDletAccess())); startLauncher(MIDletBridge.getMIDletContext());
private static void register(MIDletTimer timer) { if (timer.midletContext == null) { timer.midletContext = MIDletBridge.getMIDletContext(); } if (timer.midletContext == null) { Logger.error("Creating Timer with no MIDlet context", new Throwable()); return; } Map timers = (Map) midlets.get(timer.midletContext); if (timers == null) { // Can't use WeakHashMap Timers are disposed by JVM timers = new HashMap(); midlets.put(timer.midletContext, timers); } // Logger.debug("Register timer created from [" + timer.name + "]"); timers.put(timer, timer.midletContext); }
MIDletBridge.setMicroEmulator(this);
public void stop() { MIDletBridge.getMIDletAccess(midlet).pauseApp(); }
public void windowIconified(WindowEvent ev) { MIDletBridge.getMIDletAccess(MIDletBridge.getCurrentMIDlet()).pauseApp(); }
public InputStream getResourceAsStream(String name) { return MIDletBridge.getCurrentMIDlet().getClass().getResourceAsStream(name); }
private static void register(MIDletThread thread) { MIDletContext midletContext = MIDletBridge.getMIDletContext(); if (midletContext == null) { Logger.error("Creating thread with no MIDlet context", new Throwable()); return; } thread.callLocation = ThreadUtils.getCallLocation(MIDletThread.class.getName()); Map threads = (Map)midlets.get(midletContext); if (threads == null) { threads = new WeakHashMap(); midlets.put(midletContext, threads); } threads.put(thread, midletContext); }