1 17 package org.eclipse.emf.edit.tree.util; 18 19 20 import org.eclipse.emf.common.notify.Adapter; 21 import org.eclipse.emf.common.notify.Notifier; 22 import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; 23 import org.eclipse.emf.ecore.EObject; 24 import org.eclipse.emf.edit.tree.*; 25 26 27 35 public class TreeAdapterFactory extends AdapterFactoryImpl 36 { 37 38 44 protected static TreePackage modelPackage; 45 46 52 public TreeAdapterFactory() 53 { 54 if (modelPackage == null) 55 { 56 modelPackage = TreePackage.eINSTANCE; 57 } 58 } 59 60 68 public boolean isFactoryForType(Object object) 69 { 70 if (object == modelPackage) 71 { 72 return true; 73 } 74 if (object instanceof EObject) 75 { 76 return ((EObject)object).eClass().getEPackage() == modelPackage; 77 } 78 return false; 79 } 80 81 87 protected TreeSwitch modelSwitch = 88 new TreeSwitch() 89 { 90 public Object caseTreeNode(TreeNode object) 91 { 92 return createTreeNodeAdapter(); 93 } 94 public Object defaultCase(EObject object) 95 { 96 return createEObjectAdapter(); 97 } 98 }; 99 100 108 public Adapter createAdapter(Notifier target) 109 { 110 return (Adapter)modelSwitch.doSwitch((EObject)target); 111 } 112 113 114 124 public Adapter createTreeNodeAdapter() 125 { 126 return null; 127 } 128 129 137 public Adapter createEObjectAdapter() 138 { 139 return null; 140 } 141 142 } | Popular Tags |