protected void showNotify() { if (common.getRecordStoreManager() instanceof FileRecordStoreManager) { selectStoreCombo.setSelectedIndex(0); } else { selectStoreCombo.setSelectedIndex(1); } }
public void mouseMoved(MouseEvent e) { if (showMouseCoordinates) { StringBuffer buf = new StringBuffer(); Point p = deviceCoordinate(DeviceFactory.getDevice().getDeviceDisplay(), e.getPoint()); buf.append(p.x).append(",").append(p.y); Common.setStatusBar(buf.toString()); } }
public void notifyDestroyed(MIDletContext midletContext) { Logger.debug("notifyDestroyed"); notifyImplementationMIDletDestroyed(); startLauncher(midletContext); }
protected void openMIDletUrl(String urlString) throws IOException { midletClassOrUrl = urlString; if (!autoTests) { openMIDletUrl(urlString, createMIDletClassLoader(true)); } else { runAutoTests(urlString, false); } }
System.out.println(usage()); System.exit(0); } else if (arg.equals("--id")) { getExtensionsClassLoader().addClasspath((String) argsIterator.next()); argsIterator.remove(); } else if (arg.equals("--impl")) { registerImplementation((String) argsIterator.next(), null, true); argsIterator.remove(); } else if (arg.equals("--quit")) { ClassLoader classLoader = getExtensionsClassLoader(); if (deviceDescriptorLocation != null) { try { setDevice(DeviceImpl.create(emulatorContext, classLoader, deviceDescriptorLocation, defaultDeviceClass)); DeviceDisplayImpl deviceDisplay = (DeviceDisplayImpl) DeviceFactory.getDevice().getDeviceDisplay(); if (overrideDeviceWidth != -1 && overrideDeviceHeight != -1) { URL[] urls = new URL[1]; urls[0] = new File(Config.getConfigPath(), defaultDevice.getFileName()).toURI().toURL(); classLoader = createExtensionsClassLoader(urls); setDevice(DeviceImpl.create(emulatorContext, classLoader, defaultDevice.getDescriptorLocation(), defaultDeviceClass)); defaultDeviceSelected = true; } else { DeviceImpl device = (DeviceImpl) deviceClass.newInstance(); device.init(emulatorContext); setDevice(device);
if (midletClassOrUrl != null && Common.isMIDletUrlExtension(midletClassOrUrl)) { try { File file = new File(midletClassOrUrl); String url = file.exists() ? IOUtils.getCanonicalFileURL(file) : midletClassOrUrl; openMIDletUrl(url); } catch (IOException exception) { Logger.error("Cannot load " + midletClassOrUrl + " URL", exception); useSystemClassLoader = mIDletClassLoaderConfig.isClassLoaderDisabled(); if (!useSystemClassLoader) { MIDletClassLoader classLoader = createMIDletClassLoader(false); try { classLoader.addClassURL(midletClassOrUrl); runAutoTests(jadURL, true); jad = loadJadProperties(propertiesJad); } catch (IOException e) { Logger.error("Cannot load " + propertiesJad + " URL", e); MIDletEntry entry = launcher.getSelectedMidletEntry(); if (startMidlet && entry != null) { started = (null != startMidlet(entry.getMIDletClass(), MIDletBridge.getMIDletAccess())); started = (null != startMidlet(midletClass, MIDletBridge.getMIDletAccess())); startLauncher(MIDletBridge.getMIDletContext());
dispose(); setResponseInterface(false); try { URL url = null; } catch (MalformedURLException ex1) { Logger.error("Unable to find jar url", ex1); setResponseInterface(true); return; setResponseInterface(true); return; String tmpURL = saveJar2TmpFile(jarUrl, true); if (tmpURL == null) { return; is = midletClassLoader.getResourceAsStream("META-INF/MANIFEST.MF"); if (is == null) { if (!describeJarProblem(url, midletClassLoader)) { Message.error("Unable to find MANIFEST in MIDlet jar"); startLauncher(MIDletBridge.getMIDletContext()); setStatusBar(""); } finally { setResponseInterface(true);
public String getDescriptorLocation() { if (descriptorLocation == null) { URL[] urls = new URL[1]; try { urls[0] = new File(Config.getConfigPath(), fileName).toURI().toURL(); ClassLoader classLoader = Common.createExtensionsClassLoader(urls); Class deviceClass = Class.forName(className, true, classLoader); Device device = (Device) deviceClass.newInstance(); com.barteo.emulator.EmulatorContext oldContext = new com.barteo.emulator.EmulatorContext(emulatorContext); device.init(oldContext); descriptorLocation = device.getDescriptorLocation(); } catch (MalformedURLException ex) { Logger.error(ex); } catch (ClassNotFoundException ex) { Logger.error(ex); } catch (InstantiationException ex) { Logger.error(ex); } catch (IllegalAccessException ex) { Logger.error(ex); } } return descriptorLocation; }
true)) { String recordStoreName = recordStoreChangePanel.getSelectedRecordStoreName(); if (!recordStoreName.equals(common.getRecordStoreManager().getName())) { if (JOptionPane.showConfirmDialog(RecordStoreManagerDialog.this, "Changing record store type requires MIDlet restart. \n" manager = new MemoryRecordStoreManager(); common.setRecordStoreManager(manager); Config.setRecordStoreManagerClassName(manager.getClass().getName()); refresh(); try { common.initMIDlet(true); } catch (Exception ex) { Logger.error(ex);
URL[] urls = new URL[1]; urls[0] = new File(Config.getConfigPath(), entry.getFileName()).toURI().toURL(); classLoader = Common.createExtensionsClassLoader(urls); common.setDevice(device); updateDevice(); return true;
private void openMIDletUrl(String urlString, MIDletClassLoader midletClassLoader) throws IOException { try { setStatusBar("Loading..."); jad.clear(); if (urlString.toLowerCase().endsWith(".jad")) { Logger.debug("openJad", urlString); jad = loadJadProperties(urlString); loadJar(urlString, jad.getJarURL(), midletClassLoader); } else { jad.setCorrectedJarURL(urlString); loadJar(null, urlString, midletClassLoader); } Config.getUrlsMRU().push(new MidletURLReference(jad.getSuiteName(), urlString)); } catch (MalformedURLException ex) { throw ex; } catch (ClassNotFoundException ex) { Logger.error(ex); throw new IOException(ex.getMessage()); } catch (FileNotFoundException ex) { Message.error("File Not found", urlString, ex); } catch (NullPointerException ex) { Logger.error("Cannot open jad", urlString, ex); } catch (IllegalArgumentException ex) { Logger.error("Cannot open jad", urlString, ex); } }
this.common = new Common(emulatorContext); this.common.setStatusBarListener(statusBarListener); this.common.setResponseInterfaceListener(responseInterfaceListener); this.common.loadImplementationsFromConfig();
public void refresh() { recordStoreTypeLabel.setText(common.getRecordStoreManager().getName()); suiteNameLabel.setText(common.getLauncher().getSuiteName()); common.getRecordStoreManager().setRecordListener(new ExtendedRecordListener() {
if (fileList.get(0) instanceof File) { File f = (File) fileList.get(0); if (Common.isMIDletUrlExtension(f.getName())) { Common.openMIDletUrlSafe(IOUtils.getCanonicalFileURL(f)); } else { Message.warn("Unable to open " + f.getAbsolutePath() + ", Only JAD files are acepted"); Logger.debug("importing", transferFlavors[i]); String path = getPathString((String) data); if (Common.isMIDletUrlExtension(path)) { Common.openMIDletUrlSafe(path); } else { Message.warn("Unable to open " + path + ", Only JAD files are acepted"); Logger.debug("importing", transferFlavors[i]); String path = getPathString((String) data); if (Common.isMIDletUrlExtension(path)) { Common.openMIDletUrlSafe(path); } else { Message.warn("Unable to open " + path + ", Only JAD files are acepted"); URL jadUrl = (URL)t.getTransferData(transferFlavors[i]); String urlString = jadUrl.toExternalForm(); if (Common.isMIDletUrlExtension(urlString)) { Common.openMIDletUrlSafe(urlString); } else { Message.warn("Unable to open " + urlString + ", Only JAD url are acepted");
public void actionPerformed(ActionEvent e) { common.startLauncher(MIDletBridge.getMIDletContext()); } };
public Headless() { emulator = new Common(context); }
ClassLoader classLoader = Common.createExtensionsClassLoader(urls); HashMap devices = new HashMap(); for (Iterator it = descriptorEntries.iterator(); it.hasNext();) {
URL[] urls = new URL[1]; urls[0] = new File(Config.getConfigPath(), entry.getFileName()).toURI().toURL(); classLoader = Common.createExtensionsClassLoader(urls);
buf.append(e.getX()).append(",").append(e.getY()); Common.setStatusBar(buf.toString());
ClassLoader classLoader = Common.createExtensionsClassLoader(urls); HashMap devices = new HashMap(); for (Iterator it = descriptorEntries.iterator(); it.hasNext();) {