Examples of IAdapterFactory


Examples of org.eclipse.core.runtime.IAdapterFactory

  }
 
  public static void registerWorkbenchAdapters()
  {
    // IWorkbenchAdapter
    Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
      public Object getAdapter(Object adaptableObject, Class adapterType) {
            if (adapterType == IWorkbenchAdapter.class)
          return createSpreadsheetEntryWorkbenchAdapter();
            if (adapterType == IPropertySource.class)
          return createSpreadsheetPropertySource((SpreadsheetEntry)adaptableObject);
        return null;
      }
      public Class[] getAdapterList() {
        return new Class[] { IWorkbenchAdapter.class, IPropertySource.class };
      }
    }, SpreadsheetEntry.class);
   
    Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
      public Object getAdapter(Object adaptableObject, Class adapterType) {
            if (adapterType == IWorkbenchAdapter.class)
          return createDocumentEntryWorkbenchAdapter();
            if (adapterType == IPropertySource.class)
          return createDocumentPropertySource((DocumentListEntry)adaptableObject);
View Full Code Here

Examples of org.eclipse.core.runtime.IAdapterFactory

  private void addFactoriesFor(String typeName, Map table) {
    List factoryList = (List) getFactories().get(typeName);
    if (factoryList == null)
      return;
    for (int i = 0, imax = factoryList.size(); i < imax; i++) {
      IAdapterFactory factory = (IAdapterFactory) factoryList.get(i);
      if (factory instanceof IAdapterFactoryExt) {
        String[] adapters = ((IAdapterFactoryExt) factory).getAdapterNames();
        for (int j = 0; j < adapters.length; j++) {
          if (table.get(adapters[j]) == null)
            table.put(adapters[j], factory);
        }
      } else {
        Class[] adapters = factory.getAdapterList();
        for (int j = 0; j < adapters.length; j++) {
          String adapterName = adapters[j].getName();
          if (table.get(adapterName) == null)
            table.put(adapterName, factory);
        }
View Full Code Here

Examples of org.eclipse.core.runtime.IAdapterFactory

  /* (non-Javadoc)
   * @see org.eclipse.core.runtime.IAdapterManager#getAdapter(java.lang.Object, java.lang.Class)
   */
  public Object getAdapter(Object adaptable, Class adapterType) {
    IAdapterFactory factory = (IAdapterFactory) getFactories(adaptable.getClass()).get(adapterType.getName());
    Object result = null;
    if (factory != null)
      result = factory.getAdapter(adaptable, adapterType);
    if (result == null && adapterType.isInstance(adaptable))
      return adaptable;
    return result;
  }
View Full Code Here

Examples of org.eclipse.core.runtime.IAdapterFactory

   * @param force <code>true</code> if the plug-in providing the
   * factory should be activated if necessary. <code>false</code>
   * if no plugin activations are desired.
   */
  private Object getAdapter(Object adaptable, String adapterType, boolean force) {
    IAdapterFactory factory = (IAdapterFactory) getFactories(adaptable.getClass()).get(adapterType);
    if (force && factory instanceof IAdapterFactoryExt)
      factory = ((IAdapterFactoryExt) factory).loadFactory(true);
    Object result = null;
    if (factory != null) {
      Class clazz = classForName(factory, adapterType);
      if (clazz != null)
        result = factory.getAdapter(adaptable, clazz);
    }
    if (result == null && adaptable.getClass().getName().equals(adapterType))
      return adaptable;
    return result;
  }
View Full Code Here

Examples of org.eclipse.core.runtime.IAdapterFactory

  /* (non-Javadoc)
   * @see org.eclipse.core.runtime.IAdapterManager#queryAdapter(java.lang.Object, java.lang.String)
   */
  public int queryAdapter(Object adaptable, String adapterTypeName) {
    IAdapterFactory factory = (IAdapterFactory) getFactories(adaptable.getClass()).get(adapterTypeName);
    if (factory == null)
      return NONE;
    if (factory instanceof IAdapterFactoryExt) {
      factory = ((IAdapterFactoryExt) factory).loadFactory(false); // don't force loading
      if (factory == null)
View Full Code Here

Examples of org.eclipse.core.runtime.IAdapterFactory

        context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8SSLGenericContainerInstantiator.JAVA8_SSL_CLIENT_NAME, new J8SSLGenericContainerInstantiator(), "ECF Java8 SSL Generic Client", false, false), null); //$NON-NLS-1$
        context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8SSLGenericContainerInstantiator.JAVA8_SSL_SERVER_NAME, new J8SSLGenericContainerInstantiator(), "ECF Java8 SSL Generic Server", true, false), null); //$NON-NLS-1$
        IAdapterManager am = getAdapterManager(context);
        if (am != null) {
          rscAdapterFactories = new ArrayList<IAdapterFactory>();
          IAdapterFactory af = new J8RemoteServiceContainerAdapterFactory();
          am.registerAdapters(af, J8SSLServerSOContainer.class);
          rscAdapterFactories.add(af);
          af = new J8RemoteServiceContainerAdapterFactory();
          am.registerAdapters(af, J8TCPServerSOContainer.class);
          rscAdapterFactories.add(af);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.