1 7 package Olj.provider; 8 9 import Olj.util.OljAdapterFactory; 10 11 import java.util.ArrayList ; 12 import java.util.Collection ; 13 14 import org.eclipse.emf.common.notify.Adapter; 15 import org.eclipse.emf.common.notify.Notification; 16 import org.eclipse.emf.common.notify.Notifier; 17 18 import org.eclipse.emf.edit.provider.ChangeNotifier; 19 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 20 import org.eclipse.emf.edit.provider.ComposedAdapterFactory; 21 import org.eclipse.emf.edit.provider.IChangeNotifier; 22 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 23 import org.eclipse.emf.edit.provider.IItemLabelProvider; 24 import org.eclipse.emf.edit.provider.IItemPropertySource; 25 import org.eclipse.emf.edit.provider.INotifyChangedListener; 26 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 27 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 28 29 38 public class OljItemProviderAdapterFactory extends OljAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier { 39 45 protected ComposedAdapterFactory parentAdapterFactory; 46 47 53 protected IChangeNotifier changeNotifier = new ChangeNotifier(); 54 55 61 protected Collection supportedTypes = new ArrayList (); 62 63 69 public OljItemProviderAdapterFactory() { 70 supportedTypes.add(IStructuredItemContentProvider.class); 71 supportedTypes.add(ITreeItemContentProvider.class); 72 supportedTypes.add(IItemPropertySource.class); 73 supportedTypes.add(IEditingDomainItemProvider.class); 74 supportedTypes.add(IItemLabelProvider.class); 75 } 76 77 83 protected ConstantColumnsTypeItemProvider constantColumnsTypeItemProvider; 84 85 91 public Adapter createConstantColumnsTypeAdapter() { 92 if (constantColumnsTypeItemProvider == null) { 93 constantColumnsTypeItemProvider = new ConstantColumnsTypeItemProvider(this); 94 } 95 96 return constantColumnsTypeItemProvider; 97 } 98 99 105 protected ConstantColumnTypeItemProvider constantColumnTypeItemProvider; 106 107 113 public Adapter createConstantColumnTypeAdapter() { 114 if (constantColumnTypeItemProvider == null) { 115 constantColumnTypeItemProvider = new ConstantColumnTypeItemProvider(this); 116 } 117 118 return constantColumnTypeItemProvider; 119 } 120 121 127 protected CopyTableTypeItemProvider copyTableTypeItemProvider; 128 129 135 public Adapter createCopyTableTypeAdapter() { 136 if (copyTableTypeItemProvider == null) { 137 copyTableTypeItemProvider = new CopyTableTypeItemProvider(this); 138 } 139 140 return copyTableTypeItemProvider; 141 } 142 143 149 protected CounterColumnsTypeItemProvider counterColumnsTypeItemProvider; 150 151 157 public Adapter createCounterColumnsTypeAdapter() { 158 if (counterColumnsTypeItemProvider == null) { 159 counterColumnsTypeItemProvider = new CounterColumnsTypeItemProvider(this); 160 } 161 162 return counterColumnsTypeItemProvider; 163 } 164 165 171 protected CounterColumnTypeItemProvider counterColumnTypeItemProvider; 172 173 179 public Adapter createCounterColumnTypeAdapter() { 180 if (counterColumnTypeItemProvider == null) { 181 counterColumnTypeItemProvider = new CounterColumnTypeItemProvider(this); 182 } 183 184 return counterColumnTypeItemProvider; 185 } 186 187 193 protected DefinitionIncludeTypeItemProvider definitionIncludeTypeItemProvider; 194 195 201 public Adapter createDefinitionIncludeTypeAdapter() { 202 if (definitionIncludeTypeItemProvider == null) { 203 definitionIncludeTypeItemProvider = new DefinitionIncludeTypeItemProvider(this); 204 } 205 206 return definitionIncludeTypeItemProvider; 207 } 208 209 215 protected DocumentRootItemProvider documentRootItemProvider; 216 217 223 public Adapter createDocumentRootAdapter() { 224 if (documentRootItemProvider == null) { 225 documentRootItemProvider = new DocumentRootItemProvider(this); 226 } 227 228 return documentRootItemProvider; 229 } 230 231 237 protected EchoTypeItemProvider echoTypeItemProvider; 238 239 245 public Adapter createEchoTypeAdapter() { 246 if (echoTypeItemProvider == null) { 247 echoTypeItemProvider = new EchoTypeItemProvider(this); 248 } 249 250 return echoTypeItemProvider; 251 } 252 253 259 protected ImportDefinitionTypeItemProvider importDefinitionTypeItemProvider; 260 261 267 public Adapter createImportDefinitionTypeAdapter() { 268 if (importDefinitionTypeItemProvider == null) { 269 importDefinitionTypeItemProvider = new ImportDefinitionTypeItemProvider(this); 270 } 271 272 return importDefinitionTypeItemProvider; 273 } 274 275 281 protected IncludeTypeItemProvider includeTypeItemProvider; 282 283 289 public Adapter createIncludeTypeAdapter() { 290 if (includeTypeItemProvider == null) { 291 includeTypeItemProvider = new IncludeTypeItemProvider(this); 292 } 293 294 return includeTypeItemProvider; 295 } 296 297 303 protected JavaScriptTypeItemProvider javaScriptTypeItemProvider; 304 305 311 public Adapter createJavaScriptTypeAdapter() { 312 if (javaScriptTypeItemProvider == null) { 313 javaScriptTypeItemProvider = new JavaScriptTypeItemProvider(this); 314 } 315 316 return javaScriptTypeItemProvider; 317 } 318 319 325 protected JdbcDefaultParametersTypeItemProvider jdbcDefaultParametersTypeItemProvider; 326 327 333 public Adapter createJdbcDefaultParametersTypeAdapter() { 334 if (jdbcDefaultParametersTypeItemProvider == null) { 335 jdbcDefaultParametersTypeItemProvider = new JdbcDefaultParametersTypeItemProvider(this); 336 } 337 338 return jdbcDefaultParametersTypeItemProvider; 339 } 340 341 347 protected JdbcParametersTypeItemProvider jdbcParametersTypeItemProvider; 348 349 355 public Adapter createJdbcParametersTypeAdapter() { 356 if (jdbcParametersTypeItemProvider == null) { 357 jdbcParametersTypeItemProvider = new JdbcParametersTypeItemProvider(this); 358 } 359 360 return jdbcParametersTypeItemProvider; 361 } 362 363 369 protected JdbcSourceParametersTypeItemProvider jdbcSourceParametersTypeItemProvider; 370 371 377 public Adapter createJdbcSourceParametersTypeAdapter() { 378 if (jdbcSourceParametersTypeItemProvider == null) { 379 jdbcSourceParametersTypeItemProvider = new JdbcSourceParametersTypeItemProvider(this); 380 } 381 382 return jdbcSourceParametersTypeItemProvider; 383 } 384 385 391 protected JdbcSourceParameterTypeItemProvider jdbcSourceParameterTypeItemProvider; 392 393 399 public Adapter createJdbcSourceParameterTypeAdapter() { 400 if (jdbcSourceParameterTypeItemProvider == null) { 401 jdbcSourceParameterTypeItemProvider = new JdbcSourceParameterTypeItemProvider(this); 402 } 403 404 return jdbcSourceParameterTypeItemProvider; 405 } 406 407 413 protected JdbcSourceTargetParametersTypeItemProvider jdbcSourceTargetParametersTypeItemProvider; 414 415 421 public Adapter createJdbcSourceTargetParametersTypeAdapter() { 422 if (jdbcSourceTargetParametersTypeItemProvider == null) { 423 jdbcSourceTargetParametersTypeItemProvider = new JdbcSourceTargetParametersTypeItemProvider(this); 424 } 425 426 return jdbcSourceTargetParametersTypeItemProvider; 427 } 428 429 435 protected JdbcTargetParametersTypeItemProvider jdbcTargetParametersTypeItemProvider; 436 437 443 public Adapter createJdbcTargetParametersTypeAdapter() { 444 if (jdbcTargetParametersTypeItemProvider == null) { 445 jdbcTargetParametersTypeItemProvider = new JdbcTargetParametersTypeItemProvider(this); 446 } 447 448 return jdbcTargetParametersTypeItemProvider; 449 } 450 451 457 protected JdbcTargetParameterTypeItemProvider jdbcTargetParameterTypeItemProvider; 458 459 465 public Adapter createJdbcTargetParameterTypeAdapter() { 466 if (jdbcTargetParameterTypeItemProvider == null) { 467 jdbcTargetParameterTypeItemProvider = new JdbcTargetParameterTypeItemProvider(this); 468 } 469 470 return jdbcTargetParameterTypeItemProvider; 471 } 472 473 479 protected LoaderJobTypeItemProvider loaderJobTypeItemProvider; 480 481 487 public Adapter createLoaderJobTypeAdapter() { 488 if (loaderJobTypeItemProvider == null) { 489 loaderJobTypeItemProvider = new LoaderJobTypeItemProvider(this); 490 } 491 492 return loaderJobTypeItemProvider; 493 } 494 495 501 protected RelationColumnsTypeItemProvider relationColumnsTypeItemProvider; 502 503 509 public Adapter createRelationColumnsTypeAdapter() { 510 if (relationColumnsTypeItemProvider == null) { 511 relationColumnsTypeItemProvider = new RelationColumnsTypeItemProvider(this); 512 } 513 514 return relationColumnsTypeItemProvider; 515 } 516 517 523 protected RelationColumnTypeItemProvider relationColumnTypeItemProvider; 524 525 531 public Adapter createRelationColumnTypeAdapter() { 532 if (relationColumnTypeItemProvider == null) { 533 relationColumnTypeItemProvider = new RelationColumnTypeItemProvider(this); 534 } 535 536 return relationColumnTypeItemProvider; 537 } 538 539 545 protected RestartCounterTypeItemProvider restartCounterTypeItemProvider; 546 547 553 public Adapter createRestartCounterTypeAdapter() { 554 if (restartCounterTypeItemProvider == null) { 555 restartCounterTypeItemProvider = new RestartCounterTypeItemProvider(this); 556 } 557 558 return restartCounterTypeItemProvider; 559 } 560 561 567 protected SortColumnsTypeItemProvider sortColumnsTypeItemProvider; 568 569 575 public Adapter createSortColumnsTypeAdapter() { 576 if (sortColumnsTypeItemProvider == null) { 577 sortColumnsTypeItemProvider = new SortColumnsTypeItemProvider(this); 578 } 579 580 return sortColumnsTypeItemProvider; 581 } 582 583 589 protected SortColumnTypeItemProvider sortColumnTypeItemProvider; 590 591 597 public Adapter createSortColumnTypeAdapter() { 598 if (sortColumnTypeItemProvider == null) { 599 sortColumnTypeItemProvider = new SortColumnTypeItemProvider(this); 600 } 601 602 return sortColumnTypeItemProvider; 603 } 604 605 611 protected SourceColumnsTypeItemProvider sourceColumnsTypeItemProvider; 612 613 619 public Adapter createSourceColumnsTypeAdapter() { 620 if (sourceColumnsTypeItemProvider == null) { 621 sourceColumnsTypeItemProvider = new SourceColumnsTypeItemProvider(this); 622 } 623 624 return sourceColumnsTypeItemProvider; 625 } 626 627 633 protected SourceColumnTypeItemProvider sourceColumnTypeItemProvider; 634 635 641 public Adapter createSourceColumnTypeAdapter() { 642 if (sourceColumnTypeItemProvider == null) { 643 sourceColumnTypeItemProvider = new SourceColumnTypeItemProvider(this); 644 } 645 646 return sourceColumnTypeItemProvider; 647 } 648 649 655 protected SqlStmtTypeItemProvider sqlStmtTypeItemProvider; 656 657 663 public Adapter createSqlStmtTypeAdapter() { 664 if (sqlStmtTypeItemProvider == null) { 665 sqlStmtTypeItemProvider = new SqlStmtTypeItemProvider(this); 666 } 667 668 return sqlStmtTypeItemProvider; 669 } 670 671 677 protected SqlTypeItemProvider sqlTypeItemProvider; 678 679 685 public Adapter createSqlTypeAdapter() { 686 if (sqlTypeItemProvider == null) { 687 sqlTypeItemProvider = new SqlTypeItemProvider(this); 688 } 689 690 return sqlTypeItemProvider; 691 } 692 693 699 protected SubCounterColumnTypeItemProvider subCounterColumnTypeItemProvider; 700 701 707 public Adapter createSubCounterColumnTypeAdapter() { 708 if (subCounterColumnTypeItemProvider == null) { 709 subCounterColumnTypeItemProvider = new SubCounterColumnTypeItemProvider(this); 710 } 711 712 return subCounterColumnTypeItemProvider; 713 } 714 715 721 protected SubCounterKeyColumnTypeItemProvider subCounterKeyColumnTypeItemProvider; 722 723 729 public Adapter createSubCounterKeyColumnTypeAdapter() { 730 if (subCounterKeyColumnTypeItemProvider == null) { 731 subCounterKeyColumnTypeItemProvider = new SubCounterKeyColumnTypeItemProvider(this); 732 } 733 734 return subCounterKeyColumnTypeItemProvider; 735 } 736 737 743 protected TablesTypeItemProvider tablesTypeItemProvider; 744 745 751 public Adapter createTablesTypeAdapter() { 752 if (tablesTypeItemProvider == null) { 753 tablesTypeItemProvider = new TablesTypeItemProvider(this); 754 } 755 756 return tablesTypeItemProvider; 757 } 758 759 765 protected TableTypeItemProvider tableTypeItemProvider; 766 767 773 public Adapter createTableTypeAdapter() { 774 if (tableTypeItemProvider == null) { 775 tableTypeItemProvider = new TableTypeItemProvider(this); 776 } 777 778 return tableTypeItemProvider; 779 } 780 781 787 protected TargetColumnsTypeItemProvider targetColumnsTypeItemProvider; 788 789 795 public Adapter createTargetColumnsTypeAdapter() { 796 if (targetColumnsTypeItemProvider == null) { 797 targetColumnsTypeItemProvider = new TargetColumnsTypeItemProvider(this); 798 } 799 800 return targetColumnsTypeItemProvider; 801 } 802 803 809 protected TargetColumnTypeItemProvider targetColumnTypeItemProvider; 810 811 817 public Adapter createTargetColumnTypeAdapter() { 818 if (targetColumnTypeItemProvider == null) { 819 targetColumnTypeItemProvider = new TargetColumnTypeItemProvider(this); 820 } 821 822 return targetColumnTypeItemProvider; 823 } 824 825 831 protected TimeStampColumnTypeItemProvider timeStampColumnTypeItemProvider; 832 833 839 public Adapter createTimeStampColumnTypeAdapter() { 840 if (timeStampColumnTypeItemProvider == null) { 841 timeStampColumnTypeItemProvider = new TimeStampColumnTypeItemProvider(this); 842 } 843 844 return timeStampColumnTypeItemProvider; 845 } 846 847 853 protected TransformationsTypeItemProvider transformationsTypeItemProvider; 854 855 861 public Adapter createTransformationsTypeAdapter() { 862 if (transformationsTypeItemProvider == null) { 863 transformationsTypeItemProvider = new TransformationsTypeItemProvider(this); 864 } 865 866 return transformationsTypeItemProvider; 867 } 868 869 875 protected TransformationTypeItemProvider transformationTypeItemProvider; 876 877 883 public Adapter createTransformationTypeAdapter() { 884 if (transformationTypeItemProvider == null) { 885 transformationTypeItemProvider = new TransformationTypeItemProvider(this); 886 } 887 888 return transformationTypeItemProvider; 889 } 890 891 897 protected UserIDColumnTypeItemProvider userIDColumnTypeItemProvider; 898 899 905 public Adapter createUserIDColumnTypeAdapter() { 906 if (userIDColumnTypeItemProvider == null) { 907 userIDColumnTypeItemProvider = new UserIDColumnTypeItemProvider(this); 908 } 909 910 return userIDColumnTypeItemProvider; 911 } 912 913 919 protected ValueColumnsTypeItemProvider valueColumnsTypeItemProvider; 920 921 927 public Adapter createValueColumnsTypeAdapter() { 928 if (valueColumnsTypeItemProvider == null) { 929 valueColumnsTypeItemProvider = new ValueColumnsTypeItemProvider(this); 930 } 931 932 return valueColumnsTypeItemProvider; 933 } 934 935 941 protected ValueColumnTypeItemProvider valueColumnTypeItemProvider; 942 943 949 public Adapter createValueColumnTypeAdapter() { 950 if (valueColumnTypeItemProvider == null) { 951 valueColumnTypeItemProvider = new ValueColumnTypeItemProvider(this); 952 } 953 954 return valueColumnTypeItemProvider; 955 } 956 957 963 protected VariableColumnsTypeItemProvider variableColumnsTypeItemProvider; 964 965 971 public Adapter createVariableColumnsTypeAdapter() { 972 if (variableColumnsTypeItemProvider == null) { 973 variableColumnsTypeItemProvider = new VariableColumnsTypeItemProvider(this); 974 } 975 976 return variableColumnsTypeItemProvider; 977 } 978 979 985 protected VariableColumnTypeItemProvider variableColumnTypeItemProvider; 986 987 993 public Adapter createVariableColumnTypeAdapter() { 994 if (variableColumnTypeItemProvider == null) { 995 variableColumnTypeItemProvider = new VariableColumnTypeItemProvider(this); 996 } 997 998 return variableColumnTypeItemProvider; 999 } 1000 1001 1007 protected VariablesTypeItemProvider variablesTypeItemProvider; 1008 1009 1015 public Adapter createVariablesTypeAdapter() { 1016 if (variablesTypeItemProvider == null) { 1017 variablesTypeItemProvider = new VariablesTypeItemProvider(this); 1018 } 1019 1020 return variablesTypeItemProvider; 1021 } 1022 1023 1029 protected VariableTypeItemProvider variableTypeItemProvider; 1030 1031 1037 public Adapter createVariableTypeAdapter() { 1038 if (variableTypeItemProvider == null) { 1039 variableTypeItemProvider = new VariableTypeItemProvider(this); 1040 } 1041 1042 return variableTypeItemProvider; 1043 } 1044 1045 1051 public ComposeableAdapterFactory getRootAdapterFactory() { 1052 return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); 1053 } 1054 1055 1061 public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { 1062 this.parentAdapterFactory = parentAdapterFactory; 1063 } 1064 1065 1070 public boolean isFactoryForType(Object type) { 1071 return supportedTypes.contains(type) || super.isFactoryForType(type); 1072 } 1073 1074 1080 public Adapter adapt(Notifier notifier, Object type) { 1081 return super.adapt(notifier, this); 1082 } 1083 1084 1089 public Object adapt(Object object, Object type) { 1090 if (isFactoryForType(type)) { 1091 Object adapter = super.adapt(object, type); 1092 if (!(type instanceof Class ) || (((Class )type).isInstance(adapter))) { 1093 return adapter; 1094 } 1095 } 1096 1097 return null; 1098 } 1099 1100 1106 public void addListener(INotifyChangedListener notifyChangedListener) { 1107 changeNotifier.addListener(notifyChangedListener); 1108 } 1109 1110 1116 public void removeListener(INotifyChangedListener notifyChangedListener) { 1117 changeNotifier.removeListener(notifyChangedListener); 1118 } 1119 1120 1126 public void fireNotifyChanged(Notification notification) { 1127 changeNotifier.fireNotifyChanged(notification); 1128 1129 if (parentAdapterFactory != null) { 1130 parentAdapterFactory.fireNotifyChanged(notification); 1131 } 1132 } 1133 1134} 1135 | Popular Tags |