/******************************************************************************* * Copyright (c) 2010 Michal Antkiewicz. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Michal Antkiewicz - initial API and implementation ******************************************************************************/ /** * * * * $Id: AppletItemProviderAdapterFactory.java,v 1.14 2008/04/10 20:33:15 Michal Antkiewicz <mantkiew@gsd.uwaterloo.ca> $ */ package ca.uwaterloo.gsd.applet.provider; import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.edit.provider.ChangeNotifier; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.IChangeNotifier; import org.eclipse.emf.edit.provider.IDisposable; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.INotifyChangedListener; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import ca.uwaterloo.gsd.applet.util.AppletAdapterFactory; /** * This is the factory that is used to provide the interfaces needed to support Viewers. * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. * The adapters also support Eclipse property sheets. * Note that most of the adapters are shared among multiple instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class AppletItemProviderAdapterFactory extends AppletAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { /** * This keeps track of the root adapter factory that delegates to this adapter factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ComposedAdapterFactory parentAdapterFactory; /** * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IChangeNotifier changeNotifier = new ChangeNotifier(); /** * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<Object> supportedTypes = new ArrayList<Object>(); /** * This constructs an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AppletItemProviderAdapterFactory() { supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.Applet} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AppletItemProvider appletItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.Applet}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createAppletAdapter() { if (appletItemProvider == null) { appletItemProvider = new AppletItemProvider(this); } return appletItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.OverridesLifecycleMethods} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected OverridesLifecycleMethodsItemProvider overridesLifecycleMethodsItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.OverridesLifecycleMethods}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createOverridesLifecycleMethodsAdapter() { if (overridesLifecycleMethodsItemProvider == null) { overridesLifecycleMethodsItemProvider = new OverridesLifecycleMethodsItemProvider(this); } return overridesLifecycleMethodsItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.Parameter} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ParameterItemProvider parameterItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.Parameter}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createParameterAdapter() { if (parameterItemProvider == null) { parameterItemProvider = new ParameterItemProvider(this); } return parameterItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.ExtendsApplet} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ExtendsAppletItemProvider extendsAppletItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.ExtendsApplet}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createExtendsAppletAdapter() { if (extendsAppletItemProvider == null) { extendsAppletItemProvider = new ExtendsAppletItemProvider(this); } return extendsAppletItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.RegistersMouseListener} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RegistersMouseListenerItemProvider registersMouseListenerItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.RegistersMouseListener}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createRegistersMouseListenerAdapter() { if (registersMouseListenerItemProvider == null) { registersMouseListenerItemProvider = new RegistersMouseListenerItemProvider(this); } return registersMouseListenerItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.RegistersMouseMotionListener} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RegistersMouseMotionListenerItemProvider registersMouseMotionListenerItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.RegistersMouseMotionListener}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createRegistersMouseMotionListenerAdapter() { if (registersMouseMotionListenerItemProvider == null) { registersMouseMotionListenerItemProvider = new RegistersMouseMotionListenerItemProvider(this); } return registersMouseMotionListenerItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.RegistersKeyListener} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RegistersKeyListenerItemProvider registersKeyListenerItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.RegistersKeyListener}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createRegistersKeyListenerAdapter() { if (registersKeyListenerItemProvider == null) { registersKeyListenerItemProvider = new RegistersKeyListenerItemProvider(this); } return registersKeyListenerItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.ThisMouseListener} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ThisMouseListenerItemProvider thisMouseListenerItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.ThisMouseListener}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createThisMouseListenerAdapter() { if (thisMouseListenerItemProvider == null) { thisMouseListenerItemProvider = new ThisMouseListenerItemProvider(this); } return thisMouseListenerItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.ThisMouseMotionListener} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ThisMouseMotionListenerItemProvider thisMouseMotionListenerItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.ThisMouseMotionListener}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createThisMouseMotionListenerAdapter() { if (thisMouseMotionListenerItemProvider == null) { thisMouseMotionListenerItemProvider = new ThisMouseMotionListenerItemProvider(this); } return thisMouseMotionListenerItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.ThisKeyListener} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ThisKeyListenerItemProvider thisKeyListenerItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.ThisKeyListener}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createThisKeyListenerAdapter() { if (thisKeyListenerItemProvider == null) { thisKeyListenerItemProvider = new ThisKeyListenerItemProvider(this); } return thisKeyListenerItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.DeregistersThis} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DeregistersThisItemProvider deregistersThisItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.DeregistersThis}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createDeregistersThisAdapter() { if (deregistersThisItemProvider == null) { deregistersThisItemProvider = new DeregistersThisItemProvider(this); } return deregistersThisItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.MouseListenerField} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MouseListenerFieldItemProvider mouseListenerFieldItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.MouseListenerField}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createMouseListenerFieldAdapter() { if (mouseListenerFieldItemProvider == null) { mouseListenerFieldItemProvider = new MouseListenerFieldItemProvider(this); } return mouseListenerFieldItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.MouseMotionListenerField} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MouseMotionListenerFieldItemProvider mouseMotionListenerFieldItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.MouseMotionListenerField}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createMouseMotionListenerFieldAdapter() { if (mouseMotionListenerFieldItemProvider == null) { mouseMotionListenerFieldItemProvider = new MouseMotionListenerFieldItemProvider(this); } return mouseMotionListenerFieldItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.KeyListenerField} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected KeyListenerFieldItemProvider keyListenerFieldItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.KeyListenerField}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createKeyListenerFieldAdapter() { if (keyListenerFieldItemProvider == null) { keyListenerFieldItemProvider = new KeyListenerFieldItemProvider(this); } return keyListenerFieldItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.AppletModel} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AppletModelItemProvider appletModelItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.AppletModel}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createAppletModelAdapter() { if (appletModelItemProvider == null) { appletModelItemProvider = new AppletModelItemProvider(this); } return appletModelItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.Thread} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ThreadItemProvider threadItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.Thread}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createThreadAdapter() { if (threadItemProvider == null) { threadItemProvider = new ThreadItemProvider(this); } return threadItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.InitializesThread} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected InitializesThreadItemProvider initializesThreadItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.InitializesThread}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createInitializesThreadAdapter() { if (initializesThreadItemProvider == null) { initializesThreadItemProvider = new InitializesThreadItemProvider(this); } return initializesThreadItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.InitializesThreadWith} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected InitializesThreadWithItemProvider initializesThreadWithItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.InitializesThreadWith}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createInitializesThreadWithAdapter() { if (initializesThreadWithItemProvider == null) { initializesThreadWithItemProvider = new InitializesThreadWithItemProvider(this); } return initializesThreadWithItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.InitializesThreadSubclass} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected InitializesThreadSubclassItemProvider initializesThreadSubclassItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.InitializesThreadSubclass}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createInitializesThreadSubclassAdapter() { if (initializesThreadSubclassItemProvider == null) { initializesThreadSubclassItemProvider = new InitializesThreadSubclassItemProvider(this); } return initializesThreadSubclassItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.ThisRunnable} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ThisRunnableItemProvider thisRunnableItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.ThisRunnable}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createThisRunnableAdapter() { if (thisRunnableItemProvider == null) { thisRunnableItemProvider = new ThisRunnableItemProvider(this); } return thisRunnableItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.RunnableField} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RunnableFieldItemProvider runnableFieldItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.RunnableField}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createRunnableFieldAdapter() { if (runnableFieldItemProvider == null) { runnableFieldItemProvider = new RunnableFieldItemProvider(this); } return runnableFieldItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.DeregistersField} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DeregistersFieldItemProvider deregistersFieldItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.DeregistersField}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createDeregistersFieldAdapter() { if (deregistersFieldItemProvider == null) { deregistersFieldItemProvider = new DeregistersFieldItemProvider(this); } return deregistersFieldItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.ShowsStatus} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ShowsStatusItemProvider showsStatusItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.ShowsStatus}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createShowsStatusAdapter() { if (showsStatusItemProvider == null) { showsStatusItemProvider = new ShowsStatusItemProvider(this); } return showsStatusItemProvider; } /** * This keeps track of the one adapter used for all {@link ca.uwaterloo.gsd.applet.SingleTaskThread} instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SingleTaskThreadItemProvider singleTaskThreadItemProvider; /** * This creates an adapter for a {@link ca.uwaterloo.gsd.applet.SingleTaskThread}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter createSingleTaskThreadAdapter() { if (singleTaskThreadItemProvider == null) { singleTaskThreadItemProvider = new SingleTaskThreadItemProvider(this); } return singleTaskThreadItemProvider; } /** * This returns the root adapter factory that contains this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ComposeableAdapterFactory getRootAdapterFactory() { return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); } /** * This sets the composed adapter factory that contains this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { this.parentAdapterFactory = parentAdapterFactory; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean isFactoryForType(Object type) { return supportedTypes.contains(type) || super.isFactoryForType(type); } /** * This implementation substitutes the factory itself as the key for the adapter. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Adapter adapt(Notifier notifier, Object type) { return super.adapt(notifier, this); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object adapt(Object object, Object type) { if (isFactoryForType(type)) { Object adapter = super.adapt(object, type); if (!(type instanceof Class) || (((Class<?>)type).isInstance(adapter))) { return adapter; } } return null; } /** * This adds a listener. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void addListener(INotifyChangedListener notifyChangedListener) { changeNotifier.addListener(notifyChangedListener); } /** * This removes a listener. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void removeListener(INotifyChangedListener notifyChangedListener) { changeNotifier.removeListener(notifyChangedListener); } /** * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void fireNotifyChanged(Notification notification) { changeNotifier.fireNotifyChanged(notification); if (parentAdapterFactory != null) { parentAdapterFactory.fireNotifyChanged(notification); } } /** * This disposes all of the item providers created by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void dispose() { if (appletModelItemProvider != null) appletModelItemProvider.dispose(); if (appletItemProvider != null) appletItemProvider.dispose(); if (overridesLifecycleMethodsItemProvider != null) overridesLifecycleMethodsItemProvider.dispose(); if (parameterItemProvider != null) parameterItemProvider.dispose(); if (extendsAppletItemProvider != null) extendsAppletItemProvider.dispose(); if (registersMouseListenerItemProvider != null) registersMouseListenerItemProvider.dispose(); if (registersMouseMotionListenerItemProvider != null) registersMouseMotionListenerItemProvider.dispose(); if (registersKeyListenerItemProvider != null) registersKeyListenerItemProvider.dispose(); if (thisMouseListenerItemProvider != null) thisMouseListenerItemProvider.dispose(); if (thisMouseMotionListenerItemProvider != null) thisMouseMotionListenerItemProvider.dispose(); if (thisKeyListenerItemProvider != null) thisKeyListenerItemProvider.dispose(); if (deregistersThisItemProvider != null) deregistersThisItemProvider.dispose(); if (mouseListenerFieldItemProvider != null) mouseListenerFieldItemProvider.dispose(); if (mouseMotionListenerFieldItemProvider != null) mouseMotionListenerFieldItemProvider.dispose(); if (keyListenerFieldItemProvider != null) keyListenerFieldItemProvider.dispose(); if (threadItemProvider != null) threadItemProvider.dispose(); if (initializesThreadItemProvider != null) initializesThreadItemProvider.dispose(); if (initializesThreadWithItemProvider != null) initializesThreadWithItemProvider.dispose(); if (initializesThreadSubclassItemProvider != null) initializesThreadSubclassItemProvider.dispose(); if (thisRunnableItemProvider != null) thisRunnableItemProvider.dispose(); if (runnableFieldItemProvider != null) runnableFieldItemProvider.dispose(); if (deregistersFieldItemProvider != null) deregistersFieldItemProvider.dispose(); if (showsStatusItemProvider != null) showsStatusItemProvider.dispose(); if (singleTaskThreadItemProvider != null) singleTaskThreadItemProvider.dispose(); } }