org.eclipse.core.runtime.IAdapterFactory Java Examples

The following examples show how to use org.eclipse.core.runtime.IAdapterFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@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 () );
    }

}
 
Example #2
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
@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 );
}
 
Example #3
Source File: MultiPageEditor.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public MultiPageEditor() {
	Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
		@Override
		public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
			if (adaptableObject instanceof MultiPageEditor) {
				MultiPageEditor mpe = (MultiPageEditor) adaptableObject;
				return adapterType.cast(mpe.editor);
			}
			return null;
		}
		@Override
		public Class<?>[] getAdapterList() {
			return new Class[]{XtextEditor.class};
		}
	}, MultiPageEditor.class);
}
 
Example #4
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 );
}
 
Example #6
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #7
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
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 );
}
 
Example #8
Source File: ElementAdapter.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public IAdapterFactory getFactory( )
{
	return factory;
}
 
Example #9
Source File: ElementAdapter.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void setFactory( IAdapterFactory factory )
{
	this.factory = factory;
}
 
Example #10
Source File: TmfTraceAdapterManager.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Registers the given adapter factory as extending traces with the given
 * trace type id.
 * </p>
 *
 * @param factory
 *            the adapter factory
 * @param traceTypeId
 *            the trace type id of traces being extended
 */
public static void registerFactory(IAdapterFactory factory, String traceTypeId) {
    fFactoriesById.put(traceTypeId, factory);
}
 
Example #11
Source File: TmfTraceAdapterManager.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Registers the given adapter factory as extending traces of the given
 * class.
 * <p>
 * If the trace class being extended is a class, the given factory's
 * adapters are available on instances of that class and any of its
 * subclasses. If it is an interface, the adapters are available to all
 * classes that directly or indirectly implement that interface.
 * </p>
 *
 * @param factory
 *            the adapter factory
 * @param traceClass
 *            the class of traces being extended
 */
public static void registerFactory(IAdapterFactory factory, Class<? extends ITmfTrace> traceClass) {
    fFactoriesByClass.put(traceClass, factory);
}
 
Example #12
Source File: TmfTraceAdapterManager.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Removes the given adapter factory completely from the list of registered
 * factories.
 *
 * @param factory
 *            the adapter factory to remove
 * @see #registerFactory(IAdapterFactory, Class)
 * @see #registerFactory(IAdapterFactory, String)
 */
public static void unregisterFactory(IAdapterFactory factory) {
    fFactoriesById.values().remove(factory);
    fFactoriesByClass.values().remove(factory);
}