當前位置: 首頁>>代碼示例>>Java>>正文


Java IAdapterFactory類代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.IAdapterFactory的典型用法代碼示例。如果您正苦於以下問題:Java IAdapterFactory類的具體用法?Java IAdapterFactory怎麽用?Java IAdapterFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IAdapterFactory類屬於org.eclipse.core.runtime包,在下文中一共展示了IAdapterFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
@Override
public void start ( final BundleContext context ) throws Exception
{
    super.start ( context );
    plugin = this;

    this.treeRoot = new WritableSet ( DisplayRealm.getRealm ( getWorkbench ().getDisplay () ) );
    this.treeRootManager = new ConnectionTreeManager ( this.treeRoot );

    this.connectionManager = new ConnectionManager ( context );

    for ( final Map.Entry<Class<?>, IAdapterFactory> entry : this.adaperFactories.entrySet () )
    {
        Platform.getAdapterManager ().registerAdapters ( entry.getValue (), entry.getKey () );
    }

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:18,代碼來源:Activator.java

示例2: stop

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
@Override
public void stop ( final BundleContext context ) throws Exception
{
    for ( final Map.Entry<Class<?>, IAdapterFactory> entry : this.adaperFactories.entrySet () )
    {
        Platform.getAdapterManager ().unregisterAdapters ( entry.getValue (), entry.getKey () );
    }

    if ( this.connectionManager != null )
    {
        this.connectionManager.dispose ();
        this.connectionManager = null;
    }

    this.treeRootManager.dispose ();
    this.treeRoot.dispose ();
    this.discoverers.dispose ();

    plugin = null;
    super.stop ( context );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:Activator.java

示例3: getAdapter

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
/**
 * Returns an adapter of the given type for the provided adapter.
 * 
 * @param adaptable
 *            the object to adapt
 * @param adapterType
 *            the type to adapt the object to
 * @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;
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:30,代碼來源:AdapterManager.java

示例4: start

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
public void start ( final BundleContext context ) throws Exception
{
    super.start ( context );

    for ( final Map.Entry<Class<?>, IAdapterFactory> entry : this.adaperFactories.entrySet () )
    {
        Platform.getAdapterManager ().registerAdapters ( entry.getValue (), entry.getKey () );
    }

    plugin = this;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:12,代碼來源:Activator.java

示例5: stop

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
public void stop ( final BundleContext context ) throws Exception
{
    plugin = null;

    for ( final Map.Entry<Class<?>, IAdapterFactory> entry : this.adaperFactories.entrySet () )
    {
        Platform.getAdapterManager ().registerAdapters ( entry.getValue (), entry.getKey () );
    }

    super.stop ( context );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:12,代碼來源:Activator.java

示例6: addAdapterFactory

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
/**
 * @param limpetAdapters
 */
public void addAdapterFactory(IAdapterFactory newFactory)
{
  if (_adapters == null)
  {
    _adapters = new ArrayList<IAdapterFactory>();
  }
  _adapters.add(newFactory);

}
 
開發者ID:debrief,項目名稱:limpet,代碼行數:13,代碼來源:Activator.java

示例7: cacheClassLookup

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
private void cacheClassLookup(IAdapterFactory factory, Class clazz) {
	synchronized (classLookupLock) {
		// cache reference to lookup to protect against concurrent flush
		Map lookup = classLookup;
		if (lookup == null)
			classLookup = lookup = new HashMap(4);
		HashMap classes = (HashMap) lookup.get(factory);
		if (classes == null) {
			classes = new HashMap(4);
			lookup.put(factory, classes);
		}
		classes.put(clazz.getName(), clazz);
	}
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:15,代碼來源:AdapterManager.java

示例8: cachedClassForName

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
private Class cachedClassForName(IAdapterFactory factory, String typeName) {
	synchronized (classLookupLock) {
		Class clazz = null;
		// cache reference to lookup to protect against concurrent flush
		Map lookup = classLookup;
		if (lookup != null) {
			HashMap classes = (HashMap) lookup.get(factory);
			if (classes != null) {
				clazz = (Class) classes.get(typeName);
			}
		}
		return clazz;
	}
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:15,代碼來源:AdapterManager.java

示例9: classForName

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
/**
 * Returns the class with the given fully qualified name, or null if that
 * class does not exist or belongs to a plug-in that has not yet been
 * loaded.
 */
private Class classForName(IAdapterFactory factory, String typeName) {
	Class clazz = cachedClassForName(factory, typeName);
	if (clazz == null) {
		if (factory instanceof IAdapterFactoryExt)
			factory = ((IAdapterFactoryExt) factory).loadFactory(false);
		if (factory != null) {
			// try {
			// clazz = factory.getClass().getClassLoader()
			// .loadClass(typeName);
			// } catch (ClassNotFoundException e) {
			// // it is possible that the default bundle classloader is
			// // unaware of this class
			// // but the adaptor factory can load it in some other way.
			// // See bug 200068.
			// if (typeName == null)
			// return null;
			// Class[] adapterList = factory.getAdapterList();
			// clazz = null;
			// for (int i = 0; i < adapterList.length; i++) {
			// if (typeName.equals(adapterList[i].getName())) {
			// clazz = adapterList[i];
			// break;
			// }
			// }
			// if (clazz == null)
			// return null; // class not yet loaded
			// }
			// cacheClassLookup(factory, clazz);
		}
	}
	return clazz;
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:38,代碼來源:AdapterManager.java

示例10: queryAdapter

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
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)
			return NOT_LOADED;
	}
	return LOADED;
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:15,代碼來源:AdapterManager.java

示例11: registerFactory

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
public void registerFactory(IAdapterFactory factory, String adaptableType) {
	List list = (List) factories.get(adaptableType);
	if (list == null) {
		list = new ArrayList(5);
		factories.put(adaptableType, list);
	}
	list.add(factory);
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:9,代碼來源:AdapterManager.java

示例12: unregisterAdapters

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
public synchronized void unregisterAdapters(IAdapterFactory factory,
		Class adaptable) {
	List factoryList = (List) factories.get(adaptable.getName());
	if (factoryList == null)
		return;
	factoryList.remove(factory);
	flushLookup();
}
 
開發者ID:ghillairet,項目名稱:gef-gwt,代碼行數:9,代碼來源:AdapterManager.java

示例13: stubAdapterFactory

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private static IAdapterFactory stubAdapterFactory( Collection<Object> expected ) {
  IAdapterFactory result = mock( IAdapterFactory.class );
  when( result.getAdapter( anyObject(), any( Class.class ) ) ).thenReturn( expected );
  when( result.getAdapterList() ).thenReturn( new Class[] { ADAPTER_TYPE_1, ADAPTER_TYPE_2 } );
  return result;
}
 
開發者ID:fappel,項目名稱:xiliary,代碼行數:8,代碼來源:AdaptersPDETest.java

示例14: getAdapters

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
/**
 * @return
 */
public ArrayList<IAdapterFactory> getAdapters()
{
  return _adapters;
}
 
開發者ID:debrief,項目名稱:limpet,代碼行數:8,代碼來源:Activator.java

示例15: newSelection

import org.eclipse.core.runtime.IAdapterFactory; //導入依賴的package包/類
protected void newSelection(final ISelection selection)
{
  if (selection == _curSelection)
  {
    return;
  }
  else
  {
    _curSelection = selection;
  }

  final List<IStoreItem> res = new ArrayList<IStoreItem>();
  if (selection instanceof StructuredSelection)
  {
    final StructuredSelection str = (StructuredSelection) selection;

    // check if it/they are suitable
    final Iterator<?> iter = str.iterator();
    while (iter.hasNext())
    {
      final Object object = iter.next();
      if (object instanceof IAdaptable)
      {
        final IAdaptable ad = (IAdaptable) object;
        final IStoreItem coll = (IStoreItem) ad.getAdapter(IStoreItem.class);
        if (coll != null)
        {
          res.add(coll);
        }
      }
      else
      {
        // can we adapt it?
        final ArrayList<IAdapterFactory> adapters =
            Activator.getDefault().getAdapters();
        if (adapters != null)
        {
          final Iterator<IAdapterFactory> aIter = adapters.iterator();
          while (aIter.hasNext())
          {
            final IAdapterFactory iAdapterFactory = aIter.next();
            final Object match =
                iAdapterFactory.getAdapter(object, IStoreItem.class);
            if (match != null)
            {
              res.add((IStoreItem) match);
              break;
            }

          }
        }
      }
    }
  }

  // have we found any, and are they suitable for us?
  if ((res.size()) > 0 && appliesToMe(res, getATests()))
  {
    // ok, stop listening to the old list
    clearChangeListeners();

    // and start listening to the new ones
    createChangeListeners(res);

    // ok, display them
    display(res);
  }
  else
  {
    // ok, nothing to display - clear the graph
    // display(new ArrayList<IStoreItem>());
  }
}
 
開發者ID:debrief,項目名稱:limpet,代碼行數:74,代碼來源:CoreAnalysisView.java


注:本文中的org.eclipse.core.runtime.IAdapterFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。