public void stateChanged(ChangeEvent e) { AnimationPanel animationPanel = (AnimationPanel) ComponentRegistry.getRegistry().getComponent("AnimationPanel"); animationPanel.changeFrame((Integer) this.getValue()); XMLPanel XPanel = (XMLPanel) ComponentRegistry.getRegistry().getComponent("XMLPanel"); XPanel.changeXML((Integer) this.getValue()); }
public FrameSpinner() { ComponentRegistry.getRegistry().registerComponent("FrameSpinner", this); AnimationPanel animationPanel = (AnimationPanel) ComponentRegistry.getRegistry().getComponent("AnimationPanel"); maximum = animationPanel.getNumberOfFrame(); this.setModel(new SpinnerNumberModel(start, minimum, maximum, 1)); this.addChangeListener(this); }
static void a(String s, String s1, Throwable throwable) { LoggingComponent loggingcomponent = ComponentRegistry.j(); if (LoggingComponent.a <= 6) { loggingcomponent.a( s, (new StringBuilder()) .append(s1) .append(": ") .append(Log.getStackTraceString(throwable)) .toString()); } }
/** Dispose of this component activator instance and all the component managers. */ void dispose(int reason) { if (m_context == null) { return; } // mark instance inactive (no more component activations) m_active = false; log( LogService.LOG_DEBUG, "BundleComponentActivator : Bundle [{0}] will destroy {1} instances", new Object[] { new Long(m_context.getBundle().getBundleId()), new Integer(m_managers.size()) }, null, null); while (m_managers.size() != 0) { ComponentHolder holder = (ComponentHolder) m_managers.get(0); try { m_managers.remove(holder); holder.disposeComponents(reason); } catch (Exception e) { log( LogService.LOG_ERROR, "BundleComponentActivator : Exception invalidating", holder.getComponentMetadata(), e); } finally { m_componentRegistry.unregisterComponentHolder(holder.getComponentMetadata().getName()); } } log( LogService.LOG_DEBUG, "BundleComponentActivator : Bundle [{0}] STOPPED", new Object[] {new Long(m_context.getBundle().getBundleId())}, null, null); if (m_logService != null) { m_logService.close(); m_logService = null; } m_componentActor = null; m_componentRegistry = null; m_context = null; }
/** * Returns an array of {@link ComponentManager} instances which match the <code>name</code>. If * the <code>name</code> is <code>null</code> an array of all currently known component managers * is returned. Otherwise an array containing a single component manager matching the name is * returned if one is registered. Finally, if no component manager with the given name is * registered, <code>null</code> is returned. * * @param name The name of the component manager to return or <code>null</code> to return an array * of all component managers. * @return An array containing one or more component managers according to the <code>name</code> * parameter or <code>null</code> if no component manager with the given name is currently * registered. */ private ComponentHolder[] getSelectedComponents(String name) { // if all components are selected if (name == null) { return (ComponentHolder[]) m_managers.toArray(new ComponentHolder[m_managers.size()]); } if (m_componentRegistry.getComponentHolder(name) != null) { // otherwise just find it Iterator it = m_managers.iterator(); while (it.hasNext()) { ComponentHolder cm = (ComponentHolder) it.next(); if (name.equals(cm.getComponentMetadata().getName())) { return new ComponentHolder[] {cm}; } } } // if the component is not known return null; }
public void run() { // fail, if the bundle is not active if (component.getState() == Component.STATE_DISPOSED) { // cannot use bundle to log because it is not accessible from the // component if the component is destroyed Activator.log( LogService.LOG_WARNING, null, "Cannot run task '" + this + "': Component has already been disposed", null); } else if (!ComponentRegistry.isBundleActive(component.getBundle())) { Activator.log( LogService.LOG_WARNING, component.getBundle(), "Cannot run task '" + this + "': Declaring bundle is not active", null); } else { doRun(); } }
public void unregisterComponentId(AbstractComponentManager componentManager) { m_componentRegistry.unregisterComponentId(componentManager.getId()); }
public long registerComponentId(AbstractComponentManager componentManager) { return m_componentRegistry.registerComponentId(componentManager); }
private void loadDescriptor(final URL descriptorURL) { // simple path for log messages final String descriptorLocation = descriptorURL.getPath(); InputStream stream = null; try { stream = descriptorURL.openStream(); BufferedReader in = new BufferedReader(new InputStreamReader(stream)); XmlHandler handler = new XmlHandler(m_context.getBundle(), this); KXml2SAXParser parser; parser = new KXml2SAXParser(in); parser.parseXML(handler); // 112.4.2 Component descriptors may contain a single, root component element // or one or more component elements embedded in a larger document Iterator i = handler.getComponentMetadataList().iterator(); while (i.hasNext()) { ComponentMetadata metadata = (ComponentMetadata) i.next(); try { // check and reserve the component name m_componentRegistry.checkComponentName(metadata.getName()); // validate the component metadata metadata.validate(this); // Request creation of the component manager ComponentHolder holder = m_componentRegistry.createComponentHolder(this, metadata); // register the component after validation m_componentRegistry.registerComponentHolder(metadata.getName(), holder); m_managers.add(holder); // enable the component if (metadata.isEnabled()) { holder.enableComponents(); } } catch (Throwable t) { // There is a problem with this particular component, we'll log the error // and proceed to the next one log(LogService.LOG_ERROR, "Cannot register Component", metadata, t); // make sure the name is not reserved any more m_componentRegistry.unregisterComponentHolder(metadata.getName()); } } } catch (IOException ex) { // 112.4.1 If an XML document specified by the header cannot be located in the bundle and its // attached // fragments, SCR must log an error message with the Log Service, if present, and continue. log( LogService.LOG_ERROR, "Problem reading descriptor entry ''{0}''", new Object[] {descriptorLocation}, null, ex); } catch (Exception ex) { log( LogService.LOG_ERROR, "General problem with descriptor entry ''{0}''", new Object[] {descriptorLocation}, null, ex); } finally { if (stream != null) { try { stream.close(); } catch (IOException ignore) { } } } }
static { ComponentRegistry.a(new LoggingComponent()); }
public static void setLogLevel(int i) { ComponentRegistry.j().setLogLevel(i); }
public static int getLogLevel() { return ComponentRegistry.j().getLogLevel(); }
static void e(String s, String s1) { LoggingComponent loggingcomponent = ComponentRegistry.j(); if (LoggingComponent.a <= 6) { loggingcomponent.a(s, s1); } }
static void d(String s, String s1) { ComponentRegistry.j(); if (LoggingComponent.a <= 5) { Log.w((new StringBuilder("MMSDK-")).append(s).toString(), s1); } }
static void b(String s, String s1) { ComponentRegistry.j(); if (LoggingComponent.a > 3) ; }